--- a/jdk/src/windows/native/sun/windows/ThemeReader.cpp Tue Apr 01 01:03:52 2014 +0400
+++ b/jdk/src/windows/native/sun/windows/ThemeReader.cpp Tue Apr 01 01:59:59 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -233,7 +233,7 @@
Themed = InitThemes();
TryLoadingThemeLib = TRUE;
}
- return Themed;
+ return JNI_IS_TRUE(Themed);
}
@@ -271,6 +271,10 @@
(JNIEnv *env, jclass klass, jstring widget) {
LPCTSTR str = (LPCTSTR) JNU_GetStringPlatformChars(env, widget, NULL);
+ if (str == NULL) {
+ JNU_ThrowOutOfMemoryError(env, 0);
+ return 0;
+ }
// We need to open the Theme on a Window that will stick around.
// The best one for that purpose is the Toolkit window.
HTHEME htheme = OpenThemeData(AwtToolkit::GetInstance().GetHWnd(), str);
@@ -485,6 +489,7 @@
if (insetsClassID == NULL) {
jclass insetsClassIDLocal = env->FindClass("java/awt/Insets");
+ CHECK_NULL_RETURN(insetsClassIDLocal, NULL);
insetsClassID = (jclass)env->NewGlobalRef(insetsClassIDLocal);
env->DeleteLocalRef(insetsClassIDLocal);
}
@@ -533,7 +538,7 @@
JNIEXPORT jboolean JNICALL Java_sun_awt_windows_ThemeReader_isThemePartDefined
(JNIEnv *env, jclass klass, jlong theme, jint part, jint state) {
HTHEME hTheme = (HTHEME) theme;
- return IsThemePartDefined(hTheme, part, state);
+ return JNI_IS_TRUE(IsThemePartDefined(hTheme, part, state));
}
/*
@@ -562,12 +567,14 @@
if (colorClassID == NULL) {
jclass colorClassIDLocal = env->FindClass("java/awt/Color");
+ CHECK_NULL_RETURN(colorClassIDLocal, NULL);
colorClassID = (jclass)env->NewGlobalRef(colorClassIDLocal);
env->DeleteLocalRef(colorClassIDLocal);
}
if (colorMID == NULL) {
colorMID = env->GetMethodID(colorClassID, "<init>", "(III)V");
+ CHECK_NULL_RETURN(colorMID, NULL);
}
jobject colorObj = env->NewObject(colorClassID,
colorMID, GetRValue(color), GetGValue(color),GetBValue(color));
@@ -628,7 +635,7 @@
HRESULT hres = GetThemeBool(hTheme, part, state, prop, &retVal);
assert_result(hres, env);
}
- return retVal;
+ return JNI_IS_TRUE(retVal);
}
/*
@@ -640,15 +647,11 @@
(JNIEnv *env, jclass klass, jlong theme, jint prop) {
HTHEME hTheme = (HTHEME)theme;
if (hTheme != NULL) {
- return GetThemeSysBool(hTheme, prop);
+ return JNI_IS_TRUE(GetThemeSysBool(hTheme, prop));
}
- return FALSE;
+ return JNI_FALSE;
}
-
-
-
-
/*
* Class: sun_awt_windows_ThemeReader
* Method: getPoint
@@ -673,12 +676,14 @@
if (pointClassID == NULL) {
jclass pointClassIDLocal = env->FindClass("java/awt/Point");
+ CHECK_NULL_RETURN(pointClassIDLocal, NULL);
pointClassID = (jclass)env->NewGlobalRef(pointClassIDLocal);
env->DeleteLocalRef(pointClassIDLocal);
}
if (pointMID == NULL) {
pointMID = env->GetMethodID(pointClassID, "<init>", "(II)V");
+ CHECK_NULL_RETURN(pointMID, NULL);
}
jobject pointObj = env->NewObject(pointClassID, pointMID, point.x, point.y);
@@ -720,11 +725,13 @@
static jclass dimClassID = NULL;
if (dimClassID == NULL) {
jclass dimClassIDLocal = env->FindClass("java/awt/Dimension");
+ CHECK_NULL_RETURN(dimClassIDLocal, NULL);
dimClassID = (jclass)env->NewGlobalRef(dimClassIDLocal);
env->DeleteLocalRef(dimClassIDLocal);
}
if (dimMID == NULL) {
dimMID = env->GetMethodID(dimClassID, "<init>", "(II)V");
+ CHECK_NULL_RETURN(dimMID, NULL);
}
jobject dimObj = env->NewObject(dimClassID, dimMID, point.x, point.y);
@@ -755,11 +762,13 @@
static jclass dimClassID = NULL;
if (dimClassID == NULL) {
jclass dimClassIDLocal = env->FindClass("java/awt/Dimension");
+ CHECK_NULL_RETURN(dimClassIDLocal, NULL);
dimClassID = (jclass)env->NewGlobalRef(dimClassIDLocal);
env->DeleteLocalRef(dimClassIDLocal);
}
if (dimMID == NULL) {
dimMID = env->GetMethodID(dimClassID, "<init>", "(II)V");
+ CHECK_NULL_RETURN(dimMID, NULL);
}
jobject dimObj = env->NewObject(dimClassID, dimMID, size.cx, size.cy);
if (safe_ExceptionOccurred(env)) {