xml-xindice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jcplerm" <jcpl...@ameritech.net>
Subject How to get real code for XMLDBException
Date Tue, 02 Sep 2003 01:38:28 GMT
I am trying to figure out how to identify when an exception is related to trying to remove
a document that does not exist anymore.
In this type of situation I would just like to ignore it and continue normally (I don't care,
if it's no longer there, good!).

But the XMLDBException does not report a code for this condition all codes are set to ZERO).
So, there is no way to distinguish from other failures.

I tried the code below:

    
       try {
          getXmldbColl().removeResource(documentId);
       }
     catch(Exception e)
     {
       e.printStackTrace();
              if (e instanceof XMLDBException) {
                   Throwable e2 = ((XMLDBException) e).getCause();
                   System.out.println("XMLDBException code: " + ((XmlRpcException)e2).code);
                   if (e2!=null) {
                        System.out.println("Cause class: " + e2.getClass());
                        if (e2 instanceof XmlRpcException) {
                                 System.out.println("Cause code: " + ((XmlRpcException)e2).code);
                                 System.out.println("Cause msg: " + ((XmlRpcException)e2).getMessage());
                        }
                   }
              }
              throw e;
       }

The code above prints something like:

XMLDBException code: 0
Cause class: class org.apache.xmlrpc.XmlRpcException
Cause code: 0
Cause msg: java.lang.Exception: org.apache.xindice.core.DBException: Document Does Not Exist

At best I could parse the message of the XmlRpcException for substring "Document Does Not
Exist".

This is like pulling tooth....

All codes set to ZERO: this is tough!!!

Thanks,

jlerm

Mime
View raw message