Hussein,

XXE reports the following (non-fatal) exception when I try to run a 
macro I'm developing.  The macro is probably buggy, but I assume that 
you don't want to throw exceptions even for buggy macros....

The macro, its key binding, and the exception are below.

Note that the macro looks for a selection and if there is none, it first 
selects the current word.  Then it attempts to operate on the selection. 
  I only see the exception if there is no selection to begin with.  The 
current word does get selected, but nothing else happens.  If I start 
with a selection, then nothing happens.

     David

   <!-- If there is a selection, enclose it in the specified tag. -->
   <!-- If there is no selection, do it to the current word. -->
   <!-- XXX: add %2 & %3 for optional attribute name and value? -->
   <command name="djf.Enclose">
     <macro>
       <sequence>
        <!-- if there is no selection, select the current word -->
        <choice>
          <sequence>
            <pass><command name="djf.testSelection" parameter="none"/></pass>
            <command name="selectText" parameter="word"/>
          </sequence>
        </choice>

        <!-- now insert the specified tag around the selection -->
        <command name="convert" parameter="[wrapElement] %1"/>
       </sequence>
     </macro>
   </command>

   <binding> <!-- Ctrl-C I: put word or selection in italics -->
     <keyPressed code="C" modifiers="ctrl"/>
     <keyPressed code="I"/>
     <command name="djf.Enclose" parameter="emphasis"/>
   </binding>

----------------------------------------
Execution of command com.xmlmind.xmledit.command.MacroCommand
with parameter 'emphasis'
has thrown a java.lang.StringIndexOutOfBoundsException exception.
----------------------------------------
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
         at java.lang.String.charAt(String.java:460)
         at 
com.xmlmind.xmledit.command.CommandUtil.toFieldChooserInfo(CommandUtil.java:149)
         at 
com.xmlmind.xmledit.command.Convert.getFieldChooserInfo(Convert.java:188)
         at 
com.xmlmind.xmledit.command.Convert.prepareCommand(Convert.java:82)
         at 
com.xmlmind.xmledit.command.MacroCommand$Invocation.prepare(MacroCommand.java:90)
         at 
com.xmlmind.xmledit.command.MacroCommand$Sequence.execute(MacroCommand.java:202)
         at 
com.xmlmind.xmledit.command.MacroCommand.executeCommand(MacroCommand.java:245)
         at 
com.xmlmind.xmledit.gadget.Bindings.executeCommand(Bindings.java:532)
         at 
com.xmlmind.xmledit.gadget.Bindings.handleKeyEvent(Bindings.java:486)
         at 
com.xmlmind.xmledit.view.DocumentView.handleKeyEvent(DocumentView.java:3092)
         at 
com.xmlmind.xmledit.gadget.EventDispatcher.dispatchEvent(EventDispatcher.java:132)
         at 
com.xmlmind.xmledit.view.DocumentViewEventDispatcher.dispatchEvent(Do


Reply via email to