Question
Java function works in Eclipse but not in Pega 7.1.7
Hi there,
I created a Java method in Pega which finds and replaces the date for "Current Date" within a text (String). Everything is working fine as long as I am using as an input for the function a simple text.
During runtime when the method gets called it should replace the date for "Current Date" within a HTML code. In this situation the date gets not replaced in Pega (the function works then still fine in Eclipse).
My java function:
String regexPattern = "Current Date: [0-9]?{6}";
java.util.regex.Pattern myPattern = java.util.regex.Pattern.compile(regexPattern);
java.util.regex.Matcher myMatch = myPattern.matcher(originText);
return myMatch.replaceAll("Current Date: " + replacementText);
I guess that there could be a problem with one of the characters of the HTML code in Pega.
Has anyone a suggestion how to solve this issue?
Many thanks in advance and regards,
Manuela
I suggest you compile your code in a standalone java class and run under the same JRE of your pega 7.1.7 instance. Your eclipse JRE might be different from that of the Pega 7.1.7. If your test yields the same result as that of the java step, then the difference in runtime might be at fault. We can then debug further based on the outcome of your test.