[open-ils-commits] r7619 - trunk/Open-ILS/src/java/org/open_ils/idl
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Aug 2 11:14:08 EDT 2007
Author: erickson
Date: 2007-08-02 11:12:02 -0400 (Thu, 02 Aug 2007)
New Revision: 7619
Added:
trunk/Open-ILS/src/java/org/open_ils/idl/IDLException.java
Modified:
trunk/Open-ILS/src/java/org/open_ils/idl/IDLParser.java
Log:
adding IDLException class. throwing IDLException on parser errors
Added: trunk/Open-ILS/src/java/org/open_ils/idl/IDLException.java
===================================================================
--- trunk/Open-ILS/src/java/org/open_ils/idl/IDLException.java (rev 0)
+++ trunk/Open-ILS/src/java/org/open_ils/idl/IDLException.java 2007-08-02 15:12:02 UTC (rev 7619)
@@ -0,0 +1,10 @@
+package org.open_ils.idl;
+
+public class IDLException extends Exception {
+ public IDLException(String info) {
+ super(info);
+ }
+ public IDLException(String info, Throwable cause) {
+ super(info, cause);
+ }
+}
Modified: trunk/Open-ILS/src/java/org/open_ils/idl/IDLParser.java
===================================================================
--- trunk/Open-ILS/src/java/org/open_ils/idl/IDLParser.java 2007-08-02 15:06:04 UTC (rev 7618)
+++ trunk/Open-ILS/src/java/org/open_ils/idl/IDLParser.java 2007-08-02 15:12:02 UTC (rev 7619)
@@ -50,7 +50,7 @@
/**
* Parses the IDL XML
*/
- public void parse() throws IOException {
+ public void parse() throws IOException, IDLException {
try {
XMLInputFactory factory = XMLInputFactory.newInstance();
@@ -85,7 +85,7 @@
}
} catch(javax.xml.stream.XMLStreamException se) {
- /* throw local exception */
+ throw new IDLException("Error parsing IDL XML", se);
}
}
@@ -129,7 +129,7 @@
}
}
- public void handleEndElement(XMLStreamReader reader) {
+ public void handleEndElement(XMLStreamReader reader) throws IDLException {
if(!OILS_NS_BASE.equals(reader.getNamespaceURI())) return;
String localpart = reader.getLocalName();
@@ -145,7 +145,13 @@
for(Iterator itr = fields.keySet().iterator(); itr.hasNext(); ) {
String key = (String) itr.next();
IDLField field = (IDLField) fields.get(key);
- fieldNames[ field.getArrayPos() ] = field.getName();
+ try {
+ fieldNames[ field.getArrayPos() ] = field.getName();
+ } catch(ArrayIndexOutOfBoundsException E) {
+ String msg = "class="+current.getIDLClass()+";field="+key+
+ ";fieldcount="+fields.size()+";currentpos="+field.getArrayPos();
+ throw new IDLException(msg, E);
+ }
}
OSRFRegistry.registerObject(
More information about the open-ils-commits
mailing list