question: private String guessName ( Pdu pdu ) { String villageName = "anon" ; try { Message message = messageFactory . fromPdu ( pdu ) ; switch ( message . getType ( ) ) { case OwnHomeData : case VisitedHomeData : case EnemyHomeData : Message user = message . getMessage ( "user" ) ; villageName = user . getString ( "userName" ) ; break ; case WarHomeData : WarVillage warVillage = Json . valueOf ( message . getString ( "homeVillage" ) , WarVillage . class ) ; villageName = warVillage . name ; break ; case HomeBattleReplayData : Replay replay = Json . valueOf ( message . getString ( "replay" ) , Replay . class ) ; villageName = replay . defender . name ; break ; } } catch ( RuntimeException | IOException e ) { log . warn ( "Couldn't extract name from pdu {}: {}" , pdu . getId ( ) , e . toString ( ) ) ; } return sanitize ( villageName ) ; }
target:  Try to extract the village name from a PDU.