Class CalendricalPrintException

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long serialVersionUID
      A serialization identifier for this class.
    • Constructor Summary

      Constructors 
      Constructor Description
      CalendricalPrintException​(java.lang.String message)
      Constructs a new exception with the specified message.
      CalendricalPrintException​(java.lang.String message, java.lang.Throwable throwable)
      Constructs a new exception with the specified message and cause.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void rethrowIOException()
      Checks if the cause of this exception was an IOException, and if so re-throws it
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        A serialization identifier for this class.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CalendricalPrintException

        public CalendricalPrintException​(java.lang.String message)
        Constructs a new exception with the specified message.
        Parameters:
        message - the message to use for this exception, may be null
      • CalendricalPrintException

        public CalendricalPrintException​(java.lang.String message,
                                         java.lang.Throwable throwable)
        Constructs a new exception with the specified message and cause.
        Parameters:
        message - the message to use for this exception, may be null
        throwable - the throwable to store as the cause, may be null
    • Method Detail

      • rethrowIOException

        public void rethrowIOException()
                                throws java.io.IOException
        Checks if the cause of this exception was an IOException, and if so re-throws it

        This method is useful if you call a printer with an open stream or writer and want to ensure that IOExceptions are not lost.

         try {
           printer.print(writer, dateTime);
         } catch (CalendricalFormatException ex) {
           ex.rethrowIOException();
           // if code reaches here exception was caused by date-time issues
         }
         
        Note that calling this method will re-throw the original IOException, causing this CalendricalFormatException to be lost.
        Throws:
        java.io.IOException - if the cause of this exception is an IOException