changeset 1661:685251e0b6e3

Merge
author asaha
date Fri, 28 Apr 2017 14:04:37 -0700
parents 5729051ffcb1 0b9f83ea5441
children 4f1513dab3b0
files .hgtags src/com/sun/org/apache/xml/internal/dtm/DTMConfigurationException.java
diffstat 7 files changed, 101 insertions(+), 580 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Mar 21 13:38:00 2017 -0700
+++ b/.hgtags	Fri Apr 28 14:04:37 2017 -0700
@@ -707,3 +707,8 @@
 c9de18d5c8846ab2a91d6df46efe6b95dd331d01 jdk8u131-b11
 14571ab1dc79ea44cbfbddf47a7333177f95b022 jdk8u141-b00
 d1a50321c3b36dfb0e1c27c85892267e8e1a060e jdk8u141-b01
+8649e84e810ef947fadae49fb0b78b516d40d7be jdk8u141-b02
+11bd896e07fdb440623aa14a8d24162317378837 jdk8u141-b03
+c3ca1c520f0f360a150073ff7b4909724d921662 jdk8u141-b04
+b597f37cab88536ee650350da47a4495ba6663fd jdk8u141-b05
+b87ca22dfc3a3c3a5f7f6ef644cded1fba20f942 jdk8u141-b06
--- a/THIRD_PARTY_README	Tue Mar 21 13:38:00 2017 -0700
+++ b/THIRD_PARTY_README	Fri Apr 28 14:04:37 2017 -0700
@@ -3318,12 +3318,12 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to zlib v1.2.8, which may be included 
+%% This notice is provided with respect to zlib v1.2.11, which may be included 
 with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
 
-  version 1.2.8, April 28th, 2013
+  version 1.2.11, January 15th, 2017
 
   Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
 
