Bug 745847 (EDG-78)

Summary: RemoteCacheManager throws an exception instead of returning null when non-existent named cache is requested
Product: [JBoss] JBoss Data Grid 5 Reporter: Michal Linhard <mlinhard>
Component: InfinispanAssignee: Default User <jbpapp-maint>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: EAP 5.1.0 EDG TPCC: mlinhard, nobody
Target Milestone: ---   
Target Release: EAP 5.1.0 EDG TP   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/EDG-78
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-23 18:31:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Michal Linhard 2011-02-09 16:57:47 UTC
project_key: EDG

I was trying out sample client code with infinispan-4.2.1.CR1

{code}package org.example;

import org.infinispan.Cache;
import org.infinispan.client.hotrod.RemoteCacheManager;

public class Sample {
   public static void main(String[] args) throws Exception {	   
      RemoteCacheManager cacheManager = new RemoteCacheManager("localhost:11222");
      cacheManager.start();
	   
      Cache<String, Object> cache = cacheManager.getCache("namedCache2");
      cache.put("key", "value");
      Object value = cache.get("key");
      cacheManager.stop();
      System.out.println(value);
   }
}{code}

and accidentaly requested namedCache2 which didn't exist in cache configuration

the operation cacheManager.getCache("namedCache2") returns something (not null)
and exception is thrown when I try to perform put:

{code}Feb 9, 2011 5:52:48 PM org.infinispan.client.hotrod.impl.operations.HotRodOperation checkForErrorsInResponseStatus
WARNING: Error status received from the server: for message id 2
Exception in thread "main" org.infinispan.client.hotrod.exceptions.HotRodClientException: id [2] code [133] 
	at org.infinispan.client.hotrod.impl.operations.HotRodOperation.checkForErrorsInResponseStatus(HotRodOperation.java:129)
	at org.infinispan.client.hotrod.impl.operations.HotRodOperation.readHeaderAndValidate(HotRodOperation.java:98)
	at org.infinispan.client.hotrod.impl.operations.AbstractKeyValueOperation.sendPutOperation(AbstractKeyValueOperation.java:48)
	at org.infinispan.client.hotrod.impl.operations.PutOperation.executeOperation(PutOperation.java:27)
	at org.infinispan.client.hotrod.impl.operations.RetryOnFailureOperation.execute(RetryOnFailureOperation.java:38)
	at org.infinispan.client.hotrod.impl.RemoteCacheImpl.put(RemoteCacheImpl.java:166)
	at org.infinispan.CacheSupport.put(CacheSupport.java:28)
	at org.example.Sample.main(Sample.java:14)
{code}

it doesn't work in neither standalone hotrod server
(./startServer.sh -r hotrod -c '..../infinispan.xml')
nor EDG

I guess the proper behaviour should be that RemoteCacheManager returns null when asked for nonexistent named cache...

Comment 1 Galder ZamarreƱo 2011-02-22 15:46:30 UTC
Link: Added: This issue depends ISPN-944


Comment 2 Galder ZamarreƱo 2011-02-22 15:46:31 UTC
For 4.2.x, it cannot return null cos it'd break API. I'll make the exception more user friendly for this branch.

For 5.x, we plan to remove this limitation.