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).

Reply via email to