From 5cb12a9750632b4c541706d1f9276b2bdb35e7bd Mon Sep 17 00:00:00 2001 From: David McKnight Date: Thu, 4 Oct 2012 19:02:28 +0000 Subject: [PATCH] [391132] filterpools don't persist when profile names end in _ --- .../filters/SystemFilterPoolReference.java | 44 ++++++++++++------- .../persistence/dom/RSEDOMImporter.java | 5 ++- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReference.java index 6cf6327e846..e90a02f19b2 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReference.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2011 IBM Corporation and others. + * Copyright (c) 2002, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,6 +19,7 @@ * David Dykstal (IBM) - [192122] extended search to look for filter pools in * profile during getReferencedFilterPool() rather than returning broken reference * David McKnight (IBM) - [358999] Deleting multiple connections takes long time + * David McKnight (IBM) -[391132] filterpools don't persist when profile names end in _ *******************************************************************************/ package org.eclipse.rse.internal.core.filters; @@ -116,10 +117,17 @@ public class SystemFilterPoolReference extends SystemPersistableReferencingObjec * The filter pool manager name is the same as its owning profile. */ String savedName = getReferencedObjectName(); - String[] parts = savedName.split(DELIMITER, 2); - String result = parts[0]; - if (parts.length == 2) { - result = parts[1]; + String result = null; + int lastDelim = savedName.lastIndexOf(DELIMITER); + if (lastDelim > 0){ + result = savedName.substring(lastDelim + DELIMITER_LENGTH); + } + else { + String[] parts = savedName.split(DELIMITER, 2); + result = parts[0]; + if (parts.length == 2) { + result = parts[1]; + } } return result; } @@ -135,16 +143,22 @@ public class SystemFilterPoolReference extends SystemPersistableReferencingObjec * The filter pool manager name is the same as its owning profile. */ String result = null; - String savedName = getReferencedObjectName(); - String[] parts = savedName.split(DELIMITER, 2); - if (parts.length == 2) { - result = parts[0]; - } else { - ISystemFilterPoolReferenceManagerProvider provider = getProvider(); - if (provider instanceof ISubSystem) { - ISubSystem subsystem = (ISubSystem) provider; - ISystemProfile profile = subsystem.getSystemProfile(); - result = profile.getName(); + String savedName = getReferencedObjectName(); + int lastDelim = savedName.lastIndexOf(DELIMITER); + if (lastDelim > 0){ + result = savedName.substring(0, lastDelim); + } + else { + String[] parts = savedName.split(DELIMITER, 2); + if (parts.length == 2) { + result = parts[0]; + } else { + ISystemFilterPoolReferenceManagerProvider provider = getProvider(); + if (provider instanceof ISubSystem) { + ISubSystem subsystem = (ISubSystem) provider; + ISystemProfile profile = subsystem.getSystemProfile(); + result = profile.getName(); + } } } if (result == null) { diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java index 4fb40f08e18..5641a168687 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2009 IBM Corporation and others. All rights reserved. + * Copyright (c) 2006, 2012 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -27,6 +27,7 @@ * David McKnight (IBM) - [267052] need to be able to create subsystems-after-the-fact * David McKnight (IBM) - [271243] [files] Switching service type brings up TWO file subsystems after restart * Uwe Stieber (Wind River) - [283844] NPE on restoring property set if persistent data is corrupted + * David McKnight (IBM) -[391132] filterpools don't persist when profile names end in _ ********************************************************************************/ package org.eclipse.rse.internal.persistence.dom; @@ -516,9 +517,9 @@ public class RSEDOMImporter { ISystemProfile profile = subsystem.getSystemProfile(); String profileName = profile.getName(); String baseFilterPoolName = filterPoolName; + filterPoolName = filterPoolName.substring(profileName.length()); // in case there's an underscore in the profile name String[] part = filterPoolName.split("___", 2); //$NON-NLS-1$ if (part.length == 2) { // name is qualified and refers to a filter pool in a specific profile - profileName = part[0]; baseFilterPoolName = part[1]; } // special processing for host owned pool references