UnsupportedOperationException in IImportResolver when serializing

5 views
Skip to first unread message

Erwann Traisnel

unread,
Jul 13, 2017, 7:06:47 AM7/13/17
to protobuf-dt
Hello,

I am using protobuf-dt in order to create and serialize protobuf files from a different model.

Whenever I try to serialize a ProtobufResource, I get an UnsuportedOperationException thrown by "NullImportResolver".

I navigated to this class and realized it hasn't been implemented, so I controlled all bindings to see if the issue comes from that .

The binding is correctly made between ImportResolver and IImportResolver, however the problem seems to come from the default implementation of IImportResolver :

@ImplementedBy(NullImportResolver.class)
public interface IImportResolver {
  /**
   * Returns the resolved path of the given {@code Import} or {@code null} if the path cannot be
   * resolved.
   *
   * @param anImport the given {@code Import}.
   */
  String resolve(Import anImport);

  /**
   * Invalidates any cached results for the resolution of the given import.
   */
  void invalidateCacheFor(Import anImport);

  class NullImportResolver implements IImportResolver {
    @Override public String resolve(Import anImport) {
      throw new UnsupportedOperationException();
    }

    @Override
    public void invalidateCacheFor(Import anImport) {
      throw new UnsupportedOperationException();
    }
  }
}

What shall I do to avoid this problem ?

Best Regards

Erwann Traisnel
Reply all
Reply to author
Forward
0 new messages