Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix regex to match even if this is not the only option to the jdbc url #643

Merged
merged 1 commit into from
May 11, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.webobjects.eoaccess.EOAttribute;
import com.webobjects.eoaccess.EOEntity;
import com.webobjects.eoaccess.EOSQLExpression;
Expand Down Expand Up @@ -72,7 +73,8 @@ protected boolean shouldUseBundledJdbcInfo() {
boolean shouldUseBundledJdbcInfo = false;
String url = connectionURL();
if (url != null) {
shouldUseBundledJdbcInfo = url.toLowerCase().matches(".*(\\?|\\?.*&)" + PostgresqlPlugIn.QUERY_STRING_USE_BUNDLED_JDBC_INFO.toLowerCase() + "=(true|yes)(\\&|$)");
Matcher matcher = Pattern.compile(PostgresqlPlugIn.QUERY_STRING_USE_BUNDLED_JDBC_INFO.toLowerCase() + "=(true|yes)").matcher(url.toLowerCase());
shouldUseBundledJdbcInfo = matcher.find();
}
return shouldUseBundledJdbcInfo;
}
Expand Down Expand Up @@ -147,15 +149,15 @@ public EOSynchronizationFactory createSynchronizationFactory() {
}
}

/**
* Expression class to create. We have custom code, so we need our own class.
/**
* Expression class to create. We have custom code, so we need our own class.
*/
@Override
public Class defaultExpressionClass() {
return PostgresqlExpression.class;
}

/**
/**
* Overrides the parent implementation to provide a more efficient mechanism for generating primary keys,
* while generating the primary key support on the fly.
*
Expand Down Expand Up @@ -210,7 +212,7 @@ public NSArray<NSDictionary<String, Object>> newPrimaryKeys(int count, EOEntity
pk = Long.valueOf(pkObj.longValue());
}
results.addObject(new NSDictionary<String, Object>(pk, attrName));
}
}
}
}
finally {
Expand Down Expand Up @@ -273,7 +275,7 @@ else if (numCount == null) {
* @return the name of the sequence
*/
protected static String _sequenceNameForEntity(EOEntity entity) {
/* timc 2006-11-06
/* timc 2006-11-06
* This used to say ... + "_SEQ";
* _SEQ would get converted to _seq because postgresql converts all unquoted identifiers to lower case.
* In the future we may use enableIdentifierQuoting for sequence names so we need to set the correct case here in the first place
Expand Down