ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1332595 - /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
Date Tue, 01 May 2012 09:49:35 GMT
Author: veithen
Date: Tue May  1 09:49:35 2012
New Revision: 1332595

URL: http://svn.apache.org/viewvc?rev=1332595&view=rev
Log:
Use OMException instead of RuntimeException. Also, we don't do log-and-throw: it is up to
the application code to decide whether a given exception should be logged or not.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java?rev=1332595&r1=1332594&r2=1332595&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
Tue May  1 09:49:35 2012
@@ -255,11 +255,8 @@ public class OMSourcedElementImpl extend
             } else {
                 return dataSource.getReader();  
             }
-        } catch (XMLStreamException e) {
-            log.error("Could not get parser from data source for element " +
-                    getPrintableName(), e);
-            throw new RuntimeException("Error obtaining parser from data source:" +
-                    e.getMessage(), e);
+        } catch (XMLStreamException ex) {
+            throw new OMException("Error obtaining parser from data source for element "
+ getPrintableName(), ex);
         }
     }
 
@@ -297,11 +294,8 @@ public class OMSourcedElementImpl extend
                 if (readerFromDS.getEventType() != XMLStreamConstants.START_ELEMENT) {
                     while (readerFromDS.next() != XMLStreamConstants.START_ELEMENT) ;
                 }
-            } catch (XMLStreamException e) {
-                log.error("forceExpand: error parsing data soruce document for element "
+
-                        getLocalName(), e);
-                throw new RuntimeException("Error parsing data source document:" +
-                        e.getMessage(), e);
+            } catch (XMLStreamException ex) {
+                throw new OMException("Error parsing data source document for element " +
getLocalName(), ex);
             }
 
             String readerLocalName = readerFromDS.getLocalName();
@@ -311,9 +305,7 @@ public class OMSourcedElementImpl extend
             } else {
                 // Make sure element local name and namespace matches what was expected
                 if (!readerLocalName.equals(getLocalName())) {
-                    log.error("forceExpand: expected element name " +
-                            getLocalName() + ", found " + readerLocalName);
-                    throw new RuntimeException("Element name from data source is " +
+                    throw new OMException("Element name from data source is " +
                             readerLocalName + ", not the expected " + getLocalName());
                 }
             }
@@ -322,9 +314,7 @@ public class OMSourcedElementImpl extend
                 readerURI = (readerURI == null) ? "" : readerURI;
                 String uri = (getNamespace() == null) ? "" : getNamespace().getNamespaceURI();
                 if (!readerURI.equals(uri)) {
-                    log.error("forceExpand: expected element namespace " +
-                            getLocalName() + ", found " + uri);
-                    throw new RuntimeException("Element namespace from data source is " +
+                    throw new OMException("Element namespace from data source is " +
                             readerURI + ", not the expected " + uri);
                 }
             }



Mime
View raw message