Revision: 601
Author: mr0...@mro.name
Date: Tue Jul 28 13:41:36 2009
Log: issue#101 - throw a RTE wrappping the original EX.
http://code.google.com/p/piccolo2d/source/detail?r=601

Modified:
  /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java
   
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PColorActivity.java
   
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PCanvasTest.java
   
/piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/swt/SWTBenchTest.java
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
   
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTPath.java
   
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/SWTGraphics2D.java

=======================================
--- /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java      
 
Tue Jul 28 13:25:13 2009
+++ /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java      
 
Tue Jul 28 13:41:36 2009
@@ -2580,8 +2580,7 @@
                  printJob.print();
              }
              catch (final PrinterException e) {
-                System.out.println("Error Printing");
-                e.printStackTrace();
+                throw new RuntimeException("Error Printing", e);
              }
          }
      }
=======================================
---  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PColorActivity.java
       
Tue Jul 28 12:46:54 2009
+++  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PColorActivity.java
       
Tue Jul 28 13:41:36 2009
@@ -121,10 +121,10 @@

      public void setRelativeTargetValue(final float zeroToOne) {
          super.setRelativeTargetValue(zeroToOne);
-        final float red = (source.getRed() + zeroToOne *  
(destination.getRed() - source.getRed()));
-        final float green = (source.getGreen() + zeroToOne *  
(destination.getGreen() - source.getGreen()));
-        final float blue = (source.getBlue() + zeroToOne *  
(destination.getBlue() - source.getBlue()));
-        final float alpha = (source.getAlpha() + zeroToOne *  
(destination.getAlpha() - source.getAlpha()));
+        final float red = source.getRed() + zeroToOne *  
(destination.getRed() - source.getRed());
+        final float green = source.getGreen() + zeroToOne *  
(destination.getGreen() - source.getGreen());
+        final float blue = source.getBlue() + zeroToOne *  
(destination.getBlue() - source.getBlue());
+        final float alpha = source.getAlpha() + zeroToOne *  
(destination.getAlpha() - source.getAlpha());
          target.setColor(new Color(red / 255, green / 255, blue / 255,  
alpha / 255));
      }

=======================================
---  
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PCanvasTest.java    
 
Tue Jul 28 12:46:54 2009
+++  
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PCanvasTest.java    
 
Tue Jul 28 13:41:36 2009
@@ -106,7 +106,7 @@
          final PInputEventListener[] listeners =  
canvas.getInputEventListeners();
          assertNotNull(listeners);
          assertEquals(3, listeners.length); // 3 since pan and zoom are  
attached
-                                           // by default
+        // by default
      }

      public void testRemoveInputEventListenersIsHonoured() {
@@ -115,7 +115,7 @@
          final PInputEventListener[] listeners =  
canvas.getInputEventListeners();
          assertNotNull(listeners);
          assertEquals(2, listeners.length); // 3 since pan and zoom are  
attached
-                                           // by default
+        // by default
      }

      public void testMemoryLeak() throws InterruptedException {
=======================================
---  
/piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/swt/SWTBenchTest.java
   
Tue Jul 28 12:46:54 2009
+++  
/piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/swt/SWTBenchTest.java
   
Tue Jul 28 13:41:36 2009
@@ -409,8 +409,7 @@
              results = new int[NUM_CONTEXTS][NUM_TESTS];
          }
          catch (final IOException e) {
-            e.printStackTrace();
-            System.exit(1);
+            throw new RuntimeException(e);
          }
      }

=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java
    
Tue Jul 28 12:46:54 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java
    
Tue Jul 28 13:41:36 2009
@@ -267,7 +267,9 @@
                  catch (final InvocationTargetException e) {
                      // Since this is how Swing handles Exceptions that get
                      // thrown on listeners, it's probably ok to do it here.
-                    e.printStackTrace();
+                    // mro: disagree. Now matter how Swing does it, either
+                    // handle or rethrow.
+                    throw new RuntimeException(e);
                  }
              }
          }
=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
    
Tue Jul 28 12:46:54 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
    
Tue Jul 28 13:41:36 2009
@@ -412,8 +412,8 @@
                  }
              }
              else {
-                new Exception("PInputEvent.getSourceSwingEvent was not a  
MouseEvent.  Actual event: "
-                        + sourceSwingEvent + ", class=" +  
sourceSwingEvent.getClass().getName()).printStackTrace();
+                throw new  
RuntimeException("PInputEvent.getSourceSwingEvent was not a MouseEvent.   
Actual event: "
+                        + sourceSwingEvent + ", class=" +  
sourceSwingEvent.getClass().getName());
              }
          }
      }
=======================================
---  
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTPath.java   
 
Tue Jul 28 12:46:54 2009
+++  
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTPath.java   
 
Tue Jul 28 13:41:36 2009
@@ -390,7 +390,8 @@
              return new Line2D.Double(l2.getP1(), l2.getP2());
          }
          else {
-            new Exception().printStackTrace();
+            // again: either throw or don't - but nothing in between  
please.
+            // new Exception().printStackTrace();
              final GeneralPath aPath = new GeneralPath();
              aPath.append(aShape, false);
              return aPath;
=======================================
---  
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/SWTGraphics2D.java
       
Tue Jul 28 12:46:54 2009
+++  
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/SWTGraphics2D.java
       
Tue Jul 28 13:41:36 2009
@@ -121,7 +121,7 @@
              SWTShapeManager.transform(aRect, transform.createInverse());
          }
          catch (final Exception e) {
-            e.printStackTrace();
+            throw new RuntimeException(e);
          }
          return aRect;
      }
@@ -182,7 +182,7 @@
              SWTShapeManager.transform(aRect, transform.createInverse());
          }
          catch (final Exception e) {
-            e.printStackTrace();
+            throw new RuntimeException(e);
          }
          return aRect;
      }
@@ -311,7 +311,7 @@
                  sizeInt =  
Integer.parseInt(size.substring(size.indexOf("=") + 1, size.length()));
              }
              catch (final Exception e) {
-                e.printStackTrace();
+                throw new RuntimeException(e);
              }

              cachedFont = new org.eclipse.swt.graphics.Font(device,

--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to