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:it.geosolutions.geoserver.jms.JMSManager.java
/** * Method to make lookup using the type of the passed eventType. * //from w w w . ja v a2 s. com * @param <S> * @param <O> * @param eventType * @return the handler * @throws IllegalArgumentException */ public <S extends Serializable, O> JMSEventHandler<S, O> getHandler(final O eventType) throws IllegalArgumentException { final Set<?> beanSet = beans.entrySet(); // declare a tree set to define the handler priority final Set<JMSEventHandlerSPI<S, O>> candidates = new TreeSet<JMSEventHandlerSPI<S, O>>( new Comparator<JMSEventHandlerSPI<S, O>>() { @Override public int compare(JMSEventHandlerSPI<S, O> o1, JMSEventHandlerSPI<S, O> o2) { if (o1.getPriority() < o2.getPriority()) return -1; else if (o1.getPriority() == o2.getPriority()) { return 0; // } else if (o1.getPriority()>o2.getPriority()){ } else { return 1; } } }); // for each handler check if it 'canHandle' the incoming object if so // add it to the tree for (final Iterator<?> it = beanSet.iterator(); it.hasNext();) { final Map.Entry<String, ?> entry = (Entry<String, ?>) it.next(); final JMSEventHandlerSPI<S, O> spi = (JMSEventHandlerSPI) entry.getValue(); if (spi != null) { if (spi.canHandle(eventType)) { if (LOGGER.isLoggable(Level.INFO)) LOGGER.info("Creating an instance of: " + spi.getClass()); candidates.add(spi); } } } // TODO return the entire tree leaving choice to the caller (useful to // build a failover list) // return the first available handler final Iterator<JMSEventHandlerSPI<S, O>> it = candidates.iterator(); while (it.hasNext()) { try { final JMSEventHandler<S, O> handler = it.next().createHandler(); if (handler != null) return handler; } catch (Exception e) { if (LOGGER.isLoggable(Level.WARNING)) LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); } } final String message = "Unable to find the needed Handler SPI for event of type: " + eventType.getClass().getCanonicalName(); if (LOGGER.isLoggable(Level.WARNING)) LOGGER.warning(message); throw new IllegalArgumentException(message); }
From source file:com.golemgame.functional.component.BFunctionApplier.java
@Override public float generateSignal(float time) { if (this.switchActive && this.switchType == ModifierSwitchType.Pause && this.hasHoldValue) return this.holdValue; else if ((!this.switchActive) && this.switchType == ModifierSwitchType.Pause) { holdValue = 0;//from w w w. java 2 s . c o m this.hasHoldValue = false; } if ((!this.switchActive) && (this.switchType == ModifierSwitchType.On)) { state = 0;//clear state return 0; } float output = 0; try { //a null pointer here is tied to physics not deleting... output = settings.clampY( (float) function.value(settings.clampX(state / settings.getScaleX())) * settings.getScaleY()); } catch (FunctionEvaluationException e) { StateManager.getLogger().log(Level.WARNING, e.getStackTrace().toString()); //send no signal on error } if (this.switchType == ModifierSwitchType.Invert && this.switchActive) output = -output; else if (this.switchType == ModifierSwitchType.Multiply)//doesnt care if the switch is active output *= this.switchValue; else if (this.switchActive && this.switchType == ModifierSwitchType.Pause) { this.holdValue = output; this.hasHoldValue = true; } state = 0; return output; }
From source file:org.tomitribe.tribestream.registryng.service.serialization.CustomJacksonJaxbJsonProvider.java
@Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { try {//w w w.jav a 2 s . c o m return super.isWriteable(type, genericType, annotations, mediaType); } catch (Exception e) { LOGGER.log(Level.WARNING, "Checking if entity is writable failed!", e); throw new RuntimeException(e); } }
From source file:ijfx.core.icon.DefaultFXIconService.java
@Override public Node getIconAsNode(String iconPath) { if (iconPath == null) { return null; }//from w ww . j a va 2s. c o m if ("".equals(iconPath)) { return null; } if (fontawesomeIconEquivalent.containsKey(iconPath)) { return getIconAsNode(fontawesomeIconEquivalent.get(iconPath)); } else if (iconPath.startsWith("fa:")) { try { return new FontAwesomeIconView(getIcon(iconPath)); } catch (Exception e) { logger.log(Level.WARNING, String.format("Couldn't load FA icon : %s", iconPath.substring(3).toUpperCase())); return new FontAwesomeIconView(FontAwesomeIcon.REMOVE); } } else { ImageView imageView = new ImageView(iconPath); imageView.getStyleClass().add("image-icon"); return imageView; } }
From source file:me.ryvix.claimcommands.functions.FlagsFunctions.java
/** * List flags// w w w .java 2 s.co m * * @param loc * @return */ public String list(Location loc) { List<String> flags; String output; try { flags = sql.select(plugin.getCcClaim().getGPClaimId(loc)); if (flags.size() > 0) { // show only one allow and deny List<String> newflags = new ArrayList<>(); boolean allow = false; boolean deny = false; for (String flag : flags) { if (flag.equals("allow")) { if (!allow) { allow = true; } else { continue; } } if (flag.equals("deny")) { if (!deny) { deny = true; } else { continue; } } newflags.add(flag); } output = StringUtils.join(newflags, ", "); output = ChatColor.GREEN + "Flags: " + ChatColor.GOLD + output; } else { output = ChatColor.RED + "No flags found."; } } catch (SQLException e) { plugin.getLogger().log(Level.WARNING, "Error: {0}", e.getMessage()); return ChatColor.RED + "Sorry, there was an error retrieving flags for this claim."; } return output; }
From source file:jenkins.branch.WorkspaceLocatorImpl.java
@Override public FilePath locate(TopLevelItem item, Node node) { if (PATH_MAX == 0) { return null; }/*from ww w . jav a2 s . co m*/ if (!(item.getParent() instanceof MultiBranchProject)) { return null; } String minimized = minimize(item.getFullName()); if (node instanceof Jenkins) { String workspaceDir = ((Jenkins) node).getRawWorkspaceDir(); if (!workspaceDir.contains("ITEM_FULL")) { LOGGER.log(Level.WARNING, "JENKINS-34564 path sanitization ineffective when using legacy Workspace Root Directory {0}; switch to $'{'JENKINS_HOME'}'/workspace/$'{'ITEM_FULLNAME'}' as in JENKINS-8446 / JENKINS-21942", workspaceDir); } return new FilePath( new File(expandVariablesForDirectory(workspaceDir, minimized, item.getRootDir().getPath()))); } else if (node instanceof Slave) { FilePath root = ((Slave) node).getWorkspaceRoot(); return root != null ? root.child(minimized) : null; } else { // ? return null; } }
From source file:net.daboross.bukkitdev.skywars.world.WorldUnzipper.java
public void doWorldUnzip(Logger logger) throws StartupFailedException { Validate.notNull(logger, "Logger cannot be null"); Path outputDir = Bukkit.getWorldContainer().toPath().resolve(Statics.BASE_WORLD_NAME); if (Files.exists(outputDir)) { return;/* w w w . j a v a 2 s. c o m*/ } try { Files.createDirectories(outputDir); } catch (IOException e) { throw new StartupFailedException("Couldn't create directory " + outputDir.toAbsolutePath() + "."); } InputStream fis = WorldUnzipper.class.getResourceAsStream(Statics.ZIP_FILE_PATH); if (fis == null) { throw new StartupFailedException("Couldn't get resource.\nError creating world. Please delete " + Statics.BASE_WORLD_NAME + " and restart server."); } try { try (ZipInputStream zis = new ZipInputStream(fis)) { ZipEntry ze = zis.getNextEntry(); while (ze != null) { String fileName = ze.getName(); Path newFile = outputDir.resolve(fileName); Path parent = newFile.getParent(); if (parent != null) { Files.createDirectories(parent); } if (ze.isDirectory()) { logger.log(Level.FINER, "Making dir {0}", newFile); Files.createDirectories(newFile); } else if (Files.exists(newFile)) { logger.log(Level.FINER, "Already exists {0}", newFile); } else { logger.log(Level.FINER, "Copying {0}", newFile); try (FileOutputStream fos = new FileOutputStream(newFile.toFile())) { try { int next; while ((next = zis.read()) != -1) { fos.write(next); } fos.flush(); } catch (IOException ex) { logger.log(Level.WARNING, "Error copying file from zip", ex); throw new StartupFailedException("Error creating world. Please delete " + Statics.BASE_WORLD_NAME + " and restart server."); } fos.close(); } } try { ze = zis.getNextEntry(); } catch (IOException ex) { throw new StartupFailedException( "Error getting next zip entry\nError creating world. Please delete " + Statics.BASE_WORLD_NAME + " and restart server.", ex); } } } } catch (IOException | RuntimeException ex) { throw new StartupFailedException( "\nError unzipping world. Please delete " + Statics.BASE_WORLD_NAME + " and restart server.", ex); } }
From source file:name.richardson.james.bukkit.utilities.persistence.configuration.AbstractConfiguration.java
protected final void load() throws IOException { logger.log(Level.CONFIG, "Loading configuration: " + this.getClass().getSimpleName()); logger.log(Level.CONFIG, "Using path: " + this.file.getAbsolutePath()); if (!this.file.exists() || this.file.length() == 0) { this.defaults.options().copyHeader(true); this.defaults.options().copyDefaults(true); logger.log(Level.WARNING, localisation.getMessage("saving-default-configuration", this.file.getName())); defaults.save(this.file); }/* w w w . ja v a2s . c o m*/ this.configuration = YamlConfiguration.loadConfiguration(this.file); if (runtimeDefaults) this.configuration.setDefaults(this.defaults); this.configuration.options().copyDefaults(false); }
From source file:net.morematerials.cmds.SMExecutor.java
@SuppressWarnings("unchecked") public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (args.length == 0) { sender.sendMessage(MainManager.getUtils() .getMessage("This server is running " + this.plugin.getDescription().getName() + " " + "v" + plugin.getDescription().getVersion() + "! " + "Credits to " + StringUtils.join(this.plugin.getDescription().getAuthors(), ", ") + "!")); return true; }/*from w ww .j a va2s . c o m*/ // Help parameter. if (args[0].equalsIgnoreCase("?") || args[0].equalsIgnoreCase("help")) { // Someone specified the command to get help for. if (args.length > 1) { Map<String, Object> commands = (HashMap<String, Object>) this.plugin.getDescription().getCommands() .values(); if (!commands.containsKey(args[1])) { return false; } sender.sendMessage(MainManager.getUtils().getMessage("Help page for /" + args[1], Level.SEVERE)); sender.sendMessage(MainManager.getUtils().getMessage("---------------------------------")); String commandInfo = (String) ((HashMap<String, Object>) commands.get(args[1])).get("usage"); for (String usage : StringUtils.split(commandInfo, "\n")) { usage = usage.replaceAll("<command>", args[1] + ChatColor.GOLD); sender.sendMessage(MainManager.getUtils().getMessage(usage, Level.WARNING)); } // Someone wants to see all commands. } else { sender.sendMessage(MainManager.getUtils().getMessage("Help page", Level.SEVERE)); sender.sendMessage(MainManager.getUtils().getMessage("---------------------------------")); // Getting commands from plugin.yml // TODO unsafe cast warning remove HashMap<String, Object> commands = (HashMap<String, Object>) this.plugin.getDescription() .getCommands().values(); for (String commandsEntry : commands.keySet()) { // TODO unsafe cast warning remove HashMap<String, Object> commandInfo = (HashMap<String, Object>) commands.get(commandsEntry); sender.sendMessage(MainManager.getUtils().getMessage( "/" + commandsEntry + " -> " + ChatColor.GOLD + commandInfo.get("description"), Level.WARNING)); } } } // This is some kind of weird command - do we actualy need it? if (args[0].equalsIgnoreCase("fixme")) { if (!(sender instanceof Player)) { return false; } Player player = (Player) sender; SpoutItemStack itemStack = new SpoutItemStack(player.getItemInHand()); player.sendMessage(MainManager.getUtils() .getMessage("The item in your hand is custom: " + itemStack.isCustomItem())); player.sendMessage( MainManager.getUtils().getMessage("It's called " + itemStack.getMaterial().getName() + "!")); } return true; }