You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Carsten Ziegeler (Jira)" <ji...@apache.org> on 2025/05/21 05:41:00 UTC

[jira] [Commented] (SLING-12742) Don't swallow java.io.NotSerializableException in JcrPropertyMapCacheEntry.createValue()

    [ https://issues.apache.org/jira/browse/SLING-12742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17953047#comment-17953047 ] 

Carsten Ziegeler commented on SLING-12742:
------------------------------------------

[~kwin] Isn't this a breaking change? Code that was working before now throws an exception?

> Don't swallow java.io.NotSerializableException in JcrPropertyMapCacheEntry.createValue()
> ----------------------------------------------------------------------------------------
>
>                 Key: SLING-12742
>                 URL: https://issues.apache.org/jira/browse/SLING-12742
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 3.3.2
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>            Priority: Major
>             Fix For: JCR Resource 3.3.4
>
>
> Currently a log like this is exposed in case a class cannot be serialized (despite having the marker interface Serializable) when an object of that type is put into a {{ModifiableValueMap}}:
> {code}
> Caused by: java.lang.IllegalArgumentException: Value can't be stored in the repository: <my object>
> 	at org.apache.sling.jcr.resource.internal.helper.JcrPropertyMapCacheEntry.failIfCannotStore(JcrPropertyMapCacheEntry.java:109) [org.apache.sling.jcr.resource:3.3.2]
> 	at org.apache.sling.jcr.resource.internal.helper.JcrPropertyMapCacheEntry.<init>(JcrPropertyMapCacheEntry.java:97) [org.apache.sling.jcr.resource:3.3.2]
> 	at org.apache.sling.jcr.resource.internal.JcrModifiableValueMap.put(JcrModifiableValueMap.java:63) [org.apache.sling.jcr.resource:3.3.2]
> {code}
> The underlying exception was a 
> {code}
> java.io.NotSerializableException: java.util.Optional
> {code}
> which was swallowed in https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/7d980aa423bf32b639bea5c767d1fe6ec66773b7/src/main/java/org/apache/sling/jcr/resource/internal/helper/JcrPropertyMapCacheEntry.java#L135



--
This message was sent by Atlassian Jira
(v8.20.10#820010)