You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/03/28 12:30:38 UTC
[commons-vfs] branch master updated (4752bbb -> adf6aca)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git.
from 4752bbb Revert "[VFS-798] IllegalArgumentException: Bad escape for Chinese characters in FileObject path."
new e434635 In-line local var. Better local name. Formatting. Comment empty blocks.
new c18fb6c Use StringUtils.isEmpty().
new 7c83a0e Normalize to US spelling (pun unintended).
new 94b2c74 Javadoc.
new adf6aca Lambdas.
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/commons/vfs2/provider/AbstractFileSystem.java | 3 +--
.../apache/commons/vfs2/provider/HostFileNameParser.java | 8 ++++----
.../java/org/apache/commons/vfs2/provider/UriParser.java | 4 ++--
.../commons/vfs2/provider/local/LocalFileNameParser.java | 14 +++++++-------
.../commons/vfs2/provider/local/WindowsFileNameParser.java | 3 +++
.../org/apache/commons/vfs2/provider/url/UrlFileName.java | 7 ++++---
.../commons/vfs2/provider/DefaultFileContentTest.java | 6 +++---
7 files changed, 24 insertions(+), 21 deletions(-)
[commons-vfs] 03/05: Normalize to US spelling (pun unintended).
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
commit 7c83a0eeef87214cd14e695806af9b1b08ea9383
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 28 08:09:33 2021 -0400
Normalize to US spelling (pun unintended).
---
.../java/org/apache/commons/vfs2/provider/HostFileNameParser.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java
index 07c90ce..a3bcb7c 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java
@@ -279,7 +279,7 @@ public class HostFileNameParser extends AbstractFileNameParser {
}
}
- // Extract hostname, and normalise (lowercase)
+ // Extract hostname, and normalize (lowercase)
final String hostName = extractHostName(name);
if (hostName == null) {
throw new FileSystemException("vfs.provider/missing-hostname.error", uri);
@@ -336,7 +336,7 @@ public class HostFileNameParser extends AbstractFileNameParser {
// Extract the scheme and authority parts
final Authority auth = extractToPath(context, fileName, name);
- // Decode and normalise the file name
+ // Decode and normalize the file name
UriParser.canonicalizePath(name, 0, name.length(), this);
UriParser.fixSeparators(name);
final FileType fileType = UriParser.normalisePath(name);
[commons-vfs] 01/05: In-line local var. Better local name.
Formatting. Comment empty blocks.
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
commit e4346352fa7d9d55e290b150d162888f9a632bf0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 28 07:59:34 2021 -0400
In-line local var. Better local name. Formatting. Comment empty blocks.
---
.../apache/commons/vfs2/provider/AbstractFileSystem.java | 3 +--
.../java/org/apache/commons/vfs2/provider/UriParser.java | 4 ++--
.../commons/vfs2/provider/local/LocalFileNameParser.java | 14 +++++++-------
.../commons/vfs2/provider/local/WindowsFileNameParser.java | 3 +++
4 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
index 4b7ef76..4ee98d6 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
@@ -292,8 +292,7 @@ public abstract class AbstractFileSystem extends AbstractVfsComponent implements
@Override
public FileObject resolveFile(final String nameStr) throws FileSystemException {
// Resolve the name, and create the file
- final FileName name = getFileSystemManager().resolveName(rootName, nameStr);
- return resolveFile(name);
+ return resolveFile(getFileSystemManager().resolveName(rootName, nameStr));
}
/**
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
index 8789177..aa24f88 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
@@ -333,8 +333,8 @@ public final class UriParser {
buffer.setLength(0);
buffer.append(uri);
}
- for(final String scheme : schemes) {
- if(uri.startsWith(scheme + ":")) {
+ for (final String scheme : schemes) {
+ if (uri.startsWith(scheme + ":")) {
if (buffer != null) {
buffer.delete(0, uri.indexOf(':') + 1);
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileNameParser.java
index b012932..676a93b 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileNameParser.java
@@ -71,10 +71,10 @@ public abstract class LocalFileNameParser extends AbstractFileNameParser {
@Override
public FileName parseUri(final VfsComponentContext context, final FileName base, final String uri)
throws FileSystemException {
- final StringBuilder name = new StringBuilder();
+ final StringBuilder nameBuilder = new StringBuilder();
// Extract the scheme
- String scheme = UriParser.extractScheme(getSchemes(context, base, uri), uri, name);
+ String scheme = UriParser.extractScheme(getSchemes(context, base, uri), uri, nameBuilder);
if (scheme == null && base != null) {
scheme = base.getScheme();
}
@@ -83,17 +83,17 @@ public abstract class LocalFileNameParser extends AbstractFileNameParser {
}
// Remove encoding, and adjust the separators
- UriParser.canonicalizePath(name, 0, name.length(), this);
+ UriParser.canonicalizePath(nameBuilder, 0, nameBuilder.length(), this);
- UriParser.fixSeparators(name);
+ UriParser.fixSeparators(nameBuilder);
// Extract the root prefix
- final String rootFile = extractRootPrefix(uri, name);
+ final String rootFile = extractRootPrefix(uri, nameBuilder);
// Normalise the path
- final FileType fileType = UriParser.normalisePath(name);
+ final FileType fileType = UriParser.normalisePath(nameBuilder);
- final String path = name.toString();
+ final String path = nameBuilder.toString();
return createFileName(scheme, rootFile, path, fileType);
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileNameParser.java
index 68a2939..64b8642 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileNameParser.java
@@ -78,6 +78,7 @@ public class WindowsFileNameParser extends LocalFileNameParser {
final int maxpos = name.length();
int pos = 0;
for (; pos < maxpos && name.charAt(pos) != '/'; pos++) {
+ // empty
}
pos++;
if (pos >= maxpos) {
@@ -87,6 +88,7 @@ public class WindowsFileNameParser extends LocalFileNameParser {
// Now have <name> '/'
final int startShareName = pos;
for (; pos < maxpos && name.charAt(pos) != '/'; pos++) {
+ // empty
}
if (pos == startShareName) {
throw new FileSystemException("vfs.provider.local/missing-share-name.error", uri);
@@ -110,6 +112,7 @@ public class WindowsFileNameParser extends LocalFileNameParser {
int startPos = 0;
final int maxlen = Math.min(4, name.length());
for (; startPos < maxlen && name.charAt(startPos) == '/'; startPos++) {
+ // empty
}
if (startPos == maxlen && name.length() > (startPos + 1) && name.charAt(startPos + 1) == '/') {
// Too many '/'
[commons-vfs] 05/05: Lambdas.
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
commit adf6acaaf0806f22553a9d42f581ed068e58485a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 28 08:30:34 2021 -0400
Lambdas.
---
.../org/apache/commons/vfs2/provider/DefaultFileContentTest.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/DefaultFileContentTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/DefaultFileContentTest.java
index c483981..44a3c99 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/DefaultFileContentTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/DefaultFileContentTest.java
@@ -84,7 +84,7 @@ public class DefaultFileContentTest {
@Test
public void testInputStreamClosedInADifferentThread() throws Exception {
- testStreamClosedInADifferentThread(content -> content.getInputStream());
+ testStreamClosedInADifferentThread(FileContent::getInputStream);
}
@Test
@@ -177,7 +177,7 @@ public class DefaultFileContentTest {
@Test
public void testOutputStreamClosedInADifferentThread() throws Exception {
- testStreamClosedInADifferentThread(content -> content.getOutputStream());
+ testStreamClosedInADifferentThread(FileContent::getOutputStream);
}
private <T extends Closeable> void testStreamClosedInADifferentThread(final FailableFunction<FileContent, T, IOException> getStream) throws Exception {
@@ -190,7 +190,7 @@ public class DefaultFileContentTest {
final Thread thread = new Thread(() -> {
try {
stream.close();
- } catch (IOException exception) {
+ } catch (final IOException exception) {
// ignore
}
check.set(true);
[commons-vfs] 04/05: Javadoc.
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
commit 94b2c74057df9244d7537fa33e0e8e319e29a6da
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 28 08:10:54 2021 -0400
Javadoc.
---
.../java/org/apache/commons/vfs2/provider/HostFileNameParser.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java
index a3bcb7c..e602cc3 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java
@@ -27,10 +27,10 @@ import org.apache.commons.vfs2.util.CryptorFactory;
/**
* Implementation for any URL based file system.
* <p>
- * Parses the URL into user/password/host/port/path. Does not handle a query string (after ?)
+ * Parses the URL into user/password/host/port/path. Does not handle a query string (after ?).
* </p>
*
- * @see URLFileNameParser URLFileNameParser for the implementation which also handles the query string too
+ * @see URLFileNameParser URLFileNameParser for the implementation which also handles the query string too.
*/
public class HostFileNameParser extends AbstractFileNameParser {
/**
[commons-vfs] 02/05: Use StringUtils.isEmpty().
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
commit c18fb6ce480547fad2d0e2fae999bac9d2afd489
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 28 08:07:05 2021 -0400
Use StringUtils.isEmpty().
---
.../java/org/apache/commons/vfs2/provider/url/UrlFileName.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileName.java
index ff35c31..73c887f 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileName.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileName.java
@@ -16,6 +16,7 @@
*/
package org.apache.commons.vfs2.provider.url;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.vfs2.FileType;
import org.apache.commons.vfs2.provider.URLFileName;
@@ -38,14 +39,14 @@ public class UrlFileName extends URLFileName {
* @param queryString Parameters to use when locating or creating the file name.
*/
public UrlFileName(final String scheme, final String hostName, final int port, final int defaultPort,
- final String userName, final String password, final String path, final FileType type,
- final String queryString) {
+ final String userName, final String password, final String path, final FileType type,
+ final String queryString) {
super(scheme, hostName, port, defaultPort, userName, password, path, type, queryString);
}
@Override
protected void appendRootUri(final StringBuilder buffer, final boolean addPassword) {
- if (getHostName() != null && !"".equals(getHostName())) {
+ if (!StringUtils.isEmpty(getHostName())) {
super.appendRootUri(buffer, addPassword);
return;
}