-
- Downloads
- added file handle closing (base https://github.com/ExLibrisGroup/Rosetta.CustomNFSStoragePlugin)
... | @@ -87,7 +87,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { | ... | @@ -87,7 +87,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { |
boolean result = true; | boolean result = true; | ||
if (fixities != null) | if (fixities != null) | ||
{ | { | ||
InputStream is; | InputStream is = null; | ||
|
|||
try { | try { | ||
is = retrieveEntity(storedEntityIdentifier, isRelativePath); | is = retrieveEntity(storedEntityIdentifier, isRelativePath); | ||
Checksummer checksummer = new Checksummer(is, true, true, true,true); | Checksummer checksummer = new Checksummer(is, true, true, true,true); | ||
... | @@ -132,6 +132,13 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { | ... | @@ -132,6 +132,13 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { |
finally | finally | ||
{ | { | ||
// log.info("SLUBStoragePlugin.checkFixity() finally called"); | // log.info("SLUBStoragePlugin.checkFixity() finally called"); | ||
if (is != null) { | |||
try { | |||
is.close(); | |||
} catch (Exception e) { | |||
log.warn("SLUBStoragePlugin.checkFixity(), failed closing file, " + e.getMessage()); | |||
} | |||
} | |||
} | } | ||
} | } | ||
return result; | return result; | ||
... | @@ -242,7 +249,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { | ... | @@ -242,7 +249,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { |
{ | { | ||
log.info("SLUBStoragePlugin.retrieveEntitybyRange() with '" + storedEntityIdentifier + "' start=" + start + " end=" + end); | log.info("SLUBStoragePlugin.retrieveEntitybyRange() with '" + storedEntityIdentifier + "' start=" + start + " end=" + end); | ||
byte[] bytes = new byte[(int)(end - start + 1L)]; | byte[] bytes = new byte[(int)(end - start + 1L)]; | ||
RandomAccessFile file; | RandomAccessFile file = null; | ||
try | try | ||
{ | { | ||
file = new RandomAccessFile(this.parameters.get("DIR_ROOT") + storedEntityIdentifier, "r"); | file = new RandomAccessFile(this.parameters.get("DIR_ROOT") + storedEntityIdentifier, "r"); | ||
... | @@ -264,6 +271,13 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { | ... | @@ -264,6 +271,13 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { |
finally | finally | ||
{ | { | ||
// log.info("SLUBStoragePlugin.retrieveEntityByRange() finally called"); | // log.info("SLUBStoragePlugin.retrieveEntityByRange() finally called"); | ||
if (file != null) { | |||
try { | |||
file.close(); | |||
} catch (Exception e) { | |||
log.warn("SLUBStoragePlugin.retrieveEntitybyRange(), failed closing file, " + e.getMessage()); | |||
} | |||
} | |||
} | } | ||
return bytes; | return bytes; | ||
} | } | ||
... | ... |