Questions tagged [indexoutofboundsexception]

An exception that occurs when you attempt to access an object that is outside the boundaries of the container. Common containers are arrays or array-based objects. This is a language-independent tag.

0
votes
0answers
5 views

Strange behavour with SqlParameter

Using .Net 4.5.2 I have the following example code... var cmd = new SqlCommand(); cmd.Parameters.Add(new SqlParameter("@CONTENTHYPERLINK", SqlDbType.VarChar, 50)); cmd.Parameters["@contentHyperlink"]....
2
votes
1answer
37 views

I want to the sum of the 6th column vlaues

The code: import csv cr = csv.reader(open("filename")) next(cr) print (sum(float(x[6]) for x in cr)) But getting an error IndexError: list index out of range
0
votes
0answers
14 views

adding node elements to an ArrayList and calling heap methods on the list, throwing a persistent index out of bounds exception [duplicate]

Very basic question but I am quite stuck and growing desperate. Any helpful advice would be very sincerely appreciated. Thanks I'm attempting to add node elements from an existing ArrayList into a ...
0
votes
1answer
40 views

Java Array reversing task compiling error - IndexOutOfBoundsException: 2

I'm trying to reverse the array; i input length of array than it's all values. After that i'm trying to reverse it doing like that: a[i] = a[al - i] in the "for construction" - for(int i = o; i < ...
1
vote
2answers
51 views

How do I split by “/” delimiters using index in python?

In one DataFrame some columns are in the DataFrame. I want to column value to split by "/" using index. Below are the list of columns where i want to split the data. Eg:- split_columns = ['Fuel', '...
-2
votes
0answers
29 views

java.lang.IndexOutOfBoundsException in Arraylist Adapater

server data stored in Arraylist. this data show in recyclerview in android.selected Recyclerview selected link stored in objectbox database and also stored like and unlike count in database store. ...
-1
votes
2answers
61 views

RecyclerView Nesting java.lang.IndexOutOfBoundsException: Invalid index 5, size is 5 [duplicate]

Scenario : I have 5 data in recyclerview, and tried to adding addOnItemTouchListener. First run doing well in 1 until 3 RecyclerView Row. But if I click on 4 and 5 row , it got that exception. Code: ...
-1
votes
0answers
18 views

java.lang.ArrayIndexOutOfBoundsException: 4 [duplicate]

I am trying to deal with, if the champion name is two words(which will have two arguments) its gonna add the 3rd and 4rth args together.... The part where the champion name is only one word which is 1 ...
-2
votes
0answers
27 views

java.lang.ArrayIndexOutOfBoundsException: 0 > 0 Please help me with this [duplicate]

class find implements ActionListener { public void actionPerformed(ActionEvent arg0) { String k = tf1.getText().trim(); int row = table.getRowCount(); int column = table....
0
votes
1answer
46 views

Get error when execute a string which includes multiple SQL statements but data is updated

My environment is JDK 1.6, Eclipse Indigo, JBoss 4.2.3.GA-jdk6. The database is Microsoft SQL Server 2008 R2. I am using jTDS JDBC Driver. I have a string which has multiple SQL statements (UPDATE, ...
1
vote
4answers
50 views

Java method CharAt crashes at comparing to #

So what I want to do is to see if a string starts with a # in a text file. However when I call the comparison of charAt(0) with # it gives out an error. Exception in thread "main" java.lang....
-1
votes
2answers
40 views

I do not receive the address of my location (java.lang.IndexOutOfBoundsException: Index: 0 Size: 0)

I have a code that has to return the coordinates and the address of the coordinates of my device and the place I select on the map, the application gives me the coordinates rounded of my device, but ...
1
vote
1answer
44 views

Getting ArrayIndexOutOfBoundsException for a list

public class pGen_Example { public static void main(String[] args) { long seed = 80; vGen(seed, (int) Math.pow(2, 32), 22695477, 1, 1); } private static void vGen(long x, ...
4
votes
1answer
56 views

Spark distinct followed by join giving IndexOutOfBoundsException

Trying to join two dataframes A & B. B has a distinct operation right before the join. Also one of the columns in B is joined on two columns in A. This specific situation is giving an ...
-2
votes
0answers
20 views

java.lang.ArrayIndexOutOfBoundsException: length=0; index=0 [duplicate]

I created a method that reads data from a inputFrame and return some value. Android Studio doesn't give syntax errors but when i launch my app the log says: Caused by: java.lang....
0
votes
1answer
51 views

ArrayIndexOutOfBoundsException - Retrofit 2.4.0 Call

I am trying to hit POST call using retrofit. It's working fine on some devices but crash on Nexus 5 with OS version 6.0.1. But now I am facing an exception art/runtime/thread.cc:1344] Throwing ...
-1
votes
0answers
16 views

RecyclerView with Header is throwing ArrayIndexOutOfBoundsException

Previously without header, everything works fine with a minimal issue and that is sometimes I am getting RecyclerView.NO_POSITION where the value is -1 after calling notifyItemRangeChanged(0, list....
0
votes
1answer
27 views

Adding new item in RecyclerView with Header causing ArrayIndexOutOfBoundsException

My RecyclerAdapter is working but when I add a new item to it and then click some button, ArrayIndexOutOfBoundsException is thrown. There are two scenario of populating my list, first is when there ...
0
votes
0answers
40 views

ArrayIndexOutOfBoundsException Error in quiz app YoungLearnerActivity

I'm creating an android quiz with four activity. I'm facing some problem. When I run the app & answer the quiz and press Next button, current questions all data are save into each array. But when ...
1
vote
1answer
48 views

Getting ArrayIndexOutOfBoundsException in Adapter

I am displaying data in a recyclerview. I am using Firebase Firestore. Here is how I am setting up my Adapter in MainActivity: @Override protected void onCreate(Bundle savedInstanceState) { ...
0
votes
7answers
59 views

How to compare array elements and add corresponding elements to a third array?

Below is my code where I want to compare two array elements and add corresponding elements to a new array(foundArray) and not found elements to other array(notFoundArray). public static void main(...
0
votes
1answer
28 views

ArrayIndex Out OfBound Error in swing with java codeing [duplicate]

I have six entries in my database/Jtable. When I click on JTable I display all selected data in text field except Date(dob). It shows me an error: java.lang.ArrayIndexOutOfBoundsException: 5 >= 5 ...
-2
votes
1answer
31 views

this program is giving error i want to take input in one line [duplicate]

Program is: String main() throws IOException { int c=0,b=0; double ans=0; int a[]=new int[55]; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String ...
-3
votes
0answers
39 views

Hour glass challenge with Java [duplicate]

public class Solution { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int sum,big; sum=big=0; int temp; int a[][]=new int [100][100]; for(...
1
vote
2answers
58 views

Tetris clone in Java, out of bounds while moving a piece?

I'm trying to write a tetris clone. My board is a 10x20 array of integers on which 0 means no tile, 1-7 means a tile of specific color. It is constantly translated to graphic interpretation. My shapes ...
0
votes
1answer
29 views

Writing to excel using jxl, getting indexOutofBoundException error

public static void main(String args[]) throws BiffException, IOException, RowsExceededException, WriteException{ WritableWorkbook workbookCP; try { Workbook workbook = Workbook....
-1
votes
3answers
65 views

Why this parseInt throws array out of bound exception?

I was trying to find GCD of two arguments but at line 36 it throws ArrayOutOfBoundsException Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Hcdno.main(Gcdno.java:36) ...
0
votes
2answers
70 views

Getting IndexOutOfBoundsException only when resume Activity

My problem is that my App crashes when the MainActivity gets resumed. The error is an IndexOutOfBoundsException, unfortunately without a specific line. And the error says Index: 0, Size: 0. As I know ...
-1
votes
1answer
35 views

Assigning value to array gives an error [duplicate]

I'm aware there are many answers here related to that, I went through a lot of them and I still don't realize what am I doing wrong. I'm trying to pass an array to another UIViewController when a ...
-2
votes
0answers
34 views

IndexOutOfBoundsException at ChangeListener/Editable Combobox

Huhu, my code doesn't work and i can't figure out why. I have a changelistener on a editable Combobox, to get the user input and search in the Database for it and show the result in the Combobox. It ...
-1
votes
4answers
65 views

While loop, IndexOutOfBoundsException: Index: 1, Size: 1

Full code: public static String[] dirReduc(String[] arr) { LinkedList<String> list = new LinkedList<>(Arrays.asList(arr)); for (int t = 0; t < list.size(); t++) { ...
0
votes
2answers
52 views

Java ArrayIndexOutOfBoundsException keeps appearing while trying to find most occuring word in file

I am currently building a program which reads a file and prints the most occurring words and how many times each word appears like so: package WordLookUp; import java.util.*; import java.io.*; ...
0
votes
0answers
26 views

Thread error java.lang.IndexOutOfBoundsException: Index: 2, Size: 0

I have a problem in the for loop. By inserting two IP addresses (one valid and one wrong) the program works without problems. I added a third IP, also valid: at this point the program performs the ...
-2
votes
3answers
71 views

Getting error : Caused by: java.lang.ArrayIndexOutOfBoundsException: length=3; index=4

I got error in following code. I am trying to save my traveled distance in SQLite Database but getting error in SQLite Database. I don't know how to manage the array length. I am getting an error ...
3
votes
1answer
54 views

Unable to read all the data existing in excel sheet using Java/Selenium script

I'm facing an issue with reading the data from an excel file (which basically contains the login credentials in the form of test data) particularly when I am using TestNG. The same code works fine ...
0
votes
4answers
68 views

Java ArrayIndexOutOfBounds Exception on array map

I have a code that iterates on ArrayMap keys, and I got an Array Index Out Of Bounds Exception from unknown reason From Crashalytics: Fatal Exception: java.lang.ArrayIndexOutOfBoundsException length=...
-1
votes
2answers
33 views

ArrayIndexOutOfBoundException while separating odd numbers from an Array in JAVA [duplicate]

I am trying to come up with a solution to sort only the odd numbers in an Array while keeping the even numbers intact. In order to accomplish that, I tried to remove all the odd numbers in the given ...
0
votes
0answers
31 views

Recycler View crashs after app is in background and resumes

I have a Recycler View, that displays data from Firebase. everything works good, but when the app is in background and I get it back it always crahses with the error message: E/AndroidRuntime: ...
0
votes
0answers
40 views

RecyclerView: Inconsistency detected when update grouped items by PagedListAdapter

I using android.arch.paging.PagedListAdapter <Item, RecyclerView.ViewHolder> and Room DB as data source for show items in RecyclerView. Each item has date day. I also group elements by this ...
2
votes
3answers
53 views

Finding the index of the smallest element in an array (Java)

I am trying to write up a block of code that takes an array of integers as an argument and returns the index of the smallest element in the array. Also, the function should return -1 if the list is an ...
0
votes
4answers
63 views

Cannot understand Array bounds [duplicate]

I've been learning to code recently, but unfortunately iterating through arrays and understanding their Length property and not going out of bounds eludes me. I have the following exercise that I ...
1
vote
1answer
135 views

java.lang.IndexOutOfBoundsException: setSpan (-1 … -1) starts before 0 at Android 8.0

The problem Since the upgrade to Android 8.0 I get many crash reports stating an IndexOutOfBoundsException that occurs outside my code.But different with the other question The crash report ...
-1
votes
1answer
36 views

I want to run my code, but terminal tells index out of bounds. Probably, because of ArrayList methode get ot smth like this

I'm trying to run my code. But terminal tells: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util....
-3
votes
1answer
50 views

Getting IndexOutOfBound exception during setting a text to TextView

My application is working well in my test device and also to most of the users (maybe), but I am getting a crash report in my play console account and I don't understand where the problem is. I am ...
0
votes
1answer
35 views

index out of bound with iterrows

I got error IndexError: index 5105 is out of bounds for axis 0 with size 5105 with that code i understand the problem but how to solve it knowing that i use df.iterrows() ? anime_edges = {} for idx, ...
0
votes
0answers
35 views

Reset the icon to the original icon of an un-selected item in bottomavigationview

I have implemented a navigation view using the bottomnavigationview. I am changing the icon if the item is selected but on selecting another item, I have reset the icon to the previous icon. I have a ...
-1
votes
1answer
26 views

Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: (number you input but negative)

When I input any amountNumber > 4 it appears: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: (number I input but negative) at finder_pairs.finder_program_main.main(...
6
votes
5answers
100 views

Java - How to create a deck of cards (with a focus on static arrays)? - AP Computer Science Project

this is my first question ever. Just to clarify, I did check to see if there were any questions that could have helped me before asking this. Apologies in advance if I do anything incorrectly, I'm new....
-3
votes
3answers
127 views

Array index out of bounds exception in java code

I am writing the code to print a matrix on taking user input in the form of n value: Suppose if, n= 3 output: 3 3 3 3 0 3 3 1 3 3 2 3 3 3 3 I am getting ArrayIndexOutOfBoundException in the line: a[i]...
3
votes
4answers
55 views

IndexOutOfBoundsException when running Dijkstra's algorithm implementation

Not particularly sure what's causing this IndexOutOfBoundsException to occur. The code works perfectly find if I hard code all of the addFlightPath() parameters, but as soon as I attempt to use a for ...