37. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/2/2017 7:00:17 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

37.1 Files compared

# Location File Last Modified
1 cds.zip\cds\product\production\cdsutils\src\main\java\com\cognitive\cds\utils\log Slf4jIncomingEventSender.java Fri Apr 28 17:27:00 2017 UTC
2 cds.zip\cds\product\production\cdsutils\src\main\java\com\cognitive\cds\utils\log Slf4jIncomingEventSender.java Wed Sep 27 16:03:24 2017 UTC

37.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 176
Changed 1 2
Inserted 0 0
Removed 0 0

37.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

37.4 Active regular expressions

No regular expressions were active.

37.5 Comparison detail

  1   package co m.cognitiv e.cds.util s.log;
  2  
  3   import jav a.time.Ins tant;
  4   import jav a.time.for mat.DateTi meFormatte r;
  5   import jav a.util.Has hSet;
  6   import jav a.util.Set ;
  7   import jav a.util.reg ex.Matcher ;
  8   import jav a.util.reg ex.Pattern ;
  9  
  10   import org .apache.co mmons.lang 3.StringUt ils;
  11   import org .apache.cx f.ext.logg ing.event. LogEvent;
  12   import org .apache.cx f.ext.logg ing.event. LogEventSe nder;
  13   import org .slf4j.Log ger;
  14   import org .slf4j.Log gerFactory ;
  15   import org .slf4j.MDC ;
  16  
  17   /**
  18    * A class  which out puts MDC l og formats  with the  appropriat e event ty pe 
  19    *
  20    */
  21   public cla ss Slf4jIn comingEven tSender im plements L ogEventSen der {
  22           
  23           pr ivate stat ic final L ogger LOG  = LoggerFa ctory.getL ogger(Slf4 jIncomingE ventSender .class);
  24           
  25           // "2016-10-1 9T17:38:29 .089Z"
  26           pu blic stati c final Da teTimeForm atter DATE FORMATTER  = DateTime Formatter. ISO_INSTAN T;
  27  
  28           @O verride
  29       public  void send (LogEvent  event) {
  30           Se t<String>  keys = new  HashSet<S tring>(); 
  31           tr y {
  32                    put( keys, "dat eTime", DA TEFORMATTE R.format(I nstant.now ()));
  33                put(keys , "address ", event.g etAddress( ));
  34                put(keys , "httpMet hod", even t.getHttpM ethod());
  35                put(keys , "path",  getPathAnd QueryInfo( event));
  36                
  37                switch(  event.getT ype() ) {
  38                         case REQ_I N  :  LOG. info("INCO MING REQUE ST:"); bre ak;
  39                         case REQ_O UT  : put( keys, "pat h", event. getAddress ());
  40                                                       LO G.info("OU TGOING REQ UEST:"); b reak;
  41                         case RESP_ IN  : LOG. info("INCO MING RESPO NSE:");bre ak;
  42                         case RESP_ OUT  : LOG .info("OUT GOING RESP ONSE:"); b reak;
  43                         case FAULT _IN  : LOG .info("INC OMING FAUL T:"); brea k;
  44                         case FAULT _OUT  : LO G.info("OU TGOING FAU LT:"); bre ak;
  45                         default :  LOG.info(" UNKNOWN TY PE:"); bre ak;
  46                }
  47           }  finally {
  48                for (Str ing key :  keys) {
  49                    MDC. remove(key );
  50                }
  51           }
  52           
  53       }
  54  
  55  
  56           pr ivate Patt ern pathMa tch = Patt ern.compil e("http:// .*?/.*?(/. *)");
  57           /* *
  58              * Takes a  String wit h a format  of http:/ / IP             /cds-resul ts-service /cds/invok eRules?que ry=default &param=0
  59            *  and retur ns the pat h and quer y - /cds/i nvokeRules ?query=def ault&param =0
  60            *  @param ad dress
  61            *  @return
  62            * /
  63           pr ivate Stri ng getPath AndQueryIn fo(LogEven t event) {
  64                    try  {
  65                             String  address =  event.get Address();
  66                             if( ad dress != n ull ) {
  67                                      Matcher  match = pa thMatch.ma tcher(addr ess);
  68                                      if(match .find()) {
  69                                               return Str ingUtils.d efaultIfEm pty(match. group(1)," ");
  70                                      }
  71                             }
  72                             else {
  73                                      return " MessageId  = "+event. getMessage Id();
  74                             }
  75                    }
  76                    catc h(Exceptio n e) {
  77                             LOG.er ror(e.getM essage()+"  for Messa geId : "+e vent.getMe ssageId(),  e);
  78                    }
  79                    retu rn "";
  80           }
  81           
  82       privat e void put (Set<Strin g> keys, S tring key,  String va lue) {
  83           if  (value !=  null) {
  84                MDC.put( key, value );
  85                keys.add (key);
  86           }
  87       }
  88  
  89   }