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 1040595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:14:37+00:00 2026-05-16T15:14:37+00:00

I am working in an application development. On that application i am performing files

  • 0

I am working in an application development. On that application i am performing files store, retrieve and delete operations. For identifying the files on server i am using an index(a hash map file) file. every time when i perform upload operation i update “index” file and upload “index” file on server along with other uploading files.

For performing delete operation first i am retrieving the “index” file and based on the index i am deleting the files from server and after updating “index” file i again upload “index” file on server.

I am able to perform file uploading operation successfully but while performing delete operation, i am getting “java.io.EOFException” exception, when i am trying to retrieve “index” file.

i am writing following code to download “index” file from FTPS server

//download index file
if (service.retrFile("INDEX", "") == service.OK) {
    try {
        ObjectInputStream objIn = new ObjectInputStream(new FileInputStream("INDEX"));
        try {
       Map<String, FileData> filesUploaded = (HashMap<String, FileData>) objIn.readObject();

        } catch (ClassNotFoundException ex) {
           ex.printStackTrace();
        }
        objIn.close();
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}

Where “service.ok” returns ‘0’ if it is successfully connected to FTPS server
and “FileData” contains information about file(attributes).

Same code i am using while performing uploading operation. there it is working fine with no exception. but while performing delete operation when i am retrieving “index” file i am getting exception on the statement :

Map filesUploaded = (HashMap) objIn.readObject();

Exception is :

SEVERE: null

java.io.EOFException
        at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2298)
        at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2767)
        at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:798)
        at java.io.ObjectInputStream.<init>(ObjectInputStream.java:298)
        at com.pixelvault.gui.DeleteServerFilesDialog.startDeleting(DeleteServerFilesDialog.java:447)

I have checked whether FTPS server connections are properly closed after performing corresponding operations.

I am not getting where i am doing wrong.

please give me your valuable suggestions. i thank to all your suggestions which will help me to overcome with this problem.


i am using org.apache.commons.net.ftp and “retrFile” is a method created by me for retrieving files from server.

Here is code for “retrFile”

FTPSClient ftp;

public int retrFile(String filename, String savePath) {
if (!connected) {
return ERR;
}

    FileOutputStream fout = null;
    InputStream bin = null;
    try {
        ftp.enterLocalPassiveMode();
        fout = new FileOutputStream(savePath + filename);
        bin = ftp.retrieveFileStream(filename);
        if (bin == null) {
            fout.close();
            return ERR;
        }
        byte[] b = new byte[ftp.getBufferSize()];
        int bytesRead = 0;
        while ((bytesRead = bin.read(b, 0, b.length)) != -1) {
            fout.write(b, 0, bytesRead);
        }
        ftp.completePendingCommand();
        fout.close();           
    } catch (FTPConnectionClosedException ex) {
         ex.printStackTrace();
        connected = false;
        return NOT_CONNECTED;
    } catch (IOException ex) {
         ex.printStackTrace();
        return ERR;
    } finally {
        try {
            fout.close();
        } catch (IOException ex) {
             ex.printStackTrace();
            return ERR;
        }
        try {
            if (bin != null) {
                bin.close();
            }
        } catch (IOException ex) {
             ex.printStackTrace();

            return ERR;
        }
    }
    return OK;
}
  • 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-16T15:14:37+00:00Added an answer on May 16, 2026 at 3:14 pm

    Are you sure the INDEX file is correctly downloaded?

    It’s present in the filesystem when application is closed?

    What FTP lib are you using?. i only know commons.net from Apache and i not recognice the “retrFile” file method. Could it be threaded so that the file is not completely downloaded when the readObject statement is executed?

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

Sidebar

Related Questions

I am working on an application that uses EF 4.2 and database-first development, using
I'm working on a small application that handles finances and so on. The development
I'm working at a development shop that is using outdated bug tracking software. They're
Hi I am working Android application development using titanium studio.I have developed small application.my
I am an application development intern. I'm making an application using ASP.NET MVC3 that
I'm currently working on a web application development. Our company methodology is to work
Hi i'm a newbie to iphone application development.. present i'm working on Picasa web
I'm new mobile development and i'm working on an proof of concept application on
I have a working application using python and zeromq and I would like to
I am working on splitting out an existing, working application that I currently have

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.