Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,8 @@ int getTag(FsInode inode, String tagName, byte[] data, int offset, int len)
/* some databases (hsqldb in particular) fill a full record for
* BLOBs and on read reads a full record, which is not what we expect.
*/
return in.readNBytes(data, offset,
// If tag is not set or NULL, then getBinaryStream will return null.
return in == null ? 0 : in.readNBytes(data, offset,
Math.min(len, (int) rs.getLong("isize")));
} catch (IOException e) {
throw new LobRetrievalFailureException(e.getMessage(), e);
Expand Down
10 changes: 10 additions & 0 deletions modules/chimera/src/test/java/org/dcache/chimera/JdbcFsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,16 @@ public void testPushTag() throws Exception {
assertArrayEquals(new String[]{tagName}, _fs.tags(d));
}

@Test
public void testReadNullTag() throws Exception {

FsInode top = _rootInode.mkdir("top");
_fs.createTag(top, "aTag");

int n = _fs.getTag(top, "aTag", new byte[10], 0, 10);
assertThat("Tag without content should return zero bytes", n, is(0));
}

@Test
public void testTashTimestampOnRemove() throws Exception {
final String name = "testTashTimestampOnRemove";
Expand Down
Loading