Skip to content

Commit 3c826cb

Browse files
[409784] Problem Importing Java EE 7 Ear with nested modules
1 parent c1e8116 commit 3c826cb

4 files changed

Lines changed: 36 additions & 24 deletions

File tree

plugins/org.eclipse.jst.j2ee.core/archive/org/eclipse/jst/jee/util/internal/JavaEEQuickPeek.java

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,13 @@ public int getVersion() {
173173
version = J2EEVersionConstants.J2EE_1_2_ID;
174174
}
175175
} else if (schemaName != null) {
176-
if (schemaName.equals(J2EEConstants.APP_CLIENT_SCHEMA_1_4)) {
176+
if (schemaName.indexOf(J2EEConstants.APP_CLIENT_SCHEMA_1_4)!= -1) {
177177
version = J2EEVersionConstants.J2EE_1_4_ID;
178-
} else if (schemaName.equals(J2EEConstants.APP_CLIENT_SCHEMA_5)) {
178+
} else if (schemaName.indexOf(J2EEConstants.APP_CLIENT_SCHEMA_5)!= -1) {
179179
version = J2EEVersionConstants.JEE_5_0_ID;
180-
} else if (schemaName.equals(J2EEConstants.APP_CLIENT_SCHEMA_6)) {
180+
} else if (schemaName.indexOf(J2EEConstants.APP_CLIENT_SCHEMA_6)!= -1) {
181181
version = J2EEVersionConstants.JEE_6_0_ID;
182-
} else if (schemaName.equals(J2EEConstants.APP_CLIENT_SCHEMA_7)) {
182+
} else if (schemaName.indexOf(J2EEConstants.APP_CLIENT_SCHEMA_7)!= -1) {
183183
version = J2EEVersionConstants.JEE_7_0_ID;
184184
}
185185
}
@@ -194,13 +194,13 @@ public int getVersion() {
194194
version = J2EEVersionConstants.J2EE_1_2_ID;
195195
}
196196
} else if (schemaName != null) {
197-
if (schemaName.equals(J2EEConstants.APPLICATION_SCHEMA_1_4)) {
197+
if (schemaName.indexOf(J2EEConstants.APPLICATION_SCHEMA_1_4) != -1) {
198198
version = J2EEVersionConstants.J2EE_1_4_ID;
199-
} else if (schemaName.equals(J2EEConstants.APPLICATION_SCHEMA_5)) {
199+
} else if (schemaName.indexOf(J2EEConstants.APPLICATION_SCHEMA_5) != -1) {
200200
version = J2EEVersionConstants.JEE_5_0_ID;
201-
} else if (schemaName.equals(J2EEConstants.APPLICATION_SCHEMA_6)) {
201+
} else if (schemaName.indexOf(J2EEConstants.APPLICATION_SCHEMA_6) != -1) {
202202
version = J2EEVersionConstants.JEE_6_0_ID;
203-
} else if (schemaName.equals(J2EEConstants.APPLICATION_SCHEMA_7)) {
203+
} else if (schemaName.indexOf(J2EEConstants.APPLICATION_SCHEMA_7) != -1){
204204
version = J2EEVersionConstants.JEE_7_0_ID;
205205
}
206206
}
@@ -213,13 +213,13 @@ public int getVersion() {
213213
version = J2EEVersionConstants.EJB_1_1_ID;
214214
}
215215
} else if (schemaName != null) {
216-
if (schemaName.equals(J2EEConstants.EJBJAR_SCHEMA_2_1)) {
216+
if (schemaName.indexOf(J2EEConstants.EJBJAR_SCHEMA_2_1) != -1) {
217217
version = J2EEVersionConstants.EJB_2_1_ID;
218-
} else if (schemaName.equals(J2EEConstants.EJBJAR_SCHEMA_3_0)) {
218+
} else if (schemaName.indexOf(J2EEConstants.EJBJAR_SCHEMA_3_0) != -1) {
219219
version = J2EEVersionConstants.EJB_3_0_ID;
220-
} else if (schemaName.equals(J2EEConstants.EJBJAR_SCHEMA_3_1)) {
220+
} else if (schemaName.indexOf(J2EEConstants.EJBJAR_SCHEMA_3_1) != -1) {
221221
version = J2EEVersionConstants.EJB_3_1_ID;
222-
} else if (schemaName.equals(J2EEConstants.EJBJAR_SCHEMA_3_2)) {
222+
} else if (schemaName.indexOf(J2EEConstants.EJBJAR_SCHEMA_3_2) != -1) {
223223
version = J2EEVersionConstants.EJB_3_2_ID;
224224
}
225225
}
@@ -230,10 +230,12 @@ public int getVersion() {
230230
version = J2EEVersionConstants.JCA_1_0_ID;
231231
}
232232
} else if (schemaName != null) {
233-
if (schemaName.equals(J2EEConstants.CONNECTOR_SCHEMA_1_5)) {
233+
if (schemaName.indexOf(J2EEConstants.CONNECTOR_SCHEMA_1_5) != -1) {
234234
version = J2EEVersionConstants.JCA_1_5_ID;
235-
} else if (schemaName.equals(J2EEConstants.CONNECTOR_SCHEMA_1_6)) {
235+
} else if (schemaName.indexOf(J2EEConstants.CONNECTOR_SCHEMA_1_6) != -1) {
236236
version = J2EEVersionConstants.JCA_1_6_ID;
237+
} else if (schemaName.indexOf(J2EEConstants.CONNECTOR_SCHEMA_1_7) != -1) {
238+
version = J2EEVersionConstants.JCA_1_7_ID;
237239
}
238240
}
239241
break;
@@ -245,13 +247,13 @@ public int getVersion() {
245247
version = J2EEVersionConstants.WEB_2_2_ID;
246248
}
247249
} else if (schemaName != null) {
248-
if (schemaName.equals(J2EEConstants.WEBAPP_SCHEMA_2_4)) {
250+
if (schemaName.indexOf(J2EEConstants.WEBAPP_SCHEMA_2_4) != -1) {
249251
version = J2EEVersionConstants.WEB_2_4_ID;
250-
} else if (schemaName.equals(J2EEConstants.WEBAPP_SCHEMA_2_5)) {
252+
} else if (schemaName.indexOf(J2EEConstants.WEBAPP_SCHEMA_2_5) != -1) {
251253
version = J2EEVersionConstants.WEB_2_5_ID;
252-
} else if (schemaName.equals(J2EEConstants.WEBAPP_SCHEMA_3_0)) {
254+
} else if (schemaName.indexOf(J2EEConstants.WEBAPP_SCHEMA_3_0) != -1) {
253255
version = J2EEVersionConstants.WEB_3_0_ID;
254-
} else if (schemaName.equals(J2EEConstants.WEBAPP_SCHEMA_3_1)) {
256+
} else if (schemaName.indexOf(J2EEConstants.WEBAPP_SCHEMA_3_1) != -1) {
255257
version = J2EEVersionConstants.WEB_3_1_ID;
256258
}
257259
}
@@ -273,8 +275,10 @@ public int getVersion() {
273275
break;
274276
case WEBFRAGMENT_TYPE:
275277
if (schemaName != null) {
276-
if (schemaName.equals(J2EEConstants.WEBFRAGMENT_SCHEMA_3_0)) {
278+
if (schemaName.indexOf(J2EEConstants.WEBFRAGMENT_SCHEMA_3_0) != -1) {
277279
version = J2EEVersionConstants.WEBFRAGMENT_3_0_ID;
280+
} else if (schemaName.indexOf(J2EEConstants.WEBFRAGMENT_SCHEMA_3_1) != -1) {
281+
version = J2EEVersionConstants.WEBFRAGMENT_3_1_ID;
278282
}
279283
}
280284
break;

plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/J2EEConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public interface J2EEConstants extends J2EEVersionConstants {
120120
URI WEBFRAGMENT_DD_URI_OBJ = URI.createURI(WEBFRAGMENT_DD_URI);
121121
String WEBFRAGMENT_DD_SHORT_NAME = "web-fragment.xml"; //$NON-NLS-1$
122122
String WEBFRAGMENT_SCHEMA_3_0 = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"; //$NON-NLS-1$
123-
String WEBFRAGMENT_SCHEMA_3_1 = "http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_0.xsd"; //$NON-NLS-1$
123+
String WEBFRAGMENT_SCHEMA_3_1 = "http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"; //$NON-NLS-1$
124124

125125
//Web app Constants
126126
/** "WebApp_ID" */

plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveWrapper.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ public List<String> getDDMappedModuleURIs() {
138138
cachedDDMappedModuleURIs = new ArrayList<String>();
139139

140140
if(archive.containsArchiveResource(new Path(J2EEConstants.APPLICATION_DD_URI))){
141-
if(jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_5_0_ID || jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_6_0_ID){
141+
if(jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_5_0_ID ||
142+
jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_6_0_ID ||
143+
jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_7_0_ID){
142144
try {
143145
Application application = (Application) archive.getModelObject();
144146
List modules = application.getModules();
@@ -178,7 +180,9 @@ public List<ArchiveWrapper> getEarModules() {
178180
fail();
179181
}
180182
cachedEARModules = new ArrayList<ArchiveWrapper>();
181-
if(jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_5_0_ID || jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_6_0_ID){
183+
if(jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_5_0_ID ||
184+
jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_6_0_ID ||
185+
jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_7_0_ID){
182186
List<IArchiveResource> resources = archive.getArchiveResources();
183187
for (IArchiveResource resource : resources) {
184188
if (resource.getType() != IArchiveResource.DIRECTORY_TYPE) {
@@ -282,7 +286,9 @@ public String getWebContextRoot() {
282286
IArchive earArchive = archive.getArchive();
283287
if(earArchive.containsArchiveResource(new Path(J2EEConstants.APPLICATION_DD_URI))){
284288
JavaEEQuickPeek earJQP = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(earArchive);
285-
if(earJQP.getJavaEEVersion() == JavaEEQuickPeek.JEE_5_0_ID || earJQP.getJavaEEVersion() == JavaEEQuickPeek.JEE_6_0_ID){
289+
if(earJQP.getJavaEEVersion() == JavaEEQuickPeek.JEE_5_0_ID ||
290+
earJQP.getJavaEEVersion() == JavaEEQuickPeek.JEE_6_0_ID ||
291+
earJQP.getJavaEEVersion() == JavaEEQuickPeek.JEE_7_0_ID){
286292
try {
287293
Application application = (Application) earArchive.getModelObject();
288294
String moduleName = archive.getPath().toString();

plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEArchiveUtilities.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,9 @@ private IArchive refineForJavaEE(final IArchive simpleArchive) {
401401
}
402402
int definedType = J2EEVersionConstants.UNKNOWN;
403403
if(archivePath != null) {
404-
if (qp.getVersion() == JavaEEQuickPeek.JEE_5_0_ID || qp.getVersion() == JavaEEQuickPeek.JEE_6_0_ID) {
404+
if (qp.getVersion() == JavaEEQuickPeek.JEE_5_0_ID ||
405+
qp.getVersion() == JavaEEQuickPeek.JEE_6_0_ID ||
406+
qp.getVersion() == JavaEEQuickPeek.JEE_7_0_ID) {
405407
isNestedWithinEar5OrAbove = true;
406408
org.eclipse.jst.javaee.application.Application app = (org.eclipse.jst.javaee.application.Application) ddObj;
407409
// If lib directory is not specified in deployment descriptor, use the default

0 commit comments

Comments
 (0)