Changeset 1531


Ignore:
Timestamp:
03/02/2012 03:20:47 PM (6 years ago)
Author:
michael.kriegel
Message:

avoiding null pointer exceptions when competencies are trying to register for migration events but migration is not used

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libs/cmion/cmionMain/src/cmion/level2/migration/MigrationUtils.java

    r366 r1531  
    5454         
    5555        public static void registerMigratingComponent(Migration competency, Migrating component){ 
    56                  
    57                 EventHandler handler = new SaveStateHandler(competency, component); 
    58                 competency.getEventHandlers().add(handler); 
    59                  
    60                 handler = new RestoreStateHandler(competency, component); 
    61                 competency.getEventHandlers().add(handler); 
     56 
     57                if (competency!= null) 
     58                { 
     59                        EventHandler handler = new SaveStateHandler(competency, component); 
     60                        competency.getEventHandlers().add(handler); 
     61 
     62                        handler = new RestoreStateHandler(competency, component); 
     63                        competency.getEventHandlers().add(handler); 
     64                } 
    6265        } 
    6366         
     
    8992         
    9093        public static void registerMigrationAwareComponent(Migration competency, MigrationAware component){ 
     94                if (competency!= null) 
     95                { 
     96                        EventHandler handler = new MigrationReceivedHandler(competency, component); 
     97                        competency.getEventHandlers().add(handler); 
    9198 
    92                 EventHandler handler = new MigrationReceivedHandler(competency, component); 
    93                 competency.getEventHandlers().add(handler); 
    94                  
    95                 handler = new SendingMigrationHandler(competency, component); 
    96                 competency.getEventHandlers().add(handler); 
    97                  
    98                 handler = new MigrationSucceededHandler(competency, component); 
    99                 competency.getEventHandlers().add(handler); 
    100                  
    101                 handler = new MigrationFailedHandler(competency, component); 
    102                 competency.getEventHandlers().add(handler); 
     99                        handler = new SendingMigrationHandler(competency, component); 
     100                        competency.getEventHandlers().add(handler); 
     101 
     102                        handler = new MigrationSucceededHandler(competency, component); 
     103                        competency.getEventHandlers().add(handler); 
     104 
     105                        handler = new MigrationFailedHandler(competency, component); 
     106                        competency.getEventHandlers().add(handler); 
     107                } 
    103108        } 
    104109         
Note: See TracChangeset for help on using the changeset viewer.