java.lang.UnsupportedOperationException at java.util.AbstractList.remove - java

I am trying to remove an item of a List.
list.remove(key);
However, it throws an exception:
Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.remove(AbstractList.java:161)
at java.util.AbstractList$Itr.remove(AbstractList.java:374)
at java.util.AbstractCollection.remove(AbstractCollection.java:293)
at bean.Bean.deleteRow(Bean.java:46)
How is this caused and how can I solve it?

The issue was during Arrays.asList() used to initialize the list, by using list.add(String) i fixed the problem

Related

How to retrieve full exception message from compiled jar without changing the code?

Java application terminates with exception:
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.NumberFormatException
at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:211)
at liquibase.integration.commandline.Main.doMigration(Main.java:967)
at liquibase.integration.commandline.Main.run(Main.java:180)
at liquibase.integration.commandline.Main.main(Main.java:99)
Caused by: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.NumberFormatException
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:13)
at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:209)
... 3 more
Caused by: liquibase.exception.DatabaseException: java.lang.NumberFormatException
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:120)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:73)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:194)
at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:292)
at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:314)
at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:234)
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:208)
at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:70)
at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:44)
at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:21)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:150)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:139)
at liquibase.command.DiffCommand.createReferenceSnapshot(DiffCommand.java:190)
at liquibase.command.DiffCommand.createDiffResult(DiffCommand.java:140)
at liquibase.command.DiffToChangeLogCommand.run(DiffToChangeLogCommand.java:51)
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:8)
... 4 more
Caused by: java.lang.NumberFormatException
at java.math.BigDecimal.<init>(Unknown Source)
at java.math.BigDecimal.<init>(Unknown Source)
at java.math.BigDecimal.<init>(Unknown Source)
at liquibase.util.SqlUtil.parseValue(SqlUtil.java:208)
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readDefaultValue(ColumnSnapshotGenerator.java:387)
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readColumn(ColumnSnapshotGenerator.java:223)
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:115)
... 20 more
I now that NumberFormatException should contain "For input string" text. What can I do to view the message text for that exception?
Not from code, this is a compiled jar application which is run with bat file like this:
java -cp "%CP%" %JAVA_OPTS% liquibase.integration.commandline.Main %CMD_LINE_ARGS%
Caused by: java.lang.NumberFormatException
...
I now that NumberFormatException should contain "For input string" text. What can I do to view the message text for that exception?
There may not be a message for you to view. If the NumberFormatException had a detail message, it would be part of the stack trace. Here is the javadoc for NumberFormatException. You will note that there's no guarantee the exception will have a detailed message. In fact, it has a no-argument constructor which is documented to construct "a NumberFormatException with no detail message".
Additionally, here is the main constructor for the OpenJDK implementation of the BigDecimal class. If you look through it, you'll see that it throws NumberFormatExceptions with no detail message in a few places.

java.lang.ClassCastException for TDBFactory

