cziegeler 01/10/24 02:33:04
Modified: src/org/apache/cocoon/sitemap XSLTFactoryLoader.java
Log:
Fix for IOOBException when pattern is empty
Revision Changes Path
1.11 +14 -11 xml-cocoon2/src/org/apache/cocoon/sitemap/XSLTFactoryLoader.java
Index: XSLTFactoryLoader.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/XSLTFactoryLoader.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XSLTFactoryLoader.java 2001/10/22 13:14:06 1.10
+++ XSLTFactoryLoader.java 2001/10/24 09:33:04 1.11
@@ -26,7 +26,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.10 $ $Date: 2001/10/22 13:14:06 $
+ * @version CVS $Revision: 1.11 $ $Date: 2001/10/24 09:33:04 $
*/
public class XSLTFactoryLoader {
protected static Logger log;
@@ -50,7 +50,7 @@
"\". Should implement the CodeFactory interface");
} catch (RuntimeException re){
log.debug("Exception in XSLTFactoryLoader.getMethodSource calling
className:" + className, re);
- throw re;
+ throw re;
}
}
@@ -78,7 +78,7 @@
"\". Should implement the CodeFactory interface");
} catch (RuntimeException re){
log.debug("Exception in XSLTFactoryLoader.getMethodSource calling
className:" + className, re);
- throw re;
+ throw re;
}
}
@@ -100,13 +100,13 @@
"\". Should implement the CodeFactory interface");
} catch (RuntimeException re){
log.debug("Exception in XSLTFactoryLoader.getMethodSource calling
className:" + className, re);
- throw re;
+ throw re;
}
}
public boolean isFactory(String className) {
boolean result = false;
-
+
if (className == null)
return false;
@@ -119,7 +119,7 @@
}
return result;
}
-
+
/**
* Escapes '"' and '\' characters in a String (add a '\' before them) so that
it can
* be inserted in java source.
@@ -129,7 +129,7 @@
// Nothing to escape
return string;
}
-
+
StringBuffer buf = new StringBuffer();
for (int i = 0; i < string.length(); i++) {
char ch = string.charAt(i);
@@ -140,7 +140,7 @@
}
return buf.toString();
}
-
+
/**
* Escapes like {@link escape(String)} after having removed any '\' preceding a
'{'.
* This is used to insert a pattern with escaped subsitution syntax in Java
source.
@@ -150,7 +150,7 @@
{
return escape(string);
}
-
+
StringBuffer buf = new StringBuffer();
for (int i = 0; i < string.length(); i++) {
char ch = string.charAt(i);
@@ -162,11 +162,14 @@
}
public boolean hasSubstitutions(String pattern) {
+ if (pattern.length() == 0) {
+ return false;
+ }
// Does it start by a substitution ?
if (pattern.charAt(0) == '{') {
return true;
}
-
+
// Search for an unescaped '{'
int i = 1;
while ((i = pattern.indexOf('{', i)) != -1) {
@@ -175,7 +178,7 @@
}
i++; // Pass '{'
}
-
+
return false;
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]