ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 18406] New: - nightly build script throws npe under some (common) conditions
Date Thu, 27 Mar 2003 11:42:42 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18406>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18406

nightly build script throws npe under some (common) conditions

           Summary: nightly build script throws npe under some (common)
                    conditions
           Product: Ant
           Version: 1.6Alpha (nightly)
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: peter.reilly@corvil.com


This happens only in the nightly build, tested on build of 27 mar 03.

The following build file causes a npe:

<project name="bizzare" default="script">
  <target name="setpath">
    <path id="xmlpath">
      <fileset dir="." includes="**/*.xml"/>
    </path>
  </target>
  
  <target name="script">
    <script language="javascript">
      i = 1;
    </script>
  </target>
</project>

The npe is:
Buildfile: /home/preilly/proj/learning/script/bizzare.xml

script:

BUILD FAILED
java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:389)
        at org.apache.tools.ant.taskdefs.optional.Script.addBeans(Script.java:92)
        at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:107)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:227)
        at org.apache.tools.ant.Task.perform(Task.java:388)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1394)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1268)
        at org.apache.tools.ant.Main.runBuild(Main.java:611)
        at org.apache.tools.ant.Main.start(Main.java:198)
        at org.apache.tools.ant.Main.main(Main.java:245)

Total time: 1 second
java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:389)
        at org.apache.tools.ant.taskdefs.optional.Script.addBeans(Script.java:92)
        at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:107)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:227)
        at org.apache.tools.ant.Task.perform(Task.java:388)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1394)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1268)
        at org.apache.tools.ant.Main.runBuild(Main.java:611)
        at org.apache.tools.ant.Main.start(Main.java:198)
        at org.apache.tools.ant.Main.main(Main.java:245)

This script works:
<project name="ok" default="script">
  <target name="setpath">
    <path id="xml-path">
      <fileset dir="." includes="**/*.xml"/>
    </path>
  </target>
  
  <target name="script">
    <script language="javascript">
      i = 1;
    </script>
  </target>
</project>


$ANT_HOME/lib contains js.jar (rhino 1_5R3) and bsf.jar (org.apache version)

The error does not occur with the 1.5.3beta binary. (using com.ibm version
of bsf).

Looking at the code, the npe appears to be caused when "xmlpath" is added
to the beans. Note that this should not happen as the 
xmlpath should not be in the properties as the "setpath" target has not
been triggered. The second script works as "xml-path" is treated
as not a valid identifier and the line 
    beans.put(key, dictionary.get(key));
is not called.
I put in printfs for key,  beans and dictionary.get(key) and
they are all not null.

It looks like some race condition as when I put in:

            try {
                if (isValid) {
                    if (key == null)
                        throw new ScriptError("key is null");
                    if (dictionary.get(key) == null)
                        throw new ScriptError("getKey(" + key + ") is null");
                    if (beans == null)
                        throw new ScriptError("beans is null");
                        
                    beans.put(key, dictionary.get(key));
                }
            }
            catch (ScriptError scriptError) {
                throw new ScriptError(
                    "scriptError.getMessage is " + scriptError.getMessage() +
                    " getKey(" + key + ") now is " + dictionary.get(key));
            }
I get the output:

org.apache.tools.ant.taskdefs.optional.Script$ScriptError:
scriptError.getMessage is getKey(xmlpath) is null getKey(xmlpath) now is
/home/preilly/proj/learning/script/bizzare.xml:/home/preilly/proj/learning/script/build.xml
        at org.apache.tools.ant.taskdefs.optional.Script.addBeans(Script.java:112)
        at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:133)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:228)
        at org.apache.tools.ant.Task.perform(Task.java:388)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1394)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1268)
        at org.apache.tools.ant.Main.runBuild(Main.java:611)
        at org.apache.tools.ant.Main.start(Main.java:198)
        at org.apache.tools.ant.Main.main(Main.java:245)
scriptError.getMessage is getKey(xmlpath) is null getKey(xmlpath) now is
/home/preilly/proj/learning/script/bizzare.xml:/home/preilly/proj/learning/script/build.xml

ant -diagnostics returns (using the nighty build - not the locally modified copy)

------- Ant diagnostics report -------
Apache Ant version 1.6alpha compiled on March 27 2003

-------------------------------------------
 Implementation Version (JDK1.2+ only)
-------------------------------------------
core tasks     : 1.5.9
optional tasks : 1.5.9

-------------------------------------------
 ANT_HOME/lib jar listing
-------------------------------------------
ant.home: /home/preilly/apps/apache-ant-1.6alpha
ant-swing.jar (6634 bytes)
ant-oro.jar (46595 bytes)
ant-trax.jar (66196 bytes)
ant-jmf.jar (6684 bytes)
ant-weblogic.jar (373 bytes)
ant-xalan2.jar (2525 bytes)
ant-junit.jar (67917 bytes)
ant-commons-logging.jar (3889 bytes)
ant-jsch.jar (18696 bytes)
ant-vaj.jar (373 bytes)
ant-xslp.jar (373 bytes)
ant-jai.jar (373 bytes)
ant-starteam.jar (373 bytes)
nodeps.jar (359601 bytes)
ant-apache-resolver.jar (3984 bytes)
ant-apache-bsf.jar (3312 bytes)
ant-jakarta-regexp.jar (3739 bytes)
ant-javamail.jar (3811 bytes)
ant-bcel.jar (8595 bytes)
ant-xalan1.jar (373 bytes)
ant-antlr.jar (4842 bytes)
ant-log4j.jar (3060 bytes)
ant-stylebook.jar (2361 bytes)
ant-commons-net.jar (18524 bytes)
ant-jdepend.jar (5638 bytes)
ant-netrexx.jar (373 bytes)
ant-icontract.jar (373 bytes)
ant.jar (822555 bytes)
optional.jar (608706 bytes)
xml-apis.jar (108484 bytes)
xercesImpl.jar (885250 bytes)
bsf.jar (175348 bytes)
js.jar (390767 bytes)

-------------------------------------------
 Tasks availability
-------------------------------------------
image : Not Available
sshexec : Missing dependency com.jcraft.jsch.UserInfo
wlrun : Not Available
icontract : Not Available
scp : Missing dependency com.jcraft.jsch.UserInfo
vajload : Not Available
stlist : Not Available
telnet : Missing dependency org.apache.commons.net.SocketClient
netrexxc : Not Available
ftp : Missing dependency org.apache.commons.net.ftp.FTP
starteam : Not Available
stlabel : Not Available
jdepend : Missing dependency jdepend.xmlui.JDepend
junit : Missing dependency junit.framework.TestListener
stcheckin : Not Available
vajexport : Not Available
stcheckout : Not Available
ejbc : Not Available
vajimport : Not Available
wlstop : Not Available
ddcreator : Not Available

-------------------------------------------
 org.apache.env.Which diagnostics
-------------------------------------------
Not available.
Download it at http://xml.apache.org/commons/

-------------------------------------------
 XML Parser information
-------------------------------------------
XML Parser : org.apache.xerces.jaxp.SAXParserImpl
XML Parser Location: /home/preilly/apps/apache-ant-1.6alpha/lib/xercesImpl.jar

-------------------------------------------
 System properties
-------------------------------------------
java.runtime.name : Java(TM) 2 Runtime Environment, Standard Edition
sun.boot.library.path : /home/java/j2sdk1.4.1_01/jre/lib/i386
java.vm.version : 1.4.1_01-b01
java.vm.vendor : Sun Microsystems Inc.
java.vendor.url : http://java.sun.com/
path.separator : :
java.vm.name : Java HotSpot(TM) Client VM
file.encoding.pkg : sun.io
user.country : US
sun.os.patch.level : unknown
java.vm.specification.name : Java Virtual Machine Specification
user.dir : /home/preilly/proj/learning/script
java.runtime.version : 1.4.1_01-b01
java.awt.graphicsenv : sun.awt.X11GraphicsEnvironment
java.endorsed.dirs : /home/java/j2sdk1.4.1_01/jre/lib/endorsed
os.arch : i386
java.io.tmpdir : /tmp
line.separator :

java.vm.specification.vendor : Sun Microsystems Inc.
os.name : Linux
ant.home : /home/preilly/apps/apache-ant-1.6alpha
sun.java2d.fontpath :
java.library.path :
/home/java/j2sdk1.4.1_01/jre/lib/i386/client:/home/java/j2sdk1.4.1_01/jre/lib/i386:/home/java/j2sdk1.4.1_01/jre/../lib/i386
java.specification.name : Java Platform API Specification
java.class.version : 48.0
java.util.prefs.PreferencesFactory : java.util.prefs.FileSystemPreferencesFactory
os.version : 2.4.20
user.home : /home/preilly
user.timezone :
java.awt.printerjob : sun.print.PSPrinterJob
file.encoding : UTF-8
java.specification.version : 1.4
java.class.path :
/home/preilly/apps/apache-ant-1.6alpha/lib/xml-apis.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/xercesImpl.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/optional.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/nodeps.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/js.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/bsf.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-xslp.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-xalan2.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-xalan1.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-weblogic.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-vaj.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-trax.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-swing.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-stylebook.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-starteam.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-oro.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-netrexx.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-log4j.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-junit.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-jsch.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-jmf.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-jdepend.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-javamail.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-jakarta-regexp.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-jai.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-icontract.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-commons-net.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-commons-logging.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-bcel.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-apache-resolver.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-apache-bsf.jar:/home/preilly/apps/apache-ant-1.6alpha/lib/ant-antlr.jar:/home/java/j2sdk1.4.1_01/lib/tools.jar
user.name : preilly
java.vm.specification.version : 1.0
java.home : /home/java/j2sdk1.4.1_01/jre
sun.arch.data.model : 32
user.language : en
java.specification.vendor : Sun Microsystems Inc.
java.vm.info : mixed mode
java.version : 1.4.1_01
java.ext.dirs : /home/java/j2sdk1.4.1_01/jre/lib/ext
sun.boot.class.path :
/home/java/j2sdk1.4.1_01/jre/lib/rt.jar:/home/java/j2sdk1.4.1_01/jre/lib/i18n.jar:/home/java/j2sdk1.4.1_01/jre/lib/sunrsasign.jar:/home/java/j2sdk1.4.1_01/jre/lib/jsse.jar:/home/java/j2sdk1.4.1_01/jre/lib/jce.jar:/home/java/j2sdk1.4.1_01/jre/lib/charsets.jar:/home/java/j2sdk1.4.1_01/jre/classes
java.vendor : Sun Microsystems Inc.
file.separator : /
java.vendor.url.bug : http://java.sun.com/cgi-bin/bugreport.cgi
sun.io.unicode.encoding : UnicodeLittle
sun.cpu.endian : little
sun.cpu.isalist :

The machine is a Dell Dimension 2350 with a 2.5Ghz cpu.

I do not think that is due to user error, but I may
be mistaken.

Peter.

Mime
View raw message