Questions tagged [bcel]

Apache Byte Code Engineering Library, an open-source library for inspecting and manipulating Java byte code files (.class files)

For details see: http://jakarta.apache.org/bcel/

123 questions
0
votes
1 answer

BCEL code example to put "new Class[]{String.class}" on the stack

I am looking for a BCEL code example on how to create an array of size 1 containing instances of java.lang.Class and initialize its only element with a reference to java.lang.String.class in other terms, I am looking for a BCEL code sample to put…
entzik
  • 654
  • 4
  • 8
0
votes
1 answer

Construct the stackmap of method while using bcel

I am trying bcel to modify a method by inserting invoke before specific instructions. It seems that my instrumentation would result in a different stackmap table, which can not be auto-generated by the bcel package itself. So, my instrumented class…
Kea Medes
  • 1
  • 1
0
votes
1 answer

Identify Unused variables in Java code

I need to identify unused variables ( arguments, local variables, class member variables) unused in Java code. Basically i have to use BCEL to access the byte code and reach my objective. I have managed using ClassGen to get all the methods called…
Ali_AUB
  • 3
  • 2
0
votes
0 answers

What is the BCEL Instruction to read my desired code block

I am developing a call method using Bcel.But i couldn't reach getTweets function.It stops after ActionListener.What is the instruction for it? Here is how i read instructions: for (InstructionHandle ih = mg.getInstructionList().getStart(); …
cyo
  • 193
  • 2
  • 4
  • 17
0
votes
0 answers

Replacing ConstantUtf8 from ConstantPool of class using BCEL

I have a java class files whose constant pool consist some ConstantUtf8 data as 75. CONSTANT_Utf8 : SampleString 95. CONSTANT_Utf8 : SampleString means same data on different index, I have written the following code: ConstantPoolGen cp =…
ssa
  • 199
  • 5
  • 13
0
votes
0 answers

when I open mission control flight recording file I get exception

When I started flight recording for my application in java mission control it records normally and I open the .jrf file I get an exception like this: *Could not load events from…
metmem
  • 33
  • 5
0
votes
1 answer

In bytecode add a method to a particular line in a class using BCEL

I am new to BCEL for manipulating Java bytecode. I need to insert a new method into a particular line in a .class file using BCEL. The result should be a new .class file which contains the class with the newly inserted method. I searched a lot…
kajarigd
  • 1,299
  • 3
  • 28
  • 46
0
votes
1 answer

Can BCEL generate LocalVariableTable?

I came across a boring error: Exception in thread "main" java.lang.VerifyError: Bad type on operand stack in method net.madz.lifecycle.demo.standalone.ServiceOrder.allocateResources(JJJ)V at offset 27 I don't quite understand the error…
Barry Zhong
  • 470
  • 3
  • 17
0
votes
1 answer

BCEL update exceptions table

I want to change a method using BCEL. But I do not know how to update the Exception table. Here's simplified code: ConstantPoolGen poolGen = classGen.getConstantPool(); InstructionList iList = new…
DivinaProportio
  • 220
  • 1
  • 3
  • 13
0
votes
1 answer

How to change value of a static field using BCEL?

I want to reset a static field using BCEL, for instance private static final int myValue = 1; to myValue = 2. Using another bytecode library such as ASM is not possible.
s106mo
  • 1,243
  • 2
  • 14
  • 20
0
votes
1 answer

Call a method when object state changes

I am providing an annotation @validateName which anyone can include in their code. Suppose some one coded class Person { @validateName private String name; .... } Then they can call NameValidator.validate(personObject) or some similar…
sinujohn
  • 2,506
  • 3
  • 21
  • 26
0
votes
0 answers

How do I load resources when using a classloader?

I'm using JarFile and JarURLConnection to load files out of a jar file. I'm then taking the classes, and loading them via BCEL (ByteCode Engineering Library, apache library). I cant just directly use a class loader because im modifying some classes…
Alex Coleman
  • 7,216
  • 1
  • 22
  • 31
0
votes
2 answers

how to create java file programmatically

I am creating a util-class which writes .java Files that act as coverter - generator. This util-class will generate AConverter.java' (refer below sample) I want know how to write the util-class. I googled, and found the recommendation to use…
VAm
  • 13
  • 5
0
votes
2 answers

How can I get the generic information of class using BCEL?

I would like to get the generic information (Counter class) of my CounterPersistence class using BCEL 6.0-SNAPSHOT. The signature is like this: public interface CounterPersistence extends BasePersistence { .... } I'm using the following…
0
votes
1 answer

Force proxy with BCEL in java

Is there some way to replace a call like Socket s = new Socket(Proxy.NO_PROXY); with Socket s = new Socket(); using BCEL because i can't figure out how. I understand it would involve changing the InstructionList but i don't know how to scan for it…
ILOVEPIE
  • 177
  • 1
  • 10
1 2 3
8
9