ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Re: AW: AW: ClassConstants filterreader fails with IOException
Date Wed, 16 Feb 2005 14:18:29 GMT

--- Jan.Materne@rzf.fin-nrw.de wrote:

> I had a look into the source of <classconstants> -
> all exceptions are
> catched and
> a new IOEx with the message only is thrown. Maybe
> for debug purposes we
> could provide
> the complete stacktrace - especially here it could
> be useful, I think.

I added them to see what is the exact exception. At
line 127 in ClassConstants.java I changed the catch
clauses to:

} catch (ClassNotFoundException cnfe) {
    cnfe.printStackTrace();
    throw new IOException(cnfe.getMessage());
} catch (NoSuchMethodException nsme) {
    nsme.printStackTrace();
    throw new IOException(nsme.getMessage());
} catch (IllegalAccessException iae) {
    iae.printStackTrace();
    throw new IOException(iae.getMessage());
} catch (IllegalArgumentException iarge) {
    iarge.printStackTrace();
    throw new IOException(iarge.getMessage());
} catch (InvocationTargetException ite) {
    ite.printStackTrace();
    throw new IOException(ite.getMessage());
}

By the way, I would also suggest these catch clauses
be replaced by one catch clause:
} catch (Exception e) {
  e.printStackTrace();
  //or
  //getProject().log(e.getMessage(), Project.MSG_ERR);
  throw new IOException(e.getMessage());
}


After rebuilding ant () and running the script from my
previous message, the output is 
Buildfile: /home/rambius/drafts/ant/constants.xml
[loadproperties]
java.lang.reflect.InvocationTargetException
[loadproperties]        at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[loadproperties]        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[loadproperties]        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[loadproperties]        at
java.lang.reflect.Method.invoke(Method.java:324)
[loadproperties]        at
org.apache.tools.ant.filters.ClassConstants.read(ClassConstants.java:120)
[loadproperties]        at
org.apache.tools.ant.filters.BaseFilterReader.read(BaseFilterReader.java:86)
[loadproperties]        at
java.io.Reader.read(Reader.java:100)
[loadproperties]        at
org.apache.tools.ant.util.FileUtils.readFully(FileUtils.java:1110)
[loadproperties]        at
org.apache.tools.ant.filters.util.ChainReaderHelper.readFully(ChainReaderHelper.java:231)
[loadproperties]        at
org.apache.tools.ant.taskdefs.LoadProperties.execute(LoadProperties.java:204)
[loadproperties]        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[loadproperties]        at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[loadproperties]        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[loadproperties]        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[loadproperties]        at
java.lang.reflect.Method.invoke(Method.java:324)
[loadproperties]        at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:104)
[loadproperties]        at
org.apache.tools.ant.Task.perform(Task.java:365)
[loadproperties]        at
org.apache.tools.ant.Target.execute(Target.java:341)
[loadproperties]        at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:136)
[loadproperties]        at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:90)
[loadproperties]        at
org.apache.tools.ant.Main.runBuild(Main.java:653)
[loadproperties]        at
org.apache.tools.ant.Main.startAnt(Main.java:187)
[loadproperties]        at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
[loadproperties]        at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
[loadproperties] Caused by:
org.apache.bcel.classfile.ClassFormatException:  is
not a Java .class file
[loadproperties]        at
org.apache.bcel.classfile.ClassParser.readID(ClassParser.java:286)
[loadproperties]        at
org.apache.bcel.classfile.ClassParser.parse(ClassParser.java:155)
[loadproperties]        at
org.apache.tools.ant.filters.util.JavaClassHelper.getConstants(JavaClassHelper.java:47)
[loadproperties]        ... 24 more

BUILD FAILED
/home/rambius/drafts/ant/constants.xml:4: Unable to
load file: java.io.IOException

As we can see there is a ClassFormataException,
obviuosly it does not recognize my class file as a
correct class file.

Regards Ivan


		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message