Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-2778

ArrayIndexOutOfBoundsException when using saveDataGraph

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • Java-SDO-1.1
    • Java-SDO-Next
    • None
    • windows, java

    Description

      In my project, for every service call response, I need to use saveDataGraph to translate Datagraph to XML string. So I have a function called bind:

      public static String bind( final DataGraph graph ) throws IOException
      {
      if ( graph != null && graph.getRootObject() != null )

      { ByteArrayOutputStream os = new ByteArrayOutputStream(); Map<String, Object> options = new HashMap<String, Object>(); options.put( "DECLARE_XML", Boolean.FALSE ); SDOUtil.saveDataGraph( graph, os, options ); final String xml = os.toString(); return xml; }

      return null;
      }

      This works fine most of the time. However, if I have too many service calls, which in turn calls the bind function for too many times, the following problem happens. It seems saveDataGraph has some problem in clearing out the buffer?

      java.lang.ArrayIndexOutOfBoundsException: 8192
      at org.eclipse.emf.ecore.xmi.impl.StringSegment.writeAscii(StringSegment.java:322)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeAscii(XMLSaveImpl.java:900)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:237)
      at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:203)
      at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:993)
      at org.apache.tuscany.sdo.helper.SDOHelperImpl.saveDataGraph(SDOHelperImpl.java:220)
      at org.apache.tuscany.sdo.api.SDOUtil.saveDataGraph(SDOUtil.java:175)
      at com.abacus.aim.service.util.DataGraphUtils.bind(DataGraphUtils.java:80)
      at com.abacus.aim.service.translation.LookupQueryTranslation.processRequest(LookupQueryTranslation.java:57)
      at com.abacus.aim.service.translation.ServiceTranslation.process(ServiceTranslation.java:113)
      at sun.reflect.GeneratedMethodAccessor364.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:275)
      at org.springframework.jms.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:452)
      at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:354)
      at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:506)
      at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:463)
      at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:435)
      at org.springframework.jms.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:407)
      at org.springframework.jms.listener.SimpleMessageListenerContainer.processMessage(SimpleMessageListenerContainer.java:228)
      at org.springframework.jms.listener.SimpleMessageListenerContainer$2.onMessage(SimpleMessageListenerContainer.java:205)
      at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:946)
      at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122)
      at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192)
      at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:118)
      at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:42)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)

      Thank you very much for your help!!

      Attachments

        Activity

          People

            Unassigned Unassigned
            ywang Yao Wang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: