List of usage examples for javax.xml.bind UnmarshalException getMessage
public String getMessage()
From source file:org.tinymediamanager.core.tvshow.connector.TvShowToXbmcNfoConnector.java
public static TvShow getData(File nfo) { if (context == null) { return null; }/*from w w w . j ava 2 s . c om*/ // try to parse XML TvShow tvShow = null; try { TvShowToXbmcNfoConnector xbmc = parseNFO(nfo); tvShow = new TvShow(); if (StringUtils.isNotBlank(xbmc.getId())) { tvShow.setTvdbId(xbmc.getId()); } if (StringUtils.isNotBlank(xbmc.getImdbid())) { tvShow.setImdbId(xbmc.getImdbid()); } tvShow.setTitle(xbmc.getTitle()); tvShow.setSortTitle(xbmc.getSorttitle()); tvShow.setRating(xbmc.getRating()); tvShow.setVotes(xbmc.getVotes()); tvShow.setYear(xbmc.getYear()); tvShow.setPlot(xbmc.getPlot()); tvShow.setCertification(Certification.findCertification(xbmc.getMpaa())); tvShow.setFirstAired(xbmc.getPremiered()); String studio = StringUtils.join(xbmc.studio, " / "); if (studio == null) { tvShow.setProductionCompany(""); } else { tvShow.setProductionCompany(studio); } tvShow.setProductionCompany(tvShow.getProductionCompany().replaceAll("\\s*,\\s*", " / ")); tvShow.setStatus(xbmc.getStatus()); for (String genre : xbmc.getGenres()) { String[] genres = genre.split("/"); for (String g : genres) { MediaGenres genreFound = MediaGenres.getGenre(g.trim()); if (genreFound != null) { tvShow.addGenre(genreFound); } } } for (Actor actor : xbmc.getActors()) { TvShowActor tvShowActor = new TvShowActor(actor.getName(), actor.getRole()); tvShowActor.setThumbUrl(actor.getThumb()); tvShow.addActor(tvShowActor); } for (String tag : xbmc.tags) { tvShow.addToTags(tag); } tvShow.addToMediaFiles(new MediaFile(nfo, MediaFileType.NFO)); } catch (UnmarshalException e) { LOGGER.error("failed to parse " + nfo.getAbsolutePath() + " " + e.getMessage()); // MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, nfoFilename, "message.nfo.readerror")); return null; } catch (Exception e) { LOGGER.error(nfo.getAbsolutePath() + " " + e.getMessage()); // MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, nfoFilename, "message.nfo.readerror")); return null; } // only return if a movie name has been found if (StringUtils.isEmpty(tvShow.getTitle())) { return null; } return tvShow; }