gianugo 2004/01/27 03:39:53
Modified: src/java/org/apache/cocoon/generation
JXTemplateGenerator.java
Log:
Fix a couple of nasty NPEs (note: a source validity object _can_ be null).
Revision Changes Path
1.31 +7 -5
cocoon-2.1/src/java/org/apache/cocoon/generation/JXTemplateGenerator.java
Index: JXTemplateGenerator.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/generation/JXTemplateGenerator.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- JXTemplateGenerator.java 11 Jan 2004 02:53:08 -0000 1.30
+++ JXTemplateGenerator.java 27 Jan 2004 11:39:53 -0000 1.31
@@ -1191,8 +1191,8 @@
int ch;
boolean inExpr = false;
boolean xpath = false;
-// int line = location.getLineNumber();
- int column = location.getColumnNumber();
+// int line = this.location.getLineNumber();
+ int column = this.location.getColumnNumber();
try {
top: while ((ch = in.read()) != -1) {
column++;
@@ -2776,8 +2776,10 @@
synchronized (cache) {
StartDocument startEvent = (StartDocument)cache.get(uri);
if (startEvent != null) {
- int valid = startEvent.compileTime.isValid();
- if ( valid == SourceValidity.UNKNOWN ) {
+ int valid = SourceValidity.UNKNOWN;
+ if (startEvent.compileTime != null)
+ valid = startEvent.compileTime.isValid();
+ if ( valid == SourceValidity.UNKNOWN &&
startEvent.compileTime != null ) {
SourceValidity validity = inputSource.getValidity();
valid = startEvent.compileTime.isValid(validity);
}