示例#1
0
        // print error message in some format
        protected void printInvalidPropMessage(String key, String value, java.lang.Exception e)
        {
            // logging.12=Invalid property value for
            String msg = new java.lang.StringBuilder().append(
                "Invalid property value for ")                                       //$NON-NLS-1$
                         .append(prefix).append(":").append(key).append("/").append( //$NON-NLS-1$//$NON-NLS-2$
                value).toString();

            errorMan.error(msg, e, ErrorManager.GENERIC_FAILURE);
        }
示例#2
0
 /**
  * Reports an error using the given message, exception and error code. This
  * implementation will write out the message to {@link System#err} on the
  * first call and all subsequent calls are ignored. A subclass of this class
  * should override this method.
  *
  * @param message
  *            the error message, which may be {@code null}.
  * @param exception
  *            the exception associated with the error, which may be
  *            {@code null}.
  * @param errorCode
  *            the error code that identifies the type of error; see the
  *            constant fields of this class for possible values.
  */
 public void error(String message, java.lang.Exception exception, int errorCode)
 {
     lock (this) {
         if (called)
         {
             return;
         }
         called = true;
     }
     java.lang.SystemJ.err.println(this.getClass().getName()
                                   + ": " + FAILURES[errorCode]); //$NON-NLS-1$
     if (message != null)
     {
         // logging.1E=Error message - {0}
         java.lang.SystemJ.err.println("Error message - " + message); //$NON-NLS-1$
     }
     if (exception != null)
     {
         // logging.1F=Exception - {0}
         java.lang.SystemJ.err.println("Exception - " + exception); //$NON-NLS-1$
     }
 }
示例#3
0
 /**
  * Construct a new instance with the specified detail string and
  * exception.
  */
 internal ConfigurationError(String msg, java.lang.Exception x)
     : base(msg)
 {
     this.exception = x;
 }
        /*
         * Create a new <code>FactoryConfigurationError</code> with a
         * given <code>Exception</code> base cause of the error.
         *
         * @param e The exception to be encapsulated in a
         * FactoryConfigurationError.
         */

        public FactoryConfigurationError(java.lang.Exception e) : base(e.toString())
        {
            this.exception = e;
        }
        /*
         * Create a new <code>FactoryConfigurationError</code> with the
         * given <code>Exception</code> base cause and detail message.
         *
         * @param e The exception to be encapsulated in a
         * FactoryConfigurationError
         * @param msg The detail message.
         */

        public FactoryConfigurationError(java.lang.Exception e, String msg) : base(msg)
        {
            this.exception = e;
        }
        /*
         * Create a new <code>FactoryConfigurationError</code> with no
         * detail message.
         */

        public FactoryConfigurationError() : base()
        {
            this.exception = null;
        }
        /*
         * Create a new <code>FactoryConfigurationError</code> with
         * the <code>String </code> specified as an error message.
         *
         * @param msg The error message for the exception.
         */

        public FactoryConfigurationError(String msg) : base(msg)
        {
            this.exception = null;
        }
示例#8
0
 /*
  * Constructs a new {@code WriteAbortedException} with its stack trace,
  * detail message and the exception which caused the underlying problem when
  * serializing the object filled in.
  *
  * @param detailMessage
  *            the detail message for this exception.
  * @param rootCause
  *            the exception that was thrown when serializing the object.
  */
 public WriteAbortedException(String detailMessage, java.lang.Exception rootCause) : base
         (detailMessage)
 {
     detail = rootCause;
     initCause(rootCause);
 }
示例#9
0
 /**
  * Constructs a new exception with the specified detail message and cause.
  *
  * @param message
  *            the detail message
  * @param cause
  *            the cause
  */
 public ArchiveException(String message, java.lang.Exception cause) : base(message)
 {
     this.initCause(cause);
 }
示例#10
0
 /*
  * Construct a new instance with the specified detail string and
  * exception.
  */
 internal ConfigurationError(String msg, java.lang.Exception x) :
     base(msg)
 {
     this.exception = x;
 }
