CPD Results

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

Duplications

FileLine
org/deegree/services/wfs/format/gml/request/GmlGetPropertyValueHandler.java206
org/deegree/services/wfs/format/gml/request/GmlGetPropertyValueHandler.java246
        xmlStream.writeComment( "NOTE: numberReturned/numberMatched attributes should be 'unknown', but this would not validate against the current version of the WFS 2.0 schema (change upcoming). See change request (CR 144): https://portal.opengeospatial.org/files?artifact_id=43925." );

        int numberReturned = 0;
        int valuesSkipped = 0;
        for ( Map.Entry<FeatureStore, List<Query>> fsToQueries : analyzer.getQueries().entrySet() ) {
            FeatureStore fs = fsToQueries.getKey();
            Query[] queries = fsToQueries.getValue().toArray( new Query[fsToQueries.getValue().size()] );
            FeatureInputStream rs = fs.query( queries );
            try {
                for ( Feature member : rs ) {
                    if ( numberReturned == maxResults ) {
                        break;
                    }
                    TypedObjectNode[] values = evaluator.eval( member, request.getValueReference() );
                    for ( TypedObjectNode value : values ) {
                        if ( valuesSkipped < startIndex ) {
                            valuesSkipped++;
                        } else {
FileLine
org/deegree/services/wfs/format/gml/request/GmlGetFeatureHandler.java247
org/deegree/services/wfs/format/gml/request/GmlGetPropertyValueHandler.java137
        GMLStreamWriter gmlStream = createGMLStreamWriter( gmlVersion, xmlStream );
        gmlStream.setProjections( analyzer.getProjections() );
        gmlStream.setOutputCrs( analyzer.getRequestedCRS() );
        gmlStream.setCoordinateFormatter( options.getFormatter() );
        gmlStream.setGenerateBoundedByForFeatures( options.isGenerateBoundedByForFeatures() );
        Map<String, String> prefixToNs = new HashMap<String, String>(
                                                                      format.getMaster().getStoreManager().getPrefixToNs() );
        prefixToNs.putAll( getFeatureTypeNsPrefixes( analyzer.getFeatureTypes() ) );
        gmlStream.setNamespaceBindings( prefixToNs );
        GmlXlinkOptions resolveOptions = new GmlXlinkOptions( request.getResolveParams() );
FileLine
org/deegree/services/wfs/query/StoredQueryHandler.java236
org/deegree/services/wfs/query/StoredQueryHandler.java327
                writer.writeStartElement( WFS_200_NS, "QueryExpressionText" );

                // <xsd:attribute name="returnFeatureTypes" type="wfs:ReturnFeatureTypesListType" use="required"/>
                List<QName> ftNames = new ArrayList<QName>( wfs.getStoreManager().getFeatureTypes().size() );
                for ( FeatureType ft : wfs.getStoreManager().getFeatureTypes() ) {
                    ftNames.add( ft.getName() );
                }
                Collections.sort( ftNames, new Comparator<QName>() {
                    @Override
                    public int compare( QName arg0, QName arg1 ) {
                        String s0 = arg0.toString();
                        String s1 = arg1.toString();
                        return s0.compareTo( s1 );
                    }
                } );
FileLine
org/deegree/services/wfs/GetCapabilitiesHandler.java659
org/deegree/services/wfs/GetCapabilitiesHandler.java965
                writer.writeStartElement( OWS_NS, "WGS84BoundingBox" );
                Point min = env.getMin();
                Point max = env.getMax();
                double minX = -180.0;
                double minY = -90.0;
                double maxX = 180.0;
                double maxY = 90.0;
                try {
                    minX = min.get0();
                    minY = min.get1();
                    maxX = max.get0();
                    maxY = max.get1();
                } catch ( ArrayIndexOutOfBoundsException e ) {
                    LOG.error( "Cannot generate WGS84 envelope for feature type '" + ftName + "'. Using full extent.",
                               e );
                    minX = -180.0;
                    minY = -90.0;
                    maxX = 180.0;
                    maxY = 90.0;
                }
                writer.writeStartElement( OWS_NS, "LowerCorner" );
FileLine
org/deegree/services/wfs/format/gml/request/GmlGetFeatureHandler.java189
org/deegree/services/wfs/format/gml/request/GmlGetFeatureHandler.java202
        if ( request.getVersion().equals( VERSION_100 ) ) {
            if ( responseContainerEl != null ) {
                xmlStream.setPrefix( responseContainerEl.getPrefix(), responseContainerEl.getNamespaceURI() );
                xmlStream.writeStartElement( responseContainerEl.getNamespaceURI(), responseContainerEl.getLocalPart() );
                xmlStream.writeNamespace( responseContainerEl.getPrefix(), responseContainerEl.getNamespaceURI() );
            } else {
                xmlStream.setPrefix( "wfs", WFS_NS );
                xmlStream.writeStartElement( WFS_NS, "FeatureCollection" );
                xmlStream.writeNamespace( "wfs", WFS_NS );
                if ( lock != null ) {
                    xmlStream.writeAttribute( "lockId", lock.getId() );
                }
FileLine
org/deegree/services/wfs/GetCapabilitiesHandler.java638
org/deegree/services/wfs/GetCapabilitiesHandler.java944
                writeOutputFormats110( writer );

                // ows:WGS84BoundingBox (minOccurs=0, maxOccurs=unbounded)
                Envelope env = null;
                try {
                    env = fs.getEnvelope( ftName );
                } catch ( FeatureStoreException e ) {
                    LOG.error( "Error retrieving envelope from FeatureStore: " + e.getMessage(), e );
                }

                if ( env != null ) {
                    try {
                        env = transformer.transform( env );
                    } catch ( Exception e ) {
                        LOG.error( "Cannot transform feature type envelope to WGS84." );
                    }
                } else {
                    env = new SimpleGeometryFactory().createEnvelope( -180, -90, 180, 90,
                                                                      CRSManager.getCRSRef( "EPSG:4326" ) );
                }

                writer.writeStartElement( OWS_NS, "WGS84BoundingBox" );
FileLine
org/deegree/services/wfs/GetCapabilitiesHandler.java593
org/deegree/services/wfs/GetCapabilitiesHandler.java899
                writer.writeStartElement( WFS_NS, "Name" );
                String prefix = ftName.getPrefix();
                if ( prefix == null || prefix.equals( "" ) ) {
                    LOG.warn( "Feature type '" + ftName + "' has no prefix!? This should not happen." );
                    prefix = "app";
                }
                if ( !"".equals( ftName.getNamespaceURI() ) ) {
                    // TODO what about the namespace prefix?
                    writer.writeNamespace( prefix, ftName.getNamespaceURI() );
                    writer.writeCharacters( prefix + ":" + ftName.getLocalPart() );
                } else {
                    writer.writeCharacters( ftName.getLocalPart() );
                }
                writer.writeEndElement();

                // wfs:Title
                writer.writeStartElement( WFS_NS, "Title" );