Message6940

Author kwatford
Recipients amak, kwatford
Date 2012-03-20.22:34:40
SpamBayes Score 2.9613298e-09
Marked as misclassified No
Message-id <1332282881.28.0.697458489192.issue1537@psf.upfronthosting.co.za>
In-reply-to
Content
Java version on the machine I'm currently on is:

Java 1.6.0_29-b11-402-11M3527 with Apple Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode

I added the unconditional ImportError and it was, as one would expect, caught, resulting in the non-mangled name being used and everything working.

I also tried instantiating the SAXParser via the org.python...SAXParser name. The import is clearly working as I'm able to do this from the Jython console without incident. I can also instantiate it via that name from the MATLAB console, so MATLAB also doesn't seem to mind it either.

My guess is that the XMLReaderFactory mentioned in the stack trace is using a different classloader. Jython's classes are being loaded by whatever classloader MATLAB is using. So it's likely that either MATLAB isn't making its classloader sufficiently "default" or XMLReaderFactory is picking a specific classloader that isn't correct in the case.

Here's my new fix. It goes in __init__.

try:
    self._reader = XMLReaderFactory.createXMLReader(_xerces_parser)
except:
    self._reader = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser")

I attempted to make the except block only catch the specific exception (a SAXException containing a ClassNotFoundException) but I was unable to catch it if I tried to do any class matching. I'm uncertain as to why, but I would guess it's more classloader issues. I was able to get the ClassNotFoundException's stacktrace, though, and I've attached it.
History
Date User Action Args
2012-03-20 22:34:41kwatfordsetmessageid: <1332282881.28.0.697458489192.issue1537@psf.upfronthosting.co.za>
2012-03-20 22:34:41kwatfordsetrecipients: + kwatford, amak
2012-03-20 22:34:41kwatfordlinkissue1537 messages
2012-03-20 22:34:41kwatfordcreate