Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
BUG 2839: Config: remove dependencies on commons-io
[controller.git]
/
opendaylight
/
config
/
yang-test-plugin
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
config
/
yang
/
test
/
plugin
/
ProcessSources.java
diff --git
a/opendaylight/config/yang-test-plugin/src/main/java/org/opendaylight/controller/config/yang/test/plugin/ProcessSources.java
b/opendaylight/config/yang-test-plugin/src/main/java/org/opendaylight/controller/config/yang/test/plugin/ProcessSources.java
index 7a20f22440a75dc97f45ed9575c1d9364f40c3fb..054edffe68a77aa3d4e87ec15a986f79cadaa78c 100644
(file)
--- a/
opendaylight/config/yang-test-plugin/src/main/java/org/opendaylight/controller/config/yang/test/plugin/ProcessSources.java
+++ b/
opendaylight/config/yang-test-plugin/src/main/java/org/opendaylight/controller/config/yang/test/plugin/ProcessSources.java
@@
-7,14
+7,14
@@
*/
package org.opendaylight.controller.config.yang.test.plugin;
*/
package org.opendaylight.controller.config.yang.test.plugin;
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-
+import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
import java.io.File;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.regex.Pattern;
import java.util.regex.Pattern;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
/**
* Add implementation code from stub.txt
/**
* Add implementation code from stub.txt
@@
-39,7
+39,7
@@
public class ProcessSources extends AbstractMojo{
}
File sourceDirectory = new File(directory.getPath() + Util.replaceDots(".org.opendaylight.controller.config.yang.test.impl"));
if (!sourceDirectory.exists()) {
}
File sourceDirectory = new File(directory.getPath() + Util.replaceDots(".org.opendaylight.controller.config.yang.test.impl"));
if (!sourceDirectory.exists()) {
- super.getLog().error(
"Source directory does not exists " + sourceDirectory.getPath(
));
+ super.getLog().error(
String.format("Source directory does not exists %s", sourceDirectory.getPath()
));
}
File[] sourceFiles = sourceDirectory.listFiles();
}
File[] sourceFiles = sourceDirectory.listFiles();
@@
-47,9
+47,9
@@
public class ProcessSources extends AbstractMojo{
if (sourceFile.getName().endsWith(".java")) {
String sourceContent;
try {
if (sourceFile.getName().endsWith(".java")) {
String sourceContent;
try {
- sourceContent = File
Utils.readFileToString(sourceFile
);
+ sourceContent = File
s.toString(sourceFile, StandardCharsets.UTF_8
);
} catch (IOException e) {
} catch (IOException e) {
- getLog().error(
"Cannot read " + sourceFile.getAbsolutePath(
), e);
+ getLog().error(
String.format("Cannot read %s", sourceFile.getAbsolutePath()
), e);
continue;
}
if (sourceFile.getName().endsWith("Module.java") || sourceFile.getName().endsWith("ModuleFactory.java")) {
continue;
}
if (sourceFile.getName().endsWith("Module.java") || sourceFile.getName().endsWith("ModuleFactory.java")) {
@@
-57,9
+57,9
@@
public class ProcessSources extends AbstractMojo{
if (stubFile.exists()) {
String stubContent = null;
try {
if (stubFile.exists()) {
String stubContent = null;
try {
- stubContent = File
Utils.readFileToString(stubFile
);
+ stubContent = File
s.toString(stubFile, StandardCharsets.UTF_8
);
} catch (IOException e) {
} catch (IOException e) {
- getLog().error(
"Cannot read " + stubFile.getAbsolutePath(
), e);
+ getLog().error(
String.format("Cannot read %s", stubFile.getAbsolutePath()
), e);
}
if (stubContent != null) {
sourceContent = rewriteStub(sourceContent, stubContent);
}
if (stubContent != null) {
sourceContent = rewriteStub(sourceContent, stubContent);
@@
-71,9
+71,9
@@
public class ProcessSources extends AbstractMojo{
// replace the file content
try {
// replace the file content
try {
- File
Utils.write(sourceFile, sourceContent
);
+ File
s.write(sourceContent, sourceFile, StandardCharsets.UTF_8
);
} catch (IOException e) {
} catch (IOException e) {
- getLog().error(
"Cannot write " + sourceFile.getAbsolutePath(
), e);
+ getLog().error(
String.format("Cannot write %s", sourceFile.getAbsolutePath()
), e);
}
}
}
}