Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Commit cfca589

Browse files
mskdeepak-oracleyaminikb
authored andcommitted
Fix #22125: Remove the archive suffix before storing module name (#22126)
1 parent ea8c0b3 commit cfca589

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

appserver/deployment/dol/src/main/java/com/sun/enterprise/deployment/util/ResourceValidator.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -904,11 +904,12 @@ private void storeAppScopedResources(Map<String, List<String>> resources, String
904904
appNamespace.addAll(appLevelResources);
905905
for (Map.Entry<String, List<String>> entry: resources.entrySet()) {
906906
if (!entry.getKey().equals(appName)) {
907-
List<String> jndiNames = moduleNamespaces.get(entry.getKey());
907+
String moduleName = getActualModuleName(entry.getKey());
908+
List<String> jndiNames = moduleNamespaces.get(moduleName);
908909
if (jndiNames == null) {
909910
jndiNames = new ArrayList<>();
910911
jndiNames.addAll(entry.getValue());
911-
moduleNamespaces.put(entry.getKey(), jndiNames);
912+
moduleNamespaces.put(moduleName, jndiNames);
912913
}
913914
else {
914915
jndiNames.addAll(entry.getValue());
@@ -934,7 +935,7 @@ public void store(String jndiName, JndiNameEnvironment env) {
934935
}
935936
}
936937
else if (jndiName.startsWith(ResourceConstants.JAVA_MODULE_SCOPE_PREFIX)) {
937-
String moduleName = DOLUtils.getModuleName(env);
938+
String moduleName = getActualModuleName(DOLUtils.getModuleName(env));
938939
List<String> jndiNames = moduleNamespaces.get(moduleName);
939940
if (jndiNames == null) {
940941
jndiNames = new ArrayList<>();
@@ -970,7 +971,7 @@ public boolean find(String jndiName, JndiNameEnvironment env) {
970971
return jndiNames != null && jndiNames.contains(jndiName);
971972
}
972973
else if (jndiName.startsWith(ResourceConstants.JAVA_MODULE_SCOPE_PREFIX)) {
973-
String moduleName = DOLUtils.getModuleName(env);
974+
String moduleName = getActualModuleName(DOLUtils.getModuleName(env));
974975
List jndiNames = moduleNamespaces.get(moduleName);
975976
return jndiNames != null && jndiNames.contains(jndiName);
976977
}
@@ -981,6 +982,18 @@ else if (jndiName.startsWith(ResourceConstants.JAVA_GLOBAL_SCOPE_PREFIX))
981982
else
982983
return nonPortableJndiNames.contains(jndiName);
983984
}
985+
986+
/**
987+
* Remove suffix from the module name.
988+
*/
989+
private String getActualModuleName(String moduleName) {
990+
if(moduleName != null){
991+
if(moduleName.endsWith(".jar") || moduleName.endsWith(".war") || moduleName.endsWith(".rar")){
992+
moduleName = moduleName.substring(0, moduleName.length()-4);
993+
}
994+
}
995+
return moduleName;
996+
}
984997
}
985998

986999
/**

0 commit comments

Comments
 (0)