Hi I am working on expanding someone else’s code and have been working
with
it for almost a year now. Recently, it just randomly stopped working. I
have
re installed an older version of java to see if it was that, I never
updated
jruby or anything, all I did was install git (version control). I didn’t
really do anything, however it said it will replace LF lines with CRLF
or
something like that. Anyway the code has been running fine for ages, I
haven’t made any modifications and I go to run a test yesterday and I
get
this:
This error message is on my ubuntu machine, however I get a similar
error on
my windows machine (on which the code has been running fine on for
ages):
jruby run.rb test
=================Processing FREDERICKSBURG_1.1=======================
ERROR IN TESTING wrong element type class java.lang.String(array
contains
char)
/home/daryl/Desktop/work/Code/geografikos/lib/sentence_splitter/splitter.rb:21:in
to_java' /home/daryl/Desktop/work/Code/geografikos/lib/sentence_splitter/splitter.rb:21:in
split’
/home/daryl/Desktop/work/Code/geografikos/lib/models/page.rb:103:in
sentences' /home/daryl/Desktop/work/Code/geografikos/lib/extractor/lingpipe_svm.rb:34:in
extract’
/home/daryl/Desktop/work/Code/geografikos/lib/extractor/geo_controller.rb:9:in
process' /home/daryl/Desktop/work/Code/geografikos/lib/extractor/geo_controller.rb:8:in
each’
/home/daryl/Desktop/work/Code/geografikos/lib/extractor/geo_controller.rb:8:in
process' /home/daryl/Desktop/work/Code/geografikos/lib/extractor/geo_controller.rb:6:in
each’
/home/daryl/Desktop/work/Code/geografikos/lib/extractor/geo_controller.rb:6:in
process' /home/daryl/Desktop/work/Code/geografikos/lib/statistics.rb:111:in
generate_all’
/home/daryl/Desktop/work/Code/geografikos/lib/statistics.rb:105:in
each' /home/daryl/Desktop/work/Code/geografikos/lib/statistics.rb:105:in
generate_all’
run.rb:56
The line of code causing the error is:
tokenizer =
IndoEuropeanTokenizerFactory.new.tokenizer(text.split(‘’).to_java(:char),
0,
text.length)
What I need to do is convert individual ruby strings (thus the .split to
split it into characters), and use them as an argument into a java class
(which should be java chars). I have tested the to_java function and I
cannot do something like:
irb(main):002:0> [‘1’,‘2’,‘3’].to_java :char
ArgumentError: wrong element type class java.lang.String(array contains
char)
from (irb):3:in `to_java’
from (irb):3
I have never had this problem before, and the code has been functional
for a
very long time. No changes have been made regarding this class in
general so
I have no idea why it would suddenly stop working. Any help would be
greatly
appreciated.
java version “1.6.0_18”
OpenJDK Runtime Environment (IcedTea6 1.8) (6b18-1.8-0ubuntu1)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
View this message in context:
http://old.nabble.com/to_java-no-longer-working--ERROR-IN-TESTING-wrong-element-type-class-java.lang.String(array-contains-char)-tp28893527p28893527.html
Sent from the JRuby - User mailing list archive at Nabble.com.
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email