Results 1 to 11 of 11
Thread: Disabling part of a method
- 10-26-2008, 07:42 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
Disabling part of a method
Well, i want to know if there is a way to disable part of a method(.class) rather than decompiling the class and fixing the errors and all.
For ex:
and i want to disable the Throw, what would i have to do?Java Code:public method test() { try { is_17_ = String.methodE(is_16_, true); } catch (RuntimeException runtimeexception) { throw Test.method1D(runtimeexception, ("")); } }
EDIT:
i would like it to look like this:
Java Code:public method test() { try { is_17_ = String.methodE(is_16_, true); } catch (RuntimeException runtimeexception) { is_B_ = new byte[100]; //throw Test.method1D(runtimeexception, ("")); } }Last edited by juru; 10-26-2008 at 07:44 PM.
- 10-26-2008, 07:51 PM #2
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
And if anyone could help me do that in bytecode, it would also be appreciated :).
-
So, let me guess that this is decompiled code that you're messing with. If so, I'd go to the folks who coded it and ask to get the source code. You'll have a much easier time changing that.
- 10-26-2008, 09:05 PM #4
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
-
OK,... then why don't you post the whole class if it's not too big, or shorten it to the smallest possible amount of code that still compiles and still shows your problem. Please adjust your variable and method names, and fix your indentation to make everything readable. Also, please specify exactly what you are trying to do here and why. You stated something about removing a catch block which sounds a bit fishy .... why is there a catch there in the first place, possibly because there's a method within the block that can possibly throw an exception, and you may need the catch,... I'm not sure. Any way, the more information and readable code you can provide, the better we'll understand your problem.
- 10-26-2008, 09:16 PM #6
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
-
Your code as written makes no sense, isn't compilable in the least (String method "methodE"?), and makes it hard to understand your question out of context. Sure you can often place a portion of a methods code within an if block and use a boolean variable to control its execution, but I've not seen that done with a throws clause. I guess it all smells funny to me.Why is the class src so important? disabling a method, can you not show me how to do it with that method itself?
- 10-26-2008, 10:05 PM #8
Senior Member
- Join Date
- Sep 2008
- Posts
- 135
- Rep Power
- 0
You have the source, but want to manipulate bytecode? Sounds almost certainly like a fudgy workaround for something-or-other. What is that something-or-other? Simply disabling the throwing of a runtime exception isn't going to magically fix some bug you've got, if that's what you're thinking
- 10-26-2008, 10:15 PM #9
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
No, i wanted to experement with that, for example, whatever the applet sends out can be changed by a class. (like..1+1=2, the output can be changed so 1+1=6, something similar)
- 10-26-2008, 11:01 PM #10
Senior Member
- Join Date
- Sep 2008
- Posts
- 135
- Rep Power
- 0
You mean "can I hack bytecode to do something other than what it was compiled to do?"
- 10-27-2008, 01:41 AM #11
Similar Threads
-
Enabling/disabling menu depending on clipboard content availability
By Java Tip in forum SWTReplies: 0Last Post: 07-07-2008, 04:35 PM -
[SOLVED] Disabling a button not working
By Leprechaun in forum New To JavaReplies: 2Last Post: 04-24-2008, 04:46 AM -
How to get part of a String?
By eva in forum New To JavaReplies: 1Last Post: 12-23-2007, 06:58 AM -
Inventory part 2 help please
By badness in forum New To JavaReplies: 1Last Post: 12-12-2007, 07:51 AM -
disabling JButtons after win in TicTacToe
By noisepoet in forum New To JavaReplies: 1Last Post: 05-18-2007, 11:01 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks