Adds an explanation about what to do when using own domain.
Some users don't look into the log so it's better to set also the exception
message in order for them to have it right at 1st glance.
In Java SE 7 and later, a single catch block can handle more than one type of exception. This feature can reduce code duplication and lessen the temptation to catch an overly broad exception.
Thanks: Jacques for the review.
Updates tasks.checkstyleMain.maxErrors to 26842
Remove a trailing space in RequestHandler I used to test the pre-push hook.
In the previous commit (c4b5f5e) I have pushed a pre-push hook rather than a
pre-commit hook. I think it makes sense. I noticed that this does not clear the
existing pre-commit hook in .git\hooks. You have to clear it by hand.
But anyway I believe we should rather use a webhook as Suggested by Samuel and
proposed by Infra. This for at least 3 reasons:
Handles PRs and not only local commits
Minimise the CPU usage locally
Simplify usage for custom projects
I think it's the best solution but I'll continue the discussion on dev ML about
Allow external scripts within the multi-block html template, to be rendered
within the html head tag, when a new attribute data-import is set to “head”
Thanks: Jacques for review
(OFBIZ-11686)
Correction in javadoc, <script is not authorize in javadoc because it
can introduce some javascript in javadoc, and so generate an error in
javadoc build.
Replace <script-template/> by "script-template"
The new tag allows us to render a freemarker template containing javascript,
as external script in html instead of inline script.
This helps to reduce CSP errors.
(OFBIZ-11643)
When doing OFBIZ-6849 I forgot to take care of the https attribute of the
security element used in controllers.
It's not used anymore since we used HTTPS everywhere but in request listed in
http.request-map.list property of url.properties. It's even enforced by HSTS for
requests that are not listed in this property.
This removes the https attribute and removes its usage in in controllers.
(OFBIZ-10837)
While working on OFBIZ-11633 I crossed an issue in R18 (not in trunk) where
objects from org.apache.commons.fileupload (namely DiskFileItem and
FileItemHeadersImpl) are not serializable.
While at it I decided to handle at the SafeObjectInputStream level
the "fileItems" case I already crossed with, OFBIZ-11534, in RequestHandler
It has an inconvenient in R18 (not in trunk) where ObjectInputStream can't
handle a null class (of course) and so return a benign exception in log (only).
I believe it's better to handle these specific cases at the lower possible
level in all supported branches.
(OFBIZ-11593)
The "entity/list" request has been put in with OFBIZ-11007. It's used to call
the entitymaint view and so is a demo/didactic duplicate of entitymaint request.
It's only used in FindGeneric screen (look for WebtoolsBackToEntityList label).
It's problematic because since the CSRF token defense was put in you can no
longer filter the entities from the entities list screen, even when the default
NoCsrfDefenseStrategy is used. It works if you use the entitymaint request
instead.
2020-01-19 I proposed in OFBIZ-11306 a solution for such cases.
It was not used because 2020-02-14 I thought it was no longer needed.
It was necessary for this case and implemented with commit e487122.
But as, Rohit Koushal reported, it breaks some functionalities like adding
address/update address during Quick Finalize Order. The issue can also be
reproduced in ecommerce when trying the same while checking out, or quick
checking out, an order.
More generally the error is of this kind:
|27.0.0.1-8009-exec-3 |ControlServlet |E| Error in request handler:
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.LinkedList.checkElementIndex(LinkedList.java:555) ~[?:1.8.0_252]
at java.util.LinkedList.get(LinkedList.java:476) ~[?:1.8.0_252]
at org.apache.ofbiz.webapp.control.RequestHandler.getRequestUri(RequestHandler.java:837) ~[main/:?]
and happens with URLs like
updateCheckoutOptions/editcontactmech?DONE_PAGE=checkoutoptions&contactMechId=9015
or
updateCheckoutOptions/editcontactmech?preContactMechTypeId=POSTAL_ADDRESS&
contactMechPurposeTypeId=SHIPPING_LOCATION&DONE_PAGE=checkoutoptions
So I decided to revert the concerned part of commit e487122 and to rather use
entitymaint instead of "entity/list" request.
* Improved: Added support to consider non-default transaction timeout for Groovy and Simple event handlers.(OFBIZ-11607)
* Revert "Improved: Added support to consider non-default transaction timeout for Groovy and Simple event handlers.(OFBIZ-11607)"
This reverts commit 934eaa4539.
* Improved: Added support to consider non-default transaction timeout for Groovy and Simple event handlers.(OFBIZ-11607)
Co-authored-by: Ravi Lodhi <lodhiravi1@gmail.com>
(OFBIZ-11534)
There is an issue in uploading large files, I am able to upload files up to 2 GB
successfully but getting an error when trying to upload a file larger than 2GB.
Example -
1. Go to party profile -
https://demo-trunk.ofbiz.apache.org/partymgr/control/viewprofile?partyId=admin
2. Try to create a party content with a file larger than 2 GB
3. Error on console
jleroux:
For a 2GB+ file you need to set Xmx to more than the double of the file size,
eg: gradlew ofbiz -PjvmArgs="-Xms1024M -Xmx5048M"
You then get another small issue (only in log) when redirecting to send the
partyId parameter.
This is because, DiskFileItem is a temporary Object with a null value contained
in "fileItems" attribute. It can't be detected by UtilMisc::makeMapSerializable
and that makes "fileItems" not serializable. So it must be removed from
reqAttrMap.
Thanks: Chandan Khandelwal for report, Michael for suggesting a very large file
to upload
SystemProperties
(OFBIZ-11594)
Adds more latitude to set same site by using
EntityUtilProperties::getPropertyValueFromDelegatorName for retrieving the value
possibly from the DB as a SystemProperty.
OF course this would not work with tenants, but I doubt the "internal" SSO
feature will ever be use in a tenants context
(OFBIZ-11593)
The "entity/list" request has been put in with OFBIZ-11007. It's used to call
the entitymaint view and so is a demo/didactic duplicate of entitymaint request.
It's only used in FindGeneric screen (look for WebtoolsBackToEntityList label).
It's problematic because since the CSRF token defense was put in you can no
longer filter the entities from the entities list screen, even when the default
NoCsrfDefenseStrategy is used. It works if you use the entitymaint request
instead.
Anyway, 2020-01-19 I proposed in OFBIZ-11306 a solution for such cases.
It was not used because 2020-02-14 I thought it was no longer needed,
but it's necessary for this case, and maybe others not already detected.
Here it's implementation (only trunk)
Mostly manually-automated, so some changes are not perfect. I have manually
changed back excessive ones
Comments out ArrayTypeStyle checkstyle
Updates checkstyleMain.maxErrors
(OFBIZ-11477)
According to OWASP OFBiz Web Content Caching is weak:
Independently of the cache policy defined by the web application, if caching web
application contents is allowed, the session IDs must never be cached, so it is
highly recommended to use the Cache-Control: no-cache="Set-Cookie, Set-Cookie2"
directive, to allow web clients to cache everything except the session ID
I though noticed that Set-Cookie2 is deprecated for a long time now. And we new
browsers policies it to often updated. So no need to use Set-Cookie2.
(OFBIZ-11317)
In some place, like at least themes/tomahawk/template/AppBarClose.ftl the CSRF
token is not generated. Because in those places OfbizUrlTransform is used.
An immediate solution is to add the CSRF token generation in OfbizUrlTransform
class.
A definitive solution is to complete OFBIZ-11229
"Merge UrlRegexpTransform and OfbizUrlTransform classes"
(OFBIZ-11317)
Adding the controlPath attribute to allow the controls by ofbizUrl to support uri to other OFBiz web application.
Thanks: Jacques for the review
(OFBIZ-11313)
‘RequestHandler#ControllerConfig’ was a wrapper around
‘ConfigXMLReader#ControllerConfig’ used as a convenience to gather
error handling when accessing configuration properties. Since the
later is now only throwing exceptions when instantiating the object,
‘RequestHandler#ControllerConfig’ is not useful anymore.
(OFBIZ-11313)
The included controller files resolution was previously delayed when
accessing the configuration properties. The issue is that it imposes
callers to handle exceptions when accessing those
properties. Additionally this has the drawback of detecting inclusion
issues late.
We are now retrieving the included files when instantiating the
controller configuration object. This provides more guarantee on the
integrity of instantiated controllers and relax the error handling
requirements on configuration properties callers.
(OFBIZ-11161)
All files in {compoment}/config directories are placed in jar
root (cf. sourceSets definition in build.gradle) but there are 4 different
`freemarkerTransforms.properties` in ofbiz (content, product, webapp, widget).
This works fine because we are adding config directories in classpath (through
classpath tag in ofbiz-component.xml), but this is not really intuitive. So to
make things clearer this patch move `freemarkerTransforms.properties` into
`src/main/resources` with a namespace package and `FreeMarkerWorker.java` is
modified accordingly.