From 7991ea56155f64f303aa022ff14754d3c978e80d Mon Sep 17 00:00:00 2001 From: Sam Hieken <99104112+sam-hieken@users.noreply.github.com> Date: Mon, 25 Sep 2023 16:05:07 -0400 Subject: [PATCH] Update JsoupConverter.java Java <11 compatibility --- src/main/java/org/jsoup/experimental/JsoupConverter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jsoup/experimental/JsoupConverter.java b/src/main/java/org/jsoup/experimental/JsoupConverter.java index 7e9418528e..976eea6f2f 100644 --- a/src/main/java/org/jsoup/experimental/JsoupConverter.java +++ b/src/main/java/org/jsoup/experimental/JsoupConverter.java @@ -84,7 +84,7 @@ private T getObjectFromElement0(Element elem, Class type) throws IllegalA if (ja != null) { // If the selector is blank, we use attributes from // the root element. - final Element child = ja.selector().isBlank() + final Element child = ja.selector().isEmpty() ? elem : elem.selectFirst(ja.selector()); @@ -182,7 +182,7 @@ else if (fieldType == List.class || fieldType == Set.class) { if (jselector == null) throw new IllegalArgumentException("Field '" + field.getName() + "' is a collection, and can't be assigned by a @JAttribute"); - final String selector = jselector.value().isBlank() + final String selector = jselector.value().isEmpty() ? field.getName() : jselector.value(); @@ -198,7 +198,7 @@ else if (fieldType == List.class || fieldType == Set.class) { if (jselector == null) throw new IllegalArgumentException("Field '" + field.getName() + "' is not a primitive, and can't be assigned by a @JAttribute"); - final String selector = jselector.value().isBlank() + final String selector = jselector.value().isEmpty() ? field.getName() : jselector.value();