CPD Results

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

Duplications

FileLine
org/jdtaus/core/text/util/HtmlEntities.java69
org/jdtaus/core/text/util/HtmlEntities.java139
        Map map = entityMap != null ? (Map) entityMap.get() : null;

        if ( map == null )
        {
            map = new HashMap/*<String,Character>*/( 512 );
            InputStream in = null;
            boolean close = true;

            final URL resources = HtmlEntities.class.getResource( "HtmlEntities.properties" );
            final Properties properties = new Properties();

            try
            {
                in = resources.openStream();
                properties.load( in );
                in.close();
                close = false;
            }
            catch ( final IOException e )
            {
                throw new AssertionError( e );
            }
            finally
            {
                try
                {
                    if ( close && in != null )
                    {
                        in.close();
                    }
                }
                catch ( final IOException e )
                {
                    throw new AssertionError( e );
                }
            }

            for ( final Enumeration e = properties.propertyNames(); e.hasMoreElements(); )
            {
                final String name = (String) e.nextElement();
                final String value = properties.getProperty( name );

                if ( name.startsWith( PROPERTY_PREFIX ) )
                {
                    map.put( name.substring( PROPERTY_PREFIX.length() ), new Character( value.charAt( 0 ) ) );
FileLine
org/jdtaus/core/io/util/CoalescingFileOperations.java207
org/jdtaus/core/io/util/ReadAheadFileOperations.java126
        }
    }

    public long getFilePointer() throws IOException
    {
        this.assertNotClosed();

        return this.filePointer;
    }

    public void setFilePointer( final long pos ) throws IOException
    {
        this.assertNotClosed();

        this.filePointer = pos;
    }

    public int read( final byte[] buf, int off, int len ) throws IOException
    {
        if ( buf == null )
        {
            throw new NullPointerException( "buf" );
        }
        if ( off < 0 )
        {
            throw new IndexOutOfBoundsException( Integer.toString( off ) );
        }
        if ( len < 0 )
        {
            throw new IndexOutOfBoundsException( Integer.toString( len ) );
        }
        if ( off + len > buf.length )
        {
            throw new IndexOutOfBoundsException( Integer.toString( off + len ) );
        }

        this.assertNotClosed();

        int read = FileOperations.EOF;
FileLine
org/jdtaus/core/nio/util/Charsets.java292
org/jdtaus/core/nio/util/Charsets.java371
            final CharBuffer buf = cset.decode( ByteBuffer.wrap( bytes ) );

            if ( buf.hasArray() )
            {
                ret = String.valueOf( buf.array(), buf.arrayOffset(),
                                      buf.length() );

            }
            else
            {
                final char[] c = new char[ buf.length() ];
                buf.rewind();
                buf.get( c );
                ret = String.valueOf( c );
            }
        }
        catch ( final ClassNotFoundException e )
        {
            throw new AssertionError( e );
        }
        catch ( final InstantiationException e )
        {
            throw new AssertionError( e );
        }
        catch ( final IllegalAccessException e )
        {
            throw new AssertionError( e );
        }
        catch ( final IOException e )
        {
            throw new AssertionError( e );
        }

        return ret;
    }