29
29
*/
30
30
package com .qulice .findbugs ;
31
31
32
- import com .google .common .io .Files ;
33
32
import com .jcabi .log .Logger ;
34
33
import java .io .File ;
35
34
import java .io .IOException ;
36
35
import java .nio .charset .StandardCharsets ;
36
+ import java .nio .file .Files ;
37
+ import java .nio .file .Path ;
37
38
import java .util .Collection ;
38
39
import org .apache .commons .io .FileUtils ;
39
40
import org .apache .commons .io .IOUtils ;
@@ -65,7 +66,7 @@ public BytecodeMocker withSource(final String src) {
65
66
* @throws IOException If some problem
66
67
*/
67
68
public byte [] mock () throws IOException {
68
- final File outdir = Files .createTempDir ( );
69
+ final Path outdir = Files .createTempDirectory ( "" );
69
70
final File input = File .createTempFile ("input" , ".java" );
70
71
FileUtils .writeStringToFile (
71
72
input ,
@@ -75,7 +76,7 @@ public byte[] mock() throws IOException {
75
76
final ProcessBuilder builder = new ProcessBuilder (
76
77
"javac" ,
77
78
"-d" ,
78
- outdir .getPath (),
79
+ outdir .toString (),
79
80
input .getPath ()
80
81
);
81
82
final Process process = builder .start ();
@@ -97,12 +98,12 @@ public byte[] mock() throws IOException {
97
98
)
98
99
);
99
100
}
100
- final byte [] bytes = this .findIn (outdir );
101
+ final byte [] bytes = this .findIn (outdir . toFile () );
101
102
Logger .debug (
102
103
this , "#mock(): produced %d bytes in bytecode for '%s'" ,
103
104
bytes .length , this .source
104
105
);
105
- FileUtils .deleteDirectory (outdir );
106
+ FileUtils .deleteDirectory (outdir . toFile () );
106
107
return bytes ;
107
108
}
108
109
0 commit comments