[
https://issues.apache.org/jira/browse/OPENJPA-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18106269#comment-18106269
]
ASF subversion and git services commented on OPENJPA-2978:
----------------------------------------------------------
Commit d5143a43156dd830c6f8226ba0f76f40f944e146 in openjpa's branch
refs/heads/OPENJPA-2978 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=d5143a431 ]
[OPENJPA-2978] Do not report unsupported schema validation as a validation
failure
SchemaManagerImpl.validate() caught every Exception and rewrapped it into a
SchemaValidationException. A store which does not implement schema validation
throws UnsupportedOperationException from AbstractBrokerFactory, so a missing
capability was reported to the caller as
SchemaValidationException("Schema could not be validated: null") - which per
the jakarta.persistence 3.2 javadoc asserts that a database object is missing
or has an unexpected definition, although nothing was ever inspected.
validate() now lets UnsupportedOperationException reach the caller unchanged,
the same way create(), drop() and truncate() already do, and keeps wrapping
every other failure (MetaDataException / IllegalStateException from the JDBC
path) in SchemaValidationException. The wrapped message falls back to the
exception class name when the exception carries no message, so it can never
read "...: null" again.
For consistency the four unsupported operations in AbstractBrokerFactory now
carry a message instead of being thrown bare, which improves the create, drop
and truncate paths as well.
Adds TestSchemaManagerImpl, covering the unsupported case for all four
operations, the wrapping of a real validation failure and the message
fallback.
> Typos, stray semicolon, and validate() masking unsupported
> ----------------------------------------------------------
>
> Key: OPENJPA-2978
> URL: https://issues.apache.org/jira/browse/OPENJPA-2978
> Project: OpenJPA
> Issue Type: Sub-task
> Components: jpa
> Affects Versions: 4.2.0
> Reporter: Maxim Solodovnik
> Priority: Major
> Fix For: 4.2.0
>
>
> Discussion thread:
> https://github.com/apache/openjpa/pull/144#discussion_r3683004763
> **(medium)** Nits before this freezes: the delegated `BrokerFactory` method
> names carry the `Strucuture`/`Struture` typos, `truncateData();;` has a
> double semicolon at line 64, and the `(Exception) ex` cast at line 58 is
> redundant. Also `validate()` wraps even UnsupportedOperationException from
> stores that do not implement validation into
> `SchemaValidationException("Schema could not be validated: null")`,
> misreporting a missing capability as a validation failure.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)