Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 79415 invoked from network); 1 Jan 2009 20:15:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Jan 2009 20:15:54 -0000 Received: (qmail 33041 invoked by uid 500); 1 Jan 2009 20:15:54 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 33021 invoked by uid 500); 1 Jan 2009 20:15:54 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 33012 invoked by uid 99); 1 Jan 2009 20:15:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Jan 2009 12:15:54 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Jan 2009 20:15:52 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2BA09238889F; Thu, 1 Jan 2009 12:15:31 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r730596 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha: ContainerId.java impl/KahaStore.java Date: Thu, 01 Jan 2009 20:15:30 -0000 To: commits@activemq.apache.org From: djencks@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090101201531.2BA09238889F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: djencks Date: Thu Jan 1 12:15:30 2009 New Revision: 730596 URL: http://svn.apache.org/viewvc?rev=730596&view=rev Log: AMQ-2052 Be careful about when to use a file-system-safened id Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/ContainerId.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/ContainerId.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/ContainerId.java?rev=730596&r1=730595&r2=730596&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/ContainerId.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/ContainerId.java Thu Jan 1 12:15:30 2009 @@ -21,6 +21,8 @@ import java.io.ObjectInput; import java.io.ObjectOutput; +import org.apache.activemq.util.IOHelper; + /** * Used by RootContainers * @@ -47,26 +49,12 @@ } /** - * @param dataContainerName The dataContainerPrefix to set. - */ - public void setDataContainerName(String dataContainerName) { - this.dataContainerName = dataContainerName; - } - - /** * @return Returns the key. */ public Object getKey() { return key; } - /** - * @param key The key to set. - */ - public void setKey(Object key) { - this.key = key; - } - public int hashCode() { return key.hashCode() ^ dataContainerName.hashCode(); } @@ -92,4 +80,8 @@ public String toString() { return "CID{" + dataContainerName + ":" + key + "}"; } + + public String getFileSystemSafeContainerName() { + return IOHelper.toFileSystemSafeName(dataContainerName); + } } Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java?rev=730596&r1=730595&r2=730596&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java Thu Jan 1 12:15:30 2009 @@ -198,9 +198,7 @@ public synchronized boolean doesMapContainerExist(Object id, String containerName) throws IOException { initialize(); - ContainerId containerId = new ContainerId(); - containerId.setKey(id); - containerId.setDataContainerName(containerName); + ContainerId containerId = new ContainerId(id, containerName); return maps.containsKey(containerId) || mapsContainer.doesRootExist(containerId); } @@ -212,17 +210,16 @@ return getMapContainer(id, containerName, persistentIndex); } - public synchronized MapContainer getMapContainer(Object id, String originalContainerName, boolean persistentIndex) + public synchronized MapContainer getMapContainer(Object id, String containerName, boolean persistentIndex) throws IOException { initialize(); - String containerName = IOHelper.toFileSystemSafeName(originalContainerName); - ContainerId containerId = new ContainerId(); - containerId.setKey(id); - containerId.setDataContainerName(containerName); + ContainerId containerId = new ContainerId(id, containerName); MapContainerImpl result = maps.get(containerId); if (result == null) { - DataManager dm = getDataManager(containerName); - IndexManager im = getIndexManager(dm, containerName); + String fileSystemSafeContainerName = containerId.getFileSystemSafeContainerName(); + DataManager dm = getDataManager(fileSystemSafeContainerName); + IndexManager im = getIndexManager(dm, fileSystemSafeContainerName); + IndexItem root = mapsContainer.getRoot(im, containerId); if (root == null) { root = mapsContainer.addRoot(im, containerId); @@ -268,9 +265,7 @@ public synchronized boolean doesListContainerExist(Object id, String containerName) throws IOException { initialize(); - ContainerId containerId = new ContainerId(); - containerId.setKey(id); - containerId.setDataContainerName(containerName); + ContainerId containerId = new ContainerId(id, containerName); return lists.containsKey(containerId) || listsContainer.doesRootExist(containerId); } @@ -282,17 +277,15 @@ return getListContainer(id, containerName, persistentIndex); } - public synchronized ListContainer getListContainer(Object id, String originalContainerName, + public synchronized ListContainer getListContainer(Object id, String containerName, boolean persistentIndex) throws IOException { initialize(); - String containerName = IOHelper.toFileSystemSafeName(originalContainerName); - ContainerId containerId = new ContainerId(); - containerId.setKey(id); - containerId.setDataContainerName(containerName); + ContainerId containerId = new ContainerId(id, containerName); ListContainerImpl result = lists.get(containerId); if (result == null) { - DataManager dm = getDataManager(containerName); - IndexManager im = getIndexManager(dm, containerName); + String fileSystemSafeContainerName = containerId.getFileSystemSafeContainerName(); + DataManager dm = getDataManager(fileSystemSafeContainerName); + IndexManager im = getIndexManager(dm, fileSystemSafeContainerName); IndexItem root = listsContainer.getRoot(im, containerId); if (root == null) {