cziegeler 2003/03/10 07:57:43
Modified: src/java/org/apache/cocoon/environment
ForwardRedirector.java
Log:
Fixing releasing of processor
Revision Changes Path
1.3 +9 -5
cocoon-2.1/src/java/org/apache/cocoon/environment/ForwardRedirector.java
Index: ForwardRedirector.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/ForwardRedirector.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ForwardRedirector.java 10 Mar 2003 14:23:00 -0000 1.2
+++ ForwardRedirector.java 10 Mar 2003 15:57:42 -0000 1.3
@@ -144,6 +144,7 @@
private void cocoonRedirect(boolean sessionMode, String uri)
throws IOException, ProcessingException {
+ Processor actualProcessor = null;
try {
boolean rawMode = false;
String prefix;
@@ -159,7 +160,7 @@
}
}
- Processor actualProcessor;
+ Processor usedProcessor;
// Does the uri point to this sitemap or to the root sitemap?
if (uri.startsWith("//")) {
@@ -167,6 +168,7 @@
prefix = ""; // start at the root
try {
actualProcessor =
(Processor)this.manager.lookup(Processor.ROLE);
+ usedProcessor = actualProcessor;
} catch (ComponentException e) {
throw new ProcessingException("Cannot get Processor instance",
e);
}
@@ -174,7 +176,7 @@
} else if (uri.startsWith("/")) {
prefix = null; // means use current prefix
uri = uri.substring(1);
- actualProcessor = this.processor;
+ usedProcessor = this.processor;
} else {
throw new ProcessingException("Malformed cocoon URI.");
@@ -202,9 +204,9 @@
try {
if ( !this.internal ) {
- processingResult = actualProcessor.process(newEnv);
+ processingResult = usedProcessor.process(newEnv);
} else {
- ProcessingPipeline pp = actualProcessor.processInternal(newEnv);
+ ProcessingPipeline pp = usedProcessor.processInternal(newEnv);
if (pp != null) pp.release();
processingResult = pp != null;
}
@@ -225,6 +227,8 @@
String msg = "Error while redirecting to " + uri;
getLogger().error(msg, e);
throw new ProcessingException(msg, e);
+ } finally {
+ this.manager.release( actualProcessor );
}
}