Alon Bar-Lev has posted comments on this change.

Change subject: core: [WIP] Manage OS properties in a repository
......................................................................


Patch Set 4: (3 inline comments)

....................................................
File 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/osinfo/OsInfoPreferencesLoader.java
Line 34:     private Log log = LogFactory.getLog(OsInfoPreferencesLoader.class);
Line 35: 
Line 36: 
Line 37:     public void init() {
Line 38:         
load(FileSystems.getDefault().getPath(EngineLocalConfig.getInstance().getUsrDir().getAbsolutePath(),
 "osinfo.conf.d"));
So why have you left this?
Line 39:         
load(FileSystems.getDefault().getPath(EngineLocalConfig.getInstance().getEtcDir().getAbsolutePath(),
 "osinfo.conf.d"));
Line 40:     }
Line 41: 
Line 42:     public void load(Path directoryPath) {


Line 46:             for (Path path: dirStream) {
Line 47:                 paths.add(path);
Line 48:             }
Line 49:             // load files by name order. 00-os.properties should be 
loaded first
Line 50:             Collections.sort(paths);
In this case that you read all files into memory, there is no difference 
between using this and using File.listFiles()... Just saying...

Something like the following? :)

 for (
     File file : new TreeSet(
         Arrays.asList(
             dir.listFiles(
                 new FileFilter() {
                     public boolean accept(File pathname) {
                         return pathname.getName().endsWith('.properties');
                     }
                 }
             )
         )
     )
 ) {
     loadFile(file);
 }
Line 51: 
Line 52:             for (Path path: paths) {
Line 53:                 loadFile(path);
Line 54:             }


Line 72:             properties = new Properties(properties);
Line 73:             properties.load(reader);
Line 74: 
Line 75:             log.info("Loaded file " + path);
Line 76:         } catch (IOException e) {
Usually ignore of exception should be at top level logic.
Line 77:             log.error("Failed loading file "  + path);
Line 78:         }
Line 79: 
Line 80:     }


--
To view, visit http://gerrit.ovirt.org/15080
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I50384bf3b6763fa7a34badc2449e06242186a858
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Roy Golan <rgo...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skriva...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Roy Golan <rgo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to