You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since 1.7.5 Ruby.java sets the system property java.net.preferIPv4Stackin its private method setNetworkStack(). If running with enabled java security (e.g. in a web application) this may fail, if the jruby domain has not been granted the appropiate PropertyPermission.
An easy fix would be to wrap the security related calls in a try-catch-block and ignore or log any thrown AccessControlException.
I made a fix locally, a working patch would look like this:
--- a/core/src/main/java/org/jruby/Ruby.java
+++ b/core/src/main/java/org/jruby/Ruby.java
@@ -131,6 +131,7 @@ import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.net.BindException;
import java.nio.channels.ClosedChannelException;
+import java.security.AccessControlException;
import java.security.SecureRandom;
import java.util.*;
import java.util.concurrent.Callable;
@@ -4493,10 +4494,16 @@ public final class Ruby {
}
private void setNetworkStack() {
- if (config.getIPv4Preferred()) {
- System.setProperty("java.net.preferIPv4Stack", "true");
- } else {
- System.setProperty("java.net.preferIPv4Stack", "false");
+ try {
+ if (config.getIPv4Preferred()) {
+ System.setProperty("java.net.preferIPv4Stack", "true");
+ } else {
+ System.setProperty("java.net.preferIPv4Stack", "false");
+ }
+ } catch (AccessControlException e) {
+ LOG.debug("unable to set network stack system property due to "
+ + "security restrictions, please set it manually as JVM "
+ + "parameter (-Djava.net.preferIPv4Stack=true|false)");
}
}
The text was updated successfully, but these errors were encountered:
Since 1.7.5
Ruby.java
sets the system propertyjava.net.preferIPv4Stack
in its private methodsetNetworkStack()
. If running with enabled java security (e.g. in a web application) this may fail, if the jruby domain has not been granted the appropiatePropertyPermission
.An easy fix would be to wrap the security related calls in a try-catch-block and ignore or log any thrown AccessControlException.
I made a fix locally, a working patch would look like this:
The text was updated successfully, but these errors were encountered: