Example usage for org.jfree.util Log error

List of usage examples for org.jfree.util Log error

Introduction

In this page you can find the example usage for org.jfree.util Log error.

Prototype

public static void error(final Object message) 

Source Link

Document

A convenience method for logging an 'error' message.

Usage

From source file:com.stevpet.sonar.plugins.dotnet.mscover.PropertiesHelper.java

public RunMode getRunMode() {
    String name = settings.getString(MSCOVER_MODE);
    if (StringUtils.isEmpty(name)) {
        return RunMode.SKIP;
    }/*w ww  . j a v a  2 s  . c o  m*/
    RunMode runMode = RunMode.SKIP;
    try {
        runMode = Enum.valueOf(RunMode.class, name.toUpperCase());
    } catch (IllegalArgumentException e) {
        String msg = "Invalid property value " + MSCOVER_MODE + "=" + name;
        Log.error(msg);
        throw new MsCoverException(msg);
    }
    return runMode;
}

From source file:org.madsonic.service.LastFMService.java

public void getArtistInfo(List<Artist> artistList) {

    LOG.debug("## ArtistCount: " + artistList.size());
    Locale LastFMLocale = new Locale(settingsService.getLocale().toString());
    LOG.debug("## LastFM Locale: " + LastFMLocale.toString());

    for (Artist artist : artistList) {
        try {// ww  w . j a v a  2  s .  co  m
            if (artist.getArtistFolder() != null) {

                LastFMArtist lastFMartist = new LastFMArtist();
                org.madsonic.lastfm.Artist tmpArtist = null;

                //String escapedArtist = stripNonValidXMLCharacters(StringEscapeUtils.escapeXml(artist.getArtistFolder()) );
                String stripedArtist = stripNonValidXMLCharacters(artist.getArtistFolder());
                String RequestedArtist = (org.madsonic.lastfm.Artist.getCorrection(stripedArtist, api_key))
                        .getName();

                //todo:error
                try {
                    tmpArtist = org.madsonic.lastfm.Artist.getInfo(RequestedArtist, LastFMLocale, null,
                            api_key);
                } catch (Exception e) {
                    Log.error("## FATAL Error! Artist Fetch! " + tmpArtist.getName());
                }

                lastFMartist.setArtistname(tmpArtist.getName());
                lastFMartist.setMbid(tmpArtist.getMbid());
                lastFMartist.setUrl(tmpArtist.getUrl());
                lastFMartist.setSince(tmpArtist.getSince());
                lastFMartist.setPlayCount(tmpArtist.getPlaycount());

                Collection<Album> TopAlbum = org.madsonic.lastfm.Artist.getTopAlbums(RequestedArtist, api_key,
                        3);

                String CollAlbum = null;
                for (Album album : TopAlbum) {
                    if (album != null) {
                        if (CollAlbum == null) {
                            CollAlbum = album.getName();
                        } else {
                            CollAlbum = CollAlbum + "|" + album.getName();
                        }
                    }
                }
                lastFMartist.setTopalbum(CollAlbum);

                Collection<String> GenreTags = tmpArtist.getTags();
                String CollTag = null;
                for (String TopTag : GenreTags) {
                    if (TopTag != null) {
                        if (CollTag == null) {
                            CollTag = TopTag;
                        } else {
                            CollTag = CollTag + "|" + TopTag;
                        }
                    }
                }
                lastFMartist.setToptag(CollTag);

                for (String TopTag : GenreTags) {
                    if (TopTag != null) {
                        lastFMartist.setGenre(TopTag);
                        break;
                    }
                }
                //             String[] sep = CollTag.split("\\|");
                //             List list = Arrays.asList(sep);

                String tmpSum = tmpArtist.getWikiSummary();
                tmpSum = StringUtil.removeMarkup(tmpSum);

                //             String tmpText = tmpArtist.getWikiText();
                //             tmpText = StringUtil.removeMarkup(tmpText);
                //             lastFMartist.setBio(tmpText);
                lastFMartist.setSummary(tmpSum);

                //             Collection<Tag> TopTags =    org.madsonic.lastfm.Artist.getTopTags(tmpArtist.getName(), api_key, 1);
                Collection<org.madsonic.lastfm.Artist> Similar = org.madsonic.lastfm.Artist
                        .getSimilar(tmpArtist.getName(), 6, api_key);

                for (org.madsonic.lastfm.Artist x : Similar) {

                    LastFMArtistSimilar s = new LastFMArtistSimilar();

                    s.setArtistName(tmpArtist.getName());
                    s.setArtistMbid(tmpArtist.getMbid());
                    s.setSimilarName(x.getName());
                    s.setSimilarMbid(x.getMbid());

                    lastFMArtistSimilarDao.createOrUpdateLastFMArtistSimilar(s);
                }

                //            /**
                //             * new Artist image importer workaround
                //             */
                //             if (tmpArtist != null) {
                //                lastFMartist.setCoverart1(tmpArtist.getImageURL(ImageSize.EXTRALARGE));
                //             }

                // deprecated

                //             PaginatedResult <Image> artistImage = org.madsonic.lastfm.Artist.getImages(RequestedArtist, 1, 5, api_key);
                //             Collection <Image> Imgs = artistImage.getPageResults();
                //
                //             int counter = 0;
                //             for (Image Img : Imgs)
                //             {    switch(counter)
                //                   { case 0: lastFMartist.setCoverart1(Img.getImageURL(ImageSize.LARGESQUARE));break;
                //                     case 1: lastFMartist.setCoverart2(Img.getImageURL(ImageSize.LARGESQUARE));break;
                //                     case 2: lastFMartist.setCoverart3(Img.getImageURL(ImageSize.LARGESQUARE));break;
                //                     case 3: lastFMartist.setCoverart4(Img.getImageURL(ImageSize.LARGESQUARE));break;
                //                     case 4: lastFMartist.setCoverart5(Img.getImageURL(ImageSize.LARGESQUARE));break;
                //                     }
                //                counter++;
                //             }

                if (lastFMartist.getArtistname() != null) {

                    LOG.info("## LastFM ArtistInfo Update: " + lastFMartist.getArtistname());
                    lastFMArtistDao.createOrUpdateLastFMArtist(lastFMartist);
                }
            }

        } catch (NullPointerException ex) {
            System.out.println("## ERROR: " + artist.getName());
        }
    }
    LOG.info("## LastFM ArtistScan Finished");

}

From source file:com.hp.avmon.deploy.service.DeployService.java

public String getMoTypeTree(String userId, String id, String pid, ResourceBundle bundle) {

    List<Map> list = new ArrayList<Map>();
    String sql = null;/*from ww w  .  ja  v  a  2s  . c om*/

    if ("businessTree".equals(pid)) {

        sql = String.format(
                "select type_id as \"id\",caption as \"text\",a.parent_id as \"pid\",'icon-'||lower(type_id) as \"iconCls\",case when b.parent_id is null then 'true' else 'false' end as \"leaf\" from TD_AVMON_MO_TYPE a  left join (select parent_id from TD_AVMON_MO_TYPE group by parent_id) b on a.type_id=b.parent_id where a.parent_id='root'");

        list = jdbc.queryForList(sql);
        int nodeCount = 0;

        for (Map map : list) {
            this.getNodeCount(map, id, bundle);
        }
    } else {
        if (null != id && id.length() > 0) {

            String parentId = id.split("\\*")[0];
            String businessType = id.split("\\*")[1];
            sql = String.format("select type_id as \"id\",caption as \"text\",a.parent_id as \"pid\","
                    + "case WHEN a.parent_id='HOST' THEN 'icon-' || upper(a.caption) else 'icon-' || lower(a.type_id) end as \"iconCls\","
                    + "case when b.parent_id is null then 'true' else 'false' end as \"leaf\" "
                    + "from TD_AVMON_MO_TYPE a  "
                    + "left join (select parent_id from TD_AVMON_MO_TYPE group by parent_id) b "
                    + "on a.type_id=b.parent_id " + "where a.parent_id='%s'", parentId);

            Log.info(sql);
            list = jdbc.queryForList(sql);
            for (Map map : list) {
                this.getNodeCount(map, businessType, bundle);
            }
        } else {
            Log.error("id is null");
        }
    }

    return JackJson.fromObjectHasDateToJson(list);
}

From source file:com.ext.portlet.epsos.EpsosHelperService.java

public static String getPortalTranslation(String key, String language) {
    String translation = "";
    language = language.replaceAll("_", "-");
    try {//from   w  ww.  jav  a 2  s.c o  m
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL url = cl.getResource("content/language/application/" + language + "/SpiritEhrPortal.xml");

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setValidating(false);
        dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(url.getFile());
        doc.getDocumentElement().normalize();
        XPath xpath = XPathFactory.newInstance().newXPath();
        translation = xpath.evaluate("//*[@key='" + key + "']", doc);
        if (Validator.isNull(translation))
            translation = key;
    } catch (Exception e) {
        Log.error(e.getMessage());
    }
    return translation;
}

From source file:com.ext.portlet.epsos.EpsosHelperService.java

public static String getConsentText(String language) {
    String translation = "";
    language = language.replaceAll("_", "-");
    try {//w ww.j av  a  2s .c o  m
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL url = cl.getResource("content/language/consent/Consent_LegalText_" + language + ".xml");

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setValidating(false);
        dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(url.getFile());
        doc.getDocumentElement().normalize();
        XPath xpath = XPathFactory.newInstance().newXPath();

        String xpathExpression = "/Consent/LegalText";
        NodeList nodes = (NodeList) xpath.evaluate(xpathExpression, doc, XPathConstants.NODESET);
        translation = nodes.item(0).getTextContent();
    } catch (Exception e) {
        Log.error("Error getting consent text for country " + language);
    }
    return translation;
}

