You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ga...@apache.org on 2006/05/16 21:41:29 UTC

svn commit: r407036 - in /webservices/axis/trunk/java/src/org/apache/axis: AxisFault.java encoding/ser/BeanSerializer.java

Author: gawor
Date: Tue May 16 12:41:28 2006
New Revision: 407036

URL: http://svn.apache.org/viewcvs?rev=407036&view=rev
Log:
a property that can disable hostname fault detail - resolves axis-2200

Modified:
    webservices/axis/trunk/java/src/org/apache/axis/AxisFault.java
    webservices/axis/trunk/java/src/org/apache/axis/encoding/ser/BeanSerializer.java

Modified: webservices/axis/trunk/java/src/org/apache/axis/AxisFault.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/AxisFault.java?rev=407036&r1=407035&r2=407036&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/AxisFault.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/AxisFault.java Tue May 16 12:41:28 2006
@@ -75,6 +75,9 @@
     /** SOAP headers which should be serialized with the Fault. */
     protected ArrayList faultHeaders = null;
 
+    public static final String PROP_HOSTNAME_DETAIL = 
+        "axis.addHostnameFaultDetail";
+
     /**
      * Make an AxisFault based on a passed Exception.  If the Exception is
      * already an AxisFault, simply use that.  Otherwise, wrap it in an
@@ -187,7 +190,9 @@
             removeHostname();
             initFromSOAPFaultException((SOAPFaultException) target);
             //but if they left it out, add it
-            addHostnameIfNeeded();
+            if (isAddHostnameDetail()) {
+                addHostnameIfNeeded();
+            }
         }
 
     }
@@ -227,7 +232,9 @@
         super (message, t);
         setFaultCodeAsString(Constants.FAULT_SERVER_GENERAL);
         setFaultString(getMessage());
-        addHostnameIfNeeded();
+        if (isAddHostnameDetail()) {
+            addHostnameIfNeeded();
+        }
     }
 
     /**
@@ -249,6 +256,7 @@
         // Set the exception message (if any) as the fault string
         setFaultString( target.toString() );
 
+        boolean addHostnameDetail = isAddHostnameDetail();
 
         // Put the exception class into the AXIS SPECIFIC HACK
         //  "exceptionName" element in the details.  This allows
@@ -258,10 +266,11 @@
         // and the other side uses *that* QName to figure out what exception
         // to use, because the class name may be completly different on the
         // client.
-        if ((target instanceof AxisFault) &&
+        if (addHostnameDetail &&
+            (target instanceof AxisFault) &&
             (target.getClass() != AxisFault.class)) {
-          addFaultDetail(Constants.QNAME_FAULTDETAIL_EXCEPTIONNAME,
-                    target.getClass().getName());
+            addFaultDetail(Constants.QNAME_FAULTDETAIL_EXCEPTIONNAME,
+                           target.getClass().getName());
         }
 
         //add stack trace
@@ -277,7 +286,9 @@
         }
 
         //add the hostname
-        addHostnameIfNeeded();
+        if (addHostnameDetail) {
+            addHostnameIfNeeded();
+        }
     }
     
     /**
@@ -916,4 +927,11 @@
     public void removeHostname() {
         removeFaultDetail(Constants.QNAME_FAULTDETAIL_HOSTNAME);
     }
+
+    private boolean isAddHostnameDetail() {
+        return JavaUtils.isTrue(
+                      AxisProperties.getProperty(PROP_HOSTNAME_DETAIL),
+                      true);
+    }
+    
 }

Modified: webservices/axis/trunk/java/src/org/apache/axis/encoding/ser/BeanSerializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/encoding/ser/BeanSerializer.java?rev=407036&r1=407035&r2=407036&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/encoding/ser/BeanSerializer.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/encoding/ser/BeanSerializer.java Tue May 16 12:41:28 2006
@@ -77,7 +77,8 @@
     static {
         errorOnNullWithNonNillableElement = 
             JavaUtils.isTrue(
-                AxisProperties.getProperty(PROP_ERROR_ON_NULL_VALUE, "true"));
+                       AxisProperties.getProperty(PROP_ERROR_ON_NULL_VALUE),
+                       true);
     }
 
     // Construct BeanSerializer for the indicated class/qname