Inconsistent stack height 0 != 1
bblfish Sep 26, 2007 3:58 PMI am getting a weird exception when I add code to the toString method of the following class.
This is code I am working on https://sommer.dev.java.net project.
My javassist byte code rewritten classes otherwise work well (though I am only now starting to test them in more serious ways).
package net.java.dev.sommer.doap.ont; import java.io.File; import java.net.URL; import java.util.Collection; import net.java.rdf.annotations.rdf; import net.java.dev.sommer.doap.CheckoutHandler; import static net.java.dev.sommer.doap.ont.DoapProject.doap; /** * * @author hjs */ @rdf(doap+"Repository") public class Repository { @rdf(doap+"location") private URL location; @rdf(doap+"browse") private Collection<URL> browse; @rdf(doap+"anon-root") private String anonRoot; @rdf(doap+"name") private String name; public CheckoutHandler checkout(File destination) { throw new UnsupportedOperationException("Not yet implemented"); } public String getType() { return "unknown"; } public URL getLocation() { return location; } public Collection<URL> getBrowse() { return browse; } public String getAnonRoot() { return anonRoot; } @Override public String toString() { if (name != null) return getType()+" type "+name; // if (location != null) return getType()+" type at "+location.getPath(); return getType()+" type with no name"; } }
The stack trace is the following
java.lang.VerifyError: (class: net/java/dev/sommer/doap/ont/Repository, method: toString signature: ()Ljava/lang/String;) Inconsistent stack height 0 != 1 at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328) at java.lang.Class.getConstructor0(Class.java:2640) at java.lang.Class.getConstructor(Class.java:1629) at net.java.rdf.sommer.SesameMapper.map(SesameMapper.java:989) at net.java.rdf.sommer.SesameMapper.getCollection(SesameMapper.java:1220) at net.java.rdf.sommer.util.RDFCollection.getCurrentCollection(RDFCollection.java:113) at net.java.rdf.sommer.util.RDFCollection.isEmpty(RDFCollection.java:121) at net.java.dev.sommer.doap.DoapDisplayForm.htmlForProject(DoapDisplayForm.java:222) at net.java.dev.sommer.doap.DoapDisplayForm.<init>(DoapDisplayForm.java:48) at net.java.dev.sommer.doap.DoapFetcher.useTheDoapFile(DoapFetcher.java:226) at net.java.dev.sommer.doap.DoapFetcher.run(DoapFetcher.java:214) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:461) [catch] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
perhaps I can send the byte code too. I am not sure where I should look to resolve the problem. If I remove the
code from the toString() everything works fine.
I can dissasemble the byte code with jad, and javap seems to have to trouble with it either.