[ 
https://issues.apache.org/jira/browse/OPENJPA-1726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12890082#action_12890082
 ] 

Fay Wang commented on OPENJPA-1726:
-----------------------------------

The following four OpenJPA test cases fail with the same error:

TestGeneratedValues.testDefaultValues
TestGeneratedValues.testCustomSequenceGeneratorWithIndirection
TestGeneratedValues.testUUIDGenerators
TestNonstandardMappingAnnotations.testInsertAndRetrieve

Caused by: <openjpa-2.1.0-SNAPSHOT-rexported fatal general error> 
org.apache.openjpa.persistence.PersistenceException: ERROR: invalid byte 
sequence for encoding "UTF8": 0x00. Hint: This error can also happen if the 
byte sequence does not match the encoding expected by the server, which is 
controlled by "client_encoding".

This error is caused by the two auto-generated uuid values (uuidstring and 
uuidT4string) In the entity, 
org.apache.openjpa.persistence.generationtype.GeneratedValues:  

    @GeneratedValue(generator="uuid-string")
    private String uuidstring;

    @GeneratedValue(generator="uuid-type4-string")
    private String uuidT4string;

These two fields are populated in a way that 
org.apache.openjpa.lib.util.UUIDGenerator first randomly generates byte[] and 
then converts it to a String using charset "ISO-8859-1". The resulting string 
may contain 0x00, causing invalid byte sequence for encoding "UTF8": 0x00. The 
failures are not deterministic as the UUID values are randomly generated. One 
way to fix this problem is to exclude Postgres from running these four test 
cases. Any comments are welcome.

> Clean up OpenJPA test case failures for PostgreSQL
> --------------------------------------------------
>
>                 Key: OPENJPA-1726
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1726
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.1.0
>            Reporter: Fay Wang
>            Assignee: Fay Wang
>            Priority: Minor
>         Attachments: OPENJPA-1726-2.patch, OPENJPA-1726.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to