Changeset 1084


Ignore:
Timestamp:
02/18/13 09:30:13 (11 years ago)
Author:
pharms
Message:
  • forwarded problems in GUI element mapping to parser to allow better handling of this exception
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/GUIElementTree.java

    r1068 r1084  
    126126     * @param guiElementSpec 
    127127     *            the GUI element specification 
     128     *             
     129     * @throws GUIModelException if the GUI element can not be added to the underlying GUI model 
    128130     */ 
    129131    public void add(T guiElementID, 
    130132                    T parentID, 
    131133                    IGUIElementSpec guiElementSpec) 
     134        throws GUIModelException 
    132135    { 
    133136        IGUIElement guiElement = guiElements.get(guiElementID); 
     
    158161            } 
    159162 
    160             try { 
    161                 guiElement = guiModel.integratePath(guiElementPath, guiElementFactory); 
    162             } 
    163             catch (GUIModelException e) { 
    164                 throw new RuntimeException("could not instantiate GUI element with id " + guiElementID, e); 
    165             } 
     163            guiElement = guiModel.integratePath(guiElementPath, guiElementFactory); 
    166164            guiElements.put(guiElementID, guiElement); 
    167165        } 
  • trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/HTMLLogParser.java

    r1069 r1084  
    2525import de.ugoe.cs.autoquest.eventcore.IEventType; 
    2626import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel; 
     27import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModelException; 
    2728import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 
    2829import de.ugoe.cs.autoquest.plugin.html.eventcore.HTMLEventTypeFactory; 
     
    133134 
    134135        if (specification != null) { 
    135             super.getGUIElementTree().add(id, parentId, specification); 
     136            try { 
     137                super.getGUIElementTree().add(id, parentId, specification); 
     138            } 
     139            catch (GUIModelException e) { 
     140                throw new SAXException("could not handle GUI element with id " + 
     141                                       id + ": " + e.getMessage(), e); 
     142            } 
    136143            return true; 
    137144        } 
     
    174181            HTMLEventTypeFactory.getInstance().getEventType(type, parameters, target); 
    175182         
    176         Event event = new Event(eventType, target); 
    177  
    178         String timestampStr = parameters.get("timestamp"); 
    179          
    180         if (timestampStr != null) { 
    181             event.setTimestamp(Long.parseLong(timestampStr)); 
    182         } 
    183  
    184         ((HTMLGUIElement) event.getTarget()).markUsed(); 
    185          
    186         super.addToSequence(event); 
     183        if (eventType != null) { 
     184            Event event = new Event(eventType, target); 
     185 
     186            String timestampStr = parameters.get("timestamp"); 
     187         
     188            if (timestampStr != null) { 
     189                event.setTimestamp(Long.parseLong(timestampStr)); 
     190            } 
     191 
     192            ((HTMLGUIElement) event.getTarget()).markUsed(); 
     193         
     194            super.addToSequence(event); 
     195        } 
     196        // else ignore unknown event type 
    187197 
    188198        return true; 
  • trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/JFCSimplifiedLogParser.java

    r1058 r1084  
    3838import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree; 
    3939import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel; 
     40import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModelException; 
    4041import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 
    4142import de.ugoe.cs.autoquest.keyboardmaps.VirtualKey; 
     
    397398        } 
    398399        else if (qName.equals("component") && currentGUIElementHash != null) { 
    399             currentGUIElementTree.add(currentGUIElementHash, currentParentHash, 
    400                                       currentGuiElementSpec); 
     400            try { 
     401                currentGUIElementTree.add(currentGUIElementHash, currentParentHash, 
     402                                          currentGuiElementSpec); 
     403            } 
     404            catch (GUIModelException e) { 
     405                throw new SAXException("could not handle GUI element with hash " + 
     406                                       currentGUIElementHash + ": " + e.getMessage(), e); 
     407            } 
    401408            List<Event> unhandledEvents = eventsWithoutTargets.get(currentGUIElementHash); 
    402409            if (unhandledEvents != null) { 
  • trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/HandlerCreate.java

    r1028 r1084  
    1515package de.ugoe.cs.autoquest.plugin.mfc; 
    1616 
     17import org.xml.sax.SAXException; 
     18 
    1719import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree; 
     20import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModelException; 
    1821import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec; 
    1922import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCGUIElementSpec; 
     
    8992     */ 
    9093    @Override 
    91     public void onEndElement() { 
     94    public void onEndElement() throws SAXException { 
    9295        if (hwnd != 0) { 
    9396                IGUIElementSpec spec = new MFCGUIElementSpec(hwnd, guiElementName, resourceId, className, isModal); 
    94             super.getGUIElementTree().add(hwnd, parentHwnd, spec); 
     97            try { 
     98                super.getGUIElementTree().add(hwnd, parentHwnd, spec); 
     99            } 
     100            catch (GUIModelException e) { 
     101                throw new SAXException("could not handle GUI element with handle " + 
     102                                       hwnd + ": " + e.getMessage(), e); 
     103            } 
    95104        } 
    96105    } 
  • trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/MessageHandler.java

    r1028 r1084  
    1414 
    1515package de.ugoe.cs.autoquest.plugin.mfc; 
     16 
     17import org.xml.sax.SAXException; 
    1618 
    1719import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree; 
     
    7375     * Called in the endElement() method of {@link MFCLogParser} when a msg-node ends. 
    7476     * </p> 
     77     *  
     78     * @throws SAXException if the msg-node could not be processed for some reason 
    7579     */ 
    76     public void onEndElement() {} 
     80    public void onEndElement() throws SAXException {} 
    7781 
    7882    /** 
Note: See TracChangeset for help on using the changeset viewer.