CPD Results

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

Duplications

File Project Line
org/codehaus/plexus/PlexusJUnit4TestCase.java Plexus :: Default Container (deprecated) 195
org/codehaus/plexus/PlexusTestCase.java Plexus :: Default Container (deprecated) 175
}

    protected void release(Object component) throws Exception {
        getContainer().release(component);
    }

    // ----------------------------------------------------------------------
    // Helper methods for sub classes
    // ----------------------------------------------------------------------

    public static File getTestFile(String path) {
        return new File(getBasedir(), path);
    }

    public static File getTestFile(String basedir, String path) {
        File basedirFile = new File(basedir);

        if (!basedirFile.isAbsolute()) {
            basedirFile = getTestFile(basedir);
        }

        return new File(basedirFile, path);
    }

    public static String getTestPath(String path) {
        return getTestFile(path).getAbsolutePath();
    }

    public static String getTestPath(String basedir, String path) {
        return getTestFile(basedir, path).getAbsolutePath();
    }

    public static String getBasedir() {
        if (basedir != null) {
            return basedir;
        }

        basedir = System.getProperty("basedir");

        if (basedir == null) {
            basedir = new File("").getAbsolutePath();
        }

        return basedir;
    }

    public String getTestConfiguration() {
        return getTestConfiguration(getClass());
    }

    public static String getTestConfiguration(Class<?> clazz) {
        String s = clazz.getName().replace('.', '/');

        return s.substring(0, s.indexOf("$")) + ".xml";
    }
}
File Project Line
org/codehaus/plexus/PlexusJUnit4TestCase.java Plexus :: Default Container (deprecated) 47
org/codehaus/plexus/PlexusTestCase.java Plexus :: Default Container (deprecated) 42
protected void setupContainer() {
        // ----------------------------------------------------------------------------
        // Context Setup
        // ----------------------------------------------------------------------------

        DefaultContext context = new DefaultContext();

        context.put("basedir", getBasedir());

        customizeContext(context);

        boolean hasPlexusHome = context.contains("plexus.home");

        if (!hasPlexusHome) {
            File f = getTestFile("target/plexus-home");

            if (!f.isDirectory()) {
                f.mkdir();
            }

            context.put("plexus.home", f.getAbsolutePath());
        }

        // ----------------------------------------------------------------------------
        // Configuration
        // ----------------------------------------------------------------------------

        String config = getCustomConfigurationName();

        ContainerConfiguration containerConfiguration =
                new DefaultContainerConfiguration().setName("test").setContext(context.getContextData());

        if (config != null) {
            containerConfiguration.setContainerConfiguration(config);
        } else {
            String resource = getConfigurationName(null);

            containerConfiguration.setContainerConfiguration(resource);
        }

        customizeContainerConfiguration(containerConfiguration);

        try {
            container = new DefaultPlexusContainer(containerConfiguration);
        } catch (PlexusContainerException e) {
            e.printStackTrace();
            fail("Failed to create plexus container.");
        }
    }

    /**
     * Allow custom test case implementations do augment the default container configuration before
     * executing tests.
     *
     * @param containerConfiguration The configuration
     */
    protected void customizeContainerConfiguration(ContainerConfiguration containerConfiguration) {}

    protected void customizeContext(Context context) {}

    protected PlexusConfiguration customizeComponentConfiguration() {
        return null;
    }
