From 170205908d72e51ba447daabbc8b2323c119a97e Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Fri, 28 Jun 2013 16:31:48 +0300
Subject: Replace printStackTrace with getLogger().log() (#12147)

Change-Id: I9ec61fdc7ddc06f129a9d69b99e6295a62c4b0d3
---
 server/src/com/vaadin/server/VaadinServlet.java          |  2 +-
 .../server/themeutils/SASSAddonImportFileCreator.java    |  8 +++++++-
 .../ui/components/colorpicker/ColorPickerPopup.java      | 16 ++++++++++++++--
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java
index a9eb42578e..94601d6599 100644
--- a/server/src/com/vaadin/server/VaadinServlet.java
+++ b/server/src/com/vaadin/server/VaadinServlet.java
@@ -814,7 +814,7 @@ public class VaadinServlet extends HttpServlet implements Constants {
                         new Object[] { realFilename, filename });
                 scss.compile();
             } catch (Exception e) {
-                e.printStackTrace();
+                getLogger().log(Level.WARNING, "Scss compilation failed", e);
                 return false;
             }
 
diff --git a/server/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java b/server/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java
index f199c347eb..94ca9e7d5b 100644
--- a/server/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java
+++ b/server/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java
@@ -26,6 +26,8 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import com.vaadin.server.widgetsetutils.ClassPathExplorer;
 import com.vaadin.server.widgetsetutils.ClassPathExplorer.LocationInfo;
@@ -126,10 +128,14 @@ public class SASSAddonImportFileCreator {
 
         } catch (FileNotFoundException e) {
             // Should not happen since file is checked before this
-            e.printStackTrace();
+            getLogger().log(Level.WARNING, "Error updating addons.scss", e);
         }
     }
 
+    private static Logger getLogger() {
+        return Logger.getLogger(SASSAddonImportFileCreator.class.getName());
+    }
+
     private static List<String> addImport(PrintStream stream, String file,
             URL location) {
 
diff --git a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java
index b1eef16024..9774211bea 100644
--- a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java
+++ b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java
@@ -22,6 +22,8 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import com.vaadin.data.Property.ValueChangeEvent;
 import com.vaadin.data.Property.ValueChangeListener;
@@ -567,7 +569,10 @@ public class ColorPickerPopup extends Window implements ClickListener,
             blueSlider.setValue(((Integer) color.getBlue()).doubleValue());
             greenSlider.setValue(((Integer) color.getGreen()).doubleValue());
         } catch (ValueOutOfBoundsException e) {
-            e.printStackTrace();
+            getLogger().log(
+                    Level.WARNING,
+                    "Unable to set RGB color value to " + color.getRed() + ","
+                            + color.getGreen() + "," + color.getBlue(), e);
         }
     }
 
@@ -577,7 +582,10 @@ public class ColorPickerPopup extends Window implements ClickListener,
             saturationSlider.setValue(((Float) (hsv[1] * 100f)).doubleValue());
             valueSlider.setValue(((Float) (hsv[2] * 100f)).doubleValue());
         } catch (ValueOutOfBoundsException e) {
-            e.printStackTrace();
+            getLogger().log(
+                    Level.WARNING,
+                    "Unable to set HSV color value to " + hsv[0] + "," + hsv[1]
+                            + "," + hsv[2], e);
         }
     }
 
@@ -764,4 +772,8 @@ public class ColorPickerPopup extends Window implements ClickListener,
             return color;
         }
     };
+
+    public static Logger getLogger() {
+        return Logger.getLogger(ColorPickerPopup.class.getName());
+    }
 }
\ No newline at end of file
-- 
cgit v1.2.3