|
9 | 9 |
|
10 | 10 | from java.io import File
|
11 | 11 | from java.io import IOException
|
| 12 | +from java.io import FileNotFoundException |
| 13 | +from java.util.zip import ZipException |
12 | 14 | 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 |
13 | 19 |
|
14 | 20 | import oracle.weblogic.deploy.util.FileUtils as FileUtils
|
15 | 21 | import oracle.weblogic.deploy.util.PyOrderedDict as OrderedDict
|
@@ -776,9 +782,14 @@ def __get_deployable_library_versioned_name(self, source_path, model_name):
|
776 | 782 | old_name_tuple = deployer_utils.get_library_name_components(model_name, self.wlst_mode)
|
777 | 783 | try:
|
778 | 784 | 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() |
782 | 793 |
|
783 | 794 | if 'Extension-Name:' in tokens:
|
784 | 795 | extension_index = tokens.index('Extension-Name:')
|
@@ -812,7 +823,7 @@ def __get_deployable_library_versioned_name(self, source_path, model_name):
|
812 | 823 | raise ex
|
813 | 824 | self.logger.info('WLSDPLY-09324', model_name, versioned_name,
|
814 | 825 | class_name=self._class_name, method_name=_method_name)
|
815 |
| - except (zipfile.BadZipfile, IOError), e: |
| 826 | + except (IOException, FileNotFoundException, ZipException, IllegalStateException), e: |
816 | 827 | ex = exception_helper.create_deploy_exception('WLSDPLY-09325', model_name, source_path, str(e), error=e)
|
817 | 828 | self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
|
818 | 829 | raise ex
|
|
0 commit comments