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, 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
File Size: 4,379 Bytes Line Count: 95 '\n' Characters Found
-
-
Field Summary
Serializable ID Modifier and Type Field static long
serialVersionUID
'final'
Exception Convenience FieldsModifier and Type Field int
articleNum
int
sectionURLNum
-
Constructor Summary
Constructors Constructor Description ReceiveException(String message, int sectionURLNum, int articleNum)
Constructs a new exception with the specified detail message, and twopublic, final
integer parameters:sectionURLNum
andarticleNum
.ReceiveException(String message, 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
.
-
-
-
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:
public static final long serialVersionUID = 1;
-
sectionURLNum
public final int sectionURLNum
This is the News Web-Site "Section" that was being processed when thisReceiveException
was thrown.
-
articleNum
public final int articleNum
This is theVector
-index into the News Web-Site "Newspaper Article"Vector
for theArticle
that was being processed byScrapedArticleReceiver
when theReceiveException
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 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
-
-