Class ReceiveException

  • All Implemented Interfaces:
    java.io.Serializable

    public class ReceiveException
    extends java.io.IOException
    Thrown by the 'ScrapedArticleReceiver' interface, if any of the methods inside an implementation of interface 'ScrapedArticleReceiver' need to throw an exception - then that exception must be wraped by this (unchecked, runtime) exception.

    This class may be used by any code that implements the FunctionalInterface ScrapedArticleReceiver. If, while writing an implementation for ScrapedArticleReceiver, it becomes necessary to check for and/or throw an exception, the ReceiveException should be used for that purpose. If there are other exceptions that could be thrown when trying to save / handle a downloaded News-Paper article, it is mandatory to wrap the "other exception" into an instance of 'ReceiveException' using the Throwable cause parameter in this exception's constructors.

    This class provides some public final "inspection & convenience" fields which should guarantee to avoid having null values when this Exception is thrown by an internal method. If as a programmer, you intended to extend use of this class, make sure to pass valid-information & valid-data, to the constructors of this class.
    See Also:
    Serialized Form


    • Constructor Summary

      Constructors 
      Constructor Description
      ReceiveException​(String message, int sectionURLNum, int articleNum)
      Constructs a new exception with the specified detail message, and two public, final integer parameters: sectionURLNum and articleNum.
      ReceiveException​(String message, Throwable cause, int sectionURLNum, int articleNum)
      Constructs a new exception with the specified detail message, cause-chain throwable, and two public, final integer parameters: sectionURLNum and articleNum.
    • Method Summary

      • 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

        🡇     🗕  🗗  🗖
        public static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.

        Note that Java's java.lang.Exception and java.lang.Error classes implement the Serializable interface, and a warning-free build expects this field be defined here.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final long serialVersionUID = 1;
        
      • articleNum

        🡅  🡇     🗕  🗗  🗖
        public final int articleNum
        This is the Vector-index into the News Web-Site "Newspaper Article" Vector for the Article that was being processed by ScrapedArticleReceiver when the ReceiveException was thrown.
    • Constructor Detail

      • ReceiveException

        🡅  🡇     🗕  🗗  🗖
        public ReceiveException​(java.lang.String message,
                                int sectionURLNum,
                                int articleNum)
        Constructs a new exception with the specified detail message, and two public, final integer parameters: sectionURLNum and articleNum.
        Parameters:
        message - the detail message.
        sectionURLNum - This is a Vector-index pointer. It points to the News-Website 'Section URL' that was provided to the class ScrapeURL's get(...) method. Since the output/return Vector to that class is parallel to the input Vector<URL> sectionURLs, this integer also (identically) points to the output return-Vector location that holds the News-Paper Section that was being processed when this ReceiveException was thrown.
        articleNum - This is also a Vector-index pointer. It points to the particular Article whose processing ultimately resulted in ReceiveException being thrown. The Vector to which this index points may or may not be obvious - but it is the return-Vector produced by the class ScrapeURLs' get(...) method.
        See Also:
        sectionURLNum, articleNum
      • ReceiveException

        🡅     🗕  🗗  🗖
        public ReceiveException​(java.lang.String message,
                                java.lang.Throwable cause,
                                int sectionURLNum,
                                int articleNum)
        Constructs a new exception with the specified detail message, cause-chain throwable, and two public, final integer parameters: sectionURLNum and articleNum.
        Parameters:
        message - The detail message (which is saved for later retrieval by the Throwable.getMessage() method).
        cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
        sectionURLNum - This is a Vector-index pointer. It points to the News-Website 'Section URL' that was provided to the class ScrapeURL's get(...) method. Since the output/return Vector to that class is parallel to the input Vector<URL> sectionURLs, this integer also (identically) points to the output return-Vector location that holds the News-Paper Section that was being processed when this ReceiveException was thrown.
        articleNum - This is a Vector-index pointer. It points to the particular Article whose processing ultimately resulted in ReceiveException being thrown. The Vector to which this index points may or may not be obvious - but it is the return-Vector produced by the class ScrapeURLs' get(...) method.
        See Also:
        sectionURLNum, articleNum