BF [ 1705768 ] Convert.recoverQuotedStrings() error on strings with <-->
http://sourceforge.net/tracker/index.php?func=detail&aid=1705768&group_id=176962&atid=879332
This commit is contained in:
parent
749a0bacd4
commit
66c31c3e63
|
@ -286,16 +286,16 @@ public abstract class Convert
|
|||
protected String recoverQuotedStrings(String retValue, Vector<String>retVars) {
|
||||
Pattern p = Pattern.compile("<-->", Pattern.CASE_INSENSITIVE | Pattern.LITERAL);
|
||||
Matcher m = p.matcher(retValue);
|
||||
for (int cont = 0; cont < retVars.size(); cont++) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
// Parse the string step by step - teo_sarca [ 1705768 ]
|
||||
for (int cont = 0; cont < retVars.size() && m.find(); cont++) {
|
||||
//hengsin, special character in replacement can cause exception
|
||||
String replacement = (String) retVars.get(cont);
|
||||
replacement = escapeQuotedString(replacement);
|
||||
retValue = m.replaceFirst(Matcher.quoteReplacement(replacement));
|
||||
if (retValue.indexOf(replacement) < 0)
|
||||
System.err.println("Failed to recover: " + replacement);
|
||||
m = p.matcher(retValue);
|
||||
m.appendReplacement(sb, Matcher.quoteReplacement(replacement));
|
||||
}
|
||||
return retValue;
|
||||
m.appendTail(sb);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,13 @@ public final class Convert_PostgreSQLTest {
|
|||
String sqe;
|
||||
String[] r;
|
||||
|
||||
// Convert.recoverQuotedStrings() error on strings with "<-->" - teo_sarca [ 1705768 ]
|
||||
// http://sourceforge.net/tracker/index.php?func=detail&aid=1705768&group_id=176962&atid=879332
|
||||
sql = "SELECT 'Partner <--> Organization', 's2\\$', 's3' FROM DUAL";
|
||||
sqe = "SELECT 'Partner <--> Organization', E's2\\\\$', 's3'";
|
||||
r = convert.convert(sql);
|
||||
verify(sql, r, sqe);
|
||||
|
||||
// [ 1704261 ] can not import currency rate
|
||||
sql = "UPDATE I_Conversion_Rate i SET MultiplyRate = 1 / DivideRate WHERE (MultiplyRate IS NULL OR MultiplyRate = 0) AND DivideRate IS NOT NULL AND DivideRate<>0 AND I_IsImported<>'Y' AND AD_Client_ID=1000000";
|
||||
sqe = "UPDATE I_Conversion_Rate SET MultiplyRate = 1 / DivideRate WHERE (MultiplyRate IS NULL OR MultiplyRate = 0) AND DivideRate IS NOT NULL AND DivideRate<>0 AND I_IsImported<>'Y' AND AD_Client_ID=1000000";
|
||||
|
|
Loading…
Reference in New Issue