From source file:com.ext.portlet.epsos.EpsosHelperService.java

public Vector getCountryIdsFromCS(String country) {
    Vector v = new Vector();
    //String[]  attrs=new String[2];
    String internationalSearchPath = GetterUtil
            .getString(GnPropsUtil.get("portalb", "international.search.path"));
    String filename = "InternationalSearch_" + country + ".xml";
    try {/* www .j av  a2  s. c o  m*/
        File file = new File(internationalSearchPath + filename);
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(file);
        doc.getDocumentElement().normalize();
        // ids
        NodeList nodeLst = doc.getElementsByTagName("id");
        String seperator = "";
        //   attrs[0]="";
        for (int s = 0; s < nodeLst.getLength(); s++) {
            Node fstNode = nodeLst.item(s);

            if (s > 0) {
                seperator = ",";
            }
            Element link = (Element) nodeLst.item(s);
            SearchMask sm = new SearchMask();
            sm.setDomain(link.getAttribute("domain"));
            sm.setLabel(link.getAttribute("label"));
            v.add(sm);
            //         attrs[0] = attrs[0] + seperator + a1;
        }
    } catch (Exception e) {
        Log.error(e.getMessage());
    }
    return v;
}

From source file:com.ext.portlet.epsos.EpsosHelperService.java

public String getLanguagesFromCS() {
    String listOfLangs = "";
    try {/*from   www.  j a  v  a2s  .co  m*/
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL url = cl.getResource("content/language/languages.xml");
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setValidating(false);
        dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(url.getFile());
        doc.getDocumentElement().normalize();
        NodeList nodeLst = doc.getElementsByTagName("entry");
        String seperator = "";
        for (int s = 0; s < nodeLst.getLength(); s++) {
            Node fstNode = nodeLst.item(s);
            if (listOfLangs.length() > 1) {
                seperator = ",";
            }
            Element link = (Element) nodeLst.item(s);
            String a1 = link.getAttribute("key");
            if (getCountryIdsFromCS(a1).get(0) != null) {
                listOfLangs = listOfLangs + seperator + a1;
            }
        }
    } catch (Exception e) {
        Log.error(e.getMessage());
    }
    return listOfLangs;
}

From source file:com.ext.portlet.epsos.EpsosHelperService.java

public String getCountriesFromCS() {
    String listOfCountries = "";
    String internationalSearchPath = GetterUtil
            .getString(GnPropsUtil.get("portalb", "international.search.path"));
    String filename = "InternationalSearch.xml";
    try {//from w  w w.j  a v  a 2 s. co m
        File file = new File(internationalSearchPath + filename);
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(file);
        doc.getDocumentElement().normalize();
        NodeList nodeLst = doc.getElementsByTagName("country");
        String seperator = "";
        for (int s = 0; s < nodeLst.getLength(); s++) {
            Node fstNode = nodeLst.item(s);
            //if (s>0) {seperator=",";}
            if (listOfCountries.length() > 1) {
                seperator = ",";
            }
            Element link = (Element) nodeLst.item(s);
            String a1 = link.getAttribute("code");
            if (getCountryIdsFromCS(a1).get(0) != null) {
                listOfCountries = listOfCountries + seperator + a1;
            }
        }
    } catch (Exception e) {
        Log.error(e.getMessage());
    }
    return listOfCountries;
}

From source file:com.ext.portlet.epsos.EpsosHelperService.java

public String getCountriesLabelsFromCS(String language) {
    String listOfCountries = "";
    String internationalSearchPath = GetterUtil
            .getString(GnPropsUtil.get("portalb", "international.search.path"));
    String filename = "InternationalSearch.xml";
    try {//  ww  w. j a  v  a 2  s . c  om
        File file = new File(internationalSearchPath + filename);
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(file);
        doc.getDocumentElement().normalize();
        NodeList nodeLst = doc.getElementsByTagName("country");
        String seperator = "";
        for (int s = 0; s < nodeLst.getLength(); s++) {
            Node fstNode = nodeLst.item(s);
            if (listOfCountries.length() > 1) {
                seperator = ",";
            }
            Element link = (Element) nodeLst.item(s);
            String a1 = EpsosHelperService.getPortalTranslation(link.getAttribute("code"), language);
            Vector v = getCountryIdsFromCS(link.getAttribute("code"));
            SearchMask sm = (SearchMask) v.get(0);
            if (sm.getDomain() != null) {
                listOfCountries = listOfCountries + seperator + a1;
            }

        }

    } catch (Exception e) {
        Log.error(e.getMessage());
    }
    return listOfCountries;
}