diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-05-15 13:54:44 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-05-15 13:54:54 +0200 |
commit | b1e62699ff74c09b2cf7313ef8a33d5ea7b0ae5f (patch) | |
tree | 21efd2dbbd3492a6f518fcd57de4888e1bfb4c3b /server/sonar-process | |
parent | 6a19a67a23a39848c28ae3cf2d189bf926fadf9b (diff) | |
download | sonarqube-b1e62699ff74c09b2cf7313ef8a33d5ea7b0ae5f.tar.gz sonarqube-b1e62699ff74c09b2cf7313ef8a33d5ea7b0ae5f.zip |
Use StandardCharsets instead of Guava and commons-io
Diffstat (limited to 'server/sonar-process')
3 files changed, 8 insertions, 7 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/AesCipher.java b/server/sonar-process/src/main/java/org/sonar/process/AesCipher.java index f98f1fe65dd..7759e1ab2fa 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/AesCipher.java +++ b/server/sonar-process/src/main/java/org/sonar/process/AesCipher.java @@ -20,7 +20,6 @@ package org.sonar.process; -import org.apache.commons.io.Charsets; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; @@ -32,6 +31,7 @@ import javax.crypto.spec.SecretKeySpec; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.security.Key; import java.security.SecureRandom; @@ -74,7 +74,7 @@ final class AesCipher implements Cipher { javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(CRYPTO_KEY); cipher.init(javax.crypto.Cipher.DECRYPT_MODE, loadSecretFile()); byte[] cipherData = cipher.doFinal(Base64.decodeBase64(StringUtils.trim(encryptedText))); - return new String(cipherData, Charsets.UTF_8); + return new String(cipherData, StandardCharsets.UTF_8); } catch (RuntimeException e) { throw e; } catch (Exception e) { diff --git a/server/sonar-process/src/main/java/org/sonar/process/Base64Cipher.java b/server/sonar-process/src/main/java/org/sonar/process/Base64Cipher.java index ca9044850e9..209588e2d90 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/Base64Cipher.java +++ b/server/sonar-process/src/main/java/org/sonar/process/Base64Cipher.java @@ -21,16 +21,17 @@ package org.sonar.process; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.Charsets; + +import java.nio.charset.StandardCharsets; final class Base64Cipher implements Cipher { @Override public String encrypt(String clearText) { - return Base64.encodeBase64String(clearText.getBytes(Charsets.UTF_8)); + return Base64.encodeBase64String(clearText.getBytes(StandardCharsets.UTF_8)); } @Override public String decrypt(String encryptedText) { - return new String(Base64.decodeBase64(encryptedText), Charsets.UTF_8); + return new String(Base64.decodeBase64(encryptedText), StandardCharsets.UTF_8); } } diff --git a/server/sonar-process/src/main/java/org/sonar/process/ConfigurationUtils.java b/server/sonar-process/src/main/java/org/sonar/process/ConfigurationUtils.java index 458cf031722..a9e27300f1f 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/ConfigurationUtils.java +++ b/server/sonar-process/src/main/java/org/sonar/process/ConfigurationUtils.java @@ -19,7 +19,6 @@ */ package org.sonar.process; -import org.apache.commons.io.Charsets; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.text.StrSubstitutor; @@ -28,6 +27,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.nio.charset.StandardCharsets; import java.util.Enumeration; import java.util.Map; import java.util.Properties; @@ -60,7 +60,7 @@ public final class ConfigurationUtils { Properties properties = new Properties(); Reader reader = null; try { - reader = new InputStreamReader(new FileInputStream(propertyFile), Charsets.UTF_8); + reader = new InputStreamReader(new FileInputStream(propertyFile), StandardCharsets.UTF_8); properties.load(reader); } catch (Exception e) { throw new IllegalStateException("Could not read properties from file: " + args[0], e); |