summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2016-12-29 19:50:29 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2016-12-29 19:50:29 +0100
commit29ddbf7fcd48f167e4a02b6ee61e9f8697a7175c (patch)
treea2e73fd6cb3cfa1f1d88ae3c76e05076816cb7c5 /org.eclipse.jgit
parentf211bfc8411cd57e6591cbacab21e004a14553dd (diff)
downloadjgit-29ddbf7fcd48f167e4a02b6ee61e9f8697a7175c.tar.gz
jgit-29ddbf7fcd48f167e4a02b6ee61e9f8697a7175c.zip
[findBugs] Remove reliance on default encoding in Base64
Change-Id: I6901da975a86c460ce7c783a519669d8be8e23bb Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java14
1 files changed, 3 insertions, 11 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
index ed5838a20e..c05570b851 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
@@ -7,6 +7,7 @@
package org.eclipse.jgit.util;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import java.util.Arrays;
@@ -184,11 +185,7 @@ public class Base64 {
e += 4;
}
- try {
- return new String(outBuff, 0, e, UTF_8);
- } catch (UnsupportedEncodingException uue) {
- return new String(outBuff, 0, e);
- }
+ return new String(outBuff, 0, e, StandardCharsets.UTF_8);
}
/**
@@ -304,12 +301,7 @@ public class Base64 {
* @return the decoded data
*/
public static byte[] decode(String s) {
- byte[] bytes;
- try {
- bytes = s.getBytes(UTF_8);
- } catch (UnsupportedEncodingException uee) {
- bytes = s.getBytes();
- }
+ byte[] bytes = s.getBytes(StandardCharsets.UTF_8);
return decode(bytes, 0, bytes.length);
}
}
} /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.7" sequenceNumber="1574722378">
  <locations>
    <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
      <unit id="org.eclipse.jetty.client" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.client.source" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.continuation" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.continuation.source" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.http" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.http.source" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.io" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.io.source" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.security" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.security.source" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.server" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.server.source" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.servlet" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.servlet.source" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.util" version="9.4.22.v20191022"/>
      <unit id="org.eclipse.jetty.util.source" version="9.4.22.v20191022"/>
      <repository id="jetty-9.4.22" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.22.v20191022/"/>
    </location>
    <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
      <unit id="com.google.gson" version="2.8.2.v20180104-1110"/>
      <unit id="com.google.gson.source" version="2.8.2.v20180104-1110"/>
      <unit id="com.jcraft.jsch" version="0.1.55.v20190404-1902"/>
      <unit id="com.jcraft.jsch.source" version="0.1.55.v20190404-1902"/>
      <unit id="com.jcraft.jzlib" version="1.1.1.v201205102305"/>
      <unit id="com.jcraft.jzlib.source" version="1.1.1.v201205102305"/>
      <unit id="javaewah" version="1.1.6.v20160919-1400"/>
      <unit id="javaewah.source" version="1.1.6.v20160919-1400"/>
      <unit id="javax.servlet" version="3.1.0.v201410161800"/>
      <unit id="javax.servlet.source" version="3.1.0.v201410161800"/>
      <unit id="net.bytebuddy.byte-buddy" version="1.9.0.v20181107-1410"/>
      <unit id="net.bytebuddy.byte-buddy-agent" version="1.9.0.v20181106-1534"/>
      <unit id="net.bytebuddy.byte-buddy-agent.source" version="1.9.0.v20181106-1534"/>
      <unit id="net.bytebuddy.byte-buddy.source" version="1.9.0.v20181107-1410"/>
      <unit id="net.i2p.crypto.eddsa" version="0.3.0.v20181102-1323"/>
      <unit id="net.i2p.crypto.eddsa.source" version="0.3.0.v20181102-1323"/>
      <unit id="org.apache.ant" version="1.10.7.v20190926-0324"/>
      <unit id="org.apache.ant.source" version="1.10.7.v20190926-0324"/>
      <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
      <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
      <unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
      <unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/>
      <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
      <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
      <unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190503-0009"/>
      <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190503-0009"/>
      <unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/>
      <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/>
      <unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
      <unit id="org.apache.log4j.source" version="1.2.15.v201012070815"/>
      <unit id="org.apache.sshd.osgi" version="2.2.0.v20190425-2127"/>
      <unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/>
      <unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/>
      <unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/>
      <unit id="org.bouncycastle.bcpg" version="1.64.0.v20191109-0815"/>
      <unit id="org.bouncycastle.bcpg.source" version="1.64.0.v20191109-0815"/>
      <unit id="org.bouncycastle.bcpkix" version="1.64.0.v20191109-0815"/>
      <unit id="org.bouncycastle.bcpkix.source" version="1.64.0.v20191109-0815"/>
      <unit id="org.bouncycastle.bcprov" version="1.64.0.v20191109-0815"/>
      <unit id="org.bouncycastle.bcprov.source" version="1.64.0.v20191109-0815"/>
      <unit id="org.hamcrest" version="1.1.0.v20090501071000"/>
      <unit id="org.hamcrest.core" version="1.3.0.v20180420-1519"/>
      <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
      <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
      <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
      <unit id="org.junit" version="4.12.0.v201504281640"/>
      <unit id="org.junit.source" version="4.12.0.v201504281640"/>
      <unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
      <unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
      <unit id="org.mockito" version="2.23.0.v20190527-1420"/>
      <unit id="org.mockito.source" version="2.23.0.v20190527-1420"/>
      <unit id="org.objenesis" version="2.6.0.v20180420-1519"/>
      <unit id="org.objenesis.source" version="2.6.0.v20180420-1519"/>
      <unit id="org.slf4j.api" version="1.7.2.v20121108-1250"/>
      <unit id="org.slf4j.api.source" version="1.7.2.v20121108-1250"/>
      <unit id="org.slf4j.impl.log4j12" version="1.7.2.v20131105-2200"/>
      <unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
      <unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
      <unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
      <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20191118194249/repository"/>
    </location>
    <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
      <unit id="org.eclipse.osgi" version="0.0.0"/>
      <repository location="http://download.eclipse.org/releases/oxygen/"/>
    </location>
  </locations>
</target>