adri...@apache.org wrote: > Author: adrianc > Date: Sun Apr 26 03:21:40 2009 > New Revision: 768634 > > Modified: > ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=768634&r1=768633&r2=768634&view=diff > ============================================================================== > --- > ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java > (original) > +++ > ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java > Sun Apr 26 03:21:40 2009 > @@ -148,4 +124,15 @@ > } > return ServiceUtil.returnSuccess(); > } > + > + public static String getApacheLicenseText() throws IOException { > + String apacheLicenseText = null; > + String basePath = System.getProperty("ofbiz.home"); > + if (UtilValidate.isNotEmpty(basePath)) { > + String apacheLicenseFileName = basePath + > "/framework/webtools/config/APACHE2_HEADER_FOR_XML"; > + File apacheLicenseFile = new File(apacheLicenseFileName); > + apacheLicenseText = FileUtil.readString("UTF-8", > apacheLicenseFile); > + } > + return apacheLicenseText; > + } > }
Would rather see this license header inside framework/base. Then, a global function to read it in a plain string of text bytes. Then, methods to embed it into xml, properties, etc. For example, maybe alter UtilXml writeDocument methods to take a boolean method, which would signify that the license header should be added. You've also broke windows machines, by hard-coding / as a file name separator. Please use FlexibleLocation instead. Doing so could also get rid if the ofbiz.home system property. If you're worried about re-reading the file from disk all the time, then a soft-ref could be used; personally, I wouldn't bother with that.