I have an issue encoding an element list.
I have a test whereby I have a message buffer 1024 bytes, the message contains an eleement list, containing a string element followed by an element containing a vector. The test is to encode refresh messages increasing the string element by one byte. ElementEntry.encodeInit throws an illegalArgumentException. This is because it is calling ByteBuffer.position(1025).
I expect to get a BUFFER_TOO_SMALL response after which I can encodeComplete(false) the elemententry, encodeComplete(true) the ElementList and Message and write the buffer.
Error occurs on UPA 7.4 and 8. I have enclosed the stack trace for 8
Data from breakpoint on IllegalArgumentException
params to HeapByteBuffer
this HeapByteBuffer (id=153)
arg0 1025
Eclipse Stack trace
TestFragmentationPublish [JUnit]
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner at localhost:52870
Thread [main] (Suspended (exception IllegalArgumentException))
HeapByteBuffer(Buffer).position(int) line: 236
T(BA).C(int) line: not available
K.A(EncodeIterator, ElementEntry, int) line: not available
x.encodeInit(EncodeIterator, int) line: not available
ElementListStateEncoder.encodeField(EncodeIterator, IPubField) line: 345
ElementListStateEncoder.submit(long, List<IPubField>) line: 92
AgoraElementTestPayload(ElementListPayload).getRefresh(IElementListState) line: 72
AgoraElementTestPayload(ElementListPayload).getRefresh(ICompositeState) line: 1
ElementListUpdater(CompositeUpdater<S>).getRefresh(S) line: 186
ElementListCompositeSubmitter.getRefresh(EncoderContext, ICompositeState) line: 36
JUTestSubmitter.submitRefresh(EncoderContext, IUpdaterProxy) line: 89
ElementListCompositeSubmitter(MessageSubmitter).submitRefresh(EncoderContext) line: 38
PublishStream.publish(PublishRequest) line: 276
TestFragmentationPublish.t003_testSubmitElementListRefresh() line: 128
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 601
FrameworkMethod$1.runReflectiveCall() line: 47
FrameworkMethod$1(ReflectiveCallable).run() line: 12
FrameworkMethod.invokeExplosively(Object, Object...) line: 44
InvokeMethod.evaluate() line: 17
RunBefores.evaluate() line: 26
RunAfters.evaluate() line: 27
BlockJUnit4ClassRunner(ParentRunner<T>).runLeaf(Statement, Description, RunNotifier) line: 271
BlockJUnit4ClassRunner.runChild(FrameworkMethod, RunNotifier) line: 70
BlockJUnit4ClassRunner.runChild(Object, RunNotifier) line: 50
ParentRunner$3.run() line: 238
ParentRunner$1.schedule(Runnable) line: 63
BlockJUnit4ClassRunner(ParentRunner<T>).runChildren(RunNotifier) line: 236
ParentRunner<T>.access$000(ParentRunner, RunNotifier) line: 53
ParentRunner$2.evaluate() line: 229
RunBefores.evaluate() line: 26
RunAfters.evaluate() line: 27
BlockJUnit4ClassRunner(ParentRunner<T>).run(RunNotifier) line: 309
JUnit4TestMethodReference(JUnit4TestReference).run(TestExecution) line: 50
TestExecution.run(ITestReference[]) line: 38
RemoteTestRunner.runTests(String[], String, TestExecution) line: 459
RemoteTestRunner.runTests(TestExecution) line: 675
RemoteTestRunner.run() line: 382
RemoteTestRunner.main(String[]) line: 192
Thread [ReaderThread] (Running)
C:\Program Files (x86)\Java\jdk1.7.0_06\bin\javaw.exe (5 Apr 2016 10:42:55)