Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    3

    Exclamation Unanswered: URGENT java.io.UTFDataFormatException

    Hi!

    I am using PostgreSQL 7.2 on windows 2000. I am working on a java application and I am encrypting an object and saving it to my database.
    Here is exacltly what I am doing:

    1. I encrypt an array using a SealedObject
    2. Then I encode this SealedObject with BASE64 Encoder
    3. The BASE64 Encoder converts my SealedObject to a large String and I save it to the db. I store it as "bytea"
    4. I then retrieve this String from the db when I want it and I Decode it using BASE64 Decoder
    5. I now have a SealedObject that I can unseal and be left with my original Array

    My problem is that when I retrieve my String from the Database and try to Decode it I get the following exception:

    java.io.UTFDataFormatException
    at java.io.ObjectInputStream$BlockDataInputStream.rea dUTFSpan(ObjectInputStream.java:2966)
    at java.io.ObjectInputStream$BlockDataInputStream.rea dUTFBody(ObjectInputStream.java:2891)
    etc.....

    If I don't put the String into the database and decode it it works fine. So it looks as if somethingis happening to my String when I retrieve it from my database.

    Could Postgres being storing my String in some way that I am losing some of the data?

    I'd appreciate and help with this,

    Thanks,

    Brian

  2. #2
    Join Date
    Feb 2004
    Posts
    3

    Re: URGENT java.io.UTFDataFormatException

    I have looked at this further and found that the the String that I isert into the database is different from the one that I retrieve. The first line of characters is the same but after that they are different.

    Does anyone have any idea why this String would change after being stored in Postgres?

    Cheers,

    B

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •