Commit Graph

8064 Commits

Author SHA1 Message Date
Gary Gregory 61580f2c01
Fix handling of non-ASCII letters & numbers in RandomStringUtils #1273 2024-09-10 20:49:42 -04:00
Fabrice Benhamouda fd866a9c2d
Fix handling of non-ASCII letters & numbers in RandomStringUtils (#1273)
An optimization introduced in commit
f382d61a03
incorrectly assumed that letters and numbers/digits are ASCII.

For example, `RandomStringUtils.random(1, 0x4e00, 0x4e01, true, false)`
would take too long to terminate and would not output the correct
answer, that is the string with a single character `0x4e00`.
The issue is that `end` would be replaced by `'z' + 1 = 123` (the latest
ASCII letter + 1) there: f382d61a03/src/main/java/org/apache/commons/lang3/RandomStringUtils.java (L266-L270)
 Thus, we would have `end < start` and `gap = end - start < 0`.

This PR fixes this issue by restricting the optimization to cases
where only ASCII characters are requested, that is `end < 0x7f`.
This PR also slightly clarifies the code, using constant variables
instead of '0', '9', 'A', and 'z'.

The PR also includes two regression tests.

Co-authored-by: Fabrice Benhamouda <yfabrice@amazon.com>
2024-09-10 20:47:24 -04:00
dependabot[bot] d1bf9bfe74
Bump actions/upload-artifact from 4.3.6 to 4.4.0 (#1272)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.6 to 4.4.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](834a144ee9...50769540e7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-06 09:08:35 -07:00
Gary Gregory 03aba1634d Speed up and sanitize StopWatchTest 2024-09-04 13:36:36 -04:00
Gary Gregory d0fd31f505 Be lenient for slow running builds 2024-09-04 13:16:00 -04:00
Gary Gregory 43d225464e Faster StopWatchTest.testSuspend()
- Replace Matcher calls with sane assertTrue()
- Use variable names in assertion messages to match the source
2024-09-04 12:37:08 -04:00
Gary Gregory edddaeb054 Faster StopWatchTest 2024-09-04 11:59:00 -04:00
Gary Gregory ba4c2cf737 Faster StopWatchTest.testSimple()
and simpler
2024-09-04 11:45:29 -04:00
Gary Gregory 66d19b140e Faster StopWatchTest.testSimple()
and simpler
2024-09-04 11:44:41 -04:00
Gary Gregory b23c2d3836 Faster StopWatchTest
- testFormatSplitTime()
- testFormatSplitTimeWithMessage()
2024-09-04 11:35:56 -04:00
Gary Gregory b657ed8389 Remove unused constant 2024-09-04 11:34:58 -04:00
Gary Gregory 9ba733b3a4 Comment 2024-09-04 11:34:24 -04:00
Gary Gregory a905cc5343 Faster StopWatchTest.testStopTimeSimple()
- Replace Matcher calls with sane assertTrue()
2024-09-04 11:33:58 -04:00
Gary Gregory b4e4c40af1 Faster StopWatchTest.testStopInstantSimple()
- Replace Matcher calls with sane assertTrue()
2024-09-04 11:32:53 -04:00
Gary Gregory 695986b2b9 Faster StopWatchTest.testLang315() 2024-09-04 11:28:14 -04:00
Gary Gregory 6dd2addd4b Faster StopWatchTest
- These string formatting tests do not need to wait 500 millis each
- Refactor magic number into a constant
2024-09-04 11:24:57 -04:00
Gary Gregory 386c17ff61 Faster StopWatchTest.testToSplitString()
This test does not need to wait 500 millis
2024-09-04 11:21:10 -04:00
Gary Gregory 4f04d06a6b Faster StopWatchTest.testGetTime() 2024-09-04 11:19:29 -04:00
Gary Gregory 9903591670 Format long constant for readability 2024-09-04 11:04:04 -04:00
Gary Gregory 45f2ceaf3c Refactor constant 2024-09-04 11:00:48 -04:00
Gary Gregory 95d15cdebd No need for formatter comments here 2024-09-04 10:59:31 -04:00
Gary Gregory 21f0069882 StopWatchTest.testGetDuration() now runs in 2 milliseconds instead of
550.
2024-09-04 10:58:20 -04:00
Gary Gregory 586358fb0e Javadoc 2024-09-04 10:05:19 -04:00
Gary Gregory 6d29fd4d14 Sentence starts with a capital 2024-09-04 10:01:04 -04:00
Gary Gregory a9bb7e90fa Use Assertions.assertInstanceOf() 2024-09-01 19:02:47 -04:00
dependabot[bot] 9cac8b5b98
Bump github/codeql-action from 3.26.4 to 3.26.6 (#1268)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.4 to 3.26.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](f0f3afee80...4dd16135b6)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-30 12:32:39 -04:00
Gary Gregory ba51fe3a03 Pick up exec-maven-plugin version from parent POM 2024-08-30 08:47:19 -04:00
Gary Gregory 97a96ba08b Fix action types in changes.xml 2024-08-30 08:42:14 -04:00
Gary Gregory 3769c18aaa Fix flaky FileUtilsWaitForTest.testWaitForNegativeDuration() 2024-08-30 08:41:43 -04:00
Gary Gregory 1091e835de
Bump org.apache.commons:commons-parent from 73 to 74 #1267 2024-08-29 15:52:49 -04:00
dependabot[bot] 404a75316b
Bump org.apache.commons:commons-parent from 73 to 74 (#1267)
Bumps [org.apache.commons:commons-parent](https://github.com/apache/commons-parent) from 73 to 74.
- [Changelog](https://github.com/apache/commons-parent/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-parent/commits)

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-parent
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-29 15:51:58 -04:00
Gary Gregory 58d459764a Add section for the next release 2024-08-29 19:41:34 +00:00
Gary Gregory f3b1b1f121 Bump to next development version 2024-08-29 19:40:20 +00:00
Gary Gregory 29ccc7665f Prepare for the next release candidate 2024-08-24 18:59:45 +00:00
Gary Gregory b64f71df6d Prepare for the next release candidate 2024-08-24 18:39:56 +00:00
Gary Gregory d2eff05cd0 Remove unused exception from deprecated StringUtils.toString(byte[],
String)
2024-08-24 14:38:25 -04:00
Gary Gregory 3be74c40e0 Sort imports 2024-08-24 14:30:17 -04:00
Gary Gregory f3b9aca3ac Sort members 2024-08-24 14:29:25 -04:00
dependabot[bot] 968d033c4f
Bump github/codeql-action from 3.26.2 to 3.26.4 (#1266)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.2 to 3.26.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](429e197704...f0f3afee80)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-23 12:16:33 -04:00
Gary Gregory 5d3c269193 Javadoc 2024-08-22 15:50:24 -04:00
Gary Gregory c4164c4e16 Better test parameter name 2024-08-21 17:23:59 -04:00
Gary Gregory f19304299f Add TimeZonesTest 2024-08-21 14:02:06 -04:00
Gary Gregory bfa3c06361 Add CalendarUtils.toOffsetDateTime(Calendar)
Add CalendarUtils.toOffsetDateTime()
2024-08-21 13:40:51 -04:00
Gary Gregory 666ad13656 Add CalendarUtils.toZonedDateTime(Calendar)
Add CalendarUtils.toZonedDateTime()
2024-08-21 12:16:50 -04:00
Gary Gregory 328f2aedfb Add CalendarUtils.toLocalDateTime(Calendar)
Add CalendarUtils.toLocalDateTime()
2024-08-21 11:38:20 -04:00
Gary Gregory df4be6cd6e Fix typos in comments 2024-08-21 09:17:10 -04:00
Gary Gregory b7a2586a31 Add test from PR ##437
- By dimitrovchi Dmitry Ovchinnikov
- https://github.com/apache/commons-lang/pull/437
2024-08-20 12:33:05 -04:00
Gary Gregory dcba60a569 Javadoc 2024-08-20 10:38:39 -04:00
Gary Gregory ee2041464e Let existing catch clause handle the NPE edge case
Add tests
2024-08-20 10:38:33 -04:00
Gary Gregory 250addd743 Add test 2024-08-20 08:41:06 -04:00