Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set up a SecurityManager from JRuby
require 'java'
class JRubySecurityManager < java.lang.SecurityManager
def checkPermission( perm )
puts perm.inspect
end
end
java.lang.System.setSecurityManager( JRubySecurityManager.new )
# from 1.6.0.RC3 (it's about the same on 1.5.6)
JavaClass.java:835:in `installClassFields': java.lang.NullPointerException
from JavaClass.java:702:in `setupProxy'
from Java.java:524:in `createProxyClass'
from Java.java:453:in `getProxyClass'
from Java.java:362:in `getInstance'
from JavaUtil.java:160:in `convertJavaToUsableRubyObject'
from JavaProxyConstructor.java:220:in `invoke'
from null:-1:in `checkPermission'
from SecurityManager.java:871:in `checkRead'
from File.java:752:in `isDirectory'
from JavaSecuredFile.java:128:in `isDirectory'
from ChannelDescriptor.java:772:in `open'
from ChannelDescriptor.java:683:in `open'
from ChannelStream.java:1453:in `fopen'
from RubyFile.java:605:in `fopen'
from RubyFile.java:567:in `openInternal'
from RubyFile.java:528:in `openFile'
from RubyFile.java:434:in `initialize'
from RubyFile$i$0$2$initialize.gen:65535:in `call'
from CachingCallSite.java:78:in `callBlock'
from CachingCallSite.java:84:in `call'
from RubyClass.java:820:in `newInstance'
from RubyIO.java:1116:in `open'
from RubyIO$s$0$2$open.gen:65535:in `call'
from DynamicMethod.java:217:in `call'
from CachingCallSite.java:312:in `cacheAndCall'
from CachingCallSite.java:182:in `callBlock'
from CachingCallSite.java:191:in `callIter'
from CallTwoArgBlockNode.java:62:in `interpret'
from NewlineNode.java:103:in `interpret'
from BlockNode.java:71:in `interpret'
from ASTInterpreter.java:111:in `INTERPRET_BLOCK'
from InterpretedBlock.java:374:in `evalBlockBody'
from InterpretedBlock.java:328:in `yield'
from BlockBody.java:73:in `call'
from Block.java:89:in `call'
from RubyProc.java:268:in `call'
from RubyProc.java:232:in `call'
from Ruby.java:2706:in `tearDown'
from Ruby.java:2693:in `tearDown'
from Main.java:201:in `internalRun'
from Main.java:164:in `run'
from Main.java:148:in `run'
from Main.java:128:in `main'
Exception in thread "main" java.lang.NullPointerException
at org.jruby.javasupport.JavaClass.installClassFields(JavaClass.java:835)
at org.jruby.javasupport.JavaClass.setupProxy(JavaClass.java:702)
at org.jruby.javasupport.Java.createProxyClass(Java.java:524)
at org.jruby.javasupport.Java.getProxyClass(Java.java:453)
at org.jruby.javasupport.Java.getProxyClass(Java.java:453)
at org.jruby.javasupport.Java.getInstance(Java.java:362)
at org.jruby.javasupport.JavaUtil.convertJavaToUsableRubyObject(JavaUtil.java:160)
at org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:220)
at org.jruby.proxy.java.lang.SecurityManager$Proxy0.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkExit(SecurityManager.java:744)
at java.lang.Runtime.exit(Runtime.java:88)
at java.lang.System.exit(System.java:904)
at org.jruby.Main.main(Main.java:141)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment