Commit 1e9c9fd
committed
JavaEngine: fix critical buffering bug
This fixes Fiji bug #1029:
http://fiji.sc/bugzilla/show_bug.cgi?id=1029
The CharBuffer has a position which does not get reset, and so length()
returns 0 even when there is data in subsequent read passes. We avoid
the issue by using a simple char[] instead of a new-fangled "object".
Without this change, Java scripts longer than 1024 characters will
produce exceptions like:
java.lang.IndexOutOfBoundsException: start 0, end 582, s.length() 442
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:453)
at java.lang.StringBuilder.append(StringBuilder.java:179)
at org.scijava.plugins.scripting.java.JavaEngine.getReaderContentsAsString(JavaEngine.java:904)
at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:169)1 parent 75731c9 commit 1e9c9fd
File tree
1 file changed
+1
-2
lines changed- src/main/java/org/scijava/plugins/scripting/java
1 file changed
+1
-2
lines changedLines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
| |||
896 | 895 | | |
897 | 896 | | |
898 | 897 | | |
899 | | - | |
| 898 | + | |
900 | 899 | | |
901 | 900 | | |
902 | 901 | | |
| |||
0 commit comments