import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.dev.test.TestUtil;
+import com.ibm.icu.dev.test.TestUtil.JavaVendor;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.text.Normalizer2;
import com.ibm.icu.text.SpoofChecker;
* Test build from source rules.
*/
public void TestOpenFromSourceRules() {
+ if (TestUtil.getJavaVendor() == JavaVendor.IBM && TestUtil.getJavaVersion() == 5) {
+ // Note: IBM Java 5 has a bug reading a large UTF-8 text contents
+ logln("Skip this test case because of the IBM Java 5 bug");
+ return;
+ }
setup();
String fileName;
Reader confusables;
// Verify that each item from the Unicode confusables.txt file
// transforms into the expected skeleton.
public void testConfData() {
+ if (TestUtil.getJavaVendor() == JavaVendor.IBM && TestUtil.getJavaVersion() == 5) {
+ // Note: IBM Java 5 has a bug reading a large UTF-8 text contents
+ logln("Skip this test case because of the IBM Java 5 bug");
+ return;
+ }
try {
// Read in the confusables.txt file. (Distributed by Unicode.org)
String fileName = "unicode/confusables.txt";
/**
*******************************************************************************
- * Copyright (C) 2001-2009, International Business Machines Corporation and *
+ * Copyright (C) 2001-2011, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.util.Locale;
public final class TestUtil {
/**
4*1024);
}
+ public enum JavaVendor {
+ Unknown,
+ Oracle,
+ IBM
+ }
+
+ public static JavaVendor getJavaVendor() {
+ JavaVendor vendor = JavaVendor.Unknown;
+ String javaVendorProp = System.getProperty("java.vendor", "").toLowerCase(Locale.US).trim();
+ if (javaVendorProp.startsWith("ibm")) {
+ vendor = JavaVendor.IBM;
+ } else if (javaVendorProp.startsWith("sun") || javaVendorProp.startsWith("oracle")) {
+ vendor = JavaVendor.Oracle;
+ }
+ return vendor;
+ }
+
+ public static int getJavaVersion() {
+ int ver = -1;
+ String verstr = System.getProperty("java.version");
+ if (verstr != null) {
+ String[] numbers = verstr.split("\\.");
+ try {
+ ver = Integer.parseInt(numbers[1]);
+ } catch (NumberFormatException e) {
+ ver = -1;
+ }
+ }
+ return ver;
+ }
}