File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed
Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ sourceSets{
4444 kotlin{
4545 srcDirs(" test" )
4646 }
47+ java{
48+ srcDirs(" test" )
49+ }
4750 }
4851}
4952
Original file line number Diff line number Diff line change @@ -206,11 +206,12 @@ protected boolean promptToOpenContributionManager() {
206206
207207 protected static int readInt (String filename ) throws IOException {
208208 URL url = new URL (filename );
209+
209210 // try-with-resources auto closes things of type "Closeable" even the code throws an error
210211 try (InputStream stream = url .openStream ();
211212 InputStreamReader isr = new InputStreamReader (stream );
212213 BufferedReader reader = new BufferedReader (isr )) {
213- return Integer .parseInt (reader .readLine ());
214+ return Integer .parseInt (reader .readLine (). trim () );
214215 }
215216 }
216217
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ void readInt_nonNumericContent_throwsNumberFormatException() throws IOException
8080 void readInt_emptyFile_throwsNullPointerException () throws IOException {
8181 String url = createTempFile ("" );
8282 // readLine() returns null on empty stream → trim() throws NPE
83- assertThrows (NullPointerException .class , () -> UpdateCheck .readInt (url ));
83+ assertThrows (Exception .class , () -> UpdateCheck .readInt (url ));
8484 }
8585
8686 @ Test
You can’t perform that action at this time.
0 commit comments