Commit Graph
2183 Commits
Author SHA1 Message Date
Mathieu Lirzin 5ac6be8f19 Improved: Turn ‘TestJSONConverters’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860024 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 21:58:15 +00:00
Mathieu Lirzin 44188945a7 Improved: Turn ‘TestBooleanConverters’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860023 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 21:54:01 +00:00
Mathieu Lirzin fb8705dbf0 Improved: Turn ‘BaseUnitTests’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860022 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 21:29:31 +00:00
Mathieu Lirzin c43b99c812 Improved: Turn ‘AssertTests’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860021 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 21:28:23 +00:00
Mathieu Lirzin c465e734ae Improved: Turn ‘UtilMiscTests’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860020 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 21:27:30 +00:00
Mathieu Lirzin e59a460525 Improved: Turn ‘UtilIOTests’ into a unit test class
(OFBIZ-11067)

Previously this test was disabled, however since it now seems to work
now we enable it.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860019 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 21:24:02 +00:00
Mathieu Lirzin 2d5e81cc50 Improved: Remove empty ‘UtilHttpTests’ class
(OFBIZ-11067)

This test class was empty so no need to convert it in a unit test
class.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860018 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 21:21:05 +00:00
Mathieu Lirzin 1d2d4ac50a Improved: Turn ‘UtilCacheTests’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860017 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 21:19:54 +00:00
Mathieu Lirzin 409323020e Improved: Turn ‘TimeDurationTests’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860016 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 21:15:04 +00:00
Mathieu Lirzin aa874841ce Improved: Turn ‘ReferenceCleanerTests’ into a unit test class
(OFBIZ-11067)

Keep it disabled since it is failing for obscure reasons.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860015 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 21:13:46 +00:00
Mathieu Lirzin 94c60ee977 Fixed: Remove entry for ‘StringUtilTests’ in “basetests.xml”
(OFBIZ-11014)

