Baubles

Baubles

116M Downloads

Erroneous try .. catch in PacketSyncBauble.java?

Opened this issue ยท 16 comments

commented

I get this when compiling:

/home/user/projects/experiments/Baubles/build/sources/java/baubles/common/network/PacketSyncBauble.java:37: error: exception IOException is never thrown in body of corresponding try statement
        try { pb.writeItemStackToBuffer(bauble); } catch (IOException e) {}
                                                   ^
/home/user/projects/experiments/Baubles/build/sources/java/baubles/common/network/PacketSyncBauble.java:46: error: exception IOException is never thrown in body of corresponding try statement
        try { bauble = pb.readItemStackFromBuffer(); } catch (IOException e) {}

Not sure why this happens, just curious if it is a bug or if I did something wrong. Removing the try statement seems to not have any bad effects, in my small tests.

UPDATE:

Turns out the problem is stranger. My commands and their results can be found here: http://paste.ubuntu.com/7984700/.

commented

Strange, not sure why you are getting that. readItemStackFromBuffer definitely throws IOExceptions and without it the code won't compile due to an UnhandledException error.

commented

Hrm. If it helps, I am using OpenJDK 7 as my java, and 6 doesn't work either. Going to try Oracle's java in a few hours or so.

commented

I re-cloned the repo, removed the gradle cache, and used Oracle's java 7. It still don't work.

commented

I can confirm this issue also, building using Gradle on Oracle JDK 7. Command used gradle build.
Can you check your version of Forge is 10.13.0.1177, and your netty version is 4.0.10.

commented

Yeah, those are the versions that gradle downloads, if that's what you mean.

commented

@blue42u that's what I mean. If @Azanor is using an IDE to build instead of gradle, it might not have updated the forge version automagically.

commented

Yup, I'm using JDK 7, forge 1177 and netty 4.0.10. I build using gradle build as well.

commented

@Azanor does removing the try-catch statement break the build for you? The compiler can be instructed to ignore this and maybe that is what is happening.
Checking the method signature in your ide might reveal that the method does not have a throws statement after all.

commented

Removing it does indeed break the build and my version of those methods do indeed throw an IOException. And by my version of those methods I mean MC 1.7.10 since they are both in net.minecraft.network.PacketBuffer.

commented

Was experimenting: found out more about the problem. OP updated.

commented

If I'm reading that right it failed the first time, but after you setup a decomp workspace the build worked?
Interesting...

commented

That's what it looks like. Does this need reporting to Forge or ForgeGradle? Or is it an MCP problem?

commented

Just got back from Holiday, should be doing some testing on this soon

commented

Just created a ForgeGradle issue (MinecraftForge/ForgeGradle#145), see that for info on my debugging session.

Aside: God I hate the way Java handles exceptions, though that's not the problem. Coming from .NET (which is better IMHO) it just seems a farce.

commented

Appears to work, closed.

commented

Oh yup, I forgot to notify you all of when this was fixed. Sorry!