Commit Graph
1169 Commits
Author SHA1 Message Date
Adam Heath c8de3a22aa OPTIMIZE: Add a getMessageDigest static helper function.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1333661 13f79535-47bb-0310-9956-ffa450edef68
2012-05-03 22:19:58 +00:00
Adam Heath d22dd8d05f OPTIMIZE/FEATURE: Factor getObject into another helper,
getObjectException; the latter doesn't catch any exceptions, and doesn't
log them.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1333655 13f79535-47bb-0310-9956-ffa450edef68
2012-05-03 22:13:11 +00:00
Adam Heath 565db82f80 OPTIMIZE: Switch internal getCrypted to take a byte array, and use
String.getBytes(Charset) to fetch the bytes.  Also switches the one case
of getBytes("UTF-8") to the Charset version.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1333654 13f79535-47bb-0310-9956-ffa450edef68
2012-05-03 22:13:04 +00:00
Adam Heath 030144565f FEATURE: Add a -digest variant, that uses the deprecated password
digesting code.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1333622 13f79535-47bb-0310-9956-ffa450edef68
2012-05-03 21:13:27 +00:00
Adam Heath 9459906808 FEATURE: Improve warning when an oldFunnyHex hash is detected on a
password.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1333621 13f79535-47bb-0310-9956-ffa450edef68
2012-05-03 21:13:21 +00:00
Adam Heath 589ae262f7 FIX: Oops, my bad. Originally, this was never meant to actually be committed
upstream.  However, I decided that it might be generally useful, so
committed it anyways.  I forgot that I needed to add the copyright
header to it.  I suppose I should add a pre-commit hook somehow either
in svn or git.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1333619 13f79535-47bb-0310-9956-ffa450edef68
2012-05-03 21:13:08 +00:00
Jacques Le Roux 6900761114 Some improvements in StringUtil class
* Add the possibility to use your own separator, not only "=" which stays the default
* I changed the default separator from "|" in some intermediary methods to null which was the default before my changes in r1212749.
* A new split method based on Pattern.compile(delim).split(str, limit). This allows to create a list of string, splitting only on the nth limit occurrences. This because StringTokenizer is deprecated, though I kept it as main split method
* some formatting also (my own way, more legible I think)

All this can notably be helpful when you deal with non encoded URLs...


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1330995 13f79535-47bb-0310-9956-ffa450edef68
2012-04-26 17:56:01 +00:00
Adrian Crum ad32a9ebf9 Added a Scriptlet class to the base component - this will be used to simplify scriptlet implementation.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1330394 13f79535-47bb-0310-9956-ffa450edef68
2012-04-25 16:25:45 +00:00
Adrian Crum 6fdee164ac FlexibleMapAccessor improvement - fixed inconsistent toString() results.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1330390 13f79535-47bb-0310-9956-ffa450edef68
2012-04-25 16:23:29 +00:00
Adrian Crum 189496613e Improved ObjectType.isEmpty method - removed unnecessary calls to UtilValidate.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1330386 13f79535-47bb-0310-9956-ffa450edef68
2012-04-25 16:22:16 +00:00
Adrian Crum 5230635e21 ScriptUtil.java bug fix - removed trailing colon from script names.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1329727 13f79535-47bb-0310-9956-ffa450edef68
2012-04-24 13:53:44 +00:00
Adrian Crum e72cd93484 Improved support for optional target type in ObjectType.simpleTypeConvert.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1329219 13f79535-47bb-0310-9956-ffa450edef68
2012-04-23 12:54:27 +00:00
Jacopo Cappellato ebf04fde84 Synchronized read access to the parsedScript cache to avoid issues with concurrent thread visibility.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1328641 13f79535-47bb-0310-9956-ffa450edef68
2012-04-21 12:19:31 +00:00
Jacopo Cappellato 684fce1265 The cache of parsed Groovy scripts was not thread safe; this issue, in instances with several concurrent threads running the same script the first time (i.e. not cached) could cause the same script parsed multiple times and then added to the cache (overriding the previous value); this event was causing the clearing of caches in Freemarker; because of a bug in Freemarker [*] this could cause a deadlock.
The issue is present on all versions of Freemarker but it is less frequent on latest version because of the refactoring of caches happened after release 2.3.10.

