[294664] Classpath entry attributes lost when updating runtime classpath container
diff --git a/features/org.eclipse.jst.server_core.feature.patch/buildnotes_org.eclipse.jst.server_core.feature.patch.html b/features/org.eclipse.jst.server_core.feature.patch/buildnotes_org.eclipse.jst.server_core.feature.patch.html
index b9dffd7..43743bd 100644
--- a/features/org.eclipse.jst.server_core.feature.patch/buildnotes_org.eclipse.jst.server_core.feature.patch.html
+++ b/features/org.eclipse.jst.server_core.feature.patch/buildnotes_org.eclipse.jst.server_core.feature.patch.html
@@ -4,14 +4,14 @@
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="Build" content="Build">
-   <title>WTP 1.5.5 Patches</title>
+   <title>WTP 3.0.5 Patches</title>
 </head>
 
 <body>
 
-<h1>WTP 1.5.5 Patches</h1>
+<h1>WTP 3.0.5 Patches</h1>
 
 <h2>org.eclipse.jst.server_core.feature</h2>
 
-<p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=274644'>274644</a>. JARs deployed wrongly within EAR</p>
+<p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=294664'>294664</a>. Classpath entry attributes lost when updating runtime classpath container</p>
 </body></html>
\ No newline at end of file
diff --git a/features/org.eclipse.jst.server_core.feature.patch/feature.properties b/features/org.eclipse.jst.server_core.feature.patch/feature.properties
index d7f7e4e..06ef350 100644
--- a/features/org.eclipse.jst.server_core.feature.patch/feature.properties
+++ b/features/org.eclipse.jst.server_core.feature.patch/feature.properties
@@ -30,7 +30,7 @@
 \n\
 The fixes are described in the following bugzilla entries:\n\
 \n\
-Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=274644 JARs deployed wrongly within EAR\n\
+Bug https://bugs.eclipse.org/294664 Classpath entry attributes lost when updating runtime classpath container\n\
 \n\
 # "copyright" property - text of the "Feature Update Copyright"
 copyright=\
diff --git a/features/org.eclipse.jst.server_core.feature.patch/feature.xml b/features/org.eclipse.jst.server_core.feature.patch/feature.xml
index 7d2fd77..08ab969 100644
--- a/features/org.eclipse.jst.server_core.feature.patch/feature.xml
+++ b/features/org.eclipse.jst.server_core.feature.patch/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="org.eclipse.jst.server_core.feature.patch"
       label="%featureName"
-      version="1.5.5.qualifier"
+      version="3.0.5.qualifier"
       provider-name="%providerName">
 
    <description>
@@ -18,11 +18,11 @@
    </license>
 
    <requires>
-      <import feature="org.eclipse.jst.server_core.feature" version="1.5.4.v200704150241--2PD88Q8PCH7787" patch="true"/>
+      <import feature="org.eclipse.jst.server_core.feature" version="3.0.4.v20090115-377Aq9oA55T5F8H35AC" patch="true"/>
    </requires>
 
    <plugin
-         id="org.eclipse.jst.server.generic.core"
+         id="org.eclipse.jst.server.core"
          download-size="0"
          install-size="0"
          version="0.0.0"
diff --git a/plugins/org.eclipse.jst.server.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.server.core/META-INF/MANIFEST.MF
index bacd972..c51cbb4 100644
--- a/plugins/org.eclipse.jst.server.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.server.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jst.server.core; singleton:=true
-Bundle-Version: 1.1.3.qualifier
+Bundle-Version: 1.1.4.qualifier
 Bundle-Activator: org.eclipse.jst.server.core.internal.JavaServerPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java
index b1f40b0..f4f9509 100644
--- a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java
+++ b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 2009 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
@@ -11,17 +11,12 @@
 package org.eclipse.jst.server.core;
 
 import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IAccessRule;
 import org.eclipse.jdt.core.IClasspathAttribute;
 import org.eclipse.jdt.core.IClasspathContainer;
 import org.eclipse.jdt.core.IClasspathEntry;
@@ -151,7 +146,8 @@
 			for (int j = 0; j < size2; j++) {
 				SourceAttachmentUpdate sau = sourceAttachments.get(j);
 				if (sau.runtimeId.equals(runtime.getId()) && sau.entry.equals(entries[i].getPath())) {
-					entries[i] = JavaCore.newLibraryEntry(entries[i].getPath(), sau.sourceAttachmentPath, sau.sourceAttachmentRootPath, new IAccessRule[0], sau.attributes, false);
+					IClasspathAttribute[] consolidatedClasspathAttributes = consolidateClasspathAttributes(sau.attributes, entries[i].getExtraAttributes());
+					entries[i] = JavaCore.newLibraryEntry(entries[i].getPath(), sau.sourceAttachmentPath, sau.sourceAttachmentRootPath, entries[i].getAccessRules(), consolidatedClasspathAttributes, false);
 				}
 			}
 		}
@@ -353,4 +349,23 @@
 			Trace.trace(Trace.SEVERE, "Error saving source path info", e);
 		}
 	}
+	
+	public IClasspathAttribute[] consolidateClasspathAttributes(IClasspathAttribute[] sourceAttachmentAttributes, IClasspathAttribute[] classpathEntryAttributes) {
+		List classpathAttributeList = new ArrayList();
+		classpathAttributeList.addAll(Arrays.asList(sourceAttachmentAttributes));
+		for (int i = 0; i < classpathEntryAttributes.length; i++) {
+			boolean attributeCollision = false;
+			for (int j = 0; j < sourceAttachmentAttributes.length; j++) {
+				String name = classpathEntryAttributes[i].getName();
+				if(name != null && name.equals(sourceAttachmentAttributes[j].getName())) {
+					attributeCollision = true;
+					break;
+				}
+			}
+			if(!attributeCollision) {
+				classpathAttributeList.add(classpathEntryAttributes[i]);
+			}
+		}
+		return (IClasspathAttribute[]) classpathAttributeList.toArray(new IClasspathAttribute[classpathAttributeList.size()]);
+	}
 }
\ No newline at end of file