Jump to content

[SOLVED] [1.7.2] byte array seems to be null when mod run as packed jar


Recommended Posts

Posted

I solved it by adding @SortingOrder(1001) above my FMLLoadingPlugin (thank you diesieben07)

 

So I've got a strange problem with my current coremod, which I try to update to 1.7.2.

I use several ASM transformers and they seem to run fine and do the correct changes (I wrote the classes as files and opened them with JD-GUI, every patch is correctly applied)

However when I pack / build my coremod, put it into the mods folder and try to start Minecraft, I get a NullPointerException. The byte array supplied by the transform method is null (I put a println with the byte array and it printed null)

 

Here some details:

Forge version used: 10.12.1.1061

Crash report: https://gist.github.com/SanAndreasP/a18ef19f6f5efce65464

whole log file: (seems to be cut off and doesn't show the error, idk why) https://gist.github.com/SanAndreasP/4a6d737d043276f4b50e

offending class: https://github.com/SanAndreasP/SAPManagerPack/blob/master/java/de/sanandrew/core/manpack/transformer/TransformPlayerDismountCtrl.java#L23

whole source: https://github.com/SanAndreasP/SAPManagerPack/tree/master/java/de/sanandrew/core/manpack

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

If I remember correctly your transformer will be called with a null byte array if a class couldn't be found in some cases. Try and check for null and if it is null, just return null yourself. Then it will not crash with your ClassTransformer and you will get a proper stack trace as to where the CNFE is coming from.

Just an idea.

 

Yes, seems like my ChannelHandler caused it when I initialized it statically like static final Inst var = new Inst(params);

Now the only problem persisting is that it seems that I can't use COMPUTE_FRAMES flag for the ClassWriter when I convert the transformed class back into a byte array... And again, only in a non-dev environment, in eclipse, everything works as expected.

It just gives me an InvocationTargetException caused by a ClassNotFoundException

 

[12:41:19 INFO]: Client> java.lang.reflect.InvocationTargetException
[12:41:19 INFO]: Client> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
[12:41:19 INFO]: Client> 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
[12:41:19 INFO]: Client> Caused by: java.lang.NoClassDefFoundError: net/minecraft/entity/projectile/EntitySnowball
[12:41:19 INFO]: Client> 	at net.minecraft.item.Item.func_150900_l(Item.java:171) ~[abn.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.init.Bootstrap.func_151354_b(SourceFile:358) ~[kb.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.client.Minecraft.<init>(Minecraft.java:266) ~[azd.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.client.main.Main.main(SourceFile:84) ~[Main.class:?]
[12:41:19 INFO]: Client> 	... 6 more
[12:41:19 INFO]: Client> Caused by: java.lang.ClassNotFoundException: net.minecraft.entity.projectile.EntitySnowball
[12:41:19 INFO]: Client> 	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) ~[launchwrapper-1.9.jar:?]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at net.minecraft.item.Item.func_150900_l(Item.java:171) ~[abn.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.init.Bootstrap.func_151354_b(SourceFile:358) ~[kb.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.client.Minecraft.<init>(Minecraft.java:266) ~[azd.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.client.main.Main.main(SourceFile:84) ~[Main.class:?]
[12:41:19 INFO]: Client> 	... 6 more
[12:41:19 INFO]: Client> Caused by: java.lang.NoClassDefFoundError: net/minecraft/entity/projectile/EntityThrowable
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:180) ~[launchwrapper-1.9.jar:?]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at net.minecraft.item.Item.func_150900_l(Item.java:171) ~[abn.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.init.Bootstrap.func_151354_b(SourceFile:358) ~[kb.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.client.Minecraft.<init>(Minecraft.java:266) ~[azd.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.client.main.Main.main(SourceFile:84) ~[Main.class:?]
[12:41:19 INFO]: Client> 	... 6 more
[12:41:19 INFO]: Client> Caused by: java.lang.ClassNotFoundException: net.minecraft.entity.projectile.EntityThrowable
[12:41:19 INFO]: Client> 	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) ~[launchwrapper-1.9.jar:?]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:180) ~[launchwrapper-1.9.jar:?]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at net.minecraft.item.Item.func_150900_l(Item.java:171) ~[abn.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.init.Bootstrap.func_151354_b(SourceFile:358) ~[kb.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.client.Minecraft.<init>(Minecraft.java:266) ~[azd.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.client.main.Main.main(SourceFile:84) ~[Main.class:?]
[12:41:19 INFO]: Client> 	... 6 more
[12:41:19 INFO]: Client> Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: ayi
[12:41:19 INFO]: Client> 	at org.objectweb.asm.ClassWriter.getCommonSuperClass(Unknown Source) ~[asm-all-4.1.jar:4.1]
[12:41:19 INFO]: Client> 	at org.objectweb.asm.ClassWriter.a(Unknown Source) ~[asm-all-4.1.jar:4.1]
[12:41:19 INFO]: Client> 	at org.objectweb.asm.Frame.a(Unknown Source) ~[asm-all-4.1.jar:4.1]
[12:41:19 INFO]: Client> 	at org.objectweb.asm.Frame.a(Unknown Source) ~[asm-all-4.1.jar:4.1]
[12:41:19 INFO]: Client> 	at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source) ~[asm-all-4.1.jar:4.1]
[12:41:19 INFO]: Client> 	at org.objectweb.asm.tree.MethodNode.accept(Unknown Source) ~[asm-all-4.1.jar:4.1]
[12:41:19 INFO]: Client> 	at org.objectweb.asm.tree.MethodNode.accept(Unknown Source) ~[asm-all-4.1.jar:4.1]
[12:41:19 INFO]: Client> 	at org.objectweb.asm.tree.ClassNode.accept(Unknown Source) ~[asm-all-4.1.jar:4.1]
[12:41:19 INFO]: Client> 	at de.sanandrew.core.manpack.transformer.ASMHelper.createBytes(ASMHelper.java:124) ~[sAPManPack-1.7.2-2.0.0.jar:?]
[12:41:19 INFO]: Client> 	at de.sanandrew.core.manpack.transformer.TransformEntityThrowable.transformLqThrowable(TransformEntityThrowable.java:108) ~[sAPManPack-1.7.2-2.0.0.jar:?]
[12:41:19 INFO]: Client> 	at de.sanandrew.core.manpack.transformer.TransformEntityThrowable.transform(TransformEntityThrowable.java:37) ~[sAPManPack-1.7.2-2.0.0.jar:?]
[12:41:19 INFO]: Client> 	at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276) ~[launchwrapper-1.9.jar:?]
[12:41:19 INFO]: Client> 	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174) ~[launchwrapper-1.9.jar:?]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:180) ~[launchwrapper-1.9.jar:?]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25]
[12:41:19 INFO]: Client> 	at net.minecraft.item.Item.func_150900_l(Item.java:171) ~[abn.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.init.Bootstrap.func_151354_b(SourceFile:358) ~[kb.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.client.Minecraft.<init>(Minecraft.java:266) ~[azd.class:?]
[12:41:19 INFO]: Client> 	at net.minecraft.client.main.Main.main(SourceFile:84) ~[Main.class:?]
[12:41:19 INFO]: Client> 	... 6 more

 

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

Hrm.

COMPUTE_FRAMES

is always a dangerous spot, because it triggers class-loading of other classes.

I see you are using "notched" class-names in your transformation. Don't do that, FML transforms all the classes to have their MCP name at runtime, so if you use those you should be fine. Maybe that is the problem.

 

I'm only using notched class names when I search for a needle in a haystack (since the ClassNode has it's instructions only in notched code for whatever reason)

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

Oh. If you do @SortingIndex(1001) (or bigger) on your IFMLLoadingPlugin your transformers run after the deobfuscation transformer.

 

In all honesty I am quite unsure as to where your error is originating from :(

 

 

 

 

The sorting index worked like a charm and instantly killed all my problems. Also I don't have to worry about the notched method/field/class naming crap anymore.

I can't thank you enough \o/

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.