Issue 15483

IPT can issue bad requests to registry

15483
Reporter: trobertson
Type: Bug
Summary: IPT can issue bad requests to registry
Priority: Major
Status: Open
Created: 2014-04-02 11:41:43.054
Updated: 2016-11-29 12:54:35.518
        
Description: Tim has observed this from an IPT in Spain directly.

ERROR [2014-04-02 11:39:58,021+0200] [http-bio-8080-exec-19301] org.gbif.registry.ws.model.LegacyDataset: Owning organization key is not a valid UUID:
ERROR [2014-04-02 11:39:58,147+0200] [http-bio-8080-exec-19301] org.gbif.ws.server.provider.ValidationExceptionMapper: Validation error when calling method 'public int org.gbif.registry.ws.resources.BaseNetworkEntityResource.addContact(java.util.UUID,org.gbif.api.model.registry.Contact)' with arguments [71d46a30-f762-11e1-a439-00145eb45e9a, Contact{key=null, type=ADMINISTRATIVE_POINT_OF_CONTACT, primary=true, firstName=Francesc Uribe, lastName=null, position=null, description=null, email=furibe@mail.bcn.es, phone=NA, organization=null, address=P.Picasso, Barcelona, Catalunya ES, 08003, city=null, province=null, country=null, postalCode=null, createdBy=e8eada63-4a33-44aa-b2fd-4f71efb222a0, modifiedBy=e8eada63-4a33-44aa-b2fd-4f71efb222a0,
Created: null, modified=null}]
javax.validation.ConstraintViolationException: Validation error when calling method 'public int org.gbif.registry.ws.resources.BaseNetworkEntityResource.addContact(java.util.UUID,org.gbif.api.model.registry.Contact)' with arguments [71d46a30-f762-11e1-a439-00145eb45e9a, Contact{key=null, type=ADMINISTRATIVE_POINT_OF_CONTACT, primary=true, firstName=Francesc Uribe, lastName=null, position=null, description=null, email=furibe@mail.bcn.es, phone=NA, organization=null, address=P.Picasso, Barcelona, Catalunya ES, 08003, city=null, province=null, country=null, postalCode=null, createdBy=e8eada63-4a33-44aa-b2fd-4f71efb222a0, modifiedBy=e8eada63-4a33-44aa-b2fd-4f71efb222a0,
Created: null, modified=null}]
	at org.apache.bval.guice.ValidateMethodInterceptor.invoke(ValidateMethodInterceptor.java:82) ~[bval-guice-0.5.jar:0.5]
	at org.gbif.registry.ws.resources.legacy.IptResource.updateDataset(IptResource.java:331) ~[IptResource.class:na]
	at sun.reflect.GeneratedMethodAccessor3384.invoke(Unknown Source) ~[na:na]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.j

[~kbraak] for info]]>
    


Author: trobertson@gbif.org
Created: 2014-04-02 12:23:06.869
Updated: 2014-04-02 12:23:06.869
        
This is now sorted for the Spain IPT.

This issue was:
  phone=NA

failed validation for the contact.

This is a genuine bug in the registry validation  
    


Author: trobertson@gbif.org
Created: 2014-04-02 14:32:58.314
Updated: 2014-04-02 14:32:58.314
        
We need to improve logging on validation in the registry, and consider if the IPT needs better form validation as well (I'd expect so).


    


Author: kbraak@gbif.org
Comment: Issue related to POR-512 (first time this type of problem was encountered), and depends on https://code.google.com/p/gbif-providertoolkit/issues/detail?id=1038
Created: 2014-04-02 17:41:58.467
Updated: 2014-04-02 17:41:58.467


Author: kbraak@gbif.org
Comment: I'm surprised phone=NA was the culprit, since in our Registry DB contact.phone is type text[] and has no minimum length contraints. Looks like the registry validation is stricter than it needs to be. 
Created: 2015-05-13 12:31:35.772
Updated: 2015-05-13 12:31:35.772


Author: kbraak@gbif.org
Created: 2016-11-29 12:54:35.518
Updated: 2016-11-29 12:54:35.518
        
Documenting another related issue as discussed [~cgendreau]

When creating a new dataset with primary contact having an email address with domain "euskadi.eus", registration would fail because this email address fails validation (done by the EmailValidator from commons-validator).

Upgrading from commons-validator 1.4.0 to 1.5.1 fixes this problem, see: https://github.com/gbif/registry/commit/83b1bbc129dbb7ad4d7efb2cfb925472312ba967