[DS-707] Stack trace loss in exceptions

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5552 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2010-10-22 15:21:30 +00:00
parent b01b162175
commit f6d16fe023
47 changed files with 100 additions and 86 deletions

View File

@@ -224,7 +224,7 @@ public class MetadataImport
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new MetadataImportException("'" + handle + "' is not a Collection! You must specify a valid collection for new items"); throw new MetadataImportException("'" + handle + "' is not a Collection! You must specify a valid collection for new items", ex);
} }
} }

View File

@@ -53,4 +53,15 @@ public class MetadataImportException extends Exception
{ {
super(message); super(message);
} }
/**
* Instantiate a new MetadataImportException
*
* @param message the error message
* @param exception the root cause
*/
public MetadataImportException(String message, Exception exception)
{
super(message, exception);
}
} }

View File

@@ -561,7 +561,7 @@ public class METSExport
// We don't pass up a MetsException, so callers don't need to // We don't pass up a MetsException, so callers don't need to
// know the details of the METS toolkit // know the details of the METS toolkit
e.printStackTrace(); e.printStackTrace();
throw new IOException(e.getMessage()); throw new IOException(e.getMessage(), e);
} }
} }

View File

@@ -40,7 +40,6 @@ package org.dspace.app.sfx;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.String;
import java.net.URLEncoder; import java.net.URLEncoder;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;

View File

@@ -38,8 +38,6 @@
package org.dspace.app.statistics; package org.dspace.app.statistics;
import org.dspace.app.statistics.LogLine;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
@@ -48,9 +46,6 @@ import org.dspace.storage.rdbms.TableRow;
import java.sql.SQLException; import java.sql.SQLException;
import java.lang.Long;
import java.lang.StringBuffer;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;

View File

@@ -187,7 +187,7 @@ public class OpenSearch
catch (FeedException e) catch (FeedException e)
{ {
log.error(e.toString(), e); log.error(e.toString(), e);
throw new IOException("Unable to generate feed"); throw new IOException("Unable to generate feed", e);
} }
} }
@@ -214,7 +214,7 @@ public class OpenSearch
catch (FeedException e) catch (FeedException e)
{ {
log.error(e.toString(), e); log.error(e.toString(), e);
throw new IOException("Unable to generate feed"); throw new IOException("Unable to generate feed", e);
} }
} }
@@ -350,7 +350,7 @@ public class OpenSearch
} }
catch(JDOMException jde) catch(JDOMException jde)
{ {
throw new IOException("JDOM output exception"); throw new IOException("JDOM output exception", jde);
} }
} }
} }

View File

@@ -1131,7 +1131,7 @@ public class Collection extends DSpaceObject
catch (BrowseException e) catch (BrowseException e)
{ {
log.error("caught exception: ", e); log.error("caught exception: ", e);
throw new IOException(e.getMessage()); throw new IOException(e.getMessage(), e);
} }
finally finally
{ {

View File

@@ -1934,7 +1934,7 @@ public class Item extends DSpaceObject
catch (BrowseException e) catch (BrowseException e)
{ {
log.error("caught exception: ", e); log.error("caught exception: ", e);
throw new SQLException(e.getMessage()); throw new SQLException(e.getMessage(), e);
} }
// Delete the Dublin Core // Delete the Dublin Core

View File

@@ -272,7 +272,7 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
{ {
log.error("Error opening or reading MODS properties file: "+propsFile.toString()+": "+e.toString()); log.error("Error opening or reading MODS properties file: "+propsFile.toString()+": "+e.toString());
throw new CrosswalkInternalException("MODS crosswalk cannot "+ throw new CrosswalkInternalException("MODS crosswalk cannot "+
"open config file: "+e.toString()); "open config file: "+e.toString(), e);
} }
finally finally
{ {

View File

@@ -146,7 +146,7 @@ public class OREIngestionCrosswalk
xpathLinks.addNamespace(ATOM_NS); xpathLinks.addNamespace(ATOM_NS);
entryId = ((Attribute)xpathLinks.selectSingleNode(doc)).getValue(); entryId = ((Attribute)xpathLinks.selectSingleNode(doc)).getValue();
} catch (JDOMException e) { } catch (JDOMException e) {
throw new CrosswalkException("JDOM exception occured while ingesting the ORE"); throw new CrosswalkException("JDOM exception occured while ingesting the ORE", e);
} }
// Next for each resource, create a bitstream // Next for each resource, create a bitstream

View File

@@ -320,7 +320,7 @@ public class QDCCrosswalk extends SelfNamedPlugin
} }
catch (org.jdom.JDOMException je) catch (org.jdom.JDOMException je)
{ {
throw new CrosswalkInternalException("Failed parsing XML fragment in properties file: \""+prolog+val+postlog+"\": "+je.toString()); throw new CrosswalkInternalException("Failed parsing XML fragment in properties file: \""+prolog+val+postlog+"\": "+je.toString(), je);
} }
} }
} }

