Commit Graph
2421 Commits
Author SHA1 Message Date
Michael Brohl 8af3e9ce6b Multi Part Input Parameters not Available in Groovy Event
(OFBIZ-5048)

This change provides easier access to the FileItem by not wrapping it
into a buffer.
2020-01-31 15:50:47 +01:00
Michael Brohl 765fdbbbd8 Extend UtilHttp.urlEncodeArgs API with preserveEmpty-parameter
(OFBIZ-10198)

This patch extends the current UtilHttp.urlEncodeArgs() method with an
additional input parameter: boolean preserveEmpty.

It allows to get a query string with empty parameters, useful if the
receiver expects mandatory parameters or wants to explicit
override/clear existing values with an empty one.

Thanks Martin Becker for reporting and providing the patch.
2020-01-30 21:33:41 +01:00
Nicolas Malin 11cf350302 Improved: Change 'restMethod' by '_method' in request parameters
(OFBIZ-11332)

When we analyse a request method, we currently check the parameter "restMethod".
Mathieu Lirzin propose [1] to use "_method" instead to use a parameter name more generic

I create a new function UtilHttp.getRequestMethod() to centralize the request method resolution.

[1] https://issues.apache.org/jira/browse/OFBIZ-11007?focusedCommentId=17012712&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17012712
2020-01-29 10:50:29 +01:00
Jacques Le Roux c672c3a304 Fixed: Cannot run ComponentContainerTest on windows
(OFBIZ-11331)

Running ComponentContainerTest on windows fails due to parsing of paths of the
form '/c:/dev/....'
org.apache.ofbiz.base.container.ComponentContainerTest >
testCheckDependencyForComponent FAILED
java.nio.file.InvalidPathException at ComponentContainerTest.java:44

Line 44:
private Path ofbizHome = Paths.get(ComponentContainerTest.class.getResource
("testsdata").getFile()).toAbsolutePath().normalize();

PR created: #8

Thanks: Daniel WatfordNina Simone - My Baby Just Cares For Me.mp3
2020-01-28 18:36:06 +01:00
Daniel Watford 259f71dd43 Removed unused test imports. 2020-01-28 11:38:07 +00:00
Daniel Watford 0c2124a08a Get Path from URI than a string representation of a file path when building Path to test resources. 2020-01-28 11:35:52 +00:00
Mathieu Lirzin 583f926e04 Improved: Remove unused ‘ComponentContainer#retrieveComponentConfig’ argument
No functional change.
2020-01-03 16:01:44 +01:00
Jacques Le Roux 28b658e260 Improved: Equivalent of svn:auto-props properties on the server
(OFBIZ-OFBIZ-11279)

As explained at https://s.apache.org/i86ht

This is needed after b424d2683e
2019-12-19 13:19:59 +01:00
Mathieu Lirzin df5dde37d5 Improved: Replace getLocation with location in ‘ComponentConfig.WebappInfo’
(OFBIZ-11192)

Use Path instead of String + File.
2019-12-08 00:12:52 +01:00
Mathieu Lirzin 4d4a1ba1cd Improved: Lint ‘FreeMarkerWorker’ class
(OFBIZ-11161)
2019-12-07 23:16:45 +01:00
Mathieu Lirzin 376b818464 Improved: Do not add classpath info to the classloader classpath (OFBIZ-11161)
Those directories are already added in the classpath by the build
system. The classpath info defined in “ofbiz-component.xml” files are
now only used to retrieve label files.
2019-12-07 23:13:18 +01:00
Samuel Trégouët 98bfafd148 Improved: Resolve classpath conflict on freemarkerTransforms.properties
(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.
2019-12-07 23:13:10 +01:00
Mathieu Lirzin 87d7465306 Improved: Move ‘ComponentContainerTest’ data to src/test/resources/ (OFBIZ-11275)
Remove unnecessary webapp declaration inside the test component
configurations.
2019-12-01 23:43:53 +01:00
Samuel Trégouët 000325208a Fixed: Remove dependency management from ‘ComponentContainer’
(OFBIZ-11275)

This fixes a bug identified by ‘testCheckDependencyForComponent’ where
the dependencies declared inside component configurations were not
impacting the component retrieval order.

Component configurations stored in the cache can now be properly
sorted based on their <depends-on> declaration.  The new
‘ComponentConfig#sortDependencies’ method returns a collection of
component configuration following a topological ordering.

In case of dependency cycle we throw an error.
2019-11-25 14:56:18 +01:00
Nicolas Malin 935ffe86ca Fixed: Possible NPE in StringUtil#strToMap
(OFBIZ-11281)

StringUtil#strToMap(String, String, boolean, String) throws Nullpointer for StringUtil.strToMap("", false).

Thanks to Ulrich Heidfeld for this fix
2019-11-14 09:10:05 +01:00
Mathieu Lirzin a521de9ad8 Reverted: "Fixed: Remove dependency management from ‘ComponentContainer’"
(OFBIZ-11275)

This reverts commit 3d3533cf5e.

‘./gradlew cleanAll loadAll’ do not work anymore.
2019-11-09 00:54:56 +01:00
Mathieu Lirzin 03b69b30a5 Fixed: Fix linting issues
(OFBIZ-11265)
2019-11-08 18:19:51 +01:00
Samuel Trégouët 3d3533cf5e Fixed: Remove dependency management from ‘ComponentContainer’
(OFBIZ-11275)

This fixes a bug identified by ‘testCheckDependencyForComponent’ where
the dependencies declared inside component configurations were not
impacting the component retrieval order.

Component configurations stored in the cache can now be properly
sorted based on their <depends-on> declaration.  The new
‘ComponentConfig#sortDependencies’ method returns a collection of
component configuration following a topological ordering.

In case of dependency cycle we throw an error.
2019-11-08 18:19:51 +01:00
Samuel Trégouët 7044af8a6f Implemented: Add a generic directed graph utilitary class
(OFBIZ-11275)
2019-11-08 18:19:51 +01:00
Samuel Trégouët 1317703c9a Implemented: Show dependency resolution algorithm problem
(OFBIZ-11275)

This adds a test demonstrating a bug in the dependency resolution
algorithm done in ‘ComponentContainer’.

When relying on <depends-on> declaration in “ofbiz-component.xml”
files we should expect to retrieve components (and their associated
containers) in a topological ordering meaning a linear ordering where
each component configuration element is placed after its dependencies
configuration elements.  Currently this is not the case and the
dependency declarations only impact the construction of the dynamic
classpath.
2019-11-08 18:19:46 +01:00
Jacques Le Roux 8aea160e04 Fixed: Getting policy error while editing html text data using cms
(OFBIZ-11265)

Service parameter with allow-html="safe" does not check the OWASP sanitizer flag
ie. enabled or not and perform sanitization which causing policy error while
editing text data

getting following exception error:
"In field [textData] by our input policy, your input has not been accepted for
security reason. Please check and modify accordingly, thanks."

Thanks: Pradeep Choudhary for report and suggestion
2019-11-07 15:46:05 +01:00
Mathieu Lirzin 7d9080702d Improved: Turn ‘DependsOnInfo’ into a String
(OFBIZ-11264)

`depends-on` XML tag doesn't have any `loader` or `location` attribute so
DependsOnInfo does not need to extend ResourceInfo.

When removing the class derivation, DependsOnInfo now becomes a simple box
containing a String attribute. In order to make the manipulation of dependency
information simpler, the attribute is now inlined as a simple String value.

Thanks: Samuel Trégouët for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869185 13f79535-47bb-0310-9956-ffa450edef68
2019-10-30 15:47:58 +00:00
Mathieu Lirzin e5592a9bf4 Improved: Add ‘ComponentConfig#toString’ to ease debugging
(OFBIZ-11264)

Thanks: Samuel Trégouët for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869184 13f79535-47bb-0310-9956-ffa450edef68
2019-10-30 15:42:59 +00:00
Mathieu Lirzin 5a8e2dcf3c Improved: Rewrite ‘ComponentContainer#loadComponentsInDirectory’
(OFBIZ-11264)

Use a more declarative style with the stream API.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869183 13f79535-47bb-0310-9956-ffa450edef68
2019-10-30 15:41:29 +00:00
Mathieu Lirzin aeebf807b8 Improved: Delay the construction of component classpaths
(OFBIZ-11264)

The list of component classpath elements was constructed iteratively
while loading components. This list was additionally used to check if
a component was actually loaded.  This implementation was leading to
hard to understand code that has been replaced by a more appropriate
‘LinkedHashSet’ object.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869182 13f79535-47bb-0310-9956-ffa450edef68
2019-10-30 15:38:08 +00:00
Mathieu Lirzin 7093974aa7 Improved: Remove unnecessary ‘throws’ declarations
(OFBIZ-11264)

Some declared and/or documented exceptions that were not actually
thrown.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869181 13f79535-47bb-0310-9956-ffa450edef68
2019-10-30 15:34:30 +00:00
Mathieu Lirzin c9788a0b48 Improved: Import ‘ComponentDef’ and ‘DependsOnInfo’ inner-classes
(OFBIZ-11264)

This allows to use shorter name when using an variable or parameter of
those types.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869180 13f79535-47bb-0310-9956-ffa450edef68
2019-10-30 15:33:13 +00:00
Mathieu Lirzin 59efa181d2 Improved: Lint unit tests
This makes no behavioral changes, only coding style fixes.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869037 13f79535-47bb-0310-9956-ffa450edef68
2019-10-27 12:51:08 +00:00
Mathieu Lirzin d5e09638ba Improved: Merge ‘UtilObjectUnitTest’ into ‘UtilObjectTests’
(OFBIZ-11067)

Those classes were testing the same class.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869023 13f79535-47bb-0310-9956-ffa450edef68
2019-10-26 21:47:46 +00:00
Mathieu Lirzin e5933c677b Improved: Turn ‘UtilObjectTests’ into a unit test class
(OFBIZ-11067)

Adapt ‘UtilObjectUnitTest’ test class to avoid side effects when
testing allowed serialization classes.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869022 13f79535-47bb-0310-9956-ffa450edef68
2019-10-26 21:46:01 +00:00
Mathieu Lirzin 129ef1e601 Improved: Do not use deprecated ‘Class#newInstance’
(OFBIZ-11262)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869008 13f79535-47bb-0310-9956-ffa450edef68
2019-10-26 16:20:38 +00:00
Mathieu Lirzin 81be0b893c Improved: Do not use deprecated ‘javax.security.cert.X509Certificate’
(OFBIZ-11262)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869006 13f79535-47bb-0310-9956-ffa450edef68
2019-10-26 16:16:13 +00:00
Mathieu Lirzin deec38ec43 Improved: Refactor ‘UtilObject#getObjectException’
(OFBIZ-11261)

This moves most of the behavior inside the ‘SafeObjectInputStream’
class which has been refactored too.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869004 13f79535-47bb-0310-9956-ffa450edef68
2019-10-26 15:17:56 +00:00
Mathieu Lirzin 197d7a515b Fixed: Handle whitelist of serializable classes from properties
(OFBIZ-11261)

There was a bug regarding the way the ‘ListOfSafeObjectsForInputStream’ value
defined in the “SafeObjectInputStream.properties” file was handled.  Mistakenly
only one class identifier was allowed.

Some unit tests have been added to check that the identified bug is fixed.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869001 13f79535-47bb-0310-9956-ffa450edef68
2019-10-26 14:42:02 +00:00
Mathieu Lirzin de7a855ff5 Fixed: Use ‘ConcurrentHashMap’ to avoid ‘ConcurrentModificationException’
(OFBIZ-11258)

When trying to load components in their dependency order the
‘toBeLoadedComponents’ map is modified while being iterated over which
is not safe for non-concurrent maps.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868665 13f79535-47bb-0310-9956-ffa450edef68
2019-10-20 16:47:24 +00:00
Mathieu Lirzin 8553f0b5ae Fixed: Fix regression introduced in revision 1867409
(OFBIZ-11192)

‘null’ was an unspecified valid value for the second argument of the
‘ComponentContainer#retrieveComponentConfig’ method.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868657 13f79535-47bb-0310-9956-ffa450edef68
2019-10-20 16:13:50 +00:00
Mathieu Lirzin 434a0160a2 Improved: Adapt ‘ContainerConfig#getConfigurations’
(OFBIZ-11256)

Remove unused declared ‘ContainerException’ in signature and fix the
javadoc to match the actual specification.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868630 13f79535-47bb-0310-9956-ffa450edef68
2019-10-19 14:56:50 +00:00
Mathieu Lirzin 29f814cd49 Improved: Mark ‘ContainerConfig#configurations’ as final
(OFBIZ-11256)

Use uppercase to match coding standards.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868629 13f79535-47bb-0310-9956-ffa450edef68
2019-10-19 14:29:26 +00:00
Mathieu Lirzin 2c686c4655 Improved: Avoid unecessary breakage in ‘ContainerConfig’
(OFBIZ-11256)

This restores ‘public’ modifiers on fields and move the ‘Property’
inner class back to ‘Configuration’ to avoid breakage of client code
extending the ‘Container’ interface.

In order to smooth the transition towards using getters instead of
direct field accesss, the public modifiers on fields are now marked as
deprecated.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868628 13f79535-47bb-0310-9956-ffa450edef68
2019-10-19 14:27:01 +00:00
Mathieu Lirzin 80c46f9c8c Improved: Add ‘PropertyChildren’ interface
(OFBIZ-11256)

This allows removing some duplicated method overloads.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868626 13f79535-47bb-0310-9956-ffa450edef68
2019-10-19 14:21:46 +00:00
Mathieu Lirzin 7e7ccba7b3 Improved: Refactor ‘ContainerConfig’ class
(OFBIZ-11256)

This removes some code duplication, make things immutable and add some javadoc.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868601 13f79535-47bb-0310-9956-ffa450edef68
2019-10-18 19:46:32 +00:00
Jacques Le Roux 6db4ffdbcd Improved: Remove unused methods related to properties in UtilProperties and
EntityUtilProperties
(OFBIZ-11254)

While removing the POS I forgot to remove specific methods I added in 
UtilProperties: setPropertyValue(*,*,*) and setPropertyValueInMemory. 
I finally found that setPropertyValueInMemory is used in one test and so maybe
usefull. setPropertyValue(*,*,*) is unused and can be safemy removed. It's also 
called from EntityUtilProperties so should also be removed there.

This removes it, and also slightly formats 
EntityUtilProperties::setPropertyValueInMemory 


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868589 13f79535-47bb-0310-9956-ffa450edef68
2019-10-18 11:44:29 +00:00
Nicolas Malin 193280addb Fixed: Down the log level to inform when a property number is empty
When you call a property number undefined, UtilProperty return the default value and you have in console a warning :

    UtilProperties |W| Error converting String  to Integer; using defaultNumber 60.

Or in general if you call and resolve an empty value for a property, they is no reason to inform it as error.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868580 13f79535-47bb-0310-9956-ffa450edef68
2019-10-18 09:22:11 +00:00
Mathieu Lirzin 13188ab6cc Improved: Refactor ‘ComponentConfig.ClasspathInfo’
(OFBIZ-11192)(OFBIZ-11238)

The validity checks have been moved at construction time instead of
relying on client code to ensure that the class path information are
sound.

A new ‘ComponentConfig.ClasspathInfo.Type’ enum has been defined to
improve type safety.

The location of the class path information is now using a
‘java.nio.file.Path’ class instance.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868030 13f79535-47bb-0310-9956-ffa450edef68
2019-10-05 16:30:12 +00:00
Mathieu Lirzin f628dec8be Improved: Specify that the component dependencies are never ‘null’
(OFBIZ-11238)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868029 13f79535-47bb-0310-9956-ffa450edef68
2019-10-05 16:23:21 +00:00
Mathieu Lirzin 60f7041c3d Improved: Use ‘Path’ for component config ‘rootLocation’ attribute
(OFBIZ-11192)

The method ‘ComponentConfig#getRootLocation’ has been removed
and replaced by ‘ComponentConfig#rootLocation’.

The callers have been adapted.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868028 13f79535-47bb-0310-9956-ffa450edef68
2019-10-05 16:20:32 +00:00
Mathieu Lirzin c982df72c2 Improved: Rewrite ‘Classpath’ class
(OFBIZ-11237)

This class has been moved to ‘org.apache.ofbiz.base.container’ to be
able to reduce its visibility to the “package” level.

The API has been change to avoid unnecessary checks and simpler dataflow.

There was no need to provide thread safety so the ‘synchronized’
blocks have been removed.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868027 13f79535-47bb-0310-9956-ffa450edef68
2019-10-05 15:44:21 +00:00
Mathieu Lirzin ee77723168 Improved: Remove unnecessary semicolon
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867986 13f79535-47bb-0310-9956-ffa450edef68
2019-10-04 14:37:45 +00:00
Mathieu Lirzin b37bd7ab79 Improved: Add missing generic types
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867984 13f79535-47bb-0310-9956-ffa450edef68
2019-10-04 14:35:07 +00:00
Gil Portenseigne 42c208ee0c Improved: Refactor UelFunctions.java to remove error management via Exception
(OFBIZ-11213)

This refactoring was initiated since using UelFunction::getSize throws 
ClassCastException and log a consequent unneeded stack trace to test 
Object class type. The log is unnecessary, because it is the result of 
each supported class cast trial.

This issue show up that lot of possible NPE were not checked against,
but catched by 'Exception'.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867635 13f79535-47bb-0310-9956-ffa450edef68
2019-09-27 13:52:43 +00:00