Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313714

Summary: [DB] NULL Default String values are not stored as stmt.setNull
Product: [Modeling] EMF Reporter: Stefan Winkler <stefan>
Component: cdo.dbAssignee: Stefan Winkler <stefan>
Status: NEW --- QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3    
Version: 4.13   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 285426    
Bug Blocks:    

Description Stefan Winkler CLA 2010-05-20 08:38:31 EDT
-- Error Log from JUnit --
Class: org.eclipse.emf.cdo.tests.UnsetTest
Method: testIsSetDouble
Actual: null
Expected: null
Stack Trace:
org.eclipse.emf.cdo.tests.config.impl.ConfigTestException: Error in UnsetTest.testIsSetDouble [Combined, PostgreSQL, TCP, Native]
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTest.runBare(ConfigTest.java:431)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at org.eclipse.net4j.util.tests.AbstractOMTest.run(AbstractOMTest.java:146)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.eclipse.net4j.util.transaction.TransactionException: org.eclipse.net4j.signal.RemoteException: org.eclipse.net4j.db.DBException: org.postgresql.util.PSQLException: FEHLER: ungültige Byte-Sequenz für Kodierung »UTF8«: 0x00
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:913)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.commit(CDOTransactionImpl.java:924)
	at org.eclipse.emf.cdo.tests.UnsetTest.commitAndLoad(UnsetTest.java:522)
	at org.eclipse.emf.cdo.tests.UnsetTest.testIsSetDouble(UnsetTest.java:239)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at org.eclipse.net4j.util.tests.AbstractOMTest.runBare(AbstractOMTest.java:124)
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTest.runBare(ConfigTest.java:422)
	... 11 more
Caused by: org.eclipse.net4j.signal.RemoteException: org.eclipse.net4j.db.DBException: org.postgresql.util.PSQLException: FEHLER: ungültige Byte-Sequenz für Kodierung »UTF8«: 0x00
	at org.eclipse.net4j.signal.RequestWithConfirmation.setRemoteException(RequestWithConfirmation.java:128)
	at org.eclipse.net4j.signal.SignalProtocol.handleRemoteException(SignalProtocol.java:520)
	at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:53)
	at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:315)
	at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
	at org.eclipse.net4j.signal.Signal.runSync(Signal.java:240)
	at org.eclipse.net4j.signal.Signal.run(Signal.java:146)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.eclipse.net4j.db.DBException: org.postgresql.util.PSQLException: FEHLER: ungültige Byte-Sequenz für Kodierung »UTF8«: 0x00
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeValues(HorizontalNonAuditClassMapping.java:274)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalClassMapping.writeRevision(AbstractHorizontalClassMapping.java:457)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevision(DBStoreAccessor.java:387)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writeRevisions(DBStoreAccessor.java:368)
	at org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAccessor.java:180)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:299)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:35)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
	at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:286)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:164)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:118)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
	at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:315)
	at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
	... 5 more
Caused by: org.postgresql.util.PSQLException: FEHLER: ungültige Byte-Sequenz für Kodierung »UTF8«: 0x00
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:304)
	at org.eclipse.emf.cdo.server.db.CDODBUtil.sqlUpdate(CDODBUtil.java:185)
	at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditClassMapping.writeValues(HorizontalNonAuditClassMapping.java:270)
	... 21 more
Comment 1 Stefan Winkler CLA 2010-05-20 08:43:43 EDT
This seems to be no problem in the other Databases, but PSQL does not allow NULL-bytes as String characters. Plus, this Bug might cause problems for other databases but perhaps noone has noticed so far ...

The problem is that usually, if a NULL value for a feature is stored in the database, stmt.setNull() is used to store DB-null in the database. However, if a feature is uninitialized, its default value is looked up and stored  in the database (at least if the feature is unsettable, IIRC). If that default value happens to be null, the wrong function, namely stmt.setString(column, null) is invoked which leads to the above exception for PSQL.
Comment 2 Eike Stepper CLA 2010-06-29 04:54:33 EDT
Rebasing all outstanding 3.0 problem reports to version 3.0.1
Comment 3 Eike Stepper CLA 2010-07-07 07:10:25 EDT
Fixing wrong bug version.
Comment 4 Eike Stepper CLA 2011-06-23 04:27:36 EDT
Moving all open problem reports to 4.0
Comment 5 Eike Stepper CLA 2012-06-05 07:30:31 EDT
Moving all open bug reports to 4.1 because the release is very near and it's hghly unlikely that there will be spare time to address 4.0 problems.

Please make sure that your patches can be applied against the master branch and that your problem is not already fixed there!!!
Comment 6 Eike Stepper CLA 2012-08-14 22:56:24 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 7 Eike Stepper CLA 2013-06-29 12:17:41 EDT
We'll try to address open problems in 4.3 (master) first and then port fixes back to 4.2.
Comment 8 Eike Stepper CLA 2015-07-14 02:19:18 EDT
Moving all open bugzillas to 4.5.
Comment 9 Eike Stepper CLA 2016-07-31 01:02:04 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 10 Eike Stepper CLA 2017-12-28 01:11:02 EST
Moving all open bugs to 4.7
Comment 11 Eike Stepper CLA 2019-11-08 02:15:50 EST
Moving all unresolved issues to version 4.8-
Comment 12 Eike Stepper CLA 2019-12-13 12:44:35 EST
Moving all unresolved issues to version 4.9
Comment 13 Eike Stepper CLA 2020-12-11 10:37:55 EST
Moving to 4.13.