| 
 REQUIREMENT admin.errorcodes  | 
| Type | NEW | 
| Priority | LOW | 
| Status | CLOSED | 
| Topic | XmlBlaster supports well defined error codes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
Des cription  | 
XmlBlaster throws only one exception namely the XmlBlasterException. To distinguish the errors, xmlBlaster supports an hierarchical error code schema. The following drawing illustrates some exception situations:  
    We support a set of top level error code categories: 
 Examples for the error codes errorCode: 
 An XmlBlasterException contains a set of attributes describing an exception, all of type String: 
 Examples for location: 
 All ID's could be made available in a java.util.ResourceBundle, the client or server can display a localized text for the errorCode in this case.  | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
Example XML  | 
An xml representation is
XmlBlasterException.toXml():
============================
 <exception id='user.publish.qos'>
    <errorCode>
       <user>
          <publish>
             <qos/>
          </publish>
       </user>
    </errorCode>
    <location>
       <node>
           <heron>
             <client>
                <joe/>
             </client>
           </heron>
       </node>
    </location>
    <message><![CDATA[Invalid publish]]></message>
    <stackTrace/>
 </exception>
   
 | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
Example JAVA  | 
// Example showing how to convert an Exception (as a server developer)
import org.xmlBlaster.util.XmlBlasterException;
import org.xmlBlaster.util.def.ErrorCode;
try {
   ... // Throws exceptions 
}
catch (CorbaException ex) {
   throw new XmlBlasterException(glob,
                  ErrorCode.COMMUNICATION_NOCONNECTION_POLLING,
                  this.getClass().getName(),
                  "No callback connection to client joe",
                  ex);
}
   
 | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
Example JAVA  | 
//=====================================================================
// Example showing usage by a client
try {
   ... // Throws exceptions 
}
catch (XmlBlasterException ex) {
   // Display full stack trace for internal exceptions
   // and moderate information for user exceptions with getMessage():
   log4j.error(ex.getMessage());
}
//=====================================================================
//=====================================================================
// For user exceptions the output could look like this:
errorCode=[user.configuration]
node=[xmlBlaster]
location=[ConnectionsHandler-client:client/joe]
message=[Please provide a public session ID]
//=====================================================================
//=====================================================================
// For internal exceptions the output could look like this:
node=[xmlBlaster]
location=[XmlBlasterAccess-client/joe]
java.lang.NullPointerException: 
stackTrace=java.lang.NullPointerException: 
        at org.xmlBlaster.client.XmlBlasterAccess.connect(XmlBlasterAccess.java:181)
        at HelloWorld2(HelloWorld2.java:28)
        at HelloWorld2.main(HelloWorld2.java:76)
errorCode=internal.nullpointer message=Connection failed
        at org.xmlBlaster.util.XmlBlasterException.convert(XmlBlasterException.java:551)
        at org.xmlBlaster.util.XmlBlasterException.convert(XmlBlasterException.java:540)
        at org.xmlBlaster.client.XmlBlasterAccess.connect(XmlBlasterAccess.java:211)
        at HelloWorld2(HelloWorld2.java:28)
        at HelloWorld2.main(HelloWorld2.java:76)
versionInfo=version=0.844,os.name=Linux,os.version=2.4.19-4GB,
java.vm.vendor=IBM Corporation,java.vm.version=1.4.0,os.arch=x86,
build.timestamp=03/24/2003 11:46 PM,
build.java.vendor=IBM Corporation,build.java.version=1.4.0
errorCode description=A null pointer is an xmlBlaster internal programming error,
                      please post it to the mailing list.
//=====================================================================
   
 | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Configure | 
 These parameters allow to configure the dispatch plugin. 
 
               NOTE: Configuration parameters are specified on command line (-someValue 17) or in the
               xmlBlaster.properties file (someValue=17). See requirement "util.property" for details.  | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Todo | 
 | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| See REQ | admin.errorcodes.listing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| See API | org.xmlBlaster.util.def.ErrorCode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| See API | org.xmlBlaster.util.XmlBlasterException | 
This page is generated from the requirement XML file xmlBlaster/doc/requirements/admin.errorcodes.xml