View File

@@ -231,7 +231,7 @@ public class XSLTDisseminationCrosswalk
catch (XSLTransformException e) catch (XSLTransformException e)
{ {
log.error("Got error: "+e.toString()); log.error("Got error: "+e.toString());
throw new CrosswalkInternalException("XSL translation failed: "+e.toString()); throw new CrosswalkInternalException("XSL translation failed: "+e.toString(), e);
} }
} }
@@ -263,7 +263,7 @@ public class XSLTDisseminationCrosswalk
catch (XSLTransformException e) catch (XSLTransformException e)
{ {
log.error("Got error: "+e.toString()); log.error("Got error: "+e.toString());
throw new CrosswalkInternalException("XSL translation failed: "+e.toString()); throw new CrosswalkInternalException("XSL translation failed: "+e.toString(), e);
} }
} }

View File

@@ -162,7 +162,7 @@ public class XSLTIngestionCrosswalk
catch (XSLTransformException e) catch (XSLTransformException e)
{ {
log.error("Got error: "+e.toString()); log.error("Got error: "+e.toString());
throw new CrosswalkInternalException("XSL Transformation failed: "+e.toString()); throw new CrosswalkInternalException("XSL Transformation failed: "+e.toString(), e);
} }
} }
@@ -185,7 +185,7 @@ public class XSLTIngestionCrosswalk
catch (XSLTransformException e) catch (XSLTransformException e)
{ {
log.error("Got error: "+e.toString()); log.error("Got error: "+e.toString());
throw new CrosswalkInternalException("XSL Transformation failed: "+e.toString()); throw new CrosswalkInternalException("XSL Transformation failed: "+e.toString(), e);
} }
} }

View File

@@ -660,11 +660,11 @@ public abstract class AbstractMETSDisseminator
} }
catch (InstantiationException e) catch (InstantiationException e)
{ {
throw new PackageValidationException("Error instantiating Mdsec object: "+ e.toString()); throw new PackageValidationException("Error instantiating Mdsec object: "+ e.toString(), e);
} }
catch (IllegalAccessException e) catch (IllegalAccessException e)
{ {
throw new PackageValidationException("Error instantiating Mdsec object: "+ e.toString()); throw new PackageValidationException("Error instantiating Mdsec object: "+ e.toString(), e);
} }
} }

View File

@@ -71,4 +71,9 @@ public class PackageValidationException extends PackageException
{ {
super(exception); super(exception);
} }
public PackageValidationException(String message, Exception exception)
{
super(message, exception);
}
} }

View File

