You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Martyn Taylor (JIRA)" <ji...@apache.org> on 2018/02/26 17:04:05 UTC
[jira] [Resolved] (ARTEMIS-1190) Long/int type mismatch in
JDBCSequentialFile.setWritePosition
[ https://issues.apache.org/jira/browse/ARTEMIS-1190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martyn Taylor resolved ARTEMIS-1190.
------------------------------------
Resolution: Fixed
> 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
> Priority: Major
> Fix For: 2.2.0, 1.6.0
>
>
> 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
(v7.6.3#76005)