how to fix the errors?

package app.util;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

import app.obj.Book;


public class BookDatabaseReader
{

    public BookDatabaseReader()
    {
        bookDatabase = new File("C:"+File.separator+"User"+File.separator+"Marissa"+File.separator+"Desktop"+File.separator+"eto na"+File.separator+"dat"+File.separator+"bookdb.txt");
    }

    public List<Book> getAllBooks()
    {
        List<Book> bookList;
        bookList = new ArrayList<Book>();
        BufferedReader reader = null;
        reader = new BufferedReader(new FileReader(bookDatabase));
        for(String str = ""; (str = reader.readLine()) != null;)
        {
            InformationCutter infoCut = new InformationCutter();
            app.obj.Book book = infoCut.getBookInformation(str, "book");
            bookList.add(book);
        }

        break MISSING_BLOCK_LABEL_150;
        FileNotFoundException e;
        e.printStackTrace();
        if(reader != null)
            try
            {
                reader.close();
            }
            catch(IOException e)//Duplicate parameter e//
            {
                e.printStackTrace();
            }
        break MISSING_BLOCK_LABEL_168;
        e;//Syntax error, insert "AssignmentOperator Expression" to complete Expression//
        e.printStackTrace();
        if(reader != null)
            try
            {
                reader.close();
            }
            catch(IOException e)//Duplicate parameter e//
            {
                e.printStackTrace();
            }
        break MISSING_BLOCK_LABEL_168;
        Exception exception;
        exception; //Syntax error, insert "AssignmentOperator Expression" to complete Expression//
        if(reader != null)
            try
            {
                reader.close();
            }
            catch(IOException e)//Duplicate parameter e//
            {
                e.printStackTrace();
            }
        throw exception;
        if(reader != null)
            try
            {
                reader.close();
            }
            catch(IOException e)//Duplicate parameter e//
            {
                e.printStackTrace();
            }
        return bookList;
    }

    private File bookDatabase;
}

Edited 6 Years Ago by loveu: n/a

The problem with the so called duplicate parameter is cause you are reusing the identifier 'e', for every exception you are trying to catch even though you have already used up that identifier here:-

FileNotFoundException e

Try using some other identifiers like 'ex' or 'ioe' etc, the Java rules for identifiers are flexible enough to for you to not have to stick to just one name over and over again.

Regarding the other errors:-

e;//Syntax error, insert "AssignmentOperator Expression" to complete Expression//
Exception exception;
        exception; //Syntax error, insert "AssignmentOperator Expression" to complete Expression//

The above snippets from you code do not do anything so deleting them will not have any effect on your program, but just out of curiosity what are you trying to attempt there ???

Edited 6 Years Ago by stephen84s: n/a

I am attempting to make a web browser and that is the bookmarks that I am attempting to write to txt files.

This article has been dead for over six months. Start a new discussion instead.