Skip to content

Commit fa0a686

Browse files
committed
switch to use java to read manifest, wlst python does not support war/ear packed by pack200 method
1 parent 5db579a commit fa0a686

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

core/src/main/python/wlsdeploy/tool/deploy/applications_deployer.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99

1010
from java.io import File
1111
from java.io import IOException
12+
from java.io import FileNotFoundException
13+
from java.util.zip import ZipException
1214
from java.security import NoSuchAlgorithmException
15+
from java.util.jar import JarFile
16+
from java.util.jar import Manifest
17+
from java.lang import IllegalStateException
18+
from java.io import ByteArrayOutputStream
1319

1420
import oracle.weblogic.deploy.util.FileUtils as FileUtils
1521
import oracle.weblogic.deploy.util.PyOrderedDict as OrderedDict
@@ -776,9 +782,14 @@ def __get_deployable_library_versioned_name(self, source_path, model_name):
776782
old_name_tuple = deployer_utils.get_library_name_components(model_name, self.wlst_mode)
777783
try:
778784
source_path = self.model_context.replace_token_string(source_path)
779-
archive = zipfile.ZipFile(source_path)
780-
manifest = archive.read('META-INF/MANIFEST.MF')
781-
tokens = manifest.split()
785+
archive = JarFile(source_path)
786+
manifest_object = archive.getManifest()
787+
tokens = []
788+
if manifest_object is not None:
789+
bao = ByteArrayOutputStream()
790+
manifest_object.write(bao)
791+
manifest = bao.toString('UTF-8')
792+
tokens = manifest.split()
782793

783794
if 'Extension-Name:' in tokens:
784795
extension_index = tokens.index('Extension-Name:')
@@ -812,7 +823,7 @@ def __get_deployable_library_versioned_name(self, source_path, model_name):
812823
raise ex
813824
self.logger.info('WLSDPLY-09324', model_name, versioned_name,
814825
class_name=self._class_name, method_name=_method_name)
815-
except (zipfile.BadZipfile, IOError), e:
826+
except (IOException, FileNotFoundException, ZipException, IllegalStateException), e:
816827
ex = exception_helper.create_deploy_exception('WLSDPLY-09325', model_name, source_path, str(e), error=e)
817828
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
818829
raise ex

0 commit comments

Comments
 (0)