File Project Line
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1386
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1492
throw new XmlPullParserException("expected start tag name and not " + printable(ch), this, null);
                }
            } else if (isS(ch)) {
                gotS = true;
                if (normalizeIgnorableWS) {
                    if (ch == '\r') {
                        normalizedCR = true;
                        // posEnd = pos -1;
                        // joinPC();
                        // posEnd is already set
                        if (!usePC) {
                            posEnd = pos - 1;
                            if (posEnd > posStart) {
                                joinPC();
                            } else {
                                usePC = true;
                                pcStart = pcEnd = 0;
                            }
                        }
                        // assert usePC == true;
                        if (pcEnd >= pc.length) ensurePC(pcEnd);
                        pc[pcEnd++] = '\n';
                    } else if (ch == '\n') {
                        if (!normalizedCR && usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = '\n';
                        }
                        normalizedCR = false;
                    } else {
                        if (usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = ch;
                        }
                        normalizedCR = false;
                    }
                }
            } else {
                throw new XmlPullParserException(
File Project Line
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2231
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2345
seenDash = false;
                }
                if (normalizeIgnorableWS) {
                    if (ch == '\r') {
                        normalizedCR = true;
                        // posEnd = pos -1;
                        // joinPC();
                        // posEnd is alreadys set
                        if (!usePC) {
                            posEnd = pos - 1;
                            if (posEnd > posStart) {
                                joinPC();
                            } else {
                                usePC = true;
                                pcStart = pcEnd = 0;
                            }
                        }
                        // assert usePC == true;
                        if (pcEnd >= pc.length) ensurePC(pcEnd);
                        pc[pcEnd++] = '\n';
                    } else if (ch == '\n') {
                        if (!normalizedCR && usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = '\n';
                        }
                        normalizedCR = false;
                    } else {
                        if (usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = ch;
                        }
                        normalizedCR = false;
                    }
                }
File Project Line
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1390
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1496
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2233
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2611
if (normalizeIgnorableWS) {
                    if (ch == '\r') {
                        normalizedCR = true;
                        // posEnd = pos -1;
                        // joinPC();
                        // posEnd is already set
                        if (!usePC) {
                            posEnd = pos - 1;
                            if (posEnd > posStart) {
                                joinPC();
                            } else {
                                usePC = true;
                                pcStart = pcEnd = 0;
                            }
                        }
                        // assert usePC == true;
                        if (pcEnd >= pc.length) ensurePC(pcEnd);
                        pc[pcEnd++] = '\n';
                    } else if (ch == '\n') {
                        if (!normalizedCR && usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = '\n';
                        }
                        normalizedCR = false;
                    } else {
                        if (usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = ch;
                        }
                        normalizedCR = false;
                    }
                }
            } else {
File Project Line
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1390
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1496
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2347
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2611
if (normalizeIgnorableWS) {
                    if (ch == '\r') {
                        normalizedCR = true;
                        // posEnd = pos -1;
                        // joinPC();
                        // posEnd is already set
                        if (!usePC) {
                            posEnd = pos - 1;
                            if (posEnd > posStart) {
                                joinPC();
                            } else {
                                usePC = true;
                                pcStart = pcEnd = 0;
                            }
                        }
                        // assert usePC == true;
                        if (pcEnd >= pc.length) ensurePC(pcEnd);
                        pc[pcEnd++] = '\n';
                    } else if (ch == '\n') {
                        if (!normalizedCR && usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = '\n';
                        }
                        normalizedCR = false;
                    } else {
                        if (usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = ch;
                        }
                        normalizedCR = false;
                    }
                }
File Project Line
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2241
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2720
if (posEnd > posStart) {
                                joinPC();
                            } else {
                                usePC = true;
                                pcStart = pcEnd = 0;
                            }
                        }
                        // assert usePC == true;
                        if (pcEnd >= pc.length) ensurePC(pcEnd);
                        pc[pcEnd++] = '\n';
                    } else if (ch == '\n') {
                        if (!normalizedCR && usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = '\n';
                        }
                        normalizedCR = false;
                    } else {
                        if (usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = ch;
                        }
                        normalizedCR = false;
                    }
                }
            }

        } catch (EOFException ex) {
            // detect EOF and create meaningful error ...
            throw new XmlPullParserException(
File Project Line
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1268
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2718
posEnd = pos - 1;
                                // posEnd is already set
                                if (!usePC) {
                                    if (posEnd > posStart) {
                                        joinPC();
                                    } else {
                                        usePC = true;
                                        pcStart = pcEnd = 0;
                                    }
                                }
                                // assert usePC == true;
                                if (pcEnd >= pc.length) ensurePC(pcEnd);
                                pc[pcEnd++] = '\n';
                            } else if (ch == '\n') {
                                //   if(!usePC) {  joinPC(); } else { if(pcEnd >= pc.length) ensurePC(); }
                                if (!normalizedCR && usePC) {
                                    if (pcEnd >= pc.length) ensurePC(pcEnd);
                                    pc[pcEnd++] = '\n';
                                }
                                normalizedCR = false;
                            } else {
                                if (usePC) {
                                    if (pcEnd >= pc.length) ensurePC(pcEnd);
                                    pc[pcEnd++] = ch;
                                }
                                normalizedCR = false;
                            }
                        }
