Ori Liel has posted comments on this change.

Change subject: restapi: Add ability to extract rsdl.xml from jar
......................................................................


Patch Set 4:

(4 comments)

http://gerrit.ovirt.org/#/c/24385/4/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlIOManager.java
File 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlIOManager.java:

Line 25:         copy(SCHEMA_RESOURCE_NAME, outputDirectory);
Line 26:     }
Line 27: 
Line 28:     private static void createOutputDirectory(String outputDirectory) {
Line 29:         File outputDir = new File(outputDirectory);
> I think we should reuse this File object, returning it, for example, and th
Done
Line 30:         if (!outputDir.exists()) {
Line 31:             outputDir.mkdirs();
Line 32:         }
Line 33:     }


Line 32:         }
Line 33:     }
Line 34: 
Line 35:     private static void copy(String resourceName, String 
outputDirectory) throws IOException {
Line 36:         copy(loadAsStream(resourceName), new FileOutputStream(new 
File(outputDirectory, resourceName)));
> Here, when you create the new File object, the first parameter starts with 
Done
Line 37:     }
Line 38: 
Line 39:     public static InputStream loadAsStream(String resourceName) {
Line 40:         return RsdlIOManager.class.getResourceAsStream(resourceName);


Line 32:         }
Line 33:     }
Line 34: 
Line 35:     private static void copy(String resourceName, String 
outputDirectory) throws IOException {
Line 36:         copy(loadAsStream(resourceName), new FileOutputStream(new 
File(outputDirectory, resourceName)));
> Sorry, I meant the *second* parameter to the constructor of the File object
Done
Line 37:     }
Line 38: 
Line 39:     public static InputStream loadAsStream(String resourceName) {
Line 40:         return RsdlIOManager.class.getResourceAsStream(resourceName);


http://gerrit.ovirt.org/#/c/24385/4/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlManager.java
File 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlManager.java:

Line 58:         try {
Line 59:             rsdlAsStrem = RsdlIOManager.loadAsStream(fileName);
Line 60:             return JAXB.unmarshal(rsdlAsStrem, RSDL.class);
Line 61:         } finally {
Line 62:             rsdlAsStrem.close();
> Here rsdlAsStream could be null, add a check for that, otherwise code audit
Done
Line 63:         }
Line 64: 
Line 65:     }
Line 66: 


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I11834dac081e17c702c614ae923575a3debba6eb
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ori Liel <[email protected]>
Gerrit-Reviewer: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Ori Liel <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to