4350. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/9/2017 3:51:30 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.

4350.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:51:30 2017 UTC
2 eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-web\src\main\java\gov\va\nvap\web\util ErrorHandler.java Fri Apr 21 20:15:58 2017 UTC

4350.2 Comparison summary

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

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

4350.4 Active regular expressions

No regular expressions were active.

4350.5 Comparison detail

        1   package go v.va.nvap. web.util;
        2  
        3   import gov .va.nvap.c ommon.vali dation.Nul lChecker;
        4   import jav a.io.IOExc eption;
        5   import jav a.util.log ging.Level ;
        6   import jav a.util.log ging.Logge r;
        7   import jav ax.servlet .RequestDi spatcher;
        8   import jav ax.servlet .ServletEx ception;
        9   import jav ax.servlet .http.Http Servlet;
        10   import jav ax.servlet .http.Http ServletReq uest;
        11   import jav ax.servlet .http.Http ServletRes ponse;
        12   import jav ax.servlet .http.Http Session;
        13  
        14   /**
        15    *
        16    * @author  Johann So nnenberg
        17    * @since  07/01/2016
        18    */
        19   public cla ss ErrorHa ndler exte nds HttpSe rvlet {
        20  
        21       privat e static f inal Logge r LOGGER =  Logger.ge tLogger(Er rorHandler .class.get Name());
        22  
        23       @Overr ide
        24       public  void doGe t(HttpServ letRequest  request,  HttpServle tResponse  response)  throws Ser vletExcept ion, IOExc eption {
        25           ha ndleForwar d(request,  response) ;
        26       }
        27  
        28       @Overr ide
        29       public  void doPo st(HttpSer vletReques t request,  HttpServl etResponse  response)  throws Se rvletExcep tion, IOEx ception {
        30           th is.doGet(r equest, re sponse);
        31       }
        32  
        33       privat e void han dleForward (HttpServl etRequest  request, H ttpServlet Response r esponse) t hrows Serv letExcepti on, IOExce ption {
        34           fi nal HttpSe ssion sess ion = requ est.getSes sion(false );
        35           St ring custo mMessage =  "";
        36           St ring exTyp e = "" + r equest.get Attribute( "javax.ser vlet.error .message") ;
        37           St ring error Code = ""  + request. getAttribu te("javax. servlet.er ror.status _code");
        38           Bo olean isAj ax = "XMLH ttpRequest ".equals(r equest.get Header("X- Requested- With"));
        39           St ring nextJ SP = "/WEB -INF/web/e rror/gener icError.js p";
        40  
        41           // based on t he type of  exception , create t he custom  message to  show on t he general Error page
        42           if  ("gov.va. nvap.servi ce.audit.A uditExcept ion".equal s(exType))  {
        43                customMe ssage = "T here was a  problem c onnecting  to the Exc hange Serv ice.";
        44           }  else if (" gov.va.nva p.service. pdq.PdqExc eption".eq uals(exTyp e)) {
        45                customMe ssage = "T here was a  problem c onnecting  to the MVI  Service." ;
        46           }  else if (" java.util. concurrent .TimeoutEx ception".e quals(exTy pe)) {
        47                customMe ssage = "T he server  is current ly busy an d a timeou t has occu rred.";
        48           }  else if (" gov.va.nva p.service. adapter.au dit.Direct ServiceExc eption".eq uals(exTyp e)) {
        49                customMe ssage = "T here was a  problem c onnecting  to the Dir ect Servic e.";
        50           }  else if (" UserNameEx ception".e quals(exTy pe)) {
        51                customMe ssage = "U ser name n ot present  in reques t. User ma y not be a uthenticat ed.";
        52           }  else if (" UserRoleEx ception".e quals(exTy pe)) {
        53                customMe ssage = "T he user is  not in a  permitted  role.";
        54           }  else if (" 404".equal s(errorCod e)) {
        55                customMe ssage = "T he page yo u requeste d does not  exist.";
        56           }
        57  
        58           re quest.setA ttribute(" customMess age", cust omMessage) ; //the "n ice" error  message
        59           re quest.setA ttribute(" isLoggedIn ", !NullCh ecker.isNu llOrEmpty( session));  //used wh ether to s how the le ft nav bas ed on if a  user is l ogged in o r not
        60           re quest.setA ttribute(" errorCode" , errorCod e);
        61  
        62           if  (!NullChe cker.isNul lOrEmpty(s ession) &&  !NullChec ker.isNull OrEmpty(se ssion.getA ttribute(" debug"))
        63                && "true ".equals(s ession.get Attribute( "debug").t oString()) ) {
        64                if (!Nul lChecker.i sNullOrEmp ty(errorCo de) && !"5 00".equals (errorCode )) {
        65                    // I f this is  a 500 erro r we know  something  went bad o n the Java /Server si de
        66                    Stri ng st = ex Type;
        67                    requ est.setAtt ribute("fu llStackTra ce", st);
        68                } else {
        69                    Stri ng st = (S tring) ses sion.getAt tribute("e xceptionTr ace");
        70                    // F YI, the st ace trace  is in the  session se t by the R esponseDis patcherHtt pServlet a s "excepti onTrace"
        71                    requ est.setAtt ribute("fu llStackTra ce", st);
        72                }
        73           }
        74  
        75           // set if thi s was an a jax reques t or not a s we need  to handle  it differe ntly
        76           re quest.setA ttribute(" isAjax", i sAjax);
        77  
        78           // log the ex ception
        79           Ob ject exObj  = request .getAttrib ute("javax .servlet.e rror.excep tion");
        80           if (exObj ins tanceof Th rowable) {
        81                LOGGER.l og(Level.S EVERE, "Ex ception ca ught in Er rorHandler .", (Throw able)exObj );
        82           }  else {
        83                LOGGER.l og(Level.S EVERE, "Ex ception ca ught in Er rorHandler : {0}", ex Obj);
        84           }
        85  
        86           // if this is  an ajax r equest, se t the gene ric ajax e rror page  (just retu rns JSON)
        87           if (isAjax){
        88                nextJSP  = "/WEB-IN F/web/erro r/genericA jaxError.j sp";
        89           }
        90  
        91           // redirect t o the gene ric error  page
        92           Re questDispa tcher disp atcher = g etServletC ontext().g etRequestD ispatcher( nextJSP);
        93           di spatcher.f orward(req uest, resp onse);
        94       }
        95   }