Skip to content

Commit

Permalink
refactor: throw character name is empty on response from maple
Browse files Browse the repository at this point in the history
  • Loading branch information
geoje committed Dec 11, 2024
1 parent ae1da38 commit 7040287
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package kr.ygh.maple.character.feign.maple;

import feign.codec.Decoder;
import kr.ygh.maple.character.dto.basic.Basic;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.springframework.context.annotation.Bean;

import java.io.InputStream;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import kr.ygh.maple.character.dto.basic.Basic;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.springframework.context.annotation.Bean;

public class MapleConfig {

Expand Down Expand Up @@ -49,7 +48,7 @@ private Basic parseBasic(Document document) {
String characterName = tdMain
.map(tr -> tr.selectFirst("dt > a"))
.map(Element::text)
.orElse("");
.orElseThrow();
Optional<String> worldImage = tdMain
.map(tr -> tr.selectFirst("dt > a > img"))
.map(img -> img.attr("src"));
Expand Down

0 comments on commit 7040287

Please sign in to comment.