[x3d-public] Following patch to CreateX3dSceneAccessInterfaceJava.xslt(X3DJSAIL) fixed some issues with test.nashorn (but not all of them)

Don Brutzman brutzman at nps.edu
Mon Jul 23 23:02:26 PDT 2018


made your one-line tweak on other email.  checked in, uploading

On 7/23/2018 5:48 AM, John Carlson wrote:
> Not sure about the first error, looks like you’ve got some changes you haven’t checked in that need to be backed out?

everything is checked in.  you can look at .jar or subversion to confirm presence or absence of any files you are expecting.

For the others, you’ll probably need to create the ../nashorn/examples folder, if not already created.  Suggestions are welcome for fixes to output folders (such that scripts will have correct output folders).
> 
> I currently have several folders that there’s an examples folder in:
> 
> ./stylesheets/java/nashorn
> 
> ./stylesheets/java/nashorn/nashorn
> 
> ./stylesheets/nashorn

those all seem to be present OK.

> I didn’t know what else to do, but I didn’t think very hard either.  It’s like we need the equivalent of classpath for output.   Hmm.
> 
> John

sfor some reason X3dToES5.xslt keeps getting deleted (cleaned) and later restored when i do a version control update... perhaps that is the problem?

> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> 
> *From: *Don Brutzman <mailto:brutzman at nps.edu>
> *Sent: *Monday, July 23, 2018 1:51 AM
> *To: *John Carlson <mailto:yottzumm at gmail.com>
> *Cc: *X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
> *Subject: *Re: Following patch to CreateX3dSceneAccessInterfaceJava.xslt(X3DJSAIL) fixed some issues with test.nashorn (but not all of them)
> 
> I applied these patch changes manually, hopefully OK.
> 
> Also refactored relative directory paths in ant build.xml (for stylesheets and X3DJSAIL) from "value" to "location" so that they remained stable when one build was invoked from another.  Changes checked in, uploads in progress.
> 
> nashorn output in HelloWorldProgramOutputLog.txt looks better.  some bugs remain on my system:
> 
> ===========================================
> 
> ant antfile=java/nashorn/build.xml target=test.nashorn (direct invocation)
> 
> X3D Nashorn SAI Library.test.nashorn:
> 
> Compile:
> 
> Compiling 2 source files to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\classes
> 
> Compiling 2 source files to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\classes
> 
> Copy:
> 
> Copying 1 file to C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn\examples
> 
> Copying C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.x3d to C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn\examples\HelloWorldProgramOutput.x3d
> 
> Copying 1 file to C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn\examples
> 
> Copying C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.json to C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn\examples\HelloWorldProgramOutput.json
> 
> Run:
> 
> parameter: source file HelloWorldProgramOutput.x3d filesize 21210 bytes, parsed using Document Object Model (DOM) X3DLoader
> 
> parameter: "-tojs" for conversion to X3DJSONLD JavaScript source
> 
> parameter: "-toFile" "C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn/examples/HelloWorldProgramOutput.Nashorn.js" for result file name root C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn/examples/HelloWorldProgramOutput.Nashorn
> 
> convert to JS JavaScript:
> 
> Warning: toFileJavaScript() is overwriting prior file C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn/examples/HelloWorldProgramOutput.Nashorn.js
> 
> Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
> 
> Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
> 
> [Error] TODO problem handling local exception within CommandLine, exiting
> 
> org.web3d.x3d.sai.X3DException: ScriptException when processing fileName C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn\examples\HelloWorldProgramOutput.Nashorn.js.intermediate.js, unable to save result: javax.script.ScriptException: TypeError: Cannot load script from classpath:C:=-codewww.web3d.org=stylesheets
> 
> ashorn/examples/HelloWorldProgramOutput.Nashorn.js.intermediate.js in <eval> at line number 1
> 
>                  at org.web3d.x3d.jsail.Core.X3DObject.toFileJavaScript(X3DObject.java:1666)
> 
>                  at org.web3d.x3d.jsail.CommandLine.run(CommandLine.java:643)
> 
>                  at org.web3d.x3d.jsail.CommandLine.main(CommandLine.java:163)
> 
> parameter: source file HelloWorldProgramOutput.x3d filesize 21210 bytes, parsed using Document Object Model (DOM) X3DLoader
> 
> parameter: "-toJSON" for conversion to JSON encoding
> 
> parameter: "-toFile" "C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn/examples/HelloWorldProgramOutput.Java.json" for result file name root C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn/examples/HelloWorldProgramOutput.Java
> 
> convert to JSON:
> 
> Warning: toFileStylesheetConversion(X3dToJson.xslt) is overwriting prior file C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn/examples/HelloWorldProgramOutput.Java.json
> 
> Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
> 
> Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
> 
> file conversion successful: HelloWorldProgramOutput.Java.json (40058 bytes)
> 
> parameter: source file HelloWorldProgramOutput.x3d filesize 21210 bytes, parsed using Document Object Model (DOM) X3DLoader
> 
> parameter: "-toX3D" for conversion to X3D encoding
> 
> parameter: "-toFile" "C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn/examples/HelloWorldProgramOutput.Java.x3d" for result file name root C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn/examples/HelloWorldProgramOutput.Java
> 
> convert to X3D:
> 
> Warning: toFileX3D() is overwriting prior file C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn/examples/HelloWorldProgramOutput.Java.x3d
> 
> file conversion successful: HelloWorldProgramOutput.Java.x3d (21210 bytes)
> 
> ===========================================
> 
> HelloWorldProgramOutput.Java.x3d
> 
> 1 file(s) have been successfully validated.
> 
> 1 file(s) have been successfully validated.
> 
> matches HelloWorldProgramOutput.x3d: true
> 
> ===========================================
> 
> ===========================================
> 
> HelloWorldProgramOutput.Java.json
> 
> matches HelloWorldProgramOutput.json: true
> 
> ===========================================
> 
> script:
> 
> SFColorRGBAObject.initialize() problem: failed to match default value DEFAULT_VALUE [F at 5ddcc487
> 
> MFColorRGBAObject.initialize() problem: failed to match default value DEFAULT_VALUE [F at 36cda2c2
> 
> SFImageObject.initialize() problem: failed to match default value DEFAULT_VALUE [I at 3403e2ac
> 
> MFImageObject.initialize() problem: failed to match default value DEFAULT_VALUE [I at 54504ecd
> 
> java.nio.file.NoSuchFileException: ..\nashorn\examples\HelloWorldProgramOutput.Nashorn.js.new.x3d
> 
>                  at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
> 
>                  at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
> 
>                  at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
> 
>                  at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
> 
>                  at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
> 
>                  at java.nio.file.Files.newOutputStream(Files.java:216)
> 
>                  at java.nio.file.Files.newBufferedWriter(Files.java:2860)
> 
>                  at org.web3d.x3d.jsail.Core.X3DObject.toFileX3D(X3DObject.java:686)
> 
>                  at jdk.nashorn.internal.scripts.Script$HelloWorldProgramOutput_Nashorn.:program(C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn/examples/HelloWorldProgramOutput.Nashorn.js:258)
> 
>                  at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
> 
>                  at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
> 
>                  at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
> 
>                  at jdk.nashorn.tools.Shell.apply(Shell.java:471)
> 
>                  at jdk.nashorn.tools.Shell.runScripts(Shell.java:400)
> 
>                  at jdk.nashorn.tools.Shell.run(Shell.java:179)
> 
>                  at jdk.nashorn.tools.Shell.main(Shell.java:143)
> 
>                  at jdk.nashorn.tools.Shell.main(Shell.java:119)
> 
> Exception in thread "main" org.web3d.x3d.sai.X3DException: IOException for fileName ../nashorn/examples/HelloWorldProgramOutput.Nashorn.js.new.x3d, unable to save file: java.nio.file.NoSuchFileException: ..\nashorn\examples\HelloWorldProgramOutput.Nashorn.js.new.x3d
> 
>                  at org.web3d.x3d.jsail.Core.X3DObject.toFileX3D(X3DObject.java:694)
> 
>                  at jdk.nashorn.internal.scripts.Script$HelloWorldProgramOutput_Nashorn.:program(C:\x3d-code\www.web3d.org\x3d\stylesheets\nashorn/examples/HelloWorldProgramOutput.Nashorn.js:258)
> 
>                  at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
> 
>                  at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
> 
>                  at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
> 
>                  at jdk.nashorn.tools.Shell.apply(Shell.java:471)
> 
>                  at jdk.nashorn.tools.Shell.runScripts(Shell.java:400)
> 
>                  at jdk.nashorn.tools.Shell.run(Shell.java:179)
> 
>                  at jdk.nashorn.tools.Shell.main(Shell.java:143)
> 
>                  at jdk.nashorn.tools.Shell.main(Shell.java:119)
> 
> Result: 1
> 
> ===========================================
> 
> On 7/17/2018 3:06 AM, John Carlson wrote:
> 
>  > svn diff CreateX3dSceneAccessInterfaceJava.xslt
> 
>  >
> 
>  > Index: CreateX3dSceneAccessInterfaceJava.xslt
> 
>  >
> 
>  > ===================================================================
> 
>  >
> 
>  > --- CreateX3dSceneAccessInterfaceJava.xslt      (revision 27088)
> 
>  >
> 
>  > +++ CreateX3dSceneAccessInterfaceJava.xslt      (working copy)
> 
>  >
> 
>  > @@ -3907,9 +3907,9 @@
> 
>  >
> 
>  >                                          // patches by John Carlson
> 
>  >
> 
>  >                       bufferedWriter = Files.newBufferedWriter(intermediateJSFilePath, charset);
> 
>  >
> 
>  >                                          String nashornFolder = "nashorn";
> 
>  >
> 
>  > -                                       String tmpStr = "load('"+nashornFolder+"/jvm-npm.js');\n";
> 
>  >
> 
>  > +                                       String tmpStr = "load('classpath:"+nashornFolder+"/jvm-npm.js');\n";
> 
>  >
> 
>  >                                          bufferedWriter.write(tmpStr, 0, tmpStr.length());
> 
>  >
> 
>  > -                                       tmpStr = "load('"+nashornFolder+"/repeatPolyfill.js');\n";
> 
>  >
> 
>  > +                                       tmpStr = "load('classpath:"+nashornFolder+"/repeatPolyfill.js');\n";
> 
>  >
> 
>  >                                          bufferedWriter.write(tmpStr, 0, tmpStr.length());
> 
>  >
> 
>  >                                          tmpStr = "var xmldom = require('"+nashornFolder+"/node_modules/xmldom');\n";
> 
>  >
> 
>  >                                          bufferedWriter.write(tmpStr, 0, tmpStr.length());
> 
>  >
> 
>  > @@ -3933,9 +3933,9 @@
> 
>  >
> 
>  >                                          bufferedWriter.write(tmpStr, 0, tmpStr.length());
> 
>  >
> 
>  >                                          tmpStr = "var fieldTypes = require('"+nashornFolder+"/node/fieldTypes.js');\n";
> 
>  >
> 
>  >                                          bufferedWriter.write(tmpStr, 0, tmpStr.length());
> 
>  >
> 
>  > -                                       tmpStr = "load('"+nashornFolder+"/node/X3DJSONLD.js');\n";
> 
>  >
> 
>  > +                                       tmpStr = "load('classpath:"+nashornFolder+"/node/X3DJSONLD.js');\n";
> 
>  >
> 
>  >                                          bufferedWriter.write(tmpStr, 0, tmpStr.length());
> 
>  >
> 
>  > -                                       tmpStr = "load('"+nashornFolder+"/node/JavaScriptSerializer.js');\n";
> 
>  >
> 
>  > +                                       tmpStr = "load('classpath:"+nashornFolder+"/node/JavaScriptSerializer.js');\n";
> 
>  >
> 
>  >                                          bufferedWriter.write(tmpStr, 0, tmpStr.length());
> 
>  >
> 
>  >                                          tmpStr = "var child = CreateElement('X3D');\n";
> 
>  >
> 
>  >                                          bufferedWriter.write(tmpStr, 0, tmpStr.length());
> 
>  >
> 
>  > @@ -3963,7 +3963,7 @@
> 
>  >
> 
>  >                   }
> 
>  >
> 
>  >                   try {
> 
>  >
> 
>  >                                          ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
> 
>  >
> 
>  > -                                        engine.eval("load('"+intermediateJSFileName+"');");
> 
>  >
> 
>  > +                                        engine.eval("load('classpath:"+intermediateJSFileName+"');");
> 
>  >
> 
>  >                                          if (ConfigurationProperties.isDeleteIntermediateFiles()) // clean up when done
> 
>  >
> 
>  >                                                          intermediateJSFilePath.toFile().deleteOnExit();
> 
>  >
> 
>  >                                          engine.eval("print('Hello World!');");
> 
>  >
> 
> 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
> 


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