@@ -279,7 +279,7 @@ public class ConfigurationManager
// FIXME: Maybe something more graceful here, but with the // FIXME: Maybe something more graceful here, but with the
// configuration we can't do anything // configuration we can't do anything
throw new RuntimeException("Failed to read default license."); throw new RuntimeException("Failed to read default license.", e);
} }
finally finally
{ {

View File

@@ -302,6 +302,7 @@ public class HandlePlugin implements HandleStorage
log.debug("Exception in getRawHandleValues", e); log.debug("Exception in getRawHandleValues", e);
} }
// Stack loss as exception does not support cause
throw new HandleException(HandleException.INTERNAL_ERROR); throw new HandleException(HandleException.INTERNAL_ERROR);
} }
finally finally
@@ -419,6 +420,7 @@ public class HandlePlugin implements HandleStorage
log.debug("Exception in getHandlesForNA", sqle); log.debug("Exception in getHandlesForNA", sqle);
} }
// Stack loss as exception does not support cause
throw new HandleException(HandleException.INTERNAL_ERROR); throw new HandleException(HandleException.INTERNAL_ERROR);
} }
finally finally

View File

@@ -287,11 +287,11 @@ public class OAIHarvester {
} }
catch (FileNotFoundException fe) { catch (FileNotFoundException fe) {
log.error("The OAI server did not respond."); log.error("The OAI server did not respond.");
throw new HarvestingException("The OAI server did not respond."); throw new HarvestingException("The OAI server did not respond.", fe);
} }
catch (ConnectException fe) { catch (ConnectException fe) {
log.error("The OAI server did not respond."); log.error("The OAI server did not respond.");
throw new HarvestingException("The OAI server did not respond."); throw new HarvestingException("The OAI server did not respond.", fe);
} }
if (descMDPrefix == null) { if (descMDPrefix == null) {
log.error("The OAI server does not support this metadata format"); log.error("The OAI server does not support this metadata format");

View File

@@ -37,8 +37,6 @@
*/ */
package org.dspace.plugin; package org.dspace.plugin;
import java.lang.Exception;
/** /**
* General exception class for all code that runs as a plugin in DSpace * General exception class for all code that runs as a plugin in DSpace
* *

View File

@@ -448,7 +448,7 @@ public class BitstreamStorageManager
catch (NoSuchAlgorithmException e) catch (NoSuchAlgorithmException e)
{ {
log.warn("Caught NoSuchAlgorithmException", e); log.warn("Caught NoSuchAlgorithmException", e);
throw new IOException("Invalid checksum algorithm"); throw new IOException("Invalid checksum algorithm", e);
} }
catch (IOException e) catch (IOException e)
{ {
@@ -491,7 +491,7 @@ public class BitstreamStorageManager
catch (NoSuchAlgorithmException e) catch (NoSuchAlgorithmException e)
{ {
log.error("Caught NoSuchAlgorithmException", e); log.error("Caught NoSuchAlgorithmException", e);
throw new IOException("Invalid checksum algorithm"); throw new IOException("Invalid checksum algorithm", e);
} }
bitstream.setColumn("checksum", bitstream.setColumn("checksum",
Utils.toHex(md.digest(sFilename.getBytes()))); Utils.toHex(md.digest(sFilename.getBytes())));

View File

@@ -178,7 +178,7 @@ public class DataSourceInit {
// Need to be able to catch other exceptions. Pretend they are // Need to be able to catch other exceptions. Pretend they are
// SQLExceptions, but do log // SQLExceptions, but do log
log.warn("Exception initializing DB pool", e); log.warn("Exception initializing DB pool", e);
throw new SQLException(e.toString()); throw new SQLException(e.toString(), e);
} }
} }
} }

View File

@@ -1676,7 +1676,7 @@ public class DatabaseManager
// Need to be able to catch other exceptions. Pretend they are // Need to be able to catch other exceptions. Pretend they are
// SQLExceptions, but do log // SQLExceptions, but do log
log.warn("Exception initializing DB pool", e); log.warn("Exception initializing DB pool", e);
throw new SQLException(e.toString()); throw new SQLException(e.toString(), e);
} }
} }

View File

@@ -57,7 +57,6 @@ import org.dspace.administer.RegistryLoader;
import org.dspace.browse.IndexBrowse; import org.dspace.browse.IndexBrowse;
import org.dspace.browse.MockBrowseCreateDAOOracle; import org.dspace.browse.MockBrowseCreateDAOOracle;
import org.dspace.content.MetadataField; import org.dspace.content.MetadataField;
import org.dspace.content.MetadataSchema;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;

View File

@@ -824,11 +824,11 @@ public class BrowseListTag extends TagSupport
} }
catch (SQLException sqle) catch (SQLException sqle)
{ {
throw new JspException(sqle.getMessage()); throw new JspException(sqle.getMessage(), sqle);
} }
catch (IOException ioe) catch (IOException ioe)
{ {
throw new JspException(ioe.getMessage()); throw new JspException(ioe.getMessage(), ioe);
} }
// now get the image dimensions // now get the image dimensions
@@ -906,7 +906,7 @@ public class BrowseListTag extends TagSupport
} }
catch (SQLException sqle) catch (SQLException sqle)
{ {
throw new JspException(sqle.getMessage()); throw new JspException(sqle.getMessage(), sqle);
} }
catch (UnsupportedEncodingException e) catch (UnsupportedEncodingException e)
{ {

View File

@@ -789,11 +789,11 @@ public class ItemListTag extends TagSupport
} }
catch (SQLException sqle) catch (SQLException sqle)
{ {
throw new JspException(sqle.getMessage()); throw new JspException(sqle.getMessage(), sqle);
} }
catch (IOException ioe) catch (IOException ioe)
{ {
throw new JspException(ioe.getMessage()); throw new JspException(ioe.getMessage(), ioe);
} }
// now get the image dimensions // now get the image dimensions
@@ -871,7 +871,7 @@ public class ItemListTag extends TagSupport
} }
catch (SQLException sqle) catch (SQLException sqle)
{ {
throw new JspException(sqle.getMessage()); throw new JspException(sqle.getMessage(), sqle);
} }
catch (UnsupportedEncodingException e) catch (UnsupportedEncodingException e)
{ {

View File

@@ -962,7 +962,7 @@ public class ItemTag extends TagSupport
} }
catch(SQLException sqle) catch(SQLException sqle)
{ {
throw new IOException(sqle.getMessage()); throw new IOException(sqle.getMessage(), sqle);
} }
out.println("</td></tr></table>"); out.println("</td></tr></table>");
@@ -990,7 +990,7 @@ public class ItemTag extends TagSupport
} }
catch(SQLException sqle) catch(SQLException sqle)
{ {
throw new IOException(sqle.getMessage()); throw new IOException(sqle.getMessage(), sqle);
} }
out.println("<table align=\"center\" class=\"attentionTable\"><tr>"); out.println("<table align=\"center\" class=\"attentionTable\"><tr>");

View File

@@ -89,7 +89,7 @@ public class AuthorityChooseServlet extends DSpaceServlet {
} }
catch(SAXException e) catch(SAXException e)
{ {
throw new IOException(e.toString()); throw new IOException(e.toString(), e);
} }
finally finally
{ {

View File

@@ -283,7 +283,7 @@ public class FeedServlet extends DSpaceServlet
} }
catch( FeedException fex ) catch( FeedException fex )
{ {
throw new IOException(fex.getMessage()); throw new IOException(fex.getMessage(), fex);
} }
} }
@@ -374,12 +374,12 @@ public class FeedServlet extends DSpaceServlet
catch (SortException se) catch (SortException se)
{ {
log.error("caught exception: ", se); log.error("caught exception: ", se);
throw new IOException(se.getMessage()); throw new IOException(se.getMessage(), se);
} }
catch (BrowseException e) catch (BrowseException e)
{ {
log.error("caught exception: ", e); log.error("caught exception: ", e);
throw new IOException(e.getMessage()); throw new IOException(e.getMessage(), e);
} }
} }

View File

@@ -238,7 +238,7 @@ public class OpenSearchServlet extends DSpaceServlet
catch (TransformerException e) catch (TransformerException e)
{ {
log.error(e); log.error(e);
throw new ServletException(e.toString()); throw new ServletException(e.toString(), e);
} }
} }

View File

@@ -128,9 +128,7 @@ public class FileUploadRequest extends HttpServletRequestWrapper
} }
catch (Exception e) catch (Exception e)
{ {
IOException t = new IOException(e.getMessage()); throw new IOException(e.getMessage(), e);
t.initCause(e);
throw t;
} }
} }

View File

@@ -246,7 +246,7 @@ class DAVBitstream extends DAVDSpaceObject
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Invalid Bitstream Sequence ID in URI: " + pathElt); "Invalid Bitstream Sequence ID in URI: " + pathElt, nfe);
} }
} }

View File

@@ -587,7 +587,7 @@ class DAVCollection extends DAVDSpaceObject
{ {
pe.log(log); pe.log(log);
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, pe.toString()); HttpServletResponse.SC_INTERNAL_SERVER_ERROR, pe.toString(), pe);
} }
catch (CrosswalkException ie) catch (CrosswalkException ie)
{ {
@@ -599,7 +599,7 @@ class DAVCollection extends DAVDSpaceObject
log.error(ie.toString() + reason); log.error(ie.toString() + reason);
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ie.toString() HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ie.toString()
+ reason); + reason, ie);
} }
} }

View File

@@ -249,7 +249,7 @@ class DAVEPersonEPerson extends DAVResource
catch (NumberFormatException ne) catch (NumberFormatException ne)
{ {
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Error parsing number in request URI."); "Error parsing number in request URI.", ne);
} }
} }

View File

@@ -227,7 +227,7 @@ class DAVItem extends DAVDSpaceObject
catch (NumberFormatException ne) catch (NumberFormatException ne)
{ {
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Error parsing number in request URI."); "Error parsing number in request URI.", ne);
} }
} }
@@ -518,14 +518,14 @@ class DAVItem extends DAVDSpaceObject
{ {
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Failed in crosswalk of metadata: " + pe.toString()); "Failed in crosswalk of metadata: " + pe.toString(), pe);
} }
catch (PackageException pe) catch (PackageException pe)
{ {
pe.log(log); pe.log(log);
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, pe HttpServletResponse.SC_INTERNAL_SERVER_ERROR, pe
.toString()); .toString(), pe);
} }
} }
} }

View File

@@ -567,7 +567,7 @@ abstract class DAVResource
{ {
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_BAD_REQUEST, HttpServletResponse.SC_BAD_REQUEST,
"Bad Depth header: " + sdepth); "Bad Depth header: " + sdepth, nfe);
} }
} }
@@ -671,14 +671,14 @@ abstract class DAVResource
.toString())); .toString()));
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_BAD_REQUEST, HttpServletResponse.SC_BAD_REQUEST,
"Could not parse request document: " + je.toString()); "Could not parse request document: " + je.toString(), je);
} }
} }
catch (JDOMException je) catch (JDOMException je)
{ {
log.error(LogManager.getHeader(this.context, "propfind", je.toString())); log.error(LogManager.getHeader(this.context, "propfind", je.toString()));
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Could not parse request document: " + je.toString()); "Could not parse request document: " + je.toString(), je);
} }
// At this point, pfProps, pfType and URI define the whole request. // At this point, pfProps, pfType and URI define the whole request.
@@ -883,7 +883,7 @@ abstract class DAVResource
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_BAD_REQUEST, HttpServletResponse.SC_BAD_REQUEST,
"Could not parse PROPERTYUPDATE request document: " "Could not parse PROPERTYUPDATE request document: "
+ je.toString()); + je.toString(), je);
} }
} }
catch (JDOMException je) catch (JDOMException je)
@@ -893,7 +893,7 @@ abstract class DAVResource
.toString())); .toString()));
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Could not parse PROPERTYUPDATE request document: " "Could not parse PROPERTYUPDATE request document: "
+ je.toString()); + je.toString(), je);
} }
if (reqdoc == null) if (reqdoc == null)
{ {
@@ -1178,7 +1178,7 @@ abstract class DAVResource
{ {
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Illegal URI syntax in value of \"Destination\" header: " "Illegal URI syntax in value of \"Destination\" header: "
+ destination); + destination, e);
} }
// Depth arg from header // Depth arg from header
@@ -1202,7 +1202,7 @@ abstract class DAVResource
{ {
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_BAD_REQUEST, HttpServletResponse.SC_BAD_REQUEST,
"Illegal value in Depth request header: " + sdepth); "Illegal value in Depth request header: " + sdepth, nfe);
} }
} }
@@ -1229,14 +1229,14 @@ abstract class DAVResource
{ {
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_BAD_REQUEST, HttpServletResponse.SC_BAD_REQUEST,
"Error parsing XML document in COPY request."); "Error parsing XML document in COPY request.", je);
} }
} }
catch (JDOMException je) catch (JDOMException je)
{ {
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Error parsing XML document in COPY request: " "Error parsing XML document in COPY request: "
+ je.toString()); + je.toString(), je);
} }
if (reqdoc != null) if (reqdoc != null)
{ {
@@ -1700,14 +1700,14 @@ abstract class DAVResource
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_BAD_REQUEST, HttpServletResponse.SC_BAD_REQUEST,
"Could not parse DELETE request document: " "Could not parse DELETE request document: "
+ je.toString()); + je.toString(), je);
} }
} }
catch (JDOMException je) catch (JDOMException je)
{ {
log.error(LogManager.getHeader(this.context, "delete", je.toString())); log.error(LogManager.getHeader(this.context, "delete", je.toString()));
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Could not parse DELETE request document: " + je.toString()); "Could not parse DELETE request document: " + je.toString(), je);
} }
if (reqdoc == null) if (reqdoc == null)
{ {
@@ -1793,14 +1793,14 @@ abstract class DAVResource
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_BAD_REQUEST, HttpServletResponse.SC_BAD_REQUEST,
"Could not parse MKCOL request document: " "Could not parse MKCOL request document: "
+ je.toString()); + je.toString(), je);
} }
} }
catch (JDOMException je) catch (JDOMException je)
{ {
log.error(LogManager.getHeader(this.context, "mkcol", je.toString())); log.error(LogManager.getHeader(this.context, "mkcol", je.toString()));
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Could not parse MKCOL request document: " + je.toString()); "Could not parse MKCOL request document: " + je.toString(), je);
} }
if (reqdoc == null) if (reqdoc == null)
{ {

View File

@@ -211,7 +211,7 @@ class DAVWorkflowItem extends DAVInProgressSubmission
catch (NumberFormatException ne) catch (NumberFormatException ne)
{ {
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Error parsing number in request URI."); "Error parsing number in request URI.", ne);
} }
} }

View File

@@ -197,7 +197,7 @@ class DAVWorkspaceItem extends DAVInProgressSubmission
catch (NumberFormatException ne) catch (NumberFormatException ne)
{ {
throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST, throw new DAVStatusException(HttpServletResponse.SC_BAD_REQUEST,
"Error parsing number in request URI."); "Error parsing number in request URI.", ne);
} }
} }
@@ -285,7 +285,7 @@ class DAVWorkspaceItem extends DAVInProgressSubmission
{ {
throw new DAVStatusException( throw new DAVStatusException(
HttpServletResponse.SC_BAD_REQUEST, HttpServletResponse.SC_BAD_REQUEST,
"Error parsing number in property value."); "Error parsing number in property value.", ne);
} }
} }
else else

View File

@@ -310,7 +310,7 @@ public class LNISoapServlet extends AxisServlet
catch (DAVStatusException e) catch (DAVStatusException e)
{ {
throw new LNIRemoteException("PROPFIND request failed: " throw new LNIRemoteException("PROPFIND request failed: "
+ e.getStatusLine()); + e.getStatusLine(), e);
} }
catch (AuthorizeException e) catch (AuthorizeException e)
{ {
@@ -386,7 +386,7 @@ public class LNISoapServlet extends AxisServlet
catch (DAVStatusException e) catch (DAVStatusException e)
{ {
throw new LNIRemoteException("PROPPATCH request failed: " throw new LNIRemoteException("PROPPATCH request failed: "
+ e.getStatusLine()); + e.getStatusLine(), e);
} }
catch (AuthorizeException e) catch (AuthorizeException e)
{ {
@@ -516,7 +516,7 @@ public class LNISoapServlet extends AxisServlet
catch (DAVStatusException e) catch (DAVStatusException e)
{ {
throw new LNIRemoteException("COPY request failed: " throw new LNIRemoteException("COPY request failed: "
+ e.getStatusLine()); + e.getStatusLine(), e);
} }
catch (AuthorizeException e) catch (AuthorizeException e)
{ {

View File

@@ -149,6 +149,7 @@ public class DSpaceOAICatalog extends AbstractCatalog
// Log the error // Log the error
log.warn(LogManager.getHeader(context, "database_error", ""), se); log.warn(LogManager.getHeader(context, "database_error", ""), se);
// Stack trace loss as OAI Exception does not support cause
throw new OAIInternalServerError(se.toString()); throw new OAIInternalServerError(se.toString());
} }
finally finally
@@ -276,10 +277,12 @@ public class DSpaceOAICatalog extends AbstractCatalog
// Log the error // Log the error
log.warn(LogManager.getHeader(context, "database_error", ""), se); log.warn(LogManager.getHeader(context, "database_error", ""), se);
// Stack trace loss as OAI Exception does not support cause
throw new OAIInternalServerError(se.toString()); throw new OAIInternalServerError(se.toString());
} }
catch (ParseException pe) catch (ParseException pe)
{ {
// Stack trace loss as OAI Exception does not support cause
throw new OAIInternalServerError(pe.toString()); throw new OAIInternalServerError(pe.toString());
} }
finally finally
@@ -412,6 +415,7 @@ public class DSpaceOAICatalog extends AbstractCatalog
// Log the error // Log the error
log.warn(LogManager.getHeader(context, "database_error", ""), se); log.warn(LogManager.getHeader(context, "database_error", ""), se);
// Stack trace loss as OAI Exception does not support cause
throw new OAIInternalServerError(se.toString()); throw new OAIInternalServerError(se.toString());
} }
finally finally
@@ -656,10 +660,12 @@ public class DSpaceOAICatalog extends AbstractCatalog
// Log the error // Log the error
log.warn(LogManager.getHeader(context, "database_error", ""), se); log.warn(LogManager.getHeader(context, "database_error", ""), se);
// Stack trace loss as OAI Exception does not support cause
throw new OAIInternalServerError(se.toString()); throw new OAIInternalServerError(se.toString());
} }
catch (ParseException pe) catch (ParseException pe)
{ {
// Stack trace loss as OAI Exception does not support cause
throw new OAIInternalServerError(pe.toString()); throw new OAIInternalServerError(pe.toString());
} }
finally finally
@@ -678,7 +684,7 @@ public class DSpaceOAICatalog extends AbstractCatalog
* *
* @return a Map object containing "sets" Iterator object (contains * @return a Map object containing "sets" Iterator object (contains
* <setSpec/>XML Strings) as well as an optional resumptionMap Map. * <setSpec/>XML Strings) as well as an optional resumptionMap Map.
* @exception OAIBadRequestException * @exception NoSetHierarchyException
* signals an http status code 400 problem * signals an http status code 400 problem
* @exception OAIInternalServerError * @exception OAIInternalServerError
* signals an http status code 500 problem * signals an http status code 500 problem
@@ -751,6 +757,7 @@ public class DSpaceOAICatalog extends AbstractCatalog
// Log the error // Log the error
log.warn(LogManager.getHeader(context, "database_error", ""), se); log.warn(LogManager.getHeader(context, "database_error", ""), se);
// Stack trace loss as OAI Exception does not support cause
throw new OAIInternalServerError(se.toString()); throw new OAIInternalServerError(se.toString());
} }
finally finally
@@ -950,10 +957,12 @@ public class DSpaceOAICatalog extends AbstractCatalog
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
// Stack trace loss as OAI Exception does not support cause
throw new BadResumptionTokenException(); throw new BadResumptionTokenException();
} }
catch (NoSuchElementException nsee) catch (NoSuchElementException nsee)
{ {
// Stack trace loss as OAI Exception does not support cause
throw new BadResumptionTokenException(); throw new BadResumptionTokenException();
} }

View File

@@ -281,6 +281,7 @@ public class OAIDCCrosswalk extends Crosswalk
} }
catch (SQLException e) catch (SQLException e)
{ {
// Stack loss as exception does not support cause
throw new CannotDisseminateFormatException(e.toString()); throw new CannotDisseminateFormatException(e.toString());
} }
} }

View File

@@ -190,6 +190,7 @@ public class PluginCrosswalk extends Crosswalk
log.error("*** Stack trace follows:"); log.error("*** Stack trace follows:");
log.error(sw.toString()); log.error(sw.toString());
// Stack loss as exception does not support cause
throw new CannotDisseminateFormatException(schemaLabel); throw new CannotDisseminateFormatException(schemaLabel);
} }
} }

View File

@@ -115,7 +115,7 @@ public class DepositServlet extends HttpServlet {
+ className); + className);
throw new ServletException( throw new ServletException(
"Unable to instantiate class from 'sword-server-class': " "Unable to instantiate class from 'sword-server-class': "
+ className); + className, e);
} }
} }

View File

@@ -261,7 +261,7 @@ public class DummyServer implements SWORDServer {
filenames.append(" ").append(ze.toString()); filenames.append(" ").append(ze.toString());
} }
} catch (IOException ioe) { } catch (IOException ioe) {
throw new SWORDException("Failed to open deposited zip file", null, ErrorCodes.ERROR_CONTENT); throw new SWORDException("Failed to open deposited zip file", ioe, ErrorCodes.ERROR_CONTENT);
} }
// Handle the deposit // Handle the deposit

View File

@@ -94,7 +94,7 @@ public class ServiceDocumentServlet extends HttpServlet {
+ className); + className);
throw new ServletException( throw new ServletException(
"Unable to instantiate class from 'server-class': " "Unable to instantiate class from 'server-class': "
+ className); + className, e);
} }
} }

View File

@@ -195,7 +195,7 @@ public class FlowUtils {
} }
catch(Exception e) catch(Exception e)
{ {
throw new SQLException("Error loading Submission Info: " + e.getMessage()); throw new SQLException("Error loading Submission Info: " + e.getMessage(), e);
} }
} }
else if(subInfo==null && submission==null) else if(subInfo==null && submission==null)

View File

@@ -269,7 +269,7 @@ public class DSpaceFeedGenerator extends AbstractGenerator
} }
catch (IllegalArgumentException iae) catch (IllegalArgumentException iae)
{ {
throw new ResourceNotFoundException("Syndication feed format, '"+this.format+"', is not supported."); throw new ResourceNotFoundException("Syndication feed format, '"+this.format+"', is not supported.", iae);
} }
catch (FeedException fe) catch (FeedException fe)
{ {

View File

@@ -306,9 +306,7 @@ public class ContainerAdapter extends AbstractAdapter
} }
catch(ItemCountException e) catch(ItemCountException e)
{ {
IOException ioe = new IOException("Could not obtain Collection item-count"); throw new IOException("Could not obtain Collection item-count", e);
ioe.initCause(e);
throw ioe;
} }
} }
} }
@@ -342,9 +340,7 @@ public class ContainerAdapter extends AbstractAdapter
} }
catch(ItemCountException e) catch(ItemCountException e)
{ {
IOException ioe = new IOException("Could not obtain Collection item-count"); throw new IOException("Could not obtain Collection item-count", e);
ioe.initCause(e);
throw ioe;
} }
} }
} }