You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mb...@apache.org on 2017/12/09 17:34:02 UTC
svn commit: r1817637 - in
/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc:
JdbcValueHandler.java SQLProcessor.java SqlJdbcUtil.java
Author: mbrohl
Date: Sat Dec 9 17:34:02 2017
New Revision: 1817637
URL: http://svn.apache.org/viewvc?rev=1817637&view=rev
Log:
Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.entity.jdbc.
(OFBIZ-9782)
Thanks Dennis Balkir for reporting and providing the patch.
Modified:
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/JdbcValueHandler.java
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java
Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/JdbcValueHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/JdbcValueHandler.java?rev=1817637&r1=1817636&r2=1817637&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/JdbcValueHandler.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/JdbcValueHandler.java Sat Dec 9 17:34:02 2017
@@ -31,6 +31,7 @@ import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import javax.sql.rowset.serial.SerialBlob;
@@ -181,8 +182,8 @@ public abstract class JdbcValueHandler<T
}
protected static String parseSqlType(String sqlType) {
- String result = sqlType.toUpperCase();
- int pos = result.indexOf("(");
+ String result = sqlType.toUpperCase(Locale.getDefault());
+ int pos = result.indexOf('(');
if (pos != -1) {
result = result.substring(0, pos);
}
Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java?rev=1817637&r1=1817636&r2=1817637&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java Sat Dec 9 17:34:02 2017
@@ -56,9 +56,9 @@ public class SQLProcessor implements Aut
public static final String module = SQLProcessor.class.getName();
/** Used for testing connections when test is enabled */
- public static List<String> CONNECTION_TEST_LIST = new ArrayList<String>();
- public static int MAX_CONNECTIONS = 1000;
- public static boolean ENABLE_TEST = false;
+ private static final List<String> CONNECTION_TEST_LIST = new ArrayList<String>();
+ public static final int MAX_CONNECTIONS = 1000;
+ public static final boolean ENABLE_TEST = false;
private final Delegator delegator;
Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java?rev=1817637&r1=1817636&r2=1817637&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java Sat Dec 9 17:34:02 2017
@@ -225,10 +225,8 @@ public final class SqlJdbcUtil {
ModelViewEntity.ViewEntityCondition viewEntityCondition = viewLink.getViewEntityCondition();
if (viewEntityCondition != null) {
EntityCondition whereCondition = viewEntityCondition.getWhereCondition(modelFieldTypeReader, null);
- if (whereCondition != null) {
- condBuffer.append(" AND ");
- condBuffer.append(whereCondition.makeWhereString(modelEntity, null, datasourceInfo));
- }
+ condBuffer.append(" AND ");
+ condBuffer.append(whereCondition.makeWhereString(modelEntity, null, datasourceInfo));
}
restOfStatement.append(condBuffer.toString());
@@ -640,7 +638,7 @@ public final class SqlJdbcUtil {
}
} else {
String value = rs.getString(ind);
- if (value instanceof String && curField.getEncryptMethod().isEncrypted()) {
+ if (curField.getEncryptMethod().isEncrypted()) {
value = (String) entity.getDelegator().decryptFieldValue(encryptionKeyName, curField.getEncryptMethod(), value);
}
entity.dangerousSetNoCheckButFast(curField, value);