Se produjo una excepción en java.lang.System
Tengo un error al crear un archivo de zip usando librerias de java el error (Se produjo una excepción en el inicializador de java.lang.System) me sale en la siguiente linea de codigo
zipOutputStream = New ZipOutputStream(New FileOutputStream(zipPath))
Y este es la parte del código fuente.
Public Shared Function createZip(ByVal zipPath As String, ByVal files2Zip As System.Collections.ArrayList) As Boolean
Dim zipOutputStream As ZipOutputStream = Nothing
Dim zipEntry As ZipEntry
Dim fileInputStream As FileInputStream
Dim file2Zip As String
Dim auxObj As Object
Dim created = True
Try
zipOutputStream = New ZipOutputStream(New FileOutputStream(zipPath))
If Not IsNothing(files2Zip) Then
For Each auxObj In files2Zip
file2Zip = CType(auxObj, String)
zipEntry = New ZipEntry(Path.GetFileName(file2Zip))
zipEntry.setMethod(zipEntry.DEFLATED)
zipOutputStream.putNextEntry(zipEntry)
Try
fileInputStream = New FileInputStream(file2Zip)
Try
CopyStream(fileInputStream, zipOutputStream)
Finally
fileInputStream.close()
End Try
Catch e As Exception
created = False
Finally
zipOutputStream.closeEntry()
End Try
Next
End If
Catch e As Exception
created = False
Finally
If Not IsNothing(zipOutputStream) Then
zipOutputStream.close()
End If
End Try
Return created
End Function
Por favor espero que me ayudes un poco
zipOutputStream = New ZipOutputStream(New FileOutputStream(zipPath))
Y este es la parte del código fuente.
Public Shared Function createZip(ByVal zipPath As String, ByVal files2Zip As System.Collections.ArrayList) As Boolean
Dim zipOutputStream As ZipOutputStream = Nothing
Dim zipEntry As ZipEntry
Dim fileInputStream As FileInputStream
Dim file2Zip As String
Dim auxObj As Object
Dim created = True
Try
zipOutputStream = New ZipOutputStream(New FileOutputStream(zipPath))
If Not IsNothing(files2Zip) Then
For Each auxObj In files2Zip
file2Zip = CType(auxObj, String)
zipEntry = New ZipEntry(Path.GetFileName(file2Zip))
zipEntry.setMethod(zipEntry.DEFLATED)
zipOutputStream.putNextEntry(zipEntry)
Try
fileInputStream = New FileInputStream(file2Zip)
Try
CopyStream(fileInputStream, zipOutputStream)
Finally
fileInputStream.close()
End Try
Catch e As Exception
created = False
Finally
zipOutputStream.closeEntry()
End Try
Next
End If
Catch e As Exception
created = False
Finally
If Not IsNothing(zipOutputStream) Then
zipOutputStream.close()
End If
End Try
Return created
End Function
Por favor espero que me ayudes un poco
1 respuesta
Respuesta de Roberto Alvarado
1