List of usage examples for java.util.logging Logger getLogger
@CallerSensitive public static Logger getLogger(String name)
From source file:io.getlime.push.repository.serialization.JSONSerialization.java
/** * Parsing message from JSON to PushMessageBody object. * * @param message Message to parse// w w w . j av a2 s . c o m * @return PushMessageBody */ public static PushMessageBody deserializePushMessageBody(String message) throws PushServerException { PushMessageBody pushMessageBody; try { pushMessageBody = new ObjectMapper().readValue(message, PushMessageBody.class); } catch (IOException e) { Logger.getLogger(PushCampaignController.class.getName()).log(Level.SEVERE, e.getMessage(), e); throw new PushServerException("Failed parsing from JSON"); } return pushMessageBody; }
From source file:com.notes.listen.FsWatchService.java
public static void start(String path) { if (fsw == null) { lock.lock();// www.j ava 2 s . com if (fsw == null) { try { fsw = new FsWatcher(EventInst.getInstance().getAsyncEventBus(), Paths.get(path)); try { fsw.start(); } catch (IOException ex) { Logger.getLogger(FsWatchService.class.getName()).log(Level.SEVERE, null, ex); } } finally { lock.unlock(); } } } }
From source file:ListOfCitys.CityList.java
public static JSONObject getCityNameForCountry(String countryName, String zipName) { List<String> cities = new ArrayList<>(); List<String> citiesList = new ArrayList<>(); JSONObject obj = new JSONObject(); try {//from w w w . j a v a 2 s . co m WebService.setUserName("nane"); ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria(); searchCriteria.setQ(countryName); ToponymSearchResult searchResult; searchResult = WebService.search(searchCriteria); for (int i = 0; i < searchResult.getToponyms().size(); ++i) { cities.add(searchResult.getToponyms().get(i).getName()); } for (int j = 0; j < 3; ++j) { citiesList.add(cities.get(new Random().nextInt(cities.size()))); } obj.put(zipName, citiesList.toArray()); return obj; } catch (Exception ex) { Logger.getLogger(CityList.class.getName()).log(Level.SEVERE, null, ex); } return obj; }
From source file:com.flexdesktop.connections.restfulConnection.java
public static ArrayList<ArrayList<String>> getRESTful(String RESTfull_URL, ArrayList<String> columnasTabla) { try {/* w w w.ja va 2 s . c o m*/ URL url; URLConnection urlConnection; DataInputStream readString; url = new URL(RESTfull_URL); urlConnection = url.openConnection(); urlConnection.setDoInput(true); urlConnection.setUseCaches(false); readString = new DataInputStream(urlConnection.getInputStream()); String s; String getRequest = ""; while ((s = readString.readLine()) != null) { getRequest += s; } readString.close(); if (!"".equals(getRequest)) { return completeArray(getRequest, columnasTabla); } } catch (Exception ex) { Logger.getLogger(com.flexdesktop.connections.restfulConnection.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:io.bibleget.BibleGetI18N.java
/** * * @param s/*from w ww. j ava 2 s .c om*/ * @return */ public static String __(String s) { lcl = BibleGetIO.getLocale(); Locale myLocale; myLocale = new Locale(lcl); try { myResource = ResourceBundle.getBundle("io.bibleget.resources.messages", myLocale); } catch (MissingResourceException ex) { myResource = ResourceBundle.getBundle("io.bibleget.resources.messages"); } if (myResource.containsKey(s)) { try { String val = myResource.getString(s); return new String(val.getBytes("ISO-8859-1"), "UTF-8"); } catch (UnsupportedEncodingException ex) { Logger.getLogger(BibleGetI18N.class.getName()).log(Level.SEVERE, null, ex); } } else { return s; } return null; }
From source file:mp3downloader.ZingSearch.java
public static ArrayList<Song> searchSong(String term) { try {/* w w w . jav a 2 s . co m*/ String content = getSearchResult(term, 0); return readSongsFromContent(content); } catch (Exception ex) { Logger.getLogger(ZingSearch.class.getName()).log(Level.SEVERE, null, ex); } return new ArrayList<Song>(); }
From source file:br.com.ceosites.cachedproperties.cache.test.util.TestUtils.java
public static PropertyCache createDatabasePropertyCache(CustomDatabaseConfiguration dataseConfiguration) { DatabaseBasedConfigurationReaderStrategy readerStrategy = new DatabaseBasedConfigurationReaderStrategy( dataseConfiguration);//from w w w. j av a 2 s .c om PropertyCacheLoader cacheLoader = new PropertyCacheLoader(readerStrategy); PropertyCache cache = null; try { cache = PropertyCacheBuilder.newBuilder().withCacheSize(100L).withIdleTime(2L).withTimeToLive(2L) .loadOnStartup(false).withPropertyCacheLoader(cacheLoader).buildCache(); } catch (Exception ex) { Logger.getLogger(CachedDatabasePropertiesTest.class.getName()).log(Level.SEVERE, null, ex); } return cache; }
From source file:com.smallfe.clerk.util.DigestUtil.java
public static String encryptEGM(String plainText) { StringBuilder cypherText = new StringBuilder(); try {/*from w ww .j av a 2s . c o m*/ plainText = StringUtils.rightPad(plainText, ((plainText.length() - 1) / 3 + 1) * 3, (char) 0); } catch (NullPointerException ex) { Logger.getLogger(DigestUtil.class.getName()).log(Level.SEVERE, null, ex); return null; } for (int i = 0; i < plainText.length(); i += 3) { byte[] partitions = plainText.substring(i, i + 3).getBytes(Charset.forName("iso-8859-9")); int c1 = (int) (partitions[0]); if (c1 < 0) c1 += 256; int c2 = (int) (partitions[1]); if (c2 < 0) c2 += 256; int c3 = (int) (partitions[2]); if (c3 < 0) c3 += 256; int k1 = (c1) / 4; int k2 = (c1) % 4; int k3 = (c2) / 16; int k4 = (c2) % 16; int k5 = (c3) / 64; int k6 = (c3) % 64; char ec1 = decryptionAlphabet.charAt(k1); char ec2 = decryptionAlphabet.charAt(k3 + k2 * 16); char ec3 = decryptionAlphabet.charAt(k5 + k4 * 4); char ec4 = decryptionAlphabet.charAt(k6); cypherText.append(ec1); cypherText.append(ec2); if (c2 != 0) cypherText.append(ec3); if (c3 != 0) cypherText.append(ec4); } return cypherText.toString(); }
From source file:com.itcs.commons.email.impl.NoReplySystemMailSender.java
/** * * @param to//from w w w . j a v a 2s . co m * @param subject * @param body * @param attachments * @throws EmailException */ public static void sendHTML(String to, String subject, String body, List<EmailAttachment> attachments) throws EmailException { try { getExecutorService().execute( new RunnableSendHTMLEmail(getSession(), new String[] { to }, subject, body, attachments)); } catch (NamingException ex) { Logger.getLogger(NoReplySystemMailSender.class.getName()).log(Level.INFO, "el nombre jndi de la session de email esta mal configurado!!", ex); } }
From source file:it_minds.dk.eindberetningmobil_android.server.SafeJsonHelper.java
@Override public JSONObject put(String name, boolean value) { try {//from w w w . j av a 2s . co m return super.put(name, value); } catch (JSONException e) { Logger.getLogger("SafeJsonObject").log(Level.WARNING, "", e); return null; } }