Results 1 to 20 of 27
Thread: Quaere - Out of bounds exception
- 01-12-2012, 01:22 PM #1
Member
- Join Date
- Jan 2012
- Posts
- 12
- Rep Power
- 0
Quaere - Out of bounds exception
I am using quaere to get the common elements from 2 ArrayLists that hold objects of the same type.
I get out of bounds exception that does not make any logical sense.
The first ArrayList has 20 elements and the second 9 and i get the following error:
java.lang.IndexOutOfBoundsException: Index: 16, Size: 16
If it would be of any help I am using the following query:
from("concept").in(s.getConcepts()).
join("supportedconcept").in(listSupportedConcepts) .on("concept.id").
equals("supportedconcept.id").select("concept").it erator()
I would really appreciate your help.
- 01-12-2012, 02:41 PM #2
Re: Quaere - Out of bounds exception
For an array of 16 elements, the max index is 15. Remember array indexes are 0 based.IndexOutOfBoundsException: Index: 16, Size: 16
- 01-12-2012, 02:50 PM #3
Member
- Join Date
- Jan 2012
- Posts
- 12
- Rep Power
- 0
Re: Quaere - Out of bounds exception
Thank you for your reply. Yes I am aware that array indexes are 0 based.
I get out of bounds exception for index 16 and my arraylist has 20 elements. Any ideas what triggers this exception?
- 01-12-2012, 02:53 PM #4
Re: Quaere - Out of bounds exception
Usually the computer is right on things like this.
Try debugging the code by adding a println just before the statement where the exception occurs and print out the size of the arraylist and the value of the index being used.
- 01-12-2012, 03:06 PM #5
Member
- Join Date
- Jan 2012
- Posts
- 12
- Rep Power
- 0
Re: Quaere - Out of bounds exception
I am printing the size of the arraylist before the exception occurs, but how can i know the value of the index being used since I am using Quaere and not a For loop?
- 01-12-2012, 03:50 PM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Re: Quaere - Out of bounds exception
Is there a Quaere forum?
I've never heard of it myself...
Have you got the stack trace of that exception?
- 01-12-2012, 04:05 PM #7
Member
- Join Date
- Jan 2012
- Posts
- 12
- Rep Power
- 0
Re: Quaere - Out of bounds exception
Quaere allows you to query collections without using Loops, it is the equivalent of LINQ, but Quaere is special for Java (Quaere - Home)
Unfortunately there is no related forum :(
This is the stack trace of the exception:
java.lang.IndexOutOfBoundsException: Index: 16, Size: 16
at java.util.ArrayList.rangeCheck(ArrayList.java:604)
at java.util.ArrayList.get(ArrayList.java:382)
at org.quaere.objects.ObjectQueryEngine.visit(ObjectQ ueryEngine.java:95)
at org.quaere.expressions.JoinClause.accept(JoinClaus e.java:26)
at org.quaere.objects.ObjectQueryEngine.visit(ObjectQ ueryEngine.java:197)
at org.quaere.expressions.QueryBody.accept(QueryBody. java:39)
at org.quaere.objects.ObjectQueryEngine.visit(ObjectQ ueryEngine.java:218)
at org.quaere.expressions.QueryExpression.accept(Quer yExpression.java:24)
at org.quaere.objects.ObjectQueryEngine.evaluate(Obje ctQueryEngine.java:535)
at org.quaere.dsl.QueryExpressionBuilderImpl.iterator (QueryExpressionBuilderImpl.java:94)
at simulator.Algorithm.SemanticSuperNodeAlgorithm.fin dConceptsSupportedSuperNodes(SemanticSuperNodeAlgo rithm.java:1479)
at simulator.Algorithm.SemanticSuperNodeAlgorithm.spl itOverloadedSN(SemanticSuperNodeAlgorithm.java:985 )
at simulator.Algorithm.SemanticSuperNodeAlgorithm.pro cessAdaptivity(SemanticSuperNodeAlgorithm.java:921 )
at simulator.Topology.Node.processAdaptivity(Node.jav a:156)
at simulator.Topology.Semantic.SemanticTopology.proce ssAdaptivity(SemanticTopology.java:696)
at simulator.Topology.Topology.executeIteration(Topol ogy.java:52)
at simulator.Simulator.executeExperiment(Simulator.ja va:48)
at simulator.Main.main(Main.java:34)
- 01-12-2012, 05:52 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Re: Quaere - Out of bounds exception
Maybe you've found a bug?
Something inside it is looking for the 17th element in an array with only 16.
- 01-12-2012, 05:53 PM #9
Re: Quaere - Out of bounds exception
What arraylist is causing the exception?
What is the size of that arraylist? What does your println show its size to be?
- 01-12-2012, 06:21 PM #10
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Re: Quaere - Out of bounds exception
It's going wrong here:
simulator.Algorithm.SemanticSuperNodeAlgorithm.fin dConceptsSupportedSuperNodes(SemanticSuperNodeAlgo rithm.java:1479)
Since that's your code (by the look of it) what is happening at this point?
You haven't shown us.
- 01-12-2012, 07:23 PM #11
Member
- Join Date
- Jan 2012
- Posts
- 12
- Rep Power
- 0
Re: Quaere - Out of bounds exception
Thank you for your help guys.
As I have mentioned above the error occurs in this piece of code (simulator.Algorithm.SemanticSuperNodeAlgorithm.fi ndConceptsSupportedSuperNodes(SemanticSuperNodeAlg o rithm.java:1479)):
from("supportedconcept").in(listSupportedConcepts) .
join("concept").in(s.getConcepts()).on("supportedc oncept.id").
equals("concept.id").select("supportedconcept").it erator());
I am trying to retrieve the common elements of the two arraylists.
The first arraylist (listSupportedConcepts) has 20 elements and the second (s.getConcepts()) has 9.
- 01-12-2012, 07:25 PM #12
Re: Quaere - Out of bounds exception
If the arraylist has more than 16 elements, then why the exception? Where is the arraylist that is too small?
What did the println of the arraylist's size print out?
- 01-12-2012, 07:31 PM #13
Member
- Join Date
- Jan 2012
- Posts
- 12
- Rep Power
- 0
Re: Quaere - Out of bounds exception
I am wondering about the same thing, why get an exception for index 16, it would make more sense to get the exception for index 20.
The println for the arraylists' size gives the following sizes:
listSupportedConcepts: 20 elements
s.getConcepts(): 9 elements
- 01-12-2012, 07:34 PM #14
Re: Quaere - Out of bounds exception
Maybe as Tolls suggested there is a bug in their code
- 01-12-2012, 08:33 PM #15
Member
- Join Date
- Jan 2012
- Posts
- 12
- Rep Power
- 0
Re: Quaere - Out of bounds exception
Thank you for your replies guys!!
Do you have anything equivalent to Quaere to suggest???
- 01-12-2012, 08:40 PM #16
Re: Quaere - Out of bounds exception
What's wrong with Java SE?
- 01-12-2012, 08:42 PM #17
Member
- Join Date
- Jan 2012
- Posts
- 12
- Rep Power
- 0
Re: Quaere - Out of bounds exception
Do you mean using Loops????
- 01-12-2012, 08:42 PM #18
Re: Quaere - Out of bounds exception
I mean writing whatever code is needed
- 01-12-2012, 09:04 PM #19
Member
- Join Date
- Jan 2012
- Posts
- 12
- Rep Power
- 0
Re: Quaere - Out of bounds exception
What piece of code will you propose for getting the common elements from two arraylists????
- 01-12-2012, 09:05 PM #20
Similar Threads
-
Out of bounds exception
By MetalR0 in forum New To JavaReplies: 9Last Post: 07-31-2011, 07:08 PM -
Out of Bounds Exception
By johnwy8 in forum Java AppletsReplies: 1Last Post: 12-08-2010, 08:19 PM -
array Index out of Bounds exception== 0
By Allgorythm in forum New To JavaReplies: 6Last Post: 02-11-2010, 04:02 PM -
Array out of bounds exception 20.
By dropt in forum New To JavaReplies: 4Last Post: 09-21-2009, 10:32 PM -
[SOLVED] out of bounds exception help
By soxfan714 in forum New To JavaReplies: 21Last Post: 11-11-2008, 08:16 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks