Package Torello.HTML.Tools.NewsSite
Class ReceiveException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- Torello.HTML.Tools.NewsSite.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 theFunctionalInterface ScrapedArticleReceiver. If, while writing an implementation forScrapedArticleReceiver, it becomes necessary to check for and/or throw an exception, theReceiveExceptionshould 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 theThrowable causeparameter in this exception's constructors.
This class provides somepublic final"inspection & convenience" fields which should guarantee to avoid havingnullvalues when thisExceptionis 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
Hi-Lited Source-Code:- View Here: Torello/HTML/Tools/NewsSite/ReceiveException.java
- Open New Browser-Tab: Torello/HTML/Tools/NewsSite/ReceiveException.java
File Size: 4,598 Bytes Line Count: 100 '\n' Characters Found
-
-
Field Summary
Serializable ID Modifier and Type Field static longserialVersionUID'final'Exception Convenience FieldsModifier and Type Field intarticleNumintsectionURLNum
-
Constructor Summary
Constructors Constructor ReceiveException(String message, int sectionURLNum, int articleNum)ReceiveException(String message, Throwable cause, int sectionURLNum, int articleNum)
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable. Using theSerializableImplementation 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'sjava.lang.Exceptionandjava.lang.Errorclasses implement theSerializable interface, and a warning-free build expects this field be defined here.- See Also:
- Constant Field Values
-
sectionURLNum
public final int sectionURLNum
This is the News Web-Site "Section" that was being processed when thisReceiveExceptionwas thrown.
-
articleNum
public final int articleNum
This is theVector-index into the News Web-Site "Newspaper Article"Vectorfor theArticlethat was being processed byScrapedArticleReceiverwhen theReceiveExceptionwas thrown.
-
-
Constructor Detail
-
ReceiveException
public ReceiveException(java.lang.String message, int sectionURLNum, int articleNum)
Constructs a new exception with the specified detail message, and twopublic, finalinteger parameters:sectionURLNumandarticleNum.- Parameters:
message- the detail message.sectionURLNum- This is aVector-index pointer. It points to the News-Website 'SectionURL' that was provided to theclass ScrapeURL's get(...)method. Since the output/returnVectorto that class is parallel to the inputVector<URL> sectionURLs, this integer also (identically) points to the outputreturn-Vectorlocation that holds the News-Paper Section that was being processed when thisReceiveExceptionwas thrown.articleNum- This is also aVector-index pointer. It points to the particularArticlewhose processing ultimately resulted inReceiveExceptionbeing thrown. TheVectorto which this index points may or may not be obvious - but it is thereturn-Vectorproduced by theclass 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 twopublic, finalinteger parameters:sectionURLNumandarticleNum.Note: The detail message associated with cause is not automatically incorporated into this exception's detail message.- Parameters:
message- The detail message (which is saved for later retrieval by theThrowable.getMessage()method).cause- the cause (which is saved for later retrieval by theThrowable.getCause()method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)sectionURLNum- This is aVector-index pointer. It points to the News-Website 'SectionURL' that was provided to theclass ScrapeURL's get(...)method. Since the output/returnVectorto that class is parallel to the inputVector<URL> sectionURLs, this integer also (identically) points to the outputreturn-Vectorlocation that holds the News-Paper Section that was being processed when thisReceiveExceptionwas thrown.articleNum- This is aVector-index pointer. It points to the particularArticlewhose processing ultimately resulted inReceiveExceptionbeing thrown. TheVectorto which this index points may or may not be obvious - but it is thereturn-Vectorproduced by theclass ScrapeURLs' get(...)method.- See Also:
sectionURLNum,articleNum
-
-