[
http://jira.amdatu.org/jira/browse/AMDATU-238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10644#comment-10644
]
Angelo van der Sijpt commented on AMDATU-238:
---------------------------------------------
The javadoc of that getProperties method says
/**
* Map of properties that identify this tenant. Properties may be a
hostname or a cookie.
* @return A map of properties that identify this tenant. If no properties
are available
* then an empty map is returned. Note that the map is <em>not</em> backed
by the Tenant
* object, and changes made to this map will not result in changes to the
Tenant.
*/
So, the properties you get back are not backed by the actual object. This is a
quite regular pattern that prevents concurrency issues (e.g., CME's).
> Updating tenants does not work
> ------------------------------
>
> Key: AMDATU-238
> URL: http://jira.amdatu.org/jira/browse/AMDATU-238
> Project: Amdatu
> Issue Type: Bug
> Components: Amdatu Core
> Affects Versions: 0.1.0
> Reporter: Ivo Ladage - van Doorn
> Assignee: Angelo van der Sijpt
> Fix For: 0.1.0
>
>
> When I add this code snippet to my service to create and later on update a
> tenant, I get a NullPointerException when the tenant already exists:
> TenantEntity tenantA = m_tenantManagementService.getTenantById("tenant_a");
> if (tenantA == null) {
> tenantA = m_tenantManagementService.createTenant("tenant_a", "Tenant A");
> }
> tenantA.getProperties().put(HOSTNAME, "localhost");
> m_tenantManagementService.updateTenant(tenantA);
> The error I get:
> WARNING: Invocation of 'start' failed. [org.amdatu.core.tenant]
> null
> java.lang.NullPointerException
> at
> org.amdatu.core.tenant.service.TenantManagementServiceImpl.updateTenantService(TenantManagementServiceImpl.java:117)
> at
> org.amdatu.core.tenant.service.TenantManagementServiceImpl.updateTenant(TenantManagementServiceImpl.java:93)
> at
> org.amdatu.core.tenant.service.TenantContextProviderImpl.start(TenantContextProviderImpl.java:74)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira