Burp Suite User Forum

Create new post

applyMarker in Ruby - java Class Cast Exception

BullKing | Last updated: Sep 21, 2016 06:58PM UTC

I am using Ruby to develop an extender, that do passive scan for a particular string in response. Everything is working fine apart from applyMarkers. When applyMarkers method is called I am receive the below error. Any Idea how to fix this ? How to Cast? what is [I in java ? Error: java.lang.RuntimeException: java.lang.ClassCastException: org.jruby.RubyArray cannot be cast to [I Thanks

PortSwigger Agent | Last updated: Sep 22, 2016 08:08AM UTC

The meaning of [I in the Java error message is a native array of int values. It looks like whatever you are doing in your Ruby code is causing JRuby to pass a RubyArray object to the Java API, rather than an int[] object.

Burp User | Last updated: Sep 22, 2016 07:55PM UTC

Exactly, anyhow I fixed this by creating the Java array of type int as below. ary = [a, b].to_java Java::int a and b - starting and ending byte value of the the string to be marked. Then above Array 'ary' can be added to the Array (can be Ruby array, need not convert to Java Array again), which will be passed to applyMarkers method. matches << ary @callbacks.apply_markers(messageInfo, nil, matches) Hope this will help someone.

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.