PMD CPD Reports

Minimum Token Count : 50

Duplication 28 Lines, 99 Tokens

org/limy/web/WebResourceMultiForm.java and org/limy/web/WebResourceVMulti.java

        results.addAll(super.getAllParameters());
        
        // フォームから取得したパラメータをリストに追加
        for (Entry entry : multiFormParams.entrySet()) {
            MultiFormValue value = entry.getValue();
            if (value instanceof MultiFormStringValue) {
                List values = ((MultiFormStringValue)value).getValues();
                for (String multiValue : values) {
                    results.add(new ParameterItem(entry.getKey(), multiValue));
                }
            }
        }
        return results;
    }
    
    // ------------------------ Public Methods

    /**
     * パラメータをファイル型で取得します。
     * @param name パラメータ名
     * @return ファイル
     */
    public MultiFormFileValue getParameterFile(String name) {
        return (MultiFormFileValue)multiFormParams.get(name);
    }


}

Duplication 27 Lines, 96 Tokens

org/limy/web/WebApplicationParameter.java and org/limy/web/WebResourceImpl.java

    }

    public int getParameterIntDefault(String name, int defaultValue) {
        String param = getParameter(name);
        if (param == null) {
            return defaultValue;
        }
        try {
            return Integer.parseInt(param);
        } catch (NumberFormatException e) {
            return defaultValue;
        }
    }

    public Integer getParameterInteger(String name) {
        String param = getParameter(name);
        if (param == null) {
            return null;
        }
        try {
            return Integer.valueOf(param);
        } catch (NumberFormatException e) {
            return null;
        }
    }

    public String getParameter(String name) {

Duplication 12 Lines, 91 Tokens

org/limy/admin/format/XmlContextUtils.java and org/limy/admin/format/XmlContextUtils.java

                Map subValues = new HashMap();
                for (int i = 0; i < attrs.getLength(); i++) {
                    Node attr = attrs.item(i);
                    subValues.put(attr.getNodeName(), attr.getNodeValue());
                }
                
                if (parentValues.get(nodeName) == null) {
                    parentValues.put(nodeName, subValues);
                } else {
                    throw new IllegalStateException("予期されていない形式のXMLファイルです。");
                }
            }

Duplication 10 Lines, 77 Tokens

org/limy/web/WebResourceMultiForm.java and org/limy/web/WebResourceVMulti.java

        MultiFormValue obj = multiFormParams.get(name);
        if (obj instanceof MultiFormStringValue) {
            List stringValues = ((MultiFormStringValue)obj).getValues();
            return stringValues.toArray(new String[stringValues.size()]);
        }
        return new String[0];
    }

    public Collection getAllParameters() {
        Collection results = new ArrayList();

Duplication 27 Lines, 70 Tokens

org/limy/resource/CommonDAO.java and org/limy/resource/CommonDAO.java

            rs = stmt.executeQuery();
            
            // 結果セットからレコードを生成して返却
            List r = new ArrayList();
            while (rs.next()) {
                r.add(creator.create(rs));
            }
            return r;
            
        } catch (SQLException e) {
            logger.fatal(e);
            throw new DBException(e);
        } finally {
            closeResources(stmt, rs);
        }
    }

    /**
     * レコードを更新します。
     * @param conn DB接続
     * @param resource 更新するリソース情報(更新値もこの中に格納)
     * @param updateIndices 更新するカラムのインデックス(配列)
     * @param primaryIndex プライマリキーカラムのインデックス(更新条件として使用)
     * @return 更新したレコード数
     * @throws DBException DB例外
     */
    public static int updateRecords(

Duplication 11 Lines, 61 Tokens

org/limy/admin/format/CreateHtmlFromXml.java and org/limy/admin/format/CreateHtmlFromXml.java

            Document doc = builder.parse(xmlIn);
            Element root = doc.getDocumentElement();
            XmlContextUtils.addValue(context, root);
            
        } catch (ParserConfigurationException e) {
            throw new IOException(e.getMessage());
        } catch (SAXException e) {
            throw new IOException(e.getMessage());
        } catch (IOException e) {
            throw e;
        }

Duplication 16 Lines, 60 Tokens

org/limy/resource/CommonDAO.java and org/limy/resource/CommonDAO.java

            DBConnection conn, String sql, BindValues values, SqlExtInfo sqlExtInfo)
            throws DBException {
        
        DBPreparedStatement stmt = null;
        ResultSet rs = null;
        try {
            // SQL文からステートメントを生成してSQL文発行
            stmt = conn.prepareStatement(sql);
            if (values != null) {
                values.bind(stmt);
            }
            rs = stmt.executeQuery();
            
            // SQL文からレコード生成情報を取得
            SqlInfo sqlInfo = SqlParseUtils.parseSql(sql);
            DBCreatable creator = sqlInfo.getCreator();

Duplication 5 Lines, 59 Tokens

org/limy/util/CalendarUtils.java and org/limy/util/CalendarUtils.java

    public static boolean equalYMD(Calendar cal, Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        if (calendar.get(Calendar.YEAR) == cal.get(Calendar.YEAR)
                && calendar.get(Calendar.MONTH) == cal.get(Calendar.MONTH)

Duplication 8 Lines, 53 Tokens

org/limy/resource/svn/SvnUtils.java and org/limy/resource/svn/SvnUtils.java

            String filePath = info.getPath();
            
            logger.debug("Commit to SVN :" + repository.getLocation().getPath() + filePath);
            String dirPath = "";
            if (filePath.lastIndexOf('/') >= 0) {
                dirPath = filePath.substring(0, filePath.lastIndexOf('/'));
            }
            editor.openDir(dirPath, REVISION_HEAD);

Duplication 5 Lines, 52 Tokens

org/limy/runtime/Log4jProfileTool.java and org/limy/runtime/Log4jProfileTool.java

    public static long endProfile(Object key, String message) {
        Long time = startTimes.get(key);
        if (time != null) {
            long passingTime = System.currentTimeMillis() - time.longValue();
            logger.log(LimyLogLevel.PROFILE, message + " " + passingTime);