[ 
https://issues.apache.org/jira/browse/ARTEMIS-1190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16031371#comment-16031371
 ] 

ASF subversion and git services commented on ARTEMIS-1190:
----------------------------------------------------------

Commit dc795dc564eff29b58f4de5199168800476a9f88 in activemq-artemis's branch 
refs/heads/1.x from [~eduda]
[ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=dc795dc ]

ARTEMIS-1190 Long/int type mismatch in JDBCSequentialFile.setWritePosition

(cherry picked from commit 69740a987d580c994a287ba533ae34d1bad407f1)


> Long/int type mismatch in JDBCSequentialFile.setWritePosition
> -------------------------------------------------------------
>
>                 Key: ARTEMIS-1190
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1190
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 1.5.5, 2.1.0
>            Reporter: Erich Duda
>
> In the {{JDBCSequentialFile.setWritePosition}} there is mismatch between 
> types. The parameter of the method has type {{int}} but the private field has 
> type {{long}}.
> {code:java}
> private long writePosition = 0;
> void setWritePosition(int writePosition) {
>    this.writePosition = writePosition;
> }
> {code}
> Because of this in {{JDBCSequentialFileFactoryDriver.loadFile}} the long is 
> unnecessarily retype to int.
> {code:java}
> public void loadFile(JDBCSequentialFile file) throws SQLException {
>     synchronized (connection) {
>        connection.setAutoCommit(false);
>        readLargeObject.setLong(1, file.getId());
>        try (ResultSet rs = readLargeObject.executeQuery()) {
>           if (rs.next()) {
>              Blob blob = rs.getBlob(1);
>              if (blob != null) {
>                 file.setWritePosition((int) blob.length());
>              } else {
>                 logger.warn("ERROR NO BLOB FOR FILE" + "File: " + 
> file.getFileName() + " " + file.getId());
>              }
>           }
>           connection.commit();
>        } catch (SQLException e) {
>           connection.rollback();
>           throw e;
>        }
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to