CPD Results

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

Duplications

FileLine
org/deegree/metadata/ebrim/RegistryObject.java251
org/deegree/metadata/ebrim/RegistryObject.java314
    private void serializeBrief( XMLStreamWriter writer )
                            throws XMLStreamException {

        XMLStreamReader inStream = adapter.getRootElement().getXMLStreamReader();
        XMLStreamUtils.skipStartDocument( inStream );
        if ( inStream.getEventType() != XMLStreamConstants.START_ELEMENT ) {
            throw new XMLStreamException( "Input stream does not point to a START_ELEMENT event." );
        }

        if ( inStream.getNamespaceURI() == ""
             && ( inStream.getPrefix() == DEFAULT_NS_PREFIX || inStream.getPrefix() == null ) ) {
            writer.writeStartElement( inStream.getLocalName() );
        } else {
            if ( inStream.getPrefix() != null && writer.getNamespaceContext().getPrefix( inStream.getPrefix() ) == "" ) {
                // TODO handle special cases for prefix binding, see
                // http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/javax/xml/namespace/NamespaceContext.html#getNamespaceURI(java.lang.String)
                writer.setPrefix( inStream.getPrefix(), inStream.getNamespaceURI() );
            }
            writer.writeStartElement( inStream.getPrefix(), inStream.getLocalName(), inStream.getNamespaceURI() );
        }

        // copy RIM namespace binding
        for ( int i = 0; i < inStream.getNamespaceCount(); i++ ) {
            String nsPrefix = inStream.getNamespacePrefix( i );
            String nsURI = inStream.getNamespaceURI( i );
            if ( RIM_NS.equals( nsURI ) ) {
                writer.writeNamespace( nsPrefix, nsURI );
            }
        }

        // copy attributes required for brief representation
        for ( int i = 0; i < inStream.getAttributeCount(); i++ ) {
            String localName = inStream.getAttributeLocalName( i );
            String value = inStream.getAttributeValue( i );
            String nsURI = inStream.getAttributeNamespace( i );
            if ( nsURI == null ) {
                if ( "id".equals( localName ) || "lid".equals( localName ) || "objectType".equals( localName )
                     || "status".equals( localName ) )
                    writer.writeAttribute( localName, value );
            }
        }

        while ( inStream.next() != END_ELEMENT ) {
            if ( inStream.isStartElement() ) {
                QName elName = inStream.getName();
                if ( RIM_NS.equals( elName.getNamespaceURI() ) && "VersionInfo".equals( elName.getLocalPart() ) ) {
FileLine
org/deegree/metadata/iso/ISORecord.java571
org/deegree/metadata/iso/ISORecord.java608
    public void update( ValueReference propName, OMElement newEl ) {
        AXIOMXPath path;
        Object rootNode;
        try {
            path = getAsXPath( propName );
            rootNode = path.selectSingleNode( root );
        } catch ( JaxenException e ) {
            String msg = "Could not propName as xPath and locate in in the record: " + propName;
            LOG.debug( msg, e );
            throw new InvalidParameterException( msg );
        }
        if ( rootNode == null ) {
            String msg = "Could not find node with xPath: " + path;
            LOG.debug( msg );
            throw new InvalidParameterException( msg );
        } else if ( ( !( rootNode instanceof OMElement ) ) ) {
            String msg = "Xpath + " + path + " does not adress a Node!";
            LOG.debug( msg );
            throw new InvalidParameterException( msg );
        }

        OMElement rootEl = (OMElement) rootNode;