CPD Results

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

Duplications

File Line
org/jomc/modlet/DefaultModelContext.java 2020
org/jomc/modlet/DefaultModelContext.java 2193
    private JAXBContext createContext( final Schemas schemas, final String model, final URI publicId )
        throws ModelException
    {
        if ( model != null && publicId != null )
        {
            throw new IllegalArgumentException( "model=" + model + ", publicId=" + publicId.toASCIIString() );
        }

        try
        {
            StringBuilder packageNames = null;
            final long t0 = System.currentTimeMillis();

            if ( schemas != null )
            {
                packageNames = new StringBuilder( schemas.getSchema().size() * 25 );

                for ( Schema schema : schemas.getSchema() )
                {
                    if ( schema.getContextId() != null )
                    {
                        packageNames.append( ':' ).append( schema.getContextId() );
                    }
                }
            }

            if ( packageNames == null || packageNames.length() == 0 )
            {
                if ( model != null )
                {
                    throw new ModelException( getMessage( "missingSchemasForModel", model ) );
                }
                if ( publicId != null )
                {
                    throw new ModelException( getMessage( "missingSchemasForPublicId", publicId ) );
                }
            }

            final JAXBContext context = JAXBContext.newInstance( packageNames.substring( 1 ), this.getClassLoader() );
File Line
org/jomc/modlet/DefaultModletProcessor.java 144
org/jomc/modlet/DefaultModletProvider.java 176
    public DefaultModletProcessor()
    {
        super();
    }

    /**
     * Gets a flag indicating the processor is enabled by default.
     * <p>The default enabled flag is controlled by system property
     * {@code org.jomc.modlet.DefaultModletProcessor.defaultEnabled} holding a value indicating the processor is
     * enabled by default. If that property is not set, the {@code true} default is returned.</p>
     *
     * @return {@code true}, if the processor is enabled by default; {@code false}, if the processor is disabled by
     * default.
     *
     * @see #isEnabled()
     * @see #setDefaultEnabled(java.lang.Boolean)
     */
    public static boolean isDefaultEnabled()
    {
        if ( defaultEnabled == null )
        {
            defaultEnabled = Boolean.valueOf( System.getProperty(
                DEFAULT_ENABLED_PROPERTY_NAME, Boolean.toString( DEFAULT_ENABLED ) ) );

        }

        return defaultEnabled;
    }

    /**
     * Sets the flag indicating the processor is enabled by default.
     *
     * @param value The new value of the flag indicating the processor is enabled by default or {@code null}.
     *
     * @see #isDefaultEnabled()
     */
    public static void setDefaultEnabled( final Boolean value )
    {
        defaultEnabled = value;
    }

    /**
     * Gets a flag indicating the processor is enabled.
     *
     * @return {@code true}, if the processor is enabled; {@code false}, if the processor is disabled.
     *
     * @see #isDefaultEnabled()
     * @see #setEnabled(java.lang.Boolean)
     */
    public final boolean isEnabled()
    {
        if ( this.enabled == null )
        {
            this.enabled = isDefaultEnabled();
        }

        return this.enabled;
    }

    /**
     * Sets the flag indicating the processor is enabled.
     *
     * @param value The new value of the flag indicating the processor is enabled or {@code null}.
     *
     * @see #isEnabled()
     */
    public final void setEnabled( final Boolean value )
    {
        this.enabled = value;
    }

    /**
     * Gets the default ordinal number of the processor.
     * <p>The default ordinal number is controlled by system property
     * {@code org.jomc.modlet.DefaultModletProvider.defaultOrdinal} holding the default ordinal number of the processor.
     * If that property is not set, the {@code 0} default is returned.</p>
     *
     * @return The default ordinal number of the processor.
     *
     * @see #setDefaultOrdinal(java.lang.Integer)
     */
    public static int getDefaultOrdinal()