# HG changeset patch # User ptisnovs # Date 1334767300 -7200 # Node ID 4515e31b48fa8b5eb2100cbb5fab3f3121c636b1 # Parent 182bdaba43eae0196a950dc425a516c665a4448f Backport of: 6792400: Avoid loading of Normalizer resources for simple uses diff -r 182bdaba43ea -r 4515e31b48fa ChangeLog --- a/ChangeLog Tue Apr 17 18:57:20 2012 +0200 +++ b/ChangeLog Wed Apr 18 18:41:40 2012 +0200 @@ -1,3 +1,11 @@ +2012-04-18 Pavel Tisnovsky + + * patches/openjdk/6792400-Avoid_loading_Normalizer_resources.patch: + Backport of: 6792400: Avoid loading of Normalizer resources + for simple uses + * NEWS: Mention backport. + * Makefile.am: Updated + 2012-04-17 Pavel Tisnovsky PR881: Sign tests (wsse.policy.basic) failures with OpenJDK6 diff -r 182bdaba43ea -r 4515e31b48fa Makefile.am --- a/Makefile.am Tue Apr 17 18:57:20 2012 +0200 +++ b/Makefile.am Wed Apr 18 18:41:40 2012 +0200 @@ -380,7 +380,8 @@ patches/openjdk/7103725-ssl_beast_regression.patch \ patches/openjdk/6851973-kerberos.patch \ patches/openjdk/7091528-javadoc_class_files.patch \ - patches/idresolver_fix.patch + patches/idresolver_fix.patch \ + patches/openjdk/6792400-Avoid_loading_Normalizer_resources.patch if WITH_ALT_HSBUILD ICEDTEA_PATCHES += \ diff -r 182bdaba43ea -r 4515e31b48fa NEWS --- a/NEWS Tue Apr 17 18:57:20 2012 +0200 +++ b/NEWS Wed Apr 18 18:41:40 2012 +0200 @@ -13,6 +13,8 @@ * Bug fixes - PR732: Use xsltproc for bootstrap xslt in place of Xerces/Xalan - PR881: Sign tests (wsse.policy.basic) failures with OpenJDK6 +* Backports + - S6792400: Avoid loading of Normalizer resources for simple uses New in release 1.10.6 (2012-02-14): diff -r 182bdaba43ea -r 4515e31b48fa patches/openjdk/6792400-Avoid_loading_Normalizer_resources.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/6792400-Avoid_loading_Normalizer_resources.patch Wed Apr 18 18:41:40 2012 +0200 @@ -0,0 +1,50 @@ +# HG changeset patch +# User peytoia +# Date 1245934539 -32400 +# Node ID e0707baa159364ff923bf901eab1b6c83d4cf092 +# Parent 4d54d6e7bcefd16bcc9a26b93937359f031389ca +6792400: Avoid loading of Normalizer resources for simple uses +Reviewed-by: okutsu + +diff -r 4d54d6e7bcef -r e0707baa1593 src/share/classes/sun/text/normalizer/NormalizerBase.java +--- openjdk/jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java Thu Jun 25 02:42:26 2009 -0700 ++++ openjdk/jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java Thu Jun 25 21:55:39 2009 +0900 +@@ -1598,15 +1598,34 @@ + * @param options the optional features to be enabled. + */ + public static String normalize(String str, Normalizer.Form form, int options) { ++ int len = str.length(); ++ boolean asciiOnly = true; ++ if (len < 80) { ++ for (int i = 0; i < len; i++) { ++ if (str.charAt(i) > 127) { ++ asciiOnly = false; ++ break; ++ } ++ } ++ } else { ++ char[] a = str.toCharArray(); ++ for (int i = 0; i < len; i++) { ++ if (a[i] > 127) { ++ asciiOnly = false; ++ break; ++ } ++ } ++ } ++ + switch (form) { + case NFC : +- return NFC.normalize(str, options); ++ return asciiOnly ? str : NFC.normalize(str, options); + case NFD : +- return NFD.normalize(str, options); ++ return asciiOnly ? str : NFD.normalize(str, options); + case NFKC : +- return NFKC.normalize(str, options); ++ return asciiOnly ? str : NFKC.normalize(str, options); + case NFKD : +- return NFKD.normalize(str, options); ++ return asciiOnly ? str : NFKD.normalize(str, options); + } + + throw new IllegalArgumentException("Unexpected normalization form: " +