CPD Results

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

Duplications

File Project Line
net/sf/jguard/jee/extras/dwr1/DWR1Permission.java TRUNK jGuard jee extras 106
net/sf/jguard/jee/extras/dwr2/DWR2Permission.java TRUNK jGuard jee extras 105
			DWR2Permission dwrPerm = (DWR2Permission) p;
			if(!creatorClassName.equals(dwrPerm.getCreatorClassName())||!className.equals(dwrPerm.getClassName())||!methodName.equals(dwrPerm.getMethodName())){
				return false;
			}else{
				//case where creatorClassName, AND className AND methodName aer equals.
				return true;
			}
		 }
		
	 }

	public String getClassName() {
		return className;
	}

	public String getMethodName() {
		return methodName;
	}

	public String getCreatorClassName() {
		return creatorClassName;
	}

	public String toString(){
		StringBuffer buffer = new StringBuffer();
		buffer.append("name=");
		buffer.append(name);
		buffer.append(",");
		buffer.append("creatorClassName=");
		buffer.append(creatorClassName);
		buffer.append(",");
		buffer.append("className=");
		buffer.append(className);
		buffer.append(",");
		buffer.append("methodName=");
		buffer.append(methodName);
		return buffer.toString();
		
	}
	
	/**
	 * return an enmpy JGPermissionCollection.
	 *
	 * @return empty JGPermissionCollection
	 */
	public java.security.PermissionCollection newPermissionCollection() {
		return new JGPositivePermissionCollection();
	}

	public String getActions() {
		return actions;
	}

}

File Project Line
net/sf/jguard/jee/extras/dwr1/DWR1Permission.java TRUNK jGuard jee extras 63
net/sf/jguard/jee/extras/dwr2/DWR2Permission.java TRUNK jGuard jee extras 63
	public DWR2Permission(String name, String actions) {
		super(name);
		this.name = name;
		this.actions = actions;
		if(name==null){
			throw new IllegalArgumentException(" 'name' must not be null ");
		}
		String[] actionsArray = (String[])actions.split(",");
		if(actionsArray.length!=3){
			throw new IllegalArgumentException(" DWR1Permission must have 3 actions : creatorClassName,className and methodName ");
		}
		creatorClassName = actionsArray[0];
		className = actionsArray[1];
		methodName = actionsArray[2];
		if(creatorClassName==null ||className==null || methodName==null){
			throw new IllegalArgumentException(" one or more of these arguments are 'null' : \n name="+name+ "creatorClassName ="+creatorClassName+" className= "+className);
		}
	}
	
	public int hashCode(){
		return name.hashCode()+creatorClassName.hashCode()+className.hashCode()+methodName.hashCode();
	}
	
	public boolean equals(Object object){
		if (object instanceof DWR2Permission == false) {

File Project Line
net/sf/jguard/ext/authorization/manager/JdbcAuthorizationManager.java TRUNK jGuard ext 1141
net/sf/jguard/ext/authorization/manager/JdbcAuthorizationManager.java TRUNK jGuard ext 1191
        PreparedStatement pst;
        Connection conn = null;
        try {
        	conn = connectionFactory.getConnection();
            //get principalAsc id
            pst = conn.prepareStatement(props.getProperty(READ_PRINCIPAL_ID));
            pst.setString(1, principalAscName);
            ResultSet rs = pst.executeQuery();
            rs.next();
            int principalAscId = rs.getInt(1);
            rs.close();

            //get principalDesc id
            pst.setString(1, principalDescName);
            rs = pst.executeQuery();
            rs.next();
            int principalDescId = rs.getInt(1);
            rs.close();
            pst.close();

            //delete the principal inheritance
            pst = conn.prepareStatement(props.getProperty(DELETE_PRINCIPAL_INHERITANCE));