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 2020/12/16 22:29:52 UTC

[commons-vfs] branch master updated (1db6b4b -> c571535)

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 1db6b4b  Fix Spotbugs issue.
     new a4b8872  Fix Spotbugs issue and stay platform independent.
     new 4f43195  Oops, forgot to make this constant final.
     new c571535  Fix Spotbugs issue.

The 3 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:
 .../src/main/java/org/apache/commons/vfs2/util/DefaultCryptor.java | 7 +++++--
 .../main/java/org/apache/commons/vfs2/util/FileObjectUtils.java    | 2 +-
 .../src/main/java/org/apache/commons/vfs2/util/URIUtils.java       | 3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)


[commons-vfs] 01/03: Fix Spotbugs issue and stay platform independent.

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 a4b8872c561cd441a28c07afb860f7ca0e62738f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 16 17:16:56 2020 -0500

    Fix Spotbugs issue and stay platform independent.
---
 .../src/main/java/org/apache/commons/vfs2/util/DefaultCryptor.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DefaultCryptor.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DefaultCryptor.java
index 3d6b754..58a404c 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DefaultCryptor.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DefaultCryptor.java
@@ -16,6 +16,9 @@
  */
 package org.apache.commons.vfs2.util;
 
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+
 import javax.crypto.Cipher;
 import javax.crypto.spec.SecretKeySpec;
 
@@ -53,7 +56,7 @@ public class DefaultCryptor implements Cryptor {
      */
     @Override
     public String encrypt(final String plainKey) throws Exception {
-        final byte[] input = plainKey.getBytes();
+        final byte[] input = plainKey.getBytes(StandardCharsets.UTF_8);
         final SecretKeySpec key = new SecretKeySpec(KEY_BYTES, "AES");
 
         final Cipher cipher = Cipher.getInstance("AES");
@@ -83,7 +86,7 @@ public class DefaultCryptor implements Cryptor {
         final byte[] plainText = new byte[cipher.getOutputSize(decoded.length)];
         int ptLength = cipher.update(decoded, 0, decoded.length, plainText, 0);
         ptLength += cipher.doFinal(plainText, ptLength);
-        return new String(plainText).substring(0, ptLength);
+        return new String(plainText, StandardCharsets.UTF_8).substring(0, ptLength);
     }
 
     /** Hex-encode bytes. */


[commons-vfs] 02/03: Oops, forgot to make this constant final.

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 4f4319510fc3c2057a8e59684d1fe567d59e6c2f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 16 17:19:00 2020 -0500

    Oops, forgot to make this constant final.
---
 .../src/main/java/org/apache/commons/vfs2/util/FileObjectUtils.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/FileObjectUtils.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/FileObjectUtils.java
index 38234f1..daf2ddb 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/FileObjectUtils.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/FileObjectUtils.java
@@ -38,7 +38,7 @@ public final class FileObjectUtils {
      * 
      * @since 2.9.0
      */
-    public static FileObject[] EMPTY_ARRAY = new FileObject[0];
+    public static final FileObject[] EMPTY_ARRAY = new FileObject[0];
 
     /**
      * Null-safe call to {@link FileObject#exists()}.


[commons-vfs] 03/03: Fix Spotbugs issue.

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 c571535880573d09d21af78523b68b1eba28201f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 16 17:20:18 2020 -0500

    Fix Spotbugs issue.
---
 commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIUtils.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIUtils.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIUtils.java
index 76779f0..18be01b 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIUtils.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIUtils.java
@@ -18,6 +18,7 @@ package org.apache.commons.vfs2.util;
 
 import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
 import java.util.BitSet;
 
 import org.apache.commons.logging.Log;
@@ -88,7 +89,7 @@ public class URIUtils {
                     LOG.warn("Unsupported encoding: " + charset + ". System encoding used.");
                 }
 
-                return data.getBytes();
+                return data.getBytes(Charset.defaultCharset());
             }
         }