247
248 List<String> value = Stream.concat(
249 META_FILES.stream(),
250 filtered.stream().flatMap(s -> includeLocaleFilePatterns(s).stream()))
251 .map(s -> "regex:" + s)
252 .collect(Collectors.toList());
253
254 predicate = ResourceFilter.includeFilter(value);
255 }
256
257 private List<String> includeLocaleFilePatterns(String tag) {
258 // Ignore extension variations
259 if (tag.matches(".+-[a-z]-.+")) {
260 return List.of();
261 }
262
263 List<String> files = new ArrayList<>(includeLocaleFiles(tag.replaceAll("-", "_")));
264
265 // Add Thai BreakIterator related data files
266 if (tag.equals("th")) {
267 files.add(".+sun/text/resources/thai_dict");
268 files.add(".+sun/text/resources/[^_]+BreakIteratorData_th");
269 }
270
271 // Add Taiwan resource bundles for Hong Kong
272 if (tag.equals("zh-HK")) {
273 files.addAll(includeLocaleFiles("zh_TW"));
274 }
275
276 return files;
277 }
278
279 private List<String> includeLocaleFiles(String localeStr) {
280 return INCLUDE_LOCALE_FILES.stream()
281 .map(s -> s + localeStr + ".class")
282 .collect(Collectors.toList());
283 }
284
285 private boolean stripUnsupportedLocales(byte[] bytes, ClassReader cr) {
286 char[] buf = new char[cr.getMaxStringLength()];
287 boolean[] modified = new boolean[1];
288
|
247
248 List<String> value = Stream.concat(
249 META_FILES.stream(),
250 filtered.stream().flatMap(s -> includeLocaleFilePatterns(s).stream()))
251 .map(s -> "regex:" + s)
252 .collect(Collectors.toList());
253
254 predicate = ResourceFilter.includeFilter(value);
255 }
256
257 private List<String> includeLocaleFilePatterns(String tag) {
258 // Ignore extension variations
259 if (tag.matches(".+-[a-z]-.+")) {
260 return List.of();
261 }
262
263 List<String> files = new ArrayList<>(includeLocaleFiles(tag.replaceAll("-", "_")));
264
265 // Add Thai BreakIterator related data files
266 if (tag.equals("th")) {
267 files.add(".+sun/text/resources/ext/thai_dict");
268 files.add(".+sun/text/resources/ext/[^_]+BreakIteratorData_th");
269 }
270
271 // Add Taiwan resource bundles for Hong Kong
272 if (tag.equals("zh-HK")) {
273 files.addAll(includeLocaleFiles("zh_TW"));
274 }
275
276 return files;
277 }
278
279 private List<String> includeLocaleFiles(String localeStr) {
280 return INCLUDE_LOCALE_FILES.stream()
281 .map(s -> s + localeStr + ".class")
282 .collect(Collectors.toList());
283 }
284
285 private boolean stripUnsupportedLocales(byte[] bytes, ClassReader cr) {
286 char[] buf = new char[cr.getMaxStringLength()];
287 boolean[] modified = new boolean[1];
288
|