Results 1 to 7 of 7
  1. #1
    meghaladevi is offline Member
    Join Date
    Oct 2010
    Posts
    4
    Rep Power
    0

    Default ZipInputStream Throws Illegalargument exception for diacritics

    Hi,


    If I run the below program with the zip file which has some files with diacritic characters (e.g 1-2GF-969##JÖN.pdf) , I get IllegalArgumentException.

    My application has to support all languages. So, we set encoding to UTF-8


    All languages work fine. But the problem comes when reading diacritic characters.

    I tried using alternatives to zip input stream, like arcmexer, but it does not support Chinese characters.

    Please help me with this.

    private static void readUsingJava() {
    ZipInputStream zis;
    try {
    zis = new ZipInputStream(new FileInputStream("C:\\Check.zip"));
    ZipEntry ze;
    while ((ze = zis.getNextEntry()) != null) {
    System.out.println("Name of the File Is :: " + ze.getName());
    }
    zis.close();
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }
    }

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,442
    Rep Power
    18

    Default

    Where is the exception being thrown from?
    Have you got the stacktrace?

  3. #3
    meghaladevi is offline Member
    Join Date
    Oct 2010
    Posts
    4
    Rep Power
    0

    Default

    Hi
    Thanks for your reply

    Here is the stack trace

    <java.lang.IllegalArgumentException>
    <at java.util.zip.ZipInputStream.getUTF8String(ZipInpu tStream.java:299)>
    <at java.util.zip.ZipInputStream.getNextEntry(ZipInput Stream.java:73)>
    <at java.util.zip.ZipInputStream.readLOC(ZipInputStrea m.java:238)>
    <at com.hp.gpp.massupload.util.FileHandler.getTotalNoO fFilesinZip(FileHandler.java:153)>
    <at com.hp.gpp.massupload.dao.DocumentDAO.updateDocume nts(DocumentDAO.java:1995)>
    <at com.hp.gpp.massupload.handler.LoadProcessor.update Load(LoadProcessor.java:350)>
    <at com.hp.gpp.massupload.action.UpdateLoadAction.exec ute(UpdateLoadAction.java:153)>
    <at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:431)>
    <at com.hp.bco.pl.wpa.action.WPARequestProcessor.proce ss(WPARequestProcessor.java:200)>
    <at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1196)>
    <at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:432)>
    <at javax.servlet.http.HttpServlet.service(HttpServlet .java:763)>
    <at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)>
    <at weblogic.servlet.internal.StubSecurityHelper$Servl etServiceAction.run(StubSecurityHelper.java:225)>
    <at weblogic.servlet.internal.StubSecurityHelper.invok eServlet(StubSecurityHelper.java:127)>
    <at weblogic.servlet.internal.ServletStubImpl.execute( ServletStubImpl.java:266)>
    <at weblogic.servlet.internal.TailFilter.doFilter(Tail Filter.java:26)>
    <at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:42)>
    <at com.hp.gpp.massupload.filter.EncodingFilter.doFilt er(EncodingFilter.java:33)>
    <at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:42)>
    <at com.hp.websat.timber.transaction.TransactionLoggin gFilter.doFilter(TransactionLoggingFilter.java:113 )>
    <at weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:42)>
    <at weblogic.servlet.internal.WebAppServletContext$Ser vletInvocationAction.run(WebAppServletContext.java :3160)>
    <at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)>
    <at weblogic.security.service.SecurityManager.runAs(Se curityManager.java:121)>
    <at weblogic.servlet.internal.WebAppServletContext.sec uredExecute(WebAppServletContext.java:1973)>
    <at weblogic.servlet.internal.WebAppServletContext.exe cute(WebAppServletContext.java:1880)>
    <at weblogic.servlet.internal.ServletRequestImpl.run(S ervletRequestImpl.java:1309)>
    <at weblogic.work.ExecuteThread.execute(ExecuteThread. java:207)>
    <at weblogic.work.ExecuteThread.run(ExecuteThread.java :179)>
    <Error.jsp :: Setting archive file to null>

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

  5. #5
    meghaladevi is offline Member
    Join Date
    Oct 2010
    Posts
    4
    Rep Power
    0

    Default

    Hi DB,

    Thanks a lot for your help.
    This works fine with Apache commons compress and Winzip - latest version - 14.5.
    I tried with evaluation version of WinZIP.


    We have got license for Winzip 9 only. It does not work with Winzip 9 and apache :-)
    So, I'm trying to find some alternative solutions. If you know, kindly help.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,442
    Rep Power
    18

    Default

    Did you read Darryls post above?
    The one where you appear to have spammed a load of forums with this question without informing any of them of the other places you posted?

  7. #7
    meghaladevi is offline Member
    Join Date
    Oct 2010
    Posts
    4
    Rep Power
    0

    Default Sorry

    Sorry for that Tolls
    I urgently needed the answer. So, I posted like that.

    Henceforth I will give references if i post in other forums.
    Sorry for the inconvenience caused.

Similar Threads

  1. throws exception
    By simorgh in forum New To Java
    Replies: 1
    Last Post: 07-30-2010, 12:24 AM
  2. JButton: getLocationOnScreen() throws Exception
    By ExceptionHandler in forum AWT / Swing
    Replies: 10
    Last Post: 02-15-2010, 01:38 PM
  3. Applet throws exception while recording
    By Basit56 in forum Java Applets
    Replies: 1
    Last Post: 08-20-2009, 01:42 PM
  4. Exception throws when I read File
    By Juggler in forum New To Java
    Replies: 11
    Last Post: 08-18-2008, 06:09 PM
  5. throws Exception
    By javaplus in forum New To Java
    Replies: 1
    Last Post: 11-06-2007, 07:32 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •