• 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

String to Value and DataFormatException

 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have just completed two searches in the history on StringtoValue and DataFormatException. I looked at these in the API and required more information so I went to history but unfortunately it returned no results.

Could someone suggest where to look to find out more about these?

Should I be using DataFormatException instead of the Parse Exception?

Thanking you in advance.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What situation will you be using the Exception for?
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you considering calling existing methods that might throw these exceptions? Or are you considering extending these exceptions in your own classes?
 
Maureen Charlton
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
marc and Paul,

Firstly, thank you for responding to my thread.

I have actually worked out the Exception to use so I have no problems now.

However, I would still be interest on when and what these are for?

I was originally having a date format of four digits.
The date was a String (it had to be as one came in as 0181 and zero is not seen as an integer, instead it was hex as it started with zero).

I was then using the ParseException to change the string to a date format.

My correct code in the end was as follows:


Again, thank you for your help!
 
Paul Speijers
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure about the DataFormatException, it's in the Zip package so I guess it has something to do with files within zipfiles having the wrong format. The ParseException however in general occurs when you try to convert a string literal to a primitive with one of the wrapper classes.
 
This will take every ounce of my mental strength! All for a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic