CPD Results

The following document contains the results of PMD's CPD 4.3.

Duplications

FileLine
org\dbunit\ext\oracle\OracleSdoElemInfoArray.java75
org\dbunit\ext\oracle\OracleSdoOrdinateArray.java75
    OracleSdoElemInfoArray a = new OracleSdoElemInfoArray();
    a._array = new MutableArray(2, (ARRAY) d, null);
    return a;
  }

  public int length() throws SQLException
  {
    return _array.length();
  }

  public int getBaseType() throws SQLException
  {
    return _array.getBaseType();
  }

  public String getBaseTypeName() throws SQLException
  {
    return _array.getBaseTypeName();
  }

  public ArrayDescriptor getDescriptor() throws SQLException
  {
    return _array.getDescriptor();
  }

  /* array accessor methods */
  public java.math.BigDecimal[] getArray() throws SQLException
  {
    return (java.math.BigDecimal[]) _array.getObjectArray();
  }

  public java.math.BigDecimal[] getArray(long index, int count) throws SQLException
  {
    return (java.math.BigDecimal[]) _array.getObjectArray(index, count);
  }

  public void setArray(java.math.BigDecimal[] a) throws SQLException
  {
    _array.setObjectArray(a);
  }

  public void setArray(java.math.BigDecimal[] a, long index) throws SQLException
  {
    _array.setObjectArray(a, index);
  }

  public java.math.BigDecimal getElement(long index) throws SQLException
  {
    return (java.math.BigDecimal) _array.getObjectElement(index);
  }

  public void setElement(java.math.BigDecimal a, long index) throws SQLException
  {
    _array.setObjectElement(a, index);
  }

  public String toString()
  { try { String r = "MDSYS.SDO_ELEM_INFO_ARRAY" + "(";
FileLine
org\dbunit\dataset\csv\CsvParserImpl.java71
org\dbunit\dataset\sqlloader\SqlLoaderControlParserImpl.java96
        pipeline = new Pipeline();
        getPipeline().putFront(SeparatorHandler.ENDPIECE());
        getPipeline().putFront(EscapeHandler.ACCEPT());
        getPipeline().putFront(IsAlnumHandler.QUOTE());
        getPipeline().putFront(QuoteHandler.QUOTE());
        getPipeline().putFront(EscapeHandler.ESCAPE());
        getPipeline().putFront(WhitespacesHandler.IGNORE());
        getPipeline().putFront(TransparentHandler.IGNORE());
    }

    public List parse(String csv) throws PipelineException, IllegalInputCharacterException {
        logger.debug("parse(csv={}) - start", csv);

        getPipeline().resetProducts();
        CharacterIterator iterator = new StringCharacterIterator(csv);
        for (char c = iterator.first(); c != CharacterIterator.DONE; c = iterator.next()) {
            getPipeline().handle(c);
        }
        getPipeline().noMoreInput();
        getPipeline().thePieceIsDone();
        return getPipeline().getProducts();
    }

    public List parse(File file) throws IOException, CsvParserException {
FileLine
org\dbunit\ext\mysql\MySqlMetadataHandler.java99
org\dbunit\ext\netezza\NetezzaMetadataHandler.java102
            logger.debug("Using catalogName '" + catalogName + "' as schema since the schema is null but the catalog is set (probably in a MySQL environment).");
            schemaName = catalogName;
        }
        return schemaName;
    }

    public boolean tableExists(DatabaseMetaData metaData, String schema, String tableName) 
    throws SQLException 
    {
        ResultSet tableRs = metaData.getTables(schema, null, tableName, null);
        try 
        {
            return tableRs.next();
        }
        finally
        {
            SQLHelper.close(tableRs);
        }
    }

    public ResultSet getTables(DatabaseMetaData metaData, String schemaName, String[] tableType) 
    throws SQLException
    {
        if(logger.isTraceEnabled())
            logger.trace("tableExists(metaData={}, schemaName={}, tableType={}) - start", 
                    new Object[] {metaData, schemaName, tableType} );

        return metaData.getTables(schemaName, null, "%", tableType);
    }

    public ResultSet getPrimaryKeys(DatabaseMetaData metaData, String schemaName, String tableName) 
    throws SQLException
    {
        if(logger.isTraceEnabled())
            logger.trace("getPrimaryKeys(metaData={}, schemaName={}, tableName={}) - start", 
                    new Object[] {metaData, schemaName, tableName} );

        ResultSet resultSet = metaData.getPrimaryKeys(
                schemaName, null, tableName);
        return resultSet;
    }

}
FileLine
org\dbunit\database\DefaultMetadataHandler.java61
org\dbunit\ext\db2\Db2MetadataHandler.java46
        return matches(resultSet, null, schema, table, null, caseSensitive);
    }

    public boolean matches(ResultSet columnsResultSet, String catalog,
            String schema, String table, String column,
            boolean caseSensitive) throws SQLException 
    {
        if(logger.isTraceEnabled())
            logger.trace("matches(columnsResultSet={}, catalog={}, schema={}," +
            		" table={}, column={}, caseSensitive={}) - start", 
                    new Object[] {columnsResultSet, catalog, schema, 
                            table, column, Boolean.valueOf(caseSensitive)});
        
        String catalogName = columnsResultSet.getString(1);
        String schemaName = columnsResultSet.getString(2);
        String tableName = columnsResultSet.getString(3);
        String columnName = columnsResultSet.getString(4);

        if(logger.isDebugEnabled()){
            logger.debug("Comparing the following values using caseSensitive={} (searched<=>actual): " +
                    "catalog: {}<=>{} schema: {}<=>{} table: {}<=>{} column: {}<=>{}", 
                    new Object[] {
                        Boolean.valueOf(caseSensitive),
                        catalog, catalogName,
                        schema, schemaName,
                        table, tableName,
                        column, columnName
                    });
        }
        
        boolean areEqual = 
FileLine
org\dbunit\database\search\ImportedAndExportedKeysSearchCallbackFilteredByPKs.java67
org\dbunit\database\search\ImportedKeysSearchCallbackFilteredByPKs.java60
		this.pksFilter = new PrimaryKeyFilter(connection, allowedPKs, true);
	}

	/**
	 * Get the primary key filter associated with the call back
	 * 
	 * @return primary key filter associated with the call back
	 */
	public ITableFilter getFilter()
	{
		return this.pksFilter;
	}

	public void nodeAdded(Object node) throws SearchException
	{
		logger.debug("nodeAdded(node={}) - start", node);
		this.pksFilter.nodeAdded(node);
	}

	protected IEdge newEdge(ResultSet rs, int type, String from, String to, String fkColumn, String pkColumn) throws SearchException
	{
		if (logger.isDebugEnabled())
		{
			logger.debug("newEdge(rs={}, type={}, from={}, to={}, fkColumn={}, pkColumn={}) - start",
				new Object[] { rs, String.valueOf(type), from, to, fkColumn, pkColumn });
		}

		ForeignKeyRelationshipEdge edge = createFKEdge(rs, type, from, to, fkColumn, pkColumn);
		this.pksFilter.edgeAdded(edge);
		return edge;
	}

}
FileLine
org\dbunit\ext\mysql\MySqlMetadataHandler.java48
org\dbunit\ext\netezza\NetezzaMetadataHandler.java53
    public ResultSet getColumns(DatabaseMetaData databaseMetaData, String schemaName, String tableName) 
    throws SQLException {
        // Note that MySQL uses the catalogName instead of the schemaName, so
        // pass in the given schema name as catalog name (first argument).
        ResultSet resultSet = databaseMetaData.getColumns(
                schemaName, null, tableName, "%");
        return resultSet;
    }
    
    public boolean matches(ResultSet resultSet,
            String schema, String table, boolean caseSensitive) 
    throws SQLException 
    {
        return matches(resultSet, null, schema, table, null, caseSensitive);
    }

    public boolean matches(ResultSet columnsResultSet, String catalog,
            String schema, String table, String column,
            boolean caseSensitive) throws SQLException 
    {
        String catalogName = columnsResultSet.getString(1);
        String schemaName = columnsResultSet.getString(2);
        String tableName = columnsResultSet.getString(3);
        String columnName = columnsResultSet.getString(4);
FileLine
org\dbunit\ext\oracle\OracleSdoElemInfoArray.java132
org\dbunit\ext\oracle\OracleSdoOrdinateArray.java132
  { try { String r = "MDSYS.SDO_ELEM_INFO_ARRAY" + "(";
     java.math.BigDecimal[] a = (java.math.BigDecimal[])getArray();
     for (int i=0; i<a.length; ) {
       r = r + a[i];
       i++; if (i<a.length) r = r + ","; }
     r = r + ")"; return r;
    } catch (SQLException e) { return e.toString(); }
  }

    public boolean equals(Object obj)
    {
        if (this == obj)
        {
            return true;
        }

        if ((obj == null) || (! obj.getClass().equals(this.getClass())))
        {
            return false;
        }
FileLine
org\dbunit\dataset\ReplacementDataSet.java86
org\dbunit\dataset\ReplacementTable.java84
        this._strictReplacement = strictReplacement;
    }
    
    /**
     * Add a new Object replacement mapping.
     *
     * @param originalObject the object to replace
     * @param replacementObject the replacement object
     */
    public void addReplacementObject(Object originalObject, Object replacementObject)
    {
        logger.debug("addReplacementObject(originalObject={}, replacementObject={}) - start", originalObject, replacementObject);

        _objectMap.put(originalObject, replacementObject);
    }

    /**
     * Add a new substring replacement mapping.
     *
     * @param originalSubstring the substring to replace
     * @param replacementSubstring the replacement substring
     */
    public void addReplacementSubstring(String originalSubstring,
            String replacementSubstring)
    {
        logger.debug("addReplacementSubstring(originalSubstring={}, replacementSubstring={}) - start", originalSubstring, replacementSubstring);

        if (originalSubstring == null || replacementSubstring == null)
        {
            throw new NullPointerException();
        }

        _substringMap.put(originalSubstring, replacementSubstring);
    }

    /**
     * Sets substring delimiters.
     */
    public void setSubstringDelimiters(String startDelimiter, String endDelimiter)
    {
        logger.debug("setSubstringDelimiters(startDelimiter={}, endDelimiter={}) - start", startDelimiter, endDelimiter);

        if (startDelimiter == null || endDelimiter == null)
        {
            throw new NullPointerException();
        }

        _startDelim = startDelimiter;
        _endDelim = endDelimiter;
    }

    private ReplacementTable createReplacementTable(ITable table)
FileLine
org\dbunit\ext\mysql\MySqlMetadataHandler.java78
org\dbunit\ext\netezza\NetezzaMetadataHandler.java83
        }
        
        boolean areEqual = 
            areEqualIgnoreNull(catalog, catalogName, caseSensitive) &&
            areEqualIgnoreNull(schema, schemaName, caseSensitive) &&
            areEqualIgnoreNull(table, tableName, caseSensitive) &&
            areEqualIgnoreNull(column, columnName, caseSensitive);
        return areEqual;
    }

    private boolean areEqualIgnoreNull(String value1, String value2,
            boolean caseSensitive) {
        return SQLHelper.areEqualIgnoreNull(value1, value2, caseSensitive);
    }

    public String getSchema(ResultSet resultSet) throws SQLException {
        String catalogName = resultSet.getString(1);
        String schemaName = resultSet.getString(2);
        
        // Fix schema/catalog for mysql. Normally the schema is not set but only the catalog is set
        if(schemaName == null && catalogName != null) {
            logger.debug("Using catalogName '" + catalogName + "' as schema since the schema is null but the catalog is set (probably in a MySQL environment).");
FileLine
org\dbunit\ext\postgresql\GenericEnumType.java102
org\dbunit\ext\postgresql\InetType.java83
org\dbunit\ext\postgresql\UuidType.java85
            setValueMethod.invoke(tempEnum, new Object[]{value.toString()});

        } catch (ClassNotFoundException e) {
            throw new TypeCastException(value, this, e);
        } catch (InvocationTargetException e) {
            throw new TypeCastException(value, this, e);
        } catch (NoSuchMethodException e) {
            throw new TypeCastException(value, this, e);
        } catch (IllegalAccessException e) {
            throw new TypeCastException(value, this, e);
        } catch (InstantiationException e) {
            throw new TypeCastException(value, this, e);
        }

        return tempEnum;