[x3d-public] bug in X3D Java SAI. comparing string arrays
yottzumm at gmail.com
yottzumm at gmail.com
Tue Jan 3 20:01:12 PST 2017
The following code shows the problem with comparing string arrays. The equals returns false, so the exception is thrown.
Please revamp this code, then apply to stylesheet code to create better SAI.
John
package org;
import java.util.*;
public class X3DObject {
public static final ArrayList<String> JUSTIFY_MIDDLE_MIDDLE = new ArrayList<>(Arrays.asList("\"MIDDLE\",\"MIDDLE\""));
public X3DObject() {
}
public void setStringArray(String [] array) throws Exception {
if (!(Arrays.asList(array).equals(JUSTIFY_MIDDLE_MIDDLE))) {
throw new Exception("Illegal "+ Arrays.toString(array));
}
}
public static void main(String [] args) throws Exception {
new X3DObject().setStringArray(new String[] {"MIDDLE", "MIDDLE"});
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170103/8875639a/attachment-0001.html>
More information about the x3d-public
mailing list