Grokbase Groups Ant user May 2016
FAQ
How can I declare a byte[] array inside of scriptdef when the language of
choice is javascript? Ant 1.8.1, The following line:

var bytebuffer = new byte[8192]; // line 36

Would give the following error:

build.xml
:1126: javax.script.ScriptException:
sun.org.mozilla.javascript.internal.EvaluatorException: identifier is a
reserved word (<Unknown source>#36) in <Unknown source> at line number 36
         at
com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:156)
         at
com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:170)
         at
javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at
org.apache.tools.ant.util.ReflectUtil.invoke(ReflectUtil.java:108)
         at
org.apache.tools.ant.util.ReflectWrapper.invoke(ReflectWrapper.java:81)
         at
org.apache.tools.ant.util.optional.JavaxScriptRunner.evaluateScript(JavaxScriptRunner.java:104)
         at
org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript(JavaxScriptRunner.java:68)
         at
org.apache.tools.ant.taskdefs.optional.script.ScriptDef.executeScript(ScriptDef.java:350)
         at
org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase.execute(ScriptDefBase.java:50)
         at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
         at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
         at org.apache.tools.ant.Task.perform(Task.java:348)
         at org.apache.tools.ant.Target.execute(Target.java:390)
         at org.apache.tools.ant.Target.performTasks(Target.java:411)
         at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
         at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
         at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
         at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
         at org.apache.tools.ant.Main.runBuild(Main.java:801)
         at org.apache.tools.ant.Main.startAnt(Main.java:218)
         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)


I am trying to obtain checksum (MD5) for every file in a .zip package,
hence I need to read chunks of bytes (arrays).

Search Discussions

  • Martin Gainty at Jun 1, 2016 at 12:46 am
    function test(){var bytebuffer = new java.lang.String("/package/filename.ext").getBytes();}
    https://docs.nativescript.org/runtimes/android/marshalling/java-to-js.html
    Martin
    ______________________________________________


    Date: Tue, 31 May 2016 18:26:53 -0400
    Subject: Declaring a byte[] Array in scriptdef
    From: maps.this.address@gmail.com
    To: user@ant.apache.org

    How can I declare a byte[] array inside of scriptdef when the language of
    choice is javascript? Ant 1.8.1, The following line:

    var bytebuffer = new byte[8192]; // line 36

    Would give the following error:

    build.xml
    :1126: javax.script.ScriptException:
    sun.org.mozilla.javascript.internal.EvaluatorException: identifier is a
    reserved word (<Unknown source>#36) in <Unknown source> at line number 36
    at
    com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:156)
    at
    com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:170)
    at
    javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    org.apache.tools.ant.util.ReflectUtil.invoke(ReflectUtil.java:108)
    at
    org.apache.tools.ant.util.ReflectWrapper.invoke(ReflectWrapper.java:81)
    at
    org.apache.tools.ant.util.optional.JavaxScriptRunner.evaluateScript(JavaxScriptRunner.java:104)
    at
    org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript(JavaxScriptRunner.java:68)
    at
    org.apache.tools.ant.taskdefs.optional.script.ScriptDef.executeScript(ScriptDef.java:350)
    at
    org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase.execute(ScriptDefBase.java:50)
    at
    org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at
    org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at
    org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
    at org.apache.tools.ant.Main.runBuild(Main.java:801)
    at org.apache.tools.ant.Main.startAnt(Main.java:218)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)


    I am trying to obtain checksum (MD5) for every file in a .zip package,
    hence I need to read chunks of bytes (arrays).
  • Evan J at Jun 1, 2016 at 4:57 pm
    Martin,

    Thanks. I needed some Java-to-Javascript reference. At the end, I managed
    to create a checksum task via ANT API rather than implementing MD5 hash
    from the scratch in the code.
    On Tue, May 31, 2016 at 8:46 PM, Martin Gainty wrote:

    function test(){var bytebuffer = new
    java.lang.String("/package/filename.ext").getBytes();}
    https://docs.nativescript.org/runtimes/android/marshalling/java-to-js.html
    Martin
    ______________________________________________


    Date: Tue, 31 May 2016 18:26:53 -0400
    Subject: Declaring a byte[] Array in scriptdef
    From: maps.this.address@gmail.com
    To: user@ant.apache.org

    How can I declare a byte[] array inside of scriptdef when the language of
    choice is javascript? Ant 1.8.1, The following line:

    var bytebuffer = new byte[8192]; // line 36

    Would give the following error:

    build.xml
    :1126: javax.script.ScriptException:
    sun.org.mozilla.javascript.internal.EvaluatorException: identifier is a
    reserved word (<Unknown source>#36) in <Unknown source> at line number 36
    at
    com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:156)
    at
    com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:170)
    at
    javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    org.apache.tools.ant.util.ReflectUtil.invoke(ReflectUtil.java:108)
    at
    org.apache.tools.ant.util.ReflectWrapper.invoke(ReflectWrapper.java:81)
    at
    org.apache.tools.ant.util.optional.JavaxScriptRunner.evaluateScript(JavaxScriptRunner.java:104)
    at
    org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript(JavaxScriptRunner.java:68)
    at
    org.apache.tools.ant.taskdefs.optional.script.ScriptDef.executeScript(ScriptDef.java:350)
    at
    org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase.execute(ScriptDefBase.java:50)
    at
    org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at
    org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at
    org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
    at org.apache.tools.ant.Main.runBuild(Main.java:801)
    at org.apache.tools.ant.Main.startAnt(Main.java:218)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)


    I am trying to obtain checksum (MD5) for every file in a .zip package,
    hence I need to read chunks of bytes (arrays).

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriesant
postedMay 31, '16 at 10:26p
activeJun 1, '16 at 4:57p
posts3
users2
websiteant.apache.org

2 users in discussion

Evan J: 2 posts Martin Gainty: 1 post

People

Translate

site design / logo © 2018 Grokbase