Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException while attempting to serialize an ItemStack #1334

Closed
Mohron opened this issue May 5, 2017 · 7 comments
Closed

IllegalArgumentException while attempting to serialize an ItemStack #1334

Mohron opened this issue May 5, 2017 · 7 comments
Labels
system: data type: bug Something isn't working

Comments

@Mohron
Copy link

Mohron commented May 5, 2017

I am currently running...

  • SpongeForge version: 1.10.2-2281-5.2.0-BETA-2300

  • Java version: 1.8.0_121

  • Operating System: Win 10

  • Plugins/Mods: Minecraft, Minecraft Coder Pack, Forge Mod Loader, Minecraft Forge, SpongeAPI, SpongeForge, InventoryProtect, mercurius_updater, LuckPerms, Nucleus

What is the expected result?
Serializing an ItemStack without crashing

What is the current result?

java.lang.IllegalArgumentException: Configuration does not accept objects of type class java.lang.Short
	at ninja.leaping.configurate.ScalarConfigValue.setValue(ScalarConfigValue.java:42) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.SimpleConfigurationNode.insertNewValue(SimpleConfigurationNode.java:274) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.SimpleConfigurationNode.setValue(SimpleConfigurationNode.java:201) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.SimpleConfigurationNode.setValue(SimpleConfigurationNode.java:182) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.SimpleConfigurationNode.setValue(SimpleConfigurationNode.java:168) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.SimpleConfigurationNode.setValue(SimpleConfigurationNode.java:182) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.SimpleConfigurationNode.setValue(SimpleConfigurationNode.java:182) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.SimpleConfigurationNode.setValue(SimpleConfigurationNode.java:39) ~[configurate-core-3.2.jar:?]
	at org.spongepowered.common.config.DataSerializableTypeSerializer.serialize(DataSerializableTypeSerializer.java:59) ~[DataSerializableTypeSerializer.class:1.10.2-2281-5.2.0-BETA-2300]
	at org.spongepowered.common.config.DataSerializableTypeSerializer.serialize(DataSerializableTypeSerializer.java:41) ~[DataSerializableTypeSerializer.class:1.10.2-2281-5.2.0-BETA-2300]
	at ninja.leaping.configurate.objectmapping.ObjectMapper$FieldData.serializeTo(ObjectMapper.java:113) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.ObjectMapper$BoundInstance.serialize(ObjectMapper.java:162) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.serialize.TypeSerializers$AnnotatedObjectSerializer.serialize(TypeSerializers.java:284) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.serialize.TypeSerializers$ListSerializer.serialize(TypeSerializers.java:247) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.serialize.TypeSerializers$ListSerializer.serialize(TypeSerializers.java:206) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.ObjectMapper$FieldData.serializeTo(ObjectMapper.java:113) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.ObjectMapper$BoundInstance.serialize(ObjectMapper.java:162) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.serialize.TypeSerializers$AnnotatedObjectSerializer.serialize(TypeSerializers.java:284) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.serialize.TypeSerializers$ListSerializer.serialize(TypeSerializers.java:247) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.serialize.TypeSerializers$ListSerializer.serialize(TypeSerializers.java:206) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.ObjectMapper$FieldData.serializeTo(ObjectMapper.java:113) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.ObjectMapper$BoundInstance.serialize(ObjectMapper.java:162) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.objectmapping.serialize.TypeSerializers$AnnotatedObjectSerializer.serialize(TypeSerializers.java:284) ~[configurate-core-3.2.jar:?]
	at ninja.leaping.configurate.ConfigurationNode.setValue(ConfigurationNode.java:402) ~[configurate-core-3.2.jar:?]
	at rocks.devonthe.inventoryprotect.data.DataProvider.saveUserData(DataProvider.java:85) ~[DataProvider.class:?]
	at rocks.devonthe.inventoryprotect.listener.DeathListener.lambda$saveDeathInventory$0(DeathListener.java:64) ~[DeathListener.class:?]
	at org.spongepowered.common.scheduler.SchedulerBase.lambda$startTask$0(SchedulerBase.java:183) ~[SchedulerBase.class:1.10.2-2281-5.2.0-BETA-2300]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_121]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]

https://gist.github.com/Mohron/a193ecec64971c00c9d86a6d1af4cbb7

@stephan-gh stephan-gh added system: data type: bug Something isn't working labels May 6, 2017
@Mohron
Copy link
Author

Mohron commented May 19, 2017

FYI, @dualspiral recommended that I try using hocon instead of json. The change made the serialization successful but deserialization fails.

https://gist.github.com/Mohron/c038a1095ad7faa967eab4f0a562e324

https://gist.github.com/Mohron/b119b1e135d23e2c5dbd93a1b71bde50

@Mohron
Copy link
Author

Mohron commented May 19, 2017

Related to #1307 perhaps?

@stephan-gh stephan-gh self-assigned this Jun 12, 2017
@stephan-gh
Copy link
Contributor

  • You should use DataFormats.JSON if you want to serialize to JSON
  • Have you posted the error you get when deserializing using HOCON somewhere? Above you've only posted the serialization error, and a log with an unrelated error.

@Mohron
Copy link
Author

Mohron commented Jun 20, 2017

Serialized Data
Log

@Sir-Will
Copy link

Sir-Will commented Jul 11, 2017

I got the same issue:

