You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adam Heath <do...@brainfood.com> on 2009/04/26 07:00:26 UTC
Re: svn commit: r768634 - /ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
adrianc@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.
Re: svn commit: r768634 - /ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
Posted by Adrian Crum <ad...@yahoo.com>.
Good points all. There are other problems with that code too. I was just trying to eliminate the deprecated Xerces class and clean it up a little.
Maybe someone would be interested in working on cleaning this up more and implementing your suggestions.
-Adrian
--- On Sat, 4/25/09, Adam Heath <do...@brainfood.com> wrote:
> From: Adam Heath <do...@brainfood.com>
> Subject: Re: svn commit: r768634 - /ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
> To: dev@ofbiz.apache.org
> Cc: commits@ofbiz.apache.org
> Date: Saturday, April 25, 2009, 10:00 PM
> adrianc@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.