CPD Results

The following document contains the results of PMD's CPD

Duplications

FileLine
org/jcreme/sql/WrappedResultSet.java137
org/jcreme/sql/WrappedStatement.java163
        message = message + ": \n" + e.getMessage();
        SQLException exc = null;
        if ((this.exceptionHandler != null)
                && (this.exceptionHandler.isDeadLock(e))) {
            exc = generateDeadLockException(message, e);
        } else if ((this.exceptionHandler != null)
                && (this.exceptionHandler.isLossOfConnection(e))) {
            exc = generateConnectionLostException(message, e);
        } else {
            exc = generateNewException(message, e);
        }
        exc.setNextException(e);
        return exc;
    }

    /**
     * This method generates a DeadLockException from an SQLException.
     * 
     * @param message
     *            the message to append.
     * @param e
     *            the original exception.
     * @return a DeadLockException with the given message.
     */
    protected DeadLockException generateDeadLockException(String message,
            SQLException e) {
        return new DeadLockException(message, e.getSQLState(), e.getErrorCode());
    }

    /**
     * This method generates a ConnectionLostException from an SQLException.
     * 
     * @param message
     *            the message to append.
     * @param e
     *            the original exception.
     * @return a ConnectionLostException with the given message.
     */
    protected ConnectionLostException generateConnectionLostException(
            String message, SQLException e) {
        return new ConnectionLostException(message, e.getSQLState(), e
                .getErrorCode());
    }

    /**
     * This method generates a new SQLException from an SQLException.
     * 
     * @param message
     *            the message to append.
     * @param e
     *            the original exception.
     * @return a new SQLException with the given message.
     */
    protected SQLException generateNewException(String message, SQLException e) {
        return new SQLException(message, e.getSQLState(), e.getErrorCode());
    }

    /**
     * This method generates a BatchUpdateException from an SQLException.
     * 
     * @param message
     *            the message to append.
     * @param e
     *            the original exception.
     * @return a BatchUpdateException with the given message.
     */
    protected SQLException generateNewException(String message,

FileLine
org/jcreme/swing/table/colormodel/BaseCyclingColorModel.java165
org/jcreme/swing/table/colormodel/LineTitlesColorModel.java236
            fireTableColorModelChanged(new TableColorModelEvent(this));
        }
    }

    /**
     * This method enables to change the color used as background for selected
     * cells.
     * 
     * @param bgSelectedColor
     *            the new background for selected cells.
     */
    public void setBackgroundSelectedColor(Color bgSelectedColor) {
        if (((bgSelectedColor == null) && (this.backgroundSelectedColor != null))
                || ((bgSelectedColor != null) && ((this.backgroundSelectedColor == null) || (!this.backgroundSelectedColor
                        .equals(bgSelectedColor))))) {
            this.backgroundSelectedColor = bgSelectedColor;
            fireTableColorModelChanged(new TableColorModelEvent(this));
        }
    }

    /**
     * This method enables to change the color used as foreground for selected
     * cells.
     * 
     * @param fgSelectedColor
     *            the new foreground for selected cells.
     */
    public void setForegroundSelectedColor(Color fgSelectedColor) {
        if (((fgSelectedColor == null) && (this.foregroundSelectedColor != null))
                || ((fgSelectedColor != null) && ((this.foregroundSelectedColor == null) || (!this.foregroundSelectedColor
                        .equals(fgSelectedColor))))) {
            this.foregroundSelectedColor = fgSelectedColor;
            fireTableColorModelChanged(new TableColorModelEvent(this));
        }
    }

