The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Validation of database path, port number and ip address Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Validation of database path, port number and ip address" Watch "Validation of database path, port number and ip address" New topic
Author

Validation of database path, port number and ip address

Bably Das
Greenhorn

Joined: Sep 17, 2009
Posts: 28
Hello,

Just wanted to know if it is really necessary to validate the database path, port number and ip address in the assignment? I have a line in my assignment which says -
No authentication is required for database access.


My deadline is approaching so wanted to be sure if I can pass without doing it?

Thanks,
Bably Das


SCJP 1.5, SCJD (URLyBird 1.3.2)
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5597
    
  15

Authentication has nothing to do with validations.

In my assignment I did lots of validations and I also limited the user input (for example: no chars can be entered in the port number field, only digits). I think you can pass without validating them, because it's not a must requirement. But how will your application react if I enter 'abcd' as port number. I don't think your application crashing (and showing a NumberFormatException) will result in a nice score.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Bably Das
Greenhorn

Joined: Sep 17, 2009
Posts: 28
Thanks Roel for the reply. Yeah being new to software development world I was a bit confused about authentication and validations. I am doing the following validations:

1. Port number - allowing user to enter only digits upto maximum of 5 and then checking if the number entered is between 0-65535.
2. Database location - If a file exists in the location specified by user and can be read and written to. I decided not do any validations on the magic cookie.
3. IP address - if it is in the correct format ie, A valid ip-address must be in the form of xxx.xxx.xxx.xxx, where xxx is a number from 0-255.
I have decided to stick to ip-address as I found it difficult to validate the host name, hope thats acceptable.
4. customer id - A user can enter only positive numbers in the customer Id field and that must be 8 digits for it to be accepted as a valid customer id.

Hope thats sufficient to pass.
Thanks,
Bably Das
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5597
    
  15

Bably Das wrote:Hope thats sufficient to pass.

No need to worry
Bably Das
Greenhorn

Joined: Sep 17, 2009
Posts: 28
No need to worry


Thanks Roel for the confirmation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validation of database path, port number and ip address