44. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 7/10/2017 1:01:43 PM 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.

44.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\IV-ehmp_cif\ImagingCacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl\filesystem InstanceReadableByteChannelImpl.java Thu Jun 29 17:22:11 2017 UTC
2 C:\AraxisMergeCompare\Pri_re\IV-ehmp_cif\ImagingCacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl\filesystem InstanceReadableByteChannelImpl.java Thu Jul 6 15:02:19 2017 UTC

44.2 Comparison summary

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

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

44.4 Active regular expressions

No regular expressions were active.

44.5 Comparison detail

  1   package go v.va.med.i maging.sto rage.cache .impl.file system;
  2  
  3   import gov .va.med.im aging.stor age.cache. InstanceRe adableByte Channel;
  4   import gov .va.med.im aging.stor age.cache. TracableCo mponent;
  5   import gov .va.med.im aging.stor age.cache. exceptions .InstanceU navailable Exception;
  6   import gov .va.med.im aging.stor age.cache. impl.Abstr actByteCha nnelFactor y;
  7  
  8   import jav a.io.File;
  9   import jav a.io.FileI nputStream ;
  10   import jav a.io.IOExc eption;
  11   import jav a.nio.Byte Buffer;
  12   import jav a.nio.chan nels.FileC hannel;
  13   import jav a.nio.chan nels.FileL ock;
  14   import jav a.util.zip .Checksum;
  15  
  16   /**
  17    * A class  that simp ly wraps a  FileChann el that wi ll be used  for readi ng,
  18    * and rel eases a lo ck when th e channel  is closed.
  19    * 
  20    * @author         
BECKEC
  21    *
  22    */
  23   public cla ss Instanc eReadableB yteChannel Impl 
  24   implements  InstanceR eadableByt eChannel,  TracableCo mponent
  25   {
  26           /* *
  27            *  
  28            * /
  29           pr ivate fina l Abstract ByteChanne lFactory f actory;
  30           pr ivate fina l File fil e;
  31           pr ivate fina l FileChan nel wrappe dChannel;
  32           pr ivate fina l FileInpu tStream in Stream;
  33           pr ivate File Lock lock;
  34           pr ivate long  openedTim e;                                            // keep  this so th at we coul d close th e files ou rselves if  the clien t does not
  35           pr ivate long  lastAcces sedTime;
  36           pr ivate java .util.zip. Checksum c hecksum;
  37           pr ivate Stac kTraceElem ent[] inst antiatingS tackTrace  = null;
  38           
  39           In stanceRead ableByteCh annelImpl( AbstractBy teChannelF actory fac tory, File  file) 
  40           th rows IOExc eption, In stanceUnav ailableExc eption
  41           {
  42                    this (factory,  file, null );
  43           }
  44           
  45           pu blic Insta nceReadabl eByteChann elImpl(Abs tractByteC hannelFact ory factor y, File fi le, Checks um checksu m) 
  46           th rows IOExc eption, In stanceUnav ailableExc eption
  47           {
  48                    this .factory =  factory;
  49                    this .file = fi le;
  50                    this .checksum  = checksum ;
  51                    
  52                    this .factory.g etLogger() .debug("In stanceRead ableByteCh annelImpl,  opening ' " + file.g etPath() +  "'" );
  53                    // t race the c hannel ins tantiation  so we can  tattle-ta le later i f its not  closed
  54                    if(t his.factor y.isTraceC hannelInst antiation( ))
  55                             instan tiatingSta ckTrace =  Thread.cur rentThread ().getStac kTrace();
  56                    
  57                    inSt ream = new  FileInput Stream(fil e);
  58                    this .wrappedCh annel = in Stream.get Channel();
  59                    
  60                    open edTime = S ystem.curr entTimeMil lis();
  61                    last AccessedTi me = opene dTime;
  62                    
  63                    // t ry to acqu ire a shar ed lock on  the file
  64                    //lo ck = wrapp edChannel. tryLock(0L , Long.MAX _VALUE, tr ue);
  65           }
  66  
  67           Fi le getFile ()
  68           {
  69                    retu rn this.fi le;
  70           }
  71  
  72           pu blic File  getCacheFi le()
  73           {
  74                    retu rn this.fi le;
  75           }
  76           
  77           @O verride
  78           pu blic Stack TraceEleme nt[] getIn stantiatin gStackTrac e()
  79           {
  80                    retu rn instant iatingStac kTrace;
  81           }
  82           
  83           pu blic java. util.zip.C hecksum ge tChecksum( )
  84           {
  85                    retu rn this.ch ecksum;
  86           }
  87  
  88           /*  (non-Java doc)
  89            *  @see gov. va.med.ima ging.stora ge.cache.i mpl.filesy stem.Insta nceReadabl eByteChann el#error()
  90            * /
  91           pu blic void  error() 
  92           th rows IOExc eption
  93           {
  94                    clos e(true);
  95           }
  96           
  97           /* *
  98            *  A normal  close, the  cache ite m contents  are valid .
  99            * /
  100           pu blic void  close() 
  101           th rows IOExc eption
  102           {
  103                    clos e(false);
  104           }
  105           
  106           pr ivate void  close(boo lean error Close) 
  107           th rows IOExc eption
  108           {
  109                    IOEx ception io X = null;
  110                    this .factory.g etLogger() .debug("In stanceRead ableByteCh annelImpl,  closing ' " + file.g etPath() +  "' " + (e rrorClose  ? "WITH" :  "without" ) + " dele te");
  111  
  112                    try{ if(lock !=  null) loc k.release( );}                              // the loc k release  must occur  before th e close
  113                    catc h(IOExcept ion e)
  114                    {thi s.factory. getLogger( ).warn(e);  ioX = e;}  // the lo ck may alr eady be re leased thr ough some  error or o ther timeo ut, log it  but keep  going
  115                    
  116                    try{  wrappedCh annel.clos e(); }
  117                    catc h(IOExcept ion e)
  118                    {thi s.factory. getLogger( ).warn(e); } // the c hannel may  already b e closed t hrough som e error or  other tim eout, log  it but kee p going
  119  
  120                    try{  inStream. close(); }
  121                    catc h(IOExcept ion e)
  122                    {thi s.factory. getLogger( ).warn(e); } // the s tream may  already be  closed th rough some  error or  other time out, log i t but keep  going
  123                    
  124                    if(  errorClose  && ! this .file.dele te() )
  125                             this.f actory.get Logger().e rror("Unab le to dele te cache i tem, file  '" + (file .getAbsolu tePath())  + "' may b e corrupt  and should  be manual ly deleted ." );
  126                    
  127                    // t he followi ng two ope rations re ally must  occur rega rdless of  the 
  128                    // s uccess of  the previo us IO oper ations, el se channel s will rep eatedly be  closed wh en they ar e already  closed
  129                    this .factory.r eadableByt eChannelCl osed(this,  errorClos e);
  130                    
  131                    this .factory.g etLogger() .debug("In stanceRead ableByteCh annelImpl  - '" + fil e.getPath( ) + "' clo sed " + (e rrorClose  ? "WITH" :  "without" ) + " dele te");
  132                    if(i oX != null )
  133                             throw  ioX;
  134           }
  135           
  136  
  137           pu blic boole an isOpen( )
  138           {
  139                    retu rn wrapped Channel !=  null && w rappedChan nel.isOpen ();
  140           }
  141  
  142           pu blic int r ead(ByteBu ffer dst) 
  143           th rows IOExc eption
  144           {
  145                    int  bytesRead  = 0;
  146                    
  147                    last AccessedTi me = Syste m.currentT imeMillis( );
  148                    byte sRead = wr appedChann el.read(ds t);
  149                    
  150                    Chec ksum local ChecksumRe f = getChe cksum();                // just  for perfor mance
  151                    if(l ocalChecks umRef != n ull)
  152                    {
  153                             ByteBu ffer local Buffer = d st.asReadO nlyBuffer( );
  154                             for(lo calBuffer. flip(); lo calBuffer. hasRemaini ng(); loca lChecksumR ef.update( localBuffe r.get()) ) ;
  155                    }
  156                    
  157                    retu rn bytesRe ad;
  158           }
  159  
  160           pu blic long  getLastAcc essedTime( )
  161           {
  162                    retu rn lastAcc essedTime;
  163           }
  164   }