Getting StringIndexOutOfBounds exception with Progress Database - java

I am getting the below exception when I am trying to retrieve data from Progress database.
Exception::java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1768)
at com.progress.sql.jdbc.JdbcProgressResultSet.reWordAsCountQuery(JdbcProgressResultSet.java:6634)
at com.progress.sql.jdbc.JdbcProgressResultSet.calculateRowCount(JdbcProgressResultSet.java:6427)
at com.progress.sql.jdbc.JdbcProgressResultSet.initialize(JdbcProgressResultSet.java:157)
at com.progress.sql.jdbc.JdbcProgressStatement.getResultSet(JdbcProgressStatement.java:435)
at com.progress.sql.jdbc.JdbcProgressPreparedStatement.executeQuery(JdbcProgressPreparedStatement.java:97)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at com.esb.service.DBService.handleStatement(DBService.java:992)
One thing I noticed is if I put a space at the beginning or end of the query the query works fine.But this looks strange to me.
Can any one help me resolve this issue.
Thanks in Advance.

Given this bug report page, it looks like you basically need to update to a later release.

Related

NullPointerException when training with h2o's AutoML

I've been using h2o for about 3 years and first time these kind of error happens to me. I can't share a reproducible example because I'm using sensitive data but the dataset contains about 20K observations, R version 4.0.2, macOS Catalina 10.15.6, latest stable version h20 3.30.1.3. Could you please help me understand the error? This is the result after a couple of minutes training models (53% done according to the progress bar):
java.lang.NullPointerException
java.lang.NullPointerException
at hex.ModelMetrics.getMetricFromModelMetric(ModelMetrics.java:151)
at ai.h2o.automl.leaderboard.Leaderboard.getMetrics(Leaderboard.java:558)
at ai.h2o.automl.leaderboard.Leaderboard.updateModels(Leaderboard.java:422)
at ai.h2o.automl.leaderboard.Leaderboard.lambda$addModels$0(Leaderboard.java:381)
at ai.h2o.automl.leaderboard.Leaderboard.atomicUpdate(Leaderboard.java:442)
at ai.h2o.automl.leaderboard.Leaderboard.addModels(Leaderboard.java:378)
at ai.h2o.automl.leaderboard.Leaderboard.addModel(Leaderboard.java:459)
at ai.h2o.automl.ModelingStepsExecutor.addModel(ModelingStepsExecutor.java:186)
at ai.h2o.automl.ModelingStepsExecutor.monitor(ModelingStepsExecutor.java:163)
at ai.h2o.automl.ModelingStepsExecutor.submit(ModelingStepsExecutor.java:82)
at ai.h2o.automl.AutoML.learn(AutoML.java:604)
at ai.h2o.automl.AutoML.run(AutoML.java:407)
at ai.h2o.automl.H2OJob$1.compute2(H2OJob.java:33)
at water.H2O$H2OCountedCompleter.compute(H2O.java:1563)
at jsr166y.CountedCompleter.exec(CountedCompleter.java:468)
at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263)
at jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974)
at jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477)
at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
I have a hunch that if I use the same data input for training_frame and leaderboard_frame this error happens. If there's anything else I can share to help understand this issue, let me know! Thanks.

Itext hyphenation in Table cells

I´m creating a table using iText.
But the output looks really bad, because of the hyphenation, which seems not to be done properly.
I allready read this question How to hyphenate text?
and this example http://itextpdf.com/sandbox/tables/HyphenationExample
I tried the example in eclipse after i added the itext_hyph_xml.jar to my class path. No error is thrown when i run the code, but the lines
Hyphenator h = new Hyphenator("de", "DE", 2, 2);
Hyphenation s = h.hyphenate("Leistungsscheinziffer");
System.out.println(s);
print null to the console instead of "Lei-stungs-schein-zif-fer" or something similar as i expected.
I tried playing with the parameters in
chunk.setHyphenation(new HyphenationAuto("de", "DE", 2,2));
but the output in the document never differes even slightly.
The code i´m trying to get to work looks kind of like this by the way:
for(String s: interest){
Chunk chunk = new Chunk(s,FONT[0]);
chunk.setHyphenation(new HyphenationAuto("de", "DE", 2,3));
table.addCell(new Phrase(chunk));
}
Ok I figured it out on my own now.
And because i couldn´t find the answer on the internet i thought i will share it here so anyone who might have the same error in the future wouldn´t need a week to figure it out.
It seems that in the class Hyphenator the defaultHyphLocation is set like this:
private static final String defaultHyphLocation = "com/itextpdf/text/pdf/hyphenation/hyph/";
But the structure of itext_hyph.jar looks like this:
com.lowagie.text.pdf.hyphenation.hyph
Obviously loading a hyph file from the jar will surely fail, since the path used by Hyphenator can not be found. I actually thought this would cause an error but it seems simply null is returned when the loading of the hyph file fails.
Calling Hyphenator.setHyphenDir("com/lowagie/text/pdf/hyphenation/hyph/"); however wouldn´t change a thing as one would think, since it changes the wrong string variable.
The only thing i could think of to solve this problem was to recreate the itext_hyph.jar according to the path given in Hyphenator and that acctually fixed it. Hyphenation is now working.

