geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick McGuire <rick...@gmail.com>
Subject Re: svn commit: r412426 - in /geronimo/specs/trunk/geronimo-spec-javamail/src: main/java/javax/mail/internet/ main/java/org/apache/geronimo/mail/util/ test/java/javax/mail/internet/
Date Thu, 08 Jun 2006 12:44:15 GMT
Kevan Miller wrote:
> Rick,
> If you're updating javamail, you need to update the version number for 
> the javamail spec.
> --kevan
I was sort of wondering if anything needed to be done there.  I assume 
it should be changed from 1.1 to 1.1.1?

Rick

> On Jun 7, 2006, at 11:21 AM, rickmcguire@apache.org wrote:
>
>> Author: rickmcguire
>> Date: Wed Jun  7 08:21:46 2006
>> New Revision: 412426
>>
>> URL: http://svn.apache.org/viewvc?rev=412426&view=rev
>> Log:
>> GERONIMO-2087 MimeUtility.encodeWord()/encodeText() have some errors.
>>
>>
>> Modified:
>>     
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/internet/MimeUtility.java

>>
>>     
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/Base64Encoder.java

>>
>>     
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/RFC2231Encoder.java

>>
>>     
>> geronimo/specs/trunk/geronimo-spec-javamail/src/test/java/javax/mail/internet/MimeUtilityTest.java

>>
>>
>> Modified: 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/internet/MimeUtility.java

>>
>> URL: 
>> http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/internet/MimeUtility.java?rev=412426&r1=412425&r2=412426&view=diff

>>
>> ============================================================================== 
>>
>> --- 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/internet/MimeUtility.java

>> (original)
>> +++ 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/internet/MimeUtility.java

