Commit Graph
1138 Commits
Author SHA1 Message Date
Erwan de Ferrieres 029f6e9410 Removing usage some more iterators
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1306568 13f79535-47bb-0310-9956-ffa450edef68
2012-03-28 20:18:13 +00:00
Jacques Le Roux 8f6004c2eb This was missing in r1305004
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1305316 13f79535-47bb-0310-9956-ffa450edef68
2012-03-26 11:42:49 +00:00
Jacques Le Roux 7d943cb341 A patch from Anne Jessel "Support validation of resource xml files" https://issues.apache.org/jira/browse/OFBIZ-4723
The xsd for the resource xml files is invalid. In addition, the format of the value of the xml:lang attribute in resource xml files is invalid, according to the xml standard.

The attached patch:

    provides a valid xsd
    updates UtilProperties and the Label Manager to deal with the correct formatting of the xml:lang value, while still working with the old format, following Adrian Crum's recommendation on the mailing list
    includes simple unit tests for UtilProperties to ensure it does work with both formats
    changes the Label Manager to include a reference to the new xsd, and to use the correct format of the xml:lang value, when writing a resource xml file.

Some minor code cleanups to these files.

jleroux: the base test suite was successfully run locally once UtilIOTests have been commented out (still an issue with it on Windows)

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1305004 13f79535-47bb-0310-9956-ffa450edef68
2012-03-25 11:07:57 +00:00
Jacques Le Roux 0c07b6df6f Revert r1304193 for now
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1304737 13f79535-47bb-0310-9956-ffa450edef68
2012-03-24 09:35:09 +00:00
Jacques Le Roux 1c5a0459c3 A patch from Anne Jessel "Support validation of resource xml files" https://issues.apache.org/jira/browse/OFBIZ-4723
The xsd for the resource xml files is invalid. In addition, the format of the value of the xml:lang attribute in resource xml files is invalid, according to the xml standard.

The attached patch:

    provides a valid xsd
    updates UtilProperties and the Label Manager to deal with the correct formatting of the xml:lang value, while still working with the old format, following Adrian Crum's recommendation on the mailing list
    includes simple unit tests for UtilProperties to ensure it does work with both formats
    changes the Label Manager to include a reference to the new xsd, and to use the correct format of the xml:lang value, when writing a resource xml file.

