NoSuchElementException when uploading empty data

Description

When uploading a file that somehow has empty parameters, the batching process ends up with an empty list of states and breaks with the indicated exception.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 13:34:18,037 ERROR [org.zanata.async.AsyncTaskManager] (pool-8-thread-4) Exception when executing an asynchronous task.: java.util.NoSuchElementException at com.google.common.collect.Iterables.getLast(Iterables.java:784) at org.zanata.service.impl.TranslationStateCacheImpl.textFlowStateUpdated(TranslationStateCacheImpl.java:206) at org.zanata.service.impl.TranslationStateCacheImpl$Proxy$_$$_WeldClientProxy.textFlowStateUpdated(Unknown Source) at org.zanata.service.impl.TranslationUpdatedManager.textFlowStateUpdated(TranslationUpdatedManager.java:57) at org.zanata.service.impl.TranslationUpdatedManager$Proxy$_$$_WeldSubclass.textFlowStateUpdated$$super(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.weld.interceptor.proxy.TerminalAroundInvokeInvocationContext.proceedInternal(TerminalAroundInvokeInvocationContext.java:49) at org.jboss.weld.interceptor.proxy.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:77) at org.zanata.async.AsyncMethodInterceptor.aroundInvoke(AsyncMethodInterceptor.java:113) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:74) at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeAroundInvoke(InterceptorMethodHandler.java:84) at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:72) at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:56) at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:79) at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:68) at org.zanata.service.impl.TranslationUpdatedManager$Proxy$_$$_WeldSubclass.textFlowStateUpdated(Unknown Source) at org.zanata.service.impl.TranslationUpdatedManager$Proxy$_$$_WeldClientProxy.textFlowStateUpdated(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.zanata.async.AsyncMethodInterceptor.lambda$aroundInvoke$1(AsyncMethodInterceptor.java:92) at org.zanata.async.AsyncTaskManager.lambda$startTask$0(AsyncTaskManager.java:115) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

Environment

None

Status

Assignee

Sean Flanigan

Reporter

Damian Jansen

Labels

Tested Version/s

None

Components

Fix versions

Affects versions

server-3.9.0

Priority

Medium