[ https://issues.apache.org/jira/browse/ARTEMIS-1190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16030309#comment-16030309 ]
ASF GitHub Bot commented on ARTEMIS-1190: ----------------------------------------- Github user asfgit closed the pull request at: https://github.com/apache/activemq-artemis/pull/1302 > 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)