summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Egnor <egnor@google.com>2010-03-03 16:22:41 -0800
committerDan Egnor <egnor@google.com>2010-03-03 16:22:41 -0800
commit64b058597da6260646ba8dc68fdcfb3982b16bff (patch)
treee4dc609a9acbd68d79d17b4d014dc32c1c988d69
parentdfa4254ca189a7a128ae76b558d60cbe3139f563 (diff)
downloadoauth-64b058597da6260646ba8dc68fdcfb3982b16bff.tar.gz
Use Android Base64 class, instead of the Apache commons one
that isn't even in the public SDK.
-rw-r--r--core/src/main/java/Android.mk2
-rwxr-xr-xcore/src/main/java/net/oauth/signature/OAuthSignatureMethod.java13
2 files changed, 9 insertions, 6 deletions
diff --git a/core/src/main/java/Android.mk b/core/src/main/java/Android.mk
index c76a3f9..7a48084 100644
--- a/core/src/main/java/Android.mk
+++ b/core/src/main/java/Android.mk
@@ -8,7 +8,7 @@ LOCAL_MODULE := oauth
LOCAL_SRC_FILES := \
$(call all-java-files-under, net)
-#LOCAL_SDK_VERSION := current
+LOCAL_SDK_VERSION := current
# Build the actual static library
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/core/src/main/java/net/oauth/signature/OAuthSignatureMethod.java b/core/src/main/java/net/oauth/signature/OAuthSignatureMethod.java
index 967153d..b0384d5 100755
--- a/core/src/main/java/net/oauth/signature/OAuthSignatureMethod.java
+++ b/core/src/main/java/net/oauth/signature/OAuthSignatureMethod.java
@@ -31,7 +31,10 @@ import net.oauth.OAuthConsumer;
import net.oauth.OAuthException;
import net.oauth.OAuthMessage;
import net.oauth.OAuthProblemException;
-import org.apache.commons.codec.binary.Base64;
+// BEGIN android-changed
+// import org.apache.commons.codec.binary.Base64;
+import android.util.base64.Base64;
+// END android-changed
/**
* A pair of algorithms for computing and verifying an OAuth digital signature.
@@ -190,15 +193,15 @@ public abstract class OAuthSignatureMethod {
return OAuth.formEncode(getParameters(p));
}
+ // BEGIN android-changed
public static byte[] decodeBase64(String s) {
- return BASE64.decode(s.getBytes());
+ return Base64.decode(s, Base64.DEFAULT);
}
public static String base64Encode(byte[] b) {
- return new String(BASE64.encode(b));
+ return Base64.encodeToString(b, Base64.DEFAULT);
}
-
- private static final Base64 BASE64 = new Base64();
+ // END android-changed
public static OAuthSignatureMethod newSigner(OAuthMessage message,
OAuthAccessor accessor) throws IOException, OAuthException {