Print

Print


Commit in GeomConverter/src/org/lcsim/geometry/layer on MAIN
LayerSlice.java+17-141.5 -> 1.6
Fixed GC-44 reported by Lima -- null material in slice.

GeomConverter/src/org/lcsim/geometry/layer
LayerSlice.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- LayerSlice.java	5 Jul 2005 22:40:17 -0000	1.5
+++ LayerSlice.java	19 Jul 2005 18:48:29 -0000	1.6
@@ -18,7 +18,7 @@
 {
     
     private boolean sensitive;
-    private Material material;
+    private Material material = null;
     private double thickness;
     
     public LayerSlice()
@@ -26,27 +26,30 @@
         material = null;
         thickness = 0.0;
         sensitive = false;
-    }
-    
-    public LayerSlice(Material m, double w, boolean sens)
-    {
-        material = m;
-        thickness = w;
-        sensitive = sens;
-    }
+    }    
     
     public LayerSlice(String matName, double w, boolean sens)
-    {    
-        //Material material = MaterialManager.getMaterial( matName );
-        Material material;
-        try {
+    {                    
+        try {            
             material = MaterialManager.findMaterial( matName );
         }
         catch (MaterialNotFoundException mnfe)
         {
-            throw new RuntimeException(mnfe);        
+            throw new RuntimeException("Material not found.", mnfe);        
         }                                
+                        
+        thickness = w;
+        sensitive = sens;
+    }
+    
+    private LayerSlice(Material m, double w, boolean sens)
+    {
+        if ( m == null )
+        {
+            throw new IllegalArgumentException("Material argument cannot be null.");
+        }
         
+        material = m;
         thickness = w;
         sensitive = sens;
     }
CVSspam 0.2.8