Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@auntyellow
Copy link
Contributor

I found a NPE when a binary/varbinary/blob type in SQL, because I disable registering P6LogFactory (to avoid massive log):

java.lang.NullPointerException
    at com.p6spy.engine.common.Value.convertToString(Value.java:98)
    at com.p6spy.engine.common.Value.toString(Value.java:63)
    at com.p6spy.engine.common.PreparedStatementInformation.getSqlWithValues(PreparedStatementInformation.java:56)
    ...

So I add the null check for P6LogOptions.getActiveInstance().

btw, duplicated allOptions.put(...) call in P6ModuleManager removed.

@auntyellow
Copy link
Contributor Author

Before this NPE fixed, I have to register a simple module that can add P6LogOptions into P6ModuleManager as a workaround:

public class P6NoLogFactory implements com.p6spy.engine.spy.P6Factory {
	@Override
	public P6LoadableOptions getOptions(P6OptionsRepository optionsRepository) {
		return new P6LogOptions(optionsRepository);
	}

	@Override
	public JdbcEventListener getJdbcEventListener() {
		return new SimpleJdbcEventListener() {/**/};
	}
}

Copy link
Member

@gavlyukovskiy gavlyukovskiy left a comment

Choose a reason for hiding this comment

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

LGTM with small comment

@typekpb
Copy link
Member

typekpb commented Sep 21, 2019

@auntyellow any chance to provide the fix requested by @gavlyukovskiy ? afterwards we'd be happy to merge

@auntyellow
Copy link
Contributor Author

@auntyellow any chance to provide the fix requested by @gavlyukovskiy ? afterwards we'd be happy to merge

fixed :-)

@gavlyukovskiy gavlyukovskiy merged commit 706451e into p6spy:master Sep 24, 2019
@gavlyukovskiy
Copy link
Member

@auntyellow merged, thank you!

@gavlyukovskiy
Copy link
Member

@typekpb fyi I just released version 3.8.6 with this fix

@typekpb
Copy link
Member

typekpb commented Sep 25, 2019 via email

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.

3 participants