and ModelTreeAction classes
(OFBIZ-9287)
This 3 methods share a pattern which should be refactored in a common protected
method. The pattern is
{code}
if (!this.resultMapNameAcsr.isEmpty()) {
this.resultMapNameAcsr.put(context, result);
String queryString = (String) result.get("queryString");
context.put("queryString", queryString);
context.put("queryStringMap", result.get("queryStringMap"));
if (UtilValidate.isNotEmpty(queryString)) {
try {
String queryStringEncoded = queryString.replaceAll("&", "%26");
context.put("queryStringEncoded", queryStringEncoded);
} catch (PatternSyntaxException e) {
// obviously a PatternSyntaxException should not occur here
}
}
} else {
context.putAll(result);
}
{code}
Enough for a refactor I'd say.
I created a ModelActionUtil class where I extracted the method I used in the 3
other classes.
This also removes the swallowed exception that we had in ModelFormAction and
ModelTreeAction, but not in ModelActionUtil from where I extracted the method.
It's now consistent and if ever, for a very unlikely reason, the exception
is thrown, people will know about it and will take appropriate measures.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1789737 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8341)
Obviously a PatternSyntaxException should not occur there.
So I simply put a comment to document the fact even it it seems obvious.
I note though that the repeated pattern is a smell for refactoring...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1789163 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9230)
This has been temporarily fixed with r1784259. After a discussion on dev ML and
a code analysis reported in the Jira issue, I decided to follow Rishi Solanki's
idea of using the delegatorName.
Since we have no context when executing a macro in the widget form, I decided
to pass it to the macro. I had though to create an
EntityUtilProperties.getPropertyValueFromDelegatorName() method to eventually
pass the delegatorName. Two macros were concerned renderLookupField and
renderTextField.
Note: while analysing the code I found that EntityExpr.checkRhsType() can face
a related kind of problem. I'll commit an improvement later...
Thanks: Wai for report and discussion and Rishi for pursuing his idea of using
the delegatorName
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1785882 13f79535-47bb-0310-9956-ffa450edef68
completes r1781219 by putting svn:eol-style=native to all file types declared
in [auto-props] section of the svn config files.css
Actually this is only a 1st pass, it was too complicated to do it for
all file types at once only concerned here
*.java;*.bsh;*.groovy;*.jsp;*.tld;*.ftl;*.js;*.sql;*.c;*.cpp;*.h;*.txt;*.sgml;
*.properties;*.xml;.classpath;.project;*.sld;*.gml;*.xsl;*.xsd
*.html;*.htm;*.css;*.md;README;NOTICE;LICENSE;rc.ofbiz.*;*.less;*.dsp;*.dsw
Most files should not be concerned by this change, but it's impossible to do
it one by one.
There are also changes in files with have mixed EOLs; because this has no sense
when using native which automatically resolves this issue
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1781731 13f79535-47bb-0310-9956-ffa450edef68
I did not even notice I committed this bunch of WIP stuff. I guess I clicked
somewhere while my machine was too buzy
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1781367 13f79535-47bb-0310-9956-ffa450edef68
I did not even notice I committed this bunch of WIP stuff. I guess I clicked
somewhere while my machine was too buzy
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1781366 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9191)
This is due to a change in (at least) Tomcat 8.0.39
Here is a simple fix. I tried other ways but none worked and I prefer to keep
this simple.
I tried other ways but none worked and I prefer to keep this simple.
* Using an encoder at this stage (just before calling the macro) is not an
option. Or maybe by using the encoder on the linkurl variable alone.
But then linkurl must be transformed in a String and back to a
StringBuilder or more refactoring is needed. It does not worth it IMO.
* Also using encode="true" for links in AccountingTrees.xml does not work.
This also removes trailing blanks (by hand)
Thanks: Moatasim Al Masri for report
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1781125 13f79535-47bb-0310-9956-ffa450edef68
Despite missing the creation data in svn, I guess this file has been created
after I created the portoffset feature or I missed it then (unlikely since I
changed all 8080 and 8443 ports in Java code).
Anyway, we now need this to be portoffset aware and this commit just does that
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1780659 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9164)
While working on OFBIZ-6919 which was built on R13.07 I stumbled upon an issue
due to r1652852 where Adrian improved the cacheKey in
FormFactory.getFormFromLocation() by adding a delegator reference (Tenants).
Actually I'm not even sure it was done at r1652852 because Adrian did not
maintain the FormFactory svn history.
Anyway, to make a long story short I had to introduce a DispatchContext
parameter when calling FormFactory.readFormDocument() when the code from
R13.07 only passed a null.
This had an impact in the hierarchy tree because FormFactory.readFormDocument()
was called in DataResourceWorker class, where the new code was called
from renderDataResourceAsText().
So I instead of only passing a Delegator I decided to pass only a
LocalDispatcher parameter in renderDataResourceAsText(), since we can get the
Delegator from the LocalDispatcher. Doing so it had an impact on the
renderDataResourceAsText hierarchy tree ending in DataResourceWorkerInterface
and all related.
I finally decided to apply the same "Change Method Signature" refactoring
pattern (http://refactoring.com/catalog/addParameter.html) to all cases
related to ContentWorkerInterface. No need to pass a delegator when you have
LocalDispatcher!
Since last commit and revert I fixed 5 test failures and improved the code more,
mostly formatting, comments, etc.
There are very ugly method signatures out there which still need refactoring,
but it's so much work...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1777297 13f79535-47bb-0310-9956-ffa450edef68
Improved: Refactor ContentWorkerInterface methods signatures
(OFBIZ-9164)
While working on OFBIZ-6919 which was built on R13.07 I stumbled upon an issue
due to r1652852 where Adrian improved the cacheKey in
FormFactory.getFormFromLocation() by adding a delegator reference (Tenants).
Actually I'm not even sure it was done at r1652852 because Adrian did not
maintain the FormFactory svn history.
Anyway, to make a long story short I had to introduce a DispatchContext
parameter when calling FormFactory.readFormDocument() when the code from
R13.07 only passed a null.
This had an impact in the hierarchy tree because FormFactory.readFormDocument()
was called in DataResourceWorker class, where the new code was called
from renderDataResourceAsText().
So I instead of only passing a Delegator I decided to pass only a
LocalDispatcher parameter in renderDataResourceAsText(), since we can get the
Delegator from the LocalDispatcher. Doing so it had an impact on the
renderDataResourceAsText hierarchy tree ending in DataResourceWorkerInterface
and all related.
I finally decided to apply the same "Change Method Signature" refactoring
pattern (http://refactoring.com/catalog/addParameter.html) to all cases
related to ContentWorkerInterface. No need to pass a delegator when you have
LocalDispatcher!
I locally got 5 incomprehensible test failures. After checking as much as I can
w/o committing I believe it's a Windows 7 issue only. Anyway if Buildbot reports
the same I'll revert. I need this changes in to continue on another not yet
created subtask of OFBIZ-6919
........
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1777154 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9164)
While working on OFBIZ-6919 which was built on R13.07 I stumbled upon an issue
due to r1652852 where Adrian improved the cacheKey in
FormFactory.getFormFromLocation() by adding a delegator reference (Tenants).
Actually I'm not even sure it was done at r1652852 because Adrian did not
maintain the FormFactory svn history.
Anyway, to make a long story short I had to introduce a DispatchContext
parameter when calling FormFactory.readFormDocument() when the code from
R13.07 only passed a null.
This had an impact in the hierarchy tree because FormFactory.readFormDocument()
was called in DataResourceWorker class, where the new code was called
from renderDataResourceAsText().
So I instead of only passing a Delegator I decided to pass only a
LocalDispatcher parameter in renderDataResourceAsText(), since we can get the
Delegator from the LocalDispatcher. Doing so it had an impact on the
renderDataResourceAsText hierarchy tree ending in DataResourceWorkerInterface
and all related.
I finally decided to apply the same "Change Method Signature" refactoring
pattern (http://refactoring.com/catalog/addParameter.html) to all cases
related to ContentWorkerInterface. No need to pass a delegator when you have
LocalDispatcher!
I locally got 5 incomprehensible test failures. After checking as much as I can
w/o committing I believe it's a Windows 7 issue only. Anyway if Buildbot reports
the same I'll revert. I need this changes in to continue on another not yet
created subtask of OFBIZ-6919
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1777145 13f79535-47bb-0310-9956-ffa450edef68
ExternalLoginKeysManager.getExternalLoginKey(...) method.
Minor refactoring of the getExternalLoginKey(...) method to make it more
friendly to unit tests.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1776138 13f79535-47bb-0310-9956-ffa450edef68
tokens from the LoginWorker class to a new class named ExternalLoginKeysManager.
Improved Javadocs in the new class.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1775807 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9144)
This is the first commit to the above mentioned issue which fixes many javadoc
errors dispersed through the different components. The fixes are not
necessarily improvements to the javadocs but rather making them valid javadocs
to prevent reporting errors from gradle
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1774154 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9023) (OFBIZ-9026)(OFBIZ-9027)(OFBIZ-9032)(OFBIZ-9034)(OFBIZ-9036)(OFBIZ-9030)
Thanks: Divesh Dutta, Amit Gadaley and Shubham Agrawal for the contribution.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1768189 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8909)(OFBIZ-8910)(OFBIZ-8911)(OFBIZ-8912)(OFBIZ-8913)(OFBIZ-8914)(OFBIZ-8915)(OFBIZ-8917)(OFBIZ-8918)(OFBIZ-8919)(OFBIZ-8920)(OFBIZ-8921)(OFBIZ-8922)
Thanks: Divesh Dutta for reporting and Amit Gaadaley for providing patch.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1768168 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8505)
Reverts r1765058 + r1765080 following discussion on dev ML
This was introduced for this improvement: In form widgets of list type empty
header row should not render if list to render in file is empty for OFBIZ-7598
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1766080 13f79535-47bb-0310-9956-ffa450edef68
conditional.xml to conditionalLabels.xml
DefaultMessages.xml to DefaultMessagesLabels.xml
EmailPassword.xml to EmailPasswordLabels.xml
Found while working on OFBIZ-8321
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1764261 13f79535-47bb-0310-9956-ffa450edef68
code using it, that wraps most of the OFBiz integration with FreeMarker.
This is the list of the main modifications:
* simplified and cleaned up the public methods of FreeMarkerWorker, used to
retrieve and render Freemarker templates and changed client code accordingly to
use them
* removed unused methods in FreeMarkerWorker and made some others private
* improved the integration code in FreeMarkerWorker to better use the Freemarker
API and specifically to leverage the various TemplateLoaders and the Freemarker
caching mechanism; it is now possible to switch the OFBiz legacy template
caching mechanism to use the Freemarker one instead
* improved the implementation of Freemarker template rendering from strings
(used by DataResourceWorker): it now leverages the Freemarker's
StringTemplateLoader that provides the ability to cache the strings, retrieved
from DataResources records, based on the timestamp of the last modification
* moved freemarkerImports.properties from "widget" to "base" component, and
changed its content (and the content of the associated templates
AutoImportTemplate.ftl and HtmlTemplate.ftl) to remove the dependency from base
to widget&common; some resources of "widget" and "common" are still referenced
from AutoImportTemplate.ftl (that is in "base") but even if they are soft
dependencies: if they are missing the system will load properly without any
error or warning; before this change it was impossible to use, or unit test,
FreeMarkerWorker before the "widget" and "common" components were loaded by the
system, now it is possible
* created a new class for unit tests for FreeMarkerWorker, named
FreeMarkerWorkerTests: at the moment it contains just one simple unit test but
more should be implemented
* refactored WebToolsServices.entityImport(...) to leverage the
FreeMarkerWorker.renderTemplate(...) method to run the Freemarker template,
rather than dealing with the Freemarker API directly; this is now possible
thanks to the cleanups and improvements done in the FreeMarkerWorker class; this
same approach should be implemented for a few other similar integration points
(mostly in the "content" component); this is a TODO item
* moved the encodeDoubleQuotes(...) method from FreeMarkerWorker to
MacroFormRenderer and made it private since this is the only calss using it and
its logic is not related to FreeMarker
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1762227 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8302)
This was due to r1759555 has Scott spotted on. r1759555 fixed a vulnerability
but as explained in r1759555 commit message we used
>2 redundant mechanisms (better safe than sorry):
>1) linkUrl = URLEncoder.encode(linkUrl, "UTF-8");
>2) sr.append("\" linkUrl=r\"");
Removing the 1st way fixes the reported issue and we are still safe.
I'll have a look at how the catalog/control/FindProduct URL is generated to be
sure it's OK as is
Thanks: Pierre for report, Scott for spotting the issue.
[CVE-2016-4462] OFBiz template remote code vulnerability
By manipulating the URL parameter externalLoginKey, a malicious, logged in
user could pass valid Freemarker directives to the Template Engine that are
reflected on the webpage; a specially crafted Freemarker template could be
used for remote code execution.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1761978 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-7758)
I am running on trunk rev 1751489 on tomahawk theme.
In the browser, right-click and view the page source.
There is duplicate linking of jquery.jgrowl.min.css i.e.
<link rel="stylesheet" href="/images/jquery/plugins/jquery-jgrowl/1.4.1/jquery.jgrowl.min.css" type="text/css"/>
The solution is to remove a hack for JPublish in fex Java classes
and related changes (mostly "page." in ftl and xml files)
Thanks: Rohit Koushal for the path and James Yong the report
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1761235 13f79535-47bb-0310-9956-ffa450edef68
By manipulating the UL parameter externalLoginKey it is possible to pass valid Freemarker directives to the Template Engine that are reflected on the webpage
With Freemarker it is possible to create and use Java classes that implement the TemplateModel, including the freemarker.template.utility.Execute class
An attacker can pass arbitary commands via this class, which are executed on the server.
This fixes it using 2 redundant mechanisms (better safe than sorry):
1) linkUrl = URLEncoder.encode(linkUrl, "UTF-8");
2) sr.append("\" linkUrl=r\"");
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1759555 13f79535-47bb-0310-9956-ffa450edef68
=================================
No need to show "---" after selecting any option from drop-down in Find Screens.
=================================
Thanks Renuka for your contribution.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1759018 13f79535-47bb-0310-9956-ffa450edef68
There are forms in the ecommerce component referencing the status. This issue is about applying the CommonLabel label where it is possible in these forms.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1758774 13f79535-47bb-0310-9956-ffa450edef68
================================
Client side required field validation is not working for password type field
================================
Thanks Deepak and Renuka for your contribution.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1757992 13f79535-47bb-0310-9956-ffa450edef68
Notes:
* Also removes empty framework/base/lib/scripting and useless applications\content\lib\uno\README (miss doc in wiki)
* When jpim-0.1.jar will be (hopefully) replaced we can drop lib ref in framework/base/ofbiz-component.xml
* I wonder if we should let the geronimo component alone with only 2 classes, could we not put that in entity or entityext?
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1755306 13f79535-47bb-0310-9956-ffa450edef68
This is the first of two steps in the above mentioned JIRA. This
first step changes the java source directory for every component
from /src to /src/main/java. The next step will be adding unit
tests to every component in /src/test/java
Thank you to Deepak Dixit for tips on how to use the SVN commands
to make the appropriate file moving.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1752838 13f79535-47bb-0310-9956-ffa450edef68
Remove all bsh libraries and bsh remaining fonctionnalities.
Bsh interpreter is replaced by GroovyShell evaluation.
To avoid groovyShell undefined var exception, the evaluated expression is analysed, detecting variables used and setting its to null if undefined in context.
Today only alphabetic variable with '_' are detected (i.e. my_variable==null).
Add in example a test replacement of " syntax to simple quote.
Remove all found bsh references
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1752231 13f79535-47bb-0310-9956-ffa450edef68
This is the first patch that takes OFBiz to the point of no return
in terms of switching from Ant to Gradle build system. Specifically
this patch applies the following items:
- Delete all old Ant and Maven build scripts
- Delete 169 Jar libraries and replace them with remote ones in the
gradle build script
- update the gradle build scripts for the dependencies and other minor
changes needed for the script work correctly
All tests pass with the command ./gradlew cleanAll loadDefault testIntegration
Again, thank you for everyone who contributed valueble time and effort in this
process.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1752033 13f79535-47bb-0310-9956-ffa450edef68
This feature has been contributed a long time ago as an experimental feature but never really matured into a production ready artifact: since it was contributed, no users asked about how to use it, or tested it, or reported bugs or enhancement requests.
More importantly, the feature has always been disabled in the OFBiz framework (i.e. the widget code and the entity engine code were not using it).
This removal should not impact our user base; however, after the removal, an entry to the Attic will be created to keep track of it and to make it easier, to interested users, to get this code, improve it (e.g. by making it dependent on a live external jar, for example MapDB instead of JDBM) and possibly contribute it back to the project.
The most compelling reason for its removal is that the feature was based on a snapshot, unreleased version of JDBM, which is now a mostly dead project: for licensing reasons we are no more allowed to bundle jars in our releases. Additionally, having code that relies an old jar from a no more active project represents a maintenance issue for the community.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1751817 13f79535-47bb-0310-9956-ffa450edef68