I made a tdb index with Jena for the data I have.
In order to refer to the data while querying, I tried using TDBFactory and Model (both statements given below). I am getting the same exception for both, so this seems to be independent of the statement I write.
Dataset dataset = TDBFactory.createDataset(directory) ;
and
Model model=FileManager.get().loadModel(directory);
The runtime exception is:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.reset(RDFReaderFImpl.java:81)
at com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.<clinit>(RDFReaderFImpl.java:74)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.<clinit>(ModelCom.java:54)
at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:114)
at com.hp.hpl.jena.vocabulary.OWL.<clinit>(OWL.java:36)
at com.hp.hpl.jena.sparql.graph.NodeConst.<clinit>(NodeConst.java:29)
at com.hp.hpl.jena.sparql.engine.optimizer.reorder.ReorderFixed.<clinit>(ReorderFixed.java:23)
at com.hp.hpl.jena.sparql.engine.optimizer.reorder.ReorderLib.fixed(ReorderLib.java:53)
at com.hp.hpl.jena.tdb.sys.SystemTDB.<clinit>(SystemTDB.java:187)
at com.hp.hpl.jena.tdb.TDB.<clinit>(TDB.java:90)
at com.hp.hpl.jena.tdb.setup.DatasetBuilderStd.<clinit>(DatasetBuilderStd.java:64)
at com.hp.hpl.jena.tdb.StoreConnection.make(StoreConnection.java:227)
at com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction.<init>(DatasetGraphTransaction.java:75)
at com.hp.hpl.jena.tdb.sys.TDBMaker._create(TDBMaker.java:57)
at com.hp.hpl.jena.tdb.sys.TDBMaker.createDatasetGraphTransaction(TDBMaker.java:45)
at com.hp.hpl.jena.tdb.TDBFactory._createDatasetGraph(TDBFactory.java:104)
at com.hp.hpl.jena.tdb.TDBFactory.createDatasetGraph(TDBFactory.java:73)
at com.hp.hpl.jena.tdb.TDBFactory.createDataset(TDBFactory.java:52)
at com.hp.hpl.jena.tdb.TDBFactory.createDataset(TDBFactory.java:48)
Caused by: java.lang.ClassCastException: org.apache.xerces.dom.DeferredTextImpl cannot be cast to org.w3c.dom.Element
at sun.util.xml.PlatformXmlPropertiesProvider.importProperties(PlatformXmlPropertiesProvider.java:118)
at sun.util.xml.PlatformXmlPropertiesProvider.load(PlatformXmlPropertiesProvider.java:90)
at java.util.Properties$XmlSupport.load(Properties.java:1201)
at java.util.Properties.loadFromXML(Properties.java:881)
at com.hp.hpl.jena.util.Metadata.read(Metadata.java:76)
at com.hp.hpl.jena.util.Metadata.addMetadata(Metadata.java:54)
at com.hp.hpl.jena.util.Metadata.<init>(Metadata.java:48)
at com.hp.hpl.jena.JenaRuntime.<clinit>(JenaRuntime.java:34)
The jar files that I am using are:
arq-2.8.7.jar,
commons-cli-1.2.jar,
commons-codec-1.6.jar,
commons-collections-3.2.1.jar,
commons-csv-1.0.jar,
commons-io-2.4.jar,
commons-lang3-3.1.jar,
commons-math3-3.0.jar,
httpclient-4.2.6.jar,
httpclient-cache-4.2.6.jar,
httpcore-4.2.5.jar,
jackson-annotations-2.3.0.jar,
jackson-core-2.3.3.jar,
jackson-databind-2.3.3.jar,
jcl-over-slf4j-1.7.6.jar,
jena-arq-2.12.1.jar,
jena-core-2.12.1.jar,
jena-iri-1.1.1.jar,
jena-sdb-1.5.1.jar,
jena-tdb-1.1.1.jar,
jgraph.jar,
jsonld-java-0.5.0.jar,
libthrift-0.9.1.jar,
log4j-1.2.17.jar,
slf4j-api-1.7.6.jar,
slf4j-log4j12-1.7.6.jar,
xercesImpl-2.11.0.jar,
xml-apis-1.4.01.jar
How do I fix this?

java.util.logging.LoggingProxyImpl cannot be cast to sun.util.logging.LoggingProxy

I am using JBoss-7.1.0 with JDK-7. I am getting the following stacktrace:
java.lang.ClassCastException: java.util.logging.LoggingProxyImpl cannot be cast to sun.util.logging.LoggingProxy
Can any one know solution to this exception?
https://access.redhat.com/site/discussions/792203
The solution was to add 'path name="sun/util/logging"/' to jboss\modules\system\layers\base\sun\jdk\main\module.

java.lang.NoSuchMethodError: : org.jfree.ui.RectangleInsets.<init>(DDDD)V

