Co-linear points are causing an exception

Description

When trying to create a polygon with co-linear latitudes hibernate spatial is throwing an exception.

Here is the text from the developer who found the issue.

The shape it is constructing is org.geolatte.geom.Polygon

SRID=4326;POLYGON((4.442222 48.633333,5.398611 48.633333,6.141667 48.633333,5.942222 48.495556,5.169167 48.389444,4.528333 48.573056,4.442222 48.633333))
Crs is org.geolatte.geom.crs.Geographic2DCoordinateReferenceSystem@969543e0

SDOGeometry it is converting it to is (2003,4326,null,null,null)

The shape consists of following 3 lines, which are being appended to make a polygon. (should it be saved as another type of shape??? Ie multi-line)
Lat1 Long1 Lat2 Long2
48.63333 4.442222 48.63333 5.398611
48.63333 5.398611 48.63333 6.141667
48.63333 6.141667 48.49556 5.942222

However as they are all on the same latitude, they will be in a straight line when persisting when using hibernate.

Here is the stack trace copied from eclipse when the actual exception is thrown.

Daemon Thread [Camel (asn-business-app) thread #2 - JmsConsumer[AIRSCAPE.DAFIF_IMPORT]] (Suspended (exception IllegalArgumentException))
NumericalMethods.isCounterClockwise(Position, Position, Position) line: 72
NumericalMethods.isCounterClockwise(PositionSequence<?>) line: 92
SdoPolygonEncoder(AbstractSDOEncoder).addPolygon(SDOGeometry, Polygon) line: 44
SdoPolygonEncoder.encode(G) line: 26
SdoPolygonEncoder.encode(Geometry) line: 12
Encoders.encode(Geometry<?>) line: 41
SDOGeometryValueBinder<J>.toNative(Geometry, Connection) line: 63
SDOGeometryValueBinder<J>.bind(PreparedStatement, J, int, WrapperOptions) line: 52
JTSGeometryType(AbstractStandardBasicType<T>).nullSafeSet(PreparedStatement, Object, int, WrapperOptions) line: 257
JTSGeometryType(AbstractStandardBasicType<T>).nullSafeSet(PreparedStatement, Object, int, SessionImplementor) line: 252
JTSGeometryType(AbstractSingleColumnStandardBasicType<T>).nullSafeSet(PreparedStatement, Object, int, boolean[], SessionImplementor) line: 39
SingleTableEntityPersister(AbstractEntityPersister).dehydrate(Serializable, Object[], Object, boolean[], boolean[][], int, PreparedStatement, SessionImplementor, int, boolean) line: 2598
SingleTableEntityPersister(AbstractEntityPersister).insert(Serializable, Object[], boolean[], int, String, Object, SessionImplementor) line: 2882
SingleTableEntityPersister(AbstractEntityPersister).insert(Serializable, Object[], Object, SessionImplementor) line: 3385
EntityInsertAction.execute() line: 89
ActionQueue.executeActions(ExecutableList<E>) line: 560
ActionQueue.executeActions() line: 434
JpaFlushEventListener(AbstractFlushingEventListener).performExecutions(EventSource) line: 337
JpaFlushEventListener(DefaultFlushEventListener).onFlush(FlushEvent) line: 39
SessionImpl.flush() line: 1282
EntityManagerImpl(AbstractEntityManagerImpl).flush() line: 1300
GeneratedMethodAccessor394.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
Method.invoke(Object, Object...) line: not available
SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(Object, Method, Object[]) line: 291
$Proxy98.flush() line: not available
SimpleJpaRepository<T,ID>.flush() line: 486
GeneratedMethodAccessor396.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
Method.invoke(Object, Object...) line: not available
RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(Object, Method, Object[]) line: 483
RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(MethodInvocation) line: 468
RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(MethodInvocation) line: 440
ReflectiveMethodInvocation.proceed() line: 179
DefaultMethodInvokingMethodInterceptor.invoke(MethodInvocation) line: 61
ReflectiveMethodInvocation.proceed() line: 179
TransactionInterceptor$1.proceedWithInvocation() line: 99
TransactionInterceptor(TransactionAspectSupport).invokeWithinTransaction(Method, Class<?>, InvocationCallback) line: 281
TransactionInterceptor.invoke(MethodInvocation) line: 96
ReflectiveMethodInvocation.proceed() line: 179
PersistenceExceptionTranslationInterceptor.invoke(MethodInvocation) line: 136
ReflectiveMethodInvocation.proceed() line: 179
CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(MethodInvocation) line: 131
ReflectiveMethodInvocation.proceed() line: 179
ExposeInvocationInterceptor.invoke(MethodInvocation) line: 92
ReflectiveMethodInvocation.proceed() line: 179
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 208
$Proxy119.flush() line: not available
RepositorySuasService(GenericDafifDataTypePersister<D,T>).addSublist(List<D>) line: 74
RepositorySuasService(GenericDafifDataTypePersister<D,T>).add(Collection<D>) line: 57
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
Method.invoke(Object, Object...) line: not available
AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[]) line: 302
ReflectiveMethodInvocation.invokeJoinpoint() line: 190
ReflectiveMethodInvocation.proceed() line: 157
TransactionInterceptor$1.proceedWithInvocation() line: 99
TransactionInterceptor(TransactionAspectSupport).invokeWithinTransaction(Method, Class<?>, InvocationCallback) line: 281
TransactionInterceptor.invoke(MethodInvocation) line: 96
ReflectiveMethodInvocation.proceed() line: 179
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 208
$Proxy120.add(Collection) line: not available
OneParseDafifProcessor<T>.process(Long, File) line: 74
DafifImportProcessor.lambda$2(ImportJobId, Long, File, DafifDataTypeProcessor) line: 350
19678733.accept(Object) line: not available
ArrayList<E>.forEach(Consumer<? super E>) line: not available
DafifImportProcessor.processFiles(Long, File, ImportJobId) line: 347
DafifImportProcessor.process(ImportJobEntry, ImportJobId) line: 189
DafifImportProcessor$$FastClassBySpringCGLIB$$e26bd991.invoke(int, Object, Object[]) line: not available
MethodProxy.invoke(Object, Object[]) line: 204
CglibAopProxy$CglibMethodInvocation.invokeJoinpoint() line: 718
CglibAopProxy$CglibMethodInvocation(ReflectiveMethodInvocation).proceed() line: 157
TransactionInterceptor$1.proceedWithInvocation() line: 99
TransactionInterceptor(TransactionAspectSupport).invokeWithinTransaction(Method, Class<?>, InvocationCallback) line: 281
TransactionInterceptor.invoke(MethodInvocation) line: 96
CglibAopProxy$CglibMethodInvocation(ReflectiveMethodInvocation).proceed() line: 179
CglibAopProxy$DynamicAdvisedInterceptor.intercept(Object, Method, Object[], MethodProxy) line: 654
DafifImportProcessor$$EnhancerBySpringCGLIB$$455a78e5.process(ImportJobEntry, ImportJobId) line: not available
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
Method.invoke(Object, Object...) line: not available
MethodInfo.invoke(Method, Object, Object[], Exchange) line: 408
MethodInfo$1.doProceed(AsyncCallback) line: 279
MethodInfo$1.proceed(AsyncCallback) line: 252
BeanProcessor.process(Exchange, AsyncCallback) line: 177
AsyncProcessorHelper.process(AsyncProcessor, Exchange) line: 109
BeanProcessor.process(Exchange) line: 68
BeanProducer.process(Exchange, AsyncCallback) line: 38
SendProcessor.process(Exchange, AsyncCallback) line: 141
InstrumentationProcessor.process(Exchange, AsyncCallback) line: 77
DefaultErrorHandler(RedeliveryErrorHandler).process(Exchange, AsyncCallback) line: 460
DefaultChannel(CamelInternalProcessor).process(Exchange, AsyncCallback) line: 190
Pipeline.process(Exchange, Exchange, AsyncCallback, Iterator<Processor>, AsyncProcessor) line: 121
Pipeline.process(Exchange, AsyncCallback) line: 83
DefaultErrorHandler(RedeliveryErrorHandler).process(Exchange, AsyncCallback) line: 460
CamelInternalProcessor.process(Exchange, AsyncCallback) line: 190
Splitter(MulticastProcessor).doProcessSequential(Exchange, AtomicExchange, Iterable<ProcessorExchangePair>, Iterator<ProcessorExchangePair>, ProcessorExchangePair, AsyncCallback, AtomicInteger) line: 668
Splitter(MulticastProcessor).doProcessSequential(Exchange, AtomicExchange, Iterable<ProcessorExchangePair>, AsyncCallback) line: 596
Splitter(MulticastProcessor).process(Exchange, AsyncCallback) line: 237
Splitter.process(Exchange, AsyncCallback) line: 104
InstrumentationProcessor.process(Exchange, AsyncCallback) line: 77
DefaultErrorHandler(RedeliveryErrorHandler).process(Exchange, AsyncCallback) line: 460
DefaultChannel(CamelInternalProcessor).process(Exchange, AsyncCallback) line: 190
Pipeline.process(Exchange, Exchange, AsyncCallback, Iterator<Processor>, AsyncProcessor) line: 121
Pipeline.process(Exchange, AsyncCallback) line: 83
CamelInternalProcessor.process(Exchange, AsyncCallback) line: 190
AsyncProcessorHelper.process(AsyncProcessor, Exchange) line: 109
CamelInternalProcessor(DelegateAsyncProcessor).process(Exchange) line: 87
EndpointMessageListener.onMessage(Message, Session) line: 112
DefaultJmsMessageListenerContainer(AbstractMessageListenerContainer).doInvokeListener(SessionAwareMessageListener, Session, Message) line: 689
DefaultJmsMessageListenerContainer(AbstractMessageListenerContainer).invokeListener(Session, Message) line: 649
DefaultJmsMessageListenerContainer(AbstractMessageListenerContainer).doExecuteListener(Session, Message) line: 619
DefaultJmsMessageListenerContainer(AbstractPollingMessageListenerContainer).doReceiveAndExecute(Object, Session, MessageConsumer, TransactionStatus) line: 307
DefaultJmsMessageListenerContainer(AbstractPollingMessageListenerContainer).receiveAndExecute(Object, Session, MessageConsumer) line: 245
DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener() line: 1144
DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop() line: 1136
DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run() line: 1033
ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available

Environment

Hibernate 5.0.5 and Oracle Locator

Status

Assignee

Karel Maesen

Reporter

Matt Shaw

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.0.5

Priority

Major