File | Line |
---|
org/apache/logging/log4j/message/MessageFormatMessage.java | 115 |
org/apache/logging/log4j/message/StringFormattedMessage.java | 111 |
}
@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();
}
}
/**
* Return the throwable passed to the Message.
*
* @return the Throwable.
*/
@Override
public Throwable getThrowable() {
return throwable;
}
} |
File | Line |
---|
org/apache/logging/log4j/message/FormattedMessage.java | 162 |
org/apache/logging/log4j/message/MessageFormatMessage.java | 127 |
org/apache/logging/log4j/message/StringFormattedMessage.java | 123 |
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
*/
@Override
public Throwable getThrowable() { |
File | Line |
---|
org/apache/logging/log4j/message/MessageFormatMessage.java | 46 |
org/apache/logging/log4j/message/StringFormattedMessage.java | 45 |
public MessageFormatMessage(final String messagePattern, final Object... arguments) {
this.messagePattern = messagePattern;
this.argArray = arguments;
if (arguments != null && arguments.length > 0 && arguments[arguments.length - 1] instanceof Throwable) {
this.throwable = (Throwable) arguments[arguments.length - 1];
}
}
/**
* Returns the formatted message.
* @return the formatted message.
*/
@Override
public String getFormattedMessage() {
if (formattedMessage == null) {
formattedMessage = formatMessage(messagePattern, argArray);
}
return formattedMessage;
}
/**
* Returns the message pattern.
* @return the message pattern.
*/
@Override
public String getFormat() {
return messagePattern;
}
/**
* Returns the message parameters.
* @return the message parameters.
*/
@Override
public Object[] getParameters() {
if (argArray != null) {
return argArray;
}
return stringArgs;
}
protected String formatMessage(final String msgPattern, final Object... args) {
try {
return MessageFormat.format(msgPattern, args); |
File | Line |
---|
org/apache/logging/log4j/message/ExtendedThreadInformation.java | 113 |
org/apache/logging/log4j/message/ExtendedThreadInformation.java | 136 |
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")) { |
File | Line |
---|
org/apache/logging/log4j/MarkerManager.java | 241 |
org/apache/logging/log4j/MarkerManager.java | 275 |
}
final Marker[] localParents = parents;
if (localParents != null) {
// With only one or two parents the for loop is slower.
final int localParentsLength = localParents.length;
if (localParentsLength == 1) {
return checkParent(localParents[0], marker);
}
if (localParentsLength == 2) {
return checkParent(localParents[0], marker) || checkParent(localParents[1], marker);
}
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < localParentsLength; i++) {
final Marker localParent = localParents[i];
if (checkParent(localParent, marker)) {
return true;
}
}
}
return false;
} |
File | Line |
---|
org/apache/logging/log4j/message/FormattedMessage.java | 140 |
org/apache/logging/log4j/message/MessageFormatMessage.java | 105 |
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=" + |
File | Line |
---|
org/apache/logging/log4j/MarkerManager.java | 277 |
org/apache/logging/log4j/MarkerManager.java | 302 |
if (localParents != null) {
final int localParentsLength = localParents.length;
if (localParentsLength == 1) {
return checkParent(localParents[0], marker);
}
if (localParentsLength == 2) {
return checkParent(localParents[0], marker) || checkParent(localParents[1], marker);
}
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < localParentsLength; i++) {
final Marker localParent = localParents[i];
if (checkParent(localParent, marker)) {
return true;
}
}
}
return false;
}
private static boolean checkParent(final Marker parent, final Marker marker) { |
File | Line |
---|
org/apache/logging/log4j/message/ExtendedThreadInformation.java | 123 |
org/apache/logging/log4j/message/ExtendedThreadInformation.java | 148 |
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;
} |