Some minor code cleanups to these files.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1304193 13f79535-47bb-0310-9956-ffa450edef68
2012-03-23 05:47:10 +00:00
Jacopo Cappellato 4845c553ac The scripthelper object was created too early when the bindings were not set in the context; this caused the wrong scriptType to be set in the ContextHelper.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1300202 13f79535-47bb-0310-9956-ffa450edef68
2012-03-13 15:47:50 +00:00
Adrian Crum fda9bad4cf More JSR-223 work - added a ScriptHelper object to the bindings. Also added a demonstration to the JavaScript test service.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1299924 13f79535-47bb-0310-9956-ffa450edef68
2012-03-12 23:20:55 +00:00
Adrian Crum 1c162eb3d7 JSR-223 bug fix, added String constants for commonly used binding keys.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1299636 13f79535-47bb-0310-9956-ffa450edef68
2012-03-12 11:41:03 +00:00
Adrian Crum 7f15204b03 JSR-223 bug fixes.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1299121 13f79535-47bb-0310-9956-ffa450edef68
2012-03-10 00:46:54 +00:00
Adrian Crum 484f0e6999 More JSR-223 work - added the ability to protect the bindings, plus some minor code formatting changes.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1299040 13f79535-47bb-0310-9956-ffa450edef68
2012-03-09 20:41:18 +00:00
Jacopo Cappellato c8323e7ab5 Enhanced Groovy Event Handler to support the execution of a method (as an event) inside of a groovy source file (script class): the method can be specified in the "invoke" attribute.
Similarly to Groovy services, the Groovy Events Handler sets the base script class containing helper methods; these helper methods have been enhanced in order to be used by groovy method executed as services or events in a transparent way.
 


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1298908 13f79535-47bb-0310-9956-ffa450edef68
2012-03-09 16:34:18 +00:00
Jacopo Cappellato da59ea40b4 Enhanced Groovy service engine to inject a (configurable) script base class that provides a basic DSL language to the Groovy services; the DSL is still a work in progress but it is already enough to implement several services in Groovy following a programming style very close to Minilang.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1298461 13f79535-47bb-0310-9956-ffa450edef68
2012-03-08 16:36:18 +00:00
Adrian Crum 2ba7468eff More JSR-223 work - added a bsh engine so that bsh-specific code can be eliminated. Bsh is now invoked using JSR-223.
The engine comes from http://java.net/projects/scripting. I had to modify the code slightly because the BshScriptEngine class implemented Compilable - but the Compilable methods were not implemented. So I removed implements Compilable. I renamed the jar to signify that the code has been modified.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1297478 13f79535-47bb-0310-9956-ffa450edef68
2012-03-06 14:06:13 +00:00
Adrian Crum 0a0903efb8 More JSR-223 work - added a generic script service engine.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1297323 13f79535-47bb-0310-9956-ffa450edef68
2012-03-06 02:16:29 +00:00
Adrian Crum 340e6c9d0a Added a helpful startup message to ScriptUtil.java.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1296978 13f79535-47bb-0310-9956-ffa450edef68
2012-03-05 09:43:54 +00:00
Adrian Crum deac392f10 Refactored ScriptUtil.java to use the javax.script package (JSR-223).
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1296897 13f79535-47bb-0310-9956-ffa450edef68
2012-03-04 23:43:27 +00:00
Adrian Crum 6cb4c34e22 Minor changes to ScriptUtil.java: add private constructor, make class final, code format changes. No functional change.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1296771 13f79535-47bb-0310-9956-ffa450edef68
2012-03-04 09:02:07 +00:00
Jacopo Cappellato f18d49458f First pass in the direction of the implementation of a more flexible mechanism to plugin different scripting technologies and in the same time being able to get rid of a lot of framework related custom code to support them.
In particular these chenges should make it easier to implement JSR-223 (even if I think that we should still treat Groovy in a special way).


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1296762 13f79535-47bb-0310-9956-ffa450edef68
2012-03-04 07:24:47 +00:00
Adrian Crum 4a48104212 Add private constructors to static utility classes. Patch provided by Rishi Solanki - https://issues.apache.org/jira/browse/OFBIZ-4656.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1243364 13f79535-47bb-0310-9956-ffa450edef68
2012-02-12 23:19:33 +00:00
Adrian Crum 97082c457f Extracted FileUtil.java's OS-dependent file path conversion to a separate method.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1231539 13f79535-47bb-0310-9956-ffa450edef68
2012-01-14 17:49:01 +00:00
Erwan de Ferrieres 05c9bae6e5 tabs to spaces, no functional changes - java files
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1230478 13f79535-47bb-0310-9956-ffa450edef68
2012-01-12 10:37:35 +00:00
Erwan de Ferrieres 337aa79464 OFBIZ-3651 - Minor tweaks to the Cobertura integration - A patch from Bob Morley. I've also changed the cobertura version from 1.9.3 to 1.9.4.1 (latest) as your modifications are allowing it
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1230444 13f79535-47bb-0310-9956-ffa450edef68
2012-01-12 09:01:06 +00:00
Adrian Crum 6067eec6ef FreeMarkerWorker JavaDocs - no functional change.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1228592 13f79535-47bb-0310-9956-ffa450edef68
2012-01-07 10:26:52 +00:00
Jacques Le Roux ae3205204e A patch from Martin Kreidenweis "Deserialization of arrays with UtilObject.getObject() throws ClassNotFoundException" https://issues.apache.org/jira/browse/OFBIZ-4295
Deserialization of arrays with UtilObject.getObject() throws a ClassNotFoundException. This happened to us when we enabled the distributed cache clear feature and it was sending arrays of EntityExpr objects to other OFBiz instances.

The reason is, that the org.ofbiz.base.util.ObjectInputStream calls classLoader.loadClass(name) directly instead of using Class.forName(name, init, classLoader).
According to java bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6446627 ClassLoader.loadClass() is not intended to being used this way and doesn't support loading arrays.

jleroux: Sun/Oracle is pretty clear about that <<[When you want to reflectively load a class by name initiated using a specific class loader, you should not invoke that loader's public loadClass method directly-- instead, you should always use the static three-argument Class.forName method.  The ClassLoader.loadClass instance method is more intended for delegation from one class loader to another within a class loading operation (although this is a common confusion and not well described in the documentation).  In other words, replace L.loadClass(N) with Class.forName(N,false,L).  The Class.forName invocation may eventually end up invoking loadClass on the specified loader, but only after taking care of some other aspects of the VM's standard symbolic class name resolution process-- the significant bit in this case being the support for loading/creation of array classes.]>> More at the link above


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1226223 13f79535-47bb-0310-9956-ffa450edef68
2012-01-01 09:57:50 +00:00
Jacques Le Roux f663e9b57b Yesterday, late and in a hurry, I hastily committed r1212673. It was failing after an ant clean. But I did not see, because I did not do an ant clean, and Builbot did not report any issues (yes, I sometimes rely on it). Actually it was because Buildbot tests fails since r1212266, and it only sends info when it switches from bad to good, or vice-versa.
Fortunately, on my side, it was an easy fix: I just forgot to re-add the old strToMap(String str, boolean trim) signature.

