0 Replies Latest reply on Jul 14, 2010 2:02 PM by bmatson7701

    InDesignServer API - move() for anchored text chars not working


      I need to be able to clear all text in a TextFrame with the exception of any anchor control characters (unicode FFFC), so as to maintain the anchored links. Also, after clearing the text, I need to insert new text, and then move all anchored chars to the end of the text, so that if the story has linked text frames that overflow text to eachother, the anchored chars remain in the last frame of the linked set.


      So, to illustrate the process I'm trying to execute:


      I want to find all the anchored chars by calling:


      textFrame.findText()  -- after setting     application.setFindTextString("\uFFFC")


      then, I want to move all items in the resulting Text[] into the beginning of the TextFrame by calling:


      Text text = textFrame.getAllChildTexts()[0];

      text.move(kLocationOptionsAtBeginning.value, OptArg.makeVariableType(VariableTypeUtils.createObject(text)));


      then clear content by getting a Text[]  with:

      getRangeOfChildrenTexts() -- passing in the proper start index to exclude the anchor chars, and doDelete() on all of them. This leaves me with an 
      empty TextFrame containing only FFFC chars.

      Then, get the last InsertionPoint and append my new text, and then grab the anchor char Text objects and move them to the end of the TextFrame.

      All this works fine in a TextFrame, with the exception of when then TextFrame is itself also an anchored frame, meaning that another TextFrame has
      anchor control chars that point to it.  If you do this on a TextFrame that is anchored to another, the result is the InDesignServer crashes, with the
      following Exception stack trace.

      So, put more simply, when dealing with a TextFrame that is anchored to another, you cannot manipulate its own anchor chars in regards to moving
      them within itself, or moving them to another TextFrame and then reimporting them back.  All of this can be done with a non-anchored TextFrame.
      This seems like a bug to me in the IDS-especially since it is not a caught exception, but rather crashes the server? Please help.

      Exception in thread "main" org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 208 completed: Maybe
           at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectionAbort(ORBUtilSystemException.java:2400)
           at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectionAbort(ORBUtilSystemException.java:2418)
           at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readBits(SocketOrChannelConnectionImpl.java:354)
           at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.handleEvent(SocketOrChannelConnectionImpl.java:1124)
           at com.sun.corba.se.impl.transport.SelectorImpl.run(SelectorImpl.java:288)
      Caused by: org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 211  completed: No
           at com.sun.corba.se.impl.logging.ORBUtilSystemException.ioexceptionWhenReadingConnection(ORBUtilSystemException.java:2484)
           at com.sun.corba.se.impl.logging.ORBUtilSystemException.ioexceptionWhenReadingConnection(ORBUtilSystemException.java:2502)
           at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.readGIOPHeader(MessageBase.java:116)
           at com.sun.corba.se.impl.transport.CorbaContactInfoBase.createMessageMediator(CorbaContactInfoBase.java:150)
           at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readBits(SocketOrChannelConnectionImpl.java:314)
           ... 2 more
      Caused by: java.io.IOException: An existing connection was forcibly closed by the remote host
           at sun.nio.ch.SocketDispatcher.read0(Native Method)
           at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:25)
           at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
           at sun.nio.ch.IOUtil.read(IOUtil.java:200)
           at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236)
           at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readFully(SocketOrChannelConnectionImpl.java:599)
           at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.read(SocketOrChannelConnectionImpl.java:521)
           at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.readGIOPHeader(MessageBase.java:112)
           ... 4 more