File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/java/pt/lsts/neptus/util Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 3232 */
3333package pt .lsts .neptus .util ;
3434
35+ import java .io .File ;
3536import java .io .FileInputStream ;
3637import java .io .FileNotFoundException ;
3738import java .io .FileOutputStream ;
3839import java .io .IOException ;
3940import java .io .InputStream ;
4041import java .io .OutputStream ;
42+ import java .nio .file .Files ;
43+ import java .nio .file .Path ;
44+ import java .nio .file .Paths ;
4145import java .util .Properties ;
4246
4347import pt .lsts .neptus .NeptusLog ;
@@ -142,7 +146,11 @@ public void setFile(InputStream in) throws IOException {
142146 * @param txfile Nome do ficheiro dos <i>properties </i>.
143147 */
144148 public void setFile (String txfile ) throws FileNotFoundException , IOException {
145- InputStream in = new FileInputStream (txfile );
149+ File fx = new File (txfile );
150+ if (!fx .exists ()) {
151+ throw new FileNotFoundException (txfile );
152+ }
153+ InputStream in = Files .newInputStream (Paths .get (txfile ));
146154 setFile (in );
147155 }
148156
You can’t perform that action at this time.
0 commit comments