List of usage examples for java.util.logging Level WARNING
Level WARNING
To view the source code for java.util.logging Level WARNING.
Click Source Link
From source file:com.subgraph.vega.internal.crawler.RequestConsumer.java
private boolean sendRequest(CrawlerTask task) { try {/* w w w. ja v a 2 s. c o m*/ activeRequest = task.getRequest(); final IHttpResponse response = requestEngine.sendRequest(task.getRequest()); task.setResponse(response); return response != null; } catch (RequestEngineException e) { if (e.getCause() instanceof InterruptedIOException) { stop = true; return false; } if (e.getMessage().contains("abort")) { return false; } task.setException(e); logger.log(Level.WARNING, e.getMessage()); return false; } finally { synchronized (requestLock) { activeRequest = null; } } }
From source file:com.josue.ws.web.server.MessageDispatcher.java
private void proccessConnectionMessage(MessageRequestWrapper wrapper) throws IOException { NetworkConnection connection = wrapper.getResource(); if (connection.getState() != null) { switch (connection.getState()) { case AFK: break; case CONNECTED_PLAYER: store.put(wrapper.getMap(), wrapper.getSession(), connection.getPlayer()); sendAllExceptSender(wrapper); sendConnectedUsers(wrapper); break; case DISCONNECTED: wrapper.getSession().close(new CloseReason(CloseReason.CloseCodes.NORMAL_CLOSURE, "Player " + wrapper.getSession().getId() + " disconnected")); sendAllExceptSender(wrapper); break; default:/*ww w . j av a2s . c om*/ logger.log(Level.WARNING, "Invalid connection status: {0}", connection.getState()); break; } } }
From source file:com.prowidesoftware.swift.io.parser.XMLParser.java
/** * Given a String containing a message in its WIFE internal XML * representation, returns a SwiftMessage object. * If there is any error during conversion this method returns <code>null</code> * @param xml the string containing the XML to parse * @return the XML parsed into a SwiftMessage object * * @see com.prowidesoftware.swift.io.IConversionService#getMessageFromXML(java.lang.String) *///from w w w. j a v a 2 s. co m public SwiftMessage parse(final String xml) { Validate.notNull(xml); try { final DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); final Document doc = db.parse(new ByteArrayInputStream(xml.getBytes())); return createMessage(doc); } catch (final Exception e) { log.log(Level.WARNING, "Error parsing XML", e); return null; } }
From source file:ch.puzzle.itc.mobiliar.business.shakedown.control.ShakedownTestRunner.java
/** * @param sts// ww w. j av a 2s . c o m * @return */ public TestSet executeShakedownTest(STS sts) { TestSet resultSet; String strcsv = getStrCsv(); ArrayList<Test> otherTests = new ArrayList<Test>(); String bundle; try { bundle = bundleSTM(strcsv, sts.getShakedowntestsAsCSV(), sts); try { List<String> missingSTPs = copySTMtoRemoteServerAndGetMissingSTPs(bundle, sts); if (missingSTPs != null && !missingSTPs.isEmpty()) { for (String missingSTP : missingSTPs) { try { copySTPtoRemoteServer(missingSTP, sts); } catch (ShakedownTestException e) { Test t = new Test(); t.setName(missingSTP); t.setTestStatus(OverallStatus.failed.name()); t.setStdErr(e.getMessage()); log.log(Level.WARNING, "Was not able to copy STP " + missingSTP + " to remote server", e); otherTests.add(t); } } } try { launchTests(bundle, sts); } catch (ShakedownTestException e) { Test launchTestFailure = new Test(); launchTestFailure.setName("General Test Execution"); launchTestFailure.setTestStatus(OverallStatus.failed.name()); launchTestFailure.setStdErr(e.getMessage()); log.log(Level.WARNING, "General Test Execution failed", e); otherTests.add(launchTestFailure); } } catch (ShakedownTestException e1) { Test copySTMFailure = new Test(); copySTMFailure.setName("General Test Execution"); copySTMFailure.setTestStatus(OverallStatus.failed.name()); copySTMFailure.setStdErr(e1.getMessage()); log.log(Level.WARNING, "Was not able to copy STM to remote server", e1); otherTests.add(copySTMFailure); } } catch (ShakedownTestException e) { Test bundleFailure = new Test(); bundleFailure.setName("General Test Execution"); bundleFailure.setTestStatus(OverallStatus.failed.name()); bundleFailure.setStdErr(e.getMessage()); otherTests.add(bundleFailure); log.log(Level.WARNING, "Was not able to bundle STM", e); } String result = null; try { result = analyzeResult(sts); } catch (ShakedownTestException e) { Test resultAnalyzeFailure = new Test(); resultAnalyzeFailure.setName("General Test Execution"); resultAnalyzeFailure.setTestStatus(OverallStatus.failed.name()); resultAnalyzeFailure.setStdErr(e.getMessage()); otherTests.add(resultAnalyzeFailure); log.log(Level.WARNING, "Was not able to analyze results", e); } if (result != null) { resultSet = JAXB.unmarshal(new StringReader(result), TestSet.class); } else { resultSet = new TestSet(); } if (resultSet.getTests() == null) { resultSet.setTests(otherTests); } else { resultSet.getTests().addAll(otherTests); } return resultSet; }
From source file:com.elasticgrid.examples.video.MencoderEncoder.java
public File convertVideo(File original, String destName, String format, int width, int height, Integer start, Integer end, int vbr, int abr, int fps) throws VideoConversionException, InterruptedException { File videoConverted = new File(original.getParent(), destName); logger.log(Level.FINE, "Converting video {0} into {1} as {2} format...", new Object[] { original, videoConverted, format }); String command = String.format("%s %s -ofps %d -of lavf" + " -ovc lavc -lavcopts vcodec=%s:vbitrate=%d:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=%d:%d" + " -oac mp3lame -lameopts cbr:br=%d -srate 22050 -o %s", encoderLocation, original.getAbsolutePath(), fps, format, vbr, width, height, abr, videoConverted.getAbsolutePath()); if (start != null && end != null) command = String.format("%s -ss %d -endpos %d", command, start, end); logger.info("Command is: " + command); // run the external conversion program File log = new File(videoConverted.getParent(), videoConverted.getName().replace(format, "log")); logger.info("Writing output into " + log.getAbsolutePath()); FileWriter fileWriter = null; try {//from www .j av a2 s. c om fileWriter = enableLog ? new FileWriter(log) : null; logger.log(Level.FINEST, "Created log file in {0}", log); } catch (IOException e) { logger.log(Level.WARNING, "Can't open log file. Skipping...", e); fileWriter = null; } try { logger.finest(command); final Writer logWriter = enableLog ? new BufferedWriter(fileWriter) : null; final Process process = Runtime.getRuntime().exec(command); new Thread(new Runnable() { public void run() { try { BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; try { while ((line = reader.readLine()) != null) { if (enableLog) IOUtils.write(line, logWriter); } } finally { reader.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } }).start(); new Thread(new Runnable() { public void run() { try { BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream())); String line; try { while ((line = reader.readLine()) != null) { if (enableLog) IOUtils.write(line, logWriter); } } finally { reader.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } }).start(); process.waitFor(); return videoConverted; } catch (IOException e) { throw new VideoConversionException("Can't run video conversion software", e); } finally { if (enableLog) IOUtils.closeQuietly(fileWriter); } }
From source file:au.com.addstar.SpigetUpdater.java
@Override public void checkForUpdate(UpdateCallback callback) { dispatch(() -> {/*from ww w. j av a2s . c o m*/ HttpURLConnection connection; try { connection = (HttpURLConnection) new URL( String.format(RESOURCE_INFO, resourceId, System.currentTimeMillis())).openConnection(); connection.setRequestProperty("User-Agent", getUserAgent()); JsonObject jsonObject = new JsonParser().parse(new InputStreamReader(connection.getInputStream())) .getAsJsonObject(); latestResourceInfo = new Gson().fromJson(jsonObject, ResourceInfo.class); } catch (Exception e) { log.log(Level.WARNING, "Failed to get resource info from spiget.org:" + resourceId); latestResourceInfo = new ResourceInfo(); latestResourceInfo.latestVersion = new ResourceVersion(); latestResourceInfo.latestVersion.name = "MISSING"; latestResourceInfo.external = false; latestResourceInfo.premium = true; latestResourceInfo.id = resourceId; //callback.updateAvailable(info,"UNAVAILABLE", false); } if (!latestResourceInfo.premium) { try { URL url = new URL(String.format(RESOURCE_VERSION, resourceId)); connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", getUserAgent()); InputStreamReader reader = new InputStreamReader(connection.getInputStream()); JsonElement elem = new JsonParser().parse(reader); JsonObject json = elem.getAsJsonArray().get(0).getAsJsonObject(); latestResourceInfo.latestVersion = new Gson().fromJson(json, ResourceVersion.class); } catch (Exception e) { log.log(Level.WARNING, "Failed to get version info from spiget.org", e); } if (isVersionNewer(currentVersion, latestResourceInfo.latestVersion.name)) { callback.updateAvailable(latestResourceInfo, "https://spigotmc.org/" + latestResourceInfo.file.url, !latestResourceInfo.external); } else { callback.upToDate(); } } else { latestVer = Utilities.readURL("https://api.spigotmc.org/legacy/update.php?resource=" + resourceId); if (isVersionNewer(currentVersion, latestVer)) { if (latestResourceInfo.latestVersion == null) { latestResourceInfo.latestVersion = new ResourceVersion(); } latestResourceInfo.latestVersion.name = latestVer; latestResourceInfo.latestVersion.id = resourceId; callback.updateAvailable(latestResourceInfo, "https://spigotmc.org/" + latestResourceInfo.file.url, !latestResourceInfo.external); } else { callback.upToDate(); } } }); }
From source file:com.baystep.jukeberry.JsonConfiguration.java
public void load(String fileName) { BerryLogger.LOG.info("Loading configuration file..."); File configFile = new File(fileName); if (configFile.exists()) { JSONParser jparser = new JSONParser(); try {/*from w w w.j a v a2s. c o m*/ Object obj = jparser.parse(new FileReader(configFile)); jsonConfig = (JSONObject) obj; if (jsonConfig.containsKey("disable")) { String dOpt = (String) jsonConfig.get("disable"); setDisableOption(dOpt); } if (jsonConfig.containsKey("http server")) { JSONObject httpObj = (JSONObject) jsonConfig.get("http server"); if (httpObj.containsKey("port")) httpPort = getInt(httpObj, "port"); } if (jsonConfig.containsKey("websocket server")) { JSONObject wsObj = (JSONObject) jsonConfig.get("websocket server"); if (wsObj.containsKey("port")) websocketPort = getInt(wsObj, "port"); } if (jsonConfig.containsKey("music player")) { JSONObject mpObj = (JSONObject) jsonConfig.get("music player"); if (mpObj.containsKey("start service")) { mpStartService = (String) mpObj.get("start service"); } if (mpObj.containsKey("local directories")) { mpDirectories = getStringArray(mpObj, "local directories"); } if (mpObj.containsKey("sources")) { mpSources = getSourceDescriptionArray(mpObj, "sources"); } } } catch (IOException | org.json.simple.parser.ParseException ex) { BerryLogger.LOG.log(Level.WARNING, "Failed to parse configuration file: {0}", ex.getMessage()); } } else { BerryLogger.LOG.warning("Failed to load the configuration file!"); } }
From source file:rtdc.android.impl.AndroidHttpRequest.java
/** * {@inheritDoc}/* w ww . j av a2s . co m*/ */ @Override public void execute(final AsyncCallback<HttpResponse> callback) { Response.Listener listener = new Response.Listener<String>() { @Override public void onResponse(String response) { logger.log(Level.WARNING, response); callback.onSuccess(new AndroidHttpResponse(200, response)); } }; Response.ErrorListener errorListener = new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { callback.onError(": server request timed out!"); error.printStackTrace(); } }; //Format the parameters List<BasicNameValuePair> paramsAsValuePairs = new LinkedList<BasicNameValuePair>(); for (Map.Entry<String, String> param : params.entrySet()) paramsAsValuePairs.add(new BasicNameValuePair(param.getKey(), param.getValue())); if (requestMethod == 0) url += "?" + URLEncodedUtils.format(paramsAsValuePairs, "UTF-8"); else requestBody = URLEncodedUtils.format(paramsAsValuePairs, "UTF-8"); JsonObjectRequest request = new JsonObjectRequest(requestMethod, url, listener, errorListener); StringBuilder sb = new StringBuilder("Sending at " + url + " -- " + requestMethod + " body:"); for (Map.Entry<String, String> entry : request.getParams().entrySet()) sb.append("\n\t").append(entry.getKey()).append(":").append(entry.getValue()); logger.log(Level.INFO, sb.toString()); getRequestQueue().add(request); }
From source file:com.neophob.sematrix.output.ArtnetDevice.java
/** * /*ww w .ja v a 2 s . c o m*/ * @param controller */ public ArtnetDevice(ApplicationConfigurationHelper ph, PixelControllerOutput controller) { super(OutputDeviceEnum.ARTNET, ph, controller, 8); this.initialized = false; this.artnet = new ArtNet(); try { this.pixelsPerUniverse = ph.getArtNetPixelsPerUniverse(); this.targetAdress = InetAddress.getByName(ph.getArtNetIp()); this.firstUniverseId = ph.getArtNetStartUniverseId(); String broadcastAddr = ph.getArtNetBroadcastAddr(); if (StringUtils.isBlank(broadcastAddr)) { broadcastAddr = ArtNetServer.DEFAULT_BROADCAST_IP; } LOG.log(Level.INFO, "Initialize ArtNet device IP: {0}, broadcast IP: {1}, Port: {2}", new Object[] { this.targetAdress.toString(), broadcastAddr, ArtNetServer.DEFAULT_PORT }); this.artnet.init(); this.artnet.setBroadCastAddress(broadcastAddr); this.artnet.start(); this.artnet.getNodeDiscovery().addListener(this); this.artnet.startNodeDiscovery(); //check how many universe we need this.nrOfUniverse = 1; int bufferSize = xResolution * yResolution; if (bufferSize > pixelsPerUniverse) { while (bufferSize > pixelsPerUniverse) { this.nrOfUniverse++; bufferSize -= pixelsPerUniverse; } } this.initialized = true; LOG.log(Level.INFO, "ArtNet device initialized using {0} universe with {1} pixels.", new Object[] { this.nrOfUniverse, this.pixelsPerUniverse }); } catch (BindException e) { LOG.log(Level.WARNING, "\nFailed to initialize ArtNet device:", e); LOG.log(Level.WARNING, "Make sure no ArtNet Tools like DMX-Workshop are running!\n\n"); } catch (Exception e) { LOG.log(Level.WARNING, "Failed to initialize ArtNet device:", e); } }
From source file:gov.nrel.bacnet.consumer.BACnet.java
public BACnet(Config t_config) { config = t_config;//w w w . java2 s .co m tracker = new TaskTracker(); localDevice = null; logHandler = null; try { logger.info("starting. Loading logging.properties first to log to a file in logs directory"); FileInputStream configFile = new FileInputStream(config.getLoggingPropertiesFileName()); LogManager.getLogManager().readConfiguration(configFile); if (config.getVerboseLogging()) { logger.setLevel(Level.INFO); } if (config.getVeryVerboseLogging()) { logger.setLevel(Level.ALL); } logger.info("Starting now that logger properties are loaded"); LocalDevice.setExceptionListener(new MyExceptionListener()); initialize(config); } catch (Throwable e) { logger.log(Level.WARNING, "exception starting", e); } }