You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@crail.apache.org by pe...@apache.org on 2021/06/24 14:04:25 UTC
[incubator-crail] branch master updated: Interpret only valid
entries of internalBuf of DirectoryInputStream
This is an automated email from the ASF dual-hosted git repository.
pepperjo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-crail.git
The following commit(s) were added to refs/heads/master by this push:
new 5ee9886 Interpret only valid entries of internalBuf of DirectoryInputStream
5ee9886 is described below
commit 5ee9886f2553ce53998bcbcc556637326877c32e
Author: Bernard Metzler <bm...@zurich.ibm.com>
AuthorDate: Wed Jun 16 15:11:30 2021 +0200
Interpret only valid entries of internalBuf of DirectoryInputStream
Signed-off-by: Bernard Metzler <bm...@zurich.ibm.com>
---
.../src/main/java/org/apache/crail/core/DirectoryRecord.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/client/src/main/java/org/apache/crail/core/DirectoryRecord.java b/client/src/main/java/org/apache/crail/core/DirectoryRecord.java
index a975047..e15c6f7 100644
--- a/client/src/main/java/org/apache/crail/core/DirectoryRecord.java
+++ b/client/src/main/java/org/apache/crail/core/DirectoryRecord.java
@@ -54,10 +54,14 @@ public class DirectoryRecord {
int tmplimit = buffer.position() + CrailConstants.DIRECTORY_RECORD;
buffer.limit(tmplimit);
valid = buffer.getInt();
- int length = buffer.getInt();
- byte barray[] = new byte[length];
- buffer.get(barray);
- filename = new String(barray);
+ if (valid == 1) {
+ int length = buffer.getInt();
+ byte barray[] = new byte[length];
+ buffer.get(barray);
+ filename = new String(barray);
+ } else {
+ filename = null;
+ }
buffer.position(tmplimit);
buffer.limit(oldlimit);
}