Juan Hernandez has posted comments on this change. Change subject: restapi: Add ability to extract rsdl.xml from jar ......................................................................
Patch Set 4: (3 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 then pass it to the copy medhod, instead of the string. 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 /. That won't work in systems where the path separator is \. 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 tools will complain in the future. 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 <ol...@redhat.com> Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches