[jira] [Commented] (TAP5-1510) The @Advise annotation limits advice to just a specific interface type
[ https://issues.apache.org/jira/browse/TAP5-1510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041020#comment-13041020 ] Hudson commented on TAP5-1510: -- Integrated in tapestry-trunk-freestyle #352 (See [https://builds.apache.org/hudson/job/tapestry-trunk-freestyle/352/]) TAP5-1510: The @Advise annotation limits advice to just a specific interface type drobiazko : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1128997 Files : * /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java * /tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTest.java * /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Advise.java * /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/test/IOCTestCase.java * /tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/AdviseByMarkerModule2.java * /tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java * /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java * /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Decorate.java > The @Advise annotation limits advice to just a specific interface type > -- > > Key: TAP5-1510 > URL: https://issues.apache.org/jira/browse/TAP5-1510 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-ioc >Affects Versions: 5.3.0, 5.2.5 >Reporter: Howard M. Lewis Ship >Assignee: Igor Drobiazko > > @Advise requires that you specify a service interface (there's no default > value). This is much more limiting than the advise method naming prefix, > which will match all services (subject to the use of @Match), without regard > to service interface. > Further, inside ModuleImpl: > private boolean markerMatched(ServiceDef serviceDef, Markable markable) > { > if > (!serviceDef.getServiceInterface().equals(markable.getServiceInterface())) > return false;; > here, the Markable is the AdvisorDef2 instance generated from the @Advise > annotation. This is an exact comparison; I believe this should be: > if (! > markable.getServiceInterface().isAssignableFrom(serviceDef.getServiceInterface())) > return false; > That, combined with a default of Object.class for @Advisor.serviceInterface > would do the trick ... the @Advise.serviceInterface acts as an umbrella over > any services' service interface. > . ok, did more research and more stepping with the debugger. The above > should be fixed, but it's only the second case of matching, the primary match > should be based on the @Match annotation ... but that's broken too: > Frrom DefaultModuleDefImpl: > private String[] extractPatterns(T annotation, > String id, Method method) > { > if(annotation != null) > return new String[]{}; > > Match match = method.getAnnotation(Match.class); > if (match == null) > return new String[] > { id }; > return match.value(); > } > Here, the annotation is the @Advise annotation; I don't get why it returns > empty string array; we should still see if there's a @Match annotation. > Looking at the code, I can't see any reason why we would return that empty > string array, the presense of the @Advise annotation (or for a decorator > method, the @Decorate annotation) has no purpose I can figure out. > In my situation, my advise method was not invoked because > a) Primary check (by service id) failed, because the @Match annotation was > ignored > b) Secondary check (by service type and marker annotations) failed, because > of inexact match on service interface > So, the end result is the @Advise is only useful to advise a specific service > interface, which is the opposite of what method advice is about ... it's > supposed to match against a swath of services, adapting the advise to > whatever methods are present in those services. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
svn commit: r1128997 - in /tapestry/tapestry5/trunk/tapestry-ioc/src: main/java/org/apache/tapestry5/ioc/annotations/ main/java/org/apache/tapestry5/ioc/internal/ main/java/org/apache/tapestry5/ioc/te
Author: drobiazko Date: Mon May 30 05:50:41 2011 New Revision: 1128997 URL: http://svn.apache.org/viewvc?rev=1128997&view=rev Log: TAP5-1510: The @Advise annotation limits advice to just a specific interface type Added: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/AdviseByMarkerModule2.java (with props) Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Advise.java tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Decorate.java tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/test/IOCTestCase.java tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTest.java Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Advise.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Advise.java?rev=1128997&r1=1128996&r2=1128997&view=diff == --- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Advise.java (original) +++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Advise.java Mon May 30 05:50:41 2011 @@ -36,7 +36,7 @@ public @interface Advise /** * Type of the service to advise. */ -Class serviceInterface(); +Class serviceInterface() default Object.class; /** * Id of the advisor. Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Decorate.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Decorate.java?rev=1128997&r1=1128996&r2=1128997&view=diff == --- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Decorate.java (original) +++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Decorate.java Mon May 30 05:50:41 2011 @@ -36,7 +36,7 @@ public @interface Decorate /** * Type of the service to decorate. */ -Class serviceInterface(); +Class serviceInterface() default Object.class; /** * Id of the decorator. Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java?rev=1128997&r1=1128996&r2=1128997&view=diff == --- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java (original) +++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java Mon May 30 05:50:41 2011 @@ -326,23 +326,20 @@ public class DefaultModuleDefImpl implem Set markers = extractMarkers(method, Decorate.class); -DecoratorDef def = new DecoratorDefImpl(method, extractPatterns(annotation, decoratorId, method), +DecoratorDef def = new DecoratorDefImpl(method, extractPatterns(decoratorId, method), extractConstraints(method), proxyFactory, decoratorId, serviceInterface, markers); decoratorDefs.put(decoratorId, def); } -private String[] extractPatterns(T annotation, String id, Method method) +private String[] extractPatterns(String id, Method method) { -if (annotation != null) -return new String[] -{}; - Match match = method.getAnnotation(Match.class); if (match == null) -return new String[] -{ id }; +{ +return new String[] { id }; +} return match.value(); } @@ -393,7 +390,7 @@ public class DefaultModuleDefImpl implem Set markers = extractMarkers(method, Advise.class); -AdvisorDef def = new AdvisorDefImpl(method, extractPatterns(annotation, advisorId, method), +AdvisorDef def = new AdvisorDefImpl(method, extractPatterns(advisorId, method), extractConstraints(method), proxyFactory, advisorId, serviceInterface, markers); advisorDefs.put(advisorId, def); Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/
[jira] [Assigned] (TAP5-1510) The @Advise annotation limits advice to just a specific interface type
[ https://issues.apache.org/jira/browse/TAP5-1510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Igor Drobiazko reassigned TAP5-1510: Assignee: Igor Drobiazko > The @Advise annotation limits advice to just a specific interface type > -- > > Key: TAP5-1510 > URL: https://issues.apache.org/jira/browse/TAP5-1510 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-ioc >Affects Versions: 5.3.0, 5.2.5 >Reporter: Howard M. Lewis Ship >Assignee: Igor Drobiazko > > @Advise requires that you specify a service interface (there's no default > value). This is much more limiting than the advise method naming prefix, > which will match all services (subject to the use of @Match), without regard > to service interface. > Further, inside ModuleImpl: > private boolean markerMatched(ServiceDef serviceDef, Markable markable) > { > if > (!serviceDef.getServiceInterface().equals(markable.getServiceInterface())) > return false;; > here, the Markable is the AdvisorDef2 instance generated from the @Advise > annotation. This is an exact comparison; I believe this should be: > if (! > markable.getServiceInterface().isAssignableFrom(serviceDef.getServiceInterface())) > return false; > That, combined with a default of Object.class for @Advisor.serviceInterface > would do the trick ... the @Advise.serviceInterface acts as an umbrella over > any services' service interface. > . ok, did more research and more stepping with the debugger. The above > should be fixed, but it's only the second case of matching, the primary match > should be based on the @Match annotation ... but that's broken too: > Frrom DefaultModuleDefImpl: > private String[] extractPatterns(T annotation, > String id, Method method) > { > if(annotation != null) > return new String[]{}; > > Match match = method.getAnnotation(Match.class); > if (match == null) > return new String[] > { id }; > return match.value(); > } > Here, the annotation is the @Advise annotation; I don't get why it returns > empty string array; we should still see if there's a @Match annotation. > Looking at the code, I can't see any reason why we would return that empty > string array, the presense of the @Advise annotation (or for a decorator > method, the @Decorate annotation) has no purpose I can figure out. > In my situation, my advise method was not invoked because > a) Primary check (by service id) failed, because the @Match annotation was > ignored > b) Secondary check (by service type and marker annotations) failed, because > of inexact match on service interface > So, the end result is the @Advise is only useful to advise a specific service > interface, which is the opposite of what method advice is about ... it's > supposed to match against a swath of services, adapting the advise to > whatever methods are present in those services. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (TAP5-1533) File download breaks zone managers due to unload event
[ https://issues.apache.org/jira/browse/TAP5-1533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Josh Canfield updated TAP5-1533: Component/s: (was: tapestry-component-report) tapestry-core This is related to TAP5-1115 > File download breaks zone managers due to unload event > -- > > Key: TAP5-1533 > URL: https://issues.apache.org/jira/browse/TAP5-1533 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-core >Affects Versions: 5.2.5 >Reporter: Joost Schouten > > When a file is downloaded the unload event does some cleanup which prevents > subsequent AJAX responses to fail. The request and response work fine, just > the javascript handeling of the returned JSON fails. Once the page is > refreshed all works fine again. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (TAP5-1534) BeanEditForm should handle @Version fields (hibernate optimistic locking)
[ https://issues.apache.org/jira/browse/TAP5-1534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Josh Canfield updated TAP5-1534: Component/s: (was: tapestry-core) tapestry-hibernate Moved to tapestry-hibernate for hibernate specific issue > BeanEditForm should handle @Version fields (hibernate optimistic locking) > - > > Key: TAP5-1534 > URL: https://issues.apache.org/jira/browse/TAP5-1534 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-hibernate >Affects Versions: 5.2.4, 5.2.5 >Reporter: Donny Nadolny >Priority: Minor > > A BeanEditForm for a hibernate entity with a field annotated with @Version > (the optimistic locking strategy) should be handled correctly by tapestry. > Right now, it is possible to load a page with a BeanEditForm, and if the > underlying entity is modified before the form is saved (in the > minutes/hours/days that the page is open), the form changes will overwrite > other changes. This is not supposed to happen when a Hibernate entity uses a > version field. > There are some possible solutions at > https://forum.hibernate.org/viewtopic.php?f=1&t=957807 > To reproduce this, create an entity with a version field and a page with a > BeanEditForm for it. Open the page, change the version (in the database if > you aren't using a caching layer, or via the application if you are), and > then save the form. The expected result is a StaleObjectStateException, but > instead the changes are overwritten, defeating Hibernate's optimistic locking > strategy. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Created] (TAP5-1534) BeanEditForm should handle @Version fields (hibernate optimistic locking)
BeanEditForm should handle @Version fields (hibernate optimistic locking) - Key: TAP5-1534 URL: https://issues.apache.org/jira/browse/TAP5-1534 Project: Tapestry 5 Issue Type: Bug Components: tapestry-core Affects Versions: 5.2.5, 5.2.4 Reporter: Donny Nadolny Priority: Minor A BeanEditForm for a hibernate entity with a field annotated with @Version (the optimistic locking strategy) should be handled correctly by tapestry. Right now, it is possible to load a page with a BeanEditForm, and if the underlying entity is modified before the form is saved (in the minutes/hours/days that the page is open), the form changes will overwrite other changes. This is not supposed to happen when a Hibernate entity uses a version field. There are some possible solutions at https://forum.hibernate.org/viewtopic.php?f=1&t=957807 To reproduce this, create an entity with a version field and a page with a BeanEditForm for it. Open the page, change the version (in the database if you aren't using a caching layer, or via the application if you are), and then save the form. The expected result is a StaleObjectStateException, but instead the changes are overwritten, defeating Hibernate's optimistic locking strategy. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira