[x3d-public] These 3 X3DJSAIL programs compile, but they throw warnings.
John Carlson
yottzumm at gmail.com
Wed Jun 25 03:21:00 PDT 2025
Don,
Suggestion: do the replace() you do on the input on the constants as well,
before comparing with equals.
I haven’t checked the constants.
John
On Tue, Jun 24, 2025 at 11:35 AM Don Brutzman <don.brutzman at gmail.com>
wrote:
> John, thanks for the excellent issue report.
>
> Diagnosis: the problem is in how X3DJSAIL Layout.java setAlign() method is
> evaluating the string pair. Instead of pairwise comparison with quotes
> included, it is performing unquoted single-string comparisons to quoted
> string pairs. Those (apples versus oranges) don't match, so the error
> results. Autogenerated source-code excerpts:
>
> /** MFString field named <i>align</i> with X3DUOM simpleType
> <i>layoutAlignChoices</i> and with X3DUOM baseType <i>MFString</i> is an
> array that can only include one set of the quoted enumeration values
> <i>"\"LEFT\" \"BOTTOM\""</i> (Java syntax) or <i>'"LEFT" "BOTTOM"'</i> (XML
> syntax).
> * @see <a href="
> https://web3d.org/specifications/X3dSchemaDocumentation4.0/x3d-4.0_layoutAlignChoices.html">XML
> Schema: layoutAlignChoices</a> */
> public static final String ALIGN_LEFT_BOTTOM = "\"LEFT\" \"BOTTOM\"";
>
>
> then under setAlign() method, the erroneous test:
>
> if (!(
> (newValue.length == 0) ||
> newValue[i].toString().replace("\"","").equals(ALIGN_LEFT_BOTTOM) ||
> newValue[i].toString().replace("\"","").equals(ALIGN_LEFT_CENTER) ||
> newValue[i].toString().replace("\"","").equals(ALIGN_LEFT_TOP) ||
> newValue[i].toString().replace("\"","").equals(ALIGN_CENTER_BOTTOM) ||
> newValue[i].toString().replace("\"","").equals(ALIGN_CENTER_CENTER) ||
> newValue[i].toString().replace("\"","").equals(ALIGN_CENTER_TOP) ||
> newValue[i].toString().replace("\"","").equals(ALIGN_RIGHT_BOTTOM) ||
> newValue[i].toString().replace("\"","").equals(ALIGN_RIGHT_CENTER) ||
> newValue[i].toString().replace("\"","").equals(ALIGN_RIGHT_TOP)))
>
>
> Note that this is a little trickier than usual because Layout node only
> allows certain paired combinations:
>
> - X3D 4.0 Architecture, clause 36 Layout component, 36.4.1 Layout
> -
> https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/components/layout.html#Layout
> -
>
> Layout : X3DLayoutNode {
> MFString [in,out] align ["CENTER","CENTER"] ["LEFT"|"CENTER"|"RIGHT"],["BOTTOM"|"CENTER"|"TOP"]
>
> -
>
> The values of the *align*, *offset*, and *offsetUnits* fields are used to determine the location of the layout region. First, the *align* field values align the sized rectangle to an edge or center of the parent rectangle. Then, the offset is applied using the units specified in the *offsetUnits* field. The first value of the *align* field corresponds to the horizontal alignment. The value "LEFT" specifies that the left side of this rectangle shall be aligned with the left side of the parent rectangle. The value "RIGHT" specifies that the right side of this rectangle shall be aligned with the right side of the parent rectangle. The value "CENTER" specifies that this rectangle shall be horizontally centred in its parent. Similarly, the second *align* field value aligns the vertical position of the rectangle to either the "TOP", "BOTTOM" or "CENTER" of the parent rectangle.
>
>
>
> I'll have to work out a better code pattern for this special test. Will
> work on it.
>
> For ongoing QA unit testing, am adding the following to the smoke-test
> Hello World Program:
>
> Layout layout = new Layout();
> layout.setAlign(new MFString("\"LEFT\",\"BOTTOM\"")); // or
> layout.setAlign(new java.lang.String[] {"LEFT","BOTTOM"});
> System.out.println("layout.getAlign=" +
> layout.getAlignString());
>
> // TODO simpler MFString constructor that accepts an
> arbitrary-length series of String values
>
> all the best, Don
>
>
> On Tue, Jun 24, 2025 at 4:49 AM John Carlson via x3d-public <
> x3d-public at web3d.org> wrote:
>
>> Forgot X3D-Edit QA. But even that is a bit strange.
>>
>> On Tue, Jun 24, 2025 at 6:31 AM John Carlson <yottzumm at gmail.com> wrote:
>>
>>> Three strange exceptions. They compile, but throw warnings when run.
>>>
>>> Java code is attached.
>>>
>>> Apologies for not researching this more.
>>>
>>> Note that this is my own X3DJSAIL, so one's results may be different.
>>>
>>>
>>> javac -proc:full -J-Xss1g -J-Xmx4g bumpyfreewrljsonverse.java
>>> javac -proc:full -J-Xss1g -J-Xmx4g bumpyfreewrlsliders.java
>>> javac -proc:full -J-Xss1g -J-Xmx4g bumpyx_itesliders.java
>>>
>>> java -Xss1g -Xmx4g net/coderextreme/data/bumpyfreewrljsonverse
>>> [warning] Layout align newValue='[LEFT, BOTTOM]' includes an
>>> unrecognized optional value newValue[0]=LEFT not matching any of the
>>> required enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException:
>>> [warning] Layout align newValue='[LEFT, BOTTOM]' includes an unrecognized
>>> optional value newValue[0]=LEFT not matching any of the required
>>> enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> at org.web3d.x3d.jsail.Layout.Layout.setAlign(Layout.java:737)
>>> at org.web3d.x3d.jsail.Layout.Layout.setAlign(Layout.java:766)
>>> at
>>> net.coderextreme.data.bumpyfreewrljsonverse.initialize(bumpyfreewrljsonverse.java:330)
>>> at
>>> net.coderextreme.data.bumpyfreewrljsonverse.getRootNodeList(bumpyfreewrljsonverse.java:55)
>>> at
>>> net.coderextreme.data.bumpyfreewrljsonverse.main(bumpyfreewrljsonverse.java:48)
>>>
>>>
>>>
>>> java -Xss1g -Xmx4g net/coderextreme/data/bumpyfreewrlsliders
>>> [warning] Layout align newValue='[RIGHT, BOTTOM]' includes an
>>> unrecognized optional value newValue[0]=RIGHT not matching any of the
>>> required enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException:
>>> [warning] Layout align newValue='[RIGHT, BOTTOM]' includes an unrecognized
>>> optional value newValue[0]=RIGHT not matching any of the required
>>> enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> at org.web3d.x3d.jsail.Layout.Layout.setAlign(Layout.java:737)
>>> at org.web3d.x3d.jsail.Layout.Layout.setAlign(Layout.java:766)
>>> at
>>> net.coderextreme.data.bumpyfreewrlsliders.initialize(bumpyfreewrlsliders.java:345)
>>> at
>>> net.coderextreme.data.bumpyfreewrlsliders.getRootNodeList(bumpyfreewrlsliders.java:55)
>>> at
>>> net.coderextreme.data.bumpyfreewrlsliders.main(bumpyfreewrlsliders.java:48)
>>>
>>>
>>> java -Xss1g -Xmx4g net/coderextreme/data/bumpyx_itesliders
>>> [warning] Layout align newValue='[RIGHT, BOTTOM]' includes an
>>> unrecognized optional value newValue[0]=RIGHT not matching any of the
>>> required enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException:
>>> [warning] Layout align newValue='[RIGHT, BOTTOM]' includes an unrecognized
>>> optional value newValue[0]=RIGHT not matching any of the required
>>> enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> at org.web3d.x3d.jsail.Layout.Layout.setAlign(Layout.java:737)
>>> at org.web3d.x3d.jsail.Layout.Layout.setAlign(Layout.java:766)
>>> at
>>> net.coderextreme.data.bumpyx_itesliders.initialize(bumpyx_itesliders.java:346)
>>> at
>>> net.coderextreme.data.bumpyx_itesliders.getRootNodeList(bumpyx_itesliders.java:55)
>>> at
>>> net.coderextreme.data.bumpyx_itesliders.main(bumpyx_itesliders.java:48)
>>> ~/X3DJSONLD/src/main/shell
>>> ====================================================================
>>> Results from X3ToJava.xslt (not included).
>>>
>>> $ grep -l DISEntity net/coderextreme/data/bumpy*java | xargs javac
>>> (venv)
>>> jcarl at JustHumans MINGW64 ~/X3DJSONLD/src/main/java (master)
>>> $ for i in `grep -l Align net/x3djsonld/data/*java`; do javac $i; export
>>> CL=`dirname "$i"|sed 's/\//./g'`/`basename "$i" .java`; echo $CL; java -cp
>>> "C:/Users/jcarl/X3DJSONLD/X3DJSAIL.4.0.full.jar;." "$CL"; done
>>> net.x3djsonld.data/bumpyfreewrljsonverse
>>> Build this X3D model, showing validation diagnostics...
>>> [warning] Layout align newValue='[LEFT, BOTTOM]' includes an
>>> unrecognized optional value newValue[0]=LEFT not matching any of the
>>> required enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> *** Further hints on X3DJSAIL errors and exceptions at
>>> *** https://www.web3d.org/specifications/java/X3DJSAIL.html
>>> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException:
>>> [warning] Layout align newValue='[LEFT, BOTTOM]' includes an unrecognized
>>> optional value newValue[0]=LEFT not matching any of the required
>>> enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> at org.web3d.x3d.jsail.Layout.Layout.setAlign(Layout.java:737)
>>> at
>>> net.x3djsonld.data.bumpyfreewrljsonverse.initialize(bumpyfreewrljsonverse.java:327)
>>> at
>>> net.x3djsonld.data.bumpyfreewrljsonverse.<init>(bumpyfreewrljsonverse.java:136)
>>> at
>>> net.x3djsonld.data.bumpyfreewrljsonverse.main(bumpyfreewrljsonverse.java:506)
>>>
>>>
>>>
>>>
>>>
>>>
>>> net.x3djsonld.data/bumpyfreewrlsliders
>>> Build this X3D model, showing validation diagnostics...
>>> [warning] Layout align newValue='[RIGHT, BOTTOM]' includes an
>>> unrecognized optional value newValue[0]=RIGHT not matching any of the
>>> required enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> *** Further hints on X3DJSAIL errors and exceptions at
>>> *** https://www.web3d.org/specifications/java/X3DJSAIL.html
>>> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException:
>>> [warning] Layout align newValue='[RIGHT, BOTTOM]' includes an unrecognized
>>> optional value newValue[0]=RIGHT not matching any of the required
>>> enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> at org.web3d.x3d.jsail.Layout.Layout.setAlign(Layout.java:737)
>>> at
>>> net.x3djsonld.data.bumpyfreewrlsliders.initialize(bumpyfreewrlsliders.java:267)
>>> at
>>> net.x3djsonld.data.bumpyfreewrlsliders.<init>(bumpyfreewrlsliders.java:134)
>>> at
>>> net.x3djsonld.data.bumpyfreewrlsliders.main(bumpyfreewrlsliders.java:476)
>>>
>>>
>>>
>>>
>>> net.x3djsonld.data/bumpyx_itesliders
>>> Build this X3D model, showing validation diagnostics...
>>> [warning] Layout align newValue='[RIGHT, BOTTOM]' includes an
>>> unrecognized optional value newValue[0]=RIGHT not matching any of the
>>> required enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> *** Further hints on X3DJSAIL errors and exceptions at
>>> *** https://www.web3d.org/specifications/java/X3DJSAIL.html
>>> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException:
>>> [warning] Layout align newValue='[RIGHT, BOTTOM]' includes an unrecognized
>>> optional value newValue[0]=RIGHT not matching any of the required
>>> enumeration string tokens.
>>> Supported values are "LEFT" "BOTTOM", "LEFT" "CENTER", "LEFT"
>>> "TOP", "CENTER" "BOTTOM", "CENTER" "CENTER", "CENTER" "TOP", "RIGHT"
>>> "BOTTOM", "RIGHT" "CENTER", "RIGHT" "TOP"
>>> at org.web3d.x3d.jsail.Layout.Layout.setAlign(Layout.java:737)
>>> at
>>> net.x3djsonld.data.bumpyx_itesliders.initialize(bumpyx_itesliders.java:270)
>>> at
>>> net.x3djsonld.data.bumpyx_itesliders.<init>(bumpyx_itesliders.java:134)
>>> at
>>> net.x3djsonld.data.bumpyx_itesliders.main(bumpyx_itesliders.java:479)
>>>
>>>
>>> _______________________________________________
>> x3d-public mailing list
>> x3d-public at web3d.org
>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20250625/ed35dbe6/attachment-0001.html>
More information about the x3d-public
mailing list