CPD Results

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

Duplications

FileLine
org/kuali/rice/kns/web/struts/form/LookupForm.java246
org/kuali/rice/kns/web/struts/form/LookupForm.java276
                for (Iterator iter = localLookupable.getRows().iterator(); iter.hasNext();) {
                    Row row = (Row) iter.next();

                    for (Iterator iterator = row.getFields().iterator(); iterator.hasNext();) {
                        Field field = (Field) iterator.next();

                        // check whether form already has value for field
                        if (formFields != null && formFields.containsKey(field.getPropertyName())) {
                            field.setPropertyValue(formFields.get(field.getPropertyName()));
                        }

                        // override values with request
                        if (getParameter(request, field.getPropertyName()) != null) {
                        	if(!Field.MULTI_VALUE_FIELD_TYPES.contains(field.getFieldType())) {
                        		field.setPropertyValue(getParameter(request, field.getPropertyName()).trim());
                        	} else {
                        		//multi value, set to values
                        		field.setPropertyValues(getParameterValues(request, field.getPropertyName()));
                        	}
                        }
FileLine
org/kuali/rice/kns/util/FieldUtils.java628
org/kuali/rice/kns/web/ui/SectionBridge.java696
         if ( field.getFieldType().equals(Field.KUALIUSER) ) {
             // this is supplemental, so catch and log any errors
             try {
                 if ( StringUtils.isNotBlank(field.getUniversalIdAttributeName()) ) {
                     Object principalId = ObjectUtils.getNestedValue(businessObject, field.getUniversalIdAttributeName());
                     if ( principalId != null ) {
                         field.setUniversalIdValue(principalId.toString());
                     }
                 }
                 if ( StringUtils.isNotBlank(field.getPersonNameAttributeName()) ) {
                     Object personName = ObjectUtils.getNestedValue(businessObject, field.getPersonNameAttributeName());
                     if ( personName != null ) {
                         field.setPersonNameValue( personName.toString() );
                     }
                 }
             } catch ( Exception ex ) {
                 LOG.warn( "Unable to get principal ID or person name property in SectionBridge.", ex );
FileLine
org/kuali/rice/kns/util/FieldUtils.java989
org/kuali/rice/kns/util/FieldUtils.java1009
                if (KRADConstants.MAINTENANCE_EDIT_ACTION.equals(maintenanceAction) || KRADConstants.MAINTENANCE_NEWWITHEXISTING_ACTION.equals(maintenanceAction)) {
                	// if there's existing data on the page that we're not going to clear out, then we will mask it out
                	if(fieldAuth.isPartiallyMasked()){
	                	field.setSecure(true);
	                	fieldAuth.setShouldBeEncrypted(true);
	                	MaskFormatter maskFormatter = fieldAuth.getMaskFormatter();
	                	String displayMaskValue = maskFormatter.maskValue(field.getPropertyValue());
	                	field.setDisplayMaskValue(displayMaskValue);
	                	populateSecureField(field, field.getPropertyValue());
                	}
	                else if(fieldAuth.isMasked()){
	                	field.setSecure(true);
	                	fieldAuth.setShouldBeEncrypted(true);
	                	MaskFormatter maskFormatter = fieldAuth.getMaskFormatter();
	                	String displayMaskValue = maskFormatter.maskValue(field.getPropertyValue());
	                	field.setDisplayMaskValue(displayMaskValue);
	                	populateSecureField(field, field.getPropertyValue());
	                }
                }
FileLine
org/kuali/rice/kns/maintenance/KualiMaintainableImpl.java1363
org/kuali/rice/kns/util/FieldUtils.java793
                        errorMap.putError(propertyNamePrefix + propertyName, e.getErrorKey(), e.getErrorArgs());
                    }
                }
            }
        }
        catch (IllegalAccessException e) {
            LOG.error("unable to populate business object" + e.getMessage());
            throw new RuntimeException(e.getMessage(), e);
        }
        catch (InvocationTargetException e) {
            LOG.error("unable to populate business object" + e.getMessage());
            throw new RuntimeException(e.getMessage(), e);
        }
        catch (NoSuchMethodException e) {
            LOG.error("unable to populate business object" + e.getMessage());
            throw new RuntimeException(e.getMessage(), e);
        }
FileLine
org/kuali/rice/kns/kim/role/PrincipalDerivedRoleTypeServiceImpl.java97
org/kuali/rice/kns/kim/role/RoleTypeServiceBase.java105
	}

	/**
	 * This simple initial implementation just calls  
	 * {@link #getRoleMembersFromApplicationRole(String, String, Map<String, String>)} and checks the results.
	 *
	 */
    @Override
	public boolean hasApplicationRole(String principalId, List<String> groupIds, String namespaceCode, String roleName, Map<String, String> qualification) {
	    if (StringUtils.isBlank(principalId)) {
            throw new RiceIllegalArgumentException("principalId was null or blank");
        }

        if (groupIds == null) {
            throw new RiceIllegalArgumentException("groupIds was null or blank");
        }

        if (StringUtils.isBlank(namespaceCode)) {
            throw new RiceIllegalArgumentException("namespaceCode was null or blank");
        }

        if (StringUtils.isBlank(roleName)) {
            throw new RiceIllegalArgumentException("roleName was null or blank");
        }

        if (qualification == null) {
            throw new RiceIllegalArgumentException("qualification was null or blank");
FileLine
org/kuali/rice/kns/web/struts/action/KualiDocumentActionBase.java1231
org/kuali/rice/kns/web/struts/action/KualiInquiryAction.java411
        request.setAttribute(KRADConstants.INQUIRABLE_ATTRIBUTE_NAME, kualiInquirable);
    }
    
    /**
    *
    * Handy method to stream the byte array to response object
    * @param attachmentDataSource
    * @param response
    * @throws Exception
    */
   protected void streamToResponse(byte[] fileContents, String fileName, String fileContentType,HttpServletResponse response) throws Exception{
       ByteArrayOutputStream baos = null;
       try{
           baos = new ByteArrayOutputStream(fileContents.length);
           baos.write(fileContents);
           WebUtils.saveMimeOutputStreamAsFile(response, fileContentType, baos, fileName);
       }finally{
           try{
               if(baos!=null){
                   baos.close();
                   baos = null;
               }
           }catch(IOException ioEx){
               LOG.error("Error while downloading attachment");
               throw new RuntimeException("IOException occurred while downloading attachment", ioEx);
           }
       }
   }