diff --git a/.classpath b/.classpath index d47d4cf37..9ba6b8726 100644 --- a/.classpath +++ b/.classpath @@ -8,7 +8,5 @@ - - diff --git a/compile-only-libs/commons-codec-1.3.jar b/compile-only-libs/commons-codec-1.3.jar deleted file mode 100644 index 957b6752a..000000000 Binary files a/compile-only-libs/commons-codec-1.3.jar and /dev/null differ diff --git a/compile-only-libs/commons-logging-1.1.1.jar b/compile-only-libs/commons-logging-1.1.1.jar deleted file mode 100644 index 8758a96b7..000000000 Binary files a/compile-only-libs/commons-logging-1.1.1.jar and /dev/null differ diff --git a/src/com/fsck/k9/mail/filter/Base64.java b/src/com/fsck/k9/mail/filter/Base64.java index 6c8bf7ac1..fc8bd4682 100644 --- a/src/com/fsck/k9/mail/filter/Base64.java +++ b/src/com/fsck/k9/mail/filter/Base64.java @@ -17,11 +17,6 @@ package com.fsck.k9.mail.filter; -import org.apache.commons.codec.BinaryDecoder; -import org.apache.commons.codec.BinaryEncoder; -import org.apache.commons.codec.DecoderException; -import org.apache.commons.codec.EncoderException; - import java.io.UnsupportedEncodingException; import java.math.BigInteger; @@ -38,7 +33,7 @@ import java.math.BigInteger; * @since 1.0-dev * @version $Id$ */ -public class Base64 implements BinaryEncoder, BinaryDecoder { +public class Base64 { /** * Chunk size per RFC 2045 section 6.8. * @@ -759,4 +754,16 @@ public class Base64 implements BinaryEncoder, BinaryDecoder { return resizedBytes; } + + static class DecoderException extends Exception { + DecoderException(String error) { + super(error); + } + } + + static class EncoderException extends Exception { + EncoderException(String error) { + super(error); + } + } } diff --git a/src/com/fsck/k9/mail/filter/Hex.java b/src/com/fsck/k9/mail/filter/Hex.java new file mode 100644 index 000000000..5bbcf7b05 --- /dev/null +++ b/src/com/fsck/k9/mail/filter/Hex.java @@ -0,0 +1,57 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fsck.k9.mail.filter; + +/** + * This code was copied from the Apache Commons project. + * The unnecessary parts have been left out. + */ +public class Hex +{ + /** + * Used building output as Hex + */ + private static final char[] DIGITS = { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' + }; + + /** + * Converts an array of bytes into an array of characters representing the hexidecimal values of each byte in order. + * The returned array will be double the length of the passed array, as it takes two characters to represent any + * given byte. + * + * @param data + * a byte[] to convert to Hex characters + * @return A char[] containing hexidecimal characters + */ + public static char[] encodeHex(byte[] data) { + + int l = data.length; + + char[] out = new char[l << 1]; + + // two characters form the hex value. + for (int i = 0, j = 0; i < l; i++) { + out[j++] = DIGITS[(0xF0 & data[i]) >>> 4 ]; + out[j++] = DIGITS[ 0x0F & data[i] ]; + } + + return out; + } + +} diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index a385c52f2..12b7628d7 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -47,9 +47,6 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; import javax.net.ssl.TrustManager; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.binary.Hex; - import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; @@ -76,9 +73,11 @@ import com.fsck.k9.mail.Part; import com.fsck.k9.mail.PushReceiver; import com.fsck.k9.mail.Pusher; import com.fsck.k9.mail.Store; +import com.fsck.k9.mail.filter.Base64; import com.fsck.k9.mail.filter.CountingOutputStream; import com.fsck.k9.mail.filter.EOLConvertingOutputStream; import com.fsck.k9.mail.filter.FixedLengthInputStream; +import com.fsck.k9.mail.filter.Hex; import com.fsck.k9.mail.filter.PeekableInputStream; import com.fsck.k9.mail.internet.MimeBodyPart; import com.fsck.k9.mail.internet.MimeHeader; diff --git a/src/com/fsck/k9/mail/transport/SmtpTransport.java b/src/com/fsck/k9/mail/transport/SmtpTransport.java index 552c883fc..5b9924347 100644 --- a/src/com/fsck/k9/mail/transport/SmtpTransport.java +++ b/src/com/fsck/k9/mail/transport/SmtpTransport.java @@ -7,6 +7,7 @@ import com.fsck.k9.mail.*; import com.fsck.k9.mail.Message.RecipientType; import com.fsck.k9.mail.filter.Base64; import com.fsck.k9.mail.filter.EOLConvertingOutputStream; +import com.fsck.k9.mail.filter.Hex; import com.fsck.k9.mail.filter.LineWrapOutputStream; import com.fsck.k9.mail.filter.PeekableInputStream; import com.fsck.k9.mail.filter.SmtpDataStuffing; @@ -26,7 +27,6 @@ import java.security.GeneralSecurityException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; -import org.apache.commons.codec.binary.Hex; import java.util.*;