File Project Line
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1271
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2355
if (posEnd > posStart) {
                                        joinPC();
                                    } else {
                                        usePC = true;
                                        pcStart = pcEnd = 0;
                                    }
                                }
                                // assert usePC == true;
                                if (pcEnd >= pc.length) ensurePC(pcEnd);
                                pc[pcEnd++] = '\n';
                            } else if (ch == '\n') {
                                //   if(!usePC) {  joinPC(); } else { if(pcEnd >= pc.length) ensurePC(); }
                                if (!normalizedCR && usePC) {
                                    if (pcEnd >= pc.length) ensurePC(pcEnd);
                                    pc[pcEnd++] = '\n';
                                }
                                normalizedCR = false;
                            } else {
                                if (usePC) {
                                    if (pcEnd >= pc.length) ensurePC(pcEnd);
                                    pc[pcEnd++] = ch;
                                }
                                normalizedCR = false;
                            }
                        }

                        ch = more();
                    } while (ch != '<' && ch != '&');
File Project Line
org/codehaus/plexus/component/configurator/converters/composite/ArrayConverter.java Plexus :: Default Container (deprecated) 71
org/codehaus/plexus/component/configurator/converters/composite/CollectionConverter.java Plexus :: Default Container (deprecated) 107
Class childType = getClassForImplementationHint(null, childConfiguration, classLoader);

            // check if the name is a fully qualified classname

            if (childType == null && name.indexOf('.') > 0) {
                try {
                    childType = classLoader.loadClass(name);
                } catch (ClassNotFoundException e) {
                    // doesn't exist - continue processing
                }
            }

            if (childType == null) {
                // try to find the class in the package of the baseType
                // (which is the component being configured)

                String baseTypeName = baseType.getName();

                int lastDot = baseTypeName.lastIndexOf('.');

                String className;

                if (lastDot == -1) {
                    className = name;
                } else {
                    String basePackage = baseTypeName.substring(0, lastDot);
                    className = basePackage + "." + StringUtils.capitalizeFirstLetter(name);
                }

                try {
                    childType = classLoader.loadClass(className);
                } catch (ClassNotFoundException e) {
File Project Line
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1398
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1504
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2619
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2720
if (posEnd > posStart) {
                                joinPC();
                            } else {
                                usePC = true;
                                pcStart = pcEnd = 0;
                            }
                        }
                        // assert usePC == true;
                        if (pcEnd >= pc.length) ensurePC(pcEnd);
                        pc[pcEnd++] = '\n';
                    } else if (ch == '\n') {
                        if (!normalizedCR && usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = '\n';
                        }
                        normalizedCR = false;
                    } else {
                        if (usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = ch;
                        }
                        normalizedCR = false;
                    }
                }
            } else {
File Project Line
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1271
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1398
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 1504
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2241
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2619
if (posEnd > posStart) {
                                        joinPC();
                                    } else {
                                        usePC = true;
                                        pcStart = pcEnd = 0;
                                    }
                                }
                                // assert usePC == true;
                                if (pcEnd >= pc.length) ensurePC(pcEnd);
                                pc[pcEnd++] = '\n';
                            } else if (ch == '\n') {
                                //   if(!usePC) {  joinPC(); } else { if(pcEnd >= pc.length) ensurePC(); }
                                if (!normalizedCR && usePC) {
                                    if (pcEnd >= pc.length) ensurePC(pcEnd);
                                    pc[pcEnd++] = '\n';
                                }
                                normalizedCR = false;
                            } else {
                                if (usePC) {
                                    if (pcEnd >= pc.length) ensurePC(pcEnd);
                                    pc[pcEnd++] = ch;
                                }
                                normalizedCR = false;
                            }
                        }
File Project Line
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2355
org/codehaus/plexus/metadata/merge/MXParser.java Plexus :: Component Metadata (Maven Plugin) (deprecated) 2720
if (posEnd > posStart) {
                                joinPC();
                            } else {
                                usePC = true;
                                pcStart = pcEnd = 0;
                            }
                        }
                        // assert usePC == true;
                        if (pcEnd >= pc.length) ensurePC(pcEnd);
                        pc[pcEnd++] = '\n';
                    } else if (ch == '\n') {
                        if (!normalizedCR && usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = '\n';
                        }
                        normalizedCR = false;
                    } else {
                        if (usePC) {
                            if (pcEnd >= pc.length) ensurePC(pcEnd);
                            pc[pcEnd++] = ch;
                        }
                        normalizedCR = false;
                    }
                }