[*] https://sourceforge.net/tracker/?func=detail&aid=3519805&group_id=794&atid=100794

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1328356 13f79535-47bb-0310-9956-ffa450edef68
2012-04-20 12:53:35 +00:00
Adam Heath 4e165df74b FEATURE: Very simple command-line tool to crypt a password.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1327742 13f79535-47bb-0310-9956-ffa450edef68
2012-04-18 23:49:28 +00:00
Adam Heath f092508550 FEATURE: Make use of new HashCrypt cryptPassword functionality.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1327741 13f79535-47bb-0310-9956-ffa450edef68
2012-04-18 23:49:22 +00:00
Adam Heath ffd48b19c9 FEATURE: Add unix(glibc)-compatible password hashing, exact same output, with support for salts.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1327740 13f79535-47bb-0310-9956-ffa450edef68
2012-04-18 23:49:10 +00:00
Jacopo Cappellato 160982d9e7 Enhanced GroovyUtil to support the execution of data preparation methods defined in a Groovy script file (similarly to what is already supported by the ScriptUtil class for JSR223).
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1326996 13f79535-47bb-0310-9956-ffa450edef68
2012-04-17 08:44:43 +00:00
Jacques Le Roux 8c481181d5 Adapted by hand from Lon F. Binder "CatalinaContainer Doesn't Respect <distributable/> Node for web.xml files." https://issues.apache.org/jira/browse/OFBIZ-4242
Per the servlet specification, the web.xml file should allow an optional <distributable/> node to indicate that the application is clusterable. Currently, OFBiz does not respect this setting and assumes all applications should be distributed if any cluster configuration is provided in the ofbiz-containers.xml file. As a result, if, for example, the DeltaManager is enable, all applications attempt to cluster and communicate via DeltaManager.

The expected and proper functionality is to check the individual application's web.xml file for the <distributable/> node and only use the DeltaManager if found; otherwise the StandardManager should be used for sessions.

jleroux: replaced some tabs, reformatted, added a comment about <distributable/> in the *-containers.file

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1326064 13f79535-47bb-0310-9956-ffa450edef68
2012-04-14 07:30:30 +00:00
Jacopo Cappellato 6558763ed6 Based on a suggestion by Adrian Crum, data preparation scripts can now be implemented with script methods that accept a Map context argument, for example:
def dataPreparationMethod(Map context) {
...
}



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1325750 13f79535-47bb-0310-9956-ffa450edef68
2012-04-13 13:10:59 +00:00
Jacopo Cappellato 6450c4f54d Modified Groovy util methods that prepares the binding to add the ScriptHelper object (to be consistent with the Groovy service engine and event handler and the "Script" JSR223 engine and handler): now Groovy scripts can execute the same exact Grrovy codes that can be executed when they are run thru JSR223.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1325620 13f79535-47bb-0310-9956-ffa450edef68
2012-04-13 05:53:54 +00:00
Jacopo Cappellato 4835731c9c Upgrade to the latest version of JUnit (4.10).
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1311221 13f79535-47bb-0310-9956-ffa450edef68
2012-04-09 13:37:18 +00:00
Adrian Crum e93e73afaa ScriptUtil bug fix: the SCRIPT_NAMES field was initialized only when debug level was INFO. Removed enclosing debug level check so SCRIPT_NAMES will always be initialized.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1311011 13f79535-47bb-0310-9956-ffa450edef68
2012-04-08 14:21:01 +00:00
Adrian Crum 3348ba5734 Bug fix in ScriptUtil.java - create a local copy of the calling context so script local variables are not copied to it.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1310307 13f79535-47bb-0310-9956-ffa450edef68
2012-04-06 12:51:14 +00:00
Adrian Crum 533bd091b7 CVE-2012-1622: Disable support for nested scripts in FlexibleStringExpander.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1309879 13f79535-47bb-0310-9956-ffa450edef68
2012-04-05 14:20:56 +00:00
Adrian Crum 99504db991 Added some static methods to FlexibleStringExpander that enable querying an expression about its component parts.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1309360 13f79535-47bb-0310-9956-ffa450edef68
2012-04-04 12:49:12 +00:00
Adrian Crum e94ccd9369 Added a SCRIPT_NAMES field to ScriptUtil.java.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1309359 13f79535-47bb-0310-9956-ffa450edef68
2012-04-04 12:47:30 +00:00
Sascha Rodekamp ceb27828a7 Changed the FileReader to a BufferedReader during script loading. The file reader throws an exception when the file path contains spaces (which are encoded). The result was that scripts aren't loaded and pages only showed an error message. Working with an InputStream solves this issue.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1308896 13f79535-47bb-0310-9956-ffa450edef68
2012-04-03 13:36:03 +00:00
Jacopo Cappellato 7e8d52d3bf Fixed path to svninfo.ftl file that was not working after the switch to freemarker 2.3.19
Thanks to Scott for the solution.



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1308817 13f79535-47bb-0310-9956-ffa450edef68
2012-04-03 11:09:54 +00:00
Jacopo Cappellato ec02e2ac4f this is a workaround to fix errors when loading included templates with a relative path after the migration to Freemarker 2.3.19; I am still investigating the root cause.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1308734 13f79535-47bb-0310-9956-ffa450edef68
2012-04-03 07:46:12 +00:00
Adrian Crum e1a03aee17 Small code cleanup in ObjectType.simpleTypeConvert, added support for null target type (returns original object). Updated unit tests.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1307551 13f79535-47bb-0310-9956-ffa450edef68
2012-03-30 17:48:32 +00:00
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