Revision: 562
Author: mr0...@mro.name
Date: Sat Jul 25 06:29:38 2009
Log: fix issue#101 by throwing RuntimeExceptions.
http://code.google.com/p/piccolo2d/source/detail?r=562

Modified:
  /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.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      
 
Sat Jul 25 06:11:25 2009
+++ /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java      
 
Sat Jul 25 06:29:38 2009
@@ -2628,8 +2628,7 @@
                  printJob.print();
              }
              catch (PrinterException e) {
-                System.out.println("Error Printing");
-                e.printStackTrace();
+                throw new RuntimeException("Error Printing", e);
              }
          }
      }
=======================================
---  
/piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/swt/SWTBenchTest.java
   
Fri Jul 17 06:39:05 2009
+++  
/piccolo2d.java/trunk/examples/src/main/java/edu/umd/cs/piccolo/examples/swt/SWTBenchTest.java
   
Sat Jul 25 06:29:38 2009
@@ -399,8 +399,7 @@
              results = new int[NUM_CONTEXTS][NUM_TESTS];
          }
          catch (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 21 07:33:17 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java
    
Sat Jul 25 06:29:38 2009
@@ -267,7 +267,8 @@
                  catch (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: if Swing does it wrong we don't have to.
+                    throw new RuntimeException(e);
                  }
              }
          }
=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
    
Sat Jul 18 17:58:21 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
    
Sat Jul 25 06:29:38 2009
@@ -362,11 +362,12 @@
      private void cameraToLocal(PCamera topCamera, Point2D pt, PNode node) {
          AffineTransform inverse;
          try {
-             inverse = topCamera.getViewTransform().createInverse();
-        } catch (NoninvertibleTransformException e) {
+            inverse = topCamera.getViewTransform().createInverse();
+        }
+        catch (NoninvertibleTransformException e) {
              throw new PAffineTransformException(e,  
topCamera.getViewTransform());
          }
-
+
          /*
           * Only apply the camera's view transform when this node is a  
descendant
           * of PLayer
@@ -410,10 +411,11 @@
                  }
              }
              else {
-                new Exception("PInputEvent.getSourceSwingEvent was not a  
MouseEvent.  Actual event: "
-                        + sourceSwingEvent + ", class=" +  
sourceSwingEvent.getClass().getName()).printStackTrace();
-            }
-        }
+                // what was that? an exception to format syslog output?
+                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   
 
Fri Jan 23 12:30:32 2009
+++  
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTPath.java   
 
Sat Jul 25 06:29:38 2009
@@ -383,7 +383,8 @@
              return new Line2D.Double(l2.getP1(), l2.getP2());
          }
          else {
-            new Exception().printStackTrace();
+            // either throw an exception or don't. But don't just write to  
sysout
+            // new Exception().printStackTrace();
              GeneralPath aPath = new GeneralPath();
              aPath.append(aShape, false);
              return aPath;
=======================================
---  
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/SWTGraphics2D.java
       
Fri Jan 23 12:30:32 2009
+++  
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/SWTGraphics2D.java
       
Sat Jul 25 06:29:38 2009
@@ -121,7 +121,7 @@
              SWTShapeManager.transform(aRect, transform.createInverse());
          }
          catch (Exception e) {
-            e.printStackTrace();
+            throw new RuntimeException(e);
          }
          return aRect;
      }
@@ -182,7 +182,7 @@
              SWTShapeManager.transform(aRect, transform.createInverse());
          }
          catch (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 (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