--- a/src/com/sun/org/apache/xml/internal/dtm/DTMConfigurationException.java	Tue Mar 21 13:38:00 2017 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id: DTMConfigurationException.java,v 1.2.4.1 2005/09/15 08:14:52 suresh_emailid Exp $
- */
-package com.sun.org.apache.xml.internal.dtm;
-
-import javax.xml.transform.SourceLocator;
-
-/**
- * Indicates a serious configuration error.
- */
-public class DTMConfigurationException extends DTMException {
-    static final long serialVersionUID = -4607874078818418046L;
-
-    /**
-     * Create a new <code>DTMConfigurationException</code> with no
-     * detail mesage.
-     */
-    public DTMConfigurationException() {
-        super("Configuration Error");
-    }
-
-    /**
-     * Create a new <code>DTMConfigurationException</code> with
-     * the <code>String </code> specified as an error message.
-     *
-     * @param msg The error message for the exception.
-     */
-    public DTMConfigurationException(String msg) {
-        super(msg);
-    }
-
-    /**
-     * Create a new <code>DTMConfigurationException</code> with a
-     * given <code>Exception</code> base cause of the error.
-     *
-     * @param e The exception to be encapsulated in a
-     * DTMConfigurationException.
-     */
-    public DTMConfigurationException(Throwable e) {
-        super(e);
-    }
-
-    /**
-     * Create a new <code>DTMConfigurationException</code> with the
-     * given <code>Exception</code> base cause and detail message.
-     *
-     * @param msg The detail message.
-     * @param e The exception to be wrapped in a DTMConfigurationException
-     */
-    public DTMConfigurationException(String msg, Throwable e) {
-        super(msg, e);
-    }
-
-    /**
-     * Create a new DTMConfigurationException from a message and a Locator.
-     *
-     * <p>This constructor is especially useful when an application is
-     * creating its own exception from within a DocumentHandler
-     * callback.</p>
-     *
-     * @param message The error or warning message.
-     * @param locator The locator object for the error or warning.
-     */
-    public DTMConfigurationException(String message,
-                                             SourceLocator locator) {
-        super(message, locator);
-    }
-
-    /**
-     * Wrap an existing exception in a DTMConfigurationException.
-     *
-     * @param message The error or warning message, or null to
-     *                use the message from the embedded exception.
-     * @param locator The locator object for the error or warning.
-     * @param e Any exception.
-     */
-    public DTMConfigurationException(String message,
-                                             SourceLocator locator,
-                                             Throwable e) {
-        super(message, locator, e);
-    }
-}
--- a/src/com/sun/org/apache/xml/internal/dtm/DTMException.java	Tue Mar 21 13:38:00 2017 -0700
+++ b/src/com/sun/org/apache/xml/internal/dtm/DTMException.java	Fri Apr 28 14:04:37 2017 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -17,129 +17,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: DTMException.java,v 1.3 2005/09/28 13:48:50 pvedula Exp $
- */
 package com.sun.org.apache.xml.internal.dtm;
 
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.xml.transform.SourceLocator;
-
-import com.sun.org.apache.xml.internal.res.XMLErrorResources;
-import com.sun.org.apache.xml.internal.res.XMLMessages;
-
-
 /**
- * This class specifies an exceptional condition that occured
+ * This class specifies an exceptional condition that occurred
  * in the DTM module.
  */
 public class DTMException extends RuntimeException {
     static final long serialVersionUID = -775576419181334734L;
 
-    /** Field locator specifies where the error occured.
-     *  @serial */
-    SourceLocator locator;
-
-    /**
-     * Method getLocator retrieves an instance of a SourceLocator
-     * object that specifies where an error occured.
-     *
-     * @return A SourceLocator object, or null if none was specified.
-     */
-    public SourceLocator getLocator() {
-        return locator;
-    }
-
-    /**
-     * Method setLocator sets an instance of a SourceLocator
-     * object that specifies where an error occured.
-     *
-     * @param location A SourceLocator object, or null to clear the location.
-     */
-    public void setLocator(SourceLocator location) {
-        locator = location;
-    }
-
-    /** Field containedException specifies a wrapped exception.  May be null.
-     *  @serial */
-    Throwable containedException;
-
-    /**
-     * This method retrieves an exception that this exception wraps.
-     *
-     * @return An Throwable object, or null.
-     * @see #getCause
-     */
-    public Throwable getException() {
-        return containedException;
-    }
-
-    /**
-     * Returns the cause of this throwable or <code>null</code> if the
-     * cause is nonexistent or unknown.  (The cause is the throwable that
-     * caused this throwable to get thrown.)
-     */
-    public Throwable getCause() {
-
-        return ((containedException == this)
-                ? null
-                : containedException);
-    }
-
-    /**
-     * Initializes the <i>cause</i> of this throwable to the specified value.
-     * (The cause is the throwable that caused this throwable to get thrown.)
-     *
-     * <p>This method can be called at most once.  It is generally called from
-     * within the constructor, or immediately after creating the
-     * throwable.  If this throwable was created
-     * with {@link #DTMException(Throwable)} or
-     * {@link #DTMException(String,Throwable)}, this method cannot be called
-     * even once.
-     *
-     * @param  cause the cause (which is saved for later retrieval by the
-     *         {@link #getCause()} method).  (A <tt>null</tt> value is
-     *         permitted, and indicates that the cause is nonexistent or
-     *         unknown.)
-     * @return  a reference to this <code>Throwable</code> instance.
-     * @throws IllegalArgumentException if <code>cause</code> is this
-     *         throwable.  (A throwable cannot
-     *         be its own cause.)
-     * @throws IllegalStateException if this throwable was
-     *         created with {@link #DTMException(Throwable)} or
-     *         {@link #DTMException(String,Throwable)}, or this method has already
-     *         been called on this throwable.
-     */
-    public synchronized Throwable initCause(Throwable cause) {
-
-        if ((this.containedException == null) && (cause != null)) {
-            throw new IllegalStateException(XMLMessages.createXMLMessage(XMLErrorResources.ER_CANNOT_OVERWRITE_CAUSE, null)); //"Can't overwrite cause");
-        }
-
-        if (cause == this) {
-            throw new IllegalArgumentException(
-                XMLMessages.createXMLMessage(XMLErrorResources.ER_SELF_CAUSATION_NOT_PERMITTED, null)); //"Self-causation not permitted");
-        }
-
-        this.containedException = cause;
-
-        return this;
-    }
-
     /**
      * Create a new DTMException.
      *
      * @param message The error or warning message.
      */
     public DTMException(String message) {
-
         super(message);
-
-        this.containedException = null;
-        this.locator            = null;
     }
 
     /**
@@ -148,11 +41,7 @@
      * @param e The exception to be wrapped.
      */
     public DTMException(Throwable e) {
-
-        super(e.getMessage());
-
-        this.containedException = e;
-        this.locator            = null;
+        super(e);
     }
 
     /**
@@ -166,220 +55,6 @@
      * @param e Any exception
      */
     public DTMException(String message, Throwable e) {
-
-        super(((message == null) || (message.length() == 0))
-              ? e.getMessage()
-              : message);
-
-        this.containedException = e;
-        this.locator            = null;
-    }
-
-    /**
-     * Create a new DTMException from a message and a Locator.
-     *
-     * <p>This constructor is especially useful when an application is
-     * creating its own exception from within a DocumentHandler
-     * callback.</p>
-     *
-     * @param message The error or warning message.
-     * @param locator The locator object for the error or warning.
-     */
-    public DTMException(String message, SourceLocator locator) {
-
-        super(message);
-
-        this.containedException = null;
-        this.locator            = locator;
-    }
-
-    /**
-     * Wrap an existing exception in a DTMException.
-     *
-     * @param message The error or warning message, or null to
-     *                use the message from the embedded exception.
-     * @param locator The locator object for the error or warning.
-     * @param e Any exception
-     */
-    public DTMException(String message, SourceLocator locator,
-                                Throwable e) {
-
-        super(message);
-
-        this.containedException = e;
-        this.locator            = locator;
-    }
-
-    /**
-     * Get the error message with location information
-     * appended.
-     */
-    public String getMessageAndLocation() {
-
-        StringBuffer sbuffer = new StringBuffer();
-        String       message = super.getMessage();
-
-        if (null != message) {
-            sbuffer.append(message);
-        }
-
-        if (null != locator) {
-            String systemID = locator.getSystemId();
-            int    line     = locator.getLineNumber();
-            int    column   = locator.getColumnNumber();
-
-            if (null != systemID) {
-                sbuffer.append("; SystemID: ");
-                sbuffer.append(systemID);
-            }
-
-            if (0 != line) {
-                sbuffer.append("; Line#: ");
-                sbuffer.append(line);
-            }
-
-            if (0 != column) {
-                sbuffer.append("; Column#: ");
-                sbuffer.append(column);
-            }
-        }
-
-        return sbuffer.toString();
-    }
-
-    /**
-     * Get the location information as a string.
-     *
-     * @return A string with location info, or null
-     * if there is no location information.
-     */
-    public String getLocationAsString() {
-
-        if (null != locator) {
-            StringBuffer sbuffer  = new StringBuffer();
-            String       systemID = locator.getSystemId();
-            int          line     = locator.getLineNumber();
-            int          column   = locator.getColumnNumber();
-
-            if (null != systemID) {
-                sbuffer.append("; SystemID: ");
-                sbuffer.append(systemID);
-            }
-
-            if (0 != line) {
-                sbuffer.append("; Line#: ");
-                sbuffer.append(line);
-            }
-
-            if (0 != column) {
-                sbuffer.append("; Column#: ");
-                sbuffer.append(column);
-            }
-
-            return sbuffer.toString();
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Print the the trace of methods from where the error
-     * originated.  This will trace all nested exception
-     * objects, as well as this object.
-     */
-    public void printStackTrace() {
-        printStackTrace(new java.io.PrintWriter(System.err, true));
-    }
-
-    /**
-     * Print the the trace of methods from where the error
-     * originated.  This will trace all nested exception
-     * objects, as well as this object.
-     * @param s The stream where the dump will be sent to.
-     */
-    public void printStackTrace(java.io.PrintStream s) {
-        printStackTrace(new java.io.PrintWriter(s));
-    }
-
-    /**
-     * Print the the trace of methods from where the error
-     * originated.  This will trace all nested exception
-     * objects, as well as this object.
-     * @param s The writer where the dump will be sent to.
-     */
-    public void printStackTrace(java.io.PrintWriter s) {
-
-        if (s == null) {
-            s = new java.io.PrintWriter(System.err, true);
-        }
-
-        try {
-            String locInfo = getLocationAsString();
-
-            if (null != locInfo) {
-                s.println(locInfo);
-            }
-
-            super.printStackTrace(s);
-        } catch (Throwable e) {}
-
-        boolean isJdk14OrHigher = false;
-        try {
-            Throwable.class.getMethod("getCause", (Class[]) null);
-            isJdk14OrHigher = true;
-        } catch (NoSuchMethodException nsme) {
-            // do nothing
-        }
-
-        // The printStackTrace method of the Throwable class in jdk 1.4
-        // and higher will include the cause when printing the backtrace.
-        // The following code is only required when using jdk 1.3 or lower
-        if (!isJdk14OrHigher) {
-            Throwable exception = getException();
-
-            for (int i = 0; (i < 10) && (null != exception); i++) {
-                s.println("---------");
-
-                try {
-                    if (exception instanceof DTMException) {
-                        String locInfo =
-                            ((DTMException) exception)
-                                .getLocationAsString();
-
-                        if (null != locInfo) {
-                            s.println(locInfo);
-                        }
-                    }
-
-                    exception.printStackTrace(s);
-                } catch (Throwable e) {
-                    s.println("Could not print stack trace...");
-                }
-
-                try {
-                    Method meth =
-                        ((Object) exception).getClass().getMethod("getException",
-                            (Class[]) null);
-
-                    if (null != meth) {
-                        Throwable prev = exception;
-
-                        exception = (Throwable) meth.invoke(exception, (Object[]) null);
-
-                        if (prev == exception) {
-                            break;
-                        }
-                    } else {
-                        exception = null;
-                    }
-                } catch (InvocationTargetException ite) {
-                    exception = null;
-                } catch (IllegalAccessException iae) {
-                    exception = null;
-                } catch (NoSuchMethodException nsme) {
-                    exception = null;
-                }
-            }
-        }
+        super(message, e);
     }
 }
--- a/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java	Tue Mar 21 13:38:00 2017 -0700
+++ b/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java	Fri Apr 28 14:04:37 2017 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -17,17 +17,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: DTMManager.java,v 1.2.4.1 2005/09/15 08:14:54 suresh_emailid Exp $
- */
 package com.sun.org.apache.xml.internal.dtm;
 
-import com.sun.org.apache.xml.internal.res.XMLErrorResources;
-import com.sun.org.apache.xml.internal.res.XMLMessages;
 import com.sun.org.apache.xml.internal.utils.PrefixResolver;
 import com.sun.org.apache.xml.internal.utils.XMLStringFactory;
-import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 
 /**
  * A DTMManager instance can be used to create DTM and
@@ -100,11 +93,11 @@
    *
    * @return new DTMManager instance, never null.
    *
-   * @throws DTMConfigurationException
+   * @throws DTMException
    * if the implementation is not available or cannot be instantiated.
    */
   public static DTMManager newInstance(XMLStringFactory xsf)
-           throws DTMConfigurationException
+           throws DTMException
   {
       final DTMManager factoryImpl = new com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault();
       factoryImpl.setXMLStringFactory(xsf);
@@ -316,20 +309,6 @@
 
   // -------------------- private methods --------------------
 
-   /**
-   * Temp debug code - this will be removed after we test everything
-   */
-  private static boolean debug;
-
-  static
-  {
-    try
-    {
-      debug = SecuritySupport.getSystemProperty("dtm.debug") != null;
-    }
-    catch (SecurityException ex){}
-  }
-
   /** This value, set at compile time, controls how many bits of the
    * DTM node identifier numbers are used to identify a node within a
    * document, and thus sets the maximum number of nodes per
@@ -395,47 +374,4 @@
   {
     return IDENT_NODE_DEFAULT;
   }
-
-    //
-    // Classes
-    //
-
-    /**
-     * A configuration error.
-     * Originally in ObjectFactory. This is the only portion used in this package
-     */
-    static class ConfigurationError
-        extends Error {
-                static final long serialVersionUID = 5122054096615067992L;
-        //
-        // Data
-        //
-
-        /** Exception. */
-        private Exception exception;
-
-        //
-        // Constructors
-        //
-
-        /**
-         * Construct a new instance with the specified detail string and
-         * exception.
-         */
-        ConfigurationError(String msg, Exception x) {
-            super(msg);
-            this.exception = x;
-        } // <init>(String,Exception)
-
-        //
-        // Public methods
-        //
-
-        /** Returns the exception associated to this error. */
-        Exception getException() {
-            return exception;
-        } // getException():Exception
-
-    } // class ConfigurationError
-
 }
--- a/src/javax/xml/transform/TransformerConfigurationException.java	Tue Mar 21 13:38:00 2017 -0700
+++ b/src/javax/xml/transform/TransformerConfigurationException.java	Fri Apr 28 14:04:37 2017 -0700
@@ -30,6 +30,8 @@
  */
 public class TransformerConfigurationException extends TransformerException {
 
+    private static final long serialVersionUID = 1285547467942875745L;
+
     /**
      * Create a new <code>TransformerConfigurationException</code> with no
      * detail mesage.
--- a/src/javax/xml/transform/TransformerException.java	Tue Mar 21 13:38:00 2017 -0700
+++ b/src/javax/xml/transform/TransformerException.java	Fri Apr 28 14:04:37 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,34 +27,45 @@
 
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.CodeSigner;
+import java.security.CodeSource;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import java.util.Objects;
 
 /**
- * This class specifies an exceptional condition that occured
+ * This class specifies an exceptional condition that occurred
  * during the transformation process.
  */
 public class TransformerException extends Exception {
 
-    /** Field locator specifies where the error occured */
+    private static final long serialVersionUID = 975798773772956428L;
+
+    /** Field locator specifies where the error occurred */
     SourceLocator locator;
 
     /**
      * Method getLocator retrieves an instance of a SourceLocator
-     * object that specifies where an error occured.
+     * object that specifies where an error occurred.
      *
      * @return A SourceLocator object, or null if none was specified.
      */
     public SourceLocator getLocator() {
-        return locator;
+        return this.locator;
     }
 
     /**
      * Method setLocator sets an instance of a SourceLocator
-     * object that specifies where an error occured.
+     * object that specifies where an error occurred.
      *
      * @param location A SourceLocator object, or null to clear the location.
      */
     public void setLocator(SourceLocator location) {
-        locator = location;
+        this.locator = location;
     }
 
     /** Field containedException specifies a wrapped exception.  May be null. */
@@ -74,7 +85,9 @@
      * Returns the cause of this throwable or <code>null</code> if the
      * cause is nonexistent or unknown.  (The cause is the throwable that
      * caused this throwable to get thrown.)
+     * @return the cause, or null if unknown
      */
+    @Override
     public Throwable getCause() {
 
         return ((containedException == this)
@@ -106,6 +119,7 @@
      *         {@link #TransformerException(String,Throwable)}, or this method has already
      *         been called on this throwable.
      */
+    @Override
     public synchronized Throwable initCause(Throwable cause) {
 
         if (this.containedException != null) {
@@ -128,11 +142,7 @@
      * @param message The error or warning message.
      */
     public TransformerException(String message) {
-
-        super(message);
-
-        this.containedException = null;
-        this.locator            = null;
+        this(message, null, null);
     }
 
     /**
@@ -141,11 +151,7 @@
      * @param e The exception to be wrapped.
      */
     public TransformerException(Throwable e) {
-
-        super(e.toString());
-
-        this.containedException = e;
-        this.locator            = null;
+        this(null, null, e);
     }
 
     /**
@@ -159,13 +165,7 @@
      * @param e Any exception
      */
     public TransformerException(String message, Throwable e) {
-
-        super(((message == null) || (message.length() == 0))
-              ? e.toString()
-              : message);
-
-        this.containedException = e;
-        this.locator            = null;
+        this(message, null, e);
     }
 
     /**
@@ -179,11 +179,7 @@
      * @param locator The locator object for the error or warning.
      */
     public TransformerException(String message, SourceLocator locator) {
-
-        super(message);
-
-        this.containedException = null;
-        this.locator            = locator;
+        this(message, locator, null);
     }
 
     /**
@@ -196,8 +192,9 @@
      */
     public TransformerException(String message, SourceLocator locator,
                                 Throwable e) {
-
-        super(message);
+        super(((message == null) || (message.length() == 0))
+              ? ((e == null) ? "" : e.toString())
+              : message);
 
         this.containedException = e;
         this.locator            = locator;
@@ -211,34 +208,9 @@
      *         location information appended.
      */
     public String getMessageAndLocation() {
-
-        StringBuffer sbuffer = new StringBuffer();
-        String       message = super.getMessage();
-
-        if (null != message) {
-            sbuffer.append(message);
-        }
-
-        if (null != locator) {
-            String systemID = locator.getSystemId();
-            int    line     = locator.getLineNumber();
-            int    column   = locator.getColumnNumber();
-
-            if (null != systemID) {
-                sbuffer.append("; SystemID: ");
-                sbuffer.append(systemID);
-            }
-
-            if (0 != line) {
-                sbuffer.append("; Line#: ");
-                sbuffer.append(line);
-            }
-
-            if (0 != column) {
-                sbuffer.append("; Column#: ");
-                sbuffer.append(column);
-            }
-        }
+        StringBuilder sbuffer = new StringBuilder();
+        sbuffer.append(Objects.toString(super.getMessage(), ""));
+        sbuffer.append(Objects.toString(getLocationAsString(), ""));
 
         return sbuffer.toString();
     }
@@ -250,9 +222,34 @@
      * if there is no location information.
      */
     public String getLocationAsString() {
+        if (locator == null) {
+            return null;
+        }
 
-        if (null != locator) {
-            StringBuffer sbuffer  = new StringBuffer();
+        if (System.getSecurityManager() == null) {
+            return getLocationString();
+        } else {
+            return (String) AccessController.doPrivileged(
+                new PrivilegedAction<String>() {
+                    public String run() {
+                        return getLocationString();
+                    }
+                },
+                new AccessControlContext(new ProtectionDomain[] {getNonPrivDomain()})
+            );
+        }
+    }
+
+    /**
+     * Constructs the location string.
+     * @return the location string
+     */
+    private String getLocationString() {
+        if (locator == null) {
+            return null;
+        }
+
+        StringBuilder sbuffer  = new StringBuilder();
             String       systemID = locator.getSystemId();
             int          line     = locator.getLineNumber();
             int          column   = locator.getColumnNumber();
@@ -273,9 +270,6 @@
             }
 
             return sbuffer.toString();
-        } else {
-            return null;
-        }
     }
 
     /**
@@ -283,6 +277,7 @@
      * originated.  This will trace all nested exception
      * objects, as well as this object.
      */
+    @Override
     public void printStackTrace() {
         printStackTrace(new java.io.PrintWriter(System.err, true));
     }
@@ -293,6 +288,7 @@
      * objects, as well as this object.
      * @param s The stream where the dump will be sent to.
      */
+    @Override
     public void printStackTrace(java.io.PrintStream s) {
         printStackTrace(new java.io.PrintWriter(s));
     }
@@ -303,6 +299,7 @@
      * objects, as well as this object.
      * @param s The writer where the dump will be sent to.
      */
+    @Override
     public void printStackTrace(java.io.PrintWriter s) {
 
         if (s == null) {
@@ -356,15 +353,22 @@
                 } else {
                     exception = null;
                 }
-            } catch (InvocationTargetException ite) {
-                exception = null;
-            } catch (IllegalAccessException iae) {
-                exception = null;
-            } catch (NoSuchMethodException nsme) {
+                } catch (InvocationTargetException | IllegalAccessException
+                        | NoSuchMethodException e) {
                 exception = null;
             }
         }
         // insure output is written
         s.flush();
     }
+
+    /**
+     * Creates a ProtectionDomain that has no permission.
+     * @return a ProtectionDomain
+     */
+    private ProtectionDomain getNonPrivDomain() {
+        CodeSource nullSource = new CodeSource(null, (CodeSigner[]) null);
+        PermissionCollection noPermission = new Permissions();
+        return new ProtectionDomain(nullSource, noPermission);
 }
+}