139. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 9/25/2018 2:13:05 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.

139.1 Files compared

# Location File Last Modified
1 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\org\apache\xml\internal\security Init.java Mon Jan 22 14:46:50 2018 UTC
2 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\org\apache\xml\internal\security Init.java Wed Sep 12 16:37:23 2018 UTC

139.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 6 746
Changed 5 10
Inserted 0 0
Removed 0 0

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

139.4 Active regular expressions

No regular expressions were active.

139.5 Comparison detail

  1   /*
  2    * reserve d comment  block
  3    * DO NOT  REMOVE OR  ALTER!
  4    */
  5   /**
  6    * License d to the A pache Soft ware Found ation (ASF ) under on e
  7    * or more  contribut or license  agreement s. See the  NOTICE fi le
  8    * distrib uted with  this work  for additi onal infor mation
  9    * regardi ng copyrig ht ownersh ip. The AS F licenses  this file
  10    * to you  under the  Apache Lic ense, Vers ion 2.0 (t he
  11    * "Licens e"); you m ay not use  this file  except in  complianc e
  12    * with th e License.  You may o btain a co py of the  License at
  13    *
  14    * http:// www.apache .org/licen ses/LICENS E-2.0
  15    *
  16    * Unless  required b y applicab le law or  agreed to  in writing ,
  17    * softwar e distribu ted under  the Licens e is distr ibuted on  an
  18    * "AS IS"  BASIS, WI THOUT WARR ANTIES OR  CONDITIONS  OF ANY
  19    * KIND, e ither expr ess or imp lied. See  the Licens e for the
  20    * specifi c language  governing  permissio ns and lim itations
  21    * under t he License .
  22    */
  23   package co m.sun.org. apache.xml .internal. security;
  24  
  25   import jav a.io.Input Stream;
  26   import jav a.security .AccessCon troller;
  27   import jav a.security .Privilege dAction;
  28   import jav a.security .Privilege dActionExc eption;
  29   import jav a.security .Privilege dException Action;
  30   import jav a.util.Arr ayList;
  31   import jav a.util.Lis t;
  32  
  33   import jav ax.xml.XML Constants;
  34   import jav ax.xml.par sers.Docum entBuilder ;
  35   import jav ax.xml.par sers.Docum entBuilder Factory;
  36  
  37   import com .sun.org.a pache.xml. internal.s ecurity.al gorithms.J CEMapper;
  38   import com .sun.org.a pache.xml. internal.s ecurity.al gorithms.S ignatureAl gorithm;
  39   import com .sun.org.a pache.xml. internal.s ecurity.c1 4n.Canonic alizer;
  40   import com .sun.org.a pache.xml. internal.s ecurity.ex ceptions.X MLSecurity Exception;
  41   import com .sun.org.a pache.xml. internal.s ecurity.ke ys.keyreso lver.KeyRe solver;
  42   import com .sun.org.a pache.xml. internal.s ecurity.tr ansforms.T ransform;
  43   import com .sun.org.a pache.xml. internal.s ecurity.ut ils.Elemen tProxy;
  44   import com .sun.org.a pache.xml. internal.s ecurity.ut ils.I18n;
  45   import com .sun.org.a pache.xml. internal.s ecurity.ut ils.XMLUti ls;
  46   import com .sun.org.a pache.xml. internal.s ecurity.ut ils.resolv er.Resourc eResolver;
  47   import org .w3c.dom.A ttr;
  48   import org .w3c.dom.D ocument;
  49   import org .w3c.dom.E lement;
  50   import org .w3c.dom.N ode;
  51  
  52  
  53   /**
  54    * This cl ass does t he configu ration of  the librar y. This in cludes cre ating
  55    * the map ping of Ca nonicaliza tion and T ransform a lgorithms.  Initializ ation is
  56    * done by  calling { @link Init #init} whi ch should  be done in  any stati c block
  57    * of the  files of t his librar y. We ensu re that th is call is  only exec uted once.
  58    */
  59   public cla ss Init {
  60  
  61       /** Th e namespac e for CONF  file **/
  62       public  static fi nal String  CONF_NS =  "http://w ww.xmlsecu rity.org/N S/#configu ration";
  63  
  64       /** {@ link org.a pache.comm ons.loggin g} logging  facility  */
  65       privat e static j ava.util.l ogging.Log ger log =
  66           ja va.util.lo gging.Logg er.getLogg er(Init.cl ass.getNam e());
  67  
  68       /** Fi eld alread yInitializ ed */
  69       privat e static b oolean alr eadyInitia lized = fa lse;
  70  
  71       /**
  72        * Met hod isInit ialized
  73        * @re turn true  if the lib rary is al ready init ialized.
  74        */
  75       public  static sy nchronized  final boo lean isIni tialized()  {
  76           re turn Init. alreadyIni tialized;
  77       }
  78  
  79       /**
  80        * Met hod init
  81        *
  82        */
  83       public  static sy nchronized  void init () {
  84           if  (alreadyI nitialized ) {
  85                return;
  86           }
  87  
  88           In putStream  is =
  89                AccessCo ntroller.d oPrivilege d(
  90                    new  Privileged Action<Inp utStream>( ) {
  91                         public Inp utStream r un() {
  92                             String  cfile =
  93                                 Sy stem.getPr operty("co m.sun.org. apache.xml .internal. security.r esource.co nfig");
  94                             if (cf ile == nul l) {
  95                                 re turn null;
  96                             }
  97                             return  getClass( ).getResou rceAsStrea m(cfile);
  98                         }
  99                    });
  100           if  (is == nu ll) {
  101                dynamicI nit();
  102           }  else {
  103                fileInit (is);
  104           }
  105  
  106           al readyIniti alized = t rue;
  107       }
  108  
  109       /**
  110        * Dyn amically i nitialise  the librar y by regis tering the  default a lgorithms/ implementa tions
  111        */
  112       privat e static v oid dynami cInit() {
  113           //
  114           //  Load the  Resource B undle - th e default  is the Eng lish resou rce bundle .
  115           //  To load a nother res ource bund le, call I 18n.init(. ..) before  calling t his
  116           //  method.
  117           //
  118           I1 8n.init("e n", "US");
  119  
  120           if  (log.isLo ggable(jav a.util.log ging.Level .FINE)) {
  121                log.log( java.util. logging.Le vel.FINE,  "Registeri ng default  algorithm s");
  122           }
  123           tr y {
  124                AccessCo ntroller.d oPrivilege d(new Priv ilegedExce ptionActio n<Void>(){
  125                    @Ove rride publ ic Void ru n() throws  XMLSecuri tyExceptio n {
  126                         //
  127                         // Bind th e default  prefixes
  128                         //
  129                         ElementPro xy.registe rDefaultPr efixes();
  130  
  131                         //
  132                         // Set the  default T ransforms
  133                         //
  134                         Transform. registerDe faultAlgor ithms();
  135  
  136                         //
  137                         // Set the  default s ignature a lgorithms
  138                         //
  139                         SignatureA lgorithm.r egisterDef aultAlgori thms();
  140  
  141                         //
  142                         // Set the  default J CE algorit hms
  143                         //
  144                         JCEMapper. registerDe faultAlgor ithms();
  145  
  146                         //
  147                         // Set the  default c 14n algori thms
  148                         //
  149                         Canonicali zer.regist erDefaultA lgorithms( );
  150  
  151                         //
  152                         // Registe r the defa ult resolv ers
  153                         //
  154                         ResourceRe solver.reg isterDefau ltResolver s();
  155  
  156                         //
  157                         // Registe r the defa ult key re solvers
  158                         //
  159                         KeyResolve r.register DefaultRes olvers();
  160  
  161                         return nul l;
  162                    }
  163               });
  164           }  catch (Pri vilegedAct ionExcepti on ex) {
  165                XMLSecur ityExcepti on xse = ( XMLSecurit yException )ex.getExc eption();
  166                log.log( java.util. logging.Le vel.SEVERE , xse.getM essage(),  xse);
  167                xse.prin tStackTrac e();
  168           }
  169       }
  170  
  171       /**
  172        * Ini tialise th e library  from a con figuration  file
  173        */
  174       privat e static v oid fileIn it(InputSt ream is) {
  175           tr y {
  176                /* read  library co nfiguratio n file */
  177                Document BuilderFac tory dbf =  DocumentB uilderFact ory.newIns tance();
  178                dbf.setF eature(XML Constants. FEATURE_SE CURE_PROCE SSING, Boo lean.TRUE) ;
  179  
  180                dbf.setN amespaceAw are(true);
  181                dbf.setV alidating( false);
  182  
  183                Document Builder db  = dbf.new DocumentBu ilder();
  184                Document  doc = db. parse(is);
  185                Node con fig = doc. getFirstCh ild();
  186                for (; c onfig != n ull; confi g = config .getNextSi bling()) {
  187                    if ( "Configura tion".equa ls(config. getLocalNa me())) {
  188                         break;
  189                    }
  190                }
  191                if (conf ig == null ) {
  192                    log. log(java.u til.loggin g.Level.SE VERE, "Err or in read ing config uration fi le - Confi guration e lement not  found");
  193                    retu rn;
  194                }
  195                for (Nod e el = con fig.getFir stChild();  el != nul l; el = el .getNextSi bling()) {
  196                    if ( Node.ELEME NT_NODE !=  el.getNod eType()) {
  197                         continue;
  198                    }
  199                    Stri ng tag = e l.getLocal Name();
  200                    if ( tag.equals ("Resource Bundles"))  {
  201                         Element re source = ( Element)el ;
  202                         /* configu re interna tionalizat ion */
  203                         Attr langA ttr = reso urce.getAt tributeNod e("default LanguageCo de");
  204                         Attr count ryAttr = r esource.ge tAttribute Node("defa ultCountry Code");
  205                         String lan guageCode  =
  206                             (langA ttr == nul l) ? null  : langAttr .getNodeVa lue();
  207                         String cou ntryCode =
  208                             (count ryAttr ==  null) ? nu ll : count ryAttr.get NodeValue( );
  209                         I18n.init( languageCo de, countr yCode);
  210                    }
  211  
  212                    if ( tag.equals ("Canonica lizationMe thods")) {
  213                         Element[]  list =
  214                             XMLUti ls.selectN odes(el.ge tFirstChil d(), CONF_ NS, "Canon icalizatio nMethod");
  215  
  216                         for (int i  = 0; i <  list.lengt h; i++) {
  217                             String  uri = lis t[i].getAt tributeNS( null, "URI ");
  218                             String  javaClass  =
  219                                   list[i].ge tAttribute NS(null, " JA DNS    SS");
  220                             try {
  221                                 Ca nonicalize r.register (uri, java Class);
  222                                 if  (log.isLo ggable(jav a.util.log ging.Level .FINE)) {
  223                                      log.log( java.util. logging.Le vel.FINE,  "Canonical izer.regis ter(" + ur i + ", " +  javaClass  + ")");
  224                                 }
  225                             } catc h (ClassNo tFoundExce ption e) {
  226                                 Ob ject exArg s[] = { ur i, javaCla ss };
  227                                 lo g.log(java .util.logg ing.Level. SEVERE, I1 8n.transla te("algori thm.classD oesNotExis t", exArgs ));
  228                             }
  229                         }
  230                    }
  231  
  232                    if ( tag.equals ("Transfor mAlgorithm s")) {
  233                         Element[]  tranElem =
  234                             XMLUti ls.selectN odes(el.ge tFirstChil d(), CONF_ NS, "Trans formAlgori thm");
  235  
  236                         for (int i  = 0; i <  tranElem.l ength; i++ ) {
  237                             String  uri = tra nElem[i].g etAttribut eNS(null,  "URI");
  238                             String  javaClass  =
  239                                   tranElem[i ].getAttri buteNS(nul l, "JA DNS    SS");
  240                             try {
  241                                 Tr ansform.re gister(uri , javaClas s);
  242                                 if  (log.isLo ggable(jav a.util.log ging.Level .FINE)) {
  243                                      log.log( java.util. logging.Le vel.FINE,  "Transform .register( " + uri +  ", " + jav aClass + " )");
  244                                 }
  245                             } catc h (ClassNo tFoundExce ption e) {
  246                                 Ob ject exArg s[] = { ur i, javaCla ss };
  247  
  248                                 lo g.log(java .util.logg ing.Level. SEVERE, I1 8n.transla te("algori thm.classD oesNotExis t", exArgs ));
  249                             } catc h (NoClass DefFoundEr ror ex) {
  250                                 lo g.log(java .util.logg ing.Level. WARNING, " Not able t o found de pendencies  for algor ithm, I'll  keep work ing.");
  251                             }
  252                         }
  253                    }
  254  
  255                    if ( "JCEAlgori thmMapping s".equals( tag)) {
  256                         Node algor ithmsNode  = ((Elemen t)el).getE lementsByT agName("Al gorithms") .item(0);
  257                         if (algori thmsNode ! = null) {
  258                             Elemen t[] algori thms =
  259                                 XM LUtils.sel ectNodes(a lgorithmsN ode.getFir stChild(),  CONF_NS,  "Algorithm ");
  260                             for (i nt i = 0;  i < algori thms.lengt h; i++) {
  261                                 El ement elem ent = algo rithms[i];
  262                                 St ring id =  element.ge tAttribute ("URI");
  263                                 JC EMapper.re gister(id,  new JCEMa pper.Algor ithm(eleme nt));
  264                             }
  265                         }
  266                    }
  267  
  268                    if ( tag.equals ("Signatur eAlgorithm s")) {
  269                         Element[]  sigElems =
  270                             XMLUti ls.selectN odes(el.ge tFirstChil d(), CONF_ NS, "Signa tureAlgori thm");
  271  
  272                         for (int i  = 0; i <  sigElems.l ength; i++ ) {
  273                             String  uri = sig Elems[i].g etAttribut eNS(null,  "URI");
  274                             String  javaClass  =
  275                                   sigElems[i ].getAttri buteNS(nul l, "JA DNS    SS");
  276  
  277                             /** $t odo$ handl e register ing */
  278  
  279                             try {
  280                                 Si gnatureAlg orithm.reg ister(uri,  javaClass );
  281                                 if  (log.isLo ggable(jav a.util.log ging.Level .FINE)) {
  282                                      log.log( java.util. logging.Le vel.FINE,  "Signature Algorithm. register("  + uri + " , "
  283                                                 + javaCl ass + ")") ;
  284                                 }
  285                             } catc h (ClassNo tFoundExce ption e) {
  286                                 Ob ject exArg s[] = { ur i, javaCla ss };
  287  
  288                                 lo g.log(java .util.logg ing.Level. SEVERE, I1 8n.transla te("algori thm.classD oesNotExis t", exArgs ));
  289                             }
  290                         }
  291                    }
  292  
  293                    if ( tag.equals ("Resource Resolvers" )) {
  294                         Element[]r esolverEle m =
  295                             XMLUti ls.selectN odes(el.ge tFirstChil d(), CONF_ NS, "Resol ver");
  296  
  297                         for (int i  = 0; i <  resolverEl em.length;  i++) {
  298                             String  javaClass  =
  299                                   resolverEl em[i].getA ttributeNS (null, "JA DNS    SS");
  300                             String  descripti on =
  301                                 re solverElem [i].getAtt ributeNS(n ull, "DESC RIPTION");
  302  
  303                             if ((d escription  != null)  && (descri ption.leng th() > 0))  {
  304                                 if  (log.isLo ggable(jav a.util.log ging.Level .FINE)) {
  305                                      log.log( java.util. logging.Le vel.FINE,  "Register  Resolver:  " + javaCl ass + ": "
  306                                                 + descri ption);
  307                                 }
  308                             } else  {
  309                                 if  (log.isLo ggable(jav a.util.log ging.Level .FINE)) {
  310                                      log.log( java.util. logging.Le vel.FINE,  "Register  Resolver:  " + javaCl ass
  311                                                 + ": For  unknown p urposes");
  312                                 }
  313                             }
  314                             try {
  315                                 Re sourceReso lver.regis ter(javaCl ass);
  316                             } catc h (Throwab le e) {
  317                                 lo g.log(java .util.logg ing.Level. WARNING,
  318                                       "Cannot  register: " + javaCl ass
  319                                       + " per haps some  needed jar s are not  installed" ,
  320                                       e
  321                                  ) ;
  322                             }
  323                         }
  324                    }
  325  
  326                    if ( tag.equals ("KeyResol ver")){
  327                         Element[]  resolverEl em =
  328                             XMLUti ls.selectN odes(el.ge tFirstChil d(), CONF_ NS, "Resol ver");
  329                         List<Strin g> classNa mes = new  ArrayList< String>(re solverElem .length);
  330                         for (int i  = 0; i <  resolverEl em.length;  i++) {
  331                             String  javaClass  =
  332                                   resolverEl em[i].getA ttributeNS (null, "JA DNS    SS");
  333                             String  descripti on =
  334                                 re solverElem [i].getAtt ributeNS(n ull, "DESC RIPTION");
  335  
  336                             if ((d escription  != null)  && (descri ption.leng th() > 0))  {
  337                                 if  (log.isLo ggable(jav a.util.log ging.Level .FINE)) {
  338                                      log.log( java.util. logging.Le vel.FINE,  "Register  Resolver:  " + javaCl ass + ": "
  339                                                 + descri ption);
  340                                 }
  341                             } else  {
  342                                 if  (log.isLo ggable(jav a.util.log ging.Level .FINE)) {
  343                                      log.log( java.util. logging.Le vel.FINE,  "Register  Resolver:  " + javaCl ass
  344                                                 + ": For  unknown p urposes");
  345                                 }
  346                             }
  347                             classN ames.add(j avaClass);
  348                         }
  349                         KeyResolve r.register ClassNames (className s);
  350                    }
  351  
  352  
  353                    if ( tag.equals ("PrefixMa ppings")){
  354                         if (log.is Loggable(j ava.util.l ogging.Lev el.FINE))  {
  355                             log.lo g(java.uti l.logging. Level.FINE , "Now I t ry to bind  prefixes: ");
  356                         }
  357  
  358                         Element[]  nl =
  359                             XMLUti ls.selectN odes(el.ge tFirstChil d(), CONF_ NS, "Prefi xMapping") ;
  360  
  361                         for (int i  = 0; i <  nl.length;  i++) {
  362                             String  namespace  = nl[i].g etAttribut eNS(null,  "namespace ");
  363                             String  prefix =  nl[i].getA ttributeNS (null, "pr efix");
  364                             if (lo g.isLoggab le(java.ut il.logging .Level.FIN E)) {
  365                                 lo g.log(java .util.logg ing.Level. FINE, "Now  I try to  bind " + p refix + "  to " + nam espace);
  366                             }
  367                             Elemen tProxy.set DefaultPre fix(namesp ace, prefi x);
  368                         }
  369                    }
  370                }
  371           }  catch (Exc eption e)  {
  372                log.log( java.util. logging.Le vel.SEVERE , "Bad: ",  e);
  373                e.printS tackTrace( );
  374           }
  375       }
  376  
  377   }
  378