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
924
votes
71 answers

"Conversion to Dalvik format failed with error 1" on external JAR

In my Android application in Eclipse, I get the following error. UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Lorg/xmlpull/v1/XmlPullParser; .... Conversion to Dalvik format failed with error 1 This error only…
Michel
  • 9,220
  • 13
  • 44
  • 59
572
votes
26 answers

IllegalArgumentException or NullPointerException for a null parameter?

I have a simple setter method for a property and null is not appropriate for this particular property. I have always been torn in this situation: should I throw an IllegalArgumentException, or a NullPointerException? From the javadocs, both seem…
Mike Stone
  • 44,224
  • 30
  • 113
  • 140
351
votes
40 answers

Android Fragment no view found for ID?

I have a fragment I am trying to add into a view. FragmentManager fragMgr=getSupportFragmentManager(); feed_parser_activity content = (feed_parser_activity)fragMgr …
coder_For_Life22
  • 26,645
  • 20
  • 86
  • 118
344
votes
23 answers

Duplicate ID, tag null, or parent id with another fragment for com.google.android.gms.maps.MapFragment

I have an application with three tabs. Each tab has its own layout .xml file. The main.xml has its own map fragment. It's the one that shows up when the application first launches. Everything works fine except for when I change between tabs. If I…
hermann
  • 6,237
  • 11
  • 46
  • 66
339
votes
4 answers

Upgraded to AppCompat v22.1.0 and now getting IllegalArgumentException: AppCompat does not support the current theme features

I've just upgraded my app to use the newly released v22.1.0 AppCompat and I'm now getting the following exception when I open my app. Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features at…
Chris Banes
  • 31,763
  • 16
  • 59
  • 50
282
votes
17 answers

Tomcat: java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens

I am getting below stack trace when I am deploying my application in a multi-server Apache Tomcat 8 environment. I am getting this error frequently, and it seems it is blocking the tomcat thread: INFO [http-nio-80-exec-4461]…
user2016012
  • 2,929
  • 2
  • 13
  • 4
151
votes
10 answers

The key must be an application-specific resource id

Why do I get this Exception? 05-18 20:29:38.044: ERROR/AndroidRuntime(5453): java.lang.IllegalArgumentException: The key must be an application-specific resource id. 05-18 20:29:38.044: ERROR/AndroidRuntime(5453): at…
Pentium10
  • 204,586
  • 122
  • 423
  • 502
122
votes
11 answers

Receiver not registered exception error?

In my developer console people keep reporting an error that I cannot reproduce on any phone I have. One person left a message saying he gets it when they try to open the settings screen of my battery service. As you can see from the error it says…
tyczj
  • 71,600
  • 54
  • 194
  • 296
116
votes
6 answers

When should an IllegalArgumentException be thrown?

I'm worried that this is a runtime exception so it should probably be used sparingly. Standard use case: void setPercentage(int pct) { if( pct < 0 || pct > 100) { throw new IllegalArgumentException("bad percent"); } } But that…
djechlin
  • 59,258
  • 35
  • 162
  • 290
80
votes
7 answers

java.lang.IllegalArgumentException : Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull

I'm getting this error java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter event for the line override fun onEditorAction(v: TextView, actionId: Int,…
mjsxbo
  • 2,116
  • 3
  • 22
  • 34
76
votes
5 answers

java.lang.IllegalArgumentException: Removing a detached instance com.test.User#5

I have a java EE project using JPA (transaction-type="JTA"), hibernate as provider. I write my beans to handle the CRUD things. The program running in JBOSS 7 AS. I have an EntityManagerDAO : @Stateful public class EntityManagerDao implements…
neptune
  • 875
  • 1
  • 7
  • 8
68
votes
11 answers

Android 5.0 (L) Service Intent must be explicit in Google analytics

My code worked in <5 but in Android 5.0 I'm running into an issue that I don't quite understand. 10-23 10:18:18.945: E/AndroidRuntime(8987): java.lang.IllegalArgumentException: Service Intent must be explicit: Intent {…
Jacksonkr
  • 31,583
  • 39
  • 180
  • 284
66
votes
18 answers

Preventing/catching "IllegalArgumentException: parameter must be a descendant of this view" error

I have a ListView with some focusable components inside (mostly EditTexts). Yeah, I know this isn't exactly recommended, but in general, almost everything is working fine and the focus goes where it has to go (with a few tweaks I had to code).…
dmon
  • 30,048
  • 8
  • 87
  • 96
58
votes
10 answers

Google In-App billing, IllegalArgumentException: Service Intent must be explicit, after upgrading to Android L Dev Preview

My in-app billing code was working fine until I upgraded to the Android L Dev Preview. Now I get this error when my app starts. Does anyone know what's changed about L that causes this or how I should change my code to fix this? android…
49
votes
1 answer

Illegal remote method in java

It's the first time I use java Rmi*. I have a custom class which extends UnicastRemoteObject and implements an interface which extends remote. I think that I have implemented the methods of the interface correctly in the class but still I get an…
Range
  • 689
  • 1
  • 8
  • 14
1
2 3
64 65