• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

identify exception

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my problem is that....at the time of developing application we don't pass (anyintnumber/0) then no exception occurs because i didn't think about that but when

i deploy the application my client enter (anyintnumber/0) and exception occurs.....

at the time of developing how will i know that if user enter anyintnumber/o exception occurs...

any mechanism for checking or it's depend on developer to think about that then it's very big burden on programmer.....


 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ritesh raushan wrote:any mechanism for checking or it's depend on developer to think about that then it's very big burden on programmer.....


That's exactly one of the reasons why programming is hard. If you're the developer, you have to think carefully about what happens with any input given to the program.
 
Ranch Hand
Posts: 72
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it depends on you how you plug those loop holes that can cause you application to fail, you cannot expect user to enter only definite set of values when there is not restriction. User intentionally or unintentionally can enter any figure, its up to you how you handle it.
In the example mentioned, you can even match whether its a number or not before parsing it.

Regards
Nir
 
Ranch Hand
Posts: 216
Tomcat Server Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i deploy the application my client enter (anyintnumber/0) and exception occurs.....


This is why we call them exceptions.
You can expect them at run time but nothing is guaranteed, an exception may or may not occur at run time.
 
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic