This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can anyone please help me spot my errors?

 
Anissa Pary
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. I have 2 classes


and Test class

1 failure at resizing It says resizing too often is inefficient and resizing was done 13 times. But I don't see why. Can anyone please help!

 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anissa Pary wrote:
I am getting 6 errors and when I am debugging it is NullPointer in lines 136 and 140 and 137. But I don't see why. Can anyone please help!



That looks like 3 errors, not 6. And the code you posted doesn't have those line numbers.
 
Scott Kimberly
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote:
Anissa Pary wrote:
I am getting 6 errors and when I am debugging it is NullPointer in lines 136 and 140 and 137. But I don't see why. Can anyone please help!



That looks like 3 errors, not 6. And the code you posted doesn't have those line numbers.


Assuming thats all the code for the program, there are 214 lines. The errors are at like 48 or (line 48 i think is really line 136) of that last large block.

I find that null pointer exceptions come from variables that can be set to null be shouldnt be for the purposes of your code.
 
Anissa Pary
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I have made a mistake and printed wrong stuff this six mistakes was from another program and here it is just a failure...
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anissa Pary wrote:Sorry I have made a mistake and printed wrong stuff this six mistakes was from another program and here it is just a failure...


Okay, so, what exact errors are you getting here and on which exact lines are they occurring?
 
Anissa Pary
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote:
Anissa Pary wrote:Sorry I have made a mistake and printed wrong stuff this six mistakes was from another program and here it is just a failure...


Okay, so, what exact errors are you getting here and on which exact lines are they occurring?

it is saying runs:6/6 errors:0 failures: 1
junit.framework.AssertionFailedError: Resizing too often (inefficient) expected: <-1> but was <13> at CircularArrayQueueTest.testResize(CircularArrayQueueTest.java:122). So, it means

in the method:

but when I am changing the value of it is still complaining and it fails only when I run the code
 
Anissa Pary
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anissa Pary wrote:
Jeff Verdegan wrote:
Anissa Pary wrote:Sorry I have made a mistake and printed wrong stuff this six mistakes was from another program and here it is just a failure...


Okay, so, what exact errors are you getting here and on which exact lines are they occurring?

it is saying runs:6/6 errors:0 failures: 1
junit.framework.AssertionFailedError: Resizing too often (inefficient) expected: <-1> but was <13> at CircularArrayQueueTest.testResize(CircularArrayQueueTest.java:122). So, it means

in the method:

but when I am changing the value of it is still complaining and it fails only when I run the code

OK get it working now anyway thanks for looking in my code!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic