[x3d-public] puzzling error. ProtoInstance setName() not taking effect??? inX3DJSAIL.

Don Brutzman brutzman at nps.edu
Tue Apr 18 21:08:25 PDT 2017


ProtoInstance name is always required.  See spec, tooltips, etc.  Also makes sense:  how can you know what ProtoInstance is being created if you don't have name?  Need name to find corresponding ProtoDeclare or ExternProtoDeclare.

Note that you get the exception from the validate() method.  So this is telling you that you have an invalid construct.

Compilation is allowed because (a) you might add the value at a later time, and (b) you can't get a diagnostic if validate() can't run.

Throwing an exception might sound draconian - well it is.  I think an explanatory "all stop" is much better for high-quality content than a mysterious continuation and failure.  In other words, making it hard to create a broken scene graph.

Hope that helps explain.

On 4/18/2017 10:25 AM, yottzumm at gmail.com wrote:
> Should I even be able to compile Java with a missing ProtoInstance name?
> 
> Thoughts.
> 
> John
> 
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> 
> *From: *yottzumm at gmail.com <mailto:yottzumm at gmail.com>
> *Sent: *Tuesday, April 18, 2017 12:54 PM
> *To: *Don Brutzman <mailto:brutzman at nps.edu>; Roy Walmsley <mailto:roy.walmsley at ntlworld.com>; Job at alexkern.de <mailto:Job at alexkern.de>; X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
> *Subject: *puzzling error. ProtoInstance setName() not taking effect??? inX3DJSAIL.
> 
> I got the following error in running my code.  Does ProtoInstanceObject require a name in the constructor call?  You may want to say it’s required in the constructor call. IDK.
> 
> John
> 
> Java code Attached.
> 
> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException: ERROR_VALUE_NOT_FOUND, ProtoInstance name field is required but no value found.
> 
>          at org.web3d.x3d.jsail.Core.ProtoInstanceObject.validate(ProtoInstanceObject.java:1002)
> 
>          at org.web3d.x3d.jsail.Core.fieldValueObject.validate(fieldValueObject.java:880)
> 
>          at org.web3d.x3d.jsail.Core.ProtoInstanceObject.addFieldValue(ProtoInstanceObject.java:1081)
> 
>          at arc.initialize(arc.java:356)
> 
>          at arc.main(arc.java:79)
> 


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list