Commit Graph
2272 Commits
Author SHA1 Message Date
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
Mathieu Lirzin 518edddf9c Improved: Refactor ‘ComponentContainer#loadComponentFromConfig’
(OFBIZ-11192)

The unnecessary declared ‘ContainerException’ exception has been removed. A
switch statement has been used and the javadoc has been rewritten.

Additionally the method has been renamed to ‘ComponentContainer#loadComponent’.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867499 13f79535-47bb-0310-9956-ffa450edef68
2019-09-24 22:23:59 +00:00
Mathieu Lirzin ee95f3bad3 Improved: Use ‘java.nio.file’ API in ‘ComponentContainer’ class
(OFBIZ-11192)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867409 13f79535-47bb-0310-9956-ffa450edef68
2019-09-23 21:37:57 +00:00
Mathieu Lirzin 6f54d35c91 Improved: Convert ‘Config#ofbizHome’ and ‘Config#logDir’ to a path
(OFBIZ-11192)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867399 13f79535-47bb-0310-9956-ffa450edef68
2019-09-23 20:04:43 +00:00
Mathieu Lirzin e3acbf6541 Improved: Refactor ‘ComponentLoaderConfig’ class
(OFBIZ-11192)

This redefines the ‘ComponentLoaderConfig#ComponentDef’ class by
removing its unused name attribute.

The ‘java.nio.file’ API has been used to represent the relative path
of a component location.

Various cleanups and Javadoc added.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867394 13f79535-47bb-0310-9956-ffa450edef68
2019-09-23 19:38:17 +00:00
Jacques Le Roux cfff42cdc4 Fixed: Fix Default or Empty Catch block in Java and Groovy files
(OFBIZ-8341)

In many Java and Groovy files we have auto generated catch blocks or empty catch 
blocks. 
To avoid such exception swallowing this should be improved to at least log the 
error and also return error in case of service.

Last ones :)

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866958 13f79535-47bb-0310-9956-ffa450edef68
2019-09-15 07:48:09 +00:00
Jacques Le Roux 28dfdf5c2e Fixed: Fix Default or Empty Catch block in Java and Groovy files
(OFBIZ-8341)

In many Java and Groovy files we have auto generated catch blocks or empty catch 
blocks. 
To avoid such exception swallowing this should be improved to at least log the 
error and also return error in case of service.

Here we use 3 try-with-ressource blocks and log some errors

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866957 13f79535-47bb-0310-9956-ffa450edef68
2019-09-15 06:32:42 +00:00
Jacques Le Roux 73ebcfb095 Fixed: Fix Default or Empty Catch block in Java and Groovy files
(OFBIZ-8341)

In many Java and Groovy files we have auto generated catch blocks or empty catch 
blocks. 
To avoid such exception swallowing this should be improved to at least log the 
error and also return error in case of service.

Here we use a try-with-ressource block and log some errors

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866952 13f79535-47bb-0310-9956-ffa450edef68
2019-09-14 17:11:59 +00:00
Jacques Le Roux c7759b0927 Improved: Refactor boolean returns from methods
(OFBIZ-10725)

Stumbled upon it by chance, a last one

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866931 13f79535-47bb-0310-9956-ffa450edef68
2019-09-14 09:29:06 +00:00
Jacques Le Roux ea17f3f006 Improved: Refactor boolean returns from methods
(OFBIZ-10725)

Reverts mistakes made in previous commit

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866930 13f79535-47bb-0310-9956-ffa450edef68
2019-09-14 09:25:03 +00:00
Jacques Le Roux 1686f8cb2a Improved: Refactor boolean returns from methods
(OFBIZ-10725)

Stumbled upon it by chance, here are few changes

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866929 13f79535-47bb-0310-9956-ffa450edef68
2019-09-14 09:19:16 +00:00
Jacques Le Roux 41e3889685 Improved: no functional change
In my previous commit I forgot I used FileUtile::normalizePath (old name 
of now normalizeFilePath) in FileUtile::getFile. This is useless, and reverted
here

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866927 13f79535-47bb-0310-9956-ffa450edef68
2019-09-14 08:38:13 +00:00
Jacques Le Roux b08e31dda7 Improved: no functional change
While working on OFBIZ-11196,I renamed the normalizePath() method in FileUtil 
class to createFileWithNormalizedPath() and added the normalizeFilePath()
method which deals only with String (in -> out), could be useful later...

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866924 13f79535-47bb-0310-9956-ffa450edef68
2019-09-14 08:29:45 +00:00
Jacques Le Roux 48a20b4782 Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

Allows users to easily override the list of accepted objects by using the
listOfSafeObjectsForInputStream property

CVE-2019-0189


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866834 13f79535-47bb-0310-9956-ffa450edef68
2019-09-12 07:49:41 +00:00
Jacques Le Roux ef1b7b9f90 Improved: Wrong log level show for missing labels
(OFBIZ-11159)

Better English :)

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865851 13f79535-47bb-0310-9956-ffa450edef68
2019-08-24 13:46:38 +00:00
Mathieu Lirzin 2ec608fa45 Improved: Remove unused code in ‘UtilValidate’
(OFBIZ-11172)

The code was not used in Java/Groovy/FreeMarker/XML in the framework
or official plugins.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865844 13f79535-47bb-0310-9956-ffa450edef68
2019-08-24 12:56:36 +00:00
Mathieu Lirzin 1b34cf7982 Improved: Inline ‘UtilValidate#areEqual’
(OFBIZ-11172)

‘Objects#equals’ is already providing the same functionality of ‘null’
safe equality check.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865843 13f79535-47bb-0310-9956-ffa450edef68
2019-08-24 12:52:12 +00:00
Jacques Le Roux 654838de8b Improved: Wrong log level show for missing labels
(OFBIZ-11159)


The log level for missing labels in UtilProperties is set to Info. 
This should however be, at least, of level warning.


Thanks: Pierre Smits for the Jira

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865819 13f79535-47bb-0310-9956-ffa450edef68
2019-08-24 08:05:43 +00:00
Mathieu Lirzin cf79277608 Improved: Remove redundant "dtd" directory from classpath
(OFBIZ-11161)

the "dtd" directories are already present as resources distributed
inside OFBiz jar, so there is no need to augment the classpath to find
the XML schema inside those directories.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865796 13f79535-47bb-0310-9956-ffa450edef68
2019-08-24 00:29:41 +00:00
Mathieu Lirzin 9bc8ebb864 Improved: Remove useless ‘GroovyScriptTestCase’
(OFBIZ-11165)

This class was useless since ‘GroovyScriptTestCase’ provides the same
interesting feature as ‘OFBizTestCase’ meaning a delegator and a dispatcher.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865787 13f79535-47bb-0310-9956-ffa450edef68
2019-08-23 18:02:42 +00:00
Mathieu Lirzin 9b68a55d64 Improved: Compile groovy integration tests
(OFBIZ-11165)

Since there is no need for dynamic reload for integration tests,
it is better to compile Groovy tests.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865786 13f79535-47bb-0310-9956-ffa450edef68
2019-08-23 18:00:01 +00:00
Jacques Le Roux b8e9d0497a Improved: Update Freemarker to 2.3.29
(OFBIZ-11163)

Tests and UI are OK



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865753 13f79535-47bb-0310-9956-ffa450edef68
2019-08-23 14:54:01 +00:00
Mathieu Lirzin 4c70084b76 Improved: Separate resources from Java source files
(OFBIZ-11161)

This moves the resource files in a dedicated "src/main/resources"
directory.  This convention follows the Maven standard directory
layout which is the convention used by default in Gradle.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865717 13f79535-47bb-0310-9956-ffa450edef68
2019-08-22 20:38:01 +00:00
Jacques Le Roux 2178c6082a Fixed: Issue loading solr component (JNDI timeout)
(OFBIZ-11156)

We need to provide a JNDI environment property for Solr to load faster

Fixes previous commit where I hastily harcoded in jndi.properties file

Used a system property which can be used to define a JNDI environment 
property

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865347 13f79535-47bb-0310-9956-ffa450edef68
2019-08-17 11:34:01 +00:00
Jacques Le Roux 22e304d90a Fixed: Issue loading solr component (JNDI timeout)
(OFBIZ-11156)

We need to provide a JNDI environment Property for Solr to load faster

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865344 13f79535-47bb-0310-9956-ffa450edef68
2019-08-17 11:07:01 +00:00
Jacques Le Roux c2f13a3bab Improved: Update build.gradle to the latest dependencies
(OFBIZ-11151)

Removes the last Java code warnings by using @SuppressWarnings("rawtypes")
for the org.owasp.esapi.codecs.Codec

I see no better solution since we have no access to this code.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865017 13f79535-47bb-0310-9956-ffa450edef68
2019-08-13 08:48:26 +00:00
Mathieu Lirzin 3fb1d50625 Improved: Use method references instead of lambda inside variables
(OFBIZ-10817)

Lambda expressions are not meant to be stored inside variables.  In
most cases it is better to define a static method and use a method
reference instead.  Static methods have the benefits of having a more
explicit signature and some javadoc attached to them.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1864953 13f79535-47bb-0310-9956-ffa450edef68
2019-08-12 09:47:59 +00:00
Jacques Le Roux 7c8f7a55e3 Fixed: [FB] Find Security Bugs
(OFBIZ-9973)

As suggested by Mathieu on dev ML factorises the use of Path::normalize

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1864930 13f79535-47bb-0310-9956-ffa450edef68
2019-08-11 13:23:19 +00:00
Nicolas Malin 4a511be1cc Implemented: Homogenize displaying number with multiple format
(OFBIZ-7532)

To display a number we had different possibilities :
 * on ftl use the template <@ofbizAmount and <@ofbizCurrency
 * by java call a function UtilFormatOut.formatAmount, UtilFormatOut.formatPrice, UtilFormatOut.formatQuantity, etc..
 * by form widget, use <display type=accounting-number for accounting but nothing for other

To simplify and homogenize all, I implemented a number type purpose :
   * default: display a number by default, use when no purpose is present
   * quantity: display a number as a quantity
   * amount: display a number as an amount (like price without currency)
   * spelled: litteral displaying for a number (use on <@ofbizAmount ftl only before)
   * percentage: display a number as a percentage
   * accounting: diplay a number for accounting specific

Each purpose can be associate to a number for displaying it :
   * on ftl <@ofbizNumber number=value format=purpose/>
   * on java UtilFormatOut.formatNumber(value, purpose, delegator, locale)
   * on form widget <display type=number format=purpose/>

The format use by a purpose is define on framework/common/config/number.properties with the template
    .displaying.format = ##0.00

With this, you can surchage a configuration, create your own purpose or surchage only one through entity SystemProperty.

Concerning the backware compatibility: 
 * For the ftl the template <@ofbizAmount is now a link to '<@ofbizNumber format=amount'
 * For java all previous function call UtilFormatOut.formatNumber with the matching purpose
 * For form xml accounting-number is managed as an exection

Last point, display a currency is different that a number, so I didn't refactoring some code for this case (only move properties from general to number for centralize de configuration on the same file)

Thanks Charles Steltzlen to start the refactoring

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1864832 13f79535-47bb-0310-9956-ffa450edef68
2019-08-09 20:37:11 +00:00
Mathieu Lirzin 7999e3adc1 Improved: Remove useless imports
(OFBIZ-11142)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863507 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 18:45:21 +00:00
Mathieu Lirzin fc6f9023d2 Improved: Use ‘StandardCharsets.UTF_8’
(OFBIZ-11142)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863505 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 18:41:37 +00:00
Mathieu Lirzin 2c2340db0a Improved: Use ‘java.util.Base64’
(OFBIZ-11142)

Since Java 8 a standard Base64 encoder/decoder is available. As a
consequence we can remove our embedded implementation and use it
instead.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863504 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 18:39:57 +00:00
Mathieu Lirzin 54f210a866 Improved: Inline ‘UtilGenerics#checkCollection(Object)’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863502 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:36:12 +00:00
Mathieu Lirzin e9a56a78e5 Improved: Inline ‘UtilGenerics#checkList’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863501 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:35:13 +00:00
Mathieu Lirzin 83fd20607b Improved: Inline ‘UtilGenerics#checkMap’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863500 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:32:34 +00:00
Mathieu Lirzin 17da80d72d Improved: Inline ‘UtilGenerics#checkSet’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863499 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:31:29 +00:00
Mathieu Lirzin 2f12b17663 Improved: Inline ‘UtilGenerics#toList’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863498 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:30:45 +00:00
Mathieu Lirzin 365b044268 Improved: Inline ‘UtilGenerics#toMap’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863497 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:29:52 +00:00
Mathieu Lirzin 7618a51f68 Improved: Rewrite ‘UtilGenerics#toList’ and ‘UtilGenerics#toMap’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863496 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:28:33 +00:00
Mathieu Lirzin 95430bd0cf Improved: Remove useless ‘UtilGenerics#toMap’ overloads
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863495 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:27:23 +00:00
Mathieu Lirzin fe9631545e Improved: Rewrite ‘UtilGenerics#checkMap’ to do a simple cast
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863494 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:25:51 +00:00
Mathieu Lirzin 7db8f19d08 Improved: Inline ‘UtilGenerics#checkCollectionContainment’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863493 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:24:39 +00:00
Mathieu Lirzin c2e2c3fb15 Improved: Make ‘UtilGenerics#checkCollection(Object, Class)’ more generic
(OFBIZ-11141)

Remove ‘checkList’, ‘checkSet’ and ‘checkStack’ by using
‘checkCollection’ instead.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863489 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:18:23 +00:00
Mathieu Lirzin 1e22cbc6a0 Implememented: Add unit tests for ‘UtilGenerics#checkCollectionCast’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863487 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:10:54 +00:00
Mathieu Lirzin f0dda2a551 Improved: Inline ‘UtilGenerics#checkStack(Object)’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863486 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:09:29 +00:00
Mathieu Lirzin fce71fe4e3 Improved: Inline ‘UtilGenerics#checkCollectionCast’
(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863485 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 16:08:21 +00:00
Mathieu Lirzin 7b0053b28c Improved: Remove useless ‘UtilObject#compareToHelper’
(OFBIZ-11140)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863445 13f79535-47bb-0310-9956-ffa450edef68
2019-07-19 22:17:13 +00:00
Mathieu Lirzin 1427c576d5 Improved: Remove useless ‘UtilObject#getBytes’
(OFBIZ-11140)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863444 13f79535-47bb-0310-9956-ffa450edef68
2019-07-19 22:13:43 +00:00
Mathieu Lirzin cc85af1642 Improved: Remove useless ‘UtilObject#equalsHelper’
(OFBIZ-11140)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863443 13f79535-47bb-0310-9956-ffa450edef68
2019-07-19 22:11:39 +00:00
Mathieu Lirzin 6a99c09a18 Improved: Remove ‘UtilMisc#toList’
(OFBIZ-11140)


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