Skip to content
Permalink
Browse files
fix(core): solve NPE when missing source type (#660)
Patch to avoid NPE such as in apache/camel-k#2216

Ref #658
  • Loading branch information
squakez committed Apr 15, 2021
1 parent 99ef47e commit 4d706da444397556e8f3542f79c72567620cf9d2
Showing 2 changed files with 3 additions and 1 deletion.
@@ -102,6 +102,9 @@ static void sortSources(SourceDefinition[] sources) {
// We must ensure the source order as defined in SourceType enum
Arrays.sort(sources,
(a, b) -> {
if (a.getType() == null && b.getType() == null) {
return 0;
}
if (a.getType() == null) {
return SourceType.source.compareTo(b.getType());
} else if (b.getType() == null) {
@@ -89,7 +89,6 @@ public void shouldOrderSourcesByType() {
"camel.k.sources[0].type", "template",
"camel.k.sources[1].name", "source1",
"camel.k.sources[2].name", "source2",
"camel.k.sources[2].type", "source",
"camel.k.sources[3].name", "errorHandler1",
"camel.k.sources[3].type", "errorHandler"
));

0 comments on commit 4d706da

Please sign in to comment.