You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by cu...@apache.org on 2001/05/21 16:21:50 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/templates OutputProperties.java

curcuru     01/05/21 07:21:48

  Modified:    java/src/org/apache/xalan/templates OutputProperties.java
  Log:
  Catch SecurityException as needed
  PR: Bugzilla1258
  
  Revision  Changes    Path
  1.14      +31 -9     xml-xalan/java/src/org/apache/xalan/templates/OutputProperties.java
  
  Index: OutputProperties.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/OutputProperties.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- OutputProperties.java	2001/03/26 21:35:46	1.13
  +++ OutputProperties.java	2001/05/21 14:21:40	1.14
  @@ -188,15 +188,25 @@
         is = OutputProperties.class.getResourceAsStream(resourceName);
         bis = new BufferedInputStream(is);
       props.load(bis);
  -    } catch (IOException ioe) {
  +    } 
  +    catch (IOException ioe) {
         if ( defaults == null ) {
           throw ioe;
         }
  -      else
  -      {
  -        throw new WrappedRuntimeException("Could not load '"+resourceName+"' (check CLASSPATH) using just the defaults ", ioe);
  +      else {
  +        throw new WrappedRuntimeException("Could not load '"+resourceName+"' (check CLASSPATH), now using just the defaults ", ioe);
         }
  -    } finally {
  +    }
  +    catch (SecurityException se) {
  +      // Repeat IOException handling for sandbox/applet case -sc
  +      if ( defaults == null ) {
  +        throw se;
  +      }
  +      else {
  +        throw new WrappedRuntimeException("Could not load '"+resourceName+"' (check CLASSPATH, applet security), now using just the defaults ", se);
  +      }
  +    } 
  +    finally {
         if ( bis != null ) {
           bis.close();
         }
  @@ -215,13 +225,25 @@
         // Now check if the given key was specified as a 
         // System property. If so, the system property 
         // overides the default value in the propery file.
  -      String value;
  -      if ((value = System.getProperty(key)) == null)      
  +      String value = null;
  +      try {
  +        value = System.getProperty(key);
  +      }
  +      catch (SecurityException se) {
  +        // No-op for sandbox/applet case, leave null -sc
  +      }
  +      if (value == null)      
           value = (String)props.get(key);                       
         
         String newKey = fixupPropertyString(key, true);
  -      String newValue;
  -      if ((newValue = System.getProperty(newKey)) == null)
  +      String newValue = null;
  +      try {
  +        newValue = System.getProperty(newKey);
  +      }
  +      catch (SecurityException se) {
  +        // No-op for sandbox/applet case, leave null -sc
  +      }
  +      if (newValue == null)
           newValue = fixupPropertyString(value, false);
         else
           newValue = fixupPropertyString(newValue, false);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org