java.lang.IllegalArgumentException: Configuration does not accept objects of type class [B
	at ninja.leaping.configurate.ScalarConfigValue.setValue(ScalarConfigValue.java:42) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.SimpleConfigurationNode.insertNewValue(SimpleConfigurationNode.java:274) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.SimpleConfigurationNode.setValue(SimpleConfigurationNode.java:201) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.commented.SimpleCommentedConfigurationNode.setValue(SimpleCommentedConfigurationNode.java:74) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.commented.SimpleCommentedConfigurationNode.setValue(SimpleCommentedConfigurationNode.java:32) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.SimpleConfigurationNode.setValue(SimpleConfigurationNode.java:182) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.commented.SimpleCommentedConfigurationNode.setValue(SimpleCommentedConfigurationNode.java:74) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.commented.SimpleCommentedConfigurationNode.setValue(SimpleCommentedConfigurationNode.java:32) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.SimpleConfigurationNode.setValue(SimpleConfigurationNode.java:182) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.commented.SimpleCommentedConfigurationNode.setValue(SimpleCommentedConfigurationNode.java:74) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.commented.SimpleCommentedConfigurationNode.setValue(SimpleCommentedConfigurationNode.java:32) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.common.config.DataSerializableTypeSerializer.serialize(DataSerializableTypeSerializer.java:59) ~[DataSerializableTypeSerializer.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.common.config.DataSerializableTypeSerializer.serialize(DataSerializableTypeSerializer.java:41) ~[DataSerializableTypeSerializer.class:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.objectmapping.serialize.TypeSerializers$ListSerializer.serialize(TypeSerializers.java:247) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.objectmapping.serialize.TypeSerializers$ListSerializer.serialize(TypeSerializers.java:206) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at ninja.leaping.configurate.ConfigurationNode.setValue(ConfigurationNode.java:402) ~[_spongeforge-1.10.2-2281-5.2.0-BETA-2401.jar:1.10.2-2281-5.2.0-BETA-2401]
	at net.mineyourmind.mymkit.model.KitManager.save(KitManager.java:126) ~[KitManager.class:?]
	at net.mineyourmind.mymkit.edit.KitEditorUI$CloseListener.accept(KitEditorUI.java:88) ~[KitEditorUI$CloseListener.class:?]
	at net.mineyourmind.mymkit.edit.KitEditorUI$CloseListener.accept(KitEditorUI.java:65) ~[KitEditorUI$CloseListener.class:?]
	at org.spongepowered.common.item.inventory.custom.CustomInventoryListener.handle(CustomInventoryListener.java:52) ~[CustomInventoryListener.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.common.item.inventory.custom.CustomInventoryListener.handle(CustomInventoryListener.java:35) ~[CustomInventoryListener.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95) ~[RegisteredListener.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:313) ~[SpongeModEventManager.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:342) ~[SpongeModEventManager.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:326) ~[SpongeModEventManager.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.common.SpongeImpl.postEvent(SpongeImpl.java:143) ~[SpongeImpl.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.common.event.SpongeCommonEventFactory.callInteractInventoryCloseEvent(SpongeCommonEventFactory.java:660) ~[SpongeCommonEventFactory.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.common.event.tracking.phase.packet.PacketFunction.lambda$static$50(PacketFunction.java:903) ~[PacketFunction.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.common.event.tracking.phase.packet.PacketPhase.unwind(PacketPhase.java:324) [PacketPhase.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.common.event.tracking.CauseTracker.completePhase(CauseTracker.java:225) [CauseTracker.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.common.event.tracking.CauseTracker.switchToPhase(CauseTracker.java:167) [CauseTracker.class:1.10.2-2281-5.2.0-BETA-2401]
	at org.spongepowered.common.network.PacketUtil.onProcessPacket(PacketUtil.java:156) [PacketUtil.class:1.10.2-2281-5.2.0-BETA-2401]
	at net.minecraft.network.PacketThreadUtil$1.redirect$onProcessPacket$zjh000(SourceFile:539) [fl$1.class:?]
	at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [fl$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_131]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_131]
	at net.minecraft.util.Util.func_181617_a(SourceFile:45) [h.class:?]
	at org.spongepowered.common.SpongeImplHooks.onUtilRunTask(SpongeImplHooks.java:241) [SpongeImplHooks.class:1.10.2-2281-5.2.0-BETA-2401]
	at net.minecraft.server.MinecraftServer.redirect$onRun$zhn000(MinecraftServer.java:3932) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:668) [MinecraftServer.class:?]
	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:387) [ld.class:?]
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:613) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:471) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]

@stephan-gh stephan-gh removed their assignment Aug 20, 2017
@ImMorpheus
Copy link
Contributor

This should be closed.

This is something that should be handled by configurate. [B is an array of bytes. The same thing is happening with ints, etc.
This could be reproduced by trying to serialize an enchanted Energy cell (thermal expansion) with holding V or a wand from BetterBuilderWands or any other item having an array in the NBT tags.

See SpongePowered/Configurate#95

@gabizou gabizou closed this as completed Jul 2, 2018
@gabizou
Copy link
Member

gabizou commented Jul 2, 2018

Agreeing with @ImMorpheus. It's not sponge's fault for handling it. Since we provide the serialization formats and it's the serializer itself that is failing, it's a Configurate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system: data type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants