Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /*
   * JBoss, Home of Professional Open Source
   * Copyright 2005, JBoss Inc., and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
  
  package org.jboss.remoting;
  
  import java.net.URI;
  import java.util.List;
  import java.util.Map;
  import java.util.TreeMap;
  
  import  org.jboss.logging.Logger;
InvokerLocator is an object that indentifies a specific Invoker on the network, via a unique locator URI. The locator URI is in the format:

protocol://host[:port][/path[?param=value&param2=value2]]

For example, a http based locator might be:

http://192.168.10.1:8081

An example Socket based locator might be:

socket://192.168.10.1:9999

An example RMI based locator might be:

rmi://localhost

NOTE: If no hostname is given (e.g., "socket://:5555"), then the hostname will automatically be resolved to the outside IP address of the local machine. If the given hostname is 0.0.0.0 and the system property "jboss.bind.address" is set, then the hostname will be replaced by the value associated with 'jboss.bind.address".

Author(s):
Jeff Haynie
Tom Elrod
Version:
$Revision: 5918 $
  
  public class InvokerLocator implements Serializable
  {
     static final long serialVersionUID;
     protected static Logger log = Logger.getLogger(InvokerLocator.class); 
     protected static Boolean legacyParsingFlag;
  
     protected String protocol;
     protected String host;
     protected ArrayList connectHomes = new ArrayList();
     protected ArrayList homes = new ArrayList();
     protected int port;
     protected String path;
     protected String query;
     protected Map parameters;
     private String uri;
     private String originalURL;
     private Home homeInUse;
  
  
     static
     {
        if(Version.getDefaultVersion() == .)
        {
            = -2909329895029296248L;
        }
       else
       {
           = -4977622166779282521L;
       }
    }
    
    public static boolean getUseLegacyParsing()
    {
       if ( == null)
          return false;
       return .booleanValue();
    }
    
    public static void setUseLegacyParsing(boolean flag)
    {
        = new Boolean(flag);
    }

   
Indicates should address binding to all network interfaces (i.e. 0.0.0.0)
 
    public static final String ANY = "0.0.0.0";
   
Constant value for server bind address system property. Value is 'jboss.bind.address'.
 
    private static final String SERVER_BIND_ADDRESS = "jboss.bind.address";

   
Public key to use when want to specify that locator look up local address by IP or host name.
 
    public static final String BIND_BY_HOST = "remoting.bind_by_host";


   
Constant to define the param name to be used when defining the data type.
 
    public static final String DATATYPE = "datatype";
    public static final String DATATYPE_CASED = "dataType";

   
Constant to define the param name to be used when defining the serialization type.
 
    public static final String SERIALIZATIONTYPE = "serializationtype";
    public static final String SERIALIZATIONTYPE_CASED = "serializationType";

   
Constant to define the param name to be used when defining the marshaller fully qualified classname
 
    public static final String MARSHALLER = "marshaller";
   
Constant to define the param name to be used when defining the unmarshaller fully qualified classname
 
    public static final String UNMARSHALLER = "unmarshaller";

   
Constant to define what port the marshalling loader port resides on.
 
    public static final String LOADER_PORT = "loaderport";

   
Constant to define the param name to be used when defining if marshalling should be by value, which means will be using local client invoker with cloning of payload value.
 
    public static final String BYVALUE = "byvalue";

   
Constant to define the param name to be used when defining if marshalling should use remote client invoker instead of using local client invoker (even though both client and server invokers are within same JVM).
 
    public static final String FORCE_REMOTE = "force_remote";   

   
Constant to define if client should try to automatically establish a lease with the server. Value for this parameter key should be either 'true' or 'false'.
 
    public static final String CLIENT_LEASE = "leasing";

   
Constant to define what the client lease period should be in the case that server side leasing is turned on. Value for this parameter key should be the number of milliseconds to wait before each client lease renewal and must be greater than zero in order to be recognized.
 
    public static final String CLIENT_LEASE_PERIOD = "lease_period";

   
   
Constant to define if InvokerLocator should use the old (ad hoc) parsing algorithm instead of the new, URI based, parsing algorithm.
 
    public static final String LEGACY_PARSING = "legacyParsing";
   
   
Serves as placeholder in host position when multiple hosts are given in the query part by way of the parameter "hosts". E.g.

socket://multihome:8888/?hosts=host1.jboss.org:host2.jboss.org

 
    public static final String MULTIHOME = "multihome";
   
   
Parameter key used for specifying multiple homes to connect to. E.g.

socket://multihome/?connecthomes=host1.jboss.org:7777!host2.jboss.org:8888

 
    public static final String CONNECT_HOMES_KEY = "connecthomes";
   
   
Parameter key used for specifying multiple binding homes. E.g.

socket://multihome/?homes=a.org:66!b.org:77&homes=c.org:88!d.org:99

 
    public static final String HOMES_KEY = "homes";
   
   
Parameter key used for specifying default connecting port for multihome InvokerLocator.
 
    public static final String DEFAULT_CONNECT_PORT = "defaultConnectPort";
   
   
Parameter key used for specifying default server bind port for multihme InvokerLocator.
 
    public static final String DEFAULT_PORT = "defaultPort";
   
   
Constant to determine if warning about null host should be logged.
 
    public static final String SUPPRESS_HOST_WARNING = "suppressHostWarning";
   
   
InvokerLocator leaves address 0.0.0.0 unchanged. Once serverBindAddress has been extracted from the InvokerLocator, it is necessary to transform 0.0.0.0 into an address that contacted over the network. See JBREM-687.
 
    public static InvokerLocator validateLocator(InvokerLocator locatorthrows MalformedURLException
    {
       InvokerLocator externalLocator = locator;
 
       String host = locator.getHost();
       String newHost = null;
       if(host == null || ..equals(host))
       {
          // now need to get some external bindable address
          try
          {
             newHost = (String)AccessController.doPrivilegednew PrivilegedExceptionAction()
             {
                public Object run() throws Exception
                {
                   String bindByHost = System.getProperty(."True");
                   boolean byHost = Boolean.valueOf(bindByHost).booleanValue();
                   if(byHost)
                   {
                      return getLocalHost().getHostName();
                   }
                   else
                   {
                      return getLocalHost().getHostAddress();
                   }
                }
             });
          }
          catch (PrivilegedActionException e)
          {
             .debug("Could not get host by name or address."e.getCause());
          }
 
          if(newHost == null)
          {
             // now what?  step through network interfaces?
             throw new RuntimeException("Can not determine bindable address for locator (" + locator + ")");
          }
          
          externalLocator = new InvokerLocator(locator.protocolnewHostlocator.port,
                                               locator.getPath(), locator.getParameters());
       }
 
       return externalLocator;
    }
    
    
    public static void extractHomes(String homeListList listint defaultPort)
    {
       StringTokenizer tok = new StringTokenizer(homeList"!");  
       while(tok.hasMoreTokens())
       {
          String h = null;
          int p = -1;
          String token = tok.nextToken();
          boolean isIPv6 = token.indexOf('[') >= 0;
          int boundary;
 
          if (isIPv6)
          {
             int pos = token.indexOf(']');
             if (pos + 1 == token.length())
                boundary = -1;
             else
                boundary = token.indexOf(']') + 1;
             
          }
          else
          {
             boundary = token.lastIndexOf(':');
          }
 
          if (boundary > -1)
          {
             h = token.substring(0, boundary);
 
             try
             {
                p = Integer.valueOf(token.substring(boundary + 1)).intValue();
             }
             catch (NumberFormatException  e)
             {
                .warn("invalid port value: " + token.substring(boundary + 1));
             }
          }
          else
          {
             h = token;
          }
 
          if (p == -1)
             p = defaultPort;
 
          list.add(new Home(hp));
       }
    }
    
    
    public static String convertHomesListToString(List homes)
    {
       if (homes == null || homes.size() == 0)
          return "";
       
       Iterator it = homes.iterator();
       StringBuffer b = new StringBuffer(((Homeit.next()).toString());
       while (it.hasNext())
       {
          b.append("!").append(it.next());
       }
       return b.toString();
    }
    
    private static final InetAddress LOCAL_HOST;
 
    static
    {
       try
       {
           = (InetAddress) AccessController.doPrivilegednew PrivilegedExceptionAction()
          {
             public Object run() throws UnknownHostException
             {
                try
                {
                   return InetAddress.getLocalHost();
                }
                catch (UnknownHostException e)
                {
                   return InetAddress.getByName("127.0.0.1");
                }
             }
          });
       }
       catch (PrivilegedActionException e)
       {
          .debug(InvokerLocator.class.getName() + " unable to get local host address"e.getCause());
          throw new ExceptionInInitializerError(e.getCause());
       }
       catch (SecurityException e)
       {
          .debug(InvokerLocator.class.getName() + " unable to get local host address"e);
          throw e;
       }
    }
    
    private static InetAddress getLocalHost() throws UnknownHostException
    {
       if ( != null)
       {
          return ;
       }
 
       try
       {
          return InetAddress.getLocalHost();
       }
       catch (UnknownHostException e)
       {
          return InetAddress.getByName("127.0.0.1");
       }
    }
   
   
Constructs the object used to identify a remoting server via simple uri format string (e.g. socket://myhost:7000). Note: the uri passed may not always be the one returned via call to getLocatorURI() as may need to change if port not specified, host is 0.0.0.0, etc. If need original uri that is passed to this constructor, need to call getOriginalURI().

Parameters:
uri
Throws:
MalformedURLException
 
    public InvokerLocator(String uri)
          throws MalformedURLException
    {
        = uri;
       parse();
    }
    
    
    private void parse(String uriStringthrows MalformedURLException
    {
       boolean doLegacyParsing = false;
       if ( != null)
       {
          doLegacyParsing = .booleanValue();
       }
       else 
       {
          String s = getSystemProperty();
          doLegacyParsing = "true".equalsIgnoreCase(s);
       }
 
       if (doLegacyParsing)
       {
          .warn("using deprecated legacy URL parsing routine");
          legacyParse(uriString);
       }
       else
       {
          URIParse(uriString);
       }
       
       if ( != null)
       {
          StringTokenizer tok = new StringTokenizer("&");
           = new TreeMap();
          while(tok.hasMoreTokens())
          {
             String token = tok.nextToken();
             int eq = token.indexOf("=");
             String name = (eq > -1) ? token.substring(0, eq) : token;
             String value = (eq > -1) ? token.substring(eq + 1) : "";
             .put(namevalue);
          }
       }
 
       if (!.equals() &&  != null)
       {
          // Use "host:port" to connect.
          String s = (String.remove();
          if (s != null.warn("host != " +  + ": " +  + " will be ignored");
       }
 
       if ( != null)
       {
          String homesString = (String.remove();
          String connectHomesString = (String.remove();
          createHomeLists(homesStringconnectHomesString);
       }
 
 //    rebuild it, since the host probably got resolved and the port changed
       rebuildLocatorURI();
       
       if (!.equals())
       {
           = new Home();
          .add();
          if (.isEmpty())
             .add();
       }
    }
 
    private void URIParse(String uriStringthrows MalformedURLException
    {
       try
       {
          URI uri = new URI(encodePercent(uriString));
           = uri.getScheme();
          checkHost(uri.getHost());
           = decodePercent(resolveHost(uri.getHost()));
           = uri.getPort();
           = uri.getPath();
           = decodePercent(uri.getQuery());
       }
       catch (URISyntaxException e)
       {
          throw new MalformedURLException(e.getMessage());
       }
    }
    
    private void legacyParse(String urithrows MalformedURLException
    {
       .warn("Legacy InvokerLocator parsing is deprecated");
       int i = uri.indexOf("://");
       if(i < 0)
       {
          throw new MalformedURLException("Invalid url " + uri);
       }
       String tmp = uri.substring(i + 3);
       this. = uri.substring(0, i);
       i = tmp.indexOf("/");
       int p = tmp.indexOf(":");
       if(i != -1)
       {
          p = (p < i ? p : -1);
       }
       if(p != -1)
       {
           = resolveHost(tmp.substring(0, p).trim());
          if(i > -1)
          {
              = Integer.parseInt(tmp.substring(p + 1, i));
          }
          else
          {
              = Integer.parseInt(tmp.substring(p + 1));
          }
       }
       else
       {
          if(i > -1)
          {
              = resolveHost(tmp.substring(0, i).trim());
          }
          else
          {
              = resolveHost(tmp.substring(0).trim());
          }
           = -1;
       }
 
       // now look for any path
       p = tmp.indexOf("?");
       if(p != -1)
       {
           = tmp.substring(i + 1, p);
           = tmp.substring(p + 1);
       }
       else
       {
          p = tmp.indexOf("/");
          if(p != -1)
          {
              = tmp.substring(p + 1);
          }
          else
          {
              = "";
          }
           = null;
       }
    }
 
    private static void checkHost(String uriString host)
    {
       if (host == null && !getBoolean())
       {
          StringBuffer sb = new StringBuffer("Host resolves to null in ");
          sb.append(uri).append(". Perhaps the host contains an invalid character.  ");
          sb.append("See http://www.ietf.org/rfc/rfc2396.txt.");
          .warn(sb.toString());
       }
    }
    
    private static final String resolveHost(String host)
    {
       if (host == null)
       {
          host = fixRemoteAddress(host);
       }
       else if(host.indexOf("0.0.0.0") != -1)
       {
          String bindAddress = getSystemProperty("0.0.0.0");         
          if(bindAddress.equals("0.0.0.0"))
          {
             host = fixRemoteAddress(host);
          }
          else
          {
             host = host.replaceAll("0\\.0\\.0\\.0"getSystemProperty());
          }
       }
       return host;
    }
 
    private static String fixRemoteAddress(String address)
    {
       if(address == null)
       {
          try
          {
             address = (String)AccessController.doPrivilegednew PrivilegedExceptionAction()
             {
                public Object run() throws UnknownHostException
                {
                   String bindByHost = System.getProperty("True");
                   boolean byHost = Boolean.valueOf(bindByHost).booleanValue();
 
                   if(byHost)
                   {
                      return getLocalHost().getHostName();
                   }
                   else
                   {
                      return getLocalHost().getHostAddress();
                   }
                }
             });
          }
          catch (PrivilegedActionException e)
          {
             .debug("error"e.getCause());
          }
       }
 
       return address;
    }
   
 
    private void createHomeLists(Map parametersString homesStringString connectHomesString)
    {
       // DEFAULT_PORT value takes precedence, followed by port value.
       int defaultPort = 
       String s = (Stringparameters.get();
       if (s != null && s != "")
       {
          try
          {
             defaultPort = Integer.parseInt(s);
          }
          catch (Exception e)
          {
             .warn("invalid value for " +  + ": " + s);
          }
       }
       
       if (homesString != null)
       {
          extractHomes(homesStringdefaultPort);
       }
       
       // DEFAULT_CONNECT_PORT value takes precedence, followed by 
       // DEFAULT_PORT value and then port value.
       s = (Stringparameters.get();
       if (s != null && s != "")
       {
          try
          {
             defaultPort = Integer.parseInt(s);
          }
          catch (Exception e)
          {
             .warn("invalid value for " +  + ": " + s);
          }
       }
 
       if (connectHomesString != null)
       {
          extractHomes(connectHomesStringdefaultPort);
       }
    }
   
   
   
Constructs the object used to identify a remoting server.

Parameters:
protocol
host
port
path
parameters
 
    public InvokerLocator(String protocolString hostint portString pathMap parameters)
    {
       this. = protocol;
       this. = resolveHost(host);
       this. = port;
       this. = path == null ? "" : path;
       this. = parameters == null ? new TreeMap() : new TreeMap(parameters);
      
       if (this. != null)
       {
          String homesString = (Stringthis..remove();
          String connectHomesString = (Stringthis..remove();
          createHomeLists(this.homesStringconnectHomesString);
       }
       
       // Test for IPv6 host address.
       if (this. != null && this..indexOf(":") >= 0 && this..indexOf("[") == -1)
       {
          this. = "[" + this. + "]";
       }
       
       rebuildLocatorURI();
        = ;
       
       if (!.equals(host))
       {
           = new Home(hostport);
          .add();
          .add();
 
          if (parameters != null)
          {
             // Use "host:port" to connect.
             String s = (Stringparameters.remove();
             if (s != null.warn("host != " +  + ": " +  + " will be ignored");
          }
       }
    }
 
    public int hashCode()
    {
       return .hashCode();
    }

   
Compares to see if Object passed is of type InvokerLocator and it's internal locator uri hashcode is same as this one. Note, this means is testing to see if not only the host, protocol, and port are the same, but the path and parameters as well. Therefore 'socket://localhost:9000' and 'socket://localhost:9000/foobar' would NOT be considered equal.

Parameters:
obj
Returns:
 
    public boolean equals(Object obj)
    {
       return obj != null && obj instanceof InvokerLocator && .equals(((InvokerLocator)obj).getLocatorURI());
    }

   
Compares to see if InvokerLocator passed represents the same physical remoting server endpoint as this one. Unlike the equals() method, this just tests to see if protocol, host, and port are the same and ignores the path and parameters.

Parameters:
compareMe
Returns:
 
    public boolean isSameEndpoint(InvokerLocator compareMe)
    {
       return compareMe != null && getProtocol().equalsIgnoreCase(compareMe.getProtocol()) &&
              getHost().equalsIgnoreCase(compareMe.getHost()) && getPort() == compareMe.getPort();
    }
    
    public boolean isCompatibleWith(InvokerLocator other)
    {
       if (other == null)
          return false;
       
       // If this or other comes from pre-2.4.0 Remoting.
       if ( == null || other.homes == null)
          return false;
       
       boolean result1 = getProtocol().equalsIgnoreCase(other.getProtocol()) &&
                         .equals(other.getPath()) &&
                         .equals(other.getParameters());
       
       ArrayList tempHomes = .isEmpty() ?  : ;
       boolean result2 = intersects(tempHomesother.getConnectHomeList()) || 
                         intersects(tempHomesother.getHomeList());
       
       return result1 && result2;
    }

   
return the locator URI, in the format:

protocol://host[:port][/path[?param=value&param2=value2]] Note, this may not be the same as the original uri passed as parameter to the constructor.

Returns:
 
    public String getLocatorURI()
    {
       return ;
    }
 
    public String getProtocol()
    {
       return ;
    }
 
    public String getHost()
    {
       if (.equals() &&  != null)
          return .;
       
       return ;
    }
    
    public String getActualHost()
    {
       return ;
    }
    
    public boolean isMultihome()
    {
       return .equals();
    }
    
    public String getConnectHomes()
    {
    }
    
    public List getConnectHomeList()
    {
       if ( == null)
       {
          ArrayList list = new ArrayList();
          list.add(new Home());
          return list;
       }
       
       return new ArrayList();
    }
    
    public void setConnectHomeList(List connectHomes)
    {
       if (connectHomes == null)
          this. = new ArrayList();
       else
          this. = new ArrayList(connectHomes);
       
       rebuildLocatorURI();
    }
    
    public Home getHomeInUse()
    {
       if ( != null || isMultihome())
          return ;
       
       return new Home();
    }
    
    public void setHomeInUse(Home homeInUse)
    {
       this. = homeInUse;
    }
    
    public String getHomes()
    {  
       return convertHomesListToString();
    }
    
    public List getHomeList()
    {
       if ( == null)
       {
          ArrayList list = new ArrayList();
          list.add(new Home());
          return new ArrayList();
       }
       
       return new ArrayList();
    }
 
    public void setHomeList(List homes)
    {
       if (homes == null)
          this. = new ArrayList();
       else
          this. = new ArrayList(homes);
       
       rebuildLocatorURI();
    }
    
    public int getPort()
    {
       if (.equals() &&  != null)
          return .;
       
       return ;
    }
    
    public int getActualPort()
    {
       return ;
    }
 
    public String getPath()
    {
       return ;
    }
 
    public Map getParameters()
    {
       if ( == null)
       {
           = new TreeMap();
       }
       return ;
    }
 
    public String toString()
    {
       return "InvokerLocator [" +  + "]";
    }

   
Gets the original uri passed to constructor (if there was one).

Returns:
 
    public String getOriginalURI()
    {
       return ;
    }

   
narrow this invoker to a specific RemoteClientInvoker instance

Returns:
Throws:
Exception
 
    public ClientInvoker narrow() throws Exception
    {  
       try
       {
          return (ClientInvoker) AccessController.doPrivilegednew PrivilegedExceptionAction()
          {
             public Object run() throws Exception
             {
                return InvokerRegistry.createClientInvoker(InvokerLocator.this);
             }
          });
       }
       catch (PrivilegedActionException pae)
       {
          throw pae.getException();
       }
    }
 
 
    public String findSerializationType()
    {
       String serializationTypeLocal = .;
       if( != null)
       {
          serializationTypeLocal = (String.get();
          if(serializationTypeLocal == null)
          {
             serializationTypeLocal = (String.get(.);
             if(serializationTypeLocal == null)
             {
                serializationTypeLocal = .;
             }
          }
       }
 
       return serializationTypeLocal;
    }
 
    protected boolean intersects(Collection c1Collection c2)
    {
       Iterator it = c1.iterator();
       while (it.hasNext())
       {
          if (c2.contains(it.next()))
             return true;
       }
       return false;
    }
    
    protected void rebuildLocatorURI()
    {  
       String portPart = ( > -1) ? (":" + ) : "";
       String divider = .startsWith("/") ? "" : "/";
       String parametersPart = ( != null) ? "?" : "";
        =  + "://" +  + portPart + divider +  + parametersPart;
       
       if( != null)
       {
          if (!.isEmpty())
          if (!.isEmpty())
          
          Iterator iter = .keySet().iterator();
          while(iter.hasNext())
          {
             String key = (Stringiter.next();
             String val = (String.get(key);
             if ("".equals(val))
             {
                 += key;  
             }
             else
             {
                 += key + "=" + val;  
             }
             if(iter.hasNext())
             {
                 += "&";
             }
          }
          
         .remove();
      }
   }
   
   protected static String encodePercent(String s)
   {
      if (s == nullreturn null;
      StringTokenizer st = new StringTokenizer(s"%");
      StringBuffer sb = new StringBuffer();
      int limit = st.countTokens() - 1;
      for (int i = 0; i < limiti++)
      {
         String token = st.nextToken();
         sb.append(token).append("%25");
      }
      sb.append(st.nextToken());
      return sb.toString();
   }
   
   protected static String decodePercent(String s)
   {
      if (s == nullreturn null;
      StringBuffer sb = new StringBuffer();
      int fromIndex = 0;
      int index = s.indexOf("%25"fromIndex);
      while (index >= 0)
      {
         sb.append(s.substring(fromIndexindex)).append('%');
         fromIndex = index + 3;
         index = s.indexOf("%25"fromIndex);
      }
      sb.append(s.substring(fromIndex));
      return sb.toString();
   }
   
   static private String getSystemProperty(final String namefinal String defaultValue)
   {
      if (SecurityUtility.skipAccessControl())
         return System.getProperty(namedefaultValue);
         
      String value = null;
      try
      {
         value = (String)AccessController.doPrivilegednew PrivilegedExceptionAction()
         {
            public Object run() throws Exception
            {
               return System.getProperty(namedefaultValue);
            }
         });
      }
      catch (PrivilegedActionException e)
      {
         throw (RuntimeExceptione.getCause();
      }
      
      return value;
   }
   
   static private String getSystemProperty(final String name)
   {
      if (SecurityUtility.skipAccessControl())
         return System.getProperty(name);
      
      String value = null;
      try
      {
         value = (String)AccessController.doPrivilegednew PrivilegedExceptionAction()
         {
            public Object run() throws Exception
            {
               return System.getProperty(name);
            }
         });
      }
      catch (PrivilegedActionException e)
      {
         throw (RuntimeExceptione.getCause();
      }
      
      return value;
   }
   
   static private boolean getBoolean(final String name)
   {
      if (SecurityUtility.skipAccessControl())
         return Boolean.getBoolean(name);
      
      Boolean value = null;
      try
      {
         value = (Boolean)AccessController.doPrivilegednew PrivilegedExceptionAction()
         {
            public Object run() throws Exception
            {
               return Boolean.valueOf(Boolean.getBoolean(name));
            }
         });
      }
      catch (PrivilegedActionException e)
      {
         throw (RuntimeExceptione.getCause();
      }
      
      return value.booleanValue();
   }
New to GrepCode? Check out our FAQ X