This XML element should have been removed in r1859937 when turning
this integration test class into a unit test class.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860006 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 17:49:57 +00:00
Mathieu Lirzin 9587898bbe Improved: Turn ‘ObjectTypeTests’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859984 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 14:28:15 +00:00
Mathieu Lirzin d0a1dde34e Improved: Turn ‘MiscTests’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859982 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 14:25:28 +00:00
Mathieu Lirzin 36d284097e Turn ‘IndentingWriterTests’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859979 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 14:23:12 +00:00
Mathieu Lirzin 10a8ad3097 Improved: Turn ‘GenericMapTest’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859978 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 14:20:53 +00:00
Mathieu Lirzin 1103a2a3e1 Improved: Turn ‘DateTimeTests’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859977 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 14:18:19 +00:00
Mathieu Lirzin 2a4a9bad13 Improved: Turn ‘ComparableRangeTests’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859976 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 14:15:40 +00:00
Mathieu Lirzin 0dede26601 Improved: Turn ‘UtilPropertiesTests’ into a unit test class
(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859975 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 14:12:37 +00:00
Jacques Le Roux 402db94e61 Fixed: Duplicate entries in paramWithSuffix
(OFBIZ-11056)

when using string-list-suffix attribute for service definition, invoke method 
(from associated event handler) will try to parse parameters from both request 
variable and rawParameterMap which was also built from request. 
So we end up with duplicates in resulting list.

This behaviour seems to be introduced with OFBIZ-5048.


Thanks: Samuel Trégouët for report and fix 

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859972 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 14:08:48 +00:00
Jacques Le Roux c26b16a5ee Fixed: Services allow arbitrary HTML for parameters with allow-html set to "safe"
(OFBIZ-5254)

The testCreateNewRequest was failing due to escaped single quotes in related
data in OrderTypeData.xml:
subject="OFBiz - Your Request is received: '${custRequestName}' #CR${custRequestId}"

This was a peculiar case that could be generalised to all escapable characters.
The general solution is to compare the original value with the filtered value 
unescaped in UtilCodec::checkStringForHtmlSafe.
BTW, weirdly enough StringEscapeUtils::escapeHtml4 does not escape single quote.

Another weirdness is the test was passing with plugins data loaded. This is due
to duplicated demo data in scrumTypeData.xml (which is actually not only type
data, as ever the scrum component is a mess, that's not new and always wonder
if we should not get rid of it!)

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859968 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 13:25:34 +00:00
Mathieu Lirzin 410a67a3dc Improved: Turn ‘StringUtilTests’ into a unit test class
(OFBIZ-11014)

Since there is no dependency on the delegator and dispatcher for those
tests, it is better to run them as unit tests instead of integration
tests.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859937 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:38:42 +00:00
Mathieu Lirzin 008fd8ded4 Improved: Remove unused ‘StringUtil#appendTo’ methods
(OFBIZ-11014)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859934 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:28:36 +00:00
Mathieu Lirzin 047340f8a5 Improved: Remove unused ‘StringUtil#collapseCharacter’
(OFBIZ-11014)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859932 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:27:09 +00:00
Mathieu Lirzin b601acc979 Improved: Remove unused ‘StringUtil#collapseSpaces’ method
(OFBIZ-11014)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859930 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:25:41 +00:00
Mathieu Lirzin 87a02f4ca7 Improved: Remove unused ‘StringUtil#collapseNewlines’ method
(OFBIZ-11014)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859929 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:24:37 +00:00
Mathieu Lirzin b24f702c77 Improved: Remove unused ‘StringUtil#removeNumeric’ method
(OFBIZ-11014)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859928 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:22:58 +00:00
Mathieu Lirzin ad9fc62be5 Improved: Remove unused ‘StringUtil#convertChar’ method
(OFBIZ-11014)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859927 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:21:53 +00:00
Mathieu Lirzin c79b0633ab Improved: Remove unused ‘StringUtil#mapToStr’ method
(OFBIZ-11014)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859926 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:21:06 +00:00
Mathieu Lirzin fd7eab1d30 Improved: Remove unused ‘StringUtil#strToMap’ overload
(OFBIZ-11014)

Make the other overload which is only used internally private.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859925 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:18:55 +00:00
Mathieu Lirzin b97461e47a Improved: Inline ‘StringUtil#quoteStrList’ method
(OFBIZ-11014)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859924 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:17:12 +00:00
Mathieu Lirzin 7bd53374ed Improved: Remove unused ‘StringUtil#split’ overload
(OFBIZ-11014)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859923 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:15:38 +00:00
Mathieu Lirzin d7aab2ff73 Improved: Remove unused ‘StringUtil#append’ method
(OFBIZ-11014)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859922 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:13:41 +00:00
Mathieu Lirzin d886fd1b1b Improved: Rewrite ‘StringUtil#join’ method
(OFBIZ-11014)

Use streams instead of low-level string builder.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859921 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:12:05 +00:00
Mathieu Lirzin ab2fcbcb4a Improved: Remove useless ‘StringUtil#join’ overload
(OFBIZ-11014)

‘List’ extends ‘Collection’ so there is no need to overload
‘StringUtil#join(Collection,String)’ with ‘StringUtil#join(List,String)’.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859920 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 09:10:12 +00:00
Jacques Le Roux 5a9b057f24 Improved: no functional change
Javadoc was unhappy: 
CustomPermissivePolicy.java:13: error: element not closed: blockquote


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859882 13f79535-47bb-0310-9956-ffa450edef68
2019-05-24 14:16:39 +00:00
Jacques Le Roux 2dadaacac8 Fixed: Services allow arbitrary HTML for parameters with allow-html set to "safe"
(OFBIZ-5254)

This was reopened after discussion at 
https://markmail.org/message/jnaitmwahjcjmdn5

This is a new solution which follows the work done with OFBIZ-6669 and OFBIZ-10187
Roughly said, it uses org.owasp.html.PolicyFactory and org.owasp.html.Sanitizers

Thanks: Christoph Neuroth for report

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859877 13f79535-47bb-0310-9956-ffa450edef68
2019-05-24 13:47:08 +00:00
Jacques Le Roux a0d9fba0d9 Fixed: OWASP sanitizer breaks proper rendering of HTML code
(OFBIZ-10187)

After a discussion with Dennis, I checked and the pattern ONSITE_URL would be 
useless without 

.allowAttributes("background").matching(ONSITE_URL)
.onElements("table")
.allowAttributes("background").matching(ONSITE_URL)
.onElements("td", "th", "tr")

So here they are

Thanks: Dennis Balkir for discussion

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859871 13f79535-47bb-0310-9956-ffa450edef68
2019-05-24 13:24:31 +00:00
Jacques Le Roux cce437fbdf Improved: no functional changes, only formatting
While working on OFBIZ-5254 after reopening it.

Uses the max width (120) makes things easier to read IMO

I also made a slight non functional change w/ seekSegmentTime in 
checkStringForHtmlStrictNone

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859297 13f79535-47bb-0310-9956-ffa450edef68
2019-05-15 16:18:01 +00:00
Jacques Le Roux 53f89ae595 Improved: no functional change, only formatting
While working on OFBIZ-5254 after reopening it.

Uses the max width (120) makes things easier to read IMO

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859295 13f79535-47bb-0310-9956-ffa450edef68
2019-05-15 15:39:03 +00:00
Mathieu Lirzin 3acf261b7f Fixed: Fix javadoc build for OpenJDK 11
(OFBIZ-10757)

This removes HTML5 deprecated stuff such as ‘<tt>’ elements, and
‘cellpadding’ table attributes which were breaking the ‘:javadoc’
Gradle task when using OpenJDK 11.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859123 13f79535-47bb-0310-9956-ffa450edef68
2019-05-11 20:36:45 +00:00
Mathieu Lirzin a0ac6ae331 Improved: Remove useless null check
(OFBIZ-10054)

Additionally the noisy ‘final’ modifiers on local variables have been
removed because local variables should be final by default and mutable
by exception.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859081 13f79535-47bb-0310-9956-ffa450edef68
2019-05-10 14:13:34 +00:00
Jacques Le Roux bea0b0e25f Fixed: OWASP sanitizer breaks proper rendering of HTML code
(OFBIZ-10187)

By default we now use a permissive sanitizer policy

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1858980 13f79535-47bb-0310-9956-ffa450edef68
2019-05-09 09:17:08 +00:00
Jacques Le Roux 822356ef14 Fixed: Product content management screen doesn't validate trusted users' input
(OFBIZ-10054)

Steps to recreate:
1) go to (authenticate with admin/ofbiz):
https://localhost:8443/catalog/control/EditProductContent?productId=WG-1111

