fix NPE in TemplateEngine

StackTrace For input string: ""
java.lang.NumberFormatException: For input string: ""
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:504)
	at java.lang.Integer.parseInt(Integer.java:527)
	at net.yacy.server.http.TemplateEngine.writeTemplate(TemplateEngine.java:241)
	at net.yacy.server.http.TemplateEngine.writeTemplate(TemplateEngine.java:199)
	at net.yacy.http.servlets.YaCyDefaultServlet.handleTemplate(YaCyDefaultServlet.java:896)
pull/1/head
reger 11 years ago
parent cb6d0c2113
commit ea7cef5d05

@ -236,7 +236,7 @@ public final class TemplateEngine {
final byte[] text=keyStream.toByteArray(); //text between #{key}# an #{/key}# final byte[] text=keyStream.toByteArray(); //text between #{key}# an #{/key}#
int num=0; int num=0;
final String patternKey = getPatternKey(prefix, multi_key); final String patternKey = getPatternKey(prefix, multi_key);
if(pattern.containsKey(patternKey) && pattern.get(patternKey) != null){ if(pattern.containsKey(patternKey) && !pattern.get(patternKey).isEmpty()){
try{ try{
num=Integer.parseInt(pattern.get(patternKey)); // Key contains the iteration number as string num=Integer.parseInt(pattern.get(patternKey)); // Key contains the iteration number as string
}catch(final NumberFormatException e){ }catch(final NumberFormatException e){

Loading…
Cancel
Save