LOG4J2-435 revert back to getting details from attribute object Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d84624bd Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d84624bd Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d84624bd
Branch: refs/heads/LOG4J-1181 Commit: d84624bddea437e937018933a767314f075b3c04 Parents: c77fa17 Author: rpopma <[email protected]> Authored: Sun Nov 29 15:17:19 2015 +0900 Committer: rpopma <[email protected]> Committed: Sun Nov 29 15:17:19 2015 +0900 ---------------------------------------------------------------------- .../rolling/action/PathWithAttributes.java | 125 +------------------ 1 file changed, 2 insertions(+), 123 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d84624bd/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/PathWithAttributes.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/PathWithAttributes.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/PathWithAttributes.java index 21ce14e..42640c3 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/PathWithAttributes.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/PathWithAttributes.java @@ -19,46 +19,24 @@ package org.apache.logging.log4j.core.appender.rolling.action; import java.nio.file.Path; import java.nio.file.attribute.BasicFileAttributes; -import java.nio.file.attribute.FileTime; import java.util.Objects; /** * Tuple of a {@code Path} and {@code BasicFileAttributes}, used for sorting. */ -public class PathWithAttributes implements BasicFileAttributes { +public class PathWithAttributes { private final Path path; private final BasicFileAttributes attributes; - private final FileTime lastModifiedTime; - private final FileTime lastAccessTime; - private final FileTime creationTime; - private final boolean regularFile; - private final boolean directory; - private final boolean symbolicLink; - private final boolean other; - private final long size; - private final Object fileKey; public PathWithAttributes(final Path path, final BasicFileAttributes attributes) { this.path = Objects.requireNonNull(path, "path"); this.attributes = Objects.requireNonNull(attributes, "attributes"); - - // take snapshot of attributes, it may be just a view whose values change - this.lastModifiedTime = attributes.lastModifiedTime(); - this.lastAccessTime = attributes.lastAccessTime(); - this.creationTime = attributes.creationTime(); - this.regularFile = attributes.isRegularFile(); - this.directory = attributes.isDirectory(); - this.symbolicLink = attributes.isSymbolicLink(); - this.other = attributes.isOther(); - this.size = attributes.size(); - this.fileKey = attributes.fileKey(); } @Override public String toString() { - return path + " (created: " + creationTime + ", modified: " + lastModifiedTime + ", attrMod=" - + attributes.lastModifiedTime() + ")"; + return path + " (modified: " + attributes.lastModifiedTime() + ")"; } /** @@ -76,105 +54,6 @@ public class PathWithAttributes implements BasicFileAttributes { * @return the attributes */ public BasicFileAttributes getAttributes() { - return this; - } - - /** - * Returns the original attributes object. - * - * @return the original attributes object - */ - public BasicFileAttributes getOriginalAttributes() { return attributes; } - - /* - * (non-Javadoc) - * - * @see java.nio.file.attribute.BasicFileAttributes#lastModifiedTime() - */ - @Override - public FileTime lastModifiedTime() { - return lastModifiedTime; - } - - /* - * (non-Javadoc) - * - * @see java.nio.file.attribute.BasicFileAttributes#lastAccessTime() - */ - @Override - public FileTime lastAccessTime() { - return lastAccessTime; - } - - /* - * (non-Javadoc) - * - * @see java.nio.file.attribute.BasicFileAttributes#creationTime() - */ - @Override - public FileTime creationTime() { - return creationTime; - } - - /* - * (non-Javadoc) - * - * @see java.nio.file.attribute.BasicFileAttributes#isRegularFile() - */ - @Override - public boolean isRegularFile() { - return regularFile; - } - - /* - * (non-Javadoc) - * - * @see java.nio.file.attribute.BasicFileAttributes#isDirectory() - */ - @Override - public boolean isDirectory() { - return directory; - } - - /* - * (non-Javadoc) - * - * @see java.nio.file.attribute.BasicFileAttributes#isSymbolicLink() - */ - @Override - public boolean isSymbolicLink() { - return symbolicLink; - } - - /* - * (non-Javadoc) - * - * @see java.nio.file.attribute.BasicFileAttributes#isOther() - */ - @Override - public boolean isOther() { - return other; - } - - /* - * (non-Javadoc) - * - * @see java.nio.file.attribute.BasicFileAttributes#size() - */ - @Override - public long size() { - return size; - } - - /* - * (non-Javadoc) - * - * @see java.nio.file.attribute.BasicFileAttributes#fileKey() - */ - @Override - public Object fileKey() { - return fileKey; - } }
