Changeset 63 in tmcsimulator for trunk/src


Ignore:
Timestamp:
03/15/2017 08:00:53 PM (9 years ago)
Author:
jdalbey
Message:

AssignedIncidents?, UnitStatus? add try-catch to prepareRenderer to handle bizarre timing exception

Location:
trunk/src/tmcsim/client/cadclientgui/screens
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/client/cadclientgui/screens/AssignedIncidents.java

    r59 r63  
    104104            public Component prepareRenderer(TableCellRenderer renderer, int row, int column) 
    105105            { 
    106                 Component comp = super.prepareRenderer(renderer, row, column); 
     106                Component comp; 
     107                // In a rare odd circumstance of timing, this exception is thrown: 
     108                // http://pastebin.com/A3tZe07a 
     109                try 
     110                { 
     111                    comp = super.prepareRenderer(renderer, row, column); 
     112                } catch (ArrayIndexOutOfBoundsException ex) 
     113                { 
     114                    // our workaround is to just return a dummy value 
     115                    // all will be redrawn in the next one second interval 
     116                    return new JLabel("?"); 
     117                } 
    107118 
    108119                comp.setForeground(Color.BLACK); 
     
    121132                        { 
    122133                            // Fetch the unit's current status from server 
    123                             UnitStatusEnums ustatus =  ScreenManager.theCoordinator.getCadDataUnitStatus(unitname); 
     134                            UnitStatusEnums ustatus = ScreenManager.theCoordinator.getCadDataUnitStatus(unitname); 
    124135                            // Decide which color to use for displaying the status 
    125136                            switch (ustatus) 
  • trunk/src/tmcsim/client/cadclientgui/screens/UnitStatus.java

    r59 r63  
    146146                    int row, int column) 
    147147            { 
    148                 Component comp = super.prepareRenderer(renderer, row, column); 
     148                Component comp; 
     149                // In a rare odd circumstance of timing, this exception is thrown: 
     150                // http://pastebin.com/f5wtSMHN 
     151                try 
     152                { 
     153                    comp = super.prepareRenderer(renderer, row, column); 
     154                } catch (ArrayIndexOutOfBoundsException ex) 
     155                { 
     156                    // our workaround is to just return a dummy value 
     157                    // all will be redrawn in the next one second interval 
     158                    return new JLabel("?"); 
     159                } 
    149160 
    150161                int unitNumColumn = 2; 
Note: See TracChangeset for help on using the changeset viewer.