Merge branch 'stable-2.9' into stable-2.10
* stable-2.9: Fix NPE when ReviewInput's message is empty Fix NPE in /projects/{name}/children?recursive when a parent is missing Fix NPE when submitting review with inline comments via REST Conflicts: gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java Change-Id: Icfde6f0274f0ccc92773fd5a376e8c27099437ac
This commit is contained in:
commit
114845a9ab
@ -315,12 +315,16 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
|||||||
Iterator<CommentInput> listItr = list.iterator();
|
Iterator<CommentInput> listItr = list.iterator();
|
||||||
while (listItr.hasNext()) {
|
while (listItr.hasNext()) {
|
||||||
CommentInput c = listItr.next();
|
CommentInput c = listItr.next();
|
||||||
|
if (c == null) {
|
||||||
|
listItr.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (c.line < 0) {
|
if (c.line < 0) {
|
||||||
throw new BadRequestException(String.format(
|
throw new BadRequestException(String.format(
|
||||||
"negative line number %d not allowed on %s",
|
"negative line number %d not allowed on %s",
|
||||||
c.line, path));
|
c.line, path));
|
||||||
}
|
}
|
||||||
c.message = Strings.emptyToNull(c.message).trim();
|
c.message = Strings.nullToEmpty(c.message).trim();
|
||||||
if (c.message.isEmpty()) {
|
if (c.message.isEmpty()) {
|
||||||
listItr.remove();
|
listItr.remove();
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import com.google.inject.Inject;
|
|||||||
|
|
||||||
import org.kohsuke.args4j.Option;
|
import org.kohsuke.args4j.Option;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -96,7 +97,13 @@ public class ListChildProjects implements RestReadView<ProjectResource> {
|
|||||||
node.addChild(key);
|
node.addChild(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return getChildProjectsRecursively(projects.get(parent));
|
|
||||||
|
ProjectNode n = projects.get(parent);
|
||||||
|
if (n != null) {
|
||||||
|
return getChildProjectsRecursively(n);
|
||||||
|
} else {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ProjectInfo> getChildProjectsRecursively(ProjectNode p) {
|
private List<ProjectInfo> getChildProjectsRecursively(ProjectNode p) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user