ICU-4511 fix icu data loading for websphere - prebuilt indexes

X-SVN-Rev: 17812
This commit is contained in:
Doug Felt 2005-06-07 17:49:50 +00:00
parent 843b460dd8
commit 215ba528b2
2 changed files with 42 additions and 3 deletions

View File

@ -275,6 +275,21 @@
</java>
</target>
<target name="indices" depends="icudata,tools">
<java classname="com.ibm.icu.dev.tool.index.IndexGenerator" classpath="${build.dir}" logError="true">
<arg value="${build.dir}/com/ibm/icu/impl/data/icudt33b/" />
</java>
<java classname="com.ibm.icu.dev.tool.index.IndexGenerator" classpath="${build.dir}" logError="true">
<arg value="${build.dir}/com/ibm/icu/impl/data/icudt33b/rbnf" />
</java>
<java classname="com.ibm.icu.dev.tool.index.IndexGenerator" classpath="${build.dir}" logError="true">
<arg value="${build.dir}/com/ibm/icu/impl/data/icudt33b/coll" />
</java>
<java classname="com.ibm.icu.dev.tool.index.IndexGenerator" classpath="${build.dir}" logError="true">
<arg value="${build.dir}/com/ibm/icu/impl/data/icudt33b/translit" />
</java>
</target>
<target name="one4tools" depends="anthack1,anthack2,mangle" if="version.1.4">
<javac includes="com/ibm/icu/dev/localeconverter/docs/*.java,com/ibm/icu/dev/tool/docs/*.java"
excludes="**/CVS/**/*"
@ -392,7 +407,7 @@
<!-- Creates the 3 release jar archives for distribution -->
<target name="jarRelease" depends="jar,jarSrc,jarDocs"/>
<target name="jar" depends="core" description="build full 'icu4j.jar' jar file">
<target name="jar" depends="core,indices" description="build full 'icu4j.jar' jar file">
<jar jarfile="${jar.file}"
compress="true"
includes="com/ibm/icu/util/**/*,com/ibm/icu/text/**/*,com/ibm/icu/math/**/*,com/ibm/icu/impl/**/*,com/ibm/icu/lang/**/*"

View File

@ -1,13 +1,17 @@
/*
******************************************************************************
* Copyright (C) 2004, International Business Machines Corporation and *
* Copyright (C) 2005, International Business Machines Corporation and *
* others. All Rights Reserved. *
******************************************************************************
*/
package com.ibm.icu.impl;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.lang.ref.SoftReference;
import java.net.JarURLConnection;
import java.net.URL;
@ -883,8 +887,28 @@ public abstract class ICUResourceBundle extends UResourceBundle{
doPrivileged(new java.security.PrivilegedAction() {
public Object run() {
// WebSphere class loader will return null for a raw directory name without trailing slash
URL url = root.getResource(baseName.endsWith("/") ? baseName : baseName + "/"); //
String bn = baseName.endsWith("/") ? baseName : baseName + "/";
// look for prebuilt indices first
try {
InputStream s = root.getResourceAsStream(bn + "res_index.txt");
if (s != null) {
ArrayList list = new ArrayList();
BufferedReader br = new BufferedReader(new InputStreamReader(s, "ASCII"));
String line;
while ((line = br.readLine()) != null) {
if (line.length() != 0 && !line.startsWith("#")) {
list.add(line);
}
}
return list;
}
}
catch (IOException e) {
// swallow it
}
URL url = root.getResource(bn);
URLHandler handler = URLHandler.get(url);
if (handler != null) {
final ArrayList list = new ArrayList();