示例#11
0
        /*
         * Closes the current ZIP entry and positions to read the next entry.
         *
         * @throws IOException
         *             if an {@code IOException} occurs.
         */
        public void closeEntry() // throws IOException {
        {
            if (closed)
            {
                throw new java.io.IOException("Stream is closed"); //$NON-NLS-1$
            }
            if (currentEntry == null)
            {
                return;
            }
            if (currentEntry is java.util.jar.JarEntry)
            {
                java.util.jar.Attributes temp = ((java.util.jar.JarEntry)currentEntry).getAttributes();
                if (temp != null && temp.containsKey("hidden"))   //$NON-NLS-1$
                {
                    return;
                }
            }

            /*
             * The following code is careful to leave the ZipInputStream in a
             * consistent state, even when close() results in an exception. It does
             * so by:
             *  - pushing bytes back into the source stream
             *  - reading a data descriptor footer from the source stream
             *  - resetting fields that manage the entry being closed
             */

            // Ensure all entry bytes are read
            java.lang.Exception failure = null;
            try {
                skip(java.lang.Long.MAX_VALUE);
            } catch (java.lang.Exception e) {
                failure = e;
            }

            int inB, outJ;

            if (currentEntry.compressionMethod == DEFLATED)
            {
                inB  = inf.getTotalIn();
                outJ = inf.getTotalOut();
            }
            else
            {
                inB  = inRead;
                outJ = inRead;
            }
            int diff = entryIn - inB;

            // Pushback any required bytes
            if (diff != 0)
            {
                ((java.io.PushbackInputStream)inJ).unread(buf, len - diff, diff);
            }

            try {
                readAndVerifyDataDescriptor(inB, outJ);
            } catch (java.lang.Exception e) {
                if (failure == null)   // otherwise we're already going to throw
                {
                    failure = e;
                }
            }

            inf.reset();
            lastRead = inRead = entryIn = len = 0;
            crc.reset();
            currentEntry = null;

            if (failure != null)
            {
                if (failure is java.io.IOException)
                {
                    throw (java.io.IOException)failure;
                }
                else if (failure is java.lang.RuntimeException)
                {
                    throw (java.lang.RuntimeException)failure;
                }
                java.lang.AssertionError error = new java.lang.AssertionError();
                error.initCause(failure);
                throw error;
            }
        }
 /**
  * Create a new <code>FactoryConfigurationError</code> with a
  * given <code>Exception</code> base cause of the error.
  *
  * @param e The exception to be encapsulated in a
  * FactoryConfigurationError.
  */
 public FactoryConfigurationError(java.lang.Exception e)
     : base(e.toString())
 {
     this.exception = e;
 }
 /**
  * Create a new <code>FactoryConfigurationError</code> with the
  * given <code>Exception</code> base cause and detail message.
  *
  * @param e The exception to be encapsulated in a
  * FactoryConfigurationError
  * @param msg The detail message.
  */
 public FactoryConfigurationError(java.lang.Exception e, String msg)
     : base(msg)
 {
     this.exception = e;
 }
 /**
  * Create a new <code>FactoryConfigurationError</code> with
  * the <code>String </code> specified as an error message.
  *
  * @param msg The error message for the exception.
  */
 public FactoryConfigurationError(String msg)
     : base(msg)
 {
     this.exception = null;
 }
 /**
  * Create a new <code>FactoryConfigurationError</code> with no
  * detail message.
  */
 public FactoryConfigurationError()
     : base()
 {
     this.exception = null;
 }
 /**
  * Logs the given exception to <code>System.err</code>.  Used to display
  * errors while accessing/mutating the bean.
  *
  * @param ex  the exception to log
  */
 protected void logWarn(java.lang.Exception ex)
 {
     // Deliberately do not use LOG4J or Commons Logging to avoid dependencies
     java.lang.SystemJ.outJ.println("WARN: Exception: " + ex);
     ex.printStackTrace();
 }
示例#17
0
 /*
  * Reports an error to the error manager associated with this handler,
  * {@code ErrorManager} is used for that purpose. No security checks are
  * done, therefore this is compatible with environments where the caller
  * is non-privileged.
  *
  * @param msg
  *            the error message, may be {@code null}.
  * @param ex
  *            the associated exception, may be {@code null}.
  * @param code
  *            an {@code ErrorManager} error code.
  */
 protected void reportError(String msg, java.lang.Exception ex, int code)
 {
     this.errorMan.error(msg, ex, code);
 }
 private static void logError(java.lang.Exception e)
 {
     java.lang.SystemJ.outJ.println("ERROR: " + e.getMessage());
     //FIXIT: logger later
     //logger.atInfo().withCause(e).log("Stack trace:");
 }
示例#19
0
 /*
  * Constructs a new {@code CoderMalfunctionError}.
  *
  * @param ex
  *            the original exception thrown by the encoder/decoder.
  */
 public CoderMalfunctionError(java.lang.Exception ex) : base(ex)
 {
 }
示例#20
0
 /**
  * Constructs a new {@code WriteAbortedException} with its stack trace,
  * detail message and the exception which caused the underlying problem when
  * serializing the object filled in.
  *
  * @param detailMessage
  *            the detail message for this exception.
  * @param rootCause
  *            the exception that was thrown when serializing the object.
  */
 public WriteAbortedException(String detailMessage, java.lang.Exception rootCause)
     : base(detailMessage)
 {
     detail = rootCause;
     initCause (rootCause);
 }