a question about stand-alone Java applications that do not have a background DB.

In our Uni class we were asked to build a very small application using JOptionPane methods such as "showInputDialog". The application asks for users name and birthdate and at the end displays a summary of these to the user. The values entered by the user is fed to a variable of type String.

After building this tiny app I am wondering if there is a way to feed it any characters that would cause it to crash. It does not seem to react to much of any "non-standard" input (such as entries starting with \n, \d, or unprintable characters from the ASCII table) but faithfully returns it all to the user.

So for this type of Java applications (which cannot suffer from SQL query related issues since they do not have a DB), is there any reason to do input validation? Does Java actually suffer from any input vulnerabilities like those in C?

Best regards,


Recommended Answers

All 3 Replies

well, if you come up with one, I would be interested to know :)

It depends on what you mean by validation. Correctly formatted email address. A name (no digits) A number(no letters)

I don't know of any way to make an application "crash" by entering stuff into a dialog, but things like invalid dates can cause an Exception to be thrown when you try to parse them- and if you don't catch and handle that properly your program will terminate.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.