Getting "JSONObject["myKey"] is not a JSONArray."

I have a bit of code that has been working for years
JSONObject variableData = new JSONObject(request.getParameter("VARIABLE_DATA"));
JSONArray companies = variableData.getJSONArray("COMPANIES");
and today, I get the following error:
JSONObject["COMPANIES"] is not a JSONArray.
I have stopped the code prior to executing the getJSONArray() call and looked into variableData. Here is what I find:
{"COMPANIES":[{"COMPANY":"2"}]}
To me, this looks like a valid JSONArray to be pulled from a valid JSONObject, so I'm flummoxed and looking for help. Thanks.
your piece of code works fine when using org.json-20120521.jar. I think there is something wrong with the jar you are using.
But "COMPANIES":[{"COMPANY":"2"}] is not a valid json. Other question that I would ask is the exception reproducible? Did you get this data from exact same request that produced the exception? Is there a chance that your server got corrupted data? Try to write a unit test that covers this case and check were it takes you.

OCPsoft Rewrite Rule no longer works after Update from 1.0.5 to 1.1.0

When updating OCPsoft Rewrite from Version 1.0.5.Final to 1.1.0.Final the following Rule no longer works and I don't know how to fix it:
.addRule(
Join.path("/{i}/{d}")
.where("i").matches("[-_a-zA-Z0-9~*]{8}")
.where("d").matches("[-_a-zA-Z0-9~*]{32}")
.to("/resources/html/user/doSomething.html?i={i}&d={d}")
)
In the Rewrite changelog there is one point that could help you help me:
Configuration strings are now literal. Regular expressions must be configured through a >parameter such as: .defineRule().when(Path.matches("/{*}").where("*").matches(".*"))
The exception I get is the following one:
Exception starting filter OCPsoft Rewrite Filter
java.lang.NullPointerException
at org.ocpsoft.rewrite.servlet.config.rule.Join.where(Join.java:199)
at org.ocpsoft.rewrite.servlet.config.rule.Join.where(Join.java:47)
at com.myapp.util.RewriteConfigurationProvider.getConfiguration(RewriteConfigurationProvider.java:39)
...
The following did the trick, I just had to reorder the join clauses:
.addRule(
Join.path("/{i}/{d}")
.to("/resources/html/user/doSomething.html")
.where("i").matches("[-_a-zA-Z0-9~*]{8}")
.where("d").matches("[-_a-zA-Z0-9~*]{32}")
.withRequestBinding();
)
Thanks to Lincoln, who figured this out and answered my question on the Rewrite support forums.
Hmm.. that does look like a bug, I'll try to reproduce this, but you shouldn't need to re-define {i} and {d} in the target URL. Join will handle that for you automatically if you use request binding, like so:
.addRule(
Join.path("/{i}/{d}")
.where("i").matches("[-_a-zA-Z0-9~*]{8}")
.where("d").matches("[-_a-zA-Z0-9~*]{32}")
.to("/resources/html/user/doSomething.html").withRequestBinding();
)
I'm guessing if you do that, your problem will go away. You can also use .withInboundCorrection() if you'd like to redirect requests for the old .html URL to the new URL.
If you still have a problem with this, please post on the support forums and we'll get it figured out :)
Sorry you had trouble, hopefully it won't be trouble any more :)

Url Encoding problem in Java and Solr

I am working in Solr and making some filter quires. One of my filter is consists of a space
for eg:- "fq=listing_type:New home"
But this is giving error. No result is comming out.
I also tried "fq=Listing_type:New+home"
This was not giving error. But no results are comming out. Event there is some xml which have thse values.
Can anyone tell me where is my error?
Here you see the schema.xml
Have you tried with fq=listing_type:"New home" ??? Why dont you index this field as "NewHome" ?

Categories

Resources