Difference between revisions of "Java Exception Handling"
Jump to navigation
Jump to search
Line 18: | Line 18: | ||
=== Stacktraces are sometimes swallowed === | === Stacktraces are sometimes swallowed === | ||
<code> | |||
try | |||
{ | |||
... | |||
} | |||
catch (MalformedURLException e) | |||
{LOGGER.error("Error when replacing regex in fetching URL"); e.printStackTrace(); } | |||
catch(UnsupportedEncodingException e) | |||
{e.printStackTrace();} | |||
</code> | |||
<code> | |||
try | |||
{ | |||
... | |||
} | |||
catch (JiBXException e) | |||
{ | |||
e.getCause(); | |||
} | |||
</code> | |||
=== Sometimes, excessive stacktraces are shown, even without useful information === | === Sometimes, excessive stacktraces are shown, even without useful information === |
Revision as of 09:00, 3 November 2008
Problem description[edit]
Modules need dependencies of other modules only because of their exception classes[edit]
From validation/ItemValidating:
String validateItemXml(final String itemXml) throws
ValidationSchemaNotFoundException,
TechnicalException;
From importmanager/ImportHandler:
byte[] doFetch(String sourceName, String identifier) throws FileNotFoundException,
IdentifierNotRecognisedException,
SourceNotAvailableException,
TechnicalException,
FormatNotRecognizedException;
Stacktraces are sometimes swallowed[edit]
try
{
...
}
catch (MalformedURLException e)
{LOGGER.error("Error when replacing regex in fetching URL"); e.printStackTrace(); }
catch(UnsupportedEncodingException e)
{e.printStackTrace();}
try
{
...
}
catch (JiBXException e)
{
e.getCause();
}