    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void storeStrategy(IStrategyGroup strategy) throws ServiceException {
        if (strategy == null)
            return;
        try (Connection con = sqlHelper.getConnection();) {
            StrategyGroupBean sgb = new StrategyGroupBean(strategy);
            sgb.setOwnerId(getId());
            sgb.store(con);
        } catch (SQLException e) {
            e.printStackTrace();
            throw new ServiceException(e.getMessage());
        }
    }

    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void storeStrategy(IStrategyGroup strategy) throws ServiceException {
        if (strategy == null)
            return;
        try {
            Connection con = sqlHelper.getConnection();
            StrategyGroupBean sgb = new StrategyGroupBean(strategy);
            sgb.setOwnerId(getId());
            sgb.store(con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            e.printStackTrace();
            throw new ServiceException(e.getMessage());
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public storeStrategy(strategy IStrategyGroup) : void from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void deleteStrategy(IStrategyGroup strategy) throws ServiceException {
        if (strategy == null || strategy.getId() == null)
            return;
        try (Connection con = sqlHelper.getConnection();) {
            linkObjectDao.unlink(getId(),
                    strategy.getId(),
                    LinkObjectTypeConstant.PERSON_2_STRATEGYGROUP, con);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }
    }

    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void deleteStrategy(IStrategyGroup strategy) throws ServiceException {
        if (strategy == null || strategy.getId() == null)
            return;
        try {
            Connection con = sqlHelper.getConnection();
            linkObjectDao.unlink(getId(),
                    strategy.getId(),
                    LinkObjectTypeConstant.PERSON_2_STRATEGYGROUP, con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public deleteStrategy(strategy IStrategyGroup) : void from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    /**
     * Description of the Method
     *
     * @exception ServiceException
     *                Description of the Exception
     */
    private void storePartner() throws ServiceException {
        try (Connection con = sqlHelper.getConnection();) {
            storePartner(con);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * Description of the Method
     *
     * @exception ServiceException
     *                Description of the Exception
     */
    private void storePartner() throws ServiceException {
        try {
            Connection con = sqlHelper.getConnection();
            storePartner(con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method private storePartner() : void from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    /***************************************************************************
     * Category
     **************************************************************************/
    public Collection getCategories() throws ServiceException {
        try (Connection con = sqlHelper.getConnection();) {
            Collection result = getCategories(con);
            return result;
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }

    }

    /***************************************************************************
     * Category
     **************************************************************************/
    public Collection getCategories() throws ServiceException {

        try {
            Connection con = sqlHelper.getConnection();
            Collection result = getCategories(con);
            sqlHelper.close(con);
            return result;
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getCategories() : Collection from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    public Collection getSelectedCategories() throws ServiceException {
        try (Connection con = sqlHelper.getConnection();) {
            Collection result = getSelectedCategories(con);
            return result;
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }

    }

    public Collection getSelectedCategories() throws ServiceException {

        try {
            Connection con = sqlHelper.getConnection();
            Collection result = getSelectedCategories(con);
            sqlHelper.close(con);
            return result;
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getSelectedCategories() : Collection from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void addCategory(au.com.totemsoft.util.ReferenceCode category)
            throws ServiceException {

        if (category == null || category.getDescription() == null)
            return;

        String desc = category.getDescription().trim();
        if (desc.length() > 50) {
            desc = desc.substring(0, 50);
            category.setDescription(desc);
        }

        try (Connection con = sqlHelper.getConnection();) {
            addCategory(category, con);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }

    }

    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void addCategory(au.com.totemsoft.util.ReferenceCode category)
            throws ServiceException {

        if (category == null || category.getDescription() == null)
            return;

        String desc = category.getDescription().trim();
        if (desc.length() > 50) {
            desc = desc.substring(0, 50);
            category.setDescription(desc);
        }

        try {
            Connection con = sqlHelper.getConnection();
            addCategory(category, con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public addCategory(category ReferenceCode) : void from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public boolean removeCategory(ReferenceCode category)
            throws ServiceException {
        if (category == null)
            return true;

        try (Connection con = sqlHelper.getConnection();) {
            boolean result = removeCategory(category, con);
            return result;
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }

    }

    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public boolean removeCategory(ReferenceCode category)
            throws ServiceException {
        if (category == null)
            return true;

        try {
            Connection con = sqlHelper.getConnection();
            boolean result = removeCategory(category, con);
            sqlHelper.close(con);
            return result;
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public removeCategory(category ReferenceCode) : boolean from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void updateCategory(au.com.totemsoft.util.ReferenceCode category)
            throws ServiceException {
        if (category == null)
            return;
        try (Connection con = sqlHelper.getConnection();) {
            updateCategory(category, con);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }
    }

    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void updateCategory(au.com.totemsoft.util.ReferenceCode category)
            throws ServiceException {
        if (category == null)
            return;
        try {
            Connection con = sqlHelper.getConnection();
            updateCategory(category, con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public updateCategory(category ReferenceCode) : void from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void addSelectedCategories(java.util.Vector selectedCategories)
            throws ServiceException {
        if (selectedCategories == null)
            return;
        try (Connection con = sqlHelper.getConnection();) {
            addSelectedCategories(selectedCategories, con);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }
    }

    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void addSelectedCategories(java.util.Vector selectedCategories)
            throws ServiceException {
        if (selectedCategories == null)
            return;
        try {
            Connection con = sqlHelper.getConnection();
            addSelectedCategories(selectedCategories, con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public addSelectedCategories(selectedCategories Vector) : void from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    @Override
    public Financial findFinancial(Integer personId, Integer financialId) {
        try (Connection con = sqlHelper.getConnection();) {
            PreparedStatement sql = null;
            ResultSet rs = null;
            Integer objectTypeId = null;
            try {
                sql = con.prepareStatement(
                    "SELECT ObjectTypeID FROM Object WHERE ObjectID = ?",
                    ResultSet.TYPE_FORWARD_ONLY,
                    ResultSet.CONCUR_READ_ONLY);

                int i = 0;
                sql.setInt(++i, financialId);
                rs = sql.executeQuery();

                // save id, typeId ONLY
                if (!rs.next()) {
                    return null;
                }
                objectTypeId = rs.getInt("ObjectTypeID");
            } finally {
                sqlHelper.close(rs, sql);
            }

            FinancialBean fb = ObjectClass.createNewInstance(objectTypeId);
            return initFinancial(financialId, personId, fb, con);
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw new ServiceException(e.getMessage());
        }
    }

    @Override
    public Financial findFinancial(Integer personId, Integer financialId) {
        Connection con = null;
        try {
            con = sqlHelper.getConnection();
            PreparedStatement sql = null;
            ResultSet rs = null;
            Integer objectTypeId = null;
            try {
                sql = con.prepareStatement(
                    "SELECT ObjectTypeID FROM Object WHERE ObjectID = ?",
                    ResultSet.TYPE_FORWARD_ONLY,
                    ResultSet.CONCUR_READ_ONLY);

                int i = 0;
                sql.setInt(++i, financialId);
                rs = sql.executeQuery();

                // save id, typeId ONLY
                if (!rs.next()) {
                    return null;
                }
                objectTypeId = rs.getInt("ObjectTypeID");
            } finally {
                sqlHelper.close(rs, sql);
            }

            FinancialBean fb = ObjectClass.createNewInstance(objectTypeId);
            return initFinancial(financialId, personId, fb, con);
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw new ServiceException(e.getMessage());
        } finally {
            try {
                sqlHelper.close(con);
            } catch (SQLException e) {
                throw new ServiceException(e.getMessage());
            }
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public findFinancial(personId Integer, financialId Integer) : Financial from class au.com.totemsoft.myplanner.service.impl.FinancialServiceImpl


    @Override
    public Map<Integer, Map<Integer, Financial>> findFinancials(Integer personId, Integer strategyGroupId) {
        try (Connection con = sqlHelper.getConnection();) {
            PreparedStatement sql = null;
            ResultSet rs = null;
            Map<Integer, Map<Integer, Financial>> result = null;
            // get object id's for ALL person financial
            try {
                sql = con.prepareStatement(
                    "SELECT FinancialID, ObjectID, ObjectTypeID"
                    + " FROM Financial, Object"
                    + " WHERE"
                    + " (FinancialID IN"
                    + " (SELECT ObjectID2 FROM Link WHERE ObjectID1 = ? AND LinkObjectTypeID = ? AND LogicallyDeleted IS NULL)"
                    + " ) AND (NextID IS NULL)"
                    + (strategyGroupId == null ? " AND (StrategyGroupID IS NULL)" : " AND (StrategyGroupID = ?)")
                    + " AND (FinancialID = ObjectID)",
                    ResultSet.TYPE_FORWARD_ONLY,
                    ResultSet.CONCUR_READ_ONLY);

                int i = 0;
                sql.setInt(++i, personId.intValue());
                sql.setInt(++i, LinkObjectTypeConstant.PERSON_2_FINANCIAL); // 1004
                if (strategyGroupId != null) {
                    sql.setInt(++i, strategyGroupId.intValue());
                }
                rs = sql.executeQuery();

                // save id, typeId ONLY
                while (rs.next()) {
                    if (result == null) {
                        result = new TreeMap<Integer, Map<Integer, Financial>>(new CodeComparator<Integer>());
                    }
                    Integer id = rs.getInt("FinancialID");
                    Integer objectTypeId = rs.getInt("ObjectTypeID");
                    // get/create map for this object type
                    Map<Integer, Financial> map = result.get(objectTypeId);
                    if (map == null) {
                        // map = new TreeMap();
                        map = new TreeMap<Integer, Financial>(new CodeComparator<Integer>());
                        result.put(objectTypeId, map);
                    }
                    map.put(id, null); // load Financial object later (on request)
                }
                if (result == null) {
                    return null;
                }
            } finally {
                sqlHelper.close(rs, sql);
            }

            // create ALL objects for ALL object types
            // init null Financial objects (if any) for this object type
            Iterator<Integer> iter = result.keySet().iterator();
            while (iter.hasNext()) {
                initFinancials(personId, result, iter.next(), con);
            }
            // Map( ObjectTypeID, Map( ObjectID, Object ) )
            return result;
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw new ServiceException(e.getMessage());
        }
    }

    @Override
    public Map<Integer, Map<Integer, Financial>> findFinancials(Integer personId, Integer strategyGroupId) {
        Connection con = null;
        try {
            con = sqlHelper.getConnection();

            PreparedStatement sql = null;
            ResultSet rs = null;
            Map<Integer, Map<Integer, Financial>> result = null;
            // get object id's for ALL person financial
            try {
                sql = con.prepareStatement(
                    "SELECT FinancialID, ObjectID, ObjectTypeID"
                    + " FROM Financial, Object"
                    + " WHERE"
                    + " (FinancialID IN"
                    + " (SELECT ObjectID2 FROM Link WHERE ObjectID1 = ? AND LinkObjectTypeID = ? AND LogicallyDeleted IS NULL)"
                    + " ) AND (NextID IS NULL)"
                    + (strategyGroupId == null ? " AND (StrategyGroupID IS NULL)" : " AND (StrategyGroupID = ?)")
                    + " AND (FinancialID = ObjectID)",
                    ResultSet.TYPE_FORWARD_ONLY,
                    ResultSet.CONCUR_READ_ONLY);

                int i = 0;
                sql.setInt(++i, personId.intValue());
                sql.setInt(++i, LinkObjectTypeConstant.PERSON_2_FINANCIAL); // 1004
                if (strategyGroupId != null) {
                    sql.setInt(++i, strategyGroupId.intValue());
                }
                rs = sql.executeQuery();

                // save id, typeId ONLY
                while (rs.next()) {
                    if (result == null) {
                        result = new TreeMap<Integer, Map<Integer, Financial>>(new CodeComparator<Integer>());
                    }
                    Integer id = rs.getInt("FinancialID");
                    Integer objectTypeId = rs.getInt("ObjectTypeID");
                    // get/create map for this object type
                    Map<Integer, Financial> map = result.get(objectTypeId);
                    if (map == null) {
                        // map = new TreeMap();
                        map = new TreeMap<Integer, Financial>(new CodeComparator<Integer>());
                        result.put(objectTypeId, map);
                    }
                    map.put(id, null); // load Financial object later (on request)
                }
                if (result == null) {
                    return null;
                }
            } finally {
                sqlHelper.close(rs, sql);
            }

            // create ALL objects for ALL object types
            // init null Financial objects (if any) for this object type
            Iterator<Integer> iter = result.keySet().iterator();
            while (iter.hasNext()) {
                initFinancials(personId, result, iter.next(), con);
            }
            // Map( ObjectTypeID, Map( ObjectID, Object ) )
            return result;
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw new ServiceException(e.getMessage());
        } finally {
            try {
                sqlHelper.close(con);
            } catch (SQLException e) {
                throw new ServiceException(e.getMessage());
            }
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public findFinancials(personId Integer, strategyGroupId Integer) : Map<Integer,Map<Integer,Financial>> from class au.com.totemsoft.myplanner.service.impl.FinancialServiceImpl


    /**
     * to create a new instance of Person entity bean and therefore insert data
     * into database invoke create(...) method
     */
    public Integer persist(Integer ownerPersonID) throws ServiceException {
        try (Connection con = sqlHelper.getConnection();) {
            PersonServiceImpl pb = new PersonServiceImpl(this);
            pb.setOwnerId(ownerPersonID);
            Integer personID = pb.create(con);
            return personID;
        } catch (Exception e) {
            LOG.error(e.getMessage(), e);
            throw new ServiceException(e.getMessage(), e);
        }
    }

    /**
     * to create a new instance of Person entity bean and therefore insert data
     * into database invoke create(...) method
     */
    public Integer persist(Integer ownerPersonID) throws ServiceException {
        try {
            PersonServiceImpl pb = new PersonServiceImpl(this);
            pb.setOwnerId(ownerPersonID);
            Connection con = sqlHelper.getConnection();
            Integer personID = pb.create(con);
            sqlHelper.close(con);
            return personID;
        } catch (Exception e) {
            LOG.error(e.getMessage(), e);
            throw new ServiceException(e.getMessage(), e);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public persist(ownerPersonID Integer) : Integer from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    /**
     *
     */
    public void storePerson() throws ServiceException {
        try (Connection con = sqlHelper.getConnection();) {
            storePerson(con);
            if (financialGoal != null)
                storeFinancialGoal(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage(), e);
        }
    }

    /**
     *
     */
    public void storePerson() throws ServiceException {
        try {
            Connection con = sqlHelper.getConnection();
            storePerson(con);
            if (financialGoal != null)
                storeFinancialGoal(con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage(), e);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public storePerson() : void from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    public void storeFinancials(Map financials, FinancialGoal financialGoal) throws ServiceException {
        if (financials == null && financialGoal == null)
            return;
        try (Connection con = sqlHelper.getConnection();) {
            if (financials != null)
                storeFinancials(financials); // first
            if (financialGoal != null)
                storeFinancialGoal(con); // second (will use financial data)
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
    }

    public void storeFinancials(Map financials, FinancialGoal financialGoal) throws ServiceException {
        if (financials == null && financialGoal == null)
            return;
        try {
            Connection con = sqlHelper.getConnection();
            if (financials != null)
                storeFinancials(financials); // first
            if (financialGoal != null)
                storeFinancialGoal(con); // second (will use financial data)
            sqlHelper.close(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public storeFinancials(financials Map, financialGoal FinancialGoal) : void from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    public void storeComments() throws ServiceException {
        if (comments == null)
            return;
        try (Connection con = sqlHelper.getConnection();) {
            storeComments(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
    }

    public void storeComments() throws ServiceException {
        if (comments == null)
            return;
        try {
            Connection con = sqlHelper.getConnection();
            storeComments(con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public storeComments() : void from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    public void storeSurveys() throws ServiceException {
        if (surveys == null)
            return;
        try (Connection con = sqlHelper.getConnection();) {
            storeSurveys(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
    }

    public void storeSurveys() throws ServiceException {
        if (surveys == null)
            return;
        try {
            Connection con = sqlHelper.getConnection();
            storeSurveys(con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public storeSurveys() : void from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    public void storeModels() throws ServiceException {
        if (models == null)
            return;
        try (Connection con = sqlHelper.getConnection();) {
            storeModels(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
    }

    public void storeModels() throws ServiceException {
        if (models == null)
            return;
        try {
            Connection con = sqlHelper.getConnection();
            storeModels(con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public storeModels() : void from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    public void storeEmployerBusiness() throws ServiceException {
        if (business == null)
            return;
        try (Connection con = sqlHelper.getConnection();) {
            storeEmployerBusiness(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
    }

    public void storeEmployerBusiness() throws ServiceException {
        if (business == null)
            return;
        try {
            Connection con = sqlHelper.getConnection();
            storeEmployerBusiness(con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public storeEmployerBusiness() : void from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    /**
     *
     */
    public IBusiness getEmployerBusiness() throws ServiceException {
        if (business == null) {
            try (Connection con = sqlHelper.getConnection();) {
                List list = getLinkedObjects(PERSON_2_BUSINESS, 0, PERSON$BUSINESS_2_OCCUPATION, con);
                if (list != null && !list.isEmpty()) {
                    Integer businessId = (Integer) list.get(0);
                    business = businessDao.load(businessId);
                }
            } catch (SQLException e) {
                business = null;
                throw new ServiceException(e);
            } catch (ObjectNotFoundException e) {
                business = null;
                throw e;
            }
        }
        return business;
    }

    /**
     *
     */
    public IBusiness getEmployerBusiness() throws ServiceException {
        if (business == null) {
            Connection con = null;
            try {
                con = sqlHelper.getConnection();
                List list = getLinkedObjects(PERSON_2_BUSINESS, 0, PERSON$BUSINESS_2_OCCUPATION, con);
                if (list != null && !list.isEmpty()) {
                    Integer businessId = (Integer) list.get(0);
                    business = businessDao.load(businessId);
                }
            } catch (SQLException e) {
                business = null;
                throw new ServiceException(e);
            } catch (ObjectNotFoundException e) {
                business = null;
                throw e;
            } finally {
                try {
                    sqlHelper.close(con);
                } catch (SQLException e) {
                    throw new ServiceException(e);
                }
            }
        }
        return business;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getEmployerBusiness() : IBusiness from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    public Map getStrategyGroupFinancials(Integer strategyGroupID, boolean complex) throws ServiceException {
        try (Connection con = sqlHelper.getConnection();) {
            Map result = getStrategyGroupFinancials(con, strategyGroupID, complex);
            return result;
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

    public Map getStrategyGroupFinancials(Integer strategyGroupID, boolean complex) throws ServiceException {

        Connection con = null;
        try {
            con = sqlHelper.getConnection();
            Map result = getStrategyGroupFinancials(con, strategyGroupID, complex);
            sqlHelper.close(con);
            return result;
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getStrategyGroupFinancials(strategyGroupID Integer, complex boolean) : Map from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    protected void deleteFinancials() throws SQLException {
        try (Connection con = sqlHelper.getConnection();) {
            Map financials = findFinancials();
            if (financials == null) {
                return;
            }

            // one by one
            Iterator iterGroup = financials.values().iterator();
            while (iterGroup.hasNext()) {
                Map group = (Map) iterGroup.next();
                Iterator iter = group.entrySet().iterator();
                while (iter.hasNext()) {
                    Map.Entry entry = (Map.Entry) iter.next();
                    entry.setValue(null);
                }
            }

            storeFinancials(financials);

            // remove all current assets from collection
            Assets.getCurrentAssets().initCodes(null);

            financials = null;
        } catch (Exception e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
    }

    protected void deleteFinancials() throws SQLException {
        Connection con = sqlHelper.getConnection();
        try {
            Map financials = findFinancials();
            if (financials == null) {
                return;
            }

            // one by one
            Iterator iterGroup = financials.values().iterator();
            while (iterGroup.hasNext()) {
                Map group = (Map) iterGroup.next();
                Iterator iter = group.entrySet().iterator();
                while (iter.hasNext()) {
                    Map.Entry entry = (Map.Entry) iter.next();
                    entry.setValue(null);
                }
            }

            storeFinancials(financials);

            // remove all current assets from collection
            Assets.getCurrentAssets().initCodes(null);

            financials = null;
        } catch (Exception e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        } finally {
            sqlHelper.close(con);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method protected deleteFinancials() : void from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    /**
     * get/set professional contacts
     */
    public java.util.TreeMap getContacts() throws ServiceException {

        if (contacts == null) {

            List list = null;
            try (Connection con = sqlHelper.getConnection();) {
                list = getLinkedObjects(PERSON_2_PERSON, CONTACT,
                        PERSON_2_RELATIONSHIP_FINANCE, con);

                contacts = new TreeMap();

                if (list == null || list.size() == 0)
                    return contacts;

                Integer personID = null;
                Contact c = null;
                Iterator iter = list.iterator();
                while (iter.hasNext()) {
                    personID = (Integer) iter.next();
                    c = new Contact();
                    c.setOwnerId(getId());
                    c.setId(personID);
                    new ContactBean(c).load(personID, con);
                    contacts.put(personID, c);
                }
            } catch (SQLException e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            } catch (Exception e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            }

        }

        return contacts;

    }

    /**
     * get/set professional contacts
     */
    public java.util.TreeMap getContacts() throws ServiceException {

        if (contacts == null) {

            Connection con = null;
            List list = null;

            try {
                con = sqlHelper.getConnection();

                list = getLinkedObjects(PERSON_2_PERSON, CONTACT,
                        PERSON_2_RELATIONSHIP_FINANCE, con);

                contacts = new TreeMap();

                if (list == null || list.size() == 0)
                    return contacts;

                Integer personID = null;
                Contact c = null;
                Iterator iter = list.iterator();
                while (iter.hasNext()) {
                    personID = (Integer) iter.next();
                    c = new Contact();
                    c.setOwnerId(getId());
                    c.setId(personID);
                    new ContactBean(c).load(personID, con);
                    contacts.put(personID, c);
                }
                if (con != null)
                    sqlHelper.close(con);
            } catch (SQLException e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            } catch (Exception e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            }

        }

        return contacts;

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getContacts() : TreeMap from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    /**
     * get/set dependents
     */
    public java.util.TreeMap getDependents() throws ServiceException {

        if (dependents == null) {

            List list = null;
            try (Connection con = sqlHelper.getConnection();) {
                list = getLinkedObjects(PERSON_2_PERSON, DEPENDENT,
                        PERSON_2_RELATIONSHIP_FINANCE, con);

                dependents = new TreeMap();

                if (list == null || list.size() == 0)
                    return dependents;

                Integer personID = null;
                Dependent d = null;

                Iterator iter = list.iterator();
                while (iter.hasNext()) {
                    personID = (Integer) iter.next();

                    d = new Dependent();
                    d.setOwnerId(getId());
                    d.setId(personID);

                    new DependentBean(d).load(personID, con);

                    dependents.put(personID, d);
                }
            } catch (SQLException e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            } catch (Exception e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            }

        }

        return dependents;

    }

    /**
     * get/set dependents
     */
    public java.util.TreeMap getDependents() throws ServiceException {

        if (dependents == null) {

            Connection con = null;
            List list = null;

            try {
                con = sqlHelper.getConnection();

                list = getLinkedObjects(PERSON_2_PERSON, DEPENDENT,
                        PERSON_2_RELATIONSHIP_FINANCE, con);

                dependents = new TreeMap();

                if (list == null || list.size() == 0)
                    return dependents;

                Integer personID = null;
                Dependent d = null;

                Iterator iter = list.iterator();
                while (iter.hasNext()) {
                    personID = (Integer) iter.next();

                    d = new Dependent();
                    d.setOwnerId(getId());
                    d.setId(personID);

                    new DependentBean(d).load(personID, con);

                    dependents.put(personID, d);
                }
                sqlHelper.close(con);
            } catch (SQLException e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            } catch (Exception e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            }

        }

        return dependents;

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getDependents() : TreeMap from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    /**
     *
     */
    public FinancialGoal getFinancialGoal() throws ServiceException {

        int personID = this.getPersonID();
        try (Connection con = sqlHelper.getConnection();) {
            List list = linkObjectDao.getLinkedObjects(personID,
                    PERSON_2_FINANCIALGOAL, con);

            if (list == null || list.size() == 0) {
                financialGoal = null;
            } else {
                if (financialGoal == null)
                    financialGoal = new FinancialGoal();
                financialGoal.setOwnerId(this.getId());
                financialGoal.setId((Integer) list.get(0));
                new FinancialGoalBean(financialGoal).load(con);
            }
            return financialGoal;
        } catch (Exception e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

    /**
     *
     */
    public FinancialGoal getFinancialGoal() throws ServiceException {

        int personID = this.getPersonID();

        Connection con = null;

        try {
            con = this.sqlHelper.getConnection();

            List list = linkObjectDao.getLinkedObjects(personID,
                    PERSON_2_FINANCIALGOAL, con);

            if (list == null || list.size() == 0) {
                financialGoal = null;
            } else {
                if (financialGoal == null)
                    financialGoal = new FinancialGoal();
                financialGoal.setOwnerId(this.getId());
                financialGoal.setId((Integer) list.get(0));
                new FinancialGoalBean(financialGoal).load(con);
            }
            sqlHelper.close(con);
            return financialGoal;
        } catch (Exception e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getFinancialGoal() : FinancialGoal from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    public HashMap getContactMedia(Boolean refresh)
            throws ServiceException {

        if (refresh.booleanValue())
            contactMediaDetails = null;
        else if (contactMediaDetails != null)
            return contactMediaDetails;

        int personID = this.getPersonID();

        PreparedStatement sql = null;
        ResultSet rs = null;
        try (Connection con = sqlHelper.getConnection();) {
            sql = con
                    .prepareStatement(
                            "SELECT cm.*"
                                    + " FROM Link l, ContactMedia cm"
                                    + " WHERE ( l.ObjectID1 = ? ) AND ( l.LinkObjectTypeID = ? )"
                                    + " AND ( l.ObjectID2 = cm.ContactMediaID )"
                                    + " AND ( LogicallyDeleted IS NULL )",
                            ResultSet.TYPE_FORWARD_ONLY,
                            ResultSet.CONCUR_READ_ONLY);

            sql.setInt(1, personID);
            sql.setInt(2, PERSON_2_CONTACT_MEDIA);
            rs = sql.executeQuery();

            ContactMediaBean cmb = null;
            while (rs.next()) {
                if (contactMediaDetails == null)
                    contactMediaDetails = new HashMap();
                if (cmb == null)
                    cmb = new ContactMediaBean(null, PERSON_2_CONTACT_MEDIA);
                cmb.setContactMedia(new ContactMedia(personID));
                cmb.load(rs);
                contactMediaDetails.put(cmb.getContactMediaCodeID(), cmb.getContactMedia());
            }
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        } finally {
            try {
                close(rs, sql);
            } catch (SQLException e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            }
        }

        return contactMediaDetails;

    }

    public HashMap getContactMedia(Boolean refresh)
            throws ServiceException {

        if (refresh.booleanValue())
            contactMediaDetails = null;
        else if (contactMediaDetails != null)
            return contactMediaDetails;

        int personID = this.getPersonID();

        Connection con = null;
        PreparedStatement sql = null;
        ResultSet rs = null;

        try {
            con = this.sqlHelper.getConnection();

            sql = con
                    .prepareStatement(
                            "SELECT cm.*"
                                    + " FROM Link l, ContactMedia cm"
                                    + " WHERE ( l.ObjectID1 = ? ) AND ( l.LinkObjectTypeID = ? )"
                                    + " AND ( l.ObjectID2 = cm.ContactMediaID )"
                                    + " AND ( LogicallyDeleted IS NULL )",
                            ResultSet.TYPE_FORWARD_ONLY,
                            ResultSet.CONCUR_READ_ONLY);

            sql.setInt(1, personID);
            sql.setInt(2, PERSON_2_CONTACT_MEDIA);
            rs = sql.executeQuery();

            ContactMediaBean cmb = null;
            while (rs.next()) {
                if (contactMediaDetails == null)
                    contactMediaDetails = new HashMap();
                if (cmb == null)
                    cmb = new ContactMediaBean(null, PERSON_2_CONTACT_MEDIA);
                cmb.setContactMedia(new ContactMedia(personID));
                cmb.load(rs);
                contactMediaDetails.put(cmb.getContactMediaCodeID(), cmb.getContactMedia());
            }
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        } finally {
            try {
                close(rs, sql);
                if (con != null)
                    sqlHelper.close(con);
            } catch (SQLException e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            }
        }

        return contactMediaDetails;

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getContactMedia(refresh Boolean) : HashMap from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    /**
     * get comment of link type PERSON$COMMENT_2_objectTypeID2 (most recent one)
     */
    public Comment getComment(Integer linkObjectTypeID)
            throws ServiceException {

        Comment c = null;

        if (comments != null) {
            c = (Comment) comments.get(linkObjectTypeID);
            if (c != null)
                return c;
        }

        int personID = this.getPersonID();

        PreparedStatement sql = null;
        ResultSet rs = null;
        try (Connection con = sqlHelper.getConnection();) {
            sql = con
                    .prepareStatement(
                            "SELECT c.*"
                                    + " FROM Link l, Comment c"
                                    + " WHERE"
                                    + " ( l.ObjectID1 = ? ) AND ( l.ObjectID2 = c.CommentID ) AND ( l.LinkObjectTypeID = ? )"
                                    + // personID, PERSON_2_COMMENT
                                    " AND ( LinkID IN"
                                    + " (SELECT ObjectID1"
                                    + " FROM Link"
                                    + " WHERE ( ObjectID2 IS NULL ) AND ( LinkObjectTypeID = ? )"
                                    + // linkObjectTypeID
                                    " )" + " )"
                                    + " AND ( LogicallyDeleted IS NULL )",
                            ResultSet.TYPE_FORWARD_ONLY,
                            ResultSet.CONCUR_READ_ONLY);

            sql.setInt(1, personID);
            sql.setInt(2, PERSON_2_COMMENT);
            sql.setInt(3, linkObjectTypeID);
            rs = sql.executeQuery();

            CommentBean cb = null;
            if (rs.next()) {
                c = new Comment(this.getId());
                c.setId((Integer) rs.getObject("CommentID"));
                cb = new CommentBean(c);
                cb.load(rs);
                // if ( comments == null )
                // comments = new HashMap();
                // comments.put( linkObjectTypeID, c );
            }
            return c;
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        } finally {
            try {
                close(rs, sql);
            } catch (SQLException e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            }
        }

    }

    /**
     * get comment of link type PERSON$COMMENT_2_objectTypeID2 (most recent one)
     */
    public Comment getComment(Integer linkObjectTypeID)
            throws ServiceException {

        Comment c = null;

        if (comments != null) {
            c = (Comment) comments.get(linkObjectTypeID);
            if (c != null)
                return c;
        }

        int personID = this.getPersonID();

        Connection con = null;
        PreparedStatement sql = null;
        ResultSet rs = null;

        try {
            con = this.sqlHelper.getConnection();

            sql = con
                    .prepareStatement(
                            "SELECT c.*"
                                    + " FROM Link l, Comment c"
                                    + " WHERE"
                                    + " ( l.ObjectID1 = ? ) AND ( l.ObjectID2 = c.CommentID ) AND ( l.LinkObjectTypeID = ? )"
                                    + // personID, PERSON_2_COMMENT
                                    " AND ( LinkID IN"
                                    + " (SELECT ObjectID1"
                                    + " FROM Link"
                                    + " WHERE ( ObjectID2 IS NULL ) AND ( LinkObjectTypeID = ? )"
                                    + // linkObjectTypeID
                                    " )" + " )"
                                    + " AND ( LogicallyDeleted IS NULL )",
                            ResultSet.TYPE_FORWARD_ONLY,
                            ResultSet.CONCUR_READ_ONLY);

            sql.setInt(1, personID);
            sql.setInt(2, PERSON_2_COMMENT);
            sql.setInt(3, linkObjectTypeID);
            rs = sql.executeQuery();

            CommentBean cb = null;
            if (rs.next()) {
                c = new Comment(this.getId());
                c.setId((Integer) rs.getObject("CommentID"));
                cb = new CommentBean(c);
                cb.load(rs);
                // if ( comments == null )
                // comments = new HashMap();
                // comments.put( linkObjectTypeID, c );
            }
            return c;
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        } finally {
            try {
                close(rs, sql);
                if (con != null)
                    sqlHelper.close(con);
            } catch (SQLException e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            }
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getComment(linkObjectTypeID Integer) : Comment from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    public Integer getSurveyID(int surveyTypeID)
            throws ServiceException, ObjectNotFoundException {
        PreparedStatement sql = null;
        ResultSet rs = null;
        try (Connection con = sqlHelper.getConnection();) {
            // search for person specific surveys (already saved)
            sql = con.prepareStatement("SELECT ObjectID1 FROM Link"
                    + " WHERE ( ObjectID1 IN ( SELECT ObjectID2"
                    + " FROM Link"
                    + " WHERE ( ObjectID1=? ) AND ( LinkObjectTypeID=? )"
                    + " AND ( LogicallyDeleted IS NULL ) )"
                    + ") AND ( LinkObjectTypeID=? )"
                    + "  AND ( LogicallyDeleted IS NULL )"
                    + " ORDER BY ObjectID1 DESC");

            int i = 0;
            sql.setInt(++i, getPersonID());
            sql.setInt(++i, PERSON_2_SURVEY); // 1024
            sql.setInt(++i, surveyTypeID); // e.g. SURVEY_2_RISKPROFILE 24027
            rs = sql.executeQuery();

            if (!rs.next()) {
                close(rs, sql);
                rs = null;
                sql = null;

                // search for general/common surveys (not saved yet)
                sql = con.prepareStatement("SELECT ObjectID1" + " FROM Link"
                        + " WHERE ( LinkObjectTypeID=? )"
                        + " AND ( LogicallyDeleted IS NULL )"
                        + " ORDER BY ObjectID1 DESC");

                i = 0;
                sql.setInt(++i, surveyTypeID); // e.g. SURVEY_2_RISKPROFILE
                                                // 24027
                rs = sql.executeQuery();

                if (!rs.next())
                    throw new ObjectNotFoundException(
                            "Can not find survey for surveyTypeID: "
                                    + surveyTypeID);
            }

            // get latest survey (with max id)
            return (Integer) rs.getObject(1);

        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        } finally {
            try {
                close(rs, sql);
            } catch (SQLException e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            }
        }

    }

    public Integer getSurveyID(int surveyTypeID)
            throws ServiceException, ObjectNotFoundException {

        Connection con = null;
        PreparedStatement sql = null;
        ResultSet rs = null;

        try {
            con = this.sqlHelper.getConnection();

            // search for person specific surveys (already saved)
            sql = con.prepareStatement("SELECT ObjectID1 FROM Link"
                    + " WHERE ( ObjectID1 IN ( SELECT ObjectID2"
                    + " FROM Link"
                    + " WHERE ( ObjectID1=? ) AND ( LinkObjectTypeID=? )"
                    + " AND ( LogicallyDeleted IS NULL ) )"
                    + ") AND ( LinkObjectTypeID=? )"
                    + "  AND ( LogicallyDeleted IS NULL )"
                    + " ORDER BY ObjectID1 DESC");

            int i = 0;
            sql.setInt(++i, getPersonID());
            sql.setInt(++i, PERSON_2_SURVEY); // 1024
            sql.setInt(++i, surveyTypeID); // e.g. SURVEY_2_RISKPROFILE 24027
            rs = sql.executeQuery();

            if (!rs.next()) {
                close(rs, sql);
                rs = null;
                sql = null;

                // search for general/common surveys (not saved yet)
                sql = con.prepareStatement("SELECT ObjectID1" + " FROM Link"
                        + " WHERE ( LinkObjectTypeID=? )"
                        + " AND ( LogicallyDeleted IS NULL )"
                        + " ORDER BY ObjectID1 DESC");

                i = 0;
                sql.setInt(++i, surveyTypeID); // e.g. SURVEY_2_RISKPROFILE
                                                // 24027
                rs = sql.executeQuery();

                if (!rs.next())
                    throw new ObjectNotFoundException(
                            "Can not find survey for surveyTypeID: "
                                    + surveyTypeID);
            }

            // get latest survey (with max id)
            return (Integer) rs.getObject(1);

        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        } finally {
            try {
                close(rs, sql);
                if (con != null)
                    sqlHelper.close(con);
            } catch (SQLException e) {
                e.printStackTrace(System.err);
                throw new ServiceException(e.getMessage());
            }
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getSurveyID(surveyTypeID int) : Integer from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    /***************************************************************************
     * Calculation Models
     */
    public ModelCollection getModels() throws ServiceException {

        // if ( models == null ) {
        models = new ModelCollection();
        try (Connection con = sqlHelper.getConnection();) {
            loadModels(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
        // }

        return models;

    }

    /***************************************************************************
     * Calculation Models
     */
    public ModelCollection getModels() throws ServiceException {

        // if ( models == null ) {
        models = new ModelCollection();

        Connection con = null;
        try {
            con = sqlHelper.getConnection();
            loadModels(con);
            sqlHelper.close(con);
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }
        // }

        return models;

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getModels() : ModelCollection from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    public Collection getPlans(Integer planTypeID)
            throws ServiceException {
        try (Connection con = sqlHelper.getConnection();) {
            Collection result = getPlans(planTypeID, con);
            return result;
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

    public Collection getPlans(Integer planTypeID)
            throws ServiceException {

        try {
            Connection con = sqlHelper.getConnection();
            Collection result = getPlans(planTypeID, con);
            sqlHelper.close(con);
            return result;
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getPlans(planTypeID Integer) : Collection from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    public int storePlan(au.com.totemsoft.util.ReferenceCode plan, Integer planTypeID)
            throws ServiceException {

        if (plan == null || plan.getDescription() == null)
            return -1;

        String desc = plan.getDescription().trim();
        if (desc.length() > 255) {
            desc = desc.substring(0, 255);
            plan.setDescription(desc);
        }

        try (Connection con = sqlHelper.getConnection();) {
            int result = storePlan(plan, planTypeID, con);
            return result;
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

    public int storePlan(au.com.totemsoft.util.ReferenceCode plan, Integer planTypeID)
            throws ServiceException {

        if (plan == null || plan.getDescription() == null)
            return -1;

        String desc = plan.getDescription().trim();
        if (desc.length() > 255) {
            desc = desc.substring(0, 255);
            plan.setDescription(desc);
        }

        try {
            Connection con = sqlHelper.getConnection();
            int result = storePlan(plan, planTypeID, con);
            sqlHelper.close(con);
            return result;
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public storePlan(plan ReferenceCode, planTypeID Integer) : int from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


    public boolean deletePlan(au.com.totemsoft.util.ReferenceCode plan,
            Integer planTypeID) throws ServiceException {
        int planID = plan.getId();

        if (plan == null || planID <= 0)
            return false;

        try (Connection con = sqlHelper.getConnection();) {
            Integer ownerID = getPlanOwner(planTypeID);
            int linkID = linkObjectDao.unlink(
                    ownerID == null ? GLOBAL_PLAN_TEMPLATE : ownerID,
                    // getPersonID(),
                    planID, LinkObjectTypeConstant.PERSON_2_PLAN, con);
            return linkID > 0;
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

    public boolean deletePlan(au.com.totemsoft.util.ReferenceCode plan,
            Integer planTypeID) throws ServiceException {
        int planID = plan.getId();

        if (plan == null || planID <= 0)
            return false;

        try {
            Connection con = sqlHelper.getConnection();
            Integer ownerID = getPlanOwner(planTypeID);
            int linkID = linkObjectDao.unlink(
                    ownerID == null ? GLOBAL_PLAN_TEMPLATE : ownerID,
                    // getPersonID(),
                    planID, LinkObjectTypeConstant.PERSON_2_PLAN, con);
            sqlHelper.close(con);
            return linkID > 0;
        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public deletePlan(plan ReferenceCode, planTypeID Integer) : boolean from class au.com.totemsoft.myplanner.service.impl.PersonServiceImpl


	public static Counter readCounter(File file) {
        try (FileInputStream is = new FileInputStream(file)) {
        	final Unmarshaller unmarshaller = marshallerFactory.createUnmarshaller(configuration);
            unmarshaller.start(Marshalling.createByteInput(is));
            Counter counter = (Counter) unmarshaller.readObject();
            unmarshaller.finish();
            is.close();
            return counter;
        } catch (IOException | ClassNotFoundException e) {
            System.err.print("Un-marshalling failed: ");
            e.printStackTrace();
        }
		return null;
	}

	public static Counter readCounter(File file) {
		try {
			FileInputStream ois = new FileInputStream(file);
			FSTObjectInput in = conf.getObjectInput(ois);
		    Counter result = (Counter) in.readObject(Counter.class);
		    ois.close();
		    return result;
		} catch (Exception e) {
			System.err.println("Error while writing counter to file " + file);
			e.printStackTrace();
			return null;
		}
	}

Try With Resources try(FileInputStream is=new FileInputStream(file)) in method public readCounter(file File) : Counter from class slp.core.counting.io.CounterIO


	public static void writeCounter(Counter counter, File file) {
		try (FileOutputStream os = new FileOutputStream(file)) {
        	final Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
            marshaller.start(Marshalling.createByteOutput(os));
            marshaller.writeObject(counter);
            marshaller.finish();
            os.close();
        } catch (IOException e) {
            System.err.print("Marshalling failed: ");
            e.printStackTrace();
        }
	}

	public static void writeCounter(Counter counter, File file) {
		try {
			FileOutputStream outStream = new FileOutputStream(file);
			FSTObjectOutput out = conf.getObjectOutput(outStream);
			out.writeObject(counter, Counter.class);
			out.flush();
			outStream.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

Try With Resources try(FileOutputStream os=new FileOutputStream(file)) in method public writeCounter(counter Counter, file File) : void from class slp.core.counting.io.CounterIO


    private QuizQuestion() {
        answers = new ArrayList<>();
    }

    private QuizQuestion() {
        answers = new ArrayList<Answer>();
    }

Replace Generic With Diamond ArrayList<Answer> with ArrayList<> in method private QuizQuestion() from class il.ac.hit.quizzy.QuizQuestion


    public EventHandler<DomainObjectConstructedEventArgs> constructed() {
        if (_constructed == null)
            _constructed = new EventHandler<>();
        return _constructed;
    }

    public EventHandler<DomainObjectConstructedEventArgs> constructed() {
        if (_constructed == null)
            _constructed = new EventHandler<DomainObjectConstructedEventArgs>();
        return _constructed;
    }

Replace Generic With Diamond EventHandler<DomainObjectConstructedEventArgs> with EventHandler<> in method public constructed() : EventHandler<DomainObjectConstructedEventArgs> from class apros.codeart.ddd.DomainObject


    public EventHandler<DataContextEventArgs> committed() {
        if (_committed == null)
            _committed = new EventHandler<>();
        return _committed;
    }

    public EventHandler<DataContextEventArgs> committed() {
        if (_committed == null)
            _committed = new EventHandler<DataContextEventArgs>();
        return _committed;
    }

Replace Generic With Diamond EventHandler<DataContextEventArgs> with EventHandler<> in method public committed() : EventHandler<DataContextEventArgs> from class apros.codeart.ddd.repository.DataContext


    public String getFieldsSql() {
        if (!this.hasSelectFields())
            return "*";
        else {
            // where涉及到的字段内置到GetObjectSql中，所以不必考虑
            ArrayList<String> temp = new ArrayList<>();
            ListUtil.addRange(temp, this.columns().select());
            ListUtil.addRange(temp, this.columns().order());

            var fields = StringUtil.distinctIgnoreCase(temp);

            StringBuilder sql = new StringBuilder();

            for (var field : fields) {
                sql.append(SqlStatement.qualifier(field));
                sql.append(",");
            }

            if (!sql.isEmpty())
                StringUtil.removeLast(sql);
            return sql.toString();
        }
    }

    public String getFieldsSql() {
        if (!this.hasSelectFields())
            return "*";
        else {
            // where涉及到的字段内置到GetObjectSql中，所以不必考虑
            ArrayList<String> temp = new ArrayList<String>();
            ListUtil.addRange(temp, this.columns().select());
            ListUtil.addRange(temp, this.columns().order());

            var fields = StringUtil.distinctIgnoreCase(temp);

            StringBuilder sql = new StringBuilder();

            for (var field : fields) {
                sql.append(SqlStatement.qualifier(field));
                sql.append(",");
            }

            if (!sql.isEmpty())
                StringUtil.removeLast(sql);
            return sql.toString();
        }
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public getFieldsSql() : String from class apros.codeart.ddd.repository.access.internal.SqlDefinition


    public RPCClient(int secondsTimeout) {
        _busItem = RabbitBus.borrow(RPCConfig.ClientPolicy);
        initConsumer();
        _signal = new LatchSignal<>();
        _secondsTimeout = secondsTimeout;
    }

	public RPCClient(int secondsTimeout) {
		_busItem = RabbitBus.borrow(RPCConfig.ClientPolicy);
		initConsumer();
		_signal = new LatchSignal<TransferData>();
		_secondsTimeout = secondsTimeout;
	}

Replace Generic With Diamond LatchSignal<TransferData> with LatchSignal<> in method public RPCClient(secondsTimeout int) from class apros.codeart.rabbitmq.rpc.RPCClient


	/**
	 * 使用池中的项
	 *
	 * @param action
	 * @throws Exception
	 */
	public void using(Consumer<T> action) {
		try (IPoolItem item = this.borrow()) {
			action.accept(item.getItem());
		}
	}

	/**
	 * 使用池中的项
	 *
	 * @param action
	 * @throws Exception
	 */
	public void using(Consumer<T> action) {
		IPoolItem<T> item = null;
		try {
			item = this.borrow();
			action.accept(item.getItem());
		} catch (Exception e) {
			if (item != null)
				item.setCorrupted();
			throw propagate(e);
		} finally {
			if (item != null)
				item.clear();
		}
	}

Try With Resources try(IPoolItem item=this.borrow()) in method public using(action Consumer<T>) : void from class apros.codeart.pooling.Pool


	public <R> R using(Function<T, R> action) {
		try (IPoolItem item = this.borrow()) {
			return action.apply(item.getItem());
		}
	}

	public <R> R using(Function<T, R> action) {
		IPoolItem<T> item = null;
		try {
			item = this.borrow();
			return action.apply(item.getItem());
		} catch (Exception e) {
			if (item != null)
				item.setCorrupted();
			throw propagate(e);
		} finally {
			if (item != null)
				item.clear();
		}
	}

Try With Resources try(IPoolItem item=this.borrow()) in method public using(action Function<T,R>) : R from class apros.codeart.pooling.Pool


    private void processUpdate(Update update) {
        Message message = update.message();
        if (message == null || message.text() == null) {
            return;
        }
        if (message.text().equals("/help")) {
            sendHelpMessage(message);
            return;
        }
        var handlers = getHandlers(message);
        for (var handler : handlers) {
            if (handler.invokationTest(message)) {
                Transaction transaction = ElasticApm.startTransaction();
                try (Scope scope = transaction.activate()){
                    transaction.setName(handler.getClass().getSimpleName());
                    transaction.setType(Transaction.TYPE_REQUEST);
                    handler.handle(message);
                } catch (Throwable e) {
                    transaction.captureException(e);
                } finally {
                    transaction.end();
                }
            }
        }
    }

    private void processUpdate(Update update) {
        Message message = update.message();
        if (message == null || message.text() == null) {
            return;
        }
        if (message.text().equals("/help")) {
            sendHelpMessage(message);
            return;
        }
        var handlers = getHandlers(message);
        for (var handler : handlers) {
            if (handler.invokationTest(message)) {
                Transaction transaction = ElasticApm.startTransaction();
                try {
                    transaction.setName(handler.getClass().getSimpleName());
                    transaction.setType(Transaction.TYPE_REQUEST);
                    handler.handle(message);
                } catch (Throwable e) {
                    transaction.captureException(e);
                } finally {
                    transaction.end();
                }
            }
        }
    }

Try With Resources try(Scope scope=transaction.activate()) in method private processUpdate(update Update) : void from class best.tigers.tigersbot.services.BotService


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
        UserDAO users = (UserDAO) getServletContext().getAttribute(UserDAO.ATTRIBUTE);
        //req.getParameter("Username"), req.getParameter("Password")
        String hashed = "";
        try {
            hashed = User.hashPassword(req.getParameter("password"));
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
        try {
            if(users.correct(req.getParameter("email"), hashed) && !users.isSuspended(req.getParameter("email"))){
                RequestDispatcher disp = req.getRequestDispatcher("/WEB-INF/homepage.jsp");
                req.getSession().setAttribute(User.ATTRIBUTE, users.getUserByEmail(req.getParameter("email"), false));
                disp.forward(req,res);
            } else {
                RequestDispatcher disp = req.getRequestDispatcher("try_again.jsp");
                disp.forward(req,res);
            }
        } catch (SQLException | NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
        UserDAO users = (UserDAO) getServletContext().getAttribute(UserDAO.ATTRIBUTE);
        //req.getParameter("Username"), req.getParameter("Password")
        String hashed = "";
        try {
            hashed = User.hashPassword(req.getParameter("password"));
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
        try {
            if(users.correct(req.getParameter("email"), hashed) && !users.isSuspended("email")){
                RequestDispatcher disp = req.getRequestDispatcher("/WEB-INF/homepage.jsp");
                req.getSession().setAttribute(User.ATTRIBUTE, users.getUserByEmail(req.getParameter("email"), false));
                disp.forward(req,res);
            } else {
                RequestDispatcher disp = req.getRequestDispatcher("try_again.jsp");
                disp.forward(req,res);
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }

Merge Catch [catch(SQLException e), catch(NoSuchAlgorithmException e)] to catch(SQLException|NoSuchAlgorithmException e) in method protected doPost(req HttpServletRequest, res HttpServletResponse) : void from class servlets.LoginServlet


	SignupWindow() {
		super("Sign up for member account");
		setHints(Arrays.asList(Window.Hint.CENTERED));
		Panel mainPanel = new Panel();
		Panel usernamePanel = new Panel();
		usernameBox = new TextBox(new TerminalSize(30, 1));
		usernamePanel.addComponent(usernameBox);
		Panel firstnamePanel = new Panel();
		firstnameBox = new TextBox(new TerminalSize(30, 1));
		firstnamePanel.addComponent(firstnameBox);
		Panel lastnamePanel = new Panel();
		lastnameBox = new TextBox(new TerminalSize(30, 1));
		lastnamePanel.addComponent(lastnameBox);
		Panel passwordPanel = new Panel();
		passwordBox = new TextBox(new TerminalSize(30, 1));
		passwordBox.setMask('*');
		passwordPanel.addComponent(passwordBox);
		Panel confirmPasswordPanel = new Panel();
		confirmPasswordBox = new TextBox(new TerminalSize(30, 1));
		confirmPasswordBox.setMask('*');
		confirmPasswordPanel.addComponent(confirmPasswordBox);
		Panel exitPanel = new Panel();
		Button exit = new Button("Enter", () -> {
			if (passwordBox.getText().equals(confirmPasswordBox.getText())) {
				SignupWindow.this.close();
			} else {
				MessageDialog.showMessageDialog(gui, "Error", "Passwords do not match");
			}
		});
		exitPanel.addComponent(exit);
		mainPanel.setLayoutManager(new LinearLayout(Direction.VERTICAL));
		mainPanel.addComponent(usernamePanel.withBorder(Borders.singleLine("Username")));
		mainPanel.addComponent(firstnamePanel.withBorder(Borders.singleLine("Firstname")));
		mainPanel.addComponent(lastnamePanel.withBorder(Borders.singleLine("Lastname")));
		mainPanel.addComponent(passwordPanel.withBorder(Borders.singleLine("Password")));
		mainPanel.addComponent(confirmPasswordPanel.withBorder(Borders.singleLine("Confirm Password")));
		mainPanel.addComponent(exitPanel.withBorder(Borders.singleLine()));
		setComponent(mainPanel.withBorder(Borders.singleLine()));
	}

	SignupWindow() {
		super("Sign up for member account");
		setHints(Arrays.asList(Window.Hint.CENTERED));
		Panel mainPanel = new Panel();
		Panel usernamePanel = new Panel();
		usernameBox = new TextBox(new TerminalSize(30, 1));
		usernamePanel.addComponent(usernameBox);
		Panel firstnamePanel = new Panel();
		firstnameBox = new TextBox(new TerminalSize(30, 1));
		firstnamePanel.addComponent(firstnameBox);
		Panel lastnamePanel = new Panel();
		lastnameBox = new TextBox(new TerminalSize(30, 1));
		lastnamePanel.addComponent(lastnameBox);
		Panel passwordPanel = new Panel();
		passwordBox = new TextBox(new TerminalSize(30, 1));
		passwordBox.setMask('*');
		passwordPanel.addComponent(passwordBox);
		Panel confirmPasswordPanel = new Panel();
		confirmPasswordBox = new TextBox(new TerminalSize(30, 1));
		confirmPasswordBox.setMask('*');
		confirmPasswordPanel.addComponent(confirmPasswordBox);
		Panel exitPanel = new Panel();
		Button exit = new Button("Enter", new Runnable() {
			public void run() {
				if (passwordBox.getText().equals(confirmPasswordBox.getText())) {
					SignupWindow.this.close();
				} else {
					MessageDialog.showMessageDialog(gui, "Error", "Passwords do not match");
				}
			}
		});
		exitPanel.addComponent(exit);
		mainPanel.setLayoutManager(new LinearLayout(Direction.VERTICAL));
		mainPanel.addComponent(usernamePanel.withBorder(Borders.singleLine("Username")));
		mainPanel.addComponent(firstnamePanel.withBorder(Borders.singleLine("Firstname")));
		mainPanel.addComponent(lastnamePanel.withBorder(Borders.singleLine("Lastname")));
		mainPanel.addComponent(passwordPanel.withBorder(Borders.singleLine("Password")));
		mainPanel.addComponent(confirmPasswordPanel.withBorder(Borders.singleLine("Confirm Password")));
		mainPanel.addComponent(exitPanel.withBorder(Borders.singleLine()));
		setComponent(mainPanel.withBorder(Borders.singleLine()));
	}

Replace Anonymous With Lambda businesslayer.SignupWindow.SignupWindow.exit.new Button.new Runnable with () -> {if(passwordBox.getText().equals(confirmPasswordBox.getText())){SignupWindow.this.close(); in method package SignupWindow() from class businesslayer.SignupWindow


	public ArrayList<Integer> languageSelect(HashMap<Integer, String> langNames) {
		String tempLang;
		ArrayList<Integer> langIds = new ArrayList<>(); // the language id(s) of the current book
		int i = 1;
		try {
			while (!App.getCurrentBook().isLang()) {
				Statement langstmt = con.createStatement();
				ResultSet langstmtrs = langstmt.executeQuery("select * from language;");
				TerminalSize size = new TerminalSize(20, 14);
				CheckBoxList<String> langList = new CheckBoxList<>(size);
				while (langstmtrs.next()) { // prints language list for user to choose
					tempLang = langstmtrs.getString("languagename");
					langNames.put(i, tempLang); // adds languages to hashmap to check against when making a choice
					langList.addItem(tempLang);
					i = i + 1;
				}
				BasicWindow langListHolder = new BasicWindow("Choose languages from options below or select Add to add a new one");
				langListHolder.setComponent(langList);
				String langChoiceString = s.nextLine();
				if (langChoiceString.equals(null)) {
					System.out.println("Invalid input, please enter a number.");
				} else if (Objects.nonNull(langChoiceString)) {
					int langId = Integer.parseInt(langChoiceString);
					if (Objects.isNull(langNames.get(langId)) && langId != 999) { // checks if user input is a valid
						// language and not a new language
						// entry
						System.out.println("Invalid input, please choose a language from the list.");
						return null;
					} else if (Objects.isNull(langNames.get(langId)) && langId == 999) {
						System.out.println("Type name of new language below and press enter:");
						String newLang = s.nextLine();
						PreparedStatement addlangstmt = con
								.prepareStatement("INSERT INTO language (languagename) VALUES (?);");
						addlangstmt.setString(1, newLang);
						addlangstmt.executeUpdate();
						langIds.add(getLastInsertId());

					} else if (Objects.nonNull(langNames.get(langId))) {

						langIds.add(langId);
					}

				}
				boolean continueTest = false;
				do {
					System.out.println("Do you want to add another language? (Y/N)");
					String continueString = s.nextLine();
					if (continueString.equalsIgnoreCase("N")) {
						App.getCurrentBook().setLang(true);
						continueTest = true;
					} else if (continueString.equalsIgnoreCase("Y")) {
						continueTest = true;
					} else {
						System.out.println("Invalid input, try again.");
					}
				} while (!continueTest);
			}

		} catch (Exception e) {
			System.out.println("Invalid input, try again.");
			e.printStackTrace();
		}
		return langIds;
	}

	public ArrayList<Integer> languageSelect(HashMap<Integer, String> langNames) {
		String tempLang;
		ArrayList<Integer> langIds = new ArrayList<>(); // the language id(s) of the current book
		int i = 1;
		try {
			while (!App.getCurrentBook().isLang()) {
				Statement langstmt = con.createStatement();
				ResultSet langstmtrs = langstmt.executeQuery("select * from language;");
				TerminalSize size = new TerminalSize(20, 14);
				CheckBoxList<String> langList = new CheckBoxList<String>(size);
				while (langstmtrs.next()) { // prints language list for user to choose
					tempLang = langstmtrs.getString("languagename");
					langNames.put(i, tempLang); // adds languages to hashmap to check against when making a choice
					langList.addItem(tempLang);
					i = i + 1;
				}
				BasicWindow langListHolder = new BasicWindow("Choose languages from options below or select Add to add a new one");
				langListHolder.setComponent(langList);
				String langChoiceString = s.nextLine();
				if (langChoiceString.equals(null)) {
					System.out.println("Invalid input, please enter a number.");
				} else if (Objects.nonNull(langChoiceString)) {
					int langId = Integer.parseInt(langChoiceString);
					if (Objects.isNull(langNames.get(langId)) && langId != 999) { // checks if user input is a valid
						// language and not a new language
						// entry
						System.out.println("Invalid input, please choose a language from the list.");
						return null;
					} else if (Objects.isNull(langNames.get(langId)) && langId == 999) {
						System.out.println("Type name of new language below and press enter:");
						String newLang = s.nextLine();
						PreparedStatement addlangstmt = con
								.prepareStatement("INSERT INTO language (languagename) VALUES (?);");
						addlangstmt.setString(1, newLang);
						addlangstmt.executeUpdate();
						langIds.add(getLastInsertId());

					} else if (Objects.nonNull(langNames.get(langId))) {

						langIds.add(langId);
					}

				}
				boolean continueTest = false;
				do {
					System.out.println("Do you want to add another language? (Y/N)");
					String continueString = s.nextLine();
					if (continueString.equalsIgnoreCase("N")) {
						App.getCurrentBook().setLang(true);
						continueTest = true;
					} else if (continueString.equalsIgnoreCase("Y")) {
						continueTest = true;
					} else {
						System.out.println("Invalid input, try again.");
					}
				} while (!continueTest);
			}

		} catch (Exception e) {
			System.out.println("Invalid input, try again.");
			e.printStackTrace();
		}
		return langIds;
	}

Replace Generic With Diamond CheckBoxList<String> with CheckBoxList<> in method public languageSelect(langNames HashMap<Integer,String>) : ArrayList<Integer> from class businesslayer.Library


    public static void main(String[] args) {
        Calculator calc = new Calculator();
        calc.multiple(0, 10, 2, (value, index) -> value * index);
    }

    public static void main(String[] args) {
        Calculator calc = new Calculator();
        calc.multiple(0, 10, 2, new Operation() {
            @Override
            public double calc(int left, int right) {
                return left * right;
            }
        });
    }

Replace Anonymous With Lambda ru.job4j.lambda.Calculator.main.multiple.new Operation with (value, index) -> value * index in method public main(args String[]) : void from class ru.job4j.lambda.Calculator


    private List<GeneralCommand> getGeneralInvoker(Transaction transaction, Permission permission) {
        var bankAccountService =  super.getBankAccountService();
        GeneralCommand validatePermissionCommand = new AccountPermissionCommand(transaction.getAccNo(), permission);
        GeneralCommand validateStatusCommand = new AccountValidateStatusCommand(transaction.getAccNo(), bankAccountService);
        GeneralCommand fetchBankAccountCommand = () -> {
            BankAccount bankAccount = bankAccountService.getBankAccountByAccNo(transaction.getAccNo());
            transaction.setAccNo(bankAccount.getAccNo());
        };
        return List.of(validatePermissionCommand, validateStatusCommand, fetchBankAccountCommand);
    }

    private List<GeneralCommand> getGeneralInvoker(Transaction transaction, Permission permission) {
        GeneralCommand validatePermissionCommand = new AccountPermissionCommand(transaction.getAccNo(), permission);
        GeneralCommand validateStatusCommand = new AccountValidateStatusCommand(transaction.getAccNo(), bankAccountService);
        GeneralCommand fetchBankAccountCommand = new GeneralCommand() {
            @Override
            public void execute() throws Exception {
                BankAccount bankAccount = bankAccountService.getBankAccountByAccNo(transaction.getAccNo());
                transaction.setAccNo(bankAccount.getAccNo());
            }
        };
        return List.of(validatePermissionCommand, validateStatusCommand, fetchBankAccountCommand);
    }

Replace Anonymous With Lambda site.anish_karthik.upi_net_banking.server.strategy.transactions.AccountDeposit.getGeneralInvoker.fetchBankAccountCommand.new GeneralCommand with () -> {BankAccount bankAccount=bankAccountService.getBankAccountByAccNo(transaction.getAccNo()); in method private getGeneralInvoker(transaction Transaction, permission Permission) : List<GeneralCommand> from class site.anish_karthik.upi_net_banking.server.strategy.transactions.AccountBaseStrategy


    public List<Category> getChildren() {
        if (children == null) {
            children = new ArrayList<>();
        }
        return children;
    }

    public List<Category> getChildren() {
        if (children == null) {
            children = new ArrayList<Category>();
        }
        return children;
    }

Replace Generic With Diamond ArrayList<Category> with ArrayList<> in method public getChildren() : List<Category> from class com.iti.foodCalculator.entity.Category


	private static void createVersionsInfoFile(String path, String file, String envData, String suiteName) {
		File myFoo = new File(path + file);
		try(FileOutputStream fooStream = new FileOutputStream(myFoo, false)) {
			String versions = ("env=\"" + envData + "\"\n" + "suiteName=\"" + suiteName + "\"\n");
			byte[] myBytes = versions.getBytes();
			fooStream.write(myBytes);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private static void createVersionsInfoFile(String path, String file, String envData, String suiteName) {
		File myFoo = new File(path + file);
		FileOutputStream fooStream;
		try {
			fooStream = new FileOutputStream(myFoo, false);
			String versions = ("env=\"" + envData + "\"\n" + "suiteName=\"" + suiteName + "\"\n");
			byte[] myBytes = versions.getBytes();
			fooStream.write(myBytes);
			fooStream.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

Try With Resources try(FileOutputStream fooStream=new FileOutputStream(myFoo,false)) in method private createVersionsInfoFile(path String, file String, envData String, suiteName String) : void from class org.onap.dcae.ci.report.ExtentManager


    /**
     * Lookup a JavaClass object from the Class Name provided.
     */
    @Override
    public JavaClass loadClass(final String className) throws ClassNotFoundException {
        final String classFile = className.replace('.', '/');
        JavaClass RC = findClass(className);
        if (RC != null) {
            return RC;
        }
        try (InputStream is = loader.getResourceAsStream(classFile + ".class")) {
            if (is == null) {
                throw new ClassNotFoundException(className + " not found.");
            }
            final ClassParser parser = new ClassParser(is, className);
            RC = parser.parse();
            storeClass(RC);
            return RC;
        } catch (final IOException e) {
            throw new ClassNotFoundException(className + " not found: " + e, e);
        }
    }

    /**
     * Lookup a JavaClass object from the Class Name provided.
     */
    public JavaClass loadClass( String className ) throws ClassNotFoundException {
        String classFile = className.replace('.', '/');
        JavaClass RC = findClass(className);
        if (RC != null) {
            return RC;
        }
        try {
            InputStream is = loader.getResourceAsStream(classFile + ".class");
            if (is == null) {
                throw new ClassNotFoundException(className + " not found.");
            }
            ClassParser parser = new ClassParser(is, className);
            RC = parser.parse();
            storeClass(RC);
            return RC;
        } catch (IOException e) {
            throw new ClassNotFoundException(e.toString());
        }
    }

Try With Resources try(InputStream is=loader.getResourceAsStream(classFile + ".class")) in method public loadClass(className String) : JavaClass from class org.apache.bcel.util.ClassLoaderRepository


    /**
     * Disassemble a byte array of JVM byte codes starting from code line
     * `index' and return the disassembled string representation. Decode only
     * `num' opcodes (including their operands), use -1 if you want to
     * decompile everything.
     *
     * @param  code byte code array
     * @param  constant_pool Array of constants
     * @param  index offset in `code' array
     * <EM>(number of opcodes, not bytes!)</EM>
     * @param  length number of opcodes to decompile, -1 for all
     * @param  verbose be verbose, e.g. print constant pool index
     * @return String representation of byte codes
     */
    public static String codeToString( final byte[] code, final ConstantPool constant_pool, final int index,
            final int length, final boolean verbose ) {
        final StringBuilder buf = new StringBuilder(code.length * 20); // Should be sufficient // CHECKSTYLE IGNORE MagicNumber
        try (ByteSequence stream = new ByteSequence(code)) {
            for (int i = 0; i < index; i++) {
                codeToString(stream, constant_pool, verbose);
            }
            for (int i = 0; stream.available() > 0; i++) {
                if ((length < 0) || (i < length)) {
                    final String indices = fillup(stream.getIndex() + ":", 6, true, ' ');
                    buf.append(indices).append(codeToString(stream, constant_pool, verbose)).append('\n');
                }
            }
        } catch (final IOException e) {
            throw new ClassFormatException("Byte code error: " + buf.toString(), e);
        }
        return buf.toString();
    }

    /**
     * Disassemble a byte array of JVM byte codes starting from code line
     * `index' and return the disassembled string representation. Decode only
     * `num' opcodes (including their operands), use -1 if you want to
     * decompile everything.
     *
     * @param  code byte code array
     * @param  constant_pool Array of constants
     * @param  index offset in `code' array
     * <EM>(number of opcodes, not bytes!)</EM>
     * @param  length number of opcodes to decompile, -1 for all
     * @param  verbose be verbose, e.g. print constant pool index
     * @return String representation of byte codes
     */
    public static final String codeToString( byte[] code, ConstantPool constant_pool, int index,
            int length, boolean verbose ) {
    	StringBuilder buf = new StringBuilder(code.length * 20); // Should be sufficient
        ByteSequence stream = new ByteSequence(code);
        try {
            for (int i = 0; i < index; i++) {
                codeToString(stream, constant_pool, verbose);
            }
            for (int i = 0; stream.available() > 0; i++) {
                if ((length < 0) || (i < length)) {
                    String indices = fillup(stream.getIndex() + ":", 6, true, ' ');
                    buf.append(indices).append(codeToString(stream, constant_pool, verbose))
                            .append('\n');
                }
            }
        } catch (IOException e) {
            System.out.println(buf.toString());
            e.printStackTrace();
            throw new ClassFormatException("Byte code error: " + e);
        }
        return buf.toString();
    }

Try With Resources try(ByteSequence stream=new ByteSequence(code)) in method public codeToString(code byte[], constant_pool ConstantPool, index int, length int, verbose boolean) : String from class org.apache.bcel.classfile.Utility


    /**
     * @return an array of instructions without target information for branch instructions.
     */
    public Instruction[] getInstructions() {
        final List<Instruction> instructions = new ArrayList<>();
        try (ByteSequence bytes = new ByteSequence(getByteCode())) {
            while (bytes.available() > 0) {
                instructions.add(Instruction.readInstruction(bytes));
            }
        } catch (final IOException e) {
            throw new ClassGenException(e.toString(), e);
        }
        return instructions.toArray(new Instruction[instructions.size()]);
    }

    /**
     * @return an array of instructions without target information for branch instructions.
     */
    public Instruction[] getInstructions() {
        ByteSequence bytes = new ByteSequence(getByteCode());
        List instructions = new ArrayList();
        try {
            while (bytes.available() > 0) {
                instructions.add(Instruction.readInstruction(bytes));
            }
        } catch (IOException e) {
            throw new ClassGenException(e.toString());
        }
        return (Instruction[]) instructions.toArray(new Instruction[instructions.size()]);
    }

Try With Resources try(ByteSequence bytes=new ByteSequence(getByteCode())) in method public getInstructions() : Instruction[] from class org.apache.bcel.generic.InstructionList


    /**
     * @param name fully qualified file name, e.g. java/lang/String
     * @param suffix file name ends with suffix, e.g. .java
     * @return byte array for file on class path
     */
    public byte[] getBytes(final String name, final String suffix) throws IOException {
        DataInputStream dis = null;
        try (InputStream is = getInputStream(name, suffix)) {
            if (is == null) {
                throw new IOException("Couldn't find: " + name + suffix);
            }
            dis = new DataInputStream(is);
            final byte[] bytes = new byte[is.available()];
            dis.readFully(bytes);
            return bytes;
        } finally {
            if (dis != null) {
                dis.close();
            }
        }
    }

    /**
     * @param name fully qualified file name, e.g. java/lang/String
     * @param suffix file name ends with suffix, e.g. .java
     * @return byte array for file on class path
     */
    public byte[] getBytes( String name, String suffix ) throws IOException {
        DataInputStream dis = null;
        try {
            InputStream is = getInputStream(name, suffix);
            if (is == null) {
                throw new IOException("Couldn't find: " + name + suffix);
            }
            dis = new DataInputStream(is);
            byte[] bytes = new byte[is.available()];
            dis.readFully(bytes);
            return bytes;
        } finally {
            if (dis != null) {
                dis.close();
            }
        }
    }

Try With Resources try(InputStream is=getInputStream(name,suffix)) in method public getBytes(name String, suffix String) : byte[] from class org.apache.bcel.util.ClassPath


    /**
     * Lista de entidades a DTO.
     *
     * Este método convierte una lista de objetos PagoEntity a una lista de
     * objetos PagoDTO (json)
     *
     * @param entityList corresponde a la lista de pagos de tipo Entity que
     * vamos a convertir a DTO.
     * @return la lista de pagos en forma DTO (json)
     */
    private List<PagoDTO> listEntity2DTO(List<PagoEntity> entityList) {
        List<PagoDTO> list = new ArrayList<>();
        for (PagoEntity entity : entityList) {
            list.add(new PagoDTO(entity));
        }
        return list;
    }

    /**
     * Lista de entidades a DTO.
     *
     * Este método convierte una lista de objetos PagoEntity a una lista de
     * objetos PagoDTO (json)
     *
     * @param entityList corresponde a la lista de pagos de tipo Entity que
     * vamos a convertir a DTO.
     * @return la lista de pagos en forma DTO (json)
     */
    private List<PagoDTO> listEntity2DTO(List<PagoEntity> entityList) {
        List<PagoDTO> list = new ArrayList<PagoDTO>();
        for (PagoEntity entity : entityList) {
            list.add(new PagoDTO(entity));
        }
        return list;
    }

Replace Generic With Diamond ArrayList<PagoDTO> with ArrayList<> in method private listEntity2DTO(entityList List<PagoEntity>) : List<PagoDTO> from class co.edu.uniandes.csw.partyServices.resources.PagoResource


    public FechaDetailDTO(FechaEntity fechaEntity){
        super(fechaEntity);
        if(fechaEntity!=null)
        {
            eventos=new ArrayList<>();
            for (EventoEntity evento : fechaEntity.getEventos()) {
                eventos.add(new EventoDTO(evento));
            }
        }
    }

    public FechaDetailDTO(FechaEntity fechaEntity){
        super(fechaEntity);
        if(fechaEntity!=null)
        {
            eventos=new ArrayList<EventoDTO>();
            for (EventoEntity evento : fechaEntity.getEventos()) {
                eventos.add(new EventoDTO(evento));
            }
        }
    }

Replace Generic With Diamond ArrayList<EventoDTO> with ArrayList<> in method public FechaDetailDTO(fechaEntity FechaEntity) from class co.edu.uniandes.csw.partyServices.dtos.FechaDetailDTO