
10-26-2008, 08:42 PM
|
|
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:
|
Code:
|
public method test() {
try {
is_17_ = String.methodE(is_16_, true);
} catch (RuntimeException runtimeexception) {
throw Test.method1D(runtimeexception,
(""));
}
} |
and i want to disable the Throw, what would i have to do?
EDIT:
i would like it to look like this:
|
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 08:44 PM.
|
|

10-26-2008, 08:51 PM
|
|
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  .
|
|

10-26-2008, 09:25 PM
|
 |
Moderator
|
|
Join Date: Jun 2008
Posts: 6,393
Rep Power: 8
|
|
|
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, 10:05 PM
|
|
Member
|
|
Join Date: Oct 2008
Posts: 5
Rep Power: 0
|
|
Originally Posted by Fubarable
|
|
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.
|
No, that is the example, I am the one who has the src(its a basic applet) i made it last night, because i wanted to learn how to disable somepart of a method
|
|

10-26-2008, 10:13 PM
|
 |
Moderator
|
|
Join Date: Jun 2008
Posts: 6,393
Rep Power: 8
|
|
|
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, 10:16 PM
|
|
Member
|
|
Join Date: Oct 2008
Posts: 5
Rep Power: 0
|
|
Originally Posted by Fubarable
|
|
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.
|
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:31 PM
|
 |
Moderator
|
|
Join Date: Jun 2008
Posts: 6,393
Rep Power: 8
|
|
|
Quote:
|
|
Why is the class src so important? disabling a method, can you not show me how to do it with that method itself?
|
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.
|
|

10-26-2008, 11:05 PM
|
|
Senior Member
|
|
Join Date: Sep 2008
Posts: 129
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, 11:15 PM
|
|
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-27-2008, 12:01 AM
|
|
Senior Member
|
|
Join Date: Sep 2008
Posts: 129
Rep Power: 0
|
|
|
You mean "can I hack bytecode to do something other than what it was compiled to do?"
|
|

10-27-2008, 02:41 AM
|
 |
Senior Member
|
|
Join Date: Jun 2008
Posts: 571
Rep Power: 2
|
|
Originally Posted by georgemc
|
|
You mean "can I hack bytecode to do something other than what it was compiled to do?"
|
To which the answer is "yes" with suitable effort and skill
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 07:01 PM.
|
|