Permalink
Browse files

refactor: fix some hintbugs warnings (#616)

Invocation of toString() on an array
Inefficient use of keySet() iterator instead of values() iterator
Inefficient use of keySet() iterator instead of entrySet() iterator

relates to Fix huntbugs warnings #586
  • Loading branch information...
AlexElin authored and vlsi committed Aug 4, 2016
1 parent 22c72b4 commit dd71f6f3a1ea31e4b7fb4bf92188a6e87f78c633
@@ -976,12 +976,10 @@ public synchronized void insertRow() throws SQLException {
insertSQL.append(paramSQL.toString());
insertStatement = connection.prepareStatement(insertSQL.toString());
Iterator<String> keys = updateValues.keySet().iterator();
Iterator<Object> values = updateValues.values().iterator();
for (int i = 1; keys.hasNext(); i++) {
String key = keys.next();
Object o = updateValues.get(key);
insertStatement.setObject(i, o);
for (int i = 1; values.hasNext(); i++) {
insertStatement.setObject(i, values.next());
}
insertStatement.executeUpdate();
@@ -1688,10 +1686,10 @@ private void parseQuery() {
private void updateRowBuffer() throws SQLException {
for (String columnName : updateValues.keySet()) {
int columnIndex = findColumn(columnName) - 1;
for (Map.Entry<String, Object> entry : updateValues.entrySet()) {
int columnIndex = findColumn(entry.getKey()) - 1;
Object valueObject = updateValues.get(columnName);
Object valueObject = entry.getValue();
if (valueObject instanceof PGobject) {
String value = ((PGobject) valueObject).getValue();
rowBuffer[columnIndex] = (value == null) ? null : connection.encodeString(value);
@@ -79,7 +79,7 @@
continue;
}
GMT_ZONES.put(pgZoneName + Math.abs(i), timeZone);
GMT_ZONES.put(pgZoneName + NUMBERS[Math.abs(i)], timeZone);
GMT_ZONES.put(pgZoneName + new String(NUMBERS[Math.abs(i)]), timeZone);
}
// Fast path to getting the default timezone.
// Accessing the default timezone over and over creates a clone with regular API.

0 comments on commit dd71f6f

Please sign in to comment.