>> Wed Jun  7 08:21:46 2006
>> @@ -554,7 +554,7 @@
>>              if (encoding.equalsIgnoreCase("B")) {
>>                  encoder = "base64";
>>              }
>> -            else if (encoding.equalsIgnoreCase("G")) {
>> +            else if (encoding.equalsIgnoreCase("Q")) {
>>                  encoder = "quoted-printable";
>>              }
>>              else {
>>
>> Modified: 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/Base64Encoder.java

>>
>> URL: 
>> http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/Base64Encoder.java?rev=412426&r1=412425&r2=412426&view=diff

>>
>> ============================================================================== 
>>
>> --- 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/Base64Encoder.java

>> (original)
>> +++ 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/Base64Encoder.java

>> Wed Jun  7 08:21:46 2006
>> @@ -515,21 +515,22 @@
>>              int readCount = in.read(inBuffer);
>>              // did we get a full triplet?  that's an easy encoding.
>>              if (readCount == 3) {
>> -                byte a1 = (byte)(inBuffer[0] & 0xff);
>> -                byte a2 = (byte)(inBuffer[1] & 0xff);
>> -                byte a3 = (byte)(inBuffer[2] & 0xff);
>> +                int  a1 = inBuffer[0] & 0xff;
>> +                int  a2 = inBuffer[1] & 0xff;
>> +                int  a3 = inBuffer[2] & 0xff;
>>
>>                  out.append((char)encodingTable[(a1 >>> 2) & 0x3f]);
>>                  out.append((char)encodingTable[((a1 << 4) | (a2 >>>

>> 4)) & 0x3f]);
>>                  out.append((char)encodingTable[((a2 << 2) | (a3 >>>

>> 6)) & 0x3f]);
>>                  out.append((char)encodingTable[a3 & 0x3f]);
>> +
>>              }
>>              else if (readCount <= 0) {
>>                  // eof condition, don'e entirely.
>>                  return;
>>              }
>>              else if (readCount == 1) {
>> -                byte a1 = (byte)(inBuffer[0] & 0xff);
>> +                int  a1 = inBuffer[0] & 0xff;
>>                  out.append((char)encodingTable[(a1 >>> 2) & 0x3f]);
>>                  out.append((char)encodingTable[(a1 << 4) & 0x3f]);
>>                  out.append((char)padding);
>> @@ -537,8 +538,8 @@
>>                  return;
>>              }
>>              else if (readCount == 2) {
>> -                byte a1 = (byte)(inBuffer[0] & 0xff);
>> -                byte a2 = (byte)(inBuffer[1] & 0xff);
>> +                int  a1 = inBuffer[0] & 0xff;
>> +                int  a2 = inBuffer[1] & 0xff;
>>
>>                  out.append((char)encodingTable[(a1 >>> 2) & 0x3f]);
>>                  out.append((char)encodingTable[((a1 << 4) | (a2 >>>

>> 4)) & 0x3f]);
>>
>> Modified: 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/RFC2231Encoder.java

>>
>> URL: 
>> http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/RFC2231Encoder.java?rev=412426&r1=412425&r2=412426&view=diff

>>
>> ============================================================================== 
>>
>> --- 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/RFC2231Encoder.java

>> (original)
>> +++ 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/RFC2231Encoder.java

>> Wed Jun  7 08:21:46 2006
>> @@ -52,7 +52,7 @@
>>              (byte)'8', (byte)'9', (byte)'A', (byte)'B', (byte)'C', 
>> (byte)'D', (byte)'E', (byte)'F'
>>          };
>>
>> -    protected String DEFAULT_SPECIALS = " *\\%";
>> +    protected String DEFAULT_SPECIALS = " *'%";
>>      protected String specials = DEFAULT_SPECIALS;
>>
>>      /*
>> @@ -92,11 +92,11 @@
>>          int bytesWritten = 0;
>>          for (int i = off; i < (off + length); i++)
>>          {
>> -            byte ch = data[i];
>> +            int ch = data[i] & 0xff;
>>              // character tha must be encoded?  Prefix with a '%' and 
>> encode in hex.
>>              if (ch <= 32 || ch >= 127 || specials.indexOf(ch) != -1) {
>>                  out.write((byte)'%');
>> -                out.write(encodingTable[(ch >> 4)]);
>> +                out.write(encodingTable[ch >> 4]);
>>                  out.write(encodingTable[ch & 0xf]);
>>                  bytesWritten += 3;
>>              }
>>
>> Modified: 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/test/java/javax/mail/internet/MimeUtilityTest.java

>>
>> URL: 
>> http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-spec-javamail/src/test/java/javax/mail/internet/MimeUtilityTest.java?rev=412426&r1=412425&r2=412426&view=diff

>>
>> ============================================================================== 
>>
>> --- 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/test/java/javax/mail/internet/MimeUtilityTest.java

>> (original)
>> +++ 
>> geronimo/specs/trunk/geronimo-spec-javamail/src/test/java/javax/mail/internet/MimeUtilityTest.java

>> Wed Jun  7 08:21:46 2006
>> @@ -83,4 +83,43 @@
>>          }
>>      }
>>
>> +
>> +    public void testEncodeWord() throws Exception {
>> +        assertEquals("abc", MimeUtility.encodeWord("abc"));
>> +        // default code page dependent, hard to directly test the 
>> encoded results
>> +        assertEquals(" hé! àèôu !!!", 
>> MimeUtility.decodeWord(MimeUtility.encodeWord(" hé! àèôu !!!")));
>> +
>> +        String encoded = MimeUtility.encodeWord(" hé! àèôu !!!", 
>> "UTF-8", "Q");
>> +        
>> assertEquals("=?UTF-8?Q?_h=C3=A9!_=C3=A0=C3=A8=C3=B4u_!!!?=", encoded);
>> +        assertEquals(" hé! àèôu !!!", MimeUtility.decodeWord(encoded));
>> +
>> +        encoded = MimeUtility.encodeWord(" hé! àèôu !!!", "UTF-8", 
>> "B");
>> +        assertEquals("=?UTF-8?B?IGjDqSEgw6DDqMO0dSAhISE=?=", encoded);
>> +        assertEquals(" hé! àèôu !!!", MimeUtility.decodeWord(encoded));
>> +    }
>> +
>> +
>> +    public void testEncodeText() throws Exception {
>> +        assertEquals("abc", MimeUtility.encodeWord("abc"));
>> +        // default code page dependent, hard to directly test the 
>> encoded results
>> +        assertEquals(" hé! àèôu !!!", 
>> MimeUtility.decodeText(MimeUtility.encodeText(" hé! àèôu !!!")));
>> +
>> +        String encoded = MimeUtility.encodeText(" hé! àèôu !!!", 
>> "UTF-8", "Q");
>> +        
>> assertEquals("=?UTF-8?Q?_h=C3=A9!_=C3=A0=C3=A8=C3=B4u_!!!?=", encoded);
>> +        assertEquals(" hé! àèôu !!!", MimeUtility.decodeText(encoded));
>> +
>> +        encoded = MimeUtility.encodeText(" hé! àèôu !!!", "UTF-8", 
>> "B");
>> +        assertEquals("=?UTF-8?B?IGjDqSEgw6DDqMO0dSAhISE=?=", encoded);
>> +        assertEquals(" hé! àèôu !!!", MimeUtility.decodeText(encoded));
>> +    }
>> +
>> +
>> +    public void testQuote() throws Exception {
>> +        assertEquals("abc", MimeUtility.quote("abc", "&*%"));
>> +        assertEquals("\"abc&\"", MimeUtility.quote("abc&", "&*%"));
>> +        assertEquals("\"abc\\\"\"", MimeUtility.quote("abc\"", "&*%"));
>> +        assertEquals("\"abc\\\\\"", MimeUtility.quote("abc\\", "&*%"));
>> +        assertEquals("\"abc\\\r\"", MimeUtility.quote("abc\r", "&*%"));
>> +        assertEquals("\"abc\\\n\"", MimeUtility.quote("abc\n", "&*%"));
>> +    }
>>  }
>>
>>
>
>


Mime
View raw message