pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roger Whitcomb <Roger.Whitc...@actian.com>
Subject RE: svn commit: r1619715 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java
Date Fri, 22 Aug 2014 20:58:34 GMT
Ciao Sandro,
	Wouldn't it be easier in the code to just check for the return from "properties.get" being
null rather than catching a NullPointerException?  Something like this:
String color = (String)properties.get("defaultBackgroundColor");
If (color != null) {
    defaultBackgroundColor = Color.decode(color);
} else {
   If (!isThemeDark()....

~Roger

-----Original Message-----
From: smartini@apache.org [mailto:smartini@apache.org] 
Sent: Friday, August 22, 2014 2:25 AM
To: commits@pivot.apache.org
Subject: svn commit: r1619715 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java

Author: smartini
Date: Fri Aug 22 09:25:27 2014
New Revision: 1619715

URL: http://svn.apache.org/r1619715
Log:
PIVOT-689, DRY.

Modified:
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java?rev=1619715&r1=1619714&r2=1619715&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java Fri Aug 22 09:25:27
2014
@@ -297,20 +297,12 @@ public final class TerraTheme extends Th
                 try {
                     defaultBackgroundColor = Color.decode((String) properties.get("defaultBackgroundColor"));
                 } catch (NullPointerException npe1) {
-                    if (!isThemeDark()) {
-                        defaultBackgroundColor = Color.WHITE;
-                    } else {
-                        defaultBackgroundColor = Color.BLACK;
-                    }
+                    defaultBackgroundColor = super.getDefaultBackgroundColor();
                 }
                 try {
                     defaultForegroundColor = Color.decode((String) properties.get("defaultForegroundColor"));
                 } catch (NullPointerException npe2) {
-                    if (!isThemeDark()) {
-                        defaultForegroundColor = Color.WHITE;
-                    } else {
-                        defaultForegroundColor = Color.BLACK;
-                    }
+                    defaultForegroundColor = super.getDefaultForegroundColor();
                 }
             } finally {
                 inputStream.close();


Mime
View raw message