Page 1 of 2 12 LastLast
Results 1 to 20 of 27
  1. #1
    ampossible is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default 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.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default Re: Quaere - Out of bounds exception

    IndexOutOfBoundsException: Index: 16, Size: 16
    For an array of 16 elements, the max index is 15. Remember array indexes are 0 based.

  3. #3
    ampossible is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default 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?

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default 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.

  5. #5
    ampossible is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default 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?

  6. #6
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,184
    Rep Power
    20

    Default 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?

  7. #7
    ampossible is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default 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)

  8. #8
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,184
    Rep Power
    20

    Default 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.

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default 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?

  10. #10
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,184
    Rep Power
    20

    Default 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.

  11. #11
    ampossible is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default 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.

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default 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?

  13. #13
    ampossible is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default 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

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default Re: Quaere - Out of bounds exception

    Maybe as Tolls suggested there is a bug in their code

  15. #15
    ampossible is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default Re: Quaere - Out of bounds exception

    Thank you for your replies guys!!

    Do you have anything equivalent to Quaere to suggest???

  16. #16
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default Re: Quaere - Out of bounds exception

    What's wrong with Java SE?

  17. #17
    ampossible is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default Re: Quaere - Out of bounds exception

    Do you mean using Loops????

  18. #18
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default Re: Quaere - Out of bounds exception

    I mean writing whatever code is needed

  19. #19
    ampossible is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default Re: Quaere - Out of bounds exception

    What piece of code will you propose for getting the common elements from two arraylists????

  20. #20
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

Page 1 of 2 12 LastLast

Similar Threads

  1. Out of bounds exception
    By MetalR0 in forum New To Java
    Replies: 9
    Last Post: 07-31-2011, 08:08 PM
  2. Out of Bounds Exception
    By johnwy8 in forum Java Applets
    Replies: 1
    Last Post: 12-08-2010, 09:19 PM
  3. array Index out of Bounds exception== 0
    By Allgorythm in forum New To Java
    Replies: 6
    Last Post: 02-11-2010, 05:02 PM
  4. Array out of bounds exception 20.
    By dropt in forum New To Java
    Replies: 4
    Last Post: 09-21-2009, 11:32 PM
  5. [SOLVED] out of bounds exception help
    By soxfan714 in forum New To Java
    Replies: 21
    Last Post: 11-11-2008, 09:16 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •