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:net.daboross.bukkitdev.skywars.world.providers.ProtobufStorageProvider.java
@Override public void loadArena(final SkyArenaConfig arena, final boolean forceReload) throws IOException { if (forceReload || cache.containsKey(arena.getArenaName())) { plugin.getLogger().log(Level.WARNING, "Updating arena blocks cache for arena ''{0}''.", arena.getArenaName());/*from w w w . ja v a 2s . c o m*/ } boolean createdNewCache = false; Path cachePath = plugin.getArenaPath().resolve(arena.getArenaName() + ".blocks"); BlockStorage.BlockArea area = null; if (!forceReload) { try (InputStream inputStream = new FileInputStream(cachePath.toFile())) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(inputStream)) { area = BlockStorage.BlockArea.parseFrom(gzipInputStream); } } catch (FileNotFoundException ignored) { } } if (area == null) { try { area = createCache(arena); createdNewCache = true; } catch (IllegalStateException ex1) { if (ex1.getMessage().contains("Origin location not listed in configuration")) { try (InputStream inputStream = plugin .getResourceAsStream("arenas/" + arena.getArenaName() + ".blocks")) { try (GZIPInputStream gzipInputStream = new GZIPInputStream(inputStream)) { area = BlockStorage.BlockArea.parseFrom(gzipInputStream); } plugin.getLogger().log(Level.INFO, "Loaded pre-built blocks cache file for arena {0}.", arena.getArenaName()); } catch (FileNotFoundException ex) { throw new IOException( "No origin listed in configuration, but no blocks file found in SkyWars jar file either!", ex); } } else { throw ex1; } } try (OutputStream outputStream = new FileOutputStream(cachePath.toFile())) { try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(outputStream)) { area.writeTo(gzipOutputStream); } } } // We turn the BlockStorage.BlockArea into a StoredBlockArea here, not above, because StoredBlockArea can't write to a file. MemoryBlockArea memoryBlockArea = new MemoryBlockArea(area); if (createdNewCache || arena.getChestConfiguration() == null) { loadChests(arena, memoryBlockArea); } cache.put(arena.getArenaName(), memoryBlockArea); }
From source file:com.bigtobster.pgnextractalt.chess.ChessIO.java
/** * Writes the currently imported games to a PGN file * * @param printWriter The printWriter with the bundled file to write to *//*w w w.j a va 2 s . co m*/ public void exportPGN(final PrintWriter printWriter) { final PGNWriter pgnWriter = new PGNWriter(printWriter); for (final Game game : this.chessContext.getGames()) { //noinspection ProhibitedExceptionCaught try { pgnWriter.write(game.getModel()); } catch (final NullPointerException ignored) { /* Bit of a Chesspresso weird-ism here It tries super hard to import games - whether they are sane or not In theory, the same issue applies when modifying games - you could "corrupt" them Consequently, when you try to do something to, in this case export, those games, you end up with errors. Those errors aren't fluffy and nice - they're NPEs... As a rule, GIGO applies. This is fundamentally an issue with Chesspresso that needs fixing at the Chesspresso level. */ ChessIO.LOGGER.log(Level.WARNING, ChessIO.FAILED_TO_EXPORT_INVALID_GAME); ChessIO.LOGGER.log(Level.WARNING, game.toString()); } } /* Another Chesspresso weird-ism It seems that PGNWriter does not flush the the printWriter If you don't do the below, you have missing data on export! */ if (printWriter != null) { printWriter.flush(); printWriter.close(); } }
From source file:com.archivas.clienttools.arcutils.impl.adapter.HCAPNullAdapter.java
public void writeObjectFromStream(final String targetPath, final InputStream is, final FileMetadata ingestionMetadata) throws StorageAdapterException { try {/* w ww . ja va 2 s . c om*/ Thread.sleep(sleepTimeMs); } catch (InterruptedException e) { LOG.log(Level.WARNING, e.toString(), e); } }
From source file:com.ajah.http.Http.java
/** * Calls {@link #get(URI)} but returns null instead of throwing exceptions. * // w w w. ja v a2s .c o m * @param uri * The URL to fetch. * @return The response as a String, or null. */ public static String getSafe(final String uri) { try { return get(uri); } catch (final IOException e) { log.log(Level.WARNING, e.getMessage(), e); return null; } catch (final HttpException e) { log.log(Level.WARNING, e.getMessage(), e); return null; } }
From source file:com.nebel_tv.content.wrapper.builders.MediasBuilder.java
private void createMediaItems() { if (items == null) { return;/*from ww w . j a v a 2s . com*/ } for (int i = 0; i < items.length(); i++) { try { JSONObject item = items.getJSONObject(i); if (item != null) { int id = item.getInt("Publishedid"); MediaItemCache.addItem(String.valueOf(id), item); } } catch (JSONException ex) { Logger.getLogger(MediasBuilder.class.getName()).log(Level.WARNING, null, ex); } } }
From source file:cz.incad.kramerius.virtualcollections.VirtualCollectionsManager.java
public static VirtualCollection doVC(String pid, FedoraAccess fedoraAccess, ArrayList<String> languages) { try {//ww w .j a v a 2 s . c o m String xPathStr; XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr; ArrayList<String> langs = new ArrayList<String>(); if (languages == null || languages.isEmpty()) { String[] ls = KConfiguration.getInstance().getPropertyList("interface.languages"); for (int i = 0; i < ls.length; i++) { String lang = ls[++i]; langs.add(lang); } } else { langs = new ArrayList<String>(languages); } String name = ""; boolean canLeave = true; fedoraAccess.getDC(pid); Document doc = fedoraAccess.getDC(pid); xPathStr = "//dc:title/text()"; expr = xpath.compile(xPathStr); Node node = (Node) expr.evaluate(doc, XPathConstants.NODE); if (node != null) { name = StringEscapeUtils.escapeXml(node.getNodeValue()); } xPathStr = "//dc:type/text()"; expr = xpath.compile(xPathStr); node = (Node) expr.evaluate(doc, XPathConstants.NODE); if (node != null) { canLeave = Boolean.parseBoolean(StringEscapeUtils.escapeXml(node.getNodeValue())); } VirtualCollection vc = new VirtualCollection(name, pid, canLeave); for (String lang : langs) { String dsName = TEXT_DS_PREFIX + lang; String value = IOUtils.readAsString(fedoraAccess.getDataStream(pid, dsName), Charset.forName("UTF8"), true); vc.addDescription(lang, value); } return vc; } catch (Exception vcex) { logger.log(Level.WARNING, "Could not get virtual collection for " + pid + ": " + vcex.toString()); return null; } }
From source file:com.sifiso.dvs.util.PhotoUtil.java
public ResponseDTO downloadPhotos(HttpServletRequest request, PlatformUtil platformUtil) throws FileUploadException { logger.log(Level.INFO, "######### starting PHOTO DOWNLOAD process\n\n"); ResponseDTO resp = new ResponseDTO(); InputStream stream = null;// www.j a v a2 s . c om File rootDir; try { rootDir = dvsProperties.getImageDir(); logger.log(Level.INFO, "rootDir - {0}", rootDir.getAbsolutePath()); if (!rootDir.exists()) { rootDir.mkdir(); } } catch (Exception ex) { logger.log(Level.SEVERE, "Properties file problem", ex); resp.setMessage("Server file unavailable. Please try later"); resp.setStatusCode(114); return resp; } PhotoUploadDTO dto = null; Gson gson = new Gson(); File doctorFileDir = null, surgeryDir = null; try { ServletFileUpload upload = new ServletFileUpload(); FileItemIterator iter = upload.getItemIterator(request); while (iter.hasNext()) { FileItemStream item = iter.next(); String name = item.getFieldName(); stream = item.openStream(); if (item.isFormField()) { if (name.equalsIgnoreCase("JSON")) { String json = Streams.asString(stream); if (json != null) { logger.log(Level.INFO, "picture with associated json: {0}", json); dto = gson.fromJson(json, PhotoUploadDTO.class); if (dto != null) { surgeryDir = createSurgeryFileDirectory(rootDir, surgeryDir, dto.getSurgeryID()); if (dto.getDoctorID() > 0) { doctorFileDir = createDoctorDirectory(surgeryDir, doctorFileDir, dto.getDoctorID()); } } } else { logger.log(Level.WARNING, "JSON input seems pretty fucked up! is NULL.."); } } } else { File imageFile = null; if (dto == null) { continue; } DateTime dt = new DateTime(); String fileName = ""; if (dto.isIsFullPicture()) { fileName = "f" + dt.getMillis() + ".jpg"; } else { fileName = "t" + dt.getMillis() + ".jpg"; } if (dto.getPatientfileID() != null) { if (dto.isIsFullPicture()) { fileName = "f" + dto.getPatientfileID() + ".jpg"; } else { fileName = "t" + dto.getPatientfileID() + ".jpg"; } } // switch (dto.getPictureType()) { case PhotoUploadDTO.FILES_DOCTOR: imageFile = new File(doctorFileDir, fileName); break; case PhotoUploadDTO.FILES_SURGERY: imageFile = new File(surgeryDir, fileName); } writeFile(stream, imageFile); resp.setStatusCode(0); resp.setMessage("Photo downloaded from mobile app "); //add database System.out.println("filepath: " + imageFile.getAbsolutePath()); //create uri /*int index = imageFile.getAbsolutePath().indexOf("monitor_images"); if (index > -1) { String uri = imageFile.getAbsolutePath().substring(index); System.out.println("uri: " + uri); dto.setUri(uri); } dto.setDateUploaded(new Date()); if (dto.isIsFullPicture()) { dto.setThumbFlag(null); } else { dto.setThumbFlag(1); } dataUtil.addPhotoUpload(dto);*/ } } } catch (FileUploadException | IOException | JsonSyntaxException ex) { logger.log(Level.SEVERE, "Servlet failed on IOException, images NOT uploaded", ex); throw new FileUploadException(); } return resp; }
From source file:adalid.jaas.google.GoogleRecaptcha.java
private static String secretKey() { logger.log(Level.INFO, VALIDATOR_KEY + " = {0}", GoogleRecaptcha.class.getName()); String secretKey = System.getProperties().getProperty(SECRET_KEY_PROPERTY_KEY); if (secretKey == null || secretKey.isEmpty()) { String path = secretKeyFilePath(); File file = new File(path); if (file.isFile()) { logger.log(TRACE, SECRET_KEY_FILE_PROPERTY_KEY + " = {0}", path); try { secretKey = new Scanner(file).useDelimiter("\\Z").next(); } catch (FileNotFoundException ex) { logger.log(Level.WARNING, SECRET_KEY_FILE_PROPERTY_KEY + " {0} is missing", path); }//www.j av a 2s. c o m } else { logger.log(Level.WARNING, SECRET_KEY_FILE_PROPERTY_KEY + " {0} is missing or invalid", path); } } if (secretKey == null || secretKey.isEmpty()) { logger.log(Level.WARNING, MISSING_SECRET_KEY); return DEFAULT_SECRET_KEY; } return secretKey; }
From source file:net.daboross.bukkitdev.skywars.storage.LocationStore.java
private void load() throws SkyConfigurationException { if (configFile == null) { configFile = plugin.getDataFolder().toPath().resolve("locations.yml"); }// w w w .j av a 2 s .co m storage = YamlConfiguration.loadConfiguration(configFile.toFile()); int configVersion = storage.getInt("storage-specification-version"); if (configVersion > 1) { throw new SkyConfigurationException( "Unknown configuration version for locations.yml. Did you downgrade? If so, delete or move locations.yml to reset."); } Object lobbyO = storage.get("lobby"); if (lobbyO != null) { if (lobbyO instanceof SkyBlockLocation) { lobbyPosition = new SkyPlayerLocation((SkyBlockLocation) lobbyO); } else if (lobbyO instanceof SkyPlayerLocation) { lobbyPosition = (SkyPlayerLocation) lobbyO; } else { plugin.getLogger().log(Level.WARNING, "Expected SkyBlockLocation, found {} as lobby in {}! Removing item from config file.", new Object[] { lobbyO, configFile }); } } else { List<World> worlds = Bukkit.getWorlds(); if (worlds.isEmpty()) { lobbyPosition = null; } else { Location spawn = worlds.get(0).getSpawnLocation(); lobbyPosition = new SkyPlayerLocation(spawn); } } List<?> portalList = storage.getList("portals"); if (portalList != null) { for (Object obj : portalList) { if (obj instanceof SkyBlockLocation) { portals.add((SkyBlockLocation) obj); } else { plugin.getLogger().log(Level.WARNING, "Expected SkyBlockLocation, found {} in portals list in {}! Removing item from config file.", new Object[] { obj, configFile }); } } } List<?> signList = storage.getList("signs"); if (signList != null) { for (Object object : signList) { if (object instanceof SkyBlockLocation) { signs.add((SkyBlockLocation) object); } else { plugin.getLogger().log(Level.WARNING, "Expected SkyBlockLocation, found {} in signs list in {}! Removing item from config file.", new Object[] { object, configFile }); } } } }
From source file:hudson.plugins.sauce_ondemand.SauceOnDemandReportPublisher.java
@Override public SauceOnDemandReportFactory getTestData(AbstractBuild<?, ?> build, Launcher launcher, BuildListener buildListener, TestResult testResult) throws IOException, InterruptedException { buildListener.getLogger().println("Scanning for Sauce OnDemand test data..."); List<String> lines = IOUtils.readLines(build.getLogReader()); String[] array = lines.toArray(new String[lines.size()]); List<String[]> sessionIDs = new ArrayList<String[]>(); List<CaseResult> caseResults = new ArrayList<CaseResult>(); for (SuiteResult sr : testResult.getSuites()) { for (CaseResult cr : sr.getCases()) { caseResults.add(cr);//from ww w.j av a 2 s .co m sessionIDs.addAll(SauceOnDemandReportFactory.findSessionIDs(cr, cr.getStdout(), cr.getStderr())); } } if (sessionIDs.isEmpty()) { sessionIDs.addAll(SauceOnDemandReportFactory.findSessionIDsForCaseResults(caseResults, array)); } SauceOnDemandBuildAction buildAction = getBuildAction(build); if (buildAction == null) { logger.log(Level.WARNING, "Unable to retrieve Sauce Build Action for build: " + build.toString()); buildListener.getLogger().println("Unable to retrieve the Sauce Build Action, attempting to continue"); } else { SauceREST sauceREST = new JenkinsSauceREST(buildAction.getUsername(), buildAction.getAccessKey()); for (String[] id : sessionIDs) { try { String json = sauceREST.getJobInfo(id[0]); JSONObject jsonObject = new JSONObject(json); Map<String, Object> updates = new HashMap<String, Object>(); //only store passed/name values if they haven't already been set if (jsonObject.get("passed").equals(JSONObject.NULL) && id.length == 3) { updates.put("passed", id[2]); } if (jsonObject.get("name").equals(JSONObject.NULL)) { updates.put("name", id[1]); } if (jsonObject.get("build").equals(JSONObject.NULL)) { String buildNumber = SauceOnDemandBuildWrapper.sanitiseBuildNumber(build.toString()); if (build instanceof MavenBuild) { //try the parent buildNumber = SauceOnDemandBuildWrapper .sanitiseBuildNumber(((MavenBuild) build).getParentBuild().toString()); } updates.put("build", buildNumber); } if (!updates.isEmpty()) { sauceREST.updateJobInfo(id[0], updates); } } catch (JSONException e) { buildListener.error("Error while updating job " + id[0] + " message: " + e.getMessage()); } } } buildListener.getLogger().println("Finished scanning for Sauce OnDemand test data..."); if (sessionIDs.isEmpty()) { buildListener.getLogger().println( "The Sauce OnDemand plugin is configured, but no session IDs were found in the test output."); return null; } else { return SauceOnDemandReportFactory.INSTANCE; } }