Class ReceiveException

  • All Implemented Interfaces:
    java.io.Serializable

    public class ReceiveException
    extends java.io.IOException
    ReceiveException - Documentation.

    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 are guaranteed not to be null when this Exception is thrown by an internal method to the HTML Node-Search package. 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
      ReceiveException​(String message, int sectionURLNum, int articleNum)
      ReceiveException​(String message, Throwable cause, int sectionURLNum, int 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:
        1
        public static final long serialVersionUID = 1;
        
      • sectionURLNum

        public final int sectionURLNum
        This field is provided to the user as a matter of convenience. All instantiations of this Exception are guaranteed to enforce and ensure that when an instance of this exception is thrown, the convenience field will not be null. If this package is extended, it is up to the programmer/user to make sure not to leave this field null when using one of these constructors. This constructor will not check whether a convenience field is null or not, when constructing the exception.

        IMPORTANT: All this is really trying to explain is that, when debugging your code, if in the analysis of a particular Exception, that analysis causes another exception throw (like NullPointerException) - BECAUSE THIS CONVENIENCE FIELD WAS LEFT NULL - would be an unnecessary source of headache. This is the News Web-Site "Section" that was being processed when this ReceiveException was thrown.
        Code:
        Exact Field Declaration Expression:
        1
        public final int sectionURLNum;
        
      • articleNum

        public final int articleNum
        This field is provided to the user as a matter of convenience. All instantiations of this Exception are guaranteed to enforce and ensure that when an instance of this exception is thrown, the convenience field will not be null. If this package is extended, it is up to the programmer/user to make sure not to leave this field null when using one of these constructors. This constructor will not check whether a convenience field is null or not, when constructing the exception.

        IMPORTANT: All this is really trying to explain is that, when debugging your code, if in the analysis of a particular Exception, that analysis causes another exception throw (like NullPointerException) - BECAUSE THIS CONVENIENCE FIELD WAS LEFT NULL - would be an unnecessary source of headache. 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.
        Code:
        Exact Field Declaration Expression:
        1
        public final int articleNum;
        
    • 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