So here it is

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1212749 13f79535-47bb-0310-9956-ffa450edef68
2011-12-10 08:55:27 +00:00
Hans Bakker 05909bfc1b revert 1212673 because of compile error
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1212706 13f79535-47bb-0310-9956-ffa450edef68
2011-12-10 01:24:44 +00:00
Jacques Le Roux ade4ac0468 Improves StringUtil.strToMap() by adding a delimiter as parameter
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1212673 13f79535-47bb-0310-9956-ffa450edef68
2011-12-09 22:50:01 +00:00
Hans Bakker 64befbc96a Revert 1205710 on a comment from Adrian
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1206043 13f79535-47bb-0310-9956-ffa450edef68
2011-11-25 02:59:40 +00:00
Hans Bakker d4fa24f6a6 getDayEnd will have a null pointer exception when the offset is not provided. This can cause very strange behaviour in the system when people forget to enter a value in terms. When not provided zero is assumed now
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1205710 13f79535-47bb-0310-9956-ffa450edef68
2011-11-24 02:54:14 +00:00
Sascha Rodekamp db199e87d8 IMPROVEMENT: Replace String == null with UtilValidate.isEmpty() (https://issues.apache.org/jira/browse/OFBIZ-4546). A patch from Dimitri Unruh: In UtilDateTime are some String == null comparisons. I replaces them with UtilValidate.isEmpty()
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1200231 13f79535-47bb-0310-9956-ffa450edef68
2011-11-10 09:15:01 +00:00
Adrian Crum c1381a112d UtilFormatOut.java date and date-time format methods provided by Dimitri Unruh, with JavaDocs added by me - https://issues.apache.org/jira/browse/OFBIZ-4545.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1199793 13f79535-47bb-0310-9956-ffa450edef68
2011-11-09 15:26:53 +00:00
Adrian Crum b38bcae737 Added a FIXME comment to some non-thread-safe code in UtilFormatOut.java. No time to fix it right now.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1198702 13f79535-47bb-0310-9956-ffa450edef68
2011-11-07 11:05:13 +00:00
Ashish Vijaywargiya 0ec8f44676 Bug fix: Applied patch from jira issue OFBIZ-4441. UtilXml firstChildElement should use getNodeName instead of getLocalName.
We have observed the same issue in past and provided a patch for the same. For more details please refer the commit r995384.

Fixing bug of reading node name. When we read first child element of the response of any third party integration for example ups etc, node name can't be read using "node.getLocalName()". So changing  node.getLocalName() --> node.getNodeName().

This time before I revert my changes I will wait for Bilgin's comment to understand the exact problem with SOAP call due to which he did this changes. Bilgin please post your comment on this as soon as you get a chance.
http://svn.apache.org/viewvc?view=revision&revision=894359 

Thanks Kiran, Sascha for the contribution. We were also observing this issue since quite long so for now it is better to put the code in trunk and releasebranch. 

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1183314 13f79535-47bb-0310-9956-ffa450edef68
2011-10-14 11:39:19 +00:00
Sascha Rodekamp 082526b9de FIX: Wrong use of toArray() method (https://issues.apache.org/jira/browse/OFBIZ-4425). A patch from Dimitri Unruh which replaces Array Casts with a propper call of the toArray method.
String[] temp = (String[]) foo.toArray(); <-- may cause class cast exception it is better to use: String[] temp = foo.toArray(new String[foo.size()]) 

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1173607 13f79535-47bb-0310-9956-ffa450edef68
2011-09-21 12:53:35 +00:00
Jacques Le Roux 00afa0c283 A patch from Dimitri Unruh "Some dead variable assignments " https://issues.apache.org/jira/browse/OFBIZ-4426
Some value assignments to local variables without reading or using it.

jleroux: indeed I don't see any reasons to set the size of a byte array before feeding it with String.getBytes(), since NPE is handled above. I have even simplified it more using function composition style.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1172015 13f79535-47bb-0310-9956-ffa450edef68
2011-09-17 16:51:38 +00:00
Sascha Rodekamp 16607bb1ac UPDATE: Some improvements with Map iterations (https://issues.apache.org/jira/browse/OFBIZ-4415) A patch from Dimitri Unruh which improves some Map Iterations.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1170525 13f79535-47bb-0310-9956-ffa450edef68
2011-09-14 10:52:01 +00:00
Sascha Rodekamp 5a0b643c39 Building a String using concatenation in a loop (https://issues.apache.org/jira/browse/OFBIZ-4416). A patch from Dimitri Unruh: In UtilValidate.java some methods building a String using concatenation in a loop. We can obtaine better performance by using a StringBuilder
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1170520 13f79535-47bb-0310-9956-ffa450edef68
2011-09-14 10:37:53 +00:00
Adrian Crum 79110878f1 Have FlexibleMapAccessor and FlexibleStringExpander implement IsEmpty so they can be evaluated by the various validation utilities.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1170125 13f79535-47bb-0310-9956-ffa450edef68
2011-09-13 11:51:49 +00:00
Jacques Le Roux e497883d62 VCard.java: replaec an UtilValidate.isNotEmpty() by a simple isEmpty()
ShoppingCart.java: a tabs has been automatically replaced by 8 spaces, fixes it
UtilValidate.java: removes useless parentheses
GeneriDao.java: fixes a wrong UtilValidate.isNotEmpty
ModelFormField.java: revert all UtilValidate.is(Not)Empty() changes though I ddid not find an error there, it must be one because https://localhost:8443/humanres/control/EditResponsibilityTypes is not rendered correctly. I will check again

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1169754 13f79535-47bb-0310-9956-ffa450edef68
2011-09-12 14:13:17 +00:00
Jacques Le Roux a7f92ce35f Fix a bug introduced in r1169478
Thanks to Hans for reporting on dev ML

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1169701 13f79535-47bb-0310-9956-ffa450edef68
2011-09-12 11:47:15 +00:00
Jacques Le Roux 2b712efb98 No functional changes, simple code refactoring around UtilValidate.is(Not)Empty()
Changes implementation of UtilValidate.isEmpty() for Collection and Map by using isEmpty() instead of c.size() == 0). It's more clear and as efficient. Removes also useless parentheses there.

Makes use of UtilValidate.is(Not)Empty() everywhere it makes senses. This for 2 reasons:
* Make the code more readable by replacing the (!)null/isEmpty pattern.
* Avoid possible NPEs when only isEmpty() was used (after Entity.find... for instance). I found a lot of cases (242 today) where isEmpty() could perhaps be replaced in Framework. But I guess no NPE checks were missing there and anyway it was too much for me to check them all... So I only did the relevant changes in Applications...



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1169478 13f79535-47bb-0310-9956-ffa450edef68
2011-09-11 17:06:11 +00:00
Jacques Le Roux 30b4566a7c Revert r1165076 (at Adrian's right demand)
Actually I hastily did it bad using static instead of caching. Anyway, I checked there are no real needs to change current code in OFBiz for perf.: one instance is in an exception and the other not called OOTB...

Was:  Closes https://issues.apache.org/jira/browse/OFBIZ-4201

"DateFormat.getDateTimeInstance() is very expensive, we can cache it to improve performance"

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1165084 13f79535-47bb-0310-9956-ffa450edef68
2011-09-04 19:07:16 +00:00
Jacques Le Roux fd92b0eca1 Closes https://issues.apache.org/jira/browse/OFBIZ-4201
"DateFormat.getDateTimeInstance() is very expensive, we can cache it to improve performance"

jlr: It's not really cache but a static class constant

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1165076 13f79535-47bb-0310-9956-ffa450edef68
2011-09-04 17:08:54 +00:00
Adrian Crum fb9ae9ffb5 Added some Calendar<->Date data type converters. Commit includes some unintended code formatting.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1164906 13f79535-47bb-0310-9956-ffa450edef68
2011-09-03 18:36:39 +00:00
Hans Bakker 12b2e145c8 https://issues.apache.org/jira/browse/OFBIZ-4337 : HttpClient does not support UTF-8 Patch By Chatree with comments from Adrian and Scott
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1145854 13f79535-47bb-0310-9956-ffa450edef68
2011-07-13 04:10:25 +00:00
Adam Heath b98a7f111c FEATURE: Add a global executor, to be used during config type parsing.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1141288 13f79535-47bb-0310-9956-ffa450edef68
2011-06-29 22:12:31 +00:00
Adam Heath 7047b2b80b FEATURE: Add support to Debug.logFoo() for using %-style format
strings.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1139852 13f79535-47bb-0310-9956-ffa450edef68
2011-06-26 18:07:24 +00:00
Adam Heath 07e802c9d8 FEATURE: Add helper method to fetch the results of all futures in a
collection, into a new list.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1139699 13f79535-47bb-0310-9956-ffa450edef68
2011-06-26 02:50:41 +00:00
Adam Heath 276ecca353 FEATURE: Allow the ThreadGroup to be specified for created threads.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1139698 13f79535-47bb-0310-9956-ffa450edef68
2011-06-26 02:50:35 +00:00
Adam Heath cb0f5a3b46 FEATURE: if the threadCount passed to getExecutor is negative, then use
the abs() value of that times the number of cpus, to specify the actual
number of threads.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1139697 13f79535-47bb-0310-9956-ffa450edef68
2011-06-26 02:50:29 +00:00