ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 58271] New: script task implementation should use reflection API to find if javax.script.ScriptEngineManager is available
Date Sat, 22 Aug 2015 09:57:56 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=58271

            Bug ID: 58271
           Summary: script task implementation should use reflection API
                    to find if javax.script.ScriptEngineManager is
                    available
           Product: Ant
           Version: 1.9.5
          Hardware: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Optional Tasks
          Assignee: notifications@ant.apache.org
          Reporter: a.sundararajan@gmail.com

Based on reading 1.9.5 sources:

http://grepcode.com/file/repo1.maven.org/maven2/org.apache.ant/ant/1.9.5/org/apache/tools/ant/util/ScriptRunnerCreator.java#ScriptRunnerCreator.createRunner%28java.lang.String%2Cjava.lang.String%2Cjava.lang.String%29

http://grepcode.com/file/repo1.maven.org/maven2/org.apache.ant/ant/1.9.5/org/apache/tools/ant/util/LoaderUtils.java#LoaderUtils.classNameToResource%28java.lang.String%29

I find that <script> task implementation uses ClassLoader.getResource is used
to locate a .class resource URL. Based on whether that returns null or not,
ScriptRunnerBase is created. But per documentation of ClassLoader.getResource
(http://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html#getResource-java.lang.String-),
getResource is meant for only audio/text etc. -  / A resource is some data
(images, audio, text, etc) that can be accessed by class code in a way that is
independent of the location of the code./ Never talks about ".class" 'file' as
a resource. Besides, reflection API may be used to check if
javax.script.ScriptEngineManager class is available or not in the JDK.
ClassLoader.getResource on .class resource can be avoided.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Mime
View raw message