FileLine
org/jcreme/sql/WrappedStatement.java728
org/jcreme/sql/WrappedStatement.java817
            return this.realStatement.execute(sql, autoGeneratedKeys);
        } catch (SQLException e) {
            CremeAction redo = null;
            try {
                Class[] types = { java.lang.String.class, Integer.TYPE };
                Object[] params = { this.baseQuery,
                        new Integer(autoGeneratedKeys) };
                redo = new CremeAction(getClass().getMethod("executeUpdate",
                        types));
                redo.setSubject(this);
                redo.setParameters(params);
            } catch (NoSuchMethodException ex) {
                ex.printStackTrace();
            } catch (IllegalArgumentException ex) {
                ex.printStackTrace();
            }
            manageException(e, redo);
            if ((redo != null) && (redo.isSuccessfull())) {
                return ((Boolean) redo.getResult()).booleanValue();

FileLine
org/jcreme/sql/WrappedStatement.java788
org/jcreme/sql/WrappedStatement.java875
            return this.realStatement.execute(sql, columnNames);
        } catch (SQLException e) {
            CremeAction redo = null;
            try {
                Class[] types = { java.lang.String.class, String[].class };
                Object[] params = { this.baseQuery, columnNames };
                redo = new CremeAction(getClass().getMethod("executeUpdate",
                        types));
                redo.setSubject(this);
                redo.setParameters(params);
            } catch (NoSuchMethodException ex) {
                ex.printStackTrace();
            } catch (IllegalArgumentException ex) {
                ex.printStackTrace();
            }
            manageException(e, redo);
            if ((redo != null) && (redo.isSuccessfull())) {
                return ((Boolean) redo.getResult()).booleanValue();

FileLine
org/jcreme/sql/WrappedStatement.java759
org/jcreme/sql/WrappedStatement.java846
            return this.realStatement.execute(sql, columnIndexes);
        } catch (SQLException e) {
            CremeAction redo = null;
            try {
                Class[] types = { java.lang.String.class, int[].class };
                Object[] params = { this.baseQuery, columnIndexes };
                redo = new CremeAction(getClass().getMethod("executeUpdate",
                        types));
                redo.setSubject(this);
                redo.setParameters(params);
            } catch (NoSuchMethodException ex) {
                ex.printStackTrace();
            } catch (IllegalArgumentException ex) {
                ex.printStackTrace();
            }
            manageException(e, redo);
            if ((redo != null) && (redo.isSuccessfull())) {
                return ((Boolean) redo.getResult()).booleanValue();

FileLine
org/jcreme/caches/HashCache.java140
org/jcreme/caches/LUFOCache.java258
	}

	/**
	 * This method gives access to the full content of the cache.
	 * 
	 * @return an array containing all the objects stored in the cache.
	 */
	public synchronized Object[] getAllObjects() {
		return this.values.values().toArray();
	}

	/**
	 * This method gives the same result as the getAllObjects method but the
	 * objects in the result array are types with the parameter type.
	 * 
	 * @param type
	 *            the type to give to the object in the result array.
	 * @return an array of objects of the type.
	 */
	public synchronized Object[] getAllObjects(final Class type) {
		return this.values.values().toArray(
				(Object[]) java.lang.reflect.Array.newInstance(type,
						this.values.size()));
	}

	/**
	 * This method enables to access to the cache contents.
	 * 
	 * @return a map of the (key,value) contents of the cache.
	 */
	public synchronized Map getMap() {
		return (Map) this.values.clone();
	}

	/**
	 * This is a convenience method. It enables to add to the cache all the
	 * objects present in the map.
	 * 
	 * @param m
	 *            the map that contains the objects (and keys) to use.
	 */
	public synchronized void registerAllObjects(final Map m) {
		if (m != null) {

FileLine
org/jcreme/sql/WrappedStatement.java823
org/jcreme/sql/WrappedStatement.java851
                Object[] params = { this.baseQuery, columnIndexes };
                redo = new CremeAction(getClass().getMethod("executeUpdate",
                        types));
                redo.setSubject(this);
                redo.setParameters(params);
            } catch (NoSuchMethodException ex) {
                ex.printStackTrace();
            } catch (IllegalArgumentException ex) {
                ex.printStackTrace();
            }
            manageException(e, redo);
            if ((redo != null) && (redo.isSuccessfull())) {
                return ((Boolean) redo.getResult()).booleanValue();
            }
            throw generateException(e);
        }
    }

    /**
     * @see Statement#execute(java.lang.String, java.lang.String[])
     */
    public boolean execute(String sql, String[] columnNames)

FileLine
org/jcreme/sql/WrappedStatement.java734
org/jcreme/sql/WrappedStatement.java764
                Object[] params = { this.baseQuery, columnIndexes };
                redo = new CremeAction(getClass().getMethod("executeUpdate",
                        types));
                redo.setSubject(this);
                redo.setParameters(params);
            } catch (NoSuchMethodException ex) {
                ex.printStackTrace();
            } catch (IllegalArgumentException ex) {
                ex.printStackTrace();
            }
            manageException(e, redo);
            if ((redo != null) && (redo.isSuccessfull())) {
                return ((Integer) redo.getResult()).intValue();
            }
            throw generateException(e);
        }
    }

    /**
     * @see Statement#executeUpdate(java.lang.String, java.lang.String[])
     */
    public int executeUpdate(String sql, String[] columnNames)

FileLine
org/jcreme/swing/table/colormodel/ChangeHighlightingColorModel.java152
org/jcreme/swing/table/colormodel/ChangeHighlightingColorModel.java189
            result = this.underlyingModel.getForegroundColor(row, column,
                    selected, renderer);
        }
        synchronized (this.changeEvents) {
            Iterator iter = this.changeEvents.iterator();
            TableModelEvent evt = null;
            while (iter.hasNext()) {
                evt = (TableModelEvent) iter.next();
                if ((row >= evt.getFirstRow())
                        && (row <= evt.getLastRow())
                        && ((evt.getColumn() == TableModelEvent.ALL_COLUMNS) || (column == evt
                                .getColumn()))) {
                    result = this.foregroundHighlightColor;

FileLine
org/jcreme/sql/WrappedStatement.java851
org/jcreme/sql/WrappedStatement.java880
                Object[] params = { this.baseQuery, columnNames };
                redo = new CremeAction(getClass().getMethod("executeUpdate",
                        types));
                redo.setSubject(this);
                redo.setParameters(params);
            } catch (NoSuchMethodException ex) {
                ex.printStackTrace();
            } catch (IllegalArgumentException ex) {
                ex.printStackTrace();
            }
            manageException(e, redo);
            if ((redo != null) && (redo.isSuccessfull())) {
                return ((Boolean) redo.getResult()).booleanValue();
            }
            throw generateException(e);
        }
    }

    /**
     * @see Statement#getResultSetHoldability()
     */
    public int getResultSetHoldability() throws SQLException {

FileLine
org/jcreme/sql/WrappedStatement.java317
org/jcreme/sql/WrappedStatement.java734
                Object[] params = { this.baseQuery, columnNames };
                redo = new CremeAction(getClass().getMethod("executeUpdate",
                        types));
                redo.setSubject(this);
                redo.setParameters(params);
            } catch (NoSuchMethodException ex) {
                ex.printStackTrace();
            } catch (IllegalArgumentException ex) {
                ex.printStackTrace();
            }
            manageException(e, redo);
            if ((redo != null) && (redo.isSuccessfull())) {
                return ((Integer) redo.getResult()).intValue();
            }
            throw generateException(e);
        }
    }

    /**
     * @see Statement#execute(java.lang.String, int)
     */
    public boolean execute(String sql, int autoGeneratedKeys)