You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ch...@apache.org on 2006/09/12 18:33:28 UTC

svn commit: r442640 - /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java

Author: chinthaka
Date: Tue Sep 12 09:33:26 2006
New Revision: 442640

URL: http://svn.apache.org/viewvc?view=rev&rev=442640
Log:
Fix for http://issues.apache.org/jira/browse/WSCOMMONS-57

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java?view=diff&rev=442640&r1=442639&r2=442640
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java Tue Sep 12 09:33:26 2006
@@ -28,14 +28,22 @@
     private static final String DEFAULT_SOAP12_FACTORY_CLASS_NAME = "org.apache.axiom.soap.impl.llom.soap12.SOAP12Factory";
 
 
-
     public static OMFactory getOMFactory() {
+
+        String omFactory;
         try {
-            String omFactory = System.getProperty(OM_FACTORY_NAME_PROPERTY);
+            omFactory = System.getProperty(OM_FACTORY_NAME_PROPERTY);
             if (omFactory == null || "".equals(omFactory)) {
-               omFactory = DEFAULT_OM_FACTORY_CLASS_NAME;
+                omFactory = DEFAULT_OM_FACTORY_CLASS_NAME;
             }
-            return (OMFactory) Class.forName(omFactory).newInstance();
+        } catch (SecurityException e) {
+            // security exception can be thrown when trying to access system variables within a sand box like an applet.
+            // please refer : http://issues.apache.org/jira/browse/WSCOMMONS-57
+            omFactory = DEFAULT_OM_FACTORY_CLASS_NAME;
+        }
+
+        try {
+           return (OMFactory) Class.forName(omFactory).newInstance();
         } catch (InstantiationException e) {
             throw new OMException(e);
         } catch (IllegalAccessException e) {
@@ -52,10 +60,10 @@
      * @return Returns SOAPFactory.
      */
     public static SOAPFactory getSOAP11Factory() {
-       try {
+        try {
             String omFactory = System.getProperty(SOAP11_FACTORY_NAME_PROPERTY);
             if (omFactory == null || "".equals(omFactory)) {
-               omFactory = DEFAULT_SOAP11_FACTORY_CLASS_NAME;
+                omFactory = DEFAULT_SOAP11_FACTORY_CLASS_NAME;
             }
             return (SOAPFactory) Class.forName(omFactory).newInstance();
         } catch (InstantiationException e) {
@@ -77,7 +85,7 @@
         try {
             String omFactory = System.getProperty(SOAP12_FACTORY_NAME_PROPERTY);
             if (omFactory == null || "".equals(omFactory)) {
-               omFactory = DEFAULT_SOAP12_FACTORY_CLASS_NAME;
+                omFactory = DEFAULT_SOAP12_FACTORY_CLASS_NAME;
             }
             return (SOAPFactory) Class.forName(omFactory).newInstance();
         } catch (InstantiationException e) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org