Apache logging services logo Apache log4j logo

CPD Results

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

Duplications

FileLine
org/apache/logging/log4j/message/MessageFormatMessage.java98
org/apache/logging/log4j/message/StringFormattedMessage.java97
        final MessageFormatMessage that = (MessageFormatMessage) o;

        if (messagePattern != null ? !messagePattern.equals(that.messagePattern) : that.messagePattern != null) {
            return false;
        }
        if (!Arrays.equals(stringArgs, that.stringArgs)) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int result = messagePattern != null ? messagePattern.hashCode() : 0;
        result = HASHVAL * result + (stringArgs != null ? Arrays.hashCode(stringArgs) : 0);
        return result;
    }


    @Override
    public String toString() {
        return "StringFormatMessage[messagePattern=" + messagePattern + ", args=" +
            Arrays.toString(argArray) +  "]";
    }

    private void writeObject(final ObjectOutputStream out) throws IOException {
        out.defaultWriteObject();
        getFormattedMessage();
        out.writeUTF(formattedMessage);
        out.writeUTF(messagePattern);
        out.writeInt(argArray.length);
        stringArgs = new String[argArray.length];
        int i = 0;
        for (final Object obj : argArray) {
            stringArgs[i] = obj.toString();
            ++i;
        }
    }

    private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
        in.defaultReadObject();
        formattedMessage = in.readUTF();
        messagePattern = in.readUTF();
        final int length = in.readInt();
        stringArgs = new String[length];
        for (int i = 0; i < length; ++i) {
            stringArgs[i] = in.readUTF();
        }
    }

    /**
     * Always returns null.
     *
     * @return null
     */
    public Throwable getThrowable() {
        return null;
    }
}
FileLine
org/apache/logging/log4j/message/FormattedMessage.java172
org/apache/logging/log4j/message/MessageFormatMessage.java120
org/apache/logging/log4j/message/StringFormattedMessage.java119
        return "FormattedMessage[messagePattern=" + messagePattern + ", args=" +
            Arrays.toString(argArray) +  "]";
    }

    private void writeObject(final ObjectOutputStream out) throws IOException {
        out.defaultWriteObject();
        getFormattedMessage();
        out.writeUTF(formattedMessage);
        out.writeUTF(messagePattern);
        out.writeInt(argArray.length);
        stringArgs = new String[argArray.length];
        int i = 0;
        for (final Object obj : argArray) {
            stringArgs[i] = obj.toString();
            ++i;
        }
    }

    private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
        in.defaultReadObject();
        formattedMessage = in.readUTF();
        messagePattern = in.readUTF();
        final int length = in.readInt();
        stringArgs = new String[length];
        for (int i = 0; i < length; ++i) {
            stringArgs[i] = in.readUTF();
        }
    }

    /**
     * Always returns null.
     *
     * @return null
     */
    public Throwable getThrowable() {
FileLine
org/apache/logging/log4j/message/ExtendedThreadInformation.java111
org/apache/logging/log4j/message/ExtendedThreadInformation.java134
            case WAITING: {
                final StackTraceElement element = info.getStackTrace()[0];
                final String className = element.getClassName();
                final String method = element.getMethodName();
                if (className.equals("java.lang.Object") && method.equals("wait")) {
                    sb.append(" (on object monitor");
                    if (info.getLockOwnerName() != null) {
                        sb.append(" owned by \"");
                        sb.append(info.getLockOwnerName()).append("\" Id=").append(info.getLockOwnerId());
                    }
                    sb.append(")");
                } else if (className.equals("java.lang.Thread") && method.equals("join")) {
FileLine
org/apache/logging/log4j/message/FormattedMessage.java150
org/apache/logging/log4j/message/MessageFormatMessage.java98
org/apache/logging/log4j/message/StringFormattedMessage.java97
        final FormattedMessage that = (FormattedMessage) o;

        if (messagePattern != null ? !messagePattern.equals(that.messagePattern) : that.messagePattern != null) {
            return false;
        }
        if (!Arrays.equals(stringArgs, that.stringArgs)) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int result = messagePattern != null ? messagePattern.hashCode() : 0;
        result = HASHVAL * result + (stringArgs != null ? Arrays.hashCode(stringArgs) : 0);
        return result;
    }


    @Override
    public String toString() {
        return "FormattedMessage[messagePattern=" + messagePattern + ", args=" +
FileLine
org/apache/logging/log4j/message/ExtendedThreadInformation.java121
org/apache/logging/log4j/message/ExtendedThreadInformation.java146
                    sb.append(")");
                } else if (className.equals("java.lang.Thread") && method.equals("join")) {
                    sb.append(" (on completion of thread ").append(info.getLockOwnerId()).append(")");
                } else {
                    sb.append(" (parking for lock");
                    if (info.getLockOwnerName() != null) {
                        sb.append(" owned by \"");
                        sb.append(info.getLockOwnerName()).append("\" Id=").append(info.getLockOwnerId());
                    }
                    sb.append(")");
                }
                break;
            }