58. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 5/25/2018 9:21:43 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.

58.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\ZIP\DSM-cif\Direct Implementation\java\install\build\download\apache-tomcat-6.0.37.tar\apache-tomcat-6.0.37\bin\tomcat-native.tar\tomcat-native\tomcat-native-1.1.27-src\jni\test\org\apache\tomcat\jni SocketServerTestBind.java Tue Feb 5 13:49:48 2013 UTC
2 C:\AraxisMergeCompare\Pri_re\ZIP\DSM-cif\Direct Implementation\java\install\build\download\apache-tomcat-6.0.37.tar\apache-tomcat-6.0.37\bin\tomcat-native.tar\tomcat-native\tomcat-native-1.1.27-src\jni\test\org\apache\tomcat\jni SocketServerTestBind.java Thu May 24 19:44:27 2018 UTC

58.2 Comparison summary

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

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

58.4 Active regular expressions

No regular expressions were active.

58.5 Comparison detail

  1   /*
  2    * License d to the A pache Soft ware Found ation (ASF ) under on e or more
  3    * contrib utor licen se agreeme nts.  See  the NOTICE  file dist ributed wi th
  4    * this wo rk for add itional in formation  regarding  copyright  ownership.
  5    * The ASF  licenses  this file  to You und er the Apa che Licens e, Version  2.0
  6    * (the "L icense");  you may no t use this  file exce pt in comp liance wit h
  7    * the Lic ense.  You  may obtai n a copy o f the Lice nse at
  8    * 
  9    *      ht tp://www.a pache.org/ licenses/L ICENSE-2.0
  10    * 
  11    * Unless  required b y applicab le law or  agreed to  in writing , software
  12    * distrib uted under  the Licen se is dist ributed on  an "AS IS " BASIS,
  13    * WITHOUT  WARRANTIE S OR CONDI TIONS OF A NY KIND, e ither expr ess or imp lied.
  14    * See the  License f or the spe cific lang uage gover ning permi ssions and
  15    * limitat ions under  the Licen se.
  16    */
  17  
  18   package or g.apache.t omcat.jni;
  19  
  20   import jun it.framewo rk.Test;
  21   import jun it.framewo rk.TestSui te;
  22   import jun it.textui. TestRunner ;
  23   import jun it.framewo rk.TestCas e;
  24  
  25   import jav a.io.Outpu tStream;
  26   import jav a.io.Input Stream;
  27   import jav a.net.Netw orkInterfa ce;
  28   import jav a.net.Inet Address;
  29   import jav a.util.*;
  30  
  31   /**
  32    * A basic  test suit e that tes ts Socket  Server fea ture.
  33    * 
  34    * @author  Jean-Fred eric Clere
  35    * @versio n $Id: Soc ketServerT estBind.ja va 1442587  2013-02-0 5 13:49:48 Z rjung $
  36    * @see or g.apache.t omcat.jni
  37    */
  38   public cla ss SocketS erverTestB ind extend s TestCase  {
  39  
  40       privat e long ser verSock =  0;
  41         private in t port= PORT ;
  42       privat e String h ost=null;
  43  
  44       public  static lo ng serverP ool = 0;
  45  
  46       public  void test SocketServ erTestBind () throws  Exception  {
  47  
  48           Sy stem.out.p rintln("St arting: te stSocketSe rverTestBi nd");
  49           /*  Load APR  library */
  50           Li brary.init ialize(nul l);
  51  
  52           /*  Create th e server s ocket and  listen on  it */
  53           se rverPool =  Pool.crea te(0);
  54           lo ng inetAdd ress = Add ress.info( host, Sock et.APR_UNS PEC,
  55                                               port, 0, s erverPool) ;
  56           se rverSock =  Socket.cr eate(Addre ss.getInfo (inetAddre ss).family ,
  57                                         Socke t.SOCK_STR EAM,
  58                                         Socke t.APR_PROT O_TCP, ser verPool);
  59           in t rc = Soc ket.bind(s erverSock,  inetAddre ss);
  60           if  (rc != 0)  {
  61                throw(ne w Exceptio n("Can't b ind: " + E rror.strer ror(rc)));
  62           }
  63           So cket.liste n(serverSo ck, 5);
  64  
  65           /*  Start the  client th at connect s to the s erver */
  66           Cl ient clien t = new Cl ient();
  67           cl ient.start (); 
  68           ja va.lang.Th read.sleep (100);
  69      
  70           bo olean runn ing = true ;
  71           wh ile (runni ng) { 
  72                /* Accep t it */
  73                long cli entSock =  Socket.acc ept(server Sock);
  74                Socket.t imeoutSet( clientSock , 10000);
  75                byte []  buf = new  byte[1];
  76                while (S ocket.recv (clientSoc k, buf, 0,  1) == 1)  {
  77                    if ( buf[0] ==  'A') {
  78                         buf[0] = ' Z';
  79                         Socket.sen d(clientSo ck, buf, 0 , 1);
  80                    }
  81                }
  82                Socket.c lose(clien tSock);
  83                if (buf[ 0] != 'Z')
  84                    runn ing = fals e;
  85           }
  86           cl ient.join( );
  87           Li brary.term inate();
  88           Sy stem.out.p rintln("Do ne: testSo cketServer TestBind") ;
  89       }
  90  
  91       /* sma ll client  that conne cts and se nds one by te */
  92       privat e class Cl ient exten ds java.la ng.Thread  {
  93           pu blic void  run() {
  94                try {
  95                   Enume ration net s = Networ kInterface .getNetwor kInterface s();
  96                   while  (nets.has MoreElemen ts()) {
  97                       N etworkInte rface net  = (Network Interface)  nets.next Element();
  98           
  99                       E numeration  addrs = n et.getInet Addresses( );
  100  
  101                       w hile (addr s.hasMoreE lements())  {
  102                            InetAdd ress ia =  (InetAddre ss)addrs.n extElement ();
  103                            System. out.printl n("Trying:  " + ia.ge tHostAddre ss());
  104                            java.ne t.Socket s ock = new  java.net.S ocket(ia,  port);
  105                            sock.se tSoTimeout (10000);
  106                            OutputS tream ou =  sock.getO utputStrea m();
  107                            InputSt ream in =   sock.getI nputStream ();
  108                            ou.writ e('A');
  109                            ou.flus h();
  110                            int rep  = in.read ();
  111                            sock.cl ose();
  112                            if (rep  != 'Z')
  113                                 th row new Ex ception("R ead wrong  data");
  114                      }
  115                   }
  116                } catch( Exception  ex ) {
  117                    ex.p rintStackT race();
  118                }
  119  
  120                /* Now u se localho st to writ e 'E' */
  121                try {
  122                   java. net.Socket  sock = ne w java.net .Socket("l ocalhost",  port);
  123                   Outpu tStream ou  = sock.ge tOutputStr eam();
  124                   ou.wr ite('E');
  125                   ou.fl ush();
  126                   sock. close();
  127                } catch( Exception  ex ) {
  128                    ex.p rintStackT race();
  129                }
  130           }
  131       }
  132   }