Improved: Fixing defects reported by FindBugs, package

org.apache.ofbiz.entity.jdbc.
(OFBIZ-9782)

Thanks Dennis Balkir for reporting and providing the patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1817637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Brohl
2017-12-09 17:34:02 +00:00
parent bc5c1c256e
commit c06f835668
3 changed files with 9 additions and 10 deletions
@@ -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);
}
@@ -56,9 +56,9 @@ public class SQLProcessor implements AutoCloseable {
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;
@@ -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);