Skip to content

Commit 3db4bc5

Browse files
Tobias RichterTobias Richter
Tobias Richter
authored and
Tobias Richter
committed
handle attribute length better
1 parent 131ce7f commit 3db4bc5

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

bindings/java/org/nexusformat/NexusFile.java

+4-9
Original file line numberDiff line numberDiff line change
@@ -541,20 +541,15 @@ public Hashtable attrdir() throws NexusException {
541541
int rank = args[0];
542542
int type = args[1];
543543
String name = names[0];
544+
int length = 1;
544545
int[] thedims = new int[rank];
545546
for(int i = 0 ; i < rank ; i++) {
546-
thedims[i] = dim[i];
547+
thedims[i] = dim[i];
548+
length *= dim[i];
547549
}
548-
549550
at = new AttributeEntry();
550551
at.dim = thedims;
551-
if (rank == 0) {
552-
at.length = 1;
553-
} if (rank == 1) {
554-
at.length = dim[0];
555-
} else {
556-
at.length = 0;
557-
}
552+
at.length = length;
558553
at.type = type;
559554
h.put(name, at);
560555
}

0 commit comments

Comments
 (0)