Skip to content

Commit

Permalink
style: fix Q/A exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
manticore-projects committed Dec 12, 2023
1 parent a6bd09b commit 9c729cb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
25 changes: 14 additions & 11 deletions src/main/java/com/manticore/jdbc/MJdbcTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,11 @@ public ObjectArrayKey(Object[] keys) {

@Override
public boolean equals(Object o) {
if (this == o)
if (this == o) {
return true;
if (o == null || getClass() != o.getClass())
} else if (o == null || getClass() != o.getClass()) {
return false;
}
ObjectArrayKey that = (ObjectArrayKey) o;

return Arrays.deepEquals(keys, that.keys);
Expand Down Expand Up @@ -290,20 +291,20 @@ public int compareTo(ObjectArrayKey other) {
* function is designed to create columns for each key of the Category Column and to aggregate
* the values of the Aggregate Column for each Category.
*
* @param rs The ResultSet holding the source data with the category values in rows
* @param function Determine what type of aggregate function to use (SUM, COUNT, ...)
* @param rs The ResultSet holding the source data with the category values in rows
* @param function Determine what type of aggregate function to use (SUM, COUNT, ...)
* @param aggregateColumnName Specify the column name of the aggregate value
* @param categoryColumnName Identify the column that will be transformed into separate Value
* Columns
* @param categoryFormat Format the key values into column labels
* @param buildTotals If to insert Total rows below and column on the right side
* @param repeatHeader If to insert the header repeatedly before each category
* @param categoryColumnName Identify the column that will be transformed into separate Value
* Columns
* @param categoryFormat Format the key values into column labels
* @param buildTotals If to insert Total rows below and column on the right side
* @param repeatHeader If to insert the header repeatedly before each category
* @return A 2-dimensional array holding the transformed Column Names and the Data
*/
@SuppressWarnings({"PMD.ExcessiveMethodLength"})
public static Object[][] getPivotFromQuery(ResultSet rs, AggregateFunction function,
String aggregateColumnName, String categoryColumnName, Format categoryFormat,
boolean buildTotals, boolean repeatHeader) throws SQLException {
String aggregateColumnName, String categoryColumnName, Format categoryFormat,
boolean buildTotals, boolean repeatHeader) throws SQLException {
ArrayList<String> columnNames = new ArrayList<>();
int categoryColumnIndex = -1;
Class<?> categoryClass = null;
Expand All @@ -319,12 +320,14 @@ public static Object[][] getPivotFromQuery(ResultSet rs, AggregateFunction funct
categoryColumnIndex = i;
categoryClass = Class.forName(metaData.getColumnClassName(i));
} catch (ClassNotFoundException ignore) {
// do nothing
}
} else if (columnName.equalsIgnoreCase(aggregateColumnName)) {
try {
aggregateColumnIndex = i;
aggregateClass = Class.forName(metaData.getColumnClassName(i));
} catch (ClassNotFoundException ignore) {
// do nothing
}
} else {
columnNames.add(columnName);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/manticore/jdbc/MPreparedStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import java.util.List;
import java.util.Map;

public class MPreparedStatement implements Closeable {
public final class MPreparedStatement implements Closeable {
private final static int DEFAULT_BATCH_SIZE = 24;
private final PreparedStatement statement;
private final ParameterMetaData parameterMetaData;
Expand Down

0 comments on commit 9c729cb

Please sign in to comment.