1973. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/18/2019 5:56:03 PM Eastern 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.

1973.1 Files compared

# Location File Last Modified
1 MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_Vistalink\VistaLink\src\main\java\gov\va\med\vistalink\adapter\spi VistaSocketConnection.java Wed Apr 3 02:27:46 2019 UTC
2 MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_Vistalink\VistaLink\src\main\java\gov\va\med\vistalink\adapter\spi VistaSocketConnection.java Mon Apr 15 17:37:40 2019 UTC

1973.2 Comparison summary

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

1973.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

1973.4 Active regular expressions

No regular expressions were active.

1973.5 Comparison detail

  1   package go v.va.med.v istalink.a dapter.spi ;
  2  
  3   import gov .va.med.ex ception.Ex ceptionUti ls;
  4   import gov .va.med.mo nitor.time .AuditTime r;
  5   import gov .va.med.ne t.SocketMa nager;
  6   import gov .va.med.ne t.VistaSoc ketExcepti on;
  7   import gov .va.med.ne t.VistaSoc ketTimeOut Exception;
  8   import io. netty.util .internal. logging.In ternalLogg er;
  9   import io. netty.util .internal. logging.Lo g4JLoggerF actory;
  10  
  11   import jav a.io.IOExc eption;
  12   import jav a.net.Conn ectExcepti on;
  13   import jav a.net.Inet Address;
  14   import jav a.net.Sock et;
  15   import jav a.net.Sock etExceptio n;
  16  
  17   /**
  18    * This cl ass repres ents a raw  socket co nnection t o a M-Serv er
  19    * 
  20    */
  21   public cla ss VistaSo cketConnec tion exten ds SocketM anager {
  22  
  23           /* *
  24            *  The logge r used by  this class
  25            * /
  26           pr ivate stat ic final I nternalLog ger LOGGER  = Log4JLo ggerFactor y.getInsta nce(VistaS ocketConne ction.clas s.getName( ) + ".Log" );
  27  
  28           /* *
  29            *  Audit log ger used b y this cla ss
  30            * /
  31           pr ivate stat ic final I nternalLog ger auditL OGGER = Lo g4JLoggerF actory.get Instance(V istaSocket Connection .class.get Name() + " .AuditLog" );
  32  
  33           /* *
  34            *  The xml r equest use d to send  a close re quest to M
  35            * /
  36           pr otected st atic final  String CL OSE_SOCKET _REQUEST =  "<VistaLi nk message Type='gov. va.med.fou ndations.v istalink.s ystem.requ est'"
  37                             + " ve rsion='"
  38                             + Vist aLinkManag edConnecti onFactory. ADAPTER_VE RSION
  39                             + "'"
  40                             + " mo de='single  call'"
  41                             + " xm lns:xsi='h ttp://www. w3.org/200 1/XMLSchem a-instance '"
  42                             + " xs i:noNamesp aceSchemaL ocation='v lSimpleReq uest.xsd'"
  43                              //+ " xmln s='http:// URL         /Foundatio ns'"
  44                             + ">"  + "<Reques t type='cl oseSocket' />" + "</V istaLink>" ;
  45  
  46           /* *
  47            *  The port  this socke t is conne cted to
  48            * /
  49           pr ivate int  port;
  50  
  51           /* *
  52            *  The ip ad dress this  socket is  connected  to
  53            * /
  54           pr ivate Inet Address ad dress;
  55  
  56           /* *
  57            *  @param ad dress
  58            *  @param po rt
  59            *  @throws V istaSocket Exception
  60            * /
  61           pr otected Vi staSocketC onnection( InetAddres s address,  int port,  String mc Identifier ) throws V istaSocket Exception  {
  62                    supe r();
  63  
  64                    this .address =  address;
  65                    this .port = po rt;
  66                    setM atchingIde ntifier(mc Identifier );
  67  
  68                    try  {
  69                             setSoc (new Socke t(this.add ress, this .port));
  70                    } ca tch (Conne ctExceptio n e) {
  71                             String  errStr =  "Connectio n Unsucces sful " + e .getMessag e();
  72                             throw  new VistaS ocketExcep tion(errSt r, e);
  73                    } ca tch (IOExc eption e)  {
  74                             String  errStr =  "Can not c reate TCP/ IP socket. ";
  75                             if(LOG GER.isErro rEnabled() ){
  76                                      String l oggerMsg =  getLogger FormattedS tringWStac kTrace(err Str, e);
  77                                      LOGGER.e rror(logge rMsg);
  78                             }
  79                             throw  new VistaS ocketExcep tion(errSt r, e);
  80                    }
  81           }
  82  
  83           /* *
  84            *  Sends the  request t o M and re turns the  response.  Also audit s time it
  85            *  takes to  make both  transfers.
  86            *  
  87            *  @param re quest
  88            *  @return S tring
  89            *  @throws V istaSocket TimeOutExc eption
  90            *  @throws V istaSocket Exception
  91            * /
  92           pu blic Strin g transfer (String re quest) thr ows VistaS ocketTimeO utExceptio n, VistaSo cketExcept ion {
  93  
  94                    bool ean isAudi tTimerEnab led = Audi tTimer.isA uditTimerE nabled(aud itLOGGER);
  95  
  96                    Audi tTimer aud itTimer =  null;
  97  
  98                    if ( isAuditTim erEnabled)  {
  99                             auditT imer = new  AuditTime r(auditLOG GER);
  100                             auditT imer.start ();
  101                    }
  102                    //se nd data
  103                    this .sendData( request);
  104  
  105                    //re ad respons e
  106                    Stri ng respons e = this.r eceiveData ();
  107  
  108                    if ( isAuditTim erEnabled)  {
  109                             auditT imer.stop( );
  110                             auditT imer.log(" Socket xfe r (milli-s ecs):");
  111                    }
  112  
  113                    audi tTimer = n ull;
  114  
  115                    retu rn respons e;
  116           }
  117  
  118           /* *
  119            *  Sends a c lose reque st to M. C loses the  socket. Se ts the soc ket to nul l.
  120            *  
  121            *  @throws V istaSocket Exception
  122            * /
  123           pu blic void  close() th rows Vista SocketExce ption {
  124                    clos e(true);
  125           }
  126  
  127           /* *
  128            *  Closes th e socket.  Sets the s ocket to n ull. Does  NOT send a  close req uest
  129            *  to M.
  130            *  
  131            *  @throws V istaSocket Exception
  132            * /
  133           pu blic void  closeDontN otify() th rows Vista SocketExce ption {
  134                    clos e(false);
  135           }
  136  
  137           /* *
  138            *  Closes th e socket.  Sets the s ocket to n ull. Does  NOT send a  close req uest
  139            *  to M if n otifyM par ameter is  set to fal se.
  140            *  
  141            *  @param no tifyM -
  142            *              indicate s where th e M server  should be  notified  if that th e
  143            *              socket i s closing
  144            *  @throws V istaSocket Exception
  145            * /
  146           pu blic void  close(bool ean notify M) throws  VistaSocke tException  {
  147                    if ( getSoc() ! = null) {
  148                             if (no tifyM) {
  149                                      try {
  150                                               this.sendD ata(CLOSE_ SOCKET_REQ UEST);
  151                                      } catch  (VistaSock etExceptio n e) {
  152                                               // execute  path to t his catch  block shou ld be very  rare...if
  153                                               // at all.
  154                                               String err Str = "'Cl ose Socket  request f ailed. M/V istA has m ost likely  terminate d this con nection";
  155                                               if(LOGGER. isErrorEna bled()){
  156                                                       St ring logge rMsg = get LoggerForm attedStrin gWStackTra ce(errStr,  e);
  157                                                       LO GGER.error (loggerMsg );
  158                                               }
  159                                      }
  160                             }
  161                             try {
  162                                      getSoc() .close();
  163                             } catc h (IOExcep tion e) {
  164                                      String e rrStr = "C an not clo se socket  connection .";
  165                                      if(LOGGE R.isErrorE nabled()){
  166                                               String log gerMsg = g etLoggerFo rmattedStr ingWStackT race(errSt r, e);
  167                                               LOGGER.err or(loggerM sg);
  168                                      }
  169                                      throw ne w VistaSoc ketExcepti on(errStr,  e);
  170                             }
  171                             setSoc (null);
  172                    }
  173           }
  174  
  175           /* *
  176            *  @return I netAddress
  177            * /
  178           pu blic InetA ddress get Address()  {
  179                    retu rn address ;
  180           }
  181  
  182           /* *
  183            *  @return i nt
  184            * /
  185           pu blic int g etPort() {
  186                    retu rn port;
  187           }
  188  
  189           /* *
  190            *  Sets the  time out f or socket  send/read  operations .
  191            *  
  192            *  @param ti meout
  193            *  @throws V istaSocket Exception
  194            * /
  195           pu blic void  setTransfe rTimeOut(i nt timeout ) throws V istaSocket Exception  {
  196                    try  {
  197                             getSoc ().setSoTi meout(time out);
  198                    } ca tch (Socke tException  e) {
  199                             String  errStr =  "Can not s et socket  timeout.";
  200                             if(LOG GER.isErro rEnabled() ){
  201                                      String l oggerMsg =  getLogger FormattedS tringWStac kTrace(err Str, e);
  202                                      LOGGER.e rror(logge rMsg);
  203                             }
  204                             throw  new VistaS ocketExcep tion(errSt r, e);
  205                    }
  206           }
  207  
  208           /* *
  209            *  Precautio nary code  to clean-u p socket c onnections  in J2SE e nvironment .
  210            *  <p>
  211            *  In applic ation serv er spi.Man agedConnec tion:destr oy() will  be called  to
  212            *  clean-up  connection s, hence t his method  will not  be perform ing socket
  213            *  clean-up.
  214            *  
  215            *  @see java .lang.Obje ct#finaliz e()
  216            * /
  217           pr otected vo id finaliz e() throws  Throwable  {
  218                    this .closeDont Notify();
  219                    supe r.finalize ();
  220           }
  221  
  222           pu blic final  String to String() {
  223  
  224                    retu rn (new St ringBuffer ()).append (this.getC lass().get Name()).ap pend("[mdi ]").append (getMatchi ngIdentifi er())
  225                                      .toStrin g();
  226           }
  227  
  228           /* *
  229            *  @param lo g
  230            *  @return S tring
  231            * /
  232           pr ivate Stri ng getLogg erFormatte dString(St ring log)  {
  233                    retu rn (new St ringBuffer ()).append (this.toSt ring()).ap pend("\n\t ").append( log).toStr ing();
  234           }
  235  
  236           /* *
  237            *  @param e
  238            *  @return S tring
  239            * /
  240           pr ivate Stri ng getLogg erFormatte dStringWSt ackTrace(T hrowable e ) {
  241  
  242                    retu rn getLogg erFormatte dString(Ex ceptionUti ls.getFull StackTrace (e));
  243  
  244           }
  245  
  246           /* *
  247            *  @param lo g
  248            *  @param e
  249            *  @return S tring
  250            * /
  251           pr ivate Stri ng getLogg erFormatte dStringWSt ackTrace(S tring log,  Throwable  e) {
  252  
  253                    retu rn getLogg erFormatte dString((n ew StringB uffer()).a ppend(log) .append("\ n\t").appe nd(
  254                                      Exceptio nUtils.get FullStackT race(e)).t oString()) ;
  255  
  256           }
  257   }