X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-persister-file-xml-adapter%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fpersist%2Fstorage%2Ffile%2Fxml%2FXmlFileStorageAdapter.java;h=c81aa9bec5398a4ed20259cc240fda14075eac81;hp=a714fdc9d27dd4c1901fa1f0ef25045b82cb138b;hb=a110503f173ba4fbeb07a61d3c7ebf1688dfc9d6;hpb=9ddc65e1ddae50f691566cd9382707679436c055 diff --git a/opendaylight/config/config-persister-file-xml-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/xml/XmlFileStorageAdapter.java b/opendaylight/config/config-persister-file-xml-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/xml/XmlFileStorageAdapter.java index a714fdc9d2..c81aa9bec5 100644 --- a/opendaylight/config/config-persister-file-xml-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/xml/XmlFileStorageAdapter.java +++ b/opendaylight/config/config-persister-file-xml-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/xml/XmlFileStorageAdapter.java @@ -56,30 +56,30 @@ public class XmlFileStorageAdapter implements StorageAdapter, Persister { return instance; } - File storage = extractStorageFileFromProperties(propertiesProvider); - LOG.debug("Using file {}", storage.getAbsolutePath()); + File localStorage = extractStorageFileFromProperties(propertiesProvider); + LOG.debug("Using file {}", localStorage.getAbsolutePath()); // Create file if it does not exist - File parentFile = storage.getAbsoluteFile().getParentFile(); - if (parentFile.exists() == false) { + File parentFile = localStorage.getAbsoluteFile().getParentFile(); + if (!parentFile.exists()) { LOG.debug("Creating parent folders {}", parentFile); parentFile.mkdirs(); } - if (storage.exists() == false) { + if (!localStorage.exists()) { LOG.debug("Storage file does not exist, creating empty file"); try { - boolean result = storage.createNewFile(); - if (result == false) { - throw new RuntimeException("Unable to create storage file " + storage); + boolean result = localStorage.createNewFile(); + if (!result) { + throw new RuntimeException("Unable to create storage file " + localStorage); } } catch (IOException e) { - throw new RuntimeException("Unable to create storage file " + storage, e); + throw new RuntimeException("Unable to create storage file " + localStorage, e); } } if (numberOfStoredBackups == 0) { throw new RuntimeException(NUMBER_OF_BACKUPS + " property should be either set to positive value, or ommited. Can not be set to 0."); } - setFileStorage(storage); + setFileStorage(localStorage); instance = this; return this;