Ignore:
Timestamp:
Apr 27, 2004, 8:39:34 PM (22 years ago)
Author:
bird
Message:

GCC v3.3.3 sources.

Location:
branches/GNU/src/gcc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gcc

    • Property svn:ignore
      •  

        old new  
        2626configure.vr
        2727configure.vrs
         28
        2829Makefile
        29 dir.info
        3030lost+found
        3131update.out
  • branches/GNU/src/gcc/libjava/java/security/Security.java

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r1390 r1391  
    11/* Security.java --- Java base security class implmentation
    2    Copyright (C) 1999, 2001 Free Software Foundation, Inc.
     2   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
    33
    44This file is part of GNU Classpath.
     
    3838package java.security;
    3939import java.io.File;
    40 import java.io.FileInputStream;
     40import java.io.InputStream;
    4141import java.io.IOException;
    4242import java.io.FileNotFoundException;
     43
    4344import java.security.Provider;
    4445import java.util.Vector;
     
    5657{
    5758  private static Vector providers = new Vector();
    58   private static Properties secprops;
     59  private static Properties secprops;
    5960
    6061  static
    6162  {
    62     loadProviders(System.getProperty("java.vm.name"));
    63     loadProviders("classpath");
     63    String base = System.getProperty("gnu.classpath.home.url");
     64    String vendor = System.getProperty("gnu.classpath.vm.shortname");
     65
     66    // Try VM specific security file
     67    boolean loaded = loadProviders(base, vendor);
     68
     69    // Append classpath standard provider if possible
     70    if (!loadProviders(base, "classpath") && !loaded && providers.size() == 0)
     71      {
     72        // No providers found and both security files failed to load properly.
     73        System.err.println
     74                ("WARNING: could not properly read security provider files:");
     75        System.err.println
     76                ("         " + base + "/security/" + vendor + ".security");
     77        System.err.println
     78                ("         " + base + "/security/" + "classpath" + ".security");
     79        System.err.println
     80                ("         Falling back to standard GNU security provider");
     81        providers.addElement(new gnu.java.security.provider.Gnu());
     82      }
    6483  }
    6584
     
    6988  }
    7089
    71   private static void loadProviders(String vendor)
    72   {
    73     if (vendor == null)
    74       return;
    75 
    76     String separator = System.getProperty("file.separator");
    77     String secfilestr = (System.getProperty("java.home") +
    78                          separator + "lib" +
    79                          separator + "security" +
    80                          separator + vendor + ".security");
    81 
     90  /**
     91   * Tries to load the vender specific security providers from the given
     92   * base URL. Returns true if the resource could be read and completely
     93   * parsed successfully, false otherwise.
     94   */
     95  private static boolean loadProviders(String baseUrl, String vendor)
     96  {
     97    if (baseUrl == null || vendor == null)
     98      return false;
     99
     100    boolean result = true;
     101    String secfilestr = baseUrl + "/security/" + vendor + ".security";
    82102    try
    83103      {
    84         FileInputStream fin = new FileInputStream(secfilestr);
    85         secprops = new Properties();
     104        InputStream fin = new URL(secfilestr).openStream();
    86105        secprops.load(fin);
    87106
     
    89108        String name;
    90109
    91         while ((name = secprops.getProperty("security.provider." + i++)) !=
     110        while ((name = secprops.getProperty("security.provider." + i)) !=
    92111               null)
    93112          {