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
ReceiveException - Documentation.
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, theReceiveException
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 theThrowable cause
parameter in this exception's constructors.
This class provides somepublic final
"inspection & convenience" fields which should guarantee to avoid havingnull
values when thisException
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
Hi-Lited Source-Code:
- View Here: Torello/HTML/Tools/NewsSite/ReceiveException.java
- Open New Browser-Tab: Torello/HTML/Tools/NewsSite/ReceiveException.java
-
-
Field Summary
Fields Modifier and Type Field int
articleNum
int
sectionURLNum
static long
serialVersionUID
-
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 theSerializable
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'sjava.lang.Exception
andjava.lang.Error
classes implement theSerializable 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 thisException
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 isnull
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 particularException
, that analysis causes another exception throw (likeNullPointerException
) - 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 thisReceiveException
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 thisException
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 isnull
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 particularException
, that analysis causes another exception throw (likeNullPointerException
) - BECAUSE THIS CONVENIENCE FIELD WAS LEFT NULL - would be an unnecessary source of headache. This is theVector
-index into the News Web-Site "Newspaper Article"Vector
for theArticle
that was being processed byScrapedArticleReceiver
when theReceiveException
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 twopublic, final
integer parameters:sectionURLNum
andarticleNum
.- 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/returnVector
to that class is parallel to the inputVector<URL> sectionURLs
, this integer also (identically) points to the outputreturn-Vector
location that holds the News-Paper Section that was being processed when thisReceiveException
was thrown.articleNum
- This is also aVector
-index pointer. It points to the particularArticle
whose processing ultimately resulted inReceiveException
being thrown. TheVector
to which this index points may or may not be obvious - but it is thereturn-Vector
produced 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, final
integer parameters:sectionURLNum
andarticleNum
.- 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/returnVector
to that class is parallel to the inputVector<URL> sectionURLs
, this integer also (identically) points to the outputreturn-Vector
location that holds the News-Paper Section that was being processed when thisReceiveException
was thrown.articleNum
- This is aVector
-index pointer. It points to the particularArticle
whose processing ultimately resulted inReceiveException
being thrown. TheVector
to which this index points may or may not be obvious - but it is thereturn-Vector
produced by theclass ScrapeURLs' get(...)
method.- See Also:
sectionURLNum
,articleNum
-
-