I'm new to beanshell, so was trying out some of the examples. The documented invoke() example for SAX parsing doesn't work, here i've modifed it slightly to get the InputStream correctly set.
The following throws an error "HERE!" when run. This is on 2.0b4 (but similarly failed on 1.3)
- - - 8< - - -
import javax.xml.parsers.*;
import org.xml.sax.InputSource;
factory = SAXParserFactory.newInstance();
saxParser = factory.newSAXParser();
parser = saxParser.getXMLReader();
parser.setContentHandler( this );
invoke( name, args ) {
print( name );
}
source = new InputSource(new FileReader(new File(bsh.args[0])));
parser.parse( source );
- - - - -
the source xml i'm using is:
- - - 8< - - -
<?xml version="1.0" encoding="UTF-8"?>
<message text="hello" />
</message>
- - - - - -
The stack is:
setDocumentLocator
Script threw exception: Sourced file: parse.bsh : Method Invocation parser.parse : at Line: 14 : in file: parse.bsh : parser .parse ( source )
Target exception: java.lang.Error: HERE!
java.lang.Error: HERE!
at bsh.BshMethod.invoke(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bsh.This.invokeMethod(Unknown Source)
at bsh.This.invokeMethod(Unknown Source)
at bsh.XThis$Handler.invokeImpl(Unknown Source)
at bsh.XThis$Handler.invoke(Unknown Source)
at $Proxy0.startDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startDocument(AbstractSAXParser.java:318)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startDocument(XMLDTDValidator.java:701)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.startEntity(XMLDocumentScannerImpl.java:540)
...
I've looked at the source, it seems that the invoke() is getting an array of argValues, but one of them is null, but i have no idea why.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
This is fixed in BeanShell2 fork at http://code.google.com/p/beanshell2
Dowonload it at http://beanshell2.googlecode.com/files/bsh-2.1b0.jar
Last edit: Anonymous 2013-11-21
Ticket has been migrated to github.
Please follow up on this over here: https://github.com/beanshell/beanshell/issues/468