CPD Results

The following document contains the results of PMD's CPD

Duplications

FileLine
edu/nwu/heimdall/bll/Directory.java161
edu/nwu/heimdall/bll/ActiveDirectory.java182
    public synchronized edu.nwu.heimdall.api.IEntry[] get(int num, Object key)
    {
        Collection values = dir.values();
        IEntry[] entries = (IEntry[]) values.toArray(new IEntry[0]);

        int offset = 0;

        while ((offset < entries.length) && !entries[offset].equals(key))
        {
            offset++;
        }

        IEntry[] res = new IEntry[Math.min(values.size() - offset, num)];

        for (int i = 0; i < res.length; i++)
        {
            res[i] = entries[i + offset];
        }

        return res;
    }

    /**
     * Set the value of a entry.
     *
     * @param key the key
     * @param value the value
     *
     * @return true, if update was successful
     */
    public synchronized boolean set(Object key, Object value)

FileLine
edu/nwu/time/wfl/TimeSyncServer.java87
edu/nwu/heimdall/wfl/Server.java100
        logger.error(toString() + ": " + msg);
    }

    /**
     * Write a info message to the log facility.
     *
     * @param msg the message
     */
    private void info(String msg)
    {
        logger.info(toString() + ": " + msg);
    }

    /**
     * Creates a human readable string representation of the object.
     *
     * @return the string representation
     */
    public String toString()
    {
        return server.toString();
    }

    /**
     * Start the server.
     *
     * @throws SocketException if the socket could not be opened, or the
     *         socket could not bind to the specified local port
     * @throws UnknownHostException if no IP address for the local host could
     *         be found
     */
    public void start() throws SocketException, UnknownHostException
    {
        debug("start");

        if (stopped)
        {
            stopped = false;

            server.setUp();

            Thread srv = new Thread(this);

            srv.setDaemon(true);
            srv.start();
        }
        else
        {
            throw new RuntimeException("server already running");
        }
    }

    /**
     * Stop the server.
     */
    public void stop()
    {
        debug("stop");

        if (!stopped)
        {
            server.tearDown();
            stopped = true;
        }
    }
}

FileLine
edu/nwu/graph/export/DotPs.java67
edu/nwu/graph/export/DotGif.java67
            Process dot = runtime.exec("dot -Tgif -o " + file.getPath() + " "
                    + tmp.getPath());

            dot.waitFor();

            if (dot.exitValue() != 0)
            {
                logger.error("dot returned error code " + dot.exitValue());
            }
        }
        finally
        {
            tmp.delete();
        }
    }

    /**
     * Append the extension to the filename if necessary.
     *
     * @param file the file
     *
     * @return the filename with the extension
     */
    private File appendExtension(File file)
    {
        File res = file;

        if (!res.getAbsolutePath().endsWith(EXTENSION))
        {
            logger.debug("append extension " + EXTENSION);
            res = new File(res.getAbsolutePath().concat(EXTENSION));
        }

        return res;
    }
}