[399674] ServerUtil.modifyModules() uses parents randomly
[407023] When module deleted, can't tell if the module was external or
not
diff --git a/features/org.eclipse.wst.server_core.feature.patch/buildnotes_org.eclipse.wst.server_core.feature.patch.html b/features/org.eclipse.wst.server_core.feature.patch/buildnotes_org.eclipse.wst.server_core.feature.patch.html
index c0dea77..2cf8624 100644
--- a/features/org.eclipse.wst.server_core.feature.patch/buildnotes_org.eclipse.wst.server_core.feature.patch.html
+++ b/features/org.eclipse.wst.server_core.feature.patch/buildnotes_org.eclipse.wst.server_core.feature.patch.html
@@ -23,6 +23,8 @@
<p>Bug <a href='https://bugs.eclipse.org/404072'>404072</a>. Run on server on starting server will not publish if the module is changed</p>
<p>Bug <a href='https://bugs.eclipse.org/404076'>404076</a>. during publish, Run On Server action should be adaptable to String and not only shell</p>
<p>Bug <a href='https://bugs.eclipse.org/404081'>404081</a>. show in debug action does not always work</p>
+<p>Bug <a href='https://bugs.eclipse.org/399674'>399674</a>. ServerUtil.modifyModules() uses parents randomly</p>
+<p>Bug <a href='https://bugs.eclipse.org/407023'>407023</a>. When module deleted, can't tell if the module was external or not</p>
</body>
diff --git a/features/org.eclipse.wst.server_core.feature.patch/feature.properties b/features/org.eclipse.wst.server_core.feature.patch/feature.properties
index 1a3fbff..12cb2da 100644
--- a/features/org.eclipse.wst.server_core.feature.patch/feature.properties
+++ b/features/org.eclipse.wst.server_core.feature.patch/feature.properties
@@ -30,6 +30,8 @@
Bug https://bugs.eclipse.org/404072 Run on server on starting server will not publish if the module is changed\n\
Bug https://bugs.eclipse.org/404076 during publish, Run On Server action should be adaptable to String and not only shell\n\
Bug https://bugs.eclipse.org/404081 show in debug action does not always work\n\
+Bug https://bugs.eclipse.org/399674 ServerUtil.modifyModules() uses parents randomly\n\
+Bug https://bugs.eclipse.org/407023 When module deleted, can't tell if the module was external or not\n\
\n\
# "copyright" property - text of the "Feature Update Copyright"
copyright=\
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerUtil.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerUtil.java
index b977e68..31c8be2 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerUtil.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerUtil.java
@@ -342,6 +342,14 @@
IModule[] parents = server.getRootModules(module, monitor);
if (parents != null && parents.length > 0) {
IModule parent = parents[0];
+ if(parents.length > 1){
+ for(int i = 1 ; i <parents.length; i++){
+ if(module.equals(parents[i])){
+ parent = parents[i];
+ break;
+ }
+ }
+ }
found = true;
if (!addParentModules.contains(parent))
addParentModules.add(parent);
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java
index bd2a0e9..1b89c70 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 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
@@ -22,11 +22,17 @@
protected String id;
protected String name;
protected IModuleType moduleType2;
+ protected boolean isExternal;
public DeletedModule(String id, String name, IModuleType moduleType) {
+ this(id, name, moduleType, false);
+ }
+
+ public DeletedModule(String id, String name, IModuleType moduleType, boolean isExternal) {
this.id = id;
this.name = name;
this.moduleType2 = moduleType;
+ this.isExternal = isExternal;
}
public String getId() {
@@ -73,7 +79,7 @@
}
public boolean isExternal() {
- return false;
+ return isExternal;
}
public boolean exists() {
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModulePublishInfo.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModulePublishInfo.java
index 950e084..0c4de6f 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModulePublishInfo.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModulePublishInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 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
@@ -34,6 +34,7 @@
private static final String NAME = "name";
private static final String MODULE_TYPE_ID = "module-type-id";
private static final String MODULE_TYPE_VERSION = "module-type-version";
+ private static final String MODULE_IS_EXTERNAL = "module-is-external";
private static final String STAMP = "stamp";
private static final String FILE = "file";
private static final String FOLDER = "folder";
@@ -42,6 +43,7 @@
private String name;
private IModuleResource[] resources = EMPTY_MODULE_RESOURCE;
private IModuleType moduleType;
+ private boolean isExternal;
private boolean useCache;
private IModuleResource[] currentResources = null;
@@ -66,6 +68,22 @@
/**
* ModulePublishInfo constructor.
*
+ * @param moduleId a module id
+ * @param name the module's name
+ * @param moduleType the module type
+ */
+ public ModulePublishInfo(String moduleId, String name, IModuleType moduleType, boolean isExternal) {
+ super();
+
+ this.moduleId = moduleId;
+ this.name = name;
+ this.moduleType = moduleType;
+ this.isExternal = isExternal;
+ }
+
+ /**
+ * ModulePublishInfo constructor.
+ *
* @param memento a memento
*/
public ModulePublishInfo(IMemento memento) {
@@ -121,6 +139,8 @@
String mv = memento.getString(MODULE_TYPE_VERSION);
if (mt != null && mt.length() > 0)
moduleType = ModuleType.getModuleType(mt, mv);
+ String isExternalStr = memento.getString(MODULE_IS_EXTERNAL);
+ isExternal = Boolean.parseBoolean(isExternalStr);
resources = loadResource(memento, new Path(""));
} catch (Exception e) {
@@ -459,7 +479,7 @@
int index = id.lastIndexOf("#");
if (index > 0)
id = id.substring(index+1);
- return new DeletedModule(id, name, moduleType);
+ return new DeletedModule(id, name, moduleType, isExternal);
}
public String toString() {
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPublishInfo.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPublishInfo.java
index fe36104..9deb351 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPublishInfo.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPublishInfo.java
@@ -168,7 +168,7 @@
// have to create a new one
IModule mod = module[module.length - 1];
- ModulePublishInfo mpi = new ModulePublishInfo(getKey(module), mod.getName(), mod.getModuleType());
+ ModulePublishInfo mpi = new ModulePublishInfo(getKey(module), mod.getName(), mod.getModuleType(), mod.isExternal());
modulePublishInfo.put(key, mpi);
return mpi;
}