2) set the content of the field labeled "Large Image" to:
non_existent.foo" onerror="alert('Hi!');

3) visit the url:
https://localhost:8443/ecommerce/control/product?product_id=WG-1111

A popup message will appear with the "Hi!".

jleroux: This is fixed by preventing any js event to be passed 

Thanks: Loris Nardo for report, Jacopo and Gregory for discussion

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1858965 13f79535-47bb-0310-9956-ffa450edef68
2019-05-09 06:05:05 +00:00
Mathieu Lirzin e8a656785a Improved: Remove useless ‘UtilMisc#makeSetWritable’ method
(OFBIZ-11015)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1858951 13f79535-47bb-0310-9956-ffa450edef68
2019-05-08 21:42:27 +00:00
Mathieu Lirzin 247367871c Improved: Rewrite ‘CustomPermissivePolicy#matchesEither’ static method
(OFBIZ-10187)

It now uses a lambda expression instead of an anonymous class.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1858933 13f79535-47bb-0310-9956-ffa450edef68
2019-05-08 17:09:25 +00:00
Mathieu Lirzin 9a8b403bb3 Improved: Add missing ‘synchronized’ modifier
(OFBIZ-11004)

Overriding a synchronized method with a non-synchronized one can
introduce potential runtime concurrency bugs. Since
‘ExtendedProperties#loadFromXML’ is overridding
‘Properties#loadFromXML’ which is synchronized, it is safer to mark it
as synchonized.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1858490 13f79535-47bb-0310-9956-ffa450edef68
2019-05-01 14:36:26 +00:00
Mathieu Lirzin ad645133b2 Improved: Remove unneeded generics in ‘MapContextTest’
(OFBIZ-10933)

This is done to remove a warning in OpenJDK 8 which doesn't seem to
handle ‘@safevarargs’ annotation properly when using generics.  This
warning was not present with OpenJDK 11.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1858483 13f79535-47bb-0310-9956-ffa450edef68
2019-05-01 12:55:51 +00:00
Mathieu Lirzin 2d01c1e142 Improved: Do not use ‘java.util’ backported classes
(OFBIZ-11003)

Probably due to some IDE auto-importing mistake, some classes meant as
backports of the ‘java.util.Arrays’ and ‘java.util.Collections’
classes were imported.  This make no sense since we are requiring
Java 8 which already provides those.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1858480 13f79535-47bb-0310-9956-ffa450edef68
2019-05-01 12:34:20 +00:00
Michael Brohl 52254f4435 Fixed: OWASP sanitizer breaks proper rendering of HTML code
(OFBIZ-10187)

This makes the sanitizing enabled/disabled by configuration and enhances
the functionality to support custom sanitizer policies. A reasonable 
example policy class is also included.

Thanks Dennis Balkir for reporting and providing the patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1858352 13f79535-47bb-0310-9956-ffa450edef68
2019-04-29 09:24:13 +00:00
Mathieu Lirzin b37e315aef Improved: Use the ‘@Override’ annotation
(OFBIZ-10939)

The ‘@Override’ annotation helps readers understand that the method at
hand is overriding a super class or implementing an interface.
Additionally it allows the compiler to check if the methods annotated
with ‘@Override’ are actually implementing an abstract method.

Using that annotation makes ‘@see foo.bar.ParentClass#myMethod’
comments useless, so those they have been removed for the newly
annotated methods.

Thanks Jacques Le Roux and Swapnil M Mane for acknowledging the commit.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1858295 13f79535-47bb-0310-9956-ffa450edef68
2019-04-27 19:34:25 +00:00