diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:03:55 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:03:55 -0800 |
commit | dd828f42a5c83b4270d4fbf6fce2da1878f1e84a (patch) | |
tree | fdd4b68fa1020f2b6426034c94823419a7236200 /icu/src | |
parent | fdb2704414a9ed92394ada0d1395e4db86889465 (diff) | |
download | libcore-dd828f42a5c83b4270d4fbf6fce2da1878f1e84a.zip libcore-dd828f42a5c83b4270d4fbf6fce2da1878f1e84a.tar.gz libcore-dd828f42a5c83b4270d4fbf6fce2da1878f1e84a.tar.bz2 |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'icu/src')
17 files changed, 137 insertions, 77 deletions
diff --git a/icu/src/main/java/com/ibm/icu4jni/charset/CharsetDecoderICU.java b/icu/src/main/java/com/ibm/icu4jni/charset/CharsetDecoderICU.java index 9d5387e..e33e1b2 100644 --- a/icu/src/main/java/com/ibm/icu4jni/charset/CharsetDecoderICU.java +++ b/icu/src/main/java/com/ibm/icu4jni/charset/CharsetDecoderICU.java @@ -15,7 +15,9 @@ package com.ibm.icu4jni.charset; import com.ibm.icu4jni.common.ErrorCode; -import com.ibm.icu4jni.converters.NativeConverter; +// BEGIN android-removed +// import com.ibm.icu4jni.converters.NativeConverter; +// ENd android-removed import java.nio.CharBuffer; @@ -253,7 +255,7 @@ public final class CharsetDecoderICU extends CharsetDecoder{ }else if(ec==ErrorCode.U_INVALID_CHAR_FOUND){ return CoderResult.unmappableForLength(data[INVALID_BYTES]); }else if(ec==ErrorCode.U_ILLEGAL_CHAR_FOUND){ - return CoderResult.malformedForLength(data[INVALID_BYTES]); + return CoderResult.unmappableForLength(data[INVALID_BYTES]); } /* decoding action succeded */ return CoderResult.UNDERFLOW; diff --git a/icu/src/main/java/com/ibm/icu4jni/charset/CharsetEncoderICU.java b/icu/src/main/java/com/ibm/icu4jni/charset/CharsetEncoderICU.java index cdc98a7..0fdb2c5 100644 --- a/icu/src/main/java/com/ibm/icu4jni/charset/CharsetEncoderICU.java +++ b/icu/src/main/java/com/ibm/icu4jni/charset/CharsetEncoderICU.java @@ -22,7 +22,9 @@ import java.nio.charset.CoderResult; import java.nio.charset.CodingErrorAction; import com.ibm.icu4jni.common.ErrorCode; -import com.ibm.icu4jni.converters.NativeConverter; +// BEGIN android-removed +// import com.ibm.icu4jni.converters.NativeConverter; +// END android-removed public final class CharsetEncoderICU extends CharsetEncoder { diff --git a/icu/src/main/java/com/ibm/icu4jni/charset/CharsetICU.java b/icu/src/main/java/com/ibm/icu4jni/charset/CharsetICU.java index cc0e04a..df6f7dc 100644 --- a/icu/src/main/java/com/ibm/icu4jni/charset/CharsetICU.java +++ b/icu/src/main/java/com/ibm/icu4jni/charset/CharsetICU.java @@ -15,9 +15,10 @@ import java.nio.charset.CharsetEncoder; import java.util.HashMap; import java.util.Map; -import com.ibm.icu4jni.common.ErrorCode; -import com.ibm.icu4jni.converters.NativeConverter; - +// BEGIN android-removed +// import com.ibm.icu4jni.common.ErrorCode; +// import com.ibm.icu4jni.converters.NativeConverter; +// END android-removed public final class CharsetICU extends Charset{ diff --git a/icu/src/main/java/com/ibm/icu4jni/charset/CharsetProviderICU.java b/icu/src/main/java/com/ibm/icu4jni/charset/CharsetProviderICU.java index 42d9f99..6f63479 100644 --- a/icu/src/main/java/com/ibm/icu4jni/charset/CharsetProviderICU.java +++ b/icu/src/main/java/com/ibm/icu4jni/charset/CharsetProviderICU.java @@ -13,7 +13,9 @@ import java.nio.charset.Charset; import java.nio.charset.spi.CharsetProvider; import java.util.*; import java.util.Iterator; -import com.ibm.icu4jni.converters.NativeConverter; +// BEGIN android-removed +// import com.ibm.icu4jni.converters.NativeConverter; +// END android-removed public final class CharsetProviderICU extends CharsetProvider{ diff --git a/icu/src/main/java/com/ibm/icu4jni/converters/NativeConverter.java b/icu/src/main/java/com/ibm/icu4jni/charset/NativeConverter.java index aa0cd26..2bfb050 100644 --- a/icu/src/main/java/com/ibm/icu4jni/converters/NativeConverter.java +++ b/icu/src/main/java/com/ibm/icu4jni/charset/NativeConverter.java @@ -7,13 +7,13 @@ ******************************************************************************* */ -package com.ibm.icu4jni.converters; +package com.ibm.icu4jni.charset; /** * Class for accessing the underlying JNI methods * @internal ICU 2.4 */ -public final class NativeConverter{ +final class NativeConverter{ //Native methods diff --git a/icu/src/main/java/com/ibm/icu4jni/lang/UCharacter.java b/icu/src/main/java/com/ibm/icu4jni/lang/UCharacter.java index ca278ac..7ab1843 100644 --- a/icu/src/main/java/com/ibm/icu4jni/lang/UCharacter.java +++ b/icu/src/main/java/com/ibm/icu4jni/lang/UCharacter.java @@ -141,6 +141,9 @@ public class UCharacter { private static native boolean isLowerCaseImpl(int codePoint); public static int forName(String blockName) { + if (blockName == null) { + throw new NullPointerException(); + } return forname(blockName); } diff --git a/icu/src/main/java/com/ibm/icu4jni/text/Collator.java b/icu/src/main/java/com/ibm/icu4jni/text/Collator.java index 483457d..4a7e1bf 100644 --- a/icu/src/main/java/com/ibm/icu4jni/text/Collator.java +++ b/icu/src/main/java/com/ibm/icu4jni/text/Collator.java @@ -407,21 +407,21 @@ public abstract class Collator implements Cloneable for(int i = 0; i < locales.length; i++) { locale = locales[i]; - + index = locale.indexOf('_'); index2 = locale.lastIndexOf('_'); - + if(index == -1) { result[i] = new Locale(locales[i]); } else if(index == 2 && index == index2) { result[i] = new Locale( locale.substring(0,2), locale.substring(3,5)); - } else if(index == 2 && index2 == 5) { + } else if(index == 2 && index2 > index) { result[i] = new Locale( - locale.substring(0,2), - locale.substring(3,5), - locale.substring(6)); + locale.substring(0,index), + locale.substring(index + 1,index2), + locale.substring(index2 + 1)); } } diff --git a/icu/src/main/java/com/ibm/icu4jni/text/DecimalFormat.java b/icu/src/main/java/com/ibm/icu4jni/text/DecimalFormat.java index 4dbc7e3..ddd4062 100644 --- a/icu/src/main/java/com/ibm/icu4jni/text/DecimalFormat.java +++ b/icu/src/main/java/com/ibm/icu4jni/text/DecimalFormat.java @@ -42,6 +42,11 @@ public class DecimalFormat extends NumberFormat { private boolean useExponentialNotation = false; @SuppressWarnings("unused") private byte minExponentDigits = 0; + + private boolean negPrefNull; + private boolean negSuffNull; + private boolean posPrefNull; + private boolean posSuffNull; public DecimalFormat(String pattern, DecimalFormatSymbols icuSymbols) { this.addr = icuSymbols.getAddr(); @@ -123,10 +128,7 @@ public class DecimalFormat extends NumberFormat { throw new NullPointerException(); } - String fieldType = null; - if(field != null) { - fieldType = getFieldType(field.getFieldAttribute()); - } + String fieldType = getFieldType(field.getFieldAttribute()); Number number = (Number) value; @@ -158,15 +160,11 @@ public class DecimalFormat extends NumberFormat { @Override public StringBuffer format(long value, StringBuffer buffer, FieldPosition field) { - if(buffer == null) { + if(buffer == null || field == null) { throw new NullPointerException(); } - String fieldType = null; - - if(field != null) { - fieldType = getFieldType(field.getFieldAttribute()); - } + String fieldType = getFieldType(field.getFieldAttribute()); String result = NativeDecimalFormat.format(this.addr, value, field, fieldType, null); @@ -179,15 +177,11 @@ public class DecimalFormat extends NumberFormat { @Override public StringBuffer format(double value, StringBuffer buffer, FieldPosition field) { - if(buffer == null) { + if(buffer == null || field == null) { throw new NullPointerException(); } - String fieldType = null; - - if(field != null) { - fieldType = getFieldType(field.getFieldAttribute()); - } + String fieldType = getFieldType(field.getFieldAttribute()); String result = NativeDecimalFormat.format(this.addr, value, field, fieldType, null); @@ -232,22 +226,13 @@ public class DecimalFormat extends NumberFormat { if(number instanceof BigInteger) { BigInteger valBigInteger = (BigInteger) number; - if(valBigInteger.compareTo( - new BigInteger(String.valueOf(Long.MAX_VALUE))) > 0) { - throw(new UnsupportedOperationException( - "Number too big. BigInteger > Long.MAX_VALUE not yet supported.")); - } text = NativeDecimalFormat.format(this.addr, - valBigInteger.longValue(), null, null, attributes); + valBigInteger.toString(10), null, null, attributes, 0); } else if(number instanceof BigDecimal) { BigDecimal valBigDecimal = (BigDecimal) number; - if(valBigDecimal.compareTo( - new BigDecimal(String.valueOf(Double.MAX_VALUE))) > 0) { - throw(new UnsupportedOperationException( - "Number too big. BigDecimal > Double.MAX_VALUE not yet supported.")); - } text = NativeDecimalFormat.format(this.addr, - valBigDecimal.doubleValue(), null, null, attributes); + valBigDecimal.unscaledValue().toString(10), null,null, + attributes, valBigDecimal.scale()); } else { double dv = number.doubleValue(); long lv = number.longValue(); @@ -333,21 +318,33 @@ public class DecimalFormat extends NumberFormat { } public String getNegativePrefix() { + if (negPrefNull) { + return null; + } return NativeDecimalFormat.getTextAttribute(this.addr, UNumberFormatTextAttribute.UNUM_NEGATIVE_PREFIX.ordinal()); } public String getNegativeSuffix() { + if (negSuffNull) { + return null; + } return NativeDecimalFormat.getTextAttribute(this.addr, UNumberFormatTextAttribute.UNUM_NEGATIVE_SUFFIX.ordinal()); } public String getPositivePrefix() { + if (posPrefNull) { + return null; + } return NativeDecimalFormat.getTextAttribute(this.addr, UNumberFormatTextAttribute.UNUM_POSITIVE_PREFIX.ordinal()); } public String getPositiveSuffix() { + if (posSuffNull) { + return null; + } return NativeDecimalFormat.getTextAttribute(this.addr, UNumberFormatTextAttribute.UNUM_POSITIVE_SUFFIX.ordinal()); } @@ -430,23 +427,39 @@ public class DecimalFormat extends NumberFormat { } public void setNegativePrefix(String value) { - NativeDecimalFormat.setTextAttribute(this.addr, - UNumberFormatTextAttribute.UNUM_NEGATIVE_PREFIX.ordinal(), value); + negPrefNull = value == null; + if (!negPrefNull) { + NativeDecimalFormat.setTextAttribute(this.addr, + UNumberFormatTextAttribute.UNUM_NEGATIVE_PREFIX.ordinal(), + value); + } } public void setNegativeSuffix(String value) { - NativeDecimalFormat.setTextAttribute(this.addr, - UNumberFormatTextAttribute.UNUM_NEGATIVE_SUFFIX.ordinal(), value); + negSuffNull = value == null; + if (!negSuffNull) { + NativeDecimalFormat.setTextAttribute(this.addr, + UNumberFormatTextAttribute.UNUM_NEGATIVE_SUFFIX.ordinal(), + value); + } } public void setPositivePrefix(String value) { - NativeDecimalFormat.setTextAttribute(this.addr, - UNumberFormatTextAttribute.UNUM_POSITIVE_PREFIX.ordinal(), value); + posPrefNull = value == null; + if (!posPrefNull) { + NativeDecimalFormat.setTextAttribute(this.addr, + UNumberFormatTextAttribute.UNUM_POSITIVE_PREFIX.ordinal(), + value); + } } public void setPositiveSuffix(String value) { - NativeDecimalFormat.setTextAttribute(this.addr, - UNumberFormatTextAttribute.UNUM_POSITIVE_SUFFIX.ordinal(), value); + posSuffNull = value == null; + if (!posSuffNull) { + NativeDecimalFormat.setTextAttribute(this.addr, + UNumberFormatTextAttribute.UNUM_POSITIVE_SUFFIX.ordinal(), + value); + } } @Override diff --git a/icu/src/main/java/com/ibm/icu4jni/text/NativeBreakIterator.java b/icu/src/main/java/com/ibm/icu4jni/text/NativeBreakIterator.java index c48f1d9..25249c7 100644 --- a/icu/src/main/java/com/ibm/icu4jni/text/NativeBreakIterator.java +++ b/icu/src/main/java/com/ibm/icu4jni/text/NativeBreakIterator.java @@ -16,7 +16,7 @@ package com.ibm.icu4jni.text; -public final class NativeBreakIterator +final class NativeBreakIterator { public NativeBreakIterator() { diff --git a/icu/src/main/java/com/ibm/icu4jni/text/NativeCollation.java b/icu/src/main/java/com/ibm/icu4jni/text/NativeCollation.java index 8606a86..2242b69 100644 --- a/icu/src/main/java/com/ibm/icu4jni/text/NativeCollation.java +++ b/icu/src/main/java/com/ibm/icu4jni/text/NativeCollation.java @@ -16,7 +16,7 @@ package com.ibm.icu4jni.text; * @internal ICU 2.4 */ -public final class NativeCollation +final class NativeCollation { // collator methods --------------------------------------------- diff --git a/icu/src/main/java/com/ibm/icu4jni/text/NativeDecimalFormat.java b/icu/src/main/java/com/ibm/icu4jni/text/NativeDecimalFormat.java index b3b9265..39f7307 100644 --- a/icu/src/main/java/com/ibm/icu4jni/text/NativeDecimalFormat.java +++ b/icu/src/main/java/com/ibm/icu4jni/text/NativeDecimalFormat.java @@ -19,7 +19,7 @@ package com.ibm.icu4jni.text; import java.text.FieldPosition; import java.text.ParsePosition; -public final class NativeDecimalFormat { +final class NativeDecimalFormat { enum UNumberFormatSymbol { UNUM_DECIMAL_SEPARATOR_SYMBOL, diff --git a/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java b/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java index 9931f2d..c0aca3b 100644 --- a/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java +++ b/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java @@ -260,9 +260,13 @@ public final class RuleBasedCollator extends Collator */ public RuleBasedCollator(String rules) throws ParseException { - - if (rules.length() == 0) - throw new ParseException("Build rules empty.", 0); + // BEGIN android-changed + if (rules == null) { + throw new NullPointerException(); + } + // if (rules.length() == 0) + // throw new ParseException("Build rules empty.", 0); + // END android-changed m_collator_ = NativeCollation.openCollatorFromRules(rules, CollationAttribute.VALUE_OFF, CollationAttribute.VALUE_DEFAULT_STRENGTH); @@ -285,8 +289,13 @@ public final class RuleBasedCollator extends Collator */ public RuleBasedCollator(String rules, int strength) throws ParseException { - if (rules.length() == 0) - throw new ParseException("Build rules empty.", 0); + // BEGIN android-changed + if (rules == null) { + throw new NullPointerException(); + } + // if (rules.length() == 0) + // throw new ParseException("Build rules empty.", 0); + // END android-changed if (!CollationAttribute.checkStrength(strength)) throw ErrorCode.getException(ErrorCode.U_ILLEGAL_ARGUMENT_ERROR); @@ -320,6 +329,11 @@ public final class RuleBasedCollator extends Collator */ public RuleBasedCollator(String rules, int normalizationmode, int strength) { + // BEGIN android-added + if (rules == null) { + throw new NullPointerException(); + } + // END android-added if (!CollationAttribute.checkStrength(strength) || !CollationAttribute.checkNormalization(normalizationmode)) { throw ErrorCode.getException(ErrorCode.U_ILLEGAL_ARGUMENT_ERROR); diff --git a/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedNumberFormat.java b/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedNumberFormat.java index 58ddf0e..3c865d8 100644 --- a/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedNumberFormat.java +++ b/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedNumberFormat.java @@ -85,8 +85,11 @@ public class RuleBasedNumberFormat extends NumberFormat { * @param locale the locale to use for this rule based number format */ public void open(RBNFType type, Locale locale) { - this.addr = openRBNFImpl(type.getType(), - locale.toString()); + String loc = locale.toString(); + if (loc == null) { + throw new NullPointerException(); + } + this.addr = openRBNFImpl(type.getType(), loc); } private static native int openRBNFImpl(int type, String loc); @@ -99,6 +102,9 @@ public class RuleBasedNumberFormat extends NumberFormat { * @param rule the rule for the rule based number format */ public void open(String rule) { + if (rule == null) { + throw new NullPointerException(); + } this.addr = openRBNFImpl(rule, Locale.getDefault().toString()); } @@ -111,6 +117,10 @@ public class RuleBasedNumberFormat extends NumberFormat { * @param locale the locale to use for this rule based number format */ public void open(String rule, Locale locale) { + String loc = locale.toString(); + if (loc == null || rule == null) { + throw new NullPointerException(); + } this.addr = openRBNFImpl(rule, locale.toString()); } @@ -178,6 +188,9 @@ public class RuleBasedNumberFormat extends NumberFormat { @Override public Number parse(String string, ParsePosition position) { + if (string == null || position == null) { + throw new NullPointerException(); + } return parseRBNFImpl(this.addr, string, position, false); } @@ -194,6 +207,9 @@ public class RuleBasedNumberFormat extends NumberFormat { * @return the Number resulting from the parse, or null if there is an error */ public Number parseLenient(String string, ParsePosition position) { + if (string == null || position == null) { + throw new NullPointerException(); + } return parseRBNFImpl(this.addr, string, position, true); } diff --git a/icu/src/main/native/ConverterInterface.c b/icu/src/main/native/ConverterInterface.c index 1a16197..3996146 100644 --- a/icu/src/main/native/ConverterInterface.c +++ b/icu/src/main/native/ConverterInterface.c @@ -895,15 +895,17 @@ static jstring getCanonicalName(JNIEnv *env, jclass jClass,jstring enc) { UErrorCode error = U_ZERO_ERROR; const char* encName = (*env)->GetStringUTFChars(env,enc,NULL); const char* canonicalName = ""; - jstring ret; + // BEGIN android-changed + jstring ret = NULL; if(encName) { canonicalName = ucnv_getAlias(encName,0,&error); if(canonicalName !=NULL && strstr(canonicalName,",")!=0) { canonicalName = ucnv_getAlias(canonicalName,1,&error); } ret = ((*env)->NewStringUTF(env, canonicalName)); + (*env)->ReleaseStringUTFChars(env,enc,encName); } - (*env)->ReleaseStringUTFChars(env,enc,encName); + // END android-changed return ret; } @@ -1077,14 +1079,15 @@ static jint setCallbackEncode(JNIEnv *env, jclass jClass, jlong handle, jint onM } fromUNewContext->onMalformedInput = getFromUCallback(onMalformedInput); fromUNewContext->onUnmappableInput = getFromUCallback(onUnmappableInput); + // BEGIN android-changed if(sub!=NULL) { fromUNewContext->length = length; strncpy(fromUNewContext->subChars, sub, length); + (*env)->ReleasePrimitiveArrayCritical(env,subChars, sub, 0); }else{ errorCode = U_ILLEGAL_ARGUMENT_ERROR; } - - (*env)->ReleasePrimitiveArrayCritical(env,subChars, NULL, 0); + // END android-changed ucnv_setFromUCallBack(conv, fromUNewAction, @@ -1203,13 +1206,15 @@ static jint setCallbackDecode(JNIEnv *env, jclass jClass, jlong handle, jint onM } toUNewContext->onMalformedInput = getToUCallback(onMalformedInput); toUNewContext->onUnmappableInput = getToUCallback(onUnmappableInput); + // BEGIN android-changed if(sub!=NULL) { toUNewContext->length = length; u_strncpy(toUNewContext->subUChars, sub, length); + (*env)->ReleasePrimitiveArrayCritical(env,subChars, sub, 0); }else{ errorCode = U_ILLEGAL_ARGUMENT_ERROR; } - (*env)->ReleasePrimitiveArrayCritical(env,subChars, NULL, 0); + // END android-changed ucnv_setToUCallBack(conv, toUNewAction, toUNewContext, @@ -1358,7 +1363,7 @@ static JNINativeMethod gMethods[] = { }; int register_com_ibm_icu4jni_converters_NativeConverter(JNIEnv *_env) { - return jniRegisterNativeMethods(_env, "com/ibm/icu4jni/converters/NativeConverter", + return jniRegisterNativeMethods(_env, "com/ibm/icu4jni/charset/NativeConverter", gMethods, NELEM(gMethods)); } diff --git a/icu/src/main/native/DecimalFormatInterface.cpp b/icu/src/main/native/DecimalFormatInterface.cpp index b87cbb7..243efeb 100644 --- a/icu/src/main/native/DecimalFormatInterface.cpp +++ b/icu/src/main/native/DecimalFormatInterface.cpp @@ -121,7 +121,7 @@ static jstring getSymbol(JNIEnv *env, jclass clazz, jint addr, jint symbol) { uint32_t resultlength, reslenneeded; - // the errorcode returned by unum_setSymbol + // the errorcode returned by unum_getSymbol UErrorCode status = U_ZERO_ERROR; // get the pointer to the number format @@ -173,7 +173,7 @@ static jint getAttribute(JNIEnv *env, jclass clazz, jint addr, jint symbol) { static void setTextAttribute(JNIEnv *env, jclass clazz, jint addr, jint symbol, jstring text) { - // the errorcode returned by unum_setSymbol + // the errorcode returned by unum_setTextAttribute UErrorCode status = U_ZERO_ERROR; // get the pointer to the number format @@ -195,7 +195,7 @@ static jstring getTextAttribute(JNIEnv *env, jclass clazz, jint addr, uint32_t resultlength, reslenneeded; - // the errorcode returned by unum_setSymbol + // the errorcode returned by unum_getTextAttribute UErrorCode status = U_ZERO_ERROR; // get the pointer to the number format @@ -231,7 +231,7 @@ static jstring getTextAttribute(JNIEnv *env, jclass clazz, jint addr, static void applyPatternImpl(JNIEnv *env, jclass clazz, jint addr, jboolean localized, jstring pattern) { - // the errorcode returned by unum_setSymbol + // the errorcode returned by unum_applyPattern UErrorCode status = U_ZERO_ERROR; // get the pointer to the number format @@ -252,7 +252,7 @@ static jstring toPatternImpl(JNIEnv *env, jclass clazz, jint addr, uint32_t resultlength, reslenneeded; - // the errorcode returned by unum_setSymbol + // the errorcode returned by unum_toPattern UErrorCode status = U_ZERO_ERROR; // get the pointer to the number format @@ -744,13 +744,14 @@ static jobject parse(JNIEnv *env, jclass clazz, jint addr, jstring text, return env->NewObject(longClass, longInitMethodID, (jlong) resultInt64); default: - break; + return NULL; } } else { int scale = digits.fCount - digits.fDecimalAt; - digits.fDigits[digits.fCount] = 0; // mc: ATTENTION: Abuse of Implementation Knowlegde! + // ATTENTION: Abuse of Implementation Knowlegde! + digits.fDigits[digits.fCount] = 0; if (digits.fIsPositive) { resultStr = env->NewStringUTF(digits.fDigits); } else { @@ -758,7 +759,8 @@ static jobject parse(JNIEnv *env, jclass clazz, jint addr, jstring text, env->CallVoidMethod(position, setIndexMethodID, (jint) parsePos); return env->NewObject(doubleClass, dblInitMethodID, (jdouble)-0); } else { - *(digits.fDigits - 1) = '-'; // mc: ATTENTION: Abuse of Implementation Knowlegde! + // ATTENTION: Abuse of Implementation Knowlegde! + *(digits.fDigits - 1) = '-'; resultStr = env->NewStringUTF(digits.fDigits - 1); } } @@ -769,7 +771,6 @@ static jobject parse(JNIEnv *env, jclass clazz, jint addr, jstring text, resultObject2 = env->NewObject(bigDecimalClass, bigDecimalInitMethodID, resultObject1, scale); return resultObject2; } - return NULL; // Don't see WHY, however!!! (Control never reaches here!!!) } static jint cloneImpl(JNIEnv *env, jclass clazz, jint addr) { diff --git a/icu/src/main/native/RBNFInterface.cpp b/icu/src/main/native/RBNFInterface.cpp index 17e7155..d9bf460 100644 --- a/icu/src/main/native/RBNFInterface.cpp +++ b/icu/src/main/native/RBNFInterface.cpp @@ -72,7 +72,7 @@ static jint openRBNFImpl1(JNIEnv* env, jclass clazz, } else if(type == 3) { style = URBNF_COUNT; } else { - printf("error"); + icuError(env, U_ILLEGAL_ARGUMENT_ERROR); } Locale loc = Locale::createFromName(localeChars); diff --git a/icu/src/main/native/ResourceInterface.cpp b/icu/src/main/native/ResourceInterface.cpp index a0c6922..562f480 100644 --- a/icu/src/main/native/ResourceInterface.cpp +++ b/icu/src/main/native/ResourceInterface.cpp @@ -420,6 +420,7 @@ static void getTimeZonesNative(JNIEnv* env, jclass clazz, const UnicodeString zoneID((UChar *)res, length); env->ReleaseStringChars(strObj, res); zones[i] = TimeZone::createTimeZone(zoneID); + env->DeleteLocalRef(strObj); } // 15th January 2008 |