Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLog.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLog.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLog.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLog.java Thu Sep 14 19:26:39 2017 @@ -22,8 +22,7 @@ import org.apache.commons.vfs2.operation * * @since 0.1 */ -public interface VcsLog extends FileOperation -{ +public interface VcsLog extends FileOperation { /** * * @param startRev The start revision.
Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLogEntry.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLogEntry.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLogEntry.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLogEntry.java Thu Sep 14 19:26:39 2017 @@ -22,8 +22,7 @@ import java.util.Calendar; * * @since 0.1 */ -public class VcsLogEntry -{ +public class VcsLogEntry { /** */ private final String author; @@ -56,9 +55,8 @@ public class VcsLogEntry * @param date The date. * @param path The path. */ - public VcsLogEntry(final String author, final long revision, - final String message, final Calendar date, final String path) - { + public VcsLogEntry(final String author, final long revision, final String message, final Calendar date, + final String path) { this.author = author; this.revision = revision; this.message = message; @@ -70,8 +68,7 @@ public class VcsLogEntry * * @return The author. */ - public String getAuthor() - { + public String getAuthor() { return author; } @@ -79,8 +76,7 @@ public class VcsLogEntry * * @return The revision. */ - public long getRevision() - { + public long getRevision() { return revision; } @@ -88,8 +84,7 @@ public class VcsLogEntry * * @return The message. */ - public String getMessage() - { + public String getMessage() { return message; } @@ -97,8 +92,7 @@ public class VcsLogEntry * * @return The date. */ - public Calendar getDate() - { + public Calendar getDate() { return date; } @@ -106,8 +100,7 @@ public class VcsLogEntry * * @return The path. */ - public String getPath() - { + public String getPath() { return path; } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLogEntryHandler.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLogEntryHandler.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLogEntryHandler.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsLogEntryHandler.java Thu Sep 14 19:26:39 2017 @@ -22,8 +22,7 @@ import org.apache.commons.vfs2.FileSyste * * @since 0.1 */ -public interface VcsLogEntryHandler -{ +public interface VcsLogEntryHandler { /** * * @param entry The log entry. Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsModifyListener.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsModifyListener.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsModifyListener.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsModifyListener.java Thu Sep 14 19:26:39 2017 @@ -20,8 +20,7 @@ package org.apache.commons.vfs2.operatio * * @since 0.1 */ -public interface VcsModifyListener -{ +public interface VcsModifyListener { /** * * @param path The path String. Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsRevert.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsRevert.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsRevert.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsRevert.java Thu Sep 14 19:26:39 2017 @@ -20,15 +20,13 @@ import org.apache.commons.vfs2.operation /** * <p> - * Restores pristine working copy file and cancels all local modifications. In - * other words, VcsRevert replaces working copy file with the latest version - * from the repository. + * Restores pristine working copy file and cancels all local modifications. In other words, VcsRevert replaces working + * copy file with the latest version from the repository. * </p> * * @since 0.1 */ -public interface VcsRevert extends FileOperation -{ +public interface VcsRevert extends FileOperation { /** * * @param recursive true if children should be processed. Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java Thu Sep 14 19:26:39 2017 @@ -20,35 +20,14 @@ package org.apache.commons.vfs2.operatio * * @since 0.1 */ -public enum VcsStatus -{ - UNKNOWN(-1), - NOT_MODIFIED(0), - ADDED(1), - CONFLICTED(2), - DELETED(3), - MERGED(4), - IGNORED(5), - MODIFIED(6), - REPLACED(7), - UNVERSIONED(8), - MISSING(9), - OBSTRUCTED(10), - REVERTED(11), - RESOLVED(12), - COPIED(13), - MOVED(14), - RESTORED(15), - UPDATED(16), - EXTERNAL(18), - CORRUPTED(19), - NOT_REVERTED(20); +public enum VcsStatus { + UNKNOWN(-1), NOT_MODIFIED(0), ADDED(1), CONFLICTED(2), DELETED(3), MERGED(4), IGNORED(5), MODIFIED(6), REPLACED( + 7), UNVERSIONED(8), MISSING(9), OBSTRUCTED(10), REVERTED(11), RESOLVED(12), COPIED( + 13), MOVED(14), RESTORED(15), UPDATED(16), EXTERNAL(18), CORRUPTED(19), NOT_REVERTED(20); private int status; - - private VcsStatus(final int status) - { + private VcsStatus(final int status) { this.status = status; } @@ -56,8 +35,7 @@ public enum VcsStatus * * @return the status of FileObject */ - public int getStatus() - { + public int getStatus() { return status; } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsUpdate.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsUpdate.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsUpdate.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsUpdate.java Thu Sep 14 19:26:39 2017 @@ -22,8 +22,7 @@ import org.apache.commons.vfs2.operation * * @since 0.1 */ -public interface VcsUpdate extends FileOperation -{ +public interface VcsUpdate extends FileOperation { /** * * @param revision The revision number. Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsUpdateListener.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsUpdateListener.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsUpdateListener.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsUpdateListener.java Thu Sep 14 19:26:39 2017 @@ -20,8 +20,7 @@ package org.apache.commons.vfs2.operatio * * @since 0.1 */ -public interface VcsUpdateListener -{ +public interface VcsUpdateListener { /** * * @param path The path. Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java Thu Sep 14 19:26:39 2017 @@ -25,8 +25,7 @@ import org.apache.commons.vfs2.VFS; /** * A default file name implementation. */ -public abstract class AbstractFileName implements FileName -{ +public abstract class AbstractFileName implements FileName { private final String scheme; private final String absPath; @@ -41,37 +40,27 @@ public abstract class AbstractFileName i private String key = null; - public AbstractFileName(final String scheme, final String absPath, final FileType type) - { + public AbstractFileName(final String scheme, final String absPath, final FileType type) { this.rootUri = null; this.scheme = scheme; this.type = type; - if (absPath != null && absPath.length() > 0) - { - if (absPath.length() > 1 && absPath.endsWith("/")) - { + if (absPath != null && absPath.length() > 0) { + if (absPath.length() > 1 && absPath.endsWith("/")) { this.absPath = absPath.substring(0, absPath.length() - 1); - } - else - { + } else { this.absPath = absPath; } - } - else - { + } else { this.absPath = ROOT_PATH; } } @Override - public boolean equals(final Object o) - { - if (this == o) - { + public boolean equals(final Object o) { + if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) - { + if (o == null || getClass() != o.getClass()) { return false; } @@ -81,8 +70,7 @@ public abstract class AbstractFileName i } @Override - public int hashCode() - { + public int hashCode() { return getKey().hashCode(); } @@ -93,24 +81,24 @@ public abstract class AbstractFileName i * @return negative number if less than, 0 if equal, positive if greater than. */ @Override - public int compareTo(final FileName obj) - { + public int compareTo(final FileName obj) { final AbstractFileName name = (AbstractFileName) obj; return getKey().compareTo(name.getKey()); } /** * Returns the URI of the file. + * * @return the FileName as a URI. */ @Override - public String toString() - { + public String toString() { return getURI(); } /** * Factory method for creating name instances. + * * @param absolutePath The absolute path. * @param fileType The FileType. * @return The FileName. @@ -118,8 +106,8 @@ public abstract class AbstractFileName i public abstract FileName createName(String absolutePath, FileType fileType); /** - * Builds the root URI for this file name. Note that the root URI must not - * end with a separator character. + * Builds the root URI for this file name. Note that the root URI must not end with a separator character. + * * @param buffer A StringBuilder to use to construct the URI. * @param addPassword true if the password should be added, false otherwise. */ @@ -127,20 +115,16 @@ public abstract class AbstractFileName i /** * Returns the base name of the file. + * * @return The base name of the file. */ @Override - public String getBaseName() - { - if (baseName == null) - { + public String getBaseName() { + if (baseName == null) { final int idx = getPath().lastIndexOf(SEPARATOR_CHAR); - if (idx == -1) - { + if (idx == -1) { baseName = getPath(); - } - else - { + } else { baseName = getPath().substring(idx + 1); } } @@ -149,35 +133,31 @@ public abstract class AbstractFileName i } /** - * Returns the absolute path of the file, relative to the root of the - * file system that the file belongs to. + * Returns the absolute path of the file, relative to the root of the file system that the file belongs to. + * * @return The path String. */ @Override - public String getPath() - { - if (VFS.isUriStyle()) - { + public String getPath() { + if (VFS.isUriStyle()) { return absPath + getUriTrailer(); } return absPath; } - protected String getUriTrailer() - { + protected String getUriTrailer() { return getType().hasChildren() ? "/" : ""; } /** * Returns the decoded path. + * * @return The decoded path String. * @throws FileSystemException If an error occurs. */ @Override - public String getPathDecoded() throws FileSystemException - { - if (decodedAbsPath == null) - { + public String getPathDecoded() throws FileSystemException { + if (decodedAbsPath == null) { decodedAbsPath = UriParser.decode(getPath()); } @@ -186,25 +166,20 @@ public abstract class AbstractFileName i /** * Returns the name of the parent of the file. + * * @return the FileName of the parent. */ @Override - public FileName getParent() - { + public FileName getParent() { final String parentPath; final int idx = getPath().lastIndexOf(SEPARATOR_CHAR); - if (idx == -1 || idx == getPath().length() - 1) - { + if (idx == -1 || idx == getPath().length() - 1) { // No parent return null; - } - else if (idx == 0) - { + } else if (idx == 0) { // Root is the parent parentPath = SEPARATOR; - } - else - { + } else { parentPath = getPath().substring(0, idx); } return createName(parentPath, FileType.FOLDER); @@ -212,14 +187,13 @@ public abstract class AbstractFileName i /** * find the root of the filesystem. + * * @return The root FileName. */ @Override - public FileName getRoot() - { + public FileName getRoot() { FileName root = this; - while (root.getParent() != null) - { + while (root.getParent() != null) { root = root.getParent(); } @@ -228,41 +202,38 @@ public abstract class AbstractFileName i /** * Returns the URI scheme of this file. + * * @return The protocol used to access the file. */ @Override - public String getScheme() - { + public String getScheme() { return scheme; } /** * Returns the absolute URI of the file. + * * @return The absolute URI of the file. */ @Override - public String getURI() - { - if (uri == null) - { + public String getURI() { + if (uri == null) { uri = createURI(); } return uri; } - protected String createURI() - { + protected String createURI() { return createURI(false, true); } /** * Create a path that does not use the FileType since that field is not immutable. + * * @return The key. */ - private String getKey() - { - if (key == null) - { + private String getKey() { + if (key == null) { key = getURI(); } return key; @@ -274,29 +245,26 @@ public abstract class AbstractFileName i * @return Returns the URI without a password. */ @Override - public String getFriendlyURI() - { + public String getFriendlyURI() { return createURI(false, false); } - private String createURI(final boolean useAbsolutePath, final boolean usePassword) - { + private String createURI(final boolean useAbsolutePath, final boolean usePassword) { final StringBuilder buffer = new StringBuilder(); appendRootUri(buffer, usePassword); buffer.append(useAbsolutePath ? absPath : getPath()); return buffer.toString(); } - /** * Converts a file name to a relative name, relative to this file name. + * * @param name The FileName. * @return The relative path to the file. * @throws FileSystemException if an error occurs. */ @Override - public String getRelativeName(final FileName name) throws FileSystemException - { + public String getRelativeName(final FileName name) throws FileSystemException { final String path = name.getPath(); // Calculate the common prefix @@ -304,36 +272,28 @@ public abstract class AbstractFileName i final int pathLen = path.length(); // Deal with root - if (basePathLen == 1 && pathLen == 1) - { + if (basePathLen == 1 && pathLen == 1) { return "."; - } - else if (basePathLen == 1) - { + } else if (basePathLen == 1) { return path.substring(1); } final int maxlen = Math.min(basePathLen, pathLen); int pos = 0; - for (; pos < maxlen && getPath().charAt(pos) == path.charAt(pos); pos++) - { + for (; pos < maxlen && getPath().charAt(pos) == path.charAt(pos); pos++) { } - if (pos == basePathLen && pos == pathLen) - { + if (pos == basePathLen && pos == pathLen) { // Same names return "."; - } - else if (pos == basePathLen && pos < pathLen && path.charAt(pos) == SEPARATOR_CHAR) - { + } else if (pos == basePathLen && pos < pathLen && path.charAt(pos) == SEPARATOR_CHAR) { // A descendent of the base path return path.substring(pos + 1); } // Strip the common prefix off the path final StringBuilder buffer = new StringBuilder(); - if (pathLen > 1 && (pos < pathLen || getPath().charAt(pos) != SEPARATOR_CHAR)) - { + if (pathLen > 1 && (pos < pathLen || getPath().charAt(pos) != SEPARATOR_CHAR)) { // Not a direct ancestor, need to back up pos = getPath().lastIndexOf(SEPARATOR_CHAR, pos); buffer.append(path.substring(pos)); @@ -343,8 +303,7 @@ public abstract class AbstractFileName i // prefix buffer.insert(0, ".."); pos = getPath().indexOf(SEPARATOR_CHAR, pos + 1); - while (pos != -1) - { + while (pos != -1) { buffer.insert(0, "../"); pos = getPath().indexOf(SEPARATOR_CHAR, pos + 1); } @@ -354,13 +313,12 @@ public abstract class AbstractFileName i /** * Returns the root URI of the file system this file belongs to. + * * @return The URI of the root. */ @Override - public String getRootURI() - { - if (rootUri == null) - { + public String getRootURI() { + if (rootUri == null) { final StringBuilder buffer = new StringBuilder(); appendRootUri(buffer, true); buffer.append(SEPARATOR_CHAR); @@ -371,19 +329,17 @@ public abstract class AbstractFileName i /** * Returns the depth of this file name, within its file system. + * * @return The depth of the file name. */ @Override - public int getDepth() - { + public int getDepth() { final int len = getPath().length(); - if (len == 0 || len == 1 && getPath().charAt(0) == SEPARATOR_CHAR) - { + if (len == 0 || len == 1 && getPath().charAt(0) == SEPARATOR_CHAR) { return 0; } int depth = 1; - for (int pos = 0; pos > -1 && pos < len; depth++) - { + for (int pos = 0; pos > -1 && pos < len; depth++) { pos = getPath().indexOf(SEPARATOR_CHAR, pos + 1); } return depth; @@ -391,13 +347,12 @@ public abstract class AbstractFileName i /** * Returns the extension of this file name. + * * @return The file extension. */ @Override - public String getExtension() - { - if (extension == null) - { + public String getExtension() { + if (extension == null) { getBaseName(); final int pos = baseName.lastIndexOf('.'); // if ((pos == -1) || (pos == baseName.length() - 1)) @@ -405,13 +360,10 @@ public abstract class AbstractFileName i // do not treat filenames like // .bashrc c:\windows\.java c:\windows\.javaws c:\windows\.jedit c:\windows\.appletviewer // as extension - if (pos < 1 || pos == baseName.length() - 1) - { + if (pos < 1 || pos == baseName.length() - 1) { // No extension extension = ""; - } - else - { + } else { extension = baseName.substring(pos + 1).intern(); } } @@ -420,14 +372,13 @@ public abstract class AbstractFileName i /** * Determines if another file name is an ancestor of this file name. + * * @param ancestor The FileName to check. * @return true if the FileName is an ancestor, false otherwise. */ @Override - public boolean isAncestor(final FileName ancestor) - { - if (!ancestor.getRootURI().equals(getRootURI())) - { + public boolean isAncestor(final FileName ancestor) { + if (!ancestor.getRootURI().equals(getRootURI())) { return false; } return checkName(ancestor.getPath(), getPath(), NameScope.DESCENDENT); @@ -435,27 +386,25 @@ public abstract class AbstractFileName i /** * Determines if another file name is a descendent of this file name. + * * @param descendent The FileName to check. * @return true if the FileName is a descendent, false otherwise. */ @Override - public boolean isDescendent(final FileName descendent) - { + public boolean isDescendent(final FileName descendent) { return isDescendent(descendent, NameScope.DESCENDENT); } /** * Determines if another file name is a descendent of this file name. + * * @param descendent The FileName to check. * @param scope The NameScope. * @return true if the FileName is a descendent, false otherwise. */ @Override - public boolean isDescendent(final FileName descendent, - final NameScope scope) - { - if (!descendent.getRootURI().equals(getRootURI())) - { + public boolean isDescendent(final FileName descendent, final NameScope scope) { + if (!descendent.getRootURI().equals(getRootURI())) { return false; } return checkName(getPath(), descendent.getPath(), scope); @@ -470,8 +419,7 @@ public abstract class AbstractFileName i * @see FileType#FILE */ @Override - public boolean isFile() throws FileSystemException - { + public boolean isFile() throws FileSystemException { // Use equals instead of == to avoid any class loader worries. return FileType.FILE.equals(this.getType()); } @@ -479,17 +427,15 @@ public abstract class AbstractFileName i /** * Returns the requested or current type of this name. * <p> - * The "requested" type is the one determined during resolving the name. - * n this case the name is a {@link FileType#FOLDER} if it ends with an "/" else - * it will be a {@link FileType#FILE}. + * The "requested" type is the one determined during resolving the name. n this case the name is a + * {@link FileType#FOLDER} if it ends with an "/" else it will be a {@link FileType#FILE}. * <p> * Once attached it will be changed to reflect the real type of this resource. * * @return {@link FileType#FOLDER} or {@link FileType#FILE} */ @Override - public FileType getType() - { + public FileType getType() { return type; } @@ -499,10 +445,8 @@ public abstract class AbstractFileName i * @param type {@link FileType#FOLDER} or {@link FileType#FILE} * @throws FileSystemException if an error occurs. */ - void setType(final FileType type) throws FileSystemException - { - if (type != FileType.FOLDER && type != FileType.FILE && type != FileType.FILE_OR_FOLDER) - { + void setType(final FileType type) throws FileSystemException { + if (type != FileType.FOLDER && type != FileType.FILE && type != FileType.FILE_OR_FOLDER) { throw new FileSystemException("vfs.provider/filename-type.error"); } @@ -513,60 +457,40 @@ public abstract class AbstractFileName i * Checks whether a path fits in a particular scope of another path. * * @param basePath An absolute, normalised path. - * @param path An absolute, normalised path. + * @param path An absolute, normalised path. * @param scope The NameScope. * @return true if the path fits in the scope, false otherwise. */ - public static boolean checkName(final String basePath, - final String path, - final NameScope scope) - { - if (scope == NameScope.FILE_SYSTEM) - { + public static boolean checkName(final String basePath, final String path, final NameScope scope) { + if (scope == NameScope.FILE_SYSTEM) { // All good return true; } - if (!path.startsWith(basePath)) - { + if (!path.startsWith(basePath)) { return false; } int baseLen = basePath.length(); - if (VFS.isUriStyle()) - { + if (VFS.isUriStyle()) { // strip the trailing "/" baseLen--; } - if (scope == NameScope.CHILD) - { - if (path.length() == baseLen - || baseLen > 1 && path.charAt(baseLen) != SEPARATOR_CHAR - || path.indexOf(SEPARATOR_CHAR, baseLen + 1) != -1) - { + if (scope == NameScope.CHILD) { + if (path.length() == baseLen || baseLen > 1 && path.charAt(baseLen) != SEPARATOR_CHAR + || path.indexOf(SEPARATOR_CHAR, baseLen + 1) != -1) { return false; } - } - else if (scope == NameScope.DESCENDENT) - { - if (path.length() == baseLen - || baseLen > 1 && path.charAt(baseLen) != SEPARATOR_CHAR) - { + } else if (scope == NameScope.DESCENDENT) { + if (path.length() == baseLen || baseLen > 1 && path.charAt(baseLen) != SEPARATOR_CHAR) { return false; } - } - else if (scope == NameScope.DESCENDENT_OR_SELF) - { - if (baseLen > 1 - && path.length() > baseLen - && path.charAt(baseLen) != SEPARATOR_CHAR) - { + } else if (scope == NameScope.DESCENDENT_OR_SELF) { + if (baseLen > 1 && path.length() > baseLen && path.charAt(baseLen) != SEPARATOR_CHAR) { return false; } - } - else if (scope != NameScope.FILE_SYSTEM) - { + } else if (scope != NameScope.FILE_SYSTEM) { throw new IllegalArgumentException(); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileNameParser.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileNameParser.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileNameParser.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileNameParser.java Thu Sep 14 19:26:39 2017 @@ -19,11 +19,9 @@ package org.apache.commons.vfs2.provider /** * Provides methods to parse a filename into a {@link org.apache.commons.vfs2.FileName}. */ -public abstract class AbstractFileNameParser implements FileNameParser -{ +public abstract class AbstractFileNameParser implements FileNameParser { @Override - public boolean encodeCharacter(final char ch) - { + public boolean encodeCharacter(final char ch) { return ch == '%'; } }
