Author: tolusha
Date: 2010-06-18 09:09:06 -0400 (Fri, 18 Jun 2010)
New Revision: 2661
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java
Log:
EXOJCR-756: fix
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java 2010-06-18
11:04:39 UTC (rev 2660)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java 2010-06-18
13:09:06 UTC (rev 2661)
@@ -31,6 +31,9 @@
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
/**
* Created by The eXo Platform SAS.
@@ -243,7 +246,35 @@
try
{
// get the inet address
- InetAddress local = InetAddress.getLocalHost();
+ InetAddress local = null;
+ PrivilegedExceptionAction<InetAddress> action = new
PrivilegedExceptionAction<InetAddress>()
+ {
+ public InetAddress run() throws Exception
+ {
+ return InetAddress.getLocalHost();
+ }
+ };
+ try
+ {
+ local = AccessController.doPrivileged(action);
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof UnknownHostException)
+ {
+ throw (UnknownHostException)cause;
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
+
localAddr = local.getHostAddress() + " (" + local.getHostName() +
")";
}
catch (UnknownHostException e)
Show replies by date