Print this page
rev 5615 : 6336885: RFE: Locale Data Deployment Enhancements
4609153: Provide locale data for Indic locales
5104387: Support for gl_ES locale (galician language)
6337471: desktop/system locale preferences support
7056139: (cal) SPI support for locale-dependent Calendar parameters
7058206: Provide CalendarData SPI for week params and display field value names
7073852: Support multiple scripts for digits and decimal symbols per locale
7079560: [Fmt-Da] Context dependent month names support in SimpleDateFormat
7171324: getAvailableLocales() of locale sensitive services should return the actual availability of locales
7151414: (cal) Support calendar type identification
7168528: LocaleServiceProvider needs to be aware of Locale extensions
7171372: (cal) locale's default Calendar should be created if unknown calendar is specified
Summary: JEP 127: Improve Locale Data Packaging and Adopt Unicode CLDR Data (part 1 w/o Jigsaw. by Naoto Sato and Masayoshi Okutsu)

Split Close
Expand all
Collapse all
          --- old/make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java
          +++ new/make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java
   1    1  /*
   2      - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
        2 + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
   3    3   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4    4   *
   5    5   * This code is free software; you can redistribute it and/or modify it
   6    6   * under the terms of the GNU General Public License version 2 only, as
   7    7   * published by the Free Software Foundation.  Oracle designates this
   8    8   * particular file as subject to the "Classpath" exception as provided
   9    9   * by Oracle in the LICENSE file that accompanied this code.
  10   10   *
  11   11   * This code is distributed in the hope that it will be useful, but WITHOUT
  12   12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
↓ open down ↓ 59 lines elided ↑ open up ↑
  72   72  
  73   73      /**
  74   74       * Generate data files whose names are included in
  75   75       * sun.text.resources.BreakIteratorInfo+<localeName>
  76   76       */
  77   77      private static void generateFiles() {
  78   78          String[] classNames;
  79   79          ResourceBundle rules, info;
  80   80  
  81   81          info =  ResourceBundle.getBundle("sun.text.resources.BreakIteratorInfo",
  82      -                                       new Locale(language, country, valiant));
       82 +                                         new Locale(language, country, valiant),
       83 +                                         BreakIteratorRBControl.INSTANCE);
  83   84          classNames = info.getStringArray("BreakIteratorClasses");
  84   85  
  85   86          rules = ResourceBundle.getBundle("sun.text.resources.BreakIteratorRules",
  86      -                                       new Locale(language, country, valiant));
       87 +                                         new Locale(language, country, valiant),
       88 +                                         BreakIteratorRBControl.INSTANCE);
  87   89  
  88      -        /*
  89      -         * Fallback is not necessary here.... So, cannot use getBundle().
  90      -         */
  91      -        try {
  92      -            info = (ResourceBundle)Class.forName("sun.text.resources.BreakIteratorInfo" + localeName).newInstance();
  93      -
  94      -            Enumeration<String> keys = info.getKeys();
  95      -            while (keys.hasMoreElements()) {
  96      -                String key = keys.nextElement();
  97      -
  98      -                if (key.equals("CharacterData")) {
  99      -                    generateDataFile(info.getString(key),
 100      -                                     rules.getString("CharacterBreakRules"),
 101      -                                     classNames[0]);
 102      -                } else if (key.endsWith("WordData")) {
 103      -                    generateDataFile(info.getString(key),
 104      -                                     rules.getString("WordBreakRules"),
 105      -                                     classNames[1]);
 106      -                } else if (key.endsWith("LineData")) {
 107      -                    generateDataFile(info.getString(key),
 108      -                                     rules.getString("LineBreakRules"),
 109      -                                     classNames[2]);
 110      -                } else if (key.endsWith("SentenceData")) {
 111      -                    generateDataFile(info.getString(key),
 112      -                                     rules.getString("SentenceBreakRules"),
 113      -                                     classNames[3]);
 114      -                }
 115      -            }
       90 +        if (info.containsKey("CharacterData")) {
       91 +            generateDataFile(info.getString("CharacterData"),
       92 +                             rules.getString("CharacterBreakRules"),
       93 +                             classNames[0]);
 116   94          }
 117      -        catch (Exception e) {
 118      -            throw new InternalError(e.toString());
       95 +        if (info.containsKey("WordData")) {
       96 +            generateDataFile(info.getString("WordData"),
       97 +                             rules.getString("WordBreakRules"),
       98 +                             classNames[1]);
 119   99          }
      100 +        if (info.containsKey("LineData")) {
      101 +            generateDataFile(info.getString("LineData"),
      102 +                             rules.getString("LineBreakRules"),
      103 +                             classNames[2]);
      104 +        }
      105 +        if (info.containsKey("SentenceData")) {
      106 +            generateDataFile(info.getString("SentenceData"),
      107 +                             rules.getString("SentenceBreakRules"),
      108 +                             classNames[3]);
      109 +        }
 120  110      }
 121  111  
 122  112      /**
 123  113       * Generate a data file for break-iterator
 124  114       */
 125  115      private static void generateDataFile(String datafile, String rule, String builder) {
 126  116          RuleBasedBreakIteratorBuilder bld;
 127  117          if (builder.equals("RuleBasedBreakIterator")) {
 128  118              bld = new RuleBasedBreakIteratorBuilder(rule);
 129  119          } else if (builder.equals("DictionaryBasedBreakIterator")) {
↓ open down ↓ 81 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX