From: <sa...@us...> - 2004-03-15 10:49:56
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3745/org/jrobin/core Modified Files: FetchRequest.java XmlTemplate.java Log Message: bug fixes Index: FetchRequest.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/FetchRequest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FetchRequest.java 10 Nov 2003 08:52:27 -0000 1.3 --- FetchRequest.java 15 Mar 2004 10:40:50 -0000 1.4 *************** *** 134,140 **** throw new RrdException("Invalid end time in fetch request: " + fetchEnd); } ! if(fetchStart >= fetchEnd) { throw new RrdException("Invalid start/end time in fetch request: " + fetchStart + ! "/" + fetchEnd); } if(resolution <= 0) { --- 134,140 ---- throw new RrdException("Invalid end time in fetch request: " + fetchEnd); } ! if(fetchStart > fetchEnd) { throw new RrdException("Invalid start/end time in fetch request: " + fetchStart + ! " > " + fetchEnd); } if(resolution <= 0) { Index: XmlTemplate.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/XmlTemplate.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XmlTemplate.java 8 Mar 2004 13:14:39 -0000 1.5 --- XmlTemplate.java 15 Mar 2004 10:40:50 -0000 1.6 *************** *** 189,199 **** private String resolveMappings(String templateValue) { Matcher matcher = PATTERN.matcher(templateValue); StringBuffer result = new StringBuffer(); while(matcher.find()) { String var = matcher.group(1); if(valueMap.containsKey(var)) { // mapping found ! matcher.appendReplacement(result, valueMap.get(var).toString()); } else { --- 189,205 ---- private String resolveMappings(String templateValue) { + if(templateValue == null) { + return null; + } Matcher matcher = PATTERN.matcher(templateValue); StringBuffer result = new StringBuffer(); + int lastMatchEnd = 0; while(matcher.find()) { String var = matcher.group(1); if(valueMap.containsKey(var)) { // mapping found ! result.append(templateValue.substring(lastMatchEnd, matcher.start())); ! result.append(valueMap.get(var).toString()); ! lastMatchEnd = matcher.end(); } else { *************** *** 204,208 **** } } ! matcher.appendTail(result); return result.toString(); } --- 210,214 ---- } } ! result.append(templateValue.substring(lastMatchEnd)); return result.toString(); } |