sharanggupta opened a new issue, #2741:
URL: https://github.com/apache/activemq/issues/2741

   `MessageDatabase` parses its string-valued KahaDB settings with 
`Enum.valueOf(value.trim().toUpperCase())` and no `Locale`:
   
   - `preallocationScope` / `preallocationStrategy` (parsed in 
`createJournal()` during `start()`)
   - `setJournalDiskSyncStrategy(String)`
   - `setPurgeRecoveredXATransactionStrategy(String)`
   
   `String.toUpperCase()` follows the JVM default locale. On a JVM whose 
default locale is Turkish (`tr-TR`; `-Duser.language=tr -Duser.country=TR` 
reproduces it anywhere) an `i` upper-cases to a dotted `İ` (U+0130), so every 
documented lowercase value containing an `i` is rejected and the broker fails 
to start:
   
   ```
   <kahaDB journalDiskSyncStrategy="periodic" .../>   -> 
IllegalArgumentException: No enum constant 
...Journal.JournalDiskSyncStrategy.PERİODİC
   purgeRecoveredXATransactionStrategy="commit"       -> 
...PurgeRecoveredXATransactionStrategy.COMMİT
   preallocationScope="entire_journal_async"          -> 
...Journal.PreallocationScope.ENTİRE_JOURNAL_ASYNC
   preallocationStrategy="sparse_file"                -> 
...Journal.PreallocationStrategy.SPARSE_FİLE
   ```
   
   Reproduced against the released `activemq-kahadb-store` 6.3.2 (`always`, 
`never`, `none`, `zeros`, `rollback` work). The KahaDB reference page documents 
exactly these lowercase values (`journalDiskSyncStrategy = always | periodic | 
never`, `preallocationScope = entire_journal | entire_journal_async | none`, 
`preallocationStrategy = sparse_file | os_kernel_copy | zeros | 
chunked_zeros`). The code defaults are the enum names, so only a user who 
copies a documented value is affected.
   
   Same shape elsewhere in the code base:
   
   - `activemq-amqp` `AmqpContentTypeSupport.parseContentTypeForTextualCharset` 
lower-cases the type/subtype and upper-cases the `charset` parameter with the 
default locale, so under `tr-TR` AMQP text messages with `content-type: 
text/plain;charset=iso-8859-1` (also `us-ascii`, `windows-1252`) are rejected 
with `Illegal charset: İSO-8859-1`, and an upper-cased `TEXT/PLAIN` is no 
longer recognised as textual.
   - `activemq-jdbc-store` `MySqlJDBCAdapter.setStatements` compares 
`engineType.toUpperCase()` with `"INNODB"`, so `engineType="innodb"` turns the 
`LOCK TABLE` statement on under `tr-TR`.
   
   `IntrospectionSupport` already uses `Locale.ENGLISH` for the same reason 
(AMQ-2608).
   
   Fix: `toUpperCase(Locale.ENGLISH)` / `toLowerCase(Locale.ENGLISH)` at the 
six sites, plus regression tests that set a `tr-TR` default locale around 
`MessageDatabaseTest` (the four KahaDB setters, parsed through 
`createJournal()`) and `AmqpContentTypeSupportTest`. Affects 6.3.2 and `main`. 
I have the change ready and will open the PR against `main`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to