Questions tagged [illegalargumentexception]

An exception that indicates that the arguments supplied to a method or function are not valid for their intended purpose, or are different to the format expected by the method.

An exception that indicates that the arguments supplied to a method or function are not valid for their intended purpose, or are different to the format expected by the method.

This could occur as a result of many different actions, such as...

  1. You are calling a method that accepts a low-level object type for an argument (such as Object) but you're passing an object that is not one of the types expected by the method. For example, the method might be declaring the argument as an Object so that it can capture a range of different objects in the one method, but the code implementation of the method only allows objects of certain types (such as expecting a Number-based object, and you're passing a String).
  2. You're using methods that are building a dynamic structure for use in a different context, and the argument that you're passing is not valid for the other context. For example, you might be building an SQL statement, and you're passing an argument as a String for a database field that expects a Number. The database context would detect the error and report back the exception.

This type of exception may be hard to predict, as it won't be detected at compile-time, and may only show up under certain circumstances.

965 questions
3
votes
1 answer

java.lang.IllegalArgumentException: Cannot add the same item multiple times: Day@3ea2225f

I want to use a Treegrid to represent days, but when adding the days to the treegrid I get the error: java.lang.IllegalArgumentException: Cannot add the same item multiple times: Day@3ea2225f My setItems function looks like…
Lukas
  • 110
  • 11
3
votes
1 answer

IllegalArgumentException from gluUnProject

I get this error message 08-30 19:20:17.774: ERROR/AndroidRuntime(4681): FATAL EXCEPTION: GLThread 9 08-30 19:20:17.774: ERROR/AndroidRuntime(4681): java.lang.IllegalArgumentException: length - offset < n 08-30 19:20:17.774:…
Jack
  • 2,625
  • 5
  • 33
  • 56
3
votes
2 answers

Can someone explain why applying map like this in Scala throws and IllegalArgumentException?

Here's a copy of the interpreter commands: scala>val myTable = Array(Array(1)) res30: Array[Array[Int]] = Array(Array(1)) scala> myTable.map(_.map(_.toString)) res31: Array[Array[java.lang.String]] = Array(Array(1)) scala> var result = 0 result:…
Henry Henrinson
  • 5,203
  • 7
  • 44
  • 76
3
votes
1 answer

Android 11: Primary directory (invalid) not allowed for content://media/external/file allowed directories are [Download, Documents]

I am trying to create PDF file from base64 string. Because of Storage Update in Android 11, I have to change my code but I'm getting following error in Android 11 devices: java.lang.IllegalArgumentException: Primary directory (invalid) not allowed…
3
votes
2 answers

Android - How to get file bytes from Sdcard

I'm trying to get a byte of a document inside of sdcard. What I do is exactly the following; 1-) I choose the file. fun openFile() { val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply { addCategory(Intent.CATEGORY_OPENABLE) …
3
votes
2 answers

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder

I have issue with reading the values from the application.properties file and get the following errors, [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.7.RELEASE:run (default-cli) on project wedding-card: An…
Arefe
  • 11,321
  • 18
  • 114
  • 168
3
votes
1 answer

Jenkins IllegalArgumentException while adding a new slave

I want to add a new slave to Jenkins. When I followed the Jenkins UI, it gives me the command below java -jar agent.jar -jnlpUrl http:///computer//slave-agent.jnlp -secret…
happy-integer
  • 383
  • 1
  • 3
  • 15
3
votes
2 answers

Spring Webclient : illegalargumentexception not enough variables to expand 'comment_count'

I am using spring webclient to make a Facebook graph api request with url containing {comment_count} But, getting this exception java.lang.IllegalArgumentException: Not enough variable values available to expand reactive spring Code Snippet :…
3
votes
0 answers

IllegalArgumentException onStartCommand Service

I got this error log from Google Play a few times but can't seem to replicate it on a test device. Any advice on how I can replicate or fix this? java.lang.RuntimeException: at android.app.ActivityThread.handleServiceArgs…
Zim
  • 274
  • 4
  • 17
3
votes
3 answers

java.lang.IllegalArgumentException: Invalid URL Pattern: [xhtml]

I am trying to deploy a very simple & my first JSF application (following a really good tutorial by BalusC) on glassfish local server. I completed all the steps to create the application. And when I tried to deploy the application on the glassfish…
Rajat Gupta
  • 25,853
  • 63
  • 179
  • 294
3
votes
1 answer

java.lang.IllegalArgumentException: Illegal character in path at index 33: https://box.one.th/app/api/upload

What i am doing: I am trying to make FileUploaderClient with Authorization I am getting error as: java.lang.IllegalArgumentException: Illegal character in path at index 33: https://box.one.th/app/api/upload FileUploaderClient public class…
BallZaR5R5
  • 33
  • 1
  • 4
3
votes
0 answers

Crash with java.lang.IllegalArgumentException only on Oreo

I have this issue only on Android 8.0 but I cannot understand why. App crash after a few minutes in stand by. My app has Location Permissions granted and my device has Bluetooth enabled (and BLE support) This is the…
3
votes
1 answer

Android app crashes on orientation change java.lang.IllegalArgumentException: Wrong state class -- expecting View State

I am having another problem with my android app which I can't find an answer to basically I have an android view that has been created programmatically, then when I change the orientation of my device the application crashes due to:…
3
votes
0 answers

gradle on command line

I'm trying to execute my espresso tests via gradlew on command line. The build keeps failing and the following error is displayed. I typed the following command gradlew test --stacktrace --info Following error was displayed: Could not determine…
Deeksha
  • 203
  • 5
  • 14
3
votes
1 answer

Testing IllegalArgumentException is not catching as expected

I have the following testing code: @Test(expected = IllegalArgumentException.class) public void addPlayerFailureTest() { playerDAO.addPlayer(null); } This code is supposed to return an IllegalArgumentException, and it does as expected.…
Yassine Badache
  • 1,810
  • 1
  • 19
  • 38