CPD Results

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

Duplications

File Line
org\dbunit\ext\oracle\OracleSdoElemInfoArray.java 75
org\dbunit\ext\oracle\OracleSdoOrdinateArray.java 75
    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" + "(";
File Line
org\dbunit\dataset\csv\CsvParserImpl.java 71
org\dbunit\dataset\sqlloader\SqlLoaderControlParserImpl.java 96
        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 {
File Line
org\dbunit\ext\mysql\MySqlMetadataHandler.java 99
org\dbunit\ext\netezza\NetezzaMetadataHandler.java 102
            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;
    }

}
File Line
org\dbunit\database\DefaultMetadataHandler.java 61
org\dbunit\ext\db2\Db2MetadataHandler.java 46
        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 = 
File Line
org\dbunit\database\search\ImportedAndExportedKeysSearchCallbackFilteredByPKs.java 67
org\dbunit\database\search\ImportedKeysSearchCallbackFilteredByPKs.java 60
		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;
	}

}
File Line
org\dbunit\ext\mysql\MySqlMetadataHandler.java 48
org\dbunit\ext\netezza\NetezzaMetadataHandler.java 53
    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);
File Line
org\dbunit\ext\oracle\OracleSdoElemInfoArray.java 132
org\dbunit\ext\oracle\OracleSdoOrdinateArray.java 132
  { 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;
        }
File Line
org\dbunit\dataset\ReplacementDataSet.java 85
org\dbunit\dataset\ReplacementTable.java 84
        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)
File Line
org\dbunit\database\statement\PreparedBatchStatement.java 53
org\dbunit\database\statement\SimplePreparedStatement.java 55
        _index = 0;
    }

    ////////////////////////////////////////////////////////////////////////////
    // IPreparedBatchStatement interface

    public void addValue(Object value, DataType dataType)
            throws TypeCastException, SQLException
    {
        logger.debug("addValue(value={}, dataType={}) - start", value, dataType);

        // Special NULL handling
        if (value == null || value == ITable.NO_VALUE)
        {
            String sqlTypeName = dataType.getSqlTypeName();
            if (sqlTypeName == null) {
                _statement.setNull(++_index, dataType.getSqlType());
            } else {
                _statement.setNull(++_index, dataType.getSqlType(), sqlTypeName);
            }
            return;
        }

        dataType.setSqlValue(value, ++_index, _statement);
    }

    public void addBatch() throws SQLException
    {
        logger.debug("addBatch() - start");
File Line
org\dbunit\ext\mysql\MySqlMetadataHandler.java 78
org\dbunit\ext\netezza\NetezzaMetadataHandler.java 83
        }
        
        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).");
File Line
org\dbunit\ext\postgresql\CitextType.java 85
org\dbunit\ext\postgresql\GenericEnumType.java 102
org\dbunit\ext\postgresql\InetType.java 83
org\dbunit\ext\postgresql\UuidType.java 85
            setValueMethod.invoke(tempCitext, 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 tempCitext;
File Line
org\dbunit\ext\postgresql\GeometryType.java 44
org\dbunit\ext\postgresql\IntervalType.java 79
            tempgeom = ct.newInstance(new Object[] { value });
        } 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 tempgeom;