Skip to content

Commit

Permalink
Handle null value when parsing kubevela string
Browse files Browse the repository at this point in the history
  • Loading branch information
rudi committed Aug 1, 2024
1 parent 6b1c936 commit a19ca2b
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.nebulouscloud.optimiser.kubevela;


import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -494,6 +495,9 @@ public static Map<String, List<Requirement>> getBoundedRequirements(String kubev
* @throws JsonProcessingException if kubevela does not contain valid YAML.
*/
public static JsonNode parseKubevela(String kubevela) throws JsonProcessingException {
if (kubevela == null) {
throw new JsonParseException("The provided string value was null");
}
return yamlMapper.readTree(kubevela);
}

Expand Down

0 comments on commit a19ca2b

Please sign in to comment.