- stubLines = Util.loadStubFile(stubFile.getPath());
- }
-
- InputStream javaIn = new FileInputStream(sourceFile.getPath());
- BufferedReader javaBuf = new BufferedReader(new InputStreamReader(javaIn));
- StringBuffer output = new StringBuffer();
- String line = javaBuf.readLine();
- boolean writeLine = false;
- while ((line = javaBuf.readLine()) != null) {
- if(!writeLine && line.contains("*/")) {
- line = header;
- writeLine = true;
- } else {
- if (line.contains("TODO")) {
- writeLine = false;
- } else {
- if (stubLines != null && line.contains("throw new")) {
- line = stubLines.toString();
- writeLine = true;
- }
- }
+ String stubContent = null;
+ try {
+ stubContent = Files.toString(stubFile, StandardCharsets.UTF_8);
+ } catch (IOException e) {
+ getLog().error(String.format("Cannot read %s", stubFile.getAbsolutePath()), e);