Skip to content

Conversation

@x-Ai
Copy link

@x-Ai x-Ai commented Sep 29, 2025

Rectifying the NullPointerException error encountered within the latest version of Burp.

java.lang.NullPointerException
	at synfron.reshaper.burp.core.messages.entities.http.HttpRequestMessage.getContentType(HttpRequestMessage.java:79)
	at synfron.reshaper.burp.core.messages.entities.http.HttpRequestMessage.initialize(HttpRequestMessage.java:57)

@ddwightx
Copy link
Contributor

Thanks for the contribution!

}

public static ContentType get(burp.api.montoya.http.message.ContentType contentType) {
if (contentType == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if (!encoder.isUseDefault() && encoder.isAutoSet() && !getContentType().isTextBased()) {
encoder.setEncoding("default", true);
}
initialized = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give your thought process on this move?

Copy link
Author

@x-Ai x-Ai Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, A recursive loop materializes when the initialize() method invokes getContentType(), which in turn calls back to initialize(). To resolve this circular dependency, the initialized = true; statement should be relocated to the very top of the if (!initialized) block within the initialize() method. This strategic placement dismantles the recursive cycle; upon its subsequent invocation by getContentType(), the initialize() method will encounter the pre-set flag and return immediately, thereby preempting the redundant execution of the initialization logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants