[jira] [Resolved] (SLING-4375) Expose distribution agent status
[ https://issues.apache.org/jira/browse/SLING-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Marius Petria resolved SLING-4375. -- Resolution: Fixed Fix Version/s: Content Distribution 0.1.0 Assignee: Marius Petria Committed revision 1656026. Expose distribution agent status Key: SLING-4375 URL: https://issues.apache.org/jira/browse/SLING-4375 Project: Sling Issue Type: Improvement Components: Distribution Reporter: Marius Petria Assignee: Marius Petria Fix For: Content Distribution 0.1.0 An agent can be paused, idle, running or blocked according to the state of the underlying queues. We should have an easy way to retrieve that state over http. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
Jenkins build is still unstable: sling-trunk-1.6 #3005
See https://builds.apache.org/job/sling-trunk-1.6/changes
Jenkins build is still unstable: sling-trunk-1.7 #1395
See https://builds.apache.org/job/sling-trunk-1.7/changes
[jira] [Created] (SLING-4376) ResourceResolver-mock throws NullPointerException in resolve when absPath = null
Steven Walters created SLING-4376: - Summary: ResourceResolver-mock throws NullPointerException in resolve when absPath = null Key: SLING-4376 URL: https://issues.apache.org/jira/browse/SLING-4376 Project: Sling Issue Type: Bug Components: Testing Affects Versions: Testing ResourceResolver Mock 1.1.2 Reporter: Steven Walters According to the ResolverResolver API for the resolve function: {quote} absPath The absolute path to be resolved to a resource. If this *parameter is codenull/code, it is assumed to address the *root of the resource tree. If the path is relative it is *assumed relative to the root, that is a slash is prepended to *the path before resolving it. {quote} However, in the MockResourceResolver, this scenario is not actually handled and instead throws a {{NullPointerException}} when attempting to look for indexes of the characters {{?}} or {{#}} in the path string -- This message was sent by Atlassian JIRA (v6.3.4#6332)
Jenkins build is still unstable: sling-trunk-1.8 #685
See https://builds.apache.org/job/sling-trunk-1.8/changes
Re: [RT] Ideas for a multi-tenant and multi-module content model
Hi, thanks for sharing this. The approach sounds reasonable, but it would probably help to have a more concrete example for the content structure including the resource type mappings. Will /tenant/T/home only contain groups used define tenant membership? Or will it also contain the actual users? There can be scenarios where a user could have access to multiple tenants while in other scenarios this may not be desirable. Regards Alex On Thu, Jan 29, 2015 at 4:11 PM, Dominik Süß dominik.su...@gmail.com wrote: Hi Bertrand, ok the way how you describe it you'd actually do something above the existing ResourceResolution. I'm not really sure if we win so much with that - a lock in of the resourceType might be absolutely sufficient and wouldn't add further complexity to understand resolution mechanisms. So we would have something that would define a) Tenant /content/xyz would be bound to assembly_a (for now skipping the question of versioned lookup that could be searchpath sepecific or another mechansism) b) this binding would force the resourceResolver to resolve resources underneath /content/xyz only if they are located underneath searchpath/assembly_a c) the apps folder of assembly_a would contain the rendering resources or have the assembly specific servlets mapped to. Every servlet or script used within the assembly app would have a representation there which could as minimum just have a resourceSuperType that points to the modules resourceType and therefore expose the plain feature. Assembly specific overlays can be applied to these mapping nodes at any time without impact on third assemblies (unless we allow chained assemblies) The beauty of that would be that it just requires addition of mapping logic and the constraints in the resourceResolver but no further addition. Sidenote: - I'm leaving out details like static inclussions with predefined resourceTypes within scripts the assembly where we would have to clarify if those are ok or if we completely abandon mapping beyond superType resolution to enforce a unique way of declaring mapped Types within an assembly. Cheers Dominik On Thu, Jan 29, 2015 at 3:03 PM, Bertrand Delacretaz bdelacre...@apache.org wrote: Hi Dominik, On Thu, Jan 29, 2015 at 2:52 PM, Dominik Süß dominik.su...@gmail.com wrote: ...I had a chance to look at that model yesterday and absolutely think this is a great way since it is not too far away from what we have right now... Yeah, we might even be able to run an existing Sling instance with /libs and /apps as a legacy tenant on this new model by moving the existing content around a bit, to provide a smooth transition. ...The detail about the constraint to just use an assembly would therefore be a constraint on the resourceType Path that would be evaluated by the resourceResolver and ignores resourceType not being part of the assembly I was thinking a bit differently, resource types just need to start with the module path like blog/post for the blog module. Then, the script resolver only considers /assemblies/T where T is the tenant ID, looks for a script or servlet reference resolution for blog/post under there, and remaps that to the actual module script based on which modules the assembly points to. All this needs to be proved by some working code if we want to seriously kick the tires of this new model. -Bertrand -- Alexander Saar Mobile: +49.172.8280280 E-Mail: alexander.s...@gmail.com
[discussion] [contrib] Hypermedia API tools (with Sightly)
Hi, This is the first thread I initiate on sling dev, so I apologize in advance if I'm breaking any conventions. I've written a bundle that allows sling component developers to quickly define a hypermedia API for components. The tools contain a Sightly Use class for Sightly components, but also a generic utility that can be used anywhere, like in a jsp component. It uses hypermedia to drive the state of the application (e.g a consumer uses links and forms to change the state) and uses microdata [0] to define an easy to parse structure. The API can then be consumed by bots or used in testing, while using the same HTML as the media type for the API as the browser. You can find the bundle here [1] if you'd like to have a look. The readme has some examples and you can quickly try it out with a generic python client [2]. What do you think about putting this in the contrib/ dir in sling and about the idea in general? Looking forward to some responses. - Andrei Dulvac --- [0] http://www.w3.org/TR/microdata/ [1] https://github.com/dulvac/hapi [2] https://github.com/dulvac/hapi#consuming-the-api
Jenkins build is still unstable: sling-trunk-1.6 #3006
See https://builds.apache.org/job/sling-trunk-1.6/changes
Jenkins build is still unstable: sling-trunk-1.7 #1396
See https://builds.apache.org/job/sling-trunk-1.7/changes
Jenkins build is still unstable: sling-trunk-1.8 #686
See https://builds.apache.org/job/sling-trunk-1.8/changes
[jira] [Created] (SLING-4374) Intermittent error when publishing content
Robert Munteanu created SLING-4374: -- Summary: Intermittent error when publishing content Key: SLING-4374 URL: https://issues.apache.org/jira/browse/SLING-4374 Project: Sling Issue Type: Bug Components: IDE Affects Versions: Sling Eclipse IDE 1.0.4 Reporter: Robert Munteanu Fix For: Sling Eclipse IDE 1.0.6 What steps will reproduce the problem? 1. Connect to the server 2. Reconnect in debug mode 3. Try to publish again That's what I did, not sure if it always happens in this scenario. -- Error Details -- Date: Fri Jan 30 16:17:06 EET 2015 Message: Could not publish to the server. Severity: Error Product: Eclipse 4.4.1.20150109-0740 (org.eclipse.epp.package.java.product) Plugin: org.eclipse.wst.server.core Exception Stack Trace: java.lang.NullPointerException at org.apache.sling.ide.eclipse.core.internal.ResourceChangeCommandFactory.addFileCommand(ResourceChangeCommandFactory.java:99) at org.apache.sling.ide.eclipse.core.internal.ResourceChangeCommandFactory.newCommandForAddedOrUpdated(ResourceChangeCommandFactory.java:80) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.addFileCommand(SlingLaunchpadBehaviour.java:537) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.publishContentModule(SlingLaunchpadBehaviour.java:411) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.publishModule(SlingLaunchpadBehaviour.java:225) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:1091) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:1183) at org.apache.sling.ide.eclipse.core.internal.ServerBehaviourDelegateWithModulePublishSupport.publish(ServerBehaviourDelegateWithModulePublishSupport.java:137) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774) at org.apache.sling.ide.eclipse.core.internal.ServerBehaviourDelegateWithModulePublishSupport.publish(ServerBehaviourDelegateWithModulePublishSupport.java:54) at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3157) at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (SLING-4375) Expose distribution agent status
Marius Petria created SLING-4375: Summary: Expose distribution agent status Key: SLING-4375 URL: https://issues.apache.org/jira/browse/SLING-4375 Project: Sling Issue Type: Improvement Components: Distribution Reporter: Marius Petria An agent can be paused, idle, running or blocked according to the state of the underlying queues. We should have an easy way to retrieve that state over http. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Assigned] (SLING-4374) Intermittent error when publishing content
[ https://issues.apache.org/jira/browse/SLING-4374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Robert Munteanu reassigned SLING-4374: -- Assignee: Robert Munteanu Intermittent error when publishing content -- Key: SLING-4374 URL: https://issues.apache.org/jira/browse/SLING-4374 Project: Sling Issue Type: Bug Components: IDE Affects Versions: Sling Eclipse IDE 1.0.4 Reporter: Robert Munteanu Assignee: Robert Munteanu Fix For: Sling Eclipse IDE 1.0.6 What steps will reproduce the problem? 1. Connect to the server 2. Reconnect in debug mode 3. Try to publish again That's what I did, not sure if it always happens in this scenario. -- Error Details -- Date: Fri Jan 30 16:17:06 EET 2015 Message: Could not publish to the server. Severity: Error Product: Eclipse 4.4.1.20150109-0740 (org.eclipse.epp.package.java.product) Plugin: org.eclipse.wst.server.core Exception Stack Trace: java.lang.NullPointerException at org.apache.sling.ide.eclipse.core.internal.ResourceChangeCommandFactory.addFileCommand(ResourceChangeCommandFactory.java:99) at org.apache.sling.ide.eclipse.core.internal.ResourceChangeCommandFactory.newCommandForAddedOrUpdated(ResourceChangeCommandFactory.java:80) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.addFileCommand(SlingLaunchpadBehaviour.java:537) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.publishContentModule(SlingLaunchpadBehaviour.java:411) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.publishModule(SlingLaunchpadBehaviour.java:225) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:1091) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:1183) at org.apache.sling.ide.eclipse.core.internal.ServerBehaviourDelegateWithModulePublishSupport.publish(ServerBehaviourDelegateWithModulePublishSupport.java:137) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774) at org.apache.sling.ide.eclipse.core.internal.ServerBehaviourDelegateWithModulePublishSupport.publish(ServerBehaviourDelegateWithModulePublishSupport.java:54) at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3157) at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (SLING-4372) The use of finalize in ResourceResolver leads to performance issues
[ https://issues.apache.org/jira/browse/SLING-4372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14298425#comment-14298425 ] Konrad Windszus commented on SLING-4372: [~fmeschbe] Thanks for supporting this. May I ask you to push a littlebit that the patch is also applied to Jackrabbit (in JCR-2768). To be honest I was a little bit disappointed that nothing happened there (not even a comment) almost one year after the patch has been provided in JCR-2768. Once the patch is there in Jackrabbit I consider adding one to Sling as well :-) The use of finalize in ResourceResolver leads to performance issues --- Key: SLING-4372 URL: https://issues.apache.org/jira/browse/SLING-4372 Project: Sling Issue Type: Improvement Affects Versions: Resource Resolver 1.1.12 Reporter: Konrad Windszus Currently there is a finalizer implemented for the ResourceResolverImpl (http://svn.apache.org/repos/asf/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java). This defers garbage collection. For a more detailed analysis and also some metrics around that have a look at https://issues.apache.org/jira/browse/JCR-2768. A similar approach like in the patch attached to JCR-2768 should be implemented for the ResourceResolverImpl. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (SLING-4372) The use of finalize in ResourceResolver leads to performance issues
[ https://issues.apache.org/jira/browse/SLING-4372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14298407#comment-14298407 ] Felix Meschberger commented on SLING-4372: -- I like this idea and would welcome a patch. Background: When creating the {{finalize()}} we were aware of the problems and we only created it after carefull consideration and weighing and considered the drawbacks you mentioned less problematic than not having closed ResourceResolvers lingering around. The use of finalize in ResourceResolver leads to performance issues --- Key: SLING-4372 URL: https://issues.apache.org/jira/browse/SLING-4372 Project: Sling Issue Type: Improvement Affects Versions: Resource Resolver 1.1.12 Reporter: Konrad Windszus Currently there is a finalizer implemented for the ResourceResolverImpl (http://svn.apache.org/repos/asf/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java). This defers garbage collection. For a more detailed analysis and also some metrics around that have a look at https://issues.apache.org/jira/browse/JCR-2768. A similar approach like in the patch attached to JCR-2768 should be implemented for the ResourceResolverImpl. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Assigned] (SLING-3854) Add configuration option to restrict service user mapper to system users
[ https://issues.apache.org/jira/browse/SLING-3854?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Antonio Sanso reassigned SLING-3854: Assignee: Antonio Sanso Add configuration option to restrict service user mapper to system users Key: SLING-3854 URL: https://issues.apache.org/jira/browse/SLING-3854 Project: Sling Issue Type: Improvement Components: Service User Mapper Reporter: angela Assignee: Antonio Sanso Attachments: SLING-3854.patch JCR-3802 introduces the concept of system users that distinct from regular user accounts and never have a password set. the API extensions include to following ability to discover if a given User is actually a system user: {{User.isSystemUser}}. It would be good if the service user mapping had a configuration option that would restrict the mapping to dedicated service users i.e. to users which are defined to be system users in case sling is running on a JCR repository that implements jackrabbit API. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (SLING-3859) ResourceResolver from JcrItemAdapterFactory is not closed
[ https://issues.apache.org/jira/browse/SLING-3859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14298385#comment-14298385 ] Konrad Windszus commented on SLING-3859: The problem is basically that finalize defers the garbage collection. I opened SLING-4372 about that which also has some hints about an alternative approach with phantom references. ResourceResolver from JcrItemAdapterFactory is not closed - Key: SLING-3859 URL: https://issues.apache.org/jira/browse/SLING-3859 Project: Sling Issue Type: Bug Components: JCR Affects Versions: JCR Resource 2.3.6 Reporter: Carsten Ziegeler Fix For: JCR Resource 2.4.2 Whenever a node or property is adapted to something a new resource resolver is created with the same user session as the node is from. However, this resolver is never closed and therefore is a potential memory leak -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (SLING-4372) The use of finalize in ResourceResolver leads to performance issues
Konrad Windszus created SLING-4372: -- Summary: The use of finalize in ResourceResolver leads to performance issues Key: SLING-4372 URL: https://issues.apache.org/jira/browse/SLING-4372 Project: Sling Issue Type: Improvement Affects Versions: Resource Resolver 1.1.12 Reporter: Konrad Windszus Currently there is a finalizer implemented for the ResourceResolverImpl (http://svn.apache.org/repos/asf/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java). This defers garbage collection. For a more detailed analysis and also some metrics around that have a look at https://issues.apache.org/jira/browse/JCR-2768. A similar approach like in the patch attached to JCR-2768 should be implemented for the ResourceResolverImpl. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
Jenkins build is still unstable: sling-trunk-1.7 #1394
See https://builds.apache.org/job/sling-trunk-1.7/changes
Re: JSR305
The question for me is whether we should rely on the dormant standard (which did never release anything officially) 305, because that is not supported by Eclipse or whether we should use something else? Any ideas, opinions on that? What is your experience with the JSR305 javax.annotation support in major IDEs (see also http://stackoverflow.com/questions/4963300/which-notnull-java-annotation-should-i-use http://stackoverflow.com/questions/4963300/which-notnull-java-annotation-should-i-use)? Konrad On 30 Jan 2015, at 13:37, Robert Munteanu romb...@apache.org wrote: On Fri, Jan 30, 2015 at 2:15 PM, Konrad Windszus konra...@gmx.de wrote: What about adding annotations like https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java to the Sling API? +1 I wonder if there is a static analyser which can fail the build when violations are found, e.g. immediately dereferencing the result of a method which is @Nullable. Robert
Re: JSR305
On Fri, Jan 30, 2015 at 2:55 PM, Konrad Windszus konra...@gmx.de wrote: The question for me is whether we should rely on the dormant standard (which did never release anything officially) 305, because that is not supported by Eclipse or whether we should use something else? Any ideas, opinions on that? What is your experience with the JSR305 javax.annotation support in major IDEs (see also http://stackoverflow.com/questions/4963300/which-notnull-java-annotation-should-i-use http://stackoverflow.com/questions/4963300/which-notnull-java-annotation-should-i-use)? AFAIR for Eclipse you can configure the annotation types to use ( see [1] ) . But of course we'd need to validate this before starting conversions. Robert [1]: http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-using_null_annotations.htm Konrad On 30 Jan 2015, at 13:37, Robert Munteanu romb...@apache.org wrote: On Fri, Jan 30, 2015 at 2:15 PM, Konrad Windszus konra...@gmx.de wrote: What about adding annotations like https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java to the Sling API? +1 I wonder if there is a static analyser which can fail the build when violations are found, e.g. immediately dereferencing the result of a method which is @Nullable. Robert -- Sent from my (old) computer
[jira] [Commented] (SLING-4294) Servlet Filter Support adding sling.filter.pattern support
[ https://issues.apache.org/jira/browse/SLING-4294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14298495#comment-14298495 ] Antonio Sanso commented on SLING-4294: -- added proposed patch with suggested changes in rev. 1655980 . I will add also some integration tests Servlet Filter Support adding sling.filter.pattern support -- Key: SLING-4294 URL: https://issues.apache.org/jira/browse/SLING-4294 Project: Sling Issue Type: Improvement Components: Engine Reporter: Antonio Sanso Assignee: Antonio Sanso Attachments: SLING-4294-patch.txt the current Sling Servlet Filter Support [0] allows to have scope dependent filter (e.g. REQUEST, INCLUDE, FORWARD, ERROR, COMPONENT). It would be nice to extend this support to have a specific filter being taken in consideration only for specific path (adding sling.filter.pattern) a bit like what currently can be done for Apache Felix filters. mailing list discussion in [1] [0] http://sling.apache.org/documentation/the-sling-engine/filters.html [1] http://markmail.org/message/lzp7qcienk3blwpk -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Resolved] (SLING-4373) Calling ModelFactory.createModel with a null parameter for the adaptable leads to an InvalidAdaptableException
[ https://issues.apache.org/jira/browse/SLING-4373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Konrad Windszus resolved SLING-4373. Resolution: Fixed Calling ModelFactory.createModel with a null parameter for the adaptable leads to an InvalidAdaptableException -- Key: SLING-4373 URL: https://issues.apache.org/jira/browse/SLING-4373 Project: Sling Issue Type: Improvement Affects Versions: Sling Models Impl 1.2.0 Reporter: Konrad Windszus Assignee: Konrad Windszus Fix For: Sling Models Impl 1.2.0 This is confusing. Instead an IllegalArgumentException should be thrown in case either of both parameters are null. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
Jenkins build is still unstable: sling-trunk-1.6 #3004
See https://builds.apache.org/job/sling-trunk-1.6/changes
Re: JSR305
+1 from my side. These annotations are useful and shouldn't cause any problems. Regards Julian On Friday, January 30, 2015, Konrad Windszus konra...@gmx.de wrote: Hi, the Sling API sometimes forces the developer to check for null results e.g. SlingAdaptable.adaptTo and ResourceResolver.getResource. This is very often forgotten by users of that API. I would really appreciate if we would start annotating the Sling API with JSR305 annotations (https://jcp.org/en/jsr/detail?id=305 https://jcp.org/en/jsr/detail?id=305). Although the JSR is dormant since 2012 ( http://stackoverflow.com/questions/2289694/what-is-the-status-of-jsr-305 http://stackoverflow.com/questions/2289694/what-is-the-status-of-jsr-305) it is supported by FindBugs ( http://findbugs.sourceforge.net/findbugs2.html http://findbugs.sourceforge.net/findbugs2.html) and the annotations are used also in Apache Oak (https://issues.apache.org/jira/browse/OAK-2303 https://issues.apache.org/jira/browse/OAK-2303). I don’t know of a better approach for supporting tools to check for those violations. What about adding annotations like https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java to the Sling API? Thanks for your input, Konrad
[jira] [Updated] (SLING-4373) Calling ModelFactory.createModel with a null parameter for the adaptable leads to a InvalidAdaptableException
[ https://issues.apache.org/jira/browse/SLING-4373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Konrad Windszus updated SLING-4373: --- Summary: Calling ModelFactory.createModel with a null parameter for the adaptable leads to a InvalidAdaptableException (was: Calling createModel with a null parameter for the adaptable leads to a InvalidAdaptableException) Calling ModelFactory.createModel with a null parameter for the adaptable leads to a InvalidAdaptableException - Key: SLING-4373 URL: https://issues.apache.org/jira/browse/SLING-4373 Project: Sling Issue Type: Improvement Affects Versions: Sling Models Impl 1.2.0 Reporter: Konrad Windszus Assignee: Konrad Windszus Fix For: Sling Models Impl 1.2.0 This is confusing. Instead an IllegalArgumentException should be thrown in case either of both parameters are null. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
Re: JSR305
I am +1 on that, I think that, among its usage in analysis tools like FindBugs, it helps very much in code readability, also major IDEs support that and it's therefore easier not to mess up with e.g. some API having not to return null and the likes. My 2 cents, Tommaso 2015-01-30 13:15 GMT+01:00 Konrad Windszus konra...@gmx.de: Hi, the Sling API sometimes forces the developer to check for null results e.g. SlingAdaptable.adaptTo and ResourceResolver.getResource. This is very often forgotten by users of that API. I would really appreciate if we would start annotating the Sling API with JSR305 annotations (https://jcp.org/en/jsr/detail?id=305 https://jcp.org/en/jsr/detail?id=305). Although the JSR is dormant since 2012 ( http://stackoverflow.com/questions/2289694/what-is-the-status-of-jsr-305 http://stackoverflow.com/questions/2289694/what-is-the-status-of-jsr-305) it is supported by FindBugs ( http://findbugs.sourceforge.net/findbugs2.html http://findbugs.sourceforge.net/findbugs2.html) and the annotations are used also in Apache Oak (https://issues.apache.org/jira/browse/OAK-2303 https://issues.apache.org/jira/browse/OAK-2303). I don’t know of a better approach for supporting tools to check for those violations. What about adding annotations like https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java to the Sling API? Thanks for your input, Konrad
Re: JSR305
On Fri, Jan 30, 2015 at 2:15 PM, Konrad Windszus konra...@gmx.de wrote: What about adding annotations like https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java to the Sling API? +1 I wonder if there is a static analyser which can fail the build when violations are found, e.g. immediately dereferencing the result of a method which is @Nullable. Robert