Project

General

Profile

Actions

bug #7586

closed

com.vaadin.data.Property$ReadOnlyException on opening TypeSpecimenWorkingsetEditor

Added by Andreas Kohlbecker almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Highest
Category:
cdm-vaadin
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Severity:
critical
Found in Version:
Tags:

Description

This ReadOnlyException is thrown when a user with insufficient privileges for editing the collector related to a FieldUnit opens the TypeSpecimenWorkingsetEditor:

...
Caused by: com.vaadin.event.ListenerMethod$MethodException: Invocation of method buttonClick in eu.etaxonomy.cdm.vaadin.view.registration.RegistrationWorksetViewBean$$Lambda$57/866342001 failed.
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:533)
    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:200)
    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:163)
    at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1015)
    at com.vaadin.ui.Button.fireClick(Button.java:377)
    at com.vaadin.ui.Button$1.click(Button.java:54)
    ... 80 more
Caused by: com.vaadin.event.ListenerMethod$MethodException: Invocation of method valueChange in eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader failed.
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:533)
    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:200)
    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:163)
    at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1015)
    at com.vaadin.ui.AbstractField.fireValueChange(AbstractField.java:1161)
    at com.vaadin.ui.AbstractField.setPropertyDataSource(AbstractField.java:689)
    at com.vaadin.data.fieldgroup.FieldGroup.bind(FieldGroup.java:273)
    at com.vaadin.data.fieldgroup.BeanFieldGroup.bind(BeanFieldGroup.java:155)
    at com.vaadin.data.fieldgroup.FieldGroup.bindFields(FieldGroup.java:113)
    at com.vaadin.data.fieldgroup.FieldGroup.setItemDataSource(FieldGroup.java:103)
    at com.vaadin.data.fieldgroup.BeanFieldGroup.setItemDataSource(BeanFieldGroup.java:126)
    at com.vaadin.data.fieldgroup.BeanFieldGroup.setItemDataSource(BeanFieldGroup.java:119)
    at eu.etaxonomy.vaadin.mvp.AbstractPopupEditor.loadInEditor(AbstractPopupEditor.java:733)
    at eu.etaxonomy.cdm.vaadin.view.registration.RegistrationWorkingsetPresenter.onTypeDesignationsEditorActionEdit(RegistrationWorkingsetPresenter.java:580)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.vaadin.spring.events.internal.MethodListenerWrapper.publish(MethodListenerWrapper.java:78)
    at org.vaadin.spring.events.internal.ListenerCollection.publish(ListenerCollection.java:167)
    at org.vaadin.spring.events.internal.ScopedEventBus.publish(ScopedEventBus.java:116)
    at org.vaadin.spring.events.internal.ScopedEventBus.publish(ScopedEventBus.java:109)
    at eu.etaxonomy.cdm.vaadin.view.registration.RegistrationWorksetViewBean.lambda$4(RegistrationWorksetViewBean.java:373)
    at sun.reflect.GeneratedMethodAccessor288.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
    ... 85 more
Caused by: com.vaadin.data.Buffered$SourceException
    at com.vaadin.ui.AbstractField.setValue(AbstractField.java:546)
    at eu.etaxonomy.cdm.vaadin.component.common.TeamOrPersonField.setValue(TeamOrPersonField.java:379)
    at eu.etaxonomy.cdm.vaadin.component.common.TeamOrPersonField.setValue(TeamOrPersonField.java:1)
    at eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader.valueChange(ToOneRelatedEntityReloader.java:85)
    at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
    ... 111 more
Caused by: com.vaadin.data.Property$ReadOnlyException
    at com.vaadin.data.util.MethodProperty.setValue(MethodProperty.java:646)
    at com.vaadin.data.util.TransactionalPropertyWrapper.setValue(TransactionalPropertyWrapper.java:94)
    at com.vaadin.ui.AbstractField.setValue(AbstractField.java:538)
    ... 118 more
[phycobank] 22:32:24,801 ERROR [qtp759156157-151][co.fl.va.ad.er.ErrorWindow] - Error occurred 87069e75-9803-46f1-b08f-fabef120a33f
com.vaadin.server.ServerRpcManager$RpcInvocationException: Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc
    at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:162)
    at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:119)
    at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:437)
    at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:402)
    at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:273)
    at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:90)
    at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1435)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:380)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1613)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1584)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1228)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1130)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:564)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:112)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:122)
    at org.eclipse.jetty.util.thread.strategy.ExecutingExecutionStrategy.invoke(ExecutingExecutionStrategy.java:58)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:201)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:133)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor287.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:158)
    ... 76 more
Caused by: com.vaadin.event.ListenerMethod$MethodException: Invocation of method buttonClick in eu.etaxonomy.cdm.vaadin.view.registration.RegistrationWorksetViewBean$$Lambda$57/866342001 failed.
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:533)
    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:200)
    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:163)
    at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1015)
    at com.vaadin.ui.Button.fireClick(Button.java:377)
    at com.vaadin.ui.Button$1.click(Button.java:54)
    ... 80 more
Caused by: com.vaadin.event.ListenerMethod$MethodException: Invocation of method valueChange in eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader failed.
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:533)
    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:200)
    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:163)
    at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1015)
    at com.vaadin.ui.AbstractField.fireValueChange(AbstractField.java:1161)
    at com.vaadin.ui.AbstractField.setPropertyDataSource(AbstractField.java:689)
    at com.vaadin.data.fieldgroup.FieldGroup.bind(FieldGroup.java:273)
    at com.vaadin.data.fieldgroup.BeanFieldGroup.bind(BeanFieldGroup.java:155)
    at com.vaadin.data.fieldgroup.FieldGroup.bindFields(FieldGroup.java:113)
    at com.vaadin.data.fieldgroup.FieldGroup.setItemDataSource(FieldGroup.java:103)
    at com.vaadin.data.fieldgroup.BeanFieldGroup.setItemDataSource(BeanFieldGroup.java:126)
    at com.vaadin.data.fieldgroup.BeanFieldGroup.setItemDataSource(BeanFieldGroup.java:119)
    at eu.etaxonomy.vaadin.mvp.AbstractPopupEditor.loadInEditor(AbstractPopupEditor.java:733)
    at eu.etaxonomy.cdm.vaadin.view.registration.RegistrationWorkingsetPresenter.onTypeDesignationsEditorActionEdit(RegistrationWorkingsetPresenter.java:580)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.vaadin.spring.events.internal.MethodListenerWrapper.publish(MethodListenerWrapper.java:78)
    at org.vaadin.spring.events.internal.ListenerCollection.publish(ListenerCollection.java:167)
    at org.vaadin.spring.events.internal.ScopedEventBus.publish(ScopedEventBus.java:116)
    at org.vaadin.spring.events.internal.ScopedEventBus.publish(ScopedEventBus.java:109)
    at eu.etaxonomy.cdm.vaadin.view.registration.RegistrationWorksetViewBean.lambda$4(RegistrationWorksetViewBean.java:373)
    at sun.reflect.GeneratedMethodAccessor288.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
    ... 85 more
Caused by: com.vaadin.data.Buffered$SourceException
    at com.vaadin.ui.AbstractField.setValue(AbstractField.java:546)
    at eu.etaxonomy.cdm.vaadin.component.common.TeamOrPersonField.setValue(TeamOrPersonField.java:379)
    at eu.etaxonomy.cdm.vaadin.component.common.TeamOrPersonField.setValue(TeamOrPersonField.java:1)
    at eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader.valueChange(ToOneRelatedEntityReloader.java:85)
    at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
    ... 111 more
Caused by: com.vaadin.data.Property$ReadOnlyException
    at com.vaadin.data.util.MethodProperty.setValue(MethodProperty.java:646)
    at com.vaadin.data.util.TransactionalPropertyWrapper.setValue(TransactionalPropertyWrapper.java:94)
    at com.vaadin.ui.AbstractField.setValue(AbstractField.java:538)
    ... 118 more

This happens because the ToOneRelatedEntityReloader is trying to set the cached object for the TeamOrPerson entity as value for the TeamOrPersonField while the ProperyDatasource contained in this field is readOnly:

if(EntitySupport.class.isAssignableFrom(toOneRelatedEntityField.getClass())){
    ((EntitySupport)toOneRelatedEntityField).replaceEntityValue(cachedEntity);
} else {
    toOneRelatedEntityField.removeValueChangeListener(this);
    toOneRelatedEntityField.setValue(null); // reset to trick equals check in vaadin <=== ReadOnlyException !!!!
    toOneRelatedEntityField.setValue(cachedEntity);
    toOneRelatedEntityField.addValueChangeListener(this);
}

The readOnly state of the datasource has been set in TeamOrPersonField:

protected void setInternalValue(TeamOrPersonBase<?> newValue) {
    ...
    adaptToUserPermissions(newValue);
        updateToolBarButtonStates();
    }
}

so subsequent attempts to change the value will fail as long as the readOnly state of the datasource is not temporarily set to false when setting the cachedValue to the field.


Related issues

Related to EDIT - task #7587: ToOneRelatedEntityReloader to listen and operate on PropertyDatasources directly?NewAndreas Kohlbecker

Actions
Related to EDIT - bug #7366: TeamOrPersonField readonly if users lacks edit permissionsClosedAndreas Kohlbecker

Actions
Actions #1

Updated by Andreas Kohlbecker almost 4 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50
Actions #2

Updated by Andreas Kohlbecker almost 4 years ago

  • Related to task #7587: ToOneRelatedEntityReloader to listen and operate on PropertyDatasources directly? added
Actions #3

Updated by Andreas Kohlbecker almost 4 years ago

  • Related to bug #7366: TeamOrPersonField readonly if users lacks edit permissions added
Actions #4

Updated by Andreas Kohlbecker almost 4 years ago

for solving #7366 the datasource is set in TeamOrPersonField.adaptToUserPermissions() to readonly if the the lacks editing permissions:

    private void adaptToUserPermissions(TeamOrPersonBase teamOrPerson) {

        UserHelper userHelper = UserHelperAccess.userHelper();
        boolean canEdit = teamOrPerson == null || !teamOrPerson.isPersited() || userHelper.userHasPermission(teamOrPerson, CRUD.UPDATE);
        if(!canEdit){
            getPropertyDataSource().setReadOnly(true); // <==== causes PROBLEMS with ToOneRelatedEntityReloader
            setReadOnlyComponents(true);
        }
    }

This is causing the problems and can for sure be removed without risking to compromise any data.

Actions #5

Updated by Andreas Kohlbecker almost 4 years ago

This should be solved now!

Actions #6

Updated by Andreas Kohlbecker almost 4 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 50 to 100

did not occur again on the test-server since over 20days, so this is for sure solved

Actions

Also available in: Atom PDF