You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2007/05/10 00:16:25 UTC
svn commit: r536690 -
/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java
Author: vgritsenko
Date: Wed May 9 15:16:25 2007
New Revision: 536690
URL: http://svn.apache.org/viewvc?view=rev&rev=536690
Log:
Do not fetch source's validity without reason - it ain't free.
Do use SourceValidity constants.
Modified:
cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java
Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java?view=diff&rev=536690&r1=536689&r2=536690
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java Wed May 9 15:16:25 2007
@@ -291,7 +291,9 @@
return handlerAndValidity;
} catch (Exception e) {
Throwable realEx = errorListener.getThrowable();
- if (realEx == null) realEx = e;
+ if (realEx == null) {
+ realEx = e;
+ }
if (realEx instanceof RuntimeException) {
throw (RuntimeException)realEx;
@@ -425,15 +427,6 @@
getLogger().debug("getTemplates: stylesheet " + id);
}
- SourceValidity newValidity = stylesheet.getValidity();
-
- // Only stylesheets with validity are stored
- if (newValidity == null) {
- // Remove an old template
- m_store.remove(key);
- return null;
- }
-
// Stored is an array of the templates and the caching time and list of
// includes
Object[] templateAndValidityAndIncludes = (Object[]) m_store.get(key);
@@ -442,17 +435,18 @@
return null;
}
- // Check template modification time
+ // Check template validity
SourceValidity storedValidity = (SourceValidity) templateAndValidityAndIncludes[1];
int valid = storedValidity.isValid();
- boolean isValid;
- if (valid == 0) {
- valid = storedValidity.isValid(newValidity);
- isValid = (valid == 1);
- } else {
- isValid = (valid == 1);
+ if (valid == SourceValidity.UNKNOWN) {
+ SourceValidity newValidity = stylesheet.getValidity();
+ if (newValidity != null) {
+ valid = storedValidity.isValid(newValidity);
+ }
}
- if (!isValid) {
+
+ // Only valid stylesheets are stored
+ if (valid != SourceValidity.VALID) {
m_store.remove(key);
return null;
}
@@ -472,23 +466,19 @@
aggregated.add(storedValidity);
valid = storedValidity.isValid();
- isValid = false;
- if (valid == 0) {
+ if (valid == SourceValidity.UNKNOWN) {
Source includedSource = null;
try {
includedSource = m_resolver.resolveURI((String) pair[0]);
SourceValidity included = includedSource.getValidity();
if (included != null) {
valid = storedValidity.isValid(included);
- isValid = (valid == 1);
}
} finally {
m_resolver.release(includedSource);
}
- } else {
- isValid = (valid == 1);
}
- if (!isValid) {
+ if (valid != SourceValidity.VALID) {
m_store.remove(key);
return null;
}