Handle case where the preference for the descriptor.proto is unable to
be resolved.
Change-Id: I7a022235eca4553e26b341b76a5c68da17d53e57
Signed-off-by: Harry Terkelsen <het@google.com>
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptorProvider.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptorProvider.java
index 85b6346..9605687 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptorProvider.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtoDescriptorProvider.java
@@ -129,14 +129,19 @@
GeneralPreferences preferences = new GeneralPreferences(storeAccess, project);
String descriptorProtoUri = preferences.getDescriptorProtoPath();
if (!PreferenceNames.DEFAULT_DESCRIPTOR_PATH.equals(descriptorProtoUri)) {
- URI descriptorProtoLocation =
- URI.createURI(resolver.resolveUri(descriptorProtoUri, null, project));
- if (descriptorProtoLocation != null) {
- ProtoDescriptor protoDescriptor =
- new ProtoDescriptor(descriptorProtoUri, descriptorProtoLocation, parser, nodes);
- ProtoDescriptorInfo descriptorInfo =
- new ProtoDescriptorInfo(descriptorProtoUri, descriptorProtoLocation, protoDescriptor);
- descriptorInfos.put(descriptorProtoUri, descriptorInfo);
+ String resolvedUri = resolver.resolveUri(descriptorProtoUri, null, project);
+ if (resolvedUri != null) {
+ URI descriptorProtoLocation = URI.createURI(resolvedUri);
+ if (descriptorProtoLocation != null) {
+ ProtoDescriptor protoDescriptor =
+ new ProtoDescriptor(descriptorProtoUri, descriptorProtoLocation, parser, nodes);
+ ProtoDescriptorInfo descriptorInfo =
+ new ProtoDescriptorInfo(descriptorProtoUri, descriptorProtoLocation, protoDescriptor);
+ descriptorInfos.put(descriptorProtoUri, descriptorInfo);
+ }
+ } else {
+ LOG.log(Level.WARNING,
+ "Unable to resolve URI for descriptor proto location: " + descriptorProtoUri);
}
}