CPD Results

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

Duplications

File Line
org/jomc/tools/JavaSources.java 303
org/jomc/tools/JavaSources.java 517
                }

                if ( !edited.equals( content ) )
                {
                    if ( !f.getParentFile().exists() && !f.getParentFile().mkdirs() )
                    {
                        throw new ToolException( this.getMessage( "failedCreatingDirectory", new Object[]
                            {
                                f.getParentFile().getAbsolutePath()
                            } ) );

                    }

                    if ( this.isLoggable( Level.INFO ) )
                    {
                        this.log( Level.INFO, this.getMessage( "editing", new Object[]
                            {
                                f.getCanonicalPath()
                            } ), null );

                    }

                    FileUtils.writeStringToFile( f, edited, this.getOutputEncoding() );
                }
            }
        }
        catch ( final IOException e )
        {
            throw new ToolException( e );
        }
    }

    /**
     * Gets a new editor for editing Java specification source code.
     *
     * @param specification The specification to create a new editor for.
     *
     * @return A new editor for editing the source code of {@code specification}.
     *
     * @throws NullPointerException if {@code specification} is {@code null}.
     */
    public JavaSpecificationEditor getSpecificationEditor( final Specification specification )

File Line
org/jomc/tools/JavaClasses.java 286
org/jomc/tools/JavaClasses.java 759
        {
            Dependencies dependencies = this.getModules().getDependencies( implementation.getIdentifier() );
            if ( dependencies == null )
            {
                dependencies = new Dependencies();
            }

            Properties properties = this.getModules().getProperties( implementation.getIdentifier() );
            if ( properties == null )
            {
                properties = new Properties();
            }

            Messages messages = this.getModules().getMessages( implementation.getIdentifier() );
            if ( messages == null )
            {
                messages = new Messages();
            }

            Specifications specifications = this.getModules().getSpecifications( implementation.getIdentifier() );
            if ( specifications == null )
            {
                specifications = new Specifications();
            }

File Line
org/jomc/tools/JavaSources.java 260
org/jomc/tools/JavaSources.java 366
                final JavaImplementationEditor editor = this.getImplementationEditor( implementation );
                final String edited;
                try
                {
                    edited = editor.edit( content );
                }
                catch ( final IOException e )
                {
                    throw new ToolException( this.getMessage( "failedEditing", new Object[]
                        {
                            f.getCanonicalPath(), e.getMessage()
                        } ), e );

                }

                if ( !editor.isLicenseSectionPresent() && this.isLoggable( Level.INFO ) )
                {
                    this.log( Level.INFO, this.getMessage( "missingOptionalSection", new Object[]
                        {
                            LICENSE_SECTION_NAME,
                            f.getCanonicalPath()
                        } ), null );

                }

                if ( !editor.isAnnotationsSectionPresent() )
                {
                    throw new ToolException( this.getMessage( "missingSection", new Object[]

File Line
org/jomc/tools/JavaBundles.java 355
org/jomc/tools/JavaBundles.java 404
                    final File file = new File( resourcesDirectory, bundlePath + ".properties" );
                    if ( !file.getParentFile().exists() && !file.getParentFile().mkdirs() )
                    {
                        throw new ToolException( this.getMessage( "failedCreatingDirectory", new Object[]
                            {
                                file.getParentFile().getAbsolutePath()
                            } ) );

                    }

                    if ( this.isLoggable( Level.INFO ) )
                    {
                        this.log( Level.INFO, this.getMessage( "writing", new Object[]
                            {
                                file.getCanonicalPath()
                            } ), null );

                    }

                    OutputStream out = null;
                    try
                    {
                        out = new FileOutputStream( file );