CPD Results

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

Duplications

File Line
org/deegree/services/wps/capabilities/CapabilitiesXMLWriter.java 145
org/deegree/services/wps/describeprocess/DescribeProcessResponseXMLAdapter.java 139
            writer.writeAttribute( WPS_NS, "processVersion", processDef.getProcessVersion() );

            // "ows:Identifier" (minOccurs="1", maxOccurs="1")
            writer.writeStartElement( OWS_NS, "Identifier" );
            if ( processDef.getIdentifier().getCodeSpace() != null ) {
                writer.writeAttribute( "codeSpace", processDef.getIdentifier().getCodeSpace() );
            }
            writer.writeCharacters( processDef.getIdentifier().getValue() );
            writer.writeEndElement();

            // "ows:Title" (minOccurs="1", maxOccurs="1")
            if ( processDef.getTitle() != null ) {
                writer.writeStartElement( OWS_NS, "Title" );
                if ( processDef.getTitle().getLang() != null ) {
                    writer.writeAttribute( "xml:lang", processDef.getTitle().getLang() );
                }
                writer.writeCharacters( processDef.getTitle().getValue() );
                writer.writeEndElement();
            }

            // "ows:Abstract" (minOccurs="0", maxOccurs="1")
            if ( processDef.getAbstract() != null ) {
                writer.writeStartElement( OWS_NS, "Abstract" );
                if ( processDef.getAbstract().getLang() != null ) {
                    writer.writeAttribute( "xml:lang", processDef.getAbstract().getLang() );
                }
                writer.writeCharacters( processDef.getAbstract().getValue() );
                writer.writeEndElement();
            }

            // "ows:Metadata" (minOccurs="0", maxOccurs="unbounded")
            if ( processDef.getMetadata() != null ) {
                for ( Metadata metadata : processDef.getMetadata() ) {
                    writer.writeStartElement( OWS_NS, "Metadata" );
                    if ( metadata.getAbout() != null ) {
                        writer.writeAttribute( "about", metadata.getAbout() );
                    }
                    if ( metadata.getHref() != null ) {
                        writer.writeAttribute( XLN_NS, "href", metadata.getHref() );
                    }
                    writer.writeEndElement();
                }
            }

            // "wps:Profile" (minOccurs="0", maxOccurs="unbounded")
            if ( processDef.getProfile() != null ) {
                for ( String profile : processDef.getProfile() ) {
                    writeElement( writer, WPS_NS, "Profile", profile );
                }
            }

            // "wps:WSDL" (minOccurs="0", maxOccurs="unbounded")
            if ( processDef.getWSDL() != null ) {
File Line
org/deegree/services/wps/execute/ExecuteRequestKVPAdapter.java 318
org/deegree/services/wps/execute/ExecuteRequestKVPAdapter.java 397
            throw exceptionCustomizer.inputInvalidCombination( identifier, combi );
        }

        List<ComplexFormatType> matchingFormats = new LinkedList<ComplexFormatType>();
        for ( ComplexFormatType candidateFormat : equalMimeTypeAndSchema ) {
            if ( format.getEncoding() == null || format.getEncoding().equals( candidateFormat.getEncoding() ) ) {
                matchingFormats.add( candidateFormat );
            }
        }

        // no formats with specified mime type, schema and encoding found?
        if ( matchingFormats.isEmpty() ) {
            CodeType identifier = new CodeType( definition.getIdentifier().getValue(),
                                                definition.getIdentifier().getCodeSpace() );
            List<Pair<String, String>> combi = new ArrayList<Pair<String, String>>();
            combi.add( new Pair<String, String>( "mimetype", format.getMimeType() ) );
            combi.add( new Pair<String, String>( "schema", format.getSchema() ) );
            combi.add( new Pair<String, String>( "encoding", format.getEncoding() ) );
            throw exceptionCustomizer.inputInvalidCombination( identifier, combi );
File Line
org/deegree/services/wps/execute/ExecuteRequestKVPAdapter.java 299
org/deegree/services/wps/execute/ExecuteRequestKVPAdapter.java 378
            throw exceptionCustomizer.inputInvalidParameter(
                                                             identifier,
                                                             new Pair<String, String>( "mimetype", format.getMimeType() ) );
        }

        List<ComplexFormatType> equalMimeTypeAndSchema = new LinkedList<ComplexFormatType>();
        for ( ComplexFormatType candidateFormat : equalMimeType ) {
            if ( format.getSchema() == null || format.getSchema().equals( candidateFormat.getSchema() ) ) {
                equalMimeTypeAndSchema.add( candidateFormat );
            }
        }

        // no matching formats (mime type and schema) found?
        if ( equalMimeTypeAndSchema.isEmpty() ) {
            CodeType identifier = new CodeType( definition.getIdentifier().getValue(),
                                                definition.getIdentifier().getCodeSpace() );
            List<Pair<String, String>> combi = new ArrayList<Pair<String, String>>();
            combi.add( new Pair<String, String>( "mimetype", format.getMimeType() ) );
            combi.add( new Pair<String, String>( "schema", format.getSchema() ) );
            throw exceptionCustomizer.inputInvalidCombination( identifier, combi );
File Line
org/deegree/services/wps/execute/ExecuteRequestKVPAdapter.java 274
org/deegree/services/wps/execute/ExecuteRequestKVPAdapter.java 353
                                                               ComplexInputDefinition definition,
                                                               ExceptionCustomizer exceptionCustomizer )
                            throws OWSException {

        LOG.debug( "Looking up compatible format ('" + toString( format ) + "') in parameter definition." );
        List<ComplexFormatType> equalMimeType = null;
        if ( format.getMimeType() == null ) {
            // not specified -> assume mime type from default format
            equalMimeType = Collections.singletonList( definition.getDefaultFormat() );
        } else {
            equalMimeType = new LinkedList<ComplexFormatType>();
            if ( format.getMimeType().equals( definition.getDefaultFormat().getMimeType() ) ) {
                equalMimeType.add( definition.getDefaultFormat() );
            }
            for ( ComplexFormatType otherFormat : definition.getOtherFormats() ) {
                if ( format.getMimeType().equals( otherFormat.getMimeType() ) ) {
                    equalMimeType.add( format );
                }
            }
        }

        // no matching formats (mime type) found?
        if ( equalMimeType.isEmpty() ) {
            CodeType identifier = new CodeType( definition.getIdentifier().getValue(),
                                                definition.getIdentifier().getCodeSpace() );
            throw exceptionCustomizer.inputInvalidParameter(
File Line
org/deegree/services/wps/execute/ExecuteRequestKVPAdapter.java 191
org/deegree/services/wps/execute/ExecuteRequestXMLAdapter.java 219
            processInputs.add( input );

            CodeType inputId = input.getIdentifier();
            Integer count = inputIdToCount.get( inputId );
            if ( count == null ) {
                count = 1;
            } else {
                count++;
            }
            inputIdToCount.put( inputId, count );
        }

        // validate cardinalities of present input parameters
        for ( JAXBElement<? extends ProcessletInputDefinition> el : processDef.getInputParameters().getProcessInput() ) {
            ProcessletInputDefinition inputDef = el.getValue();
            CodeType inputId = new CodeType( inputDef.getIdentifier().getValue(),
                                             inputDef.getIdentifier().getCodeSpace() );
            int minOccurs = inputDef.getMinOccurs() != null ? inputDef.getMinOccurs().intValue() : 1;
            int maxOccurs = inputDef.getMaxOccurs() != null ? inputDef.getMaxOccurs().intValue() : 1;
            int actualOccurs = inputIdToCount.get( inputId ) != null ? inputIdToCount.get( inputId ) : 0;
            if ( actualOccurs < minOccurs ) {
File Line
org/deegree/services/wps/execute/ExecuteRequestXMLAdapter.java 649
org/deegree/services/wps/execute/ExecuteRequestXMLAdapter.java 718
            throw eCustomizer.inputInvalidCombination( getIdentifier( definition ), combi );
        }

        List<ComplexFormatType> matchingFormats = new LinkedList<ComplexFormatType>();
        for ( ComplexFormatType candidateFormat : equalMimeTypeAndSchema ) {
            if ( format.getEncoding() == null || format.getEncoding().equals( candidateFormat.getEncoding() ) ) {
                matchingFormats.add( candidateFormat );
            }
        }

        // no formats with specified mime type, schema and encoding found?
        if ( matchingFormats.isEmpty() ) {
            List<Pair<String, String>> combi = new ArrayList<Pair<String, String>>();
            combi.add( new Pair<String, String>( "mimetype", format.getMimeType() ) );
            combi.add( new Pair<String, String>( "schema", format.getSchema() ) );
            combi.add( new Pair<String, String>( "encoding", format.getEncoding() ) );
            throw eCustomizer.inputInvalidCombination( getIdentifier( definition ), combi );
File Line
org/deegree/services/wps/execute/ExecuteRequestXMLAdapter.java 633
org/deegree/services/wps/execute/ExecuteRequestXMLAdapter.java 702
            throw eCustomizer.inputInvalidParameter( getIdentifier( definition ),
                                                     new Pair<String, String>( "mimetype", format.getMimeType() ) );
        }

        List<ComplexFormatType> equalMimeTypeAndSchema = new LinkedList<ComplexFormatType>();
        for ( ComplexFormatType candidateFormat : equalMimeType ) {
            if ( format.getSchema() == null || format.getSchema().equals( candidateFormat.getSchema() ) ) {
                equalMimeTypeAndSchema.add( candidateFormat );
            }
        }

        // no matching formats (mime type and schema) found?
        if ( equalMimeTypeAndSchema.isEmpty() ) {
            List<Pair<String, String>> combi = new ArrayList<Pair<String, String>>();
            combi.add( new Pair<String, String>( "mimetype", format.getMimeType() ) );
            combi.add( new Pair<String, String>( "schema", format.getSchema() ) );
            throw eCustomizer.inputInvalidCombination( getIdentifier( definition ), combi );
File Line
org/deegree/services/wps/execute/ExecuteRequestXMLAdapter.java 610
org/deegree/services/wps/execute/ExecuteRequestXMLAdapter.java 679
    private ComplexFormatType validateAndAugmentFormat( ComplexFormatType format, ComplexInputDefinition definition,
                                                        ExceptionCustomizer eCustomizer )
                            throws OWSException {

        LOG.debug( "Looking up compatible format ('" + toString( format ) + "') in parameter definition." );
        List<ComplexFormatType> equalMimeType = null;
        if ( format.getMimeType() == null ) {
            // not specified -> assume mime type from default format
            equalMimeType = Collections.singletonList( definition.getDefaultFormat() );
        } else {
            equalMimeType = new LinkedList<ComplexFormatType>();
            if ( format.getMimeType().equals( definition.getDefaultFormat().getMimeType() ) ) {
                equalMimeType.add( definition.getDefaultFormat() );
            }
            for ( ComplexFormatType otherFormat : definition.getOtherFormats() ) {
                if ( format.getMimeType().equals( otherFormat.getMimeType() ) ) {
                    equalMimeType.add( format );
                }
            }
        }

        // no matching formats (mime type) found?
        if ( equalMimeType.isEmpty() ) {
            throw eCustomizer.inputInvalidParameter( getIdentifier( definition ),
File Line
org/deegree/services/wps/execute/ExecuteRequestKVPAdapter.java 275
org/deegree/services/wps/execute/ExecuteRequestKVPAdapter.java 354
org/deegree/services/wps/execute/ExecuteRequestXMLAdapter.java 611
org/deegree/services/wps/execute/ExecuteRequestXMLAdapter.java 680
                                                               ExceptionCustomizer exceptionCustomizer )
                            throws OWSException {

        LOG.debug( "Looking up compatible format ('" + toString( format ) + "') in parameter definition." );
        List<ComplexFormatType> equalMimeType = null;
        if ( format.getMimeType() == null ) {
            // not specified -> assume mime type from default format
            equalMimeType = Collections.singletonList( definition.getDefaultFormat() );
        } else {
            equalMimeType = new LinkedList<ComplexFormatType>();
            if ( format.getMimeType().equals( definition.getDefaultFormat().getMimeType() ) ) {
                equalMimeType.add( definition.getDefaultFormat() );
            }
            for ( ComplexFormatType otherFormat : definition.getOtherFormats() ) {
                if ( format.getMimeType().equals( otherFormat.getMimeType() ) ) {
                    equalMimeType.add( format );
                }
            }
        }

        // no matching formats (mime type) found?
        if ( equalMimeType.isEmpty() ) {
File Line
org/deegree/services/wps/describeprocess/DescribeProcessResponseXMLAdapter.java 292
org/deegree/services/wps/describeprocess/DescribeProcessResponseXMLAdapter.java 499
                org.deegree.process.jaxb.java.LiteralInputDefinition.DefaultUOM defaultUOM = literalData.getDefaultUOM();
                writer.writeStartElement( "UOMs" );

                // "Default" (minOccurs="1", maxOccurs="1")
                writer.writeStartElement( "Default" );
                // "ows:UOM" (minOccurs="1", maxOccurs="1")
                writer.writeStartElement( OWS_NS, "UOM" );
                if ( defaultUOM.getReference() != null ) {
                    writer.writeAttribute( OWS_NS, "reference", defaultUOM.getReference() );
                }
                writer.writeCharacters( defaultUOM.getValue() );
                writer.writeEndElement();
                writer.writeEndElement(); // Default

                // "Supported" (minOccurs="1", maxOccurs="1")
                writer.writeStartElement( "Supported" );
                // "ows:UOM" (minOccurs="1", maxOccurs="unbounded")
                writer.writeStartElement( OWS_NS, "UOM" );
                if ( defaultUOM.getReference() != null ) {
                    writer.writeAttribute( OWS_NS, "reference", defaultUOM.getReference() );
                }
                writer.writeCharacters( defaultUOM.getValue() );
                writer.writeEndElement(); // UOM