While creating a jfreechart im getting following error and I am not sure whats the reason for it..any help??
Exception in thread "main" java.lang.NoSuchMethodError: org.jfree.ui.RectangleInsets.<init>(DDDD)V
at org.jfree.chart.axis.Axis.<clinit>(Axis.java:146)
at org.jfree.chart.StandardChartTheme.<init>(StandardChartTheme.java:227)
at org.jfree.chart.ChartFactory.<clinit>(ChartFactory.java:229)
at modules.images.Chart.createChart(Chart.java:67)
at modules.images.Chart.<init>(Chart.java:59)
at modules.images.Chart.main(Chart.java:506)
Make sure you have jcommon-1.0.0.jar (or a later version) on your classpath.

Error ClassCastException: [Ljava.lang.Object; cannot be cast to [Lcom.happydroids.droidtowers.entities.GridObject;

I'm trying to compile the following project: https://github.com/pplante/droidtowers
(the December 02 version, which is the last one that works). I managed to get all the dependencies etc and it compiles both under eclipse and IntelliJ-IDEA (which is the original project). However, when running under eclipse the following error appears at this line:
Array<GridObject> rooms = new Array<GridObject>(gameGrid.getInstancesOf(Room.class).items);
This crashes the game after a new game is started, past the Main Menu.
Now, I know that the Room class extends GridObject, and this runs fine under IntelliJ. I can't wrap my head around what can be the problem, or difference between both executables, so any help would be welcome. Maybe there's a default in the compiler overriden in the IDEA project? (I made the eclipse project from scratch).
This is using the latest Java, and android sdk.
ADDENDUM: Here's the full stacktrace:
ago 05, 2013 3:14:57 PM com.happydroids.platform.DesktopUncaughtExceptionHandler uncaughtException
SEVERE: Uncaught exception!
com.badlogic.gdx.utils.GdxRuntimeException: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lcom.happydroids.droidtowers.entities.GridObject;
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:111)
Caused by: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lcom.happydroids.droidtowers.entities.GridObject;
at com.happydroids.droidtowers.controllers.AvatarLayer.setupInitialAvatars(AvatarLayer.java:191)
at com.happydroids.droidtowers.scenes.TowerScene.create(TowerScene.java:145)
at com.happydroids.droidtowers.scenes.components.SceneManager.pushScene(SceneManager.java:39)
at com.happydroids.droidtowers.scenes.components.SceneManager.changeScene(SceneManager.java:26)
at com.happydroids.droidtowers.scenes.LoadTowerSplashScene.render(LoadTowerSplashScene.java:29)
at com.happydroids.droidtowers.DroidTowersGame.render(DroidTowersGame.java:216)
at com.happydroids.droidtowers.LwjglApplicationShim.render(LwjglApplicationShim.java:50)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:190)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:108)
com.badlogic.gdx.utils.GdxRuntimeException: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lcom.happydroids.droidtowers.entities.GridObject;
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:111)
Caused by: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lcom.happydroids.droidtowers.entities.GridObject;
at com.happydroids.droidtowers.controllers.AvatarLayer.setupInitialAvatars(AvatarLayer.java:191)
at com.happydroids.droidtowers.scenes.TowerScene.create(TowerScene.java:145)
at com.happydroids.droidtowers.scenes.components.SceneManager.pushScene(SceneManager.java:39)
at com.happydroids.droidtowers.scenes.components.SceneManager.changeScene(SceneManager.java:26)
at com.happydroids.droidtowers.scenes.LoadTowerSplashScene.render(LoadTowerSplashScene.java:29)
at com.happydroids.droidtowers.DroidTowersGame.render(DroidTowersGame.java:216)
at com.happydroids.droidtowers.LwjglApplicationShim.render(LwjglApplicationShim.java:50)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:190)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:108)
Well, can't say I "fixed" the error (apparently that's just the way generics work or something) but I removed ".items" and it worked, because it was redundant: it was basically taking a function that returns Array<GridObject>, it was converting it to an array GridObject[], then using a constructor to convert it back to a type Array<GridObject>.
The biggest mistery now is why IDEA didn't return an error at all. Could be some obscure compiler setting.

Categories

Resources