-
Notifications
You must be signed in to change notification settings - Fork 1
[Bug]: EventIterator is not able to read the value of the field properly #90
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
JAFAR Version
0.11.0
JDK Version
Eclipse Adoptium - 21.0.8
Parser Type
Other/Not Applicable
Bug Description
[Bug]: EventIterator is not able to read the value of the field properly
Steps to Reproduce
Here is the Java code
package com.example;
import io.jafar.parser.api.EventIterator;
import io.jafar.parser.api.HandlerRegistration;
import io.jafar.parser.api.JafarParser;
import io.jafar.parser.api.JafarRecordedEvent;
import io.jafar.parser.api.JfrField;
import io.jafar.parser.api.JfrType;
import io.jafar.parser.api.TypedJafarParser;
import java.nio.file.Paths;
import java.util.Map;
public class ScheduledFireTimeEventParser {
@JfrType("io.hyperfoil.ScheduledFireTimeEvent")
public interface ScheduledFireTimeEvent {
@JfrField("phaseDef")
String phaseDef();
}
public static void main(String[] args) throws Exception {
String jfrFile = "/home/dlovison/Downloads/test.jfr";
try (TypedJafarParser p = JafarParser.newTypedParser(Paths.get(jfrFile))) {
HandlerRegistration<ScheduledFireTimeEvent> reg = p.handle(ScheduledFireTimeEvent.class, (e, ctl) -> {
if (e.phaseDef() == null) {
System.err.println("phaseDef is null");
}
});
p.run();
reg.destroy(p);
}
try (EventIterator it = EventIterator.open(Paths.get(jfrFile))) {
while (it.hasNext()) {
JafarRecordedEvent event = it.next();
if ("io.hyperfoil.ScheduledFireTimeEvent".equals(event.typeName())) {
Map<String, Object> data = event.value();
Object phaseDef = data.get("phaseDef");
if (phaseDef == null) {
System.err.println("phaseDef is null");
}
}
}
}
}
}if (e.phaseDef() == null) { is never null
BUT
if (phaseDef == null) { is returning null
The value of phaseDef is a .toString of the obejct. Value example: Phase{name='steadyState/viewUser', id=4}
Expected Behavior
Both API returning the same value
Actual Behavior
Different values based on the Iterator
Stack Trace
Code Sample
Sample JFR File
No response
Additional Context
No response
Checklist
- I have searched existing issues to ensure this is not a duplicate
- I have tested with the latest version of JAFAR
- I can provide a minimal JFR file to reproduce this issue
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working