CPD Results

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

Duplications

FileLine
org/codehaus/mojo/gwt/shell/AbstractGwtShellMojo.java387
org/codehaus/mojo/gwt/shell/JavaCommand.java173
        command.add( "-classpath" );
        List<String> path = new ArrayList<String>( classpath.size() );
        for ( File file : classpath )
        {
            path.add( file.getAbsolutePath() );
        }
        command.add( StringUtils.join( path.iterator(), File.pathSeparator ) );
        if ( systemProperties != null )
        {
            for ( Map.Entry entry : systemProperties.entrySet() )
            {
                command.add( "-D" + entry.getKey() + "=" + entry.getValue() );
            }
        }
        command.add( className );
        command.addAll( args );

        try
        {
            String[] arguments = (String[]) command.toArray( new String[command.size()] );

            // On windows, the default Shell will fall into command line length limitation issue
            // On Unixes, not using a Shell breaks the classpath (NoClassDefFoundError:
            // com/google/gwt/dev/Compiler).
            Commandline cmd =
                Os.isFamily( Os.FAMILY_WINDOWS ) ? new Commandline( new JavaShell() ) : new Commandline();

            cmd.setExecutable( this.getJavaCommand() );
FileLine
org/codehaus/mojo/gwt/shell/AbstractGwtShellMojo.java336
org/codehaus/mojo/gwt/shell/JavaCommand.java119
        return this;
    }

    public JavaCommand withinClasspath( File... path )
    {
        for ( File file : path )
        {
            classpath.add( file );
        }
        return this;
    }

    public JavaCommand arg( String arg )
    {
        args.add( arg );
        return this;
    }

    public JavaCommand arg( String arg, String value )
    {
        args.add( arg );
        args.add( value );
        return this;
    }

    public JavaCommand arg( boolean condition, String arg )
    {
        if ( condition )
        {
            args.add( arg );
        }
        return this;
    }

    public JavaCommand systemProperty( String name, String value )
    {
        systemProperties.setProperty( name, value );
        return this;
    }

    public JavaCommand environment( String name, String value )
    {
        env.setProperty( name, value );
        return this;
    }

    public void execute()
        throws JavaCommandException
FileLine
org/codehaus/mojo/gwt/AbstractGwtModuleMojo.java177
org/codehaus/mojo/gwt/utils/DefaultGwtModuleReader.java145
                log.debug( "GWT module " + name + " found in " + root );
                return readModule( name, xml );
            }
        }

        try
        {
            Collection<File> classpath = getClasspath( Artifact.SCOPE_COMPILE );
            URL[] urls = new URL[classpath.size()];
            int i = 0;
            for ( File file : classpath )
            {
                urls[i++] = file.toURI().toURL();
            }
            InputStream stream = new URLClassLoader( urls ).getResourceAsStream( modulePath );
            if ( stream != null )
            {
                return readModule( name, stream );
            }
        }
        catch ( MalformedURLException e )
        {
            // ignored;
        }
        catch ( ClasspathBuilderException e )
FileLine
org/codehaus/mojo/gwt/GenerateAsyncMojo.java396
org/codehaus/mojo/gwt/shell/TestMojo.java336
        getLog().debug( "TestMojo#getProjectClassLoader()" );

        List<?> compile = getProject().getCompileClasspathElements();
        URL[] urls = new URL[compile.size()];
        int i = 0;
        for ( Object object : compile )
        {
            if ( object instanceof Artifact )
            {
                urls[i] = ( (Artifact) object ).getFile().toURI().toURL();
            }
            else
            {
                urls[i] = new File( (String) object ).toURI().toURL();
            }
            i++;
        }
        return new URLClassLoader( urls, ClassLoader.getSystemClassLoader() );
    }