commit | 486b515f75cc62384e14b247077bc707401693d7 | [log] [tgz] |
---|---|---|
author | Alex Ruiz <alruiz@google.com> | Mon Aug 29 17:21:32 2011 -0700 |
committer | Alex Ruiz <alruiz@google.com> | Mon Aug 29 17:21:32 2011 -0700 |
tree | 0a2acc97460fbf557c0556383c2331c44f43f3dc | |
parent | 3ef38674d83c5803c82137b880552e66e23205a1 [diff] | |
parent | 3d1f2de8f4bac3a15b9ea534a261b5c3d97745b4 [diff] |
Merge branch 'master' of https://code.google.com/p/protobuf-dt/
diff --git a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/builder/ProtoDescriptorPathFinder_findRootOf_Test.java b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/builder/ProtoDescriptorPathFinder_findRootOf_Test.java index 3e8fab7..be531f2 100644 --- a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/builder/ProtoDescriptorPathFinder_findRootOf_Test.java +++ b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/builder/ProtoDescriptorPathFinder_findRootOf_Test.java
@@ -35,6 +35,10 @@ assertThat(finder.findRootOf(null), nullValue()); } + @Test public void should_return_null_if_path_is_empty() { + assertThat(finder.findRootOf(""), nullValue()); + } + @Test public void should_throw_error_if_path_does_not_contain_descriptor_FQN() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Path '/usr/local/include' does not contain '/google/protobuf/descriptor.proto'");
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtoDescriptorPathFinder.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtoDescriptorPathFinder.java index 9fa8783..1e1dd46 100644 --- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtoDescriptorPathFinder.java +++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtoDescriptorPathFinder.java
@@ -9,6 +9,7 @@ package com.google.eclipse.protobuf.ui.builder; import static com.google.eclipse.protobuf.scoping.ProtoDescriptor.DESCRIPTOR_IMPORT_URI; +import static org.eclipse.xtext.util.Strings.isEmpty; /** * @author alruiz@google.com (Alex Ruiz) @@ -18,7 +19,7 @@ private static final String DESCRIPTOR_FQN = "/" + DESCRIPTOR_IMPORT_URI; public String findRootOf(String descriptorFilePath) { - if (descriptorFilePath == null) return null; + if (isEmpty(descriptorFilePath)) return null; int indexOfDescriptorFqn = descriptorFilePath.indexOf(DESCRIPTOR_FQN); if (indexOfDescriptorFqn == -1) { String format = "Path '%s' does not contain '%s'";