Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

332 comsngularkloadgenserializerprotobufserializer nullpointerexception #355

Conversation

dhergonsngular
Copy link
Contributor

Protobuf Schemas import fixed

AdrianLagartera and others added 12 commits February 22, 2023 13:45
Added a trim statement to avoid problem when cast the schemas from classpath
Removed some unused test files
Apparently the original project was renamed into cmak to avoid break the TOS of kafka having the kafka in the name of unofficial tool
…genserializerprotobufserializer-nullpointerexception

# Conflicts:
#	pom.xml
#	src/main/java/com/sngular/kloadgen/sampler/SamplerUtil.java
#	src/test/resources/mappings/schema_registry_stub.json
final var importSchema = JMeterHelper.getParsedSchema(getSubjectName(importedClass, metadata), JMeterContextService.getContext().getProperties());
if (!ProtobufHelper.NOT_ACCEPTED_IMPORTS.contains(importedClass)) {
schemaBuilder.addDependency(((ProtobufSchema) importSchema).toDescriptor().getFullName());
schemaBuilder.addSchema(convertDynamicSchema((ProtobufSchema) importSchema));

Choose a reason for hiding this comment

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

It is not an error, but I think it would be cleaner to create a variable to hold the value of importSchema because that way you avoid to do the cast several times.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -295,7 +326,7 @@ private static void extracted(
msgDef.addField("repeated", "typemapnumber" + elementField.getName(), elementField.getName(), elementField.getTag());

msgDef.addMessageDefinition(
MessageDefinition.newBuilder("typemapnumber" + elementField.getName()).addField(OPTIONAL, "string", "key", 1).addField(OPTIONAL, realType, "value", 2).build());
MessageDefinition.newBuilder("typemapnumber" + elementField.getName()).addField(OPTIONAL, "string", "key", 1).addField(OPTIONAL, realType, "value", 2).build());

Choose a reason for hiding this comment

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

You use the value of "typemapnumber" several times, so it would be nice to create a variable with that value.

Copy link
Contributor

@5uso-sng 5uso-sng left a comment

Choose a reason for hiding this comment

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

Seems good

Copy link
Contributor

@alfredo9f alfredo9f left a comment

Choose a reason for hiding this comment

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

For me it's ok.

@dhergonsngular dhergonsngular merged commit 27f2aa7 into master Mar 28, 2023
@jemacineiras jemacineiras deleted the 332-comsngularkloadgenserializerprotobufserializer-nullpointerexception branch June 7, 2023 05:53
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.

[com.sngular.kloadgen.serializer.ProtobufSerializer - NullPointerException]:
6 participants