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
4
votes
2 answers

Android java.lang.IllegalArgumentException

This is probably a simple one to answer but I can't seem to get right and thought I would ask. I am getting a java.lang.IllegalArgumentException and a java.lang.NullPointerException Here is the error log 03-20 13:13:22.872:…
4
votes
1 answer

IllegalArgumentException for JSF view while loading page

Even I am trying to open simple JSF page it is throwing exception, I am not getting even single hint what is wrong with the code. i have xhtml like this …
adam
  • 73
  • 2
  • 8
4
votes
3 answers

Exception : adding a window to a container. How to solve it?

I have a JDialog class named Preferences. This class creates a constructor like: class Preferences extends javax.swing.JDialog { Preferences(java.awt.Frame parent,modal) { super(parent,modal); …
Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328
4
votes
2 answers

MapView throwing IllegalArgumentException - Wrong Image Size: 192 192

I'm getting excessive crash reports from users on a Samsung Vibrant Galaxy S. After searching around for solutions to this issue, the only thing I came across was an open issue over at Google Code: …
hooked82
  • 6,336
  • 4
  • 41
  • 46
4
votes
1 answer

Spark regexp_extract() fails - Regex group count is 0, but the specified group index is 1

I would like to extract the last part of the string (after the last forward slash). When I use the following code it fails with the error: library(sparklyr) library(tidyverse) sc <- spark_connect(method = "databricks") tibble(my_string =…
Piotr K
  • 943
  • 9
  • 20
4
votes
0 answers

LifecycleObserver - Check if observer has another owner

I have a class which I attached an observer to in the constructor: public class MyStateMgr implements LifecycleObserver { public MyStateMgr (LifecycleOwner lifecycleOwner) { lifecycleOwner.getLifecycle().addObserver(this); …
MorZa
  • 2,215
  • 18
  • 33
4
votes
2 answers

Android java.lang.IllegalArgumentException: path must be convex

Same Application Work in Android 7 and Failed in Android 8. On an activity i am retrieving data from Fire-base database. when Fire-base database is empty then no error occurred and error occurred when it's have data's , I searched error but never…
iamkdblue
  • 3,448
  • 2
  • 25
  • 43
4
votes
1 answer

Why do I get IllegalArgumentException Cannot convert value of type String to required type Product, in Spring?

I receive the exception Failed to convert property value of type [java.lang.String] to required type [beans.Product] for property product; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type …
despot
  • 7,167
  • 9
  • 44
  • 63
4
votes
0 answers

IllegalArgumentException: Invalid BSON field name uuid

So I've tried seemingly countless things to get this to work. When I call queueWrite, the println statements give me this: { "uuid" : "49f2-0b64-4bf3-49f2a35b-bbe8-4954f742d88b" } and this: { "uuid" : "49f2-0b64-4bf3-49f2a35b-bbe8-4954f742d88b",…
annon
  • 107
  • 1
  • 11
4
votes
0 answers

ERROR java.lang.IllegalArgumentException

I'm trying just do this: WebClient webClient = new WebClient(); HtmlPage loginPage = webClient.getPage("https://www.google.com.br"); But I'm getting this error: java.lang.IllegalArgumentException: Cannot locate declared field class…
cmsantos
  • 317
  • 1
  • 4
  • 13
4
votes
1 answer

FragmentManager throws IllegalArgumentException in Kotlin

I have the following method in my Fragment override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) val fm = childFragmentManager var prefsFragment: PrefsFragment? =…
Morpheu5
  • 2,610
  • 6
  • 39
  • 72
4
votes
1 answer

Getting Error java.lang.IllegalArgumentException: unexpected url

Hi i am trying to send some data to server by using json parsing but activity is getting crashed and it leads to java.lang.IllegalArgumentException: unexpected url This is My Activity Code and i am commenting the lines where i am getting the…
4
votes
1 answer

IllegalArgumentException: You have attempted to set a value of type java.lang.String for parameter markup with expected type of java.math.BigDecimal

When I execute the below query, public int checkIfQueryExist(String query){ List products= em.createQuery("SELECT p FROM Product p WHERE p.markup=:markup" ). setParameter("markup", query).getResultList(); return…
ShayLay22
  • 53
  • 1
  • 8
4
votes
1 answer

Android Realm - Updating RealmList triggers IllegalArgumentException

I'm attempting to update an existing RealmObject (IncidentCard) which include a RealmList of type IncidentPhoto. The object is updated without any problems as long as I don't attempt to update the RealmList, when I include the list I get the…
4
votes
3 answers

How to solve java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be <= 0?

I've been spending the last hours trying to solve the stack trace below. With major research on here SO and also through Google, I understand the exception can mean several things: the program can't find the requested images with the provided…
Mark Doe
  • 125
  • 2
  • 2
  • 9