    /**
     * {@link QueryRunner#insertBatch(Connection, String, ResultSetHandler, Object[][])} asynchronously.
     *
     * @param <T> Return type expected
     * @param conn {@link Connection} to use to execute the SQL statement
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @param params An array of query replacement parameters.  Each row in
     *        this array is one set of batch replacement values.
     * @return {@link Future} that executes a query runner batch insert
     * @see QueryRunner#insertBatch(Connection, String, ResultSetHandler, Object[][])
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insertBatch(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object[][] params) throws SQLException {
        return executorService.submit(() -> queryRunner.insertBatch(conn, sql, rsh, params));
    }

    /**
     * {@link QueryRunner#insertBatch(Connection, String, ResultSetHandler, Object[][])} asynchronously.
     *
     * @param <T> Return type expected
     * @param conn {@link Connection} to use to execute the SQL statement
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @param params An array of query replacement parameters.  Each row in
     *        this array is one set of batch replacement values.
     * @return {@link Future} that executes a query runner batch insert
     * @see QueryRunner#insertBatch(Connection, String, ResultSetHandler, Object[][])
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insertBatch(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object[][] params) throws SQLException {
        return executorService.submit(new Callable<T>() {

            @Override
            public T call() throws Exception {
                return queryRunner.insertBatch(conn, sql, rsh, params);
            }
        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.insertBatch.submit.new Callable<T> with () -> queryRunner.insertBatch(conn,sql,rsh,params) in method public insertBatch(conn Connection, sql String, rsh ResultSetHandler<T>, params Object[][]) : Future<T> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * {@link QueryRunner#insertBatch(String, ResultSetHandler, Object[][])} asynchronously.
     *
     * @param <T> Return type expected
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @param params An array of query replacement parameters.  Each row in
     *        this array is one set of batch replacement values.
     * @return {@link Future} that executes a query runner batch insert
     * @see QueryRunner#insertBatch(String, ResultSetHandler, Object[][])
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insertBatch(final String sql, final ResultSetHandler<T> rsh, final Object[][] params) throws SQLException {
        return executorService.submit(() -> queryRunner.insertBatch(sql, rsh, params));
    }

    /**
     * {@link QueryRunner#insertBatch(String, ResultSetHandler, Object[][])} asynchronously.
     *
     * @param <T> Return type expected
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @param params An array of query replacement parameters.  Each row in
     *        this array is one set of batch replacement values.
     * @return {@link Future} that executes a query runner batch insert
     * @see QueryRunner#insertBatch(String, ResultSetHandler, Object[][])
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insertBatch(final String sql, final ResultSetHandler<T> rsh, final Object[][] params) throws SQLException {
        return executorService.submit(new Callable<T>() {

            @Override
            public T call() throws Exception {
                return queryRunner.insertBatch(sql, rsh, params);
            }
        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.insertBatch.submit.new Callable<T> with () -> queryRunner.insertBatch(sql,rsh,params) in method public insertBatch(sql String, rsh ResultSetHandler<T>, params Object[][]) : Future<T> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Execute an SQL SELECT query without any replacement parameters.  The
     * caller is responsible for closing the connection.
     * @param <T> The type of object that the handler returns
     * @param conn The connection to execute the query in.
     * @param sql The query to execute.
     * @param rsh The handler that converts the results into an object.
     * @return A {@code Future} which returns the result of the query call.
     * @throws SQLException if a database access error occurs
     */
    public <T> Future<T> query(final Connection conn, final String sql, final ResultSetHandler<T> rsh) throws SQLException {
        return executorService.submit(() -> queryRunner.query(conn, sql, rsh));
    }

    /**
     * Execute an SQL SELECT query without any replacement parameters.  The
     * caller is responsible for closing the connection.
     * @param <T> The type of object that the handler returns
     * @param conn The connection to execute the query in.
     * @param sql The query to execute.
     * @param rsh The handler that converts the results into an object.
     * @return A {@code Future} which returns the result of the query call.
     * @throws SQLException if a database access error occurs
     */
    public <T> Future<T> query(final Connection conn, final String sql, final ResultSetHandler<T> rsh) throws SQLException {
        return executorService.submit(new Callable<T>() {

            @Override
            public T call() throws Exception {
                return queryRunner.query(conn, sql, rsh);
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.query.submit.new Callable<T> with () -> queryRunner.query(conn,sql,rsh) in method public query(conn Connection, sql String, rsh ResultSetHandler<T>) : Future<T> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Execute an SQL SELECT query with replacement parameters.  The
     * caller is responsible for closing the connection.
     * @param <T> The type of object that the handler returns
     * @param conn The connection to execute the query in.
     * @param sql The query to execute.
     * @param rsh The handler that converts the results into an object.
     * @param params The replacement parameters.
     * @return A {@code Future} which returns the result of the query call.
     * @throws SQLException if a database access error occurs
     */
    public <T> Future<T> query(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params)
            throws SQLException {
        return executorService.submit(() -> queryRunner.query(conn, sql, rsh, params));
    }

    /**
     * Execute an SQL SELECT query with replacement parameters.  The
     * caller is responsible for closing the connection.
     * @param <T> The type of object that the handler returns
     * @param conn The connection to execute the query in.
     * @param sql The query to execute.
     * @param rsh The handler that converts the results into an object.
     * @param params The replacement parameters.
     * @return A {@code Future} which returns the result of the query call.
     * @throws SQLException if a database access error occurs
     */
    public <T> Future<T> query(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params)
            throws SQLException {
        return executorService.submit(new Callable<T>() {

            @Override
            public T call() throws Exception {
                return queryRunner.query(conn, sql, rsh, params);
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.query.submit.new Callable<T> with () -> queryRunner.query(conn,sql,rsh,params) in method public query(conn Connection, sql String, rsh ResultSetHandler<T>, params Object...) : Future<T> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Executes the given SELECT SQL without any replacement parameters.
     * The {@code Connection} is retrieved from the
     * {@code DataSource} set in the constructor.
     * @param <T> The type of object that the handler returns
     * @param sql The SQL statement to execute.
     * @param rsh The handler used to create the result object from
     * the {@code ResultSet}.
     *
     * @return A {@code Future} which returns the result of the query call.
     * @throws SQLException if a database access error occurs
     */
    public <T> Future<T> query(final String sql, final ResultSetHandler<T> rsh) throws SQLException {
        return executorService.submit(() -> queryRunner.query(sql, rsh));
    }

    /**
     * Executes the given SELECT SQL without any replacement parameters.
     * The {@code Connection} is retrieved from the
     * {@code DataSource} set in the constructor.
     * @param <T> The type of object that the handler returns
     * @param sql The SQL statement to execute.
     * @param rsh The handler used to create the result object from
     * the {@code ResultSet}.
     *
     * @return A {@code Future} which returns the result of the query call.
     * @throws SQLException if a database access error occurs
     */
    public <T> Future<T> query(final String sql, final ResultSetHandler<T> rsh) throws SQLException {
        return executorService.submit(new Callable<T>() {

            @Override
            public T call() throws Exception {
                return queryRunner.query(sql, rsh);
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.query.submit.new Callable<T> with () -> queryRunner.query(sql,rsh) in method public query(sql String, rsh ResultSetHandler<T>) : Future<T> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Executes the given SELECT SQL query and returns a result object.
     * The {@code Connection} is retrieved from the
     * {@code DataSource} set in the constructor.
     * @param <T> The type of object that the handler returns
     * @param sql The SQL statement to execute.
     * @param rsh The handler used to create the result object from
     * the {@code ResultSet}.
     * @param params Initialize the PreparedStatement's IN parameters with
     * this array.
     * @return A {@code Future} which returns the result of the query call.
     * @throws SQLException if a database access error occurs
     */
    public <T> Future<T> query(final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
        return executorService.submit(() -> queryRunner.query(sql, rsh, params));
    }

    /**
     * Executes the given SELECT SQL query and returns a result object.
     * The {@code Connection} is retrieved from the
     * {@code DataSource} set in the constructor.
     * @param <T> The type of object that the handler returns
     * @param sql The SQL statement to execute.
     * @param rsh The handler used to create the result object from
     * the {@code ResultSet}.
     * @param params Initialize the PreparedStatement's IN parameters with
     * this array.
     * @return A {@code Future} which returns the result of the query call.
     * @throws SQLException if a database access error occurs
     */
    public <T> Future<T> query(final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
        return executorService.submit(new Callable<T>() {

            @Override
            public T call() throws Exception {
                return queryRunner.query(sql, rsh, params);
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.query.submit.new Callable<T> with () -> queryRunner.query(sql,rsh,params) in method public query(sql String, rsh ResultSetHandler<T>, params Object...) : Future<T> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Execute an SQL INSERT, UPDATE, or DELETE query without replacement
     * parameters.
     *
     * @param conn The connection to use to run the query.
     * @param sql The SQL to execute.
     * @return A {@code Future} which returns the number of rows updated.
     * @throws SQLException if a database access error occurs
     */
    public Future<Integer> update(final Connection conn, final String sql) throws SQLException {
        return executorService.submit(() -> Integer.valueOf(queryRunner.update(conn, sql)));
    }

    /**
     * Execute an SQL INSERT, UPDATE, or DELETE query without replacement
     * parameters.
     *
     * @param conn The connection to use to run the query.
     * @param sql The SQL to execute.
     * @return A {@code Future} which returns the number of rows updated.
     * @throws SQLException if a database access error occurs
     */
    public Future<Integer> update(final Connection conn, final String sql) throws SQLException {
        return executorService.submit(new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return Integer.valueOf(queryRunner.update(conn, sql));
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.update.submit.new Callable<Integer> with () -> Integer.valueOf(queryRunner.update(conn,sql)) in method public update(conn Connection, sql String) : Future<Integer> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Execute an SQL INSERT, UPDATE, or DELETE query with a single replacement
     * parameter.
     *
     * @param conn The connection to use to run the query.
     * @param sql The SQL to execute.
     * @param param The replacement parameter.
     * @return A {@code Future} which returns the number of rows updated.
     * @throws SQLException if a database access error occurs
     */
    public Future<Integer> update(final Connection conn, final String sql, final Object param) throws SQLException {
        return executorService.submit(() -> Integer.valueOf(queryRunner.update(conn, sql, param)));
    }

    /**
     * Execute an SQL INSERT, UPDATE, or DELETE query with a single replacement
     * parameter.
     *
     * @param conn The connection to use to run the query.
     * @param sql The SQL to execute.
     * @param param The replacement parameter.
     * @return A {@code Future} which returns the number of rows updated.
     * @throws SQLException if a database access error occurs
     */
    public Future<Integer> update(final Connection conn, final String sql, final Object param) throws SQLException {
        return executorService.submit(new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return Integer.valueOf(queryRunner.update(conn, sql, param));
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.update.submit.new Callable<Integer> with () -> Integer.valueOf(queryRunner.update(conn,sql,param)) in method public update(conn Connection, sql String, param Object) : Future<Integer> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Execute an SQL INSERT, UPDATE, or DELETE query.
     *
     * @param conn The connection to use to run the query.
     * @param sql The SQL to execute.
     * @param params The query replacement parameters.
     * @return A {@code Future} which returns the number of rows updated.
     * @throws SQLException if a database access error occurs
     */
    public Future<Integer> update(final Connection conn, final String sql, final Object... params) throws SQLException {
        return executorService.submit(() -> Integer.valueOf(queryRunner.update(conn, sql, params)));
    }

    /**
     * Execute an SQL INSERT, UPDATE, or DELETE query.
     *
     * @param conn The connection to use to run the query.
     * @param sql The SQL to execute.
     * @param params The query replacement parameters.
     * @return A {@code Future} which returns the number of rows updated.
     * @throws SQLException if a database access error occurs
     */
    public Future<Integer> update(final Connection conn, final String sql, final Object... params) throws SQLException {
        return executorService.submit(new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return Integer.valueOf(queryRunner.update(conn, sql, params));
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.update.submit.new Callable<Integer> with () -> Integer.valueOf(queryRunner.update(conn,sql,params)) in method public update(conn Connection, sql String, params Object...) : Future<Integer> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Executes the given INSERT, UPDATE, or DELETE SQL statement without
     * any replacement parameters. The {@code Connection} is retrieved
     * from the {@code DataSource} set in the constructor.  This
     * {@code Connection} must be in auto-commit mode or the update will
     * not be saved.
     *
     * @param sql The SQL statement to execute.
     * @throws SQLException if a database access error occurs
     * @return A {@code Future} which returns the number of rows updated.
     */
    public Future<Integer> update(final String sql) throws SQLException {
        return executorService.submit(() -> Integer.valueOf(queryRunner.update(sql)));
    }

    /**
     * Executes the given INSERT, UPDATE, or DELETE SQL statement without
     * any replacement parameters. The {@code Connection} is retrieved
     * from the {@code DataSource} set in the constructor.  This
     * {@code Connection} must be in auto-commit mode or the update will
     * not be saved.
     *
     * @param sql The SQL statement to execute.
     * @throws SQLException if a database access error occurs
     * @return A {@code Future} which returns the number of rows updated.
     */
    public Future<Integer> update(final String sql) throws SQLException {
        return executorService.submit(new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return Integer.valueOf(queryRunner.update(sql));
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.update.submit.new Callable<Integer> with () -> Integer.valueOf(queryRunner.update(sql)) in method public update(sql String) : Future<Integer> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Executes the given INSERT, UPDATE, or DELETE SQL statement with
     * a single replacement parameter.  The {@code Connection} is
     * retrieved from the {@code DataSource} set in the constructor.
     * This {@code Connection} must be in auto-commit mode or the
     * update will not be saved.
     *
     * @param sql The SQL statement to execute.
     * @param param The replacement parameter.
     * @throws SQLException if a database access error occurs
     * @return A {@code Future} which returns the number of rows updated.
     */
    public Future<Integer> update(final String sql, final Object param) throws SQLException {
        return executorService.submit(() -> Integer.valueOf(queryRunner.update(sql, param)));
    }

    /**
     * Executes the given INSERT, UPDATE, or DELETE SQL statement with
     * a single replacement parameter.  The {@code Connection} is
     * retrieved from the {@code DataSource} set in the constructor.
     * This {@code Connection} must be in auto-commit mode or the
     * update will not be saved.
     *
     * @param sql The SQL statement to execute.
     * @param param The replacement parameter.
     * @throws SQLException if a database access error occurs
     * @return A {@code Future} which returns the number of rows updated.
     */
    public Future<Integer> update(final String sql, final Object param) throws SQLException {
        return executorService.submit(new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return Integer.valueOf(queryRunner.update(sql, param));
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.update.submit.new Callable<Integer> with () -> Integer.valueOf(queryRunner.update(sql,param)) in method public update(sql String, param Object) : Future<Integer> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Executes the given INSERT, UPDATE, or DELETE SQL statement.  The
     * {@code Connection} is retrieved from the {@code DataSource}
     * set in the constructor.  This {@code Connection} must be in
     * auto-commit mode or the update will not be saved.
     *
     * @param sql The SQL statement to execute.
     * @param params Initializes the PreparedStatement's IN (i.e. '?')
     * parameters.
     * @throws SQLException if a database access error occurs
     * @return A {@code Future} which returns the number of rows updated.
     */
    public Future<Integer> update(final String sql, final Object... params) throws SQLException {
        return executorService.submit(() -> Integer.valueOf(queryRunner.update(sql, params)));
    }

    /**
     * Executes the given INSERT, UPDATE, or DELETE SQL statement.  The
     * {@code Connection} is retrieved from the {@code DataSource}
     * set in the constructor.  This {@code Connection} must be in
     * auto-commit mode or the update will not be saved.
     *
     * @param sql The SQL statement to execute.
     * @param params Initializes the PreparedStatement's IN (i.e. '?')
     * parameters.
     * @throws SQLException if a database access error occurs
     * @return A {@code Future} which returns the number of rows updated.
     */
    public Future<Integer> update(final String sql, final Object... params) throws SQLException {
        return executorService.submit(new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                return Integer.valueOf(queryRunner.update(sql, params));
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.update.submit.new Callable<Integer> with () -> Integer.valueOf(queryRunner.update(sql,params)) in method public update(sql String, params Object...) : Future<Integer> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Fill the {@code PreparedStatement} replacement parameters with the
     * given object's bean property values.
     *
     * @param stmt
     *            PreparedStatement to fill
     * @param bean
     *            a JavaBean object
     * @param properties
     *            an ordered array of properties; this gives the order to insert
     *            values in the statement
     * @throws SQLException
     *             if a database access error occurs
     */
    public void fillStatementWithBean(final PreparedStatement stmt, final Object bean,
            final PropertyDescriptor[] properties) throws SQLException {
        final Object[] params = new Object[properties.length];
        for (int i = 0; i < properties.length; i++) {
            final PropertyDescriptor property = properties[i];
            Object value = null;
            final Method method = property.getReadMethod();
            if (method == null) {
                throw new RuntimeException("No read method for bean property "
                        + bean.getClass() + " " + property.getName());
            }
            try {
                value = method.invoke(bean);
            } catch (final IllegalArgumentException e) {
                throw new RuntimeException(
                        "Couldn't invoke method with 0 arguments: " + method, e);
            } catch (final InvocationTargetException | IllegalAccessException e) {
                throw new RuntimeException("Couldn't invoke method: " + method,
                        e);
            }
            params[i] = value;
        }
        fillStatement(stmt, params);
    }

    /**
     * Fill the {@code PreparedStatement} replacement parameters with the
     * given object's bean property values.
     *
     * @param stmt
     *            PreparedStatement to fill
     * @param bean
     *            a JavaBean object
     * @param properties
     *            an ordered array of properties; this gives the order to insert
     *            values in the statement
     * @throws SQLException
     *             if a database access error occurs
     */
    public void fillStatementWithBean(final PreparedStatement stmt, final Object bean,
            final PropertyDescriptor[] properties) throws SQLException {
        final Object[] params = new Object[properties.length];
        for (int i = 0; i < properties.length; i++) {
            final PropertyDescriptor property = properties[i];
            Object value = null;
            final Method method = property.getReadMethod();
            if (method == null) {
                throw new RuntimeException("No read method for bean property "
                        + bean.getClass() + " " + property.getName());
            }
            try {
                value = method.invoke(bean);
            } catch (final InvocationTargetException e) {
                throw new RuntimeException("Couldn't invoke method: " + method,
                        e);
            } catch (final IllegalArgumentException e) {
                throw new RuntimeException(
                        "Couldn't invoke method with 0 arguments: " + method, e);
            } catch (final IllegalAccessException e) {
                throw new RuntimeException("Couldn't invoke method: " + method,
                        e);
            }
            params[i] = value;
        }
        fillStatement(stmt, params);
    }

Merge Catch [catch(final InvocationTargetException e), catch(final IllegalAccessException e)] to catch(final InvocationTargetException|IllegalAccessException e) in method public fillStatementWithBean(stmt PreparedStatement, bean Object, properties PropertyDescriptor[]) : void from class org.apache.commons.dbutils.AbstractQueryRunner


    /**
     * Calls the setter method on the target object for the given property.
     * If no setter method exists for the property, this method does nothing.
     * @param target The object to set the property on.
     * @param prop The property to set.
     * @param value The value to pass into the setter.
     * @throws SQLException if an error occurs setting the property.
     */
    private void callSetter(final Object target, final PropertyDescriptor prop, Object value)
            throws SQLException {

        final Method setter = getWriteMethod(target, prop, value);

        if (setter == null || setter.getParameterTypes().length != 1) {
            return;
        }

        try {
            final Class<?> firstParam = setter.getParameterTypes()[0];
            for (final PropertyHandler handler : propertyHandlers) {
                if (handler.match(firstParam, value)) {
                    value = handler.apply(firstParam, value);
                    break;
                }
            }

            // Don't call setter if the value object isn't the right type
            if (this.isCompatibleType(value, firstParam)) {
                setter.invoke(target, value);
            } else {
              throw new SQLException(
                  "Cannot set " + prop.getName() + ": incompatible types, cannot convert "
                  + value.getClass().getName() + " to " + firstParam.getName());
                  // value cannot be null here because isCompatibleType allows null
            }

        } catch (final IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
            throw new SQLException(
                "Cannot set " + prop.getName() + ": " + e.getMessage());
        }
    }

    /**
     * Calls the setter method on the target object for the given property.
     * If no setter method exists for the property, this method does nothing.
     * @param target The object to set the property on.
     * @param prop The property to set.
     * @param value The value to pass into the setter.
     * @throws SQLException if an error occurs setting the property.
     */
    private void callSetter(final Object target, final PropertyDescriptor prop, Object value)
            throws SQLException {

        final Method setter = getWriteMethod(target, prop, value);

        if (setter == null || setter.getParameterTypes().length != 1) {
            return;
        }

        try {
            final Class<?> firstParam = setter.getParameterTypes()[0];
            for (final PropertyHandler handler : propertyHandlers) {
                if (handler.match(firstParam, value)) {
                    value = handler.apply(firstParam, value);
                    break;
                }
            }

            // Don't call setter if the value object isn't the right type
            if (this.isCompatibleType(value, firstParam)) {
                setter.invoke(target, value);
            } else {
              throw new SQLException(
                  "Cannot set " + prop.getName() + ": incompatible types, cannot convert "
                  + value.getClass().getName() + " to " + firstParam.getName());
                  // value cannot be null here because isCompatibleType allows null
            }

        } catch (final IllegalArgumentException e) {
            throw new SQLException(
                "Cannot set " + prop.getName() + ": " + e.getMessage());

        } catch (final IllegalAccessException e) {
            throw new SQLException(
                "Cannot set " + prop.getName() + ": " + e.getMessage());

        } catch (final InvocationTargetException e) {
            throw new SQLException(
                "Cannot set " + prop.getName() + ": " + e.getMessage());
        }
    }

Merge Catch [catch(final IllegalArgumentException e), catch(final IllegalAccessException e), catch(final InvocationTargetException e)] to catch(final IllegalArgumentException|IllegalAccessException|InvocationTargetException e) in method private callSetter(target Object, prop PropertyDescriptor, value Object) : void from class org.apache.commons.dbutils.BeanProcessor


        /**
         * Java 1.7 method.
         */
        @Override
        public Logger getParentLogger() throws SQLFeatureNotSupportedException {
            if (parentLoggerSupported) {
                try {
                    final Method method = adapted.getClass().getMethod("getParentLogger");
                    return (Logger)method.invoke(adapted);
                } catch (final NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
                    parentLoggerSupported = false;
                    throw new SQLFeatureNotSupportedException(e);
                }
            }
            throw new SQLFeatureNotSupportedException();
        }

        /**
         * Java 1.7 method.
         */
        @Override
        public Logger getParentLogger() throws SQLFeatureNotSupportedException {
            if (parentLoggerSupported) {
                try {
                    final Method method = adapted.getClass().getMethod("getParentLogger");
                    return (Logger)method.invoke(adapted);
                } catch (final NoSuchMethodException e) {
                    parentLoggerSupported = false;
                    throw new SQLFeatureNotSupportedException(e);
                } catch (final IllegalAccessException e) {
                    parentLoggerSupported = false;
                    throw new SQLFeatureNotSupportedException(e);
                } catch (final InvocationTargetException e) {
                    parentLoggerSupported = false;
                    throw new SQLFeatureNotSupportedException(e);
                }
            }
            throw new SQLFeatureNotSupportedException();
        }

Merge Catch [catch(final NoSuchMethodException e), catch(final IllegalAccessException e), catch(final InvocationTargetException e)] to catch(final NoSuchMethodException|IllegalAccessException|InvocationTargetException e) in method public getParentLogger() : Logger from class org.apache.commons.dbutils.DbUtils.DriverProxy


    /**
     * Factory method that returns a new instance of the given Class.  This
     * is called at the start of the bean creation process and may be
     * overridden to provide custom behavior like returning a cached bean
     * instance.
     * @param <T> The type of object to create
     * @param c The Class to create an object from.
     * @return A newly created object of the Class.
     * @throws SQLException if creation failed.
     */
    protected <T> T newInstance(final Class<T> c) throws SQLException {
        try {
            return c.getDeclaredConstructor().newInstance();

        } catch (final IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
            throw new SQLException(
                "Cannot create " + c.getName() + ": " + e.getMessage());
        }
    }

    /**
     * Factory method that returns a new instance of the given Class.  This
     * is called at the start of the bean creation process and may be
     * overridden to provide custom behavior like returning a cached bean
     * instance.
     * @param <T> The type of object to create
     * @param c The Class to create an object from.
     * @return A newly created object of the Class.
     * @throws SQLException if creation failed.
     */
    protected <T> T newInstance(final Class<T> c) throws SQLException {
        try {
            return c.newInstance();

        } catch (final InstantiationException e) {
            throw new SQLException(
                "Cannot create " + c.getName() + ": " + e.getMessage());

        } catch (final IllegalAccessException e) {
            throw new SQLException(
                "Cannot create " + c.getName() + ": " + e.getMessage());
        }
    }

Merge Catch [catch(final InstantiationException e), catch(final IllegalAccessException e)] to catch(final IllegalAccessException|InstantiationException|InvocationTargetException|NoSuchMethodException e) in method protected newInstance(c Class<T>) : T from class org.apache.commons.dbutils.BeanProcessor


    public void testMapColumnToPropertiesWithOverrides() throws Exception {
        Map<String, String> columnToPropertyOverrides = new HashMap<>();
        columnToPropertyOverrides.put("five", "four");
        BeanProcessor beanProc = new BeanProcessor(columnToPropertyOverrides);
        String[] columnNames = { "test", "test", "three", "five" };
        String[] columnLabels = { "one", "two", null, null };
        ResultSetMetaData rsmd = ProxyFactory.instance().createResultSetMetaData(
                new MockResultSetMetaData(columnNames, columnLabels));
        PropertyDescriptor[] props = Introspector.getBeanInfo(MapColumnToPropertiesBean.class).getPropertyDescriptors();

        int[] columns = beanProc.mapColumnsToProperties(rsmd, props);
        for (int i = 1; i < columns.length; i++) {
            assertTrue(columns[i] != BeanProcessor.PROPERTY_NOT_FOUND);
        }
    }

    public void testMapColumnToPropertiesWithOverrides() throws Exception {
        Map<String, String> columnToPropertyOverrides = new HashMap<String, String>();
        columnToPropertyOverrides.put("five", "four");
        BeanProcessor beanProc = new BeanProcessor(columnToPropertyOverrides);
        String[] columnNames = { "test", "test", "three", "five" };
        String[] columnLabels = { "one", "two", null, null };
        ResultSetMetaData rsmd = ProxyFactory.instance().createResultSetMetaData(
                new MockResultSetMetaData(columnNames, columnLabels));
        PropertyDescriptor[] props = Introspector.getBeanInfo(MapColumnToPropertiesBean.class).getPropertyDescriptors();

        int[] columns = beanProc.mapColumnsToProperties(rsmd, props);
        for (int i = 1; i < columns.length; i++) {
            assertTrue(columns[i] != BeanProcessor.PROPERTY_NOT_FOUND);
        }
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testMapColumnToPropertiesWithOverrides() : void from class org.apache.commons.dbutils.BeanProcessorTest


    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);    // init the mocks

        parameter = new OutParameter<>(Types.INTEGER, Number.class);
    }

    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);    // init the mocks

        parameter = new OutParameter<Number>(Types.INTEGER, Number.class);
    }

Replace Generic With Diamond OutParameter<Number> with OutParameter<> in method public setUp() : void from class org.apache.commons.dbutils.OutParameterTest


    @Test
    public void testRegisterAlternateConstructor() throws Exception {
        parameter = new OutParameter<>(Types.INTEGER, Number.class, VALUE);
        parameter.register(stmt, INDEX);
        verify(stmt, times(1)).registerOutParameter(INDEX, Types.INTEGER);
        verify(stmt, times(1)).setObject(INDEX, VALUE);
    }

    @Test
    public void testRegisterAlternateConstructor() throws Exception {
        parameter = new OutParameter<Number>(Types.INTEGER, Number.class, VALUE);
        parameter.register(stmt, INDEX);
        verify(stmt, times(1)).registerOutParameter(INDEX, Types.INTEGER);
        verify(stmt, times(1)).setObject(INDEX, VALUE);
    }

Replace Generic With Diamond OutParameter<Number> with OutParameter<> in method public testRegisterAlternateConstructor() : void from class org.apache.commons.dbutils.OutParameterTest


            @Override
            public List<Object> handle(ResultSet rs) throws SQLException
            {
                List<Object> objects = new ArrayList<>();
                while (rs.next())
                {
                    objects.add(new Object());
                }
                return objects;
            }

            @Override
            public List<Object> handle(ResultSet rs) throws SQLException
            {
                List<Object> objects = new ArrayList<Object>();
                while (rs.next())
                {
                    objects.add(new Object());
                }
                return objects;
            }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method public handle(rs ResultSet) : List<Object> from class org.apache.commons.dbutils.QueryRunnerTest.testGoodBatchInsert.handler.new ResultSetHandler<List<Object>>


    @Test
    public void testGoodBatchInsert() throws Exception {
        results = mock(ResultSet.class);
        resultsMeta = mock(ResultSetMetaData.class);

        when(meta.getParameterCount()).thenReturn(2);
        when(conn.prepareStatement(any(String.class), eq(Statement.RETURN_GENERATED_KEYS))).thenReturn(stmt);
        when(stmt.getGeneratedKeys()).thenReturn(results);
        when(results.next()).thenReturn(true).thenReturn(true).thenReturn(false);
        when(results.getMetaData()).thenReturn(resultsMeta);
        when(resultsMeta.getColumnCount()).thenReturn(1);

        ResultSetHandler<List<Object>> handler = new ResultSetHandler<List<Object>>()
        {
            @Override
            public List<Object> handle(ResultSet rs) throws SQLException
            {
                List<Object> objects = new ArrayList<>();
                while (rs.next())
                {
                    objects.add(new Object());
                }
                return objects;
            }
        };

        Object[][] params = new Object[2][2];
        params[0][0] = "Test";
        params[0][1] = "Blah";
        params[1][0] = "Test2";
        params[1][1] = "Blah2";

        List<Object> generatedKeys = runner.insertBatch("INSERT INTO blah(col1, col2) VALUES(?,?)", handler, params);

        verify(stmt, times(2)).addBatch();
        verify(stmt, times(1)).executeBatch();
        verify(stmt, times(1)).close();    // make sure we closed the statement
        verify(conn, times(1)).close();    // make sure we closed the connection

        Assert.assertEquals(2, generatedKeys.size());
    }

    @Test
    public void testGoodBatchInsert() throws Exception {
        results = mock(ResultSet.class);
        resultsMeta = mock(ResultSetMetaData.class);

        when(meta.getParameterCount()).thenReturn(2);
        when(conn.prepareStatement(any(String.class), eq(Statement.RETURN_GENERATED_KEYS))).thenReturn(stmt);
        when(stmt.getGeneratedKeys()).thenReturn(results);
        when(results.next()).thenReturn(true).thenReturn(true).thenReturn(false);
        when(results.getMetaData()).thenReturn(resultsMeta);
        when(resultsMeta.getColumnCount()).thenReturn(1);

        ResultSetHandler<List<Object>> handler = new ResultSetHandler<List<Object>>()
        {
            @Override
            public List<Object> handle(ResultSet rs) throws SQLException
            {
                List<Object> objects = new ArrayList<Object>();
                while (rs.next())
                {
                    objects.add(new Object());
                }
                return objects;
            }
        };

        Object[][] params = new Object[2][2];
        params[0][0] = "Test";
        params[0][1] = "Blah";
        params[1][0] = "Test2";
        params[1][1] = "Blah2";

        List<Object> generatedKeys = runner.insertBatch("INSERT INTO blah(col1, col2) VALUES(?,?)", handler, params);

        verify(stmt, times(2)).addBatch();
        verify(stmt, times(1)).executeBatch();
        verify(stmt, times(1)).close();    // make sure we closed the statement
        verify(conn, times(1)).close();    // make sure we closed the connection

        Assert.assertEquals(2, generatedKeys.size());
    }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method public testGoodBatchInsert() : void from class org.apache.commons.dbutils.QueryRunnerTest


    public void testHandle() throws SQLException {
        ResultSetHandler<TestBean> h = new BeanHandler<>(TestBean.class);
        TestBean results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals("1", results.getOne());
        assertEquals("2", results.getTwo());
        assertEquals(TestBean.Ordinal.THREE, results.getThree());
        assertEquals("not set", results.getDoNotSet());
    }

    public void testHandle() throws SQLException {
        ResultSetHandler<TestBean> h = new BeanHandler<TestBean>(TestBean.class);
        TestBean results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals("1", results.getOne());
        assertEquals("2", results.getTwo());
        assertEquals(TestBean.Ordinal.THREE, results.getThree());
        assertEquals("not set", results.getDoNotSet());
    }

Replace Generic With Diamond BeanHandler<TestBean> with BeanHandler<> in method public testHandle() : void from class org.apache.commons.dbutils.handlers.BeanHandlerTest


    public void testEmptyResultSetHandle() throws SQLException {
        ResultSetHandler<TestBean> h = new BeanHandler<>(TestBean.class);
        TestBean results = h.handle(this.emptyResultSet);

        assertNull(results);
    }

    public void testEmptyResultSetHandle() throws SQLException {
        ResultSetHandler<TestBean> h = new BeanHandler<TestBean>(TestBean.class);
        TestBean results = h.handle(this.emptyResultSet);

        assertNull(results);
    }

Replace Generic With Diamond BeanHandler<TestBean> with BeanHandler<> in method public testEmptyResultSetHandle() : void from class org.apache.commons.dbutils.handlers.BeanHandlerTest


    public void testHandle() throws SQLException {
        ResultSetHandler<List<TestBean>> h = new BeanListHandler<>(TestBean.class);
        List<TestBean> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        Iterator<TestBean> iter = results.iterator();
        TestBean row = null;
        assertTrue(iter.hasNext());
        row = iter.next();
        assertEquals("1", row.getOne());
        assertEquals("2", row.getTwo());
        assertEquals(TestBean.Ordinal.THREE, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertTrue(iter.hasNext());
        row = iter.next();

        assertEquals("4", row.getOne());
        assertEquals("5", row.getTwo());
        assertEquals(TestBean.Ordinal.SIX, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertFalse(iter.hasNext());
    }

    public void testHandle() throws SQLException {
        ResultSetHandler<List<TestBean>> h = new BeanListHandler<TestBean>(TestBean.class);
        List<TestBean> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        Iterator<TestBean> iter = results.iterator();
        TestBean row = null;
        assertTrue(iter.hasNext());
        row = iter.next();
        assertEquals("1", row.getOne());
        assertEquals("2", row.getTwo());
        assertEquals(TestBean.Ordinal.THREE, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertTrue(iter.hasNext());
        row = iter.next();

        assertEquals("4", row.getOne());
        assertEquals("5", row.getTwo());
        assertEquals(TestBean.Ordinal.SIX, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertFalse(iter.hasNext());
    }

Replace Generic With Diamond BeanListHandler<TestBean> with BeanListHandler<> in method public testHandle() : void from class org.apache.commons.dbutils.handlers.BeanListHandlerTest


    public void testEmptyResultSetHandle() throws SQLException {
        ResultSetHandler<List<TestBean>> h = new BeanListHandler<>(TestBean.class);
        List<TestBean> results = h.handle(this.emptyResultSet);

        assertNotNull(results);
        assertTrue(results.isEmpty());
    }

    public void testEmptyResultSetHandle() throws SQLException {
        ResultSetHandler<List<TestBean>> h = new BeanListHandler<TestBean>(TestBean.class);
        List<TestBean> results = h.handle(this.emptyResultSet);

        assertNotNull(results);
        assertTrue(results.isEmpty());
    }

Replace Generic With Diamond BeanListHandler<TestBean> with BeanListHandler<> in method public testEmptyResultSetHandle() : void from class org.apache.commons.dbutils.handlers.BeanListHandlerTest


    @Test
    public void testBeanMapHandlerClassOfV() throws Exception {
        bmh = new BeanMapHandler<>(TestBean.class);
        handle();
    }

    @Test
    public void testBeanMapHandlerClassOfV() throws Exception {
        bmh = new BeanMapHandler<Long, TestBean>(TestBean.class);
        handle();
    }

Replace Generic With Diamond BeanMapHandler<Long,TestBean> with BeanMapHandler<> in method public testBeanMapHandlerClassOfV() : void from class org.apache.commons.dbutils.handlers.BeanMapHandlerTest


    @Test
    public void testBeanMapHandlerClassOfVRowProcessor() throws Exception {
        bmh = new BeanMapHandler<>(TestBean.class, rp);
        handle();
    }

    @Test
    public void testBeanMapHandlerClassOfVRowProcessor() throws Exception {
        bmh = new BeanMapHandler<Long, TestBean>(TestBean.class, rp);
        handle();
    }

Replace Generic With Diamond BeanMapHandler<Long,TestBean> with BeanMapHandler<> in method public testBeanMapHandlerClassOfVRowProcessor() : void from class org.apache.commons.dbutils.handlers.BeanMapHandlerTest


    @Test
    public void testBeanMapHandlerClassOfVInt() throws Exception {
        bmh = new BeanMapHandler<>(TestBean.class, 2);
        handle();
    }

    @Test
    public void testBeanMapHandlerClassOfVInt() throws Exception {
        bmh = new BeanMapHandler<Long, TestBean>(TestBean.class, 2);
        handle();
    }

Replace Generic With Diamond BeanMapHandler<Long,TestBean> with BeanMapHandler<> in method public testBeanMapHandlerClassOfVInt() : void from class org.apache.commons.dbutils.handlers.BeanMapHandlerTest


    @Test
    public void testBeanMapHandlerClassOfVString() throws Exception {
        bmh = new BeanMapHandler<>(TestBean.class, "id");
        handle();
    }

    @Test
    public void testBeanMapHandlerClassOfVString() throws Exception {
        bmh = new BeanMapHandler<Long, TestBean>(TestBean.class, "id");
        handle();
    }

Replace Generic With Diamond BeanMapHandler<Long,TestBean> with BeanMapHandler<> in method public testBeanMapHandlerClassOfVString() : void from class org.apache.commons.dbutils.handlers.BeanMapHandlerTest


    @Test
    public void testEmptyResultSet() throws Exception {
        when(Boolean.valueOf(rs.next())).thenReturn(Boolean.FALSE);
        bmh = new BeanMapHandler<>(TestBean.class);
        res = bmh.handle(rs);
        assertNull(res.get(Long.valueOf(23L)));
    }

    @Test
    public void testEmptyResultSet() throws Exception {
        when(Boolean.valueOf(rs.next())).thenReturn(Boolean.FALSE);
        bmh = new BeanMapHandler<Long, TestBean>(TestBean.class);
        res = bmh.handle(rs);
        assertNull(res.get(Long.valueOf(23L)));
    }

Replace Generic With Diamond BeanMapHandler<Long,TestBean> with BeanMapHandler<> in method public testEmptyResultSet() : void from class org.apache.commons.dbutils.handlers.BeanMapHandlerTest


    public void testHandle() throws SQLException {
        ResultSetHandler<List<String>> h = new ColumnListHandler<>();
        List<String> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        assertEquals("1", results.get(0));
        assertEquals("4", results.get(1));
    }

    public void testHandle() throws SQLException {
        ResultSetHandler<List<String>> h = new ColumnListHandler<String>();
        List<String> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        assertEquals("1", results.get(0));
        assertEquals("4", results.get(1));
    }

Replace Generic With Diamond ColumnListHandler<String> with ColumnListHandler<> in method public testHandle() : void from class org.apache.commons.dbutils.handlers.ColumnListHandlerTest


    public void testColumnIndexHandle() throws SQLException {
        ResultSetHandler<List<String>> h = new ColumnListHandler<>(2);
        List<String> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        assertEquals("2", results.get(0));
        assertEquals("5", results.get(1));
    }

    public void testColumnIndexHandle() throws SQLException {
        ResultSetHandler<List<String>> h = new ColumnListHandler<String>(2);
        List<String> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        assertEquals("2", results.get(0));
        assertEquals("5", results.get(1));
    }

Replace Generic With Diamond ColumnListHandler<String> with ColumnListHandler<> in method public testColumnIndexHandle() : void from class org.apache.commons.dbutils.handlers.ColumnListHandlerTest


    public void testColumnNameHandle() throws SQLException {
        ResultSetHandler<List<Integer>> h = new ColumnListHandler<>("intTest");
        List<Integer> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        assertEquals(new Integer(1), results.get(0));
        assertEquals(new Integer(3), results.get(1));
    }

    public void testColumnNameHandle() throws SQLException {
        ResultSetHandler<List<Integer>> h = new ColumnListHandler<Integer>("intTest");
        List<Integer> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        assertEquals(new Integer(1), results.get(0));
        assertEquals(new Integer(3), results.get(1));
    }

Replace Generic With Diamond ColumnListHandler<Integer> with ColumnListHandler<> in method public testColumnNameHandle() : void from class org.apache.commons.dbutils.handlers.ColumnListHandlerTest


    public void testEmptyResultSetHandle() throws SQLException {
        ResultSetHandler<List<String>> h = new ColumnListHandler<>();
        List<String> results = h.handle(this.emptyResultSet);

        assertNotNull(results);
        assertTrue(results.isEmpty());
    }

    public void testEmptyResultSetHandle() throws SQLException {
        ResultSetHandler<List<String>> h = new ColumnListHandler<String>();
        List<String> results = h.handle(this.emptyResultSet);

        assertNotNull(results);
        assertTrue(results.isEmpty());
    }

Replace Generic With Diamond ColumnListHandler<String> with ColumnListHandler<> in method public testEmptyResultSetHandle() : void from class org.apache.commons.dbutils.handlers.ColumnListHandlerTest


    public void testHandle() throws SQLException {
        ResultSetHandler<Map<String,Map<String,Object>>> h = new KeyedHandler<>();

        Map<String,Map<String,Object>> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        Map<String,Object> row = null;
        for(Entry<String, Map<String, Object>> entry : results.entrySet())
        {
            Object key = entry.getKey();
            assertNotNull(key);
            row = entry.getValue();
            assertNotNull(row);
            assertEquals(COLS, row.keySet().size());
        }
        row = results.get("1");
        assertEquals("1", row.get("one"));
        assertEquals("2", row.get("TWO"));
        assertEquals("THREE", row.get("Three"));
    }

    public void testHandle() throws SQLException {
        ResultSetHandler<Map<String,Map<String,Object>>> h = new KeyedHandler<String>();

        Map<String,Map<String,Object>> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        Map<String,Object> row = null;
        for(Entry<String, Map<String, Object>> entry : results.entrySet())
        {
            Object key = entry.getKey();
            assertNotNull(key);
            row = entry.getValue();
            assertNotNull(row);
            assertEquals(COLS, row.keySet().size());
        }
        row = results.get("1");
        assertEquals("1", row.get("one"));
        assertEquals("2", row.get("TWO"));
        assertEquals("THREE", row.get("Three"));
    }

Replace Generic With Diamond KeyedHandler<String> with KeyedHandler<> in method public testHandle() : void from class org.apache.commons.dbutils.handlers.KeyedHandlerTest


    public void testColumnIndexHandle() throws SQLException {
        ResultSetHandler<Map<String,Map<String,Object>>> h = new KeyedHandler<>(2);
        Map<String,Map<String,Object>> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        Map<String,Object> row = null;
        for(Entry<String, Map<String, Object>> entry : results.entrySet())
        {
            Object key = entry.getKey();
            assertNotNull(key);
            row = entry.getValue();
            assertNotNull(row);
            assertEquals(COLS, row.keySet().size());
        }
        row = results.get("5");
        assertEquals("4", row.get("one"));
        assertEquals("5", row.get("TWO"));
        assertEquals("SIX", row.get("Three"));
    }

    public void testColumnIndexHandle() throws SQLException {
        ResultSetHandler<Map<String,Map<String,Object>>> h = new KeyedHandler<String>(2);
        Map<String,Map<String,Object>> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        Map<String,Object> row = null;
        for(Entry<String, Map<String, Object>> entry : results.entrySet())
        {
            Object key = entry.getKey();
            assertNotNull(key);
            row = entry.getValue();
            assertNotNull(row);
            assertEquals(COLS, row.keySet().size());
        }
        row = results.get("5");
        assertEquals("4", row.get("one"));
        assertEquals("5", row.get("TWO"));
        assertEquals("SIX", row.get("Three"));
    }

Replace Generic With Diamond KeyedHandler<String> with KeyedHandler<> in method public testColumnIndexHandle() : void from class org.apache.commons.dbutils.handlers.KeyedHandlerTest


    public void testColumnNameHandle() throws SQLException {
        ResultSetHandler<Map<Integer,Map<String,Object>>> h = new KeyedHandler<>("intTest");
        Map<Integer,Map<String,Object>> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        Map<String,Object> row = null;
        for(Entry<Integer, Map<String, Object>> entry : results.entrySet())
        {
            Object key = entry.getKey();
            assertNotNull(key);
            row = entry.getValue();
            assertNotNull(row);
            assertEquals(COLS, row.keySet().size());
        }
        row = results.get(Integer.valueOf(3));
        assertEquals("4", row.get("one"));
        assertEquals("5", row.get("TWO"));
        assertEquals("SIX", row.get("Three"));
    }

    public void testColumnNameHandle() throws SQLException {
        ResultSetHandler<Map<Integer,Map<String,Object>>> h = new KeyedHandler<Integer>("intTest");
        Map<Integer,Map<String,Object>> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        Map<String,Object> row = null;
        for(Entry<Integer, Map<String, Object>> entry : results.entrySet())
        {
            Object key = entry.getKey();
            assertNotNull(key);
            row = entry.getValue();
            assertNotNull(row);
            assertEquals(COLS, row.keySet().size());
        }
        row = results.get(Integer.valueOf(3));
        assertEquals("4", row.get("one"));
        assertEquals("5", row.get("TWO"));
        assertEquals("SIX", row.get("Three"));
    }

Replace Generic With Diamond KeyedHandler<Integer> with KeyedHandler<> in method public testColumnNameHandle() : void from class org.apache.commons.dbutils.handlers.KeyedHandlerTest


    public void testEmptyResultSetHandle() throws SQLException {
        ResultSetHandler<Map<String,Map<String,Object>>> h = new KeyedHandler<>();
        Map<String,Map<String,Object>> results = h.handle(this.emptyResultSet);
        assertNotNull(results);
        assertTrue(results.isEmpty());
    }

    public void testEmptyResultSetHandle() throws SQLException {
        ResultSetHandler<Map<String,Map<String,Object>>> h = new KeyedHandler<String>();
        Map<String,Map<String,Object>> results = h.handle(this.emptyResultSet);
        assertNotNull(results);
        assertTrue(results.isEmpty());
    }

Replace Generic With Diamond KeyedHandler<String> with KeyedHandler<> in method public testEmptyResultSetHandle() : void from class org.apache.commons.dbutils.handlers.KeyedHandlerTest


    public void testHandle() throws SQLException {
        ResultSetHandler<String> h = new ScalarHandler<>();
        Object results = h.handle(this.rs);
        assertNotNull(results);
        assertEquals("1", results);
    }

    public void testHandle() throws SQLException {
        ResultSetHandler<String> h = new ScalarHandler<String>();
        Object results = h.handle(this.rs);
        assertNotNull(results);
        assertEquals("1", results);
    }

Replace Generic With Diamond ScalarHandler<String> with ScalarHandler<> in method public testHandle() : void from class org.apache.commons.dbutils.handlers.ScalarHandlerTest


    public void testColumnIndexHandle() throws SQLException {
        ResultSetHandler<String> h = new ScalarHandler<>(2);
        Object results = h.handle(this.rs);
        assertNotNull(results);
        assertEquals("2", results);
    }

    public void testColumnIndexHandle() throws SQLException {
        ResultSetHandler<String> h = new ScalarHandler<String>(2);
        Object results = h.handle(this.rs);
        assertNotNull(results);
        assertEquals("2", results);
    }

Replace Generic With Diamond ScalarHandler<String> with ScalarHandler<> in method public testColumnIndexHandle() : void from class org.apache.commons.dbutils.handlers.ScalarHandlerTest


    public void testColumnNameHandle() throws SQLException {
        ResultSetHandler<Integer> h = new ScalarHandler<>("intTest");
        Object results = h.handle(this.rs);
        assertNotNull(results);
        assertEquals(Integer.valueOf(1), results);
    }

    public void testColumnNameHandle() throws SQLException {
        ResultSetHandler<Integer> h = new ScalarHandler<Integer>("intTest");
        Object results = h.handle(this.rs);
        assertNotNull(results);
        assertEquals(Integer.valueOf(1), results);
    }

Replace Generic With Diamond ScalarHandler<Integer> with ScalarHandler<> in method public testColumnNameHandle() : void from class org.apache.commons.dbutils.handlers.ScalarHandlerTest


    public void testEmptyResultSetHandle() throws SQLException {
        ResultSetHandler<String> h = new ScalarHandler<>();
        Object results = h.handle(this.emptyResultSet);
        assertNull(results);
    }

    public void testEmptyResultSetHandle() throws SQLException {
        ResultSetHandler<String> h = new ScalarHandler<String>();
        Object results = h.handle(this.emptyResultSet);
        assertNull(results);
    }

Replace Generic With Diamond ScalarHandler<String> with ScalarHandler<> in method public testEmptyResultSetHandle() : void from class org.apache.commons.dbutils.handlers.ScalarHandlerTest


/**
     * Convert a ResultSet into a List of JavaBeans.
     * This implementation uses reflection and BeanInfo classes to
     * match column names to bean property names. Properties are matched to
     * columns based on several factors:
     * <br/>
     * <ol>
     *     <li>
     *     The class has a writable property with the same name as a column.
     *     The name comparison is case insensitive.
     *     </li>
     *
     *     <li>
     *     The column type can be converted to the property's set method
     *     parameter type with a ResultSet.get* method.  If the conversion fails
     *     (ie. the property was an int and the column was a Timestamp) an
     *     SQLException is thrown.
     *     </li>
     * </ol>
     *
     *

     * Primitive bean properties are set to their defaults when SQL NULL is
     * returned from the ResultSet.  Numeric fields are set to 0
     * and booleans are set to false.  Object bean properties are set to
     * null when SQL NULL is returned.  This is the same behavior
     * as the ResultSet get* methods.
     * </p>
     * @param <T> The type of bean to create
     * @param rs ResultSet that supplies the bean data
     * @param type Class from which to create the bean instance
     * @throws SQLException if a database access error occurs
     * @return the newly created List of beans
     */
    public <T> List<T> toBeanList(ResultSet rs, Class<? extends T> type) throws SQLException {
        List<T> results = new ArrayList<>();

        if (!rs.next()) {
            return results;
        }

        PropertyDescriptor[] props = this.propertyDescriptors(type);
        ResultSetMetaData rsmd = rs.getMetaData();
        int[] columnToProperty = this.mapColumnsToProperties(rsmd, props);

        do {
            results.add(this.createBean(rs, type, props, columnToProperty));
        } while (rs.next());

        return results;
    }

/**
     * Convert a ResultSet into a List of JavaBeans.
     * This implementation uses reflection and BeanInfo classes to
     * match column names to bean property names. Properties are matched to
     * columns based on several factors:
     * <br/>
     * <ol>
     *     <li>
     *     The class has a writable property with the same name as a column.
     *     The name comparison is case insensitive.
     *     </li>
     *
     *     <li>
     *     The column type can be converted to the property's set method
     *     parameter type with a ResultSet.get* method.  If the conversion fails
     *     (ie. the property was an int and the column was a Timestamp) an
     *     SQLException is thrown.
     *     </li>
     * </ol>
     *
     *

     * Primitive bean properties are set to their defaults when SQL NULL is
     * returned from the ResultSet.  Numeric fields are set to 0
     * and booleans are set to false.  Object bean properties are set to
     * null when SQL NULL is returned.  This is the same behavior
     * as the ResultSet get* methods.
     * </p>
     * @param <T> The type of bean to create
     * @param rs ResultSet that supplies the bean data
     * @param type Class from which to create the bean instance
     * @throws SQLException if a database access error occurs
     * @return the newly created List of beans
     */
    public <T> List<T> toBeanList(ResultSet rs, Class<? extends T> type) throws SQLException {
        List<T> results = new ArrayList<T>();

        if (!rs.next()) {
            return results;
        }

        PropertyDescriptor[] props = this.propertyDescriptors(type);
        ResultSetMetaData rsmd = rs.getMetaData();
        int[] columnToProperty = this.mapColumnsToProperties(rsmd, props);

        do {
            results.add(this.createBean(rs, type, props, columnToProperty));
        } while (rs.next());

        return results;
    }

Replace Generic With Diamond ArrayList<T> with ArrayList<> in method public toBeanList(rs ResultSet, type Class<? extends T>) : List<T> from class org.apache.commons.dbutils.BeanProcessor


    /**
     * Invokes the stored procedure via update after checking the parameters to
     * ensure nothing is null.
     * @param conn The connection to use for the update call.
     * @param closeConn True if the connection should be closed, false otherwise.
     * @param sql The SQL statement to execute.
     * @param rsh The result set handler
     * @param params An array of update replacement parameters.  Each row in
     * this array is one set of update replacement values.
     * @return List of all objects generated by the ResultSetHandler for all result sets handled.
     * @throws SQLException If there are database or parameter errors.
     */
    private <T> List<T> execute(Connection conn, boolean closeConn, String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
        if (conn == null) {
            throw new SQLException("Null connection");
        }

        if (sql == null) {
            if (closeConn) {
                close(conn);
            }
            throw new SQLException("Null SQL statement");
        }

        if (rsh == null) {
            if (closeConn) {
                close(conn);
            }
            throw new SQLException("Null ResultSetHandler");
        }

        CallableStatement stmt = null;
        List<T> results = new LinkedList<>();

        try {
            stmt = this.prepareCall(conn, sql);
            this.fillStatement(stmt, params);
            boolean moreResultSets = stmt.execute();
            // Handle multiple result sets by passing them through the handler
            // retaining the final result
            ResultSet rs = null;
            while (moreResultSets) {
                try {
                    rs = this.wrap(stmt.getResultSet());
                    results.add(rsh.handle(rs));
                    moreResultSets = stmt.getMoreResults();

                } finally {
                    close(rs);
                }
            }
            this.retrieveOutParameters(stmt, params);

        } catch (SQLException e) {
            this.rethrow(e, sql, params);

        } finally {
            close(stmt);
            if (closeConn) {
                close(conn);
            }
        }

        return results;
    }

    /**
     * Invokes the stored procedure via update after checking the parameters to
     * ensure nothing is null.
     * @param conn The connection to use for the update call.
     * @param closeConn True if the connection should be closed, false otherwise.
     * @param sql The SQL statement to execute.
     * @param rsh The result set handler
     * @param params An array of update replacement parameters.  Each row in
     * this array is one set of update replacement values.
     * @return List of all objects generated by the ResultSetHandler for all result sets handled.
     * @throws SQLException If there are database or parameter errors.
     */
    private <T> List<T> execute(Connection conn, boolean closeConn, String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
        if (conn == null) {
            throw new SQLException("Null connection");
        }

        if (sql == null) {
            if (closeConn) {
                close(conn);
            }
            throw new SQLException("Null SQL statement");
        }

        if (rsh == null) {
            if (closeConn) {
                close(conn);
            }
            throw new SQLException("Null ResultSetHandler");
        }

        CallableStatement stmt = null;
        List<T> results = new LinkedList<T>();

        try {
            stmt = this.prepareCall(conn, sql);
            this.fillStatement(stmt, params);
            boolean moreResultSets = stmt.execute();
            // Handle multiple result sets by passing them through the handler
            // retaining the final result
            ResultSet rs = null;
            while (moreResultSets) {
                try {
                    rs = this.wrap(stmt.getResultSet());
                    results.add(rsh.handle(rs));
                    moreResultSets = stmt.getMoreResults();

                } finally {
                    close(rs);
                }
            }
            this.retrieveOutParameters(stmt, params);

        } catch (SQLException e) {
            this.rethrow(e, sql, params);

        } finally {
            close(stmt);
            if (closeConn) {
                close(conn);
            }
        }

        return results;
    }

Replace Generic With Diamond LinkedList<T> with LinkedList<> in method private execute(conn Connection, closeConn boolean, sql String, rsh ResultSetHandler<T>, params Object...) : List<T> from class org.apache.commons.dbutils.QueryRunner


/**
     * This factory method is called by handle() to create the Map
     * to store records in.  This implementation returns a HashMap
     * instance.
     *
     * @return Map to store records in
     */
    protected Map<K, V> createMap() {
        return new HashMap<>();
    }

/**
     * This factory method is called by handle() to create the Map
     * to store records in.  This implementation returns a HashMap
     * instance.
     *
     * @return Map to store records in
     */
    protected Map<K, V> createMap() {
        return new HashMap<K, V>();
    }

Replace Generic With Diamond HashMap<K,V> with HashMap<> in method protected createMap() : Map<K,V> from class org.apache.commons.dbutils.handlers.AbstractKeyedHandler


/**
     * Whole ResultSet handler. It produce List as
     * result. To convert individual rows into Java objects it uses
     * handleRow(ResultSet) method.
     *
     * @see #handleRow(ResultSet)
     * @param rs ResultSet to process.
     * @return a list of all rows in the result set
     * @throws SQLException error occurs
     */
    @Override
    public List<T> handle(ResultSet rs) throws SQLException {
        List<T> rows = new ArrayList<>();
        while (rs.next()) {
            rows.add(this.handleRow(rs));
        }
        return rows;
    }

/**
     * Whole ResultSet handler. It produce List as
     * result. To convert individual rows into Java objects it uses
     * handleRow(ResultSet) method.
     *
     * @see #handleRow(ResultSet)
     * @param rs ResultSet to process.
     * @return a list of all rows in the result set
     * @throws SQLException error occurs
     */
    @Override
    public List<T> handle(ResultSet rs) throws SQLException {
        List<T> rows = new ArrayList<T>();
        while (rs.next()) {
            rows.add(this.handleRow(rs));
        }
        return rows;
    }

Replace Generic With Diamond ArrayList<T> with ArrayList<> in method public handle(rs ResultSet) : List<T> from class org.apache.commons.dbutils.handlers.AbstractListHandler


    /**
     * Loads a set of named queries into a Map object.  This implementation
     * reads a properties file at the given path.  The properties file can be
     * in either line-oriented or XML format.  XML formatted properties files
     * must use a <code>.xml</code> file extension.

     * @param path The path that the ClassLoader will use to find the file.
     * @throws IOException if a file access error occurs
     * @throws IllegalArgumentException if the ClassLoader can't find a file at
     * the given path.
     * @throws java.util.InvalidPropertiesFormatException if the XML properties file is
     * invalid
     * @since DbUtils 1.1
     * @return Map of query names to SQL values
     * @see java.util.Properties
     */
    protected Map<String, String> loadQueries(String path) throws IOException {
        // Findbugs flags getClass().getResource as a bad practice; maybe we should change the API?
        final Properties props;
        try (InputStream in = getClass().getResourceAsStream(path)) {

            if (in == null) {
                throw new IllegalArgumentException(path + " not found.");
            }
            props = new Properties();
            if (dotXml.matcher(path).matches()) {
                props.loadFromXML(in);
            } else {
                props.load(in);
            }
        }

        // Copy to HashMap for better performance

        @SuppressWarnings({"rawtypes", "unchecked" }) // load() always creates <String,String> entries
        HashMap<String, String> hashMap = new HashMap(props);
        return hashMap;
    }

    /**
     * Loads a set of named queries into a Map object.  This implementation
     * reads a properties file at the given path.  The properties file can be
     * in either line-oriented or XML format.  XML formatted properties files
     * must use a <code>.xml</code> file extension.

     * @param path The path that the ClassLoader will use to find the file.
     * @throws IOException if a file access error occurs
     * @throws IllegalArgumentException if the ClassLoader can't find a file at
     * the given path.
     * @throws java.util.InvalidPropertiesFormatException if the XML properties file is
     * invalid
     * @since DbUtils 1.1
     * @return Map of query names to SQL values
     * @see java.util.Properties
     */
    protected Map<String, String> loadQueries(String path) throws IOException {
        // Findbugs flags getClass().getResource as a bad practice; maybe we should change the API?
        InputStream in = getClass().getResourceAsStream(path);

        if (in == null) {
            throw new IllegalArgumentException(path + " not found.");
        }

        Properties props = new Properties();
        try {
            if (dotXml.matcher(path).matches()) {
                props.loadFromXML(in);
            } else {
                props.load(in);
            }
        } finally {
            in.close();
        }

        // Copy to HashMap for better performance

        @SuppressWarnings({ "rawtypes", "unchecked" }) // load() always creates <String,String> entries
        HashMap<String, String> hashMap = new HashMap(props);
        return hashMap;
    }

Try With Resources try(InputStream in=getClass().getResourceAsStream(path)) in method protected loadQueries(path String) : Map<String,String> from class org.apache.commons.dbutils.QueryLoader


    public ArrayList<ResourceQuantity> getChest() {
        return new ArrayList<>(chest);
    }

    public ArrayList<ResourceQuantity> getChest() {
        return new ArrayList<ResourceQuantity>(chest);
    }

Replace Generic With Diamond ArrayList<ResourceQuantity> with ArrayList<> in method public getChest() : ArrayList<ResourceQuantity> from class it.polimi.ingsw.model.Chest


    public ArrayList<ResourceQuantity> getWarehouse(){
        return new ArrayList<>(warehouse);
    }

    public ArrayList<ResourceQuantity> getWarehouse(){
        return new ArrayList<ResourceQuantity>(warehouse);
    }

Replace Generic With Diamond ArrayList<ResourceQuantity> with ArrayList<> in method public getWarehouse() : ArrayList<ResourceQuantity> from class it.polimi.ingsw.model.Warehouse


    public void addSequence(String partId) {
        Entry entry = new HasEntry().getEntry(partId);
        if (entry == null) {
            Logger.error("Could not retrieve entry with id " + partId + ". Sequence was not added to blast");
            return;
        }

        Sequence sequence = sequenceDAO.getByEntry(entry);
        if (sequence == null)
            return;

        final String blastFasta = getSequenceFasta(sequence);
        if (blastFasta == null)
            return;

        blastFastaFile.write(() -> new Iterator<>() {
            private boolean called = false;

            @Override
            public boolean hasNext() {
                if (called)
                    return false;

                called = true;
                return true;
            }

            @Override
            public String next() {
                return blastFasta;
            }
        });

        try {
            blastPlus.formatBlastDb(blastFastaFile, this.dbName);
        } catch (BlastException e) {
            Logger.error(e);
        }
    }

    public void addSequence(String partId) {
        Entry entry = new HasEntry().getEntry(partId);
        if (entry == null) {
            Logger.error("Could not retrieve entry with id " + partId + ". Sequence was not added to blast");
            return;
        }

        Sequence sequence = sequenceDAO.getByEntry(entry);
        if (sequence == null)
            return;

        final String blastFasta = getSequenceFasta(sequence);
        if (blastFasta == null)
            return;

        blastFastaFile.write(() -> new Iterator<String>() {
            private boolean called = false;

            @Override
            public boolean hasNext() {
                if (called)
                    return false;

                called = true;
                return true;
            }

            @Override
            public String next() {
                return blastFasta;
            }
        });

        try {
            blastPlus.formatBlastDb(blastFastaFile, this.dbName);
        } catch (BlastException e) {
            Logger.error(e);
        }
    }

Replace Generic With Diamond Iterator<String> with Iterator<> in method public addSequence(partId String) : void from class org.jbei.ice.lib.search.blast.StandardBlastDatabase


/**
     * Parses a sequence in a file and associates it with the current entry
     *
     * @param inputStream      input stream of bytes representing the file
     * @param fileName         name of file being parsed
     * @param extractHierarchy for SBOL2 sequences only. If set to true, creates a hierarchy of ICE entries
     *                         as needed
     * @return wrapper around the internal model used to represent sequence information
     * @throws IOException on Exception parsing the contents of the file
     */
    public SequenceInfo parseSequenceFile(InputStream inputStream, String fileName, boolean extractHierarchy)
            throws IOException {
        try {
            AbstractParser parser;
            try (LineIterator iterator = IOUtils.lineIterator(inputStream, StandardCharsets.UTF_8)) {
                if (!iterator.hasNext())
                    throw new IOException("Cannot read stream for " + fileName);

                String firstLine = iterator.next();
                SequenceFormat format = SequenceUtil.detectFormat(firstLine);

                switch (format) {
                    case GENBANK:
                        parser = new GenBankParser();
                        break;

                    case SBOL2:
                        SBOLParser sbolParser = new SBOLParser(this.userId, Long.toString(this.entry.getId()), extractHierarchy);
                        return sbolParser.parseToEntry(inputStream, fileName);

                    case FASTA:
                        parser = new FastaParser();
                        break;

                    default:
                    case PLAIN:
                        parser = new PlainParser();
                        break;
                }

                Iterator<String> customIterator = new Iterator<String>() {

                    private boolean firstLineRetrieved = false;

                    @Override
                    public boolean hasNext() {
                        if (firstLineRetrieved)
                            return iterator.hasNext();
                        return true;
                    }

                    @Override
                    public String next() {
                        if (firstLineRetrieved)
                            return iterator.next();
                        firstLineRetrieved = true;
                        return firstLine;
                    }
                };

                // parse actual sequence
                String entryType = this.entry.getRecordType();

                FeaturedDNASequence dnaSequence = parser.parse(customIterator, entryType);
                Sequence sequence = SequenceUtil.dnaSequenceToSequence(dnaSequence);
                if (sequence == null)
                    throw new IOException("Could not create sequence object");

//            sequence.setSequenceUser(sequenceString); // todo sequence user now might not be such a good idea
                sequence.setFileName(fileName);
                sequence.setFormat(format);
                sequence = saveSequenceObject(sequence);

                SequenceInfo info = sequence.toDataTransferObject();
                info.setSequence(dnaSequence);
                return info;
            }
        } catch (InvalidFormatParserException e) {
            Logger.error(e);
            throw new IOException(e);
        }
    }

/**
     * Parses a sequence in a file and associates it with the current entry
     *
     * @param inputStream      input stream of bytes representing the file
     * @param fileName         name of file being parsed
     * @param extractHierarchy for SBOL2 sequences only. If set to true, creates a hierarchy of ICE entries
     *                         as needed
     * @return wrapper around the internal model used to represent sequence information
     * @throws IOException on Exception parsing the contents of the file
     */
    public SequenceInfo parseSequenceFile(InputStream inputStream, String fileName, boolean extractHierarchy)
            throws IOException {
        try {
            AbstractParser parser;
            inputStream.mark(Integer.MAX_VALUE);

            String sequenceString = Utils.getString(inputStream);
            SequenceFormat format = SequenceUtil.detectFormat(sequenceString);

            switch (format) {
                case GENBANK:
                    parser = new GenBankParser();
                    break;

                case SBOL2:
                    SBOLParser sbolParser = new SBOLParser(this.userId, Long.toString(this.entry.getId()), extractHierarchy);
                    return sbolParser.parseToEntry(inputStream, fileName);

                case FASTA:
                    parser = new FastaParser();
                    break;

                default:
                case PLAIN:
                    parser = new PlainParser();
                    break;
            }

            // parse actual sequence
            String entryType = this.entry.getRecordType();

            inputStream.reset();
            FeaturedDNASequence dnaSequence = parser.parse(inputStream, entryType);
            Sequence sequence = SequenceUtil.dnaSequenceToSequence(dnaSequence);
            if (sequence == null)
                throw new IOException("Could not create sequence object");

            sequence.setSequenceUser(sequenceString); // todo sequence user now might not be such a good idea
            sequence.setFileName(fileName);
            sequence.setFormat(format);
            sequence = saveSequenceObject(sequence);

            SequenceInfo info = sequence.toDataTransferObject();
            info.setSequence(dnaSequence);
            return info;
        } catch (InvalidFormatParserException e) {
            Logger.error(e);
            throw new IOException(e);
        }
    }

Try With Resources try(LineIterator iterator=IOUtils.lineIterator(inputStream,StandardCharsets.UTF_8)) in method public parseSequenceFile(inputStream InputStream, fileName String, extractHierarchy boolean) : SequenceInfo from class org.jbei.ice.lib.entry.sequence.PartSequence


    /**
     * Process the zip file. It expects that there is exactly one file with the .csv extension.
     * This means that a .csv cannot be used as an attachment
     * </p>
     * Also, all dot files are ignored
     */
    public ProcessedBulkUpload processUpload() {
        ProcessedBulkUpload processedBulkUpload = new ProcessedBulkUpload();
        InputStream csvFile = null;
        HashMap<String, InputStream> files = new HashMap<>();

        try (BufferedInputStream bis = new BufferedInputStream(inputStream);
             ZipInputStream zis = new ZipInputStream(bis)) {

            ZipEntry zipEntry;
            while ((zipEntry = zis.getNextEntry()) != null) {

                if (zipEntry.isDirectory())
                    continue;

                String name = zipEntry.getName();
                if (name.contains("/"))
                    name = name.substring(name.lastIndexOf("/") + 1);

                // ignore all dot files
                if (name.startsWith("."))
                    continue;

                if (csvFile != null) {
                    processedBulkUpload.setSuccess(false);
                    processedBulkUpload.setUserMessage("Duplicate csv file in zip archive. It should only contain one.");
                    return processedBulkUpload;
                }

                int len;
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                byte[] buffer = new byte[1024];
                while ((len = zis.read(buffer)) > 0) {
                    byteArrayOutputStream.write(buffer, 0, len);
                }
                zis.closeEntry();

                // get main csv
                if (name.endsWith(".csv")) {
                    csvFile = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
                } else {
                    files.put(name, new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
                }
            }
        } catch (IOException e) {
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage(e.getCause().getMessage());
            return processedBulkUpload;
        }

        if (csvFile == null) {
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage("Could not find a csv file in the zip archive");
            return processedBulkUpload;
        }

        try {
            // retrieve the partData and validates
            List<PartWithSample> updates = super.getBulkUploadDataFromFile(csvFile);
            if (updates == null) {
                processedBulkUpload.setSuccess(false);
                processedBulkUpload.setUserMessage("Validation failed");
                for (EntryField field : invalidFields) {
                    processedBulkUpload.getHeaders().add(new EntryHeaderValue(field));
                }
                return processedBulkUpload;
            }

            // validate files to ensure that for each partData with a file, that the file is available
            for (PartWithSample partWithSample : updates) {

                // check sequences
                PartData data = partWithSample.getPartData();
                String sequenceFile = data.getSequenceFileName();
                if (StringUtils.isNotBlank(sequenceFile) && files.get(sequenceFile) == null) {
                    processedBulkUpload.setSuccess(false);
                    processedBulkUpload.setUserMessage("Sequence file \"" + sequenceFile
                            + "\" not found in the zip archive");
                    return processedBulkUpload;
                }

                // check attachments
                String attachmentFile;
                if (data.getAttachments() != null && !data.getAttachments().isEmpty()) {
                    attachmentFile = data.getAttachments().get(0).getFilename();
                    if (StringUtils.isNotBlank(attachmentFile) && files.get(attachmentFile) == null) {
                        processedBulkUpload.setSuccess(false);
                        processedBulkUpload.setUserMessage("Attachment file \"" + sequenceFile
                                + "\" not found in the zip archive");
                        return processedBulkUpload;
                    }
                }

                // todo : trace sequences
            }

            // create actual registry parts
            BulkUploadEntries creator = new BulkUploadEntries(userId, this.uploadId);

            // create entries
            if (!creator.createEntries(updates, files)) {
                String errorMsg = "Error creating entries for upload";
                throw new IOException(errorMsg);
                //todo: delete upload id
            }

            processedBulkUpload.setUploadId(uploadId);
            return processedBulkUpload;
        } catch (IOException e) {
            Logger.error(e);
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
            return processedBulkUpload;
        }
    }

    /**
     * Process the zip file. It expects that there is exactly one file with the .csv extension.
     * This means that a .csv cannot be used as an attachment
     * </p>
     * Also, all dot files are ignored
     */
    public ProcessedBulkUpload processUpload() {
        ProcessedBulkUpload processedBulkUpload = new ProcessedBulkUpload();
        String csvFile = null;
        HashMap<String, InputStream> files = new HashMap<>();

        try {
            ZipFile zipFile = new ZipFile(zipFilePath.toFile());
            Enumeration<? extends ZipEntry> enumeration = zipFile.entries();

            // go through zip elements
            while (enumeration.hasMoreElements()) {
                ZipEntry zipEntry = enumeration.nextElement();
                // does not go into directories for now
                if (zipEntry.isDirectory())
                    continue;

                String name = zipEntry.getName();
                if (name.contains("/"))
                    name = name.substring(name.lastIndexOf("/") + 1);

                // ignore all dot files
                if (name.startsWith("."))
                    continue;

                // get main csv
                if (name.endsWith(".csv")) {
                    if (csvFile != null) {
                        processedBulkUpload.setSuccess(false);
                        processedBulkUpload.setUserMessage("Duplicate csv file in zip archive. It should only contain one.");
                        return processedBulkUpload;
                    }
                    csvFile = Utils.getString(zipFile.getInputStream(zipEntry));
                } else {
                    InputStream inputStream = zipFile.getInputStream(zipEntry);
                    files.put(name, inputStream);
                }
            }
        } catch (IOException e) {
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage(e.getCause().getMessage());
            return processedBulkUpload;
        }

        if (csvFile == null) {
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage("Could not find a csv file in the zip archive");
            return processedBulkUpload;
        }

        try {
            ByteArrayInputStream inputStream = new ByteArrayInputStream(csvFile.getBytes(StandardCharsets.UTF_8));
            // retrieve the partData and validates
            List<PartWithSample> updates = super.getBulkUploadDataFromFile(inputStream);
            if (updates == null) {
                processedBulkUpload.setSuccess(false);
                processedBulkUpload.setUserMessage("Validation failed");
                for (EntryField field : invalidFields) {
                    processedBulkUpload.getHeaders().add(new EntryHeaderValue(false, field));
                }
                return processedBulkUpload;
            }

            // validate files to ensure that for each partData with a file, that the file is available
            for (PartWithSample partWithSample : updates) {

                // check sequences
                PartData data = partWithSample.getPartData();
                String sequenceFile = data.getSequenceFileName();
                if (StringUtils.isNotBlank(sequenceFile) && files.get(sequenceFile) == null) {
                    processedBulkUpload.setSuccess(false);
                    processedBulkUpload.setUserMessage("Sequence file \"" + sequenceFile
                            + "\" not found in the zip archive");
                    return processedBulkUpload;
                }

                // check attachments
                String attachmentFile;
                if (data.getAttachments() != null && !data.getAttachments().isEmpty()) {
                    attachmentFile = data.getAttachments().get(0).getFilename();
                    if (StringUtils.isNotBlank(attachmentFile) && files.get(attachmentFile) == null) {
                        processedBulkUpload.setSuccess(false);
                        processedBulkUpload.setUserMessage("Attachment file \"" + sequenceFile
                                + "\" not found in the zip archive");
                        return processedBulkUpload;
                    }
                }

                // todo : trace sequences
            }

            // create actual registry parts
            BulkEntryCreator creator = new BulkEntryCreator();
            long uploadId = creator.createBulkUpload(userId, addType);

            // create entries
            if (!creator.createEntries(userId, uploadId, updates, files)) {
                String errorMsg = "Error creating entries for upload";
                throw new IOException(errorMsg);
                //todo: delete upload id
            }

            processedBulkUpload.setUploadId(uploadId);
            return processedBulkUpload;
        } catch (IOException e) {
            Logger.error(e);
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
            return processedBulkUpload;
        }
    }

Try With Resources try(BufferedInputStream bis=new BufferedInputStream(inputStream); ZipInputStream zis=new ZipInputStream(bis)) in method public processUpload() : ProcessedBulkUpload from class org.jbei.ice.lib.bulkupload.BulkZipUpload