Commit Graph

2817 Commits

Author SHA1 Message Date
JCgH4164838Gh792C124B5 64bd12b26d Fix for access issue for 2.6 discovered in WW-5004 (Minor update to previous commit):
- Restored ability to access public static fields (true by default).
- Introduced a boolean configuration flag (allowStaticFieldAccess).
- Replaced one remaining Boolean.parseBoolean() conversion in OgnlUtil use BooleanUtils.toBoolean().
- Enhanced unit tests to confirm proper operation of the fix.
- Replicating L. Lenart's change in PR#317:
  - Removed injection parameter for setAllowStaticMethodAccess in OgnlValueStackFactory.
  - Replaced with lazy retrieval of allowStaticMethodAccess from container.
  - Used same pattern for the new allowStaticFieldAccess flag.
  - Added retrieval methods for both flags from the container.
- Optimized calling sequence of isAccessible() based on feedback from previous commit.
- Made a couple of getters and the protected checkXXX methods final (avoid descendant interference).
2019-01-30 18:31:51 -05:00
JCgH4164838Gh792C124B5 925eb62949 Fix for access issue for 2.6 discovered in WW-5004 (2nd amended commit):
- Restored ability to access public static fields (true by default).
- Introduced a boolean configuration flag (allowStaticFieldAccess).
- Replaced one remaining Boolean.parseBoolean() conversion in OgnlUtil use BooleanUtils.toBoolean().
- Enhanced unit tests to confirm proper operation of the fix.
- Replicating L. Lenart's change in PR#317:
  - Removed injection parameter for setAllowStaticMethodAccess in OgnlValueStackFactory.
  - Replaced with lazy retrieval of allowStaticMethodAccess from container.
  - Used same pattern for the new allowStaticFieldAccess flag.
  - Added retrieval methods for both flags from the container.
2019-01-30 13:00:45 -05:00
JCgH4164838Gh792C124B5 b743ae56ca Minor cleanup/consistency changes for 3 modules.
- Made a private ConcurrentMap reference final, made initial sets immutable (consistency).
- Made sets for Accepted and Excluded patterns checkers immutable in 2 modules (consistency).
- Added @Override annotations missing from a few methods in 2 modules.
- Updated the 3 relevant unit tests to verify immutable states of various sets.

(cherry picked from commit 881e1b2580)

# Conflicts:
#	core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
2019-01-24 14:47:45 +03:30
Lukasz Lenart fc81832e8a WW-5001 Adds support for struts-conversion.properties files 2019-01-15 08:14:12 +01:00
Lukasz Lenart aabed3e33f Merge pull request #311 from JCgH4164838Gh792C124B5/localS2_26x_B1
Equivalent to PR#309, but for the master (2.6.x) branch.
2019-01-10 08:52:20 +01:00
JCgH4164838Gh792C124B5 7a9d51f3b3 Equivalent to PR#309 for master (2.6.x) branch.
- Removed most of the logging added in PR#292.
- Left the added logging for the setExcludedPatterns and setAcceptedPatterns methods in their respective modules.
  L. Lenart's comment indicated their benefit outweighs overhead (not something that changes often).
  Made the if-else blocks consistent with preferred styling for the log blocks.
- Removed a dangling "/**" start comment tag with no proper close (and the whitespace between it and the next "/**")
  in the OgnlValueStack module.
2019-01-09 21:43:58 -05:00
Aleksandr Mashchenko b315b6e5fd WW-4998 I18nInterceptor's default storage should store locale 2019-01-09 22:33:21 +02:00
Aleksandr Mashchenko 094b6c5e3b Merge pull request #289 from lukaszlenart/WW-4972
[WW-4972] Switches incompatible_improvements to VERSION_2_3_28
2019-01-06 22:16:27 +02:00
Lukasz Lenart 0ecb482a11 WW-4972 Adds another test case to cover escaping 2019-01-03 12:50:55 +01:00
Lukasz Lenart a4bfb0d0f2 WW-4996 Fixes post rebase file name changes 2019-01-03 11:14:02 +01:00
Lukasz Lenart 19134516d8 WW-4996 Uses Struts* naming pattern instead of Default* 2019-01-03 10:21:27 +01:00
Lukasz Lenart c941326bf3 WW-4996 Reduces code duplication 2019-01-03 10:21:27 +01:00
Lukasz Lenart 6adfbed282 WW-4996 Renames and moves class to proper package to better expose its meaning 2019-01-03 10:21:27 +01:00
Lukasz Lenart 243a8c832b WW-4996 Refactors creator to use ObjectFactory#buildConverter method
Moves class to a proper package and renames it to better expose its
function as a default Struts implementation
2019-01-03 10:21:27 +01:00
Yasser Zamani fa90e01ba5 introduce integration tests with minimum needed changes (#301)
* introduce integration tests with minimum needed changes

* report coverage for integration tests as well

References:
https://stackoverflow.com/a/41364462
http://www.mojohaus.org/cobertura-maven-plugin/usage.html#reports

* switch to JaCoCo as test coverage library

Cobertura latest release is old, 2015, has issues with java and an old weird issue with integration tests [1].

[1] https://github.com/cobertura/cobertura/issues/230

* Use HtmlUnit instead of JWebUnit
2018-12-31 19:21:49 +03:30
Aleksandr Mashchenko 83a0927935 Merge pull request #298 from sepe81/fix-sonar-warnings-for-DefaultTypeConverter
Fix sonar warnings for DefaultTypeConverter
2018-12-31 13:12:34 +02:00
Lukasz Lenart 6f05603ab0 WW-4972 Adds two simple test cases to cover incompatible improvements 2018-12-30 18:12:27 +01:00
Lukasz Lenart 35497649ba WW-4972 Uses proper statement to escape JS related events 2018-12-30 17:50:25 +01:00
Lukasz Lenart a7524b04be WW-4938 Adds missing test case and properly fix injecting internal beans 2018-12-29 16:36:15 +01:00
Lukasz Lenart 3d20e80950 WW-4972 Uses built-in auto escaping instead of escaping each parameter 2018-12-23 17:44:12 +01:00
Sebastian Peters d09d3dcb3c Fix behaviour for convertValue with value null
I insinuate that the non primitive BigInteger and BigDecimal types
should also return default values for null input.

Rename the map to `baseTypeDefaults for better understanding and
remove the check for `isPrimitive` b/c this seemed to be kind of optimization
but breaked the check for included non-primitive types.

B/c the unit tests run successfully, we can use the existing default fields ZERO.
2018-12-21 23:42:16 +01:00
Sebastian Peters b58dc38c5c Add test for convertValue with BigInteger 2018-12-21 23:32:23 +01:00
Sebastian Peters ba493b46c5 Use parameterized Class<?> instead of raw type 2018-12-21 23:08:06 +01:00
Lukasz Lenart f9272f8590 WW-4938 Reverts dropping injecting internal beans in Spring Factory 2018-12-21 22:01:56 +01:00
Aleksandr Mashchenko ee759d273d Add generated tag html 2018-12-21 21:35:16 +02:00
JCgH4164838Gh792C124B5 cd434da6f0 WW-4995 Add trimBody attribute to set tag 2018-12-21 21:33:31 +02:00
JCgH4164838Gh792C124B5 95d4e8258d Updates and cleanup for some configuration-related items (2.6.x) (#292)
* Updates and cleanup for some configuration-related items.
- Made several attributes final.
- Added limiter logic to the setting of certain configuration elements, and increased logging around them.
- Updated unit tests impacted by the limiter logic, including minor typo fixes and locale consistency.
- Minor cleanup while making the changes.

* Updates and cleanup for some configuration-related items (1st revision).
- Reworked this PR, taking into account feedback and suggestions.
- Removed the if LOG.isxxxEnabled level checks that were added.
- Removed the limiter logic and instead reduced access level of most of the injectable methods to protected.
- Updated the previous unit test changes following removal of limiter logic.

* Minor correction to two debug log statements (as requested by reviewer).

* Update debug messages for pattern checkers, as requested by reviewers.
Avoids confusing users when replacing an empty exclusion set (which improves safety).
Still provides a (slightly milder) message when replacing an empty accepted set (which can reduce safety).
2018-12-20 19:28:21 +03:30
Sebastian Peters 3d120f59aa Add test for convertValue with BigDecimal 2018-12-19 21:47:39 +01:00
Sebastian Peters 59e174e34f Simplify nested else/if 2018-12-19 21:13:32 +01:00
Sebastian Peters e428d8d785 Add the "@Override" annotation 2018-12-18 21:53:04 +01:00
Sebastian Peters d99888da5e Fix warning: Use "BigDecimal.valueOf" instead
This method uses a string under the covers to eliminate floating point rounding errors.
2018-12-18 21:52:31 +01:00
Sebastian Peters cb492377bf Remove commented-out lines of code 2018-12-18 21:50:06 +01:00
Sebastian Peters 0bad296cd2 Remove the thrown NumberFormatException which is a runtime exception 2018-12-18 21:49:14 +01:00
Sebastian Peters 8260749422 Make MILLISECOND_FORMAT static final 2018-12-18 21:46:12 +01:00
Lukasz Lenart 699f5d6c79 [WW-4938] Uses container to create an instance of the class (#295)
* WW-4938 Uses container to create an instance of the class

* WW-4938 Adds a test to proof that @Inject works on constructor

* WW-4938 Adds missing header

* Update core/src/test/java/com/opensymphony/xwork2/mock/InjectableAction.java

Co-Authored-By: lukaszlenart <lukasz.lenart@gmail.com>

* Update core/src/test/java/com/opensymphony/xwork2/mock/DummyTextProvider.java

Co-Authored-By: lukaszlenart <lukasz.lenart@gmail.com>
2018-12-18 15:55:42 +03:30
Yasser Zamani 414719171a revert f48c962 partially to decrease waste output log size for travis 2018-12-14 18:26:36 +03:30
Yasser Zamani c3f3d3de19 Merge branch 'master' of https://github.com/apache/struts into WW-4972 2018-12-14 00:10:03 +03:30
Lukasz Lenart 072cb725f2 WW-4964 Drops duplicated import of utils.js
it should be already imported using <s:head/>
2018-12-12 20:13:21 +01:00
Lukasz Lenart 796c15ee67 WW-4972 Switches incompatible_improvements to VERSION_2_3_28 2018-12-12 08:57:24 +01:00
Lukasz Lenart 81ac9b2d47 Merge pull request #286 from aleksandr-m/feature/WW-4987_optgroup
WW-4987 Add list attributes to optgroup tag
2018-12-06 10:08:03 +01:00
Lukasz Lenart 749c131de9 Fixes ActionMapper javadocs and references 2018-12-06 09:04:00 +01:00
Aleksandr Mashchenko 48d40ae6ac Improve optgroup list attributes test 2018-12-05 21:56:30 +02:00
Aleksandr Mashchenko 60dfc4d141 Improve optgroup template 2018-12-05 21:51:08 +02:00
Aleksandr Mashchenko 123a0906ce Add listTitle to optgroup tag 2018-12-04 23:02:31 +02:00
Aleksandr Mashchenko 3c24bae87f Add listCssStyle to optgroup tag 2018-12-04 22:56:44 +02:00
Aleksandr Mashchenko 94210a02e7 WW-4987 Add test for listCssClass in optgroup tag 2018-12-04 22:26:26 +02:00
Aleksandr Mashchenko c0eafac042 WW-4987 Add listCssClass to optgroup tag 2018-12-04 22:25:15 +02:00
Sebastian Peters 67d0e71f3e Fix warning: Add a nested comment explaining why this method is empty 2018-11-27 21:28:47 +01:00
Sebastian Peters b853a99493 Fix warning: Add the "@Override" annotation above this method signature 2018-11-27 21:19:40 +01:00
Sebastian Peters 1da9612ed1 Fix warning: "container" hides the field declared at line 46 2018-11-27 21:17:47 +01:00