james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Cole (JIRA)" <mime4j-...@james.apache.org>
Subject [jira] Commented: (MIME4J-179) Error Stemming From CharsetUtil class
Date Sat, 21 Aug 2010 20:52:16 GMT

    [ https://issues.apache.org/jira/browse/MIME4J-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901094#action_12901094

Richard Cole commented on MIME4J-179:

Exactly there isn't even an assert.  That's what odd.  I am not at work at the moment and
cannot create this example.  However seeing as this is the CharsetUtil init code this is just
the same.  You should be able to reproduce it by creating a test case that just instantiates
a MultipartEntity object.  This is what I'm doing in my real test trying to use a MultipartTest
object, of which call CharsetUtil in its init method



> Error Stemming From CharsetUtil class
> -------------------------------------
>                 Key: MIME4J-179
>                 URL: https://issues.apache.org/jira/browse/MIME4J-179
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>         Environment: Windows XP, Java jdk1.5.0_15, Junit 4.6
>            Reporter: Richard Cole
> Hello.
> I am experiencing a issue when running a test the instantiates a MultipartEntity class
(org.apache.http.entity.mime).  When the test is run from within my IDE (idea 8.1.4) there
is no issue.  However when the test is run as part of an automated build from the command
line the test fails.  I have tracked the issue down to the following class org.apache.james.mime4j.util.CharsetUtil.
 When run from the command line I get this error from the test:
> junit.framework.AssertionFailedError
>     at sun.nio.cs.Surrogate$Parser.parse(Surrogate.java:205)
>     at sun.nio.cs.ext.IBM949$Encoder.encodeArrayLoop(IBM949.java:1554)
>     at sun.nio.cs.ext.IBM949$Encoder.encodeLoop(IBM949.java:5239)
>     at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:544)
>     at java.lang.StringCoding$CharsetSE.encode(StringCoding.java:342)
>     at java.lang.StringCoding.encode(StringCoding.java:378)
>     at java.lang.String.getBytes(String.java:812)
>     at com.hsbc.cibm.valservice.workflowserver.server.jobs.JobsSourceTest.foo(JobsSourceTest.java:40
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:585)
>     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>     at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>     at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>     at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>     at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
>     at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:44)
>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
>     at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
>     at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>     at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>     at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
>     at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
>     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:422)
>     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:931)
>     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:758)
> The interesting point is the from the command line I end up in:
> at sun.nio.cs.Surrogate$Parser.parse(Surrogate.java:205)
>     at sun.nio.cs.ext.IBM949$Encoder.encodeArrayLoop(IBM949.java:1554)
>     at sun.nio.cs.ext.IBM949$Encoder.encodeLoop(IBM949.java:5239)
> Where as from idea I end up in sun.nio.cs.ext.MS1252$Encoder
> My example test is:
> @Test
>     public void example_of_error() {
>         for (Charset c : JAVA_CHARSETS) {
>             try {
>                 "dummy".getBytes(c.canonical);
>             } catch (UnsupportedOperationException e) {           
>             } catch (UnsupportedEncodingException e) {
>             }
>         }
>     }
>     private static Charset[] JAVA_CHARSETS = {
>             new Charset("ISO8859_1", "ISO-8859-1",
>                     new String[]{"ISO_8859-1:1987", "iso-ir-100", "ISO_8859-1",
>                             "latin1", "l1", "IBM819", "CP819",
>                             "csISOLatin1", "8859_1", "819", "IBM-819",
>                             "ISO8859-1", "ISO_8859_1"}),
>             new Charset("ISO8859_2", "ISO-8859-2",
>                     new String[]{"ISO_8859-2:1987", "iso-ir-101", "ISO_8859-2",
>                             "latin2", "l2", "csISOLatin2", "8859_2",
>                             "iso8859_2"}),
>             new Charset("ISO8859_3", "ISO-8859-3", new String[]{"ISO_8859-3:1988", "iso-ir-109",
"ISO_8859-3", "latin3", "l3", "csISOLatin3", "8859_3"}),
>             new Charset("ISO8859_4", "ISO-8859-4",
>                     new String[]{"ISO_8859-4:1988", "iso-ir-110", "ISO_8859-4",
>                             "latin4", "l4", "csISOLatin4", "8859_4"}),
>             new Charset("ISO8859_5", "ISO-8859-5",
>                     new String[]{"ISO_8859-5:1988", "iso-ir-144", "ISO_8859-5",
>                             "cyrillic", "csISOLatinCyrillic", "8859_5"}),
>             new Charset("ISO8859_6", "ISO-8859-6", new String[]{"ISO_8859-6:1987", "iso-ir-127",
"ISO_8859-6", "ECMA-114", "ASMO-708", "arabic", "csISOLatinArabic", "8859_6"}),
>             new Charset("ISO8859_7", "ISO-8859-7",
>                     new String[]{"ISO_8859-7:1987", "iso-ir-126", "ISO_8859-7",
>                             "ELOT_928", "ECMA-118", "greek", "greek8",
>                             "csISOLatinGreek", "8859_7", "sun_eu_greek"}),
>             new Charset("ISO8859_8", "ISO-8859-8", new String[]{"ISO_8859-8:1988", "iso-ir-138",
"ISO_8859-8", "hebrew", "csISOLatinHebrew", "8859_8"}),
>             new Charset("ISO8859_9", "ISO-8859-9",
>                     new String[]{"ISO_8859-9:1989", "iso-ir-148", "ISO_8859-9",
>                             "latin5", "l5", "csISOLatin5", "8859_9"}),
>             new Charset("ISO8859_13", "ISO-8859-13", new String[]{}),
>             new Charset("ISO8859_15", "ISO-8859-15",
>                     new String[]{"ISO_8859-15", "Latin-9", "8859_15",
>                             "csISOlatin9", "IBM923", "cp923", "923", "L9",
>                             "IBM-923", "ISO8859-15", "LATIN9", "LATIN0",
>                             "csISOlatin0", "ISO8859_15_FDIS"}),
>             new Charset("KOI8_R", "KOI8-R", new String[]{"csKOI8R", "koi8"}),
>             new Charset("ASCII", "US-ASCII",
>                     new String[]{"ANSI_X3.4-1968", "iso-ir-6",
>                             "ANSI_X3.4-1986", "ISO_646.irv:1991",
>                             "ISO646-US", "us", "IBM367", "cp367",
>                             "csASCII", "ascii7", "646", "iso_646.irv:1983"}),
>             new Charset("UTF8", "UTF-8", new String[]{}),
>             new Charset("UTF-16", "UTF-16", new String[]{"UTF_16"}),
>             new Charset("UnicodeBigUnmarked", "UTF-16BE", new String[]{"X-UTF-16BE",
"UTF_16BE", "ISO-10646-UCS-2"}),
>             new Charset("UnicodeLittleUnmarked", "UTF-16LE", new String[]{"UTF_16LE",
>             new Charset("Big5", "Big5", new String[]{"csBig5", "CN-Big5", "BIG-FIVE",
>             new Charset("Big5_HKSCS", "Big5-HKSCS", new String[]{"big5hkscs"}),
>             new Charset("EUC_JP", "EUC-JP",
>                     new String[]{"csEUCPkdFmtJapanese",
>                             "Extended_UNIX_Code_Packed_Format_for_Japanese",
>                             "eucjis", "x-eucjp", "eucjp", "x-euc-jp"}),
>             new Charset("EUC_KR", "EUC-KR",
>                     new String[]{"csEUCKR", "ksc5601", "5601", "ksc5601_1987",
>                             "ksc_5601", "ksc5601-1987", "ks_c_5601-1987",
>                             "euckr"}),
>             new Charset("GB18030", "GB18030", new String[]{"gb18030-2000"}),
>             new Charset("EUC_CN", "GB2312", new String[]{"x-EUC-CN", "csGB2312", "euccn",
"euc-cn", "gb2312-80", "gb2312-1980", "CN-GB", "CN-GB-ISOIR165"}),
>             new Charset("GBK", "windows-936", new String[]{"CP936", "MS936", "ms_936",
>             new Charset("Cp037", "IBM037", new String[]{"ebcdic-cp-us", "ebcdic-cp-ca",
"ebcdic-cp-wt", "ebcdic-cp-nl", "csIBM037"}),
>             new Charset("Cp273", "IBM273", new String[]{"csIBM273"}),
>             new Charset("Cp277", "IBM277", new String[]{"EBCDIC-CP-DK", "EBCDIC-CP-NO",
>             new Charset("Cp278", "IBM278", new String[]{"CP278", "ebcdic-cp-fi", "ebcdic-cp-se",
>             new Charset("Cp280", "IBM280", new String[]{"ebcdic-cp-it", "csIBM280"}),
>             new Charset("Cp284", "IBM284", new String[]{"ebcdic-cp-es", "csIBM284"}),
>             new Charset("Cp285", "IBM285", new String[]{"ebcdic-cp-gb", "csIBM285"}),
>             new Charset("Cp297", "IBM297", new String[]{"ebcdic-cp-fr", "csIBM297"}),
>             new Charset("Cp420", "IBM420", new String[]{"ebcdic-cp-ar1", "csIBM420"}),
>             new Charset("Cp424", "IBM424", new String[]{"ebcdic-cp-he", "csIBM424"}),
>             new Charset("Cp437", "IBM437", new String[]{"437", "csPC8CodePage437"}),
>             new Charset("Cp500", "IBM500", new String[]{"ebcdic-cp-be", "ebcdic-cp-ch",
>             new Charset("Cp775", "IBM775", new String[]{"csPC775Baltic"}),
>             new Charset("Cp838", "IBM-Thai", new String[]{}),
>             new Charset("Cp850", "IBM850", new String[]{"850", "csPC850Multilingual"}),
>             new Charset("Cp852", "IBM852", new String[]{"852", "csPCp852"}),
>             new Charset("Cp855", "IBM855", new String[]{"855", "csIBM855"}),
>             new Charset("Cp857", "IBM857", new String[]{"857", "csIBM857"}),
>             new Charset("Cp858", "IBM00858",
>                     new String[]{"CCSID00858", "CP00858",
>                             "PC-Multilingual-850+euro"}),
>             new Charset("Cp860", "IBM860", new String[]{"860", "csIBM860"}),
>             new Charset("Cp861", "IBM861", new String[]{"861", "cp-is", "csIBM861"}),
>             new Charset("Cp862", "IBM862", new String[]{"862", "csPC862LatinHebrew"}),
>             new Charset("Cp863", "IBM863", new String[]{"863", "csIBM863"}),
>             new Charset("Cp864", "IBM864", new String[]{"cp864", "csIBM864"}),
>             new Charset("Cp865", "IBM865", new String[]{"865", "csIBM865"}),
>             new Charset("Cp866", "IBM866", new String[]{"866", "csIBM866"}),
>             new Charset("Cp868", "IBM868", new String[]{"cp-ar", "csIBM868"}),
>             new Charset("Cp869", "IBM869", new String[]{"cp-gr", "csIBM869"}),
>             new Charset("Cp870", "IBM870", new String[]{"ebcdic-cp-roece", "ebcdic-cp-yu",
>             new Charset("Cp871", "IBM871", new String[]{"ebcdic-cp-is", "csIBM871"}),
>             new Charset("Cp918", "IBM918", new String[]{"ebcdic-cp-ar2", "csIBM918"}),
>             new Charset("Cp1026", "IBM1026", new String[]{"csIBM1026"}),
>             new Charset("Cp1047", "IBM1047", new String[]{"IBM-1047"}),
>             new Charset("Cp1140", "IBM01140",
>                     new String[]{"CCSID01140", "CP01140",
>                             "ebcdic-us-37+euro"}),
>             new Charset("Cp1141", "IBM01141",
>                     new String[]{"CCSID01141", "CP01141",
>                             "ebcdic-de-273+euro"}),
>             new Charset("Cp1142", "IBM01142", new String[]{"CCSID01142", "CP01142", "ebcdic-dk-277+euro",
>             new Charset("Cp1143", "IBM01143", new String[]{"CCSID01143", "CP01143", "ebcdic-fi-278+euro",
>             new Charset("Cp1144", "IBM01144", new String[]{"CCSID01144", "CP01144", "ebcdic-it-280+euro"}),
>             new Charset("Cp1145", "IBM01145", new String[]{"CCSID01145", "CP01145", "ebcdic-es-284+euro"}),
>             new Charset("Cp1146", "IBM01146", new String[]{"CCSID01146", "CP01146", "ebcdic-gb-285+euro"}),
>             new Charset("Cp1147", "IBM01147", new String[]{"CCSID01147", "CP01147", "ebcdic-fr-297+euro"}),
>             new Charset("Cp1148", "IBM01148", new String[]{"CCSID01148", "CP01148", "ebcdic-international-500+euro"}),
>             new Charset("Cp1149", "IBM01149", new String[]{"CCSID01149", "CP01149", "ebcdic-is-871+euro"}),
>             new Charset("Cp1250", "windows-1250", new String[]{}),
>             new Charset("Cp1251", "windows-1251", new String[]{}),
>             new Charset("Cp1252", "windows-1252", new String[]{}),
>             new Charset("Cp1253", "windows-1253", new String[]{}),
>             new Charset("Cp1254", "windows-1254", new String[]{}),
>             new Charset("Cp1255", "windows-1255", new String[]{}),
>             new Charset("Cp1256", "windows-1256", new String[]{}),
>             new Charset("Cp1257", "windows-1257", new String[]{}),
>             new Charset("Cp1258", "windows-1258", new String[]{}),
>             new Charset("ISO2022CN", "ISO-2022-CN", new String[]{}),
>             new Charset("ISO2022JP", "ISO-2022-JP", new String[]{"csISO2022JP", "JIS",
"jis_encoding", "csjisencoding"}),
>             new Charset("ISO2022KR", "ISO-2022-KR", new String[]{"csISO2022KR"}),
>             new Charset("JIS_X0201", "JIS_X0201", new String[]{"X0201", "JIS0201", "csHalfWidthKatakana"}),
>             new Charset("JIS_X0212-1990", "JIS_X0212-1990", new String[]{"iso-ir-159",
"x0212", "JIS0212", "csISO159JISX02121990"}),
>             new Charset("JIS_C6626-1983", "JIS_C6626-1983", new String[]{"x-JIS0208",
"JIS0208", "csISO87JISX0208", "x0208", "JIS_X0208-1983", "iso-ir-87"}),
>             new Charset("SJIS", "Shift_JIS", new String[]{"MS_Kanji", "csShiftJIS", "shift-jis",
"x-sjis", "pck"}),
>             new Charset("TIS620", "TIS-620", new String[]{}),
>             new Charset("MS932", "Windows-31J", new String[]{"windows-932", "csWindows31J",
>             new Charset("EUC_TW", "EUC-TW", new String[]{"x-EUC-TW", "cns11643", "euctw"}),
>             new Charset("x-Johab", "johab", new String[]{"johab", "cp1361", "ms1361",
"ksc5601-1992", "ksc5601_1992"}),
>             new Charset("MS950_HKSCS", "", new String[]{}),
>             new Charset("MS874", "windows-874", new String[]{"cp874"}),
>             new Charset("MS949", "windows-949", new String[]{"windows949", "ms_949",
>             new Charset("MS950", "windows-950", new String[]{"x-windows-950"}),
>             new Charset("Cp737", null, new String[]{}),
>             new Charset("Cp856", null, new String[]{}),
>             new Charset("Cp875", null, new String[]{}),
>             new Charset("Cp921", null, new String[]{}),
>             new Charset("Cp922", null, new String[]{}),
>             new Charset("Cp930", null, new String[]{}),
>             new Charset("Cp933", null, new String[]{}),
>             new Charset("Cp935", null, new String[]{}),
>             new Charset("Cp937", null, new String[]{}),
>             new Charset("Cp939", null, new String[]{}),
>             new Charset("Cp942", null, new String[]{}),
>             new Charset("Cp942C", null, new String[]{}),
>             new Charset("Cp943", null, new String[]{}),
>             new Charset("Cp943C", null, new String[]{}),
>             new Charset("Cp948", null, new String[]{}),
>             new Charset("Cp949", null, new String[]{}),
>             new Charset("Cp949C", null, new String[]{}),
>             new Charset("Cp950", null, new String[]{}),
>             new Charset("Cp964", null, new String[]{}),
>             new Charset("Cp970", null, new String[]{}),
>             new Charset("Cp1006", null, new String[]{}),
>             new Charset("Cp1025", null, new String[]{}),
>             new Charset("Cp1046", null, new String[]{}),
>             new Charset("Cp1097", null, new String[]{}),
>             new Charset("Cp1098", null, new String[]{}),
>             new Charset("Cp1112", null, new String[]{}),
>             new Charset("Cp1122", null, new String[]{}),
>             new Charset("Cp1123", null, new String[]{}),
>             new Charset("Cp1124", null, new String[]{}),
>             new Charset("Cp1381", null, new String[]{}),
>             new Charset("Cp1383", null, new String[]{}),
>             new Charset("Cp33722", null, new String[]{}),
>             new Charset("Big5_Solaris", null, new String[]{}),
>             new Charset("EUC_JP_LINUX", null, new String[]{}),
>             new Charset("EUC_JP_Solaris", null, new String[]{}),
>             new Charset("ISCII91", null, new String[]{"x-ISCII91", "iscii"}),
>             new Charset("ISO2022_CN_CNS", null, new String[]{}),
>             new Charset("ISO2022_CN_GB", null, new String[]{}),
>             new Charset("x-iso-8859-11", null, new String[]{}),
>             new Charset("JISAutoDetect", null, new String[]{}),
>             new Charset("MacArabic", null, new String[]{}),
>             new Charset("MacCentralEurope", null, new String[]{}),
>             new Charset("MacCroatian", null, new String[]{}),
>             new Charset("MacCyrillic", null, new String[]{}),
>             new Charset("MacDingbat", null, new String[]{}),
>             new Charset("MacGreek", "MacGreek", new String[]{}),
>             new Charset("MacHebrew", null, new String[]{}),
>             new Charset("MacIceland", null, new String[]{}),
>             new Charset("MacRoman", "MacRoman", new String[]{"Macintosh", "MAC", "csMacintosh"}),
>             new Charset("MacRomania", null, new String[]{}),
>             new Charset("MacSymbol", null, new String[]{}),
>             new Charset("MacThai", null, new String[]{}),
>             new Charset("MacTurkish", null, new String[]{}),
>             new Charset("MacUkraine", null, new String[]{}),
>             new Charset("UnicodeBig", null, new String[]{}),
>             new Charset("UnicodeLittle", null, new String[]{})
>     };
>     private static class Charset implements Comparable<Charset> {
>         private String canonical = null;
>         private String mime = null;
>         private String[] aliases = null;
>         private Charset(String canonical, String mime, String[] aliases) {
>             this.canonical = canonical;
>             this.mime = mime;
>             this.aliases = aliases;
>         }
>         public int compareTo(Charset c) {
>             return this.canonical.compareTo(c.canonical);
>         }
>     }
> ******************************************************************************
> Please let me know if you need anymore information

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message