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

NPE during setup protobuf StringValue #765

Open
lvitaly opened this issue Aug 20, 2021 · 0 comments
Open

NPE during setup protobuf StringValue #765

lvitaly opened this issue Aug 20, 2021 · 0 comments

Comments

@lvitaly
Copy link

lvitaly commented Aug 20, 2021

Hello,

I tried to use sfm-jooq and sfm-converter-protobuf (v8.2.3) along with gRPC server generated by io.grpc:protoc-gen-grpc-java:1.39.0 and com.google.protobuf:protoc:3.17.2 (JVM 11). I got this exception.

java.lang.NullPointerException: null
        at com.google.protobuf.StringValue$Builder.setValue(StringValue.java:502)
        at com.google.protobuf.StringValue.of(StringValue.java:570)
        at org.simpleflatmapper.reflect.generated.com.google.protobuf.AsmInstantiatorStringValueFromStringIntovalue_I2.newInstance(Unknown Source)
        at org.simpleflatmapper.reflect.generated.com.google.protobuf.AsmInstantiatorStringValueFromStringIntovalue_I2.newInstance(Unknown Source)
        at org.simpleflatmapper.map.getter.InstantiatorContextualGetter.get(InstantiatorContextualGetter.java:18)
        at org.simpleflatmapper.map.getter.ContextualGetterBiFunction.apply(ContextualGetterBiFunction.java:65)
        at org.simpleflatmapper.reflect.generated.com.jl.grpc.AsmBiInstantiatorBuilderFromResultSetAndMappingContextIntocityAndiataAndicaoAndidAndnameAndCountryCodeIdAndPlaceId_Ic.newInstance(Unknown Source)
        at org.simpleflatmapper.reflect.generated.com.jl.grpc.AsmBiInstantiatorBuilderFromResultSetAndMappingContextIntocityAndiataAndicaoAndidAndnameAndCountryCodeIdAndPlaceId_Ic.newInstance(Unknown Source)
        at org.simpleflatmapper.map.mapper.AbstractMapper.map(AbstractMapper.java:22)
        at org.simpleflatmapper.map.mapper.ContextualSourceFieldMapperImpl.map(ContextualSourceFieldMapperImpl.java:38)
        at org.simpleflatmapper.map.mapper.JoinMapperEnumerable.next(JoinMapperEnumerable.java:40)
        at org.simpleflatmapper.map.mapper.AbstractEnumerableMapper.forEach(AbstractEnumerableMapper.java:33)
        at org.simpleflatmapper.jooq.SelectQueryMapper.asList(SelectQueryMapper.java:52)
        ... 6 common frames omitted

Issued from

    public Builder setValue(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();

On a high level, all looks fine. But is there a way to eliminate these null values from setup or is this a bug in the tool?

My code sample

  public CompletableFuture<Iterable<Airport>> getAirports() {
    return CompletableFuture.supplyAsync(() -> {
      final var mapper = SelectQueryMapperFactory
        .newInstance()
        .useAsm(false)
        .newMapper(Airport.class);

      final var select = ctx.select(
          AIRPORTS.ID,
          AIRPORTS.ICAO,
          AIRPORTS.NAME,
          PLACES.CITY
        )
        .from(AIRPORTS)
        .innerJoin(PLACES).on(AIRPORTS.PLACE_ID.eq(PLACES.ID));

      return mapper.asList(select);
    });
  }
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

No branches or pull requests

1 participant