- re-activate some tests

M webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/PreferencesImpl.java

- Make null an acceptable argument for prefValue.  Make it mean, remove
  the pref.

M webclient/src_moz/PreferencesImpl.cpp

- make a null prefValue argument to nativeSetUnicharPref mean, ClearPref().
This commit is contained in:
edburns%acm.org 2004-04-11 01:09:03 +00:00
Родитель bcd2b59667
Коммит eda24f9718
3 изменённых файлов: 22 добавлений и 18 удалений

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -106,9 +106,6 @@ public void setPref(String prefName, String prefValue)
if (null == prefName) {
return;
}
if (null == prefValue) {
return;
}
// determine the type of pref value: String, boolean, integer
try {
Integer intVal = Integer.valueOf(prefValue);
@ -116,7 +113,8 @@ public void setPref(String prefName, String prefValue)
}
catch (NumberFormatException e) {
// it's not an integer
if (prefValue.equals("true") || prefValue.equals("false")) {
if (null != prefValue &&
(prefValue.equals("true") || prefValue.equals("false"))) {
Boolean boolVal = Boolean.valueOf(prefValue);
nativeSetBoolPref(getWrapperFactory().getNativeContext(), prefName,
boolVal.booleanValue());

Просмотреть файл

@ -111,22 +111,28 @@ Java_org_mozilla_webclient_impl_wrapper_1native_PreferencesImpl_nativeSetUnichar
const char * prefNameChars = (char *)::util_GetStringUTFChars(env,
prefName);
const jchar * prefValueChars = (jchar *)::util_GetStringChars(env,
prefValue);
if (nsnull == prefNameChars) {
::util_ThrowExceptionToJava(env, "nativeSetUnicharPref: unable to extract Java string for pref name");
rv = NS_ERROR_NULL_POINTER;
goto OMWIWNPINSUP_CLEANUP;
const jchar * prefValueChars = nsnull;
if (nsnull != prefValue) {
prefValueChars =
(jchar *)::util_GetStringChars(env, prefValue);
if (nsnull == prefNameChars) {
::util_ThrowExceptionToJava(env, "nativeSetUnicharPref: unable to extract Java string for pref name");
rv = NS_ERROR_NULL_POINTER;
goto OMWIWNPINSUP_CLEANUP;
}
if (nsnull == prefValueChars) {
::util_ThrowExceptionToJava(env, "nativeSetUnicharPref: unable to extract Java string for pref value");
rv = NS_ERROR_NULL_POINTER;
goto OMWIWNPINSUP_CLEANUP;
}
rv = prefs->SetUnicharPref(prefNameChars,
(const PRUnichar *) prefValueChars);
}
if (nsnull == prefValueChars) {
::util_ThrowExceptionToJava(env, "nativeSetUnicharPref: unable to extract Java string for pref value");
rv = NS_ERROR_NULL_POINTER;
goto OMWIWNPINSUP_CLEANUP;
else {
rv = prefs->ClearUserPref(prefNameChars);
}
rv = prefs->SetUnicharPref(prefNameChars,
(const PRUnichar *) prefValueChars);
OMWIWNPINSUP_CLEANUP:
::util_ReleaseStringUTFChars(env, prefName, prefNameChars);