Bug 745847 (EDG-78) - RemoteCacheManager throws an exception instead of returning null when non-existent named cache is requested
Summary: RemoteCacheManager throws an exception instead of returning null when non-exi...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: EDG-78
Product: JBoss Data Grid 5
Classification: JBoss
Component: Infinispan
Version: EAP 5.1.0 EDG TP
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: EAP 5.1.0 EDG TP
Assignee: Default User
QA Contact:
URL: http://jira.jboss.org/jira/browse/EDG-78
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-09 16:57 UTC by Michal Linhard
Modified: 2014-03-17 04:02 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-02-23 18:31:12 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker EDG-78 0 None None None Never

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.


Note You need to log in before you can comment on or make changes to this bug.