Issue 17250
registry SQL error when running dwca metasync
17250
Reporter: mdoering
Assignee: mdoering
Type: Bug
Summary: registry SQL error when running dwca metasync
Priority: Blocker
Resolution: Fixed
Status: Closed
Created: 2015-02-17 18:30:58.444
Updated: 2015-02-18 12:34:00.388
Resolved: 2015-02-18 12:32:03.672
Description: When posting an EML doc during dwca metasync for wikipedia to /dataset/cbb6498e-8927-405a-916b-576d00a6289b/document we get an exception
See POR-2654 for original details.
-----
HTTP ERROR 500
Problem accessing /dataset/cbb6498e-8927-405a-916b-576d00a6289b/document. Reason:
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: new row for relation "contact" violates check constraint "contact_last_name_check"
Detail: Failing row contains (69710, null, , null, null, null, null, null, null, crawler.gbif.org, crawler.gbif.org, 2015-02-16 17:50:02.520982+01, 2015-02-16 17:50:02.520982+01, , {}, {}, {}, {}, {}, {}).
### The error may involve org.gbif.registry.persistence.mapper.ContactMapper.createContact-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO contact( user_id,first_name,last_name,description,position,email,phone,homepage,organization,address,city,province,country,postal_code,created,created_by,modified,modified_by ) VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, now(), ?, now(), ? )
### Cause: org.postgresql.util.PSQLException: ERROR: new row for relation "contact" violates check constraint "contact_last_name_check"
Detail: Failing row contains (69710, null, , null, null, null, null, null, null, crawler.gbif.org, crawler.gbif.org, 2015-02-16 17:50:02.520982+01, 2015-02-16 17:50:02.520982+01, , {}, {}, {}, {}, {}, {}).
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:154)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.ibatis.session.SqlSessionManager$SqlSessionInterceptor.invoke(SqlSessionManager.java:285)
at com.sun.proxy.$Proxy45.insert(Unknown Source)
at org.apache.ibatis.session.SqlSessionManager.insert(SqlSessionManager.java:198)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:51)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy47.createContact(Unknown Source)
at org.gbif.registry.persistence.WithMyBatis.addContact(WithMyBatis.java:112)
at org.gbif.registry.ws.resources.DatasetResource.replaceContacts(DatasetResource.java:513)
]]>
Author: trobertson@gbif.org
Created: 2015-02-17 18:46:03.451
Updated: 2015-02-17 18:46:03.451
This should presumably return 400 http right, but I suppose it is returning 5xx?
Looks like
a) client should not be posting a contact with no name, no email (pointless contact)
b) service is missing validation (annotations missing perhaps?)