You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "kwin (via GitHub)" <gi...@apache.org> on 2025/04/08 18:33:22 UTC

[PR] SLING-12742 Don't swallow IOException during serialization [sling-org-apache-sling-jcr-resource]

kwin opened a new pull request, #44:
URL: https://github.com/apache/sling-org-apache-sling-jcr-resource/pull/44

   Improve exception messages when trying to put incompatible types into ModifiableValueMaps


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12742 Don't swallow IOException during serialization [sling-org-apache-sling-jcr-resource]

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #44:
URL: https://github.com/apache/sling-org-apache-sling-jcr-resource/pull/44#discussion_r2098455424


##########
src/main/java/org/apache/sling/jcr/resource/internal/helper/JcrPropertyMapCacheEntry.java:
##########
@@ -132,7 +132,7 @@ private static void failIfCannotStore(final @NotNull Object value, final @NotNul
                 final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
                 value = session.getValueFactory().createValue(session.getValueFactory().createBinary(bais));
             } catch (IOException ioe) {
-                // we ignore this here and return null
+                throw new RepositoryException("Cannot serialize object", ioe);

Review Comment:
   This is done in the the caller `JcrModificableValueMap.put(String, Object)` which puts a wrapping exception around this adding this info.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12742 Don't swallow IOException during serialization [sling-org-apache-sling-jcr-resource]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #44:
URL: https://github.com/apache/sling-org-apache-sling-jcr-resource/pull/44#issuecomment-2787354149

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-jcr-resource&pullRequest=44) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [2 New issues](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-resource&pullRequest=44&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-resource&pullRequest=44&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-resource&pullRequest=44&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-resource&pullRequest=44&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-resource&pullRequest=44&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-jcr-resource&pullRequest=44)
   
   


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12742 Don't swallow IOException during serialization [sling-org-apache-sling-jcr-resource]

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin merged PR #44:
URL: https://github.com/apache/sling-org-apache-sling-jcr-resource/pull/44


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12742 Don't swallow IOException during serialization [sling-org-apache-sling-jcr-resource]

Posted by "joerghoh (via GitHub)" <gi...@apache.org>.
joerghoh commented on code in PR #44:
URL: https://github.com/apache/sling-org-apache-sling-jcr-resource/pull/44#discussion_r2066349836


##########
src/main/java/org/apache/sling/jcr/resource/internal/helper/JcrPropertyMapCacheEntry.java:
##########
@@ -132,7 +132,7 @@ private static void failIfCannotStore(final @NotNull Object value, final @NotNul
                 final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
                 value = session.getValueFactory().createValue(session.getValueFactory().createBinary(bais));
             } catch (IOException ioe) {
-                // we ignore this here and return null
+                throw new RepositoryException("Cannot serialize object", ioe);

Review Comment:
   It would make sense to also log the node path and the type of the object in this exception, as it can help to further debug the issue in more detail.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org