mirror of
https://github.com/apache/commons-math.git
synced 2025-02-08 02:59:36 +00:00
Report missing resource rather than failing with NPE if not fount
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1164986 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7dabaab113
commit
e79fcea6cf
@ -17,6 +17,7 @@
|
|||||||
package org.apache.commons.math.stat;
|
package org.apache.commons.math.stat;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
|
||||||
@ -112,10 +113,12 @@ public class CertifiedDataTest {
|
|||||||
mean = Double.NaN;
|
mean = Double.NaN;
|
||||||
std = Double.NaN;
|
std = Double.NaN;
|
||||||
|
|
||||||
|
InputStream resourceAsStream = CertifiedDataTest.class.getResourceAsStream(resource);
|
||||||
|
Assert.assertNotNull("Could not find resource "+resource,resourceAsStream);
|
||||||
BufferedReader in =
|
BufferedReader in =
|
||||||
new BufferedReader(
|
new BufferedReader(
|
||||||
new InputStreamReader(
|
new InputStreamReader(
|
||||||
CertifiedDataTest.class.getResourceAsStream(resource)));
|
resourceAsStream));
|
||||||
|
|
||||||
String line = null;
|
String line = null;
|
||||||
|
|
||||||
@ -144,6 +147,7 @@ public class CertifiedDataTest {
|
|||||||
line = in.readLine();
|
line = in.readLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resourceAsStream.close();
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user