Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4107244
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:28:56+00:00 2026-05-20T21:28:56+00:00

I made a program and I created an export function for documents (entries). The

  • 0

I made a program and I created an export function for documents (entries).
The procedure: The user has favorited documents. There exist 2-3 strategies
(BibTex,RIS,HTML) a user can choose to export his documents.
For each strategy a new .zip file is being generated with all documents inside.
The created .zip archives are sent to the user via email.

For me ( Windows ) it works great. I can extract those archives without any problems.
But a friend of my, who is using Mac, gets errors while extracting them and I do not know why.

Here the important code:

for ( String strategy : strategies ) {
// Coderedundanz
// Jede Strategie benötigt eigene Parameter
if (strategy.equals("BibTex")) {
    _zipName = "ezdl_export_bibtex";
    _fileExtension = ".bib";
    _strategy = csf.bibTex;
}
else if (strategy.equals("RIS")) {
    _zipName = "ezdl_export_ris";
    _fileExtension = ".ris";
    _strategy = csf.ris;
}
else if (strategy.equals("HTML")) {
    _zipName = "ezdl_export_html";
    _fileExtension = ".html";
    _strategy = csf.html;
}
else {
    _zipName = _zipExtension = "";
    _fileExtension = "";
    _strategy = null;
}

// Gibt es eine korrekte Strategie?
if ( !_zipName.equals("") && !_fileExtension.equals("") && _strategy != null) {
    // 1. .zip Datei generieren
    // 2. Für jedes TextDocument eine eigene Datei erstellen
    // 3. Datei in die .zip Datei einfügen
    // 4. .zip Datei schließen und in die E-Mail hinzufügen
    File file = File.createTempFile(_zipName + _zipExtension, ".tmp");
    ZipOutputStream out = new ZipOutputStream(new FileOutputStream(file));
    out.setLevel(6);
    for ( TextDocument document : documents ) {
        out.putNextEntry(new ZipEntry( document.getOid() + _fileExtension));

        String temp = _strategy.print ( (TextDocument) document).asString().toString();

        out.write( temp.getBytes() );
        out.closeEntry();
    }

    out.finish();
    out.close();

    PreencodedMimeBodyPart part_x = new PreencodedMimeBodyPart("base64");
    part_x.setFileName(_zipName + _zipExtension);
    part_x.setContent(new String(Base64Coder.encode( getBytesFromFile (file))), "text/plain");
    multi.addBodyPart(part_x);

    if (file.exists())
        file.delete();

You see for each strategy an own archive is being created.
The program loops through the documents (TextDocument)
and with _strategy.print you get a String as output.

As I said.. for me it works great, but not on Mac.
Are there any differences? I guess.. .zip is .zip.
Or should I create tarballs (.tar.gz) for Mac?

EDIT:

serena:tmp3 alex$ unzip ezdl_export_bibtex.zip 
Archive:  ezdl_export_bibtex.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
note:  ezdl_export_bibtex.zip may be a plain executable, not an archive
unzip:  cannot find zipfile directory in one of ezdl_export_bibtex.zip or
        ezdl_export_bibtex.zip.zip, and cannot find 

Here is a screen: http://img3.imageshack.us/i/ziperror.png. It shows the error: “Unable to unarchive – Error – 1 – Operation not permitted”

I also changed my code to:

out.write( temp.getBytes() );
out.flush();
out.closeEntry();

But still the same problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T21:28:57+00:00Added an answer on May 20, 2026 at 9:28 pm

    Although it doesn’t address your problem directly, you can verify the integrity of the zip file using the -t option on the command line.

    $ unzip -t java-puzzlers.zip | tail -1
    No errors detected in compressed data of java-puzzlers.zip.
    

    In addition, you can examine the parent directory’s permissions, walking up the path until you see a problem.

    $ ls -ld ..
    drwxr-xr-x@ 26 trashgod  staff  884 Jan 17  2010 ..
    $ ls -ld ../..
    drwx------+ 23 trashgod  staff  782 Dec 17 17:15 ../..
    

    Addendum: If it “has something to do with encoding,” I always start with Joel Spolsky’s oft-cited article on the subject. This answer may be helpful, too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a program. I also made my own file type, which the program
I have made a program in c and wanted to see, how much memory
I'm trying to automate a program I made with a test suite via a
I have a program i frequently use that is made with .NET. This program
I have made a program in Flex for creating simple schedules, similar to MS
I'm new to c++. I made a c++ program using VS 2008 Professional. I
Along with: An attempt was made to load a program with an incorrect format
We have a program made in Borland Delphi that uses Word automation to create
Days ago I created a program in Python to download stuff from the Internet,
I'll try to make myself as clear as possible. I made an installation program

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.