File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String to Value and DataFormatException

 
Maureen Charlton
Ranch Hand
Posts: 218
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Paul Speijers
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What situation will you be using the Exception for?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic