Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Refactor LeaderElectionScenarioTests"
[controller.git]
/
opendaylight
/
config
/
config-manager
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
config
/
manager
/
impl
/
osgi
/
ModuleFactoryBundleTracker.java
diff --git
a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ModuleFactoryBundleTracker.java
b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ModuleFactoryBundleTracker.java
index cc71370c95891d58bb6473c8ec3f2425702fa7f9..cd72a73ecf3455365c35ae1a74b71d62654f9763 100644
(file)
--- a/
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ModuleFactoryBundleTracker.java
+++ b/
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ModuleFactoryBundleTracker.java
@@
-8,12
+8,11
@@
package org.opendaylight.controller.config.manager.impl.osgi;
import static java.lang.String.format;
package org.opendaylight.controller.config.manager.impl.osgi;
import static java.lang.String.format;
-
import com.google.common.annotations.VisibleForTesting;
import com.google.common.annotations.VisibleForTesting;
-import java.io.InputStream;
+import com.google.common.base.Charsets;
+import com.google.common.io.Resources;
+import java.io.IOException;
import java.net.URL;
import java.net.URL;
-import java.util.List;
-import org.apache.commons.io.IOUtils;
import org.opendaylight.controller.config.spi.ModuleFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
import org.opendaylight.controller.config.spi.ModuleFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
@@
-22,7
+21,6
@@
import org.osgi.util.tracker.BundleTrackerCustomizer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
/**
* OSGi extender that listens for bundle activation events. Reads file
* META-INF/services/org.opendaylight.controller.config.spi.ModuleFactory, each
/**
* OSGi extender that listens for bundle activation events. Reads file
* META-INF/services/org.opendaylight.controller.config.spi.ModuleFactory, each
@@
-46,12
+44,11
@@
public class ModuleFactoryBundleTracker implements BundleTrackerCustomizer<Objec
LOG.trace("Got addingBundle event of bundle {}, resource {}, event {}",
bundle, resource, event);
if (resource != null) {
LOG.trace("Got addingBundle event of bundle {}, resource {}, event {}",
bundle, resource, event);
if (resource != null) {
- try (InputStream inputStream = resource.openStream()) {
- List<String> lines = IOUtils.readLines(inputStream);
- for (String factoryClassName : lines) {
+ try {
+ for (String factoryClassName : Resources.readLines(resource, Charsets.UTF_8)) {
registerFactory(factoryClassName, bundle);
}
registerFactory(factoryClassName, bundle);
}
- } catch (Exception e) {
+ } catch (
IO
Exception e) {
LOG.error("Error while reading {}", resource, e);
throw new RuntimeException(e);
}
LOG.error("Error while reading {}", resource, e);
throw new RuntimeException(e);
}