commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1164986 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/CertifiedDataTest.java
Date Sun, 04 Sep 2011 10:29:03 GMT
Author: sebb
Date: Sun Sep  4 10:29:03 2011
New Revision: 1164986

URL: http://svn.apache.org/viewvc?rev=1164986&view=rev
Log:
Report missing resource rather than failing with NPE if not fount

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/CertifiedDataTest.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/CertifiedDataTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/CertifiedDataTest.java?rev=1164986&r1=1164985&r2=1164986&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/CertifiedDataTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/CertifiedDataTest.java
Sun Sep  4 10:29:03 2011
@@ -17,6 +17,7 @@
 package org.apache.commons.math.stat;
 
 import java.io.BufferedReader;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 
 
@@ -112,10 +113,12 @@ public class CertifiedDataTest {
         mean = Double.NaN;
         std = Double.NaN;
 
+        InputStream resourceAsStream = CertifiedDataTest.class.getResourceAsStream(resource);
+        Assert.assertNotNull("Could not find resource "+resource,resourceAsStream);
         BufferedReader in =
             new BufferedReader(
                     new InputStreamReader(
-                            CertifiedDataTest.class.getResourceAsStream(resource)));
+                            resourceAsStream));
 
         String line = null;
 
@@ -144,6 +147,7 @@ public class CertifiedDataTest {
             line = in.readLine();
         }
 
+        resourceAsStream.close();
         in.close();
     }
 }



Mime
View raw message