Skip to content

Commit 885df82

Browse files
authored
Merge pull request #120 from oracle/pack200fix
Pack200fix
2 parents 5db579a + 6c18d4e commit 885df82

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
import copy
66
import javaos as os
77
from sets import Set
8-
import zipfile
98

109
from java.io import File
1110
from java.io import IOException
11+
from java.io import FileNotFoundException
12+
from java.util.zip import ZipException
1213
from java.security import NoSuchAlgorithmException
14+
from java.util.jar import JarFile
15+
from java.util.jar import Manifest
16+
from java.lang import IllegalStateException
17+
from java.io import ByteArrayOutputStream
1318

1419
import oracle.weblogic.deploy.util.FileUtils as FileUtils
1520
import oracle.weblogic.deploy.util.PyOrderedDict as OrderedDict
@@ -776,9 +781,14 @@ def __get_deployable_library_versioned_name(self, source_path, model_name):
776781
old_name_tuple = deployer_utils.get_library_name_components(model_name, self.wlst_mode)
777782
try:
778783
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()
784+
archive = JarFile(source_path)
785+
manifest_object = archive.getManifest()
786+
tokens = []
787+
if manifest_object is not None:
788+
bao = ByteArrayOutputStream()
789+
manifest_object.write(bao)
790+
manifest = bao.toString('UTF-8')
791+
tokens = manifest.split()
782792

783793
if 'Extension-Name:' in tokens:
784794
extension_index = tokens.index('Extension-Name:')
@@ -812,7 +822,7 @@ def __get_deployable_library_versioned_name(self, source_path, model_name):
812822
raise ex
813823
self.logger.info('WLSDPLY-09324', model_name, versioned_name,
814824
class_name=self._class_name, method_name=_method_name)
815-
except (zipfile.BadZipfile, IOError), e:
825+
except (IOException, FileNotFoundException, ZipException, IllegalStateException), e:
816826
ex = exception_helper.create_deploy_exception('WLSDPLY-09325', model_name, source_path, str(e), error=e)
817827
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
818828
raise ex

0 commit comments

Comments
 (0)