org.apache.cocoon
public class: ProcessingException [javadoc |
source]
java.lang.Object
org.apache.commons.lang.exception.NestableException
org.apache.cocoon.util.location.LocatedException
org.apache.cocoon.ProcessingException
All Implemented Interfaces:
LocatableException, MultiLocatable
Direct Known Subclasses:
ResourceNotFoundException, LibraryException, DuplicateIdException, LibraryException, IncompletenessException, ConnectionResetException, InvalidContinuationException, FormsException, BindingException
This Exception is thrown every time there is a problem in processing
a request.
- author:
< - a href="mailto:pier@apache.org">Pierpaolo Fumagalli
(Apache Software Foundation)
- version:
CVS - $Id: ProcessingException.java 433543 2006-08-22 06:22:54Z crossley $
| Constructor: |
public ProcessingException(String message) {
super(message);
}
Construct a new ProcessingException instance. |
public ProcessingException(Exception ex) {
super(ex.getMessage(), ex);
}
Creates a new ProcessingException instance. Parameters:
ex - an Exception value
|
public ProcessingException(String message,
Throwable t) {
super(message, t);
}
Construct a new ProcessingException that references
a parent Exception. |
public ProcessingException(String message,
Location location) {
super(message, location);
}
Construct a new ProcessingException that has an associated location. |
protected ProcessingException(String message,
Throwable t,
Location location) {
super(message, t, location);
}
Construct a new ProcessingException that has a parent exception
and an associated location.
This constructor is protected to enforce the use of #throwLocated(String, Throwable, Location)
which limits exception nesting as far as possible. |
| Method from org.apache.cocoon.ProcessingException Detail: |
public static ProcessingException throwLocated(String message,
Throwable thr,
Location location) throws ProcessingException {
if (thr instanceof ProcessingException) {
ProcessingException pe = (ProcessingException)thr;
pe.addLocation(location);
throw pe;
} else if (thr instanceof LocatedRuntimeException) {
LocatedRuntimeException re = (LocatedRuntimeException)thr;
re.addLocation(location);
// Rethrow
throw re;
}
throw new ProcessingException(message, thr, location);
}
Throw a located exception given an existing exception and the location where
this exception was catched.
If the exception is already a ProcessingException or a LocatedRuntimeException ,
the location is added to the original exception's location chain and the original exception
is rethrown (description is ignored) to limit exception nesting. Otherwise, a new
ProcessingException is thrown, wrapping the original exception.
Note: this method returns an exception as a convenience if you want to keep the throw
semantics in the caller code, i.e. write
throw ProcessingException.throwLocated(...);
instead of
ProcessingException.throwLocated(...);
return; |
public static ProcessingException throwLocated(String message,
Throwable thr,
List locations) throws ProcessingException {
MultiLocatable multiloc;
if (thr instanceof ProcessingException) {
multiloc = (ProcessingException)thr;
} else if (thr instanceof LocatedRuntimeException) {
multiloc = (LocatedRuntimeException)thr;
} else {
multiloc = new ProcessingException(message, thr);
}
if (locations != null) {
for (int i = 0; i < locations.size(); i++) {
multiloc.addLocation((Location)locations.get(i));
}
}
if (multiloc instanceof LocatedRuntimeException) {
throw (LocatedRuntimeException)multiloc;
} else {
throw (ProcessingException)multiloc;
}
}
Throw a located exception given an existing exception and the locations where
this exception was catched.
If the exception is already a ProcessingException or a LocatedRuntimeException ,
the locations are added to the original exception's location chain and the original exception
is rethrown (description is ignored) to limit exception nesting. Otherwise, a new
ProcessingException is thrown, wrapping the original exception.
Note: this method returns an exception as a convenience if you want to keep the throw
semantics in the caller code, i.e. write
throw ProcessingException.throwLocated(...);
instead of
ProcessingException.throwLocated(...);
return; |