File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Bug with Data.java - Urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Bug with Data.java - Urgent" Watch "Bug with Data.java - Urgent" New topic
Author

Bug with Data.java - Urgent

Amit Kr Kumar
Ranch Hand

Joined: Feb 08, 2002
Posts: 100
Hi Team
There seems to be a bug with add(DataInfo[]) method of Data.java. This method first check whether the flight number of the new record to be added already exist in the db.db. If not found it invokes writeRecord(String[] newData) method where the new values are inserted in the db and the values which has larger length than required by Data, they are truncated.
The problem is that suppose there is already a record with flight number="SINGA" in the db.db
Now if we try to add a record with flight number "SINGAPORE-27", by invoking the add() method, then it will not find the flight number "SINGAPORE-27" in database. Thus then writeRecord() method will be invoked. Now since the length of flight number string to be added "SINGAPORE-27" is larger than expected, thus it will be truncated to "SINGA" only and then inserted into database. Thus now the database have duplicate flights.
How to overcome from this probelm ???
Pls Help
I need to upload the assignment in 1-2 days
Amit
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hey Amit,
Don't worry about it. You must assume that the database guys are aware of the constraints and besides, there is no need for you to call add() in the first place. I don't know of anyone who has concerned themselves with what you point out may be a flaw in the database schema. So just relax and make sure your client and server do what they're supposed to do.
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Mike Piotrowski
Ranch Hand

Joined: Apr 24, 2002
Posts: 82
Amit,
I would say also don't worry about it. You never need to call the add method anyways in the assignment. This may be something you might want to point out though in your desing document.
Mike
 
wood burning stoves
 
subject: Bug with Data.java - Urgent