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.webpagebytes.cms.template.FreeMarkerImageDirective.java
public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { // Check if no parameters were given: if (body != null) throw new TemplateModelException("WBFreeMarkerModuleDirective does not suport directive body"); String externalKey = null;/*from w w w .j a va 2 s. co m*/ if (params.containsKey("externalKey")) { externalKey = (String) DeepUnwrap.unwrap((TemplateModel) params.get("externalKey")); } else { throw new TemplateModelException("No external key for image directive"); } boolean embedded = false; if (params.containsKey("embedded")) { String embeddedStr = (String) DeepUnwrap.unwrap((TemplateModel) params.get("embedded")); embedded = embeddedStr.toLowerCase().equals("true"); } try { String serveUrl = ""; WPBFile file = cacheInstances.getFilesCache().getByExternalKey(externalKey); if (file == null) { log.log(Level.WARNING, "cannot find iamge with key" + externalKey); return; } WPBFilePath cloudFile = new WPBFilePath("public", file.getBlobKey()); if (!embedded) { serveUrl = cloudFileStorage.getPublicFileUrl(cloudFile); env.getOut().write(serveUrl); } else { InputStream is = null; ByteArrayOutputStream baos = null; try { is = cloudFileStorage.getFileContent(cloudFile); baos = new ByteArrayOutputStream(4046); IOUtils.copy(is, baos); String base64 = CmsBase64Utility.toBase64(baos.toByteArray()); String htmlImage = String.format("data:%s;base64,%s", file.getAdjustedContentType(), base64); env.getOut().write(htmlImage); } catch (IOException e) { log.log(Level.SEVERE, "Error when generating base64 image for " + externalKey); throw e; } finally { IOUtils.closeQuietly(is); IOUtils.closeQuietly(baos); } } } catch (WPBIOException e) { log.log(Level.SEVERE, "ERROR: ", e); throw new TemplateModelException("WBFreeMarkerModuleDirective IO exception when reading image"); } }
From source file:com.google.enterprise.connector.encryptpassword.EncryptPassword.java
@Override protected void initStandAloneContext(boolean ignored) { // Turn down the logging output to the console. Logger.getLogger("com.google.enterprise.connector").setLevel(Level.WARNING); // Find the Connector Manager WEB-INF directory. File webInfDir = locateWebInf(); if (webInfDir == null) { System.err.println("Unable to locate the connector-manager webapp directory."); System.err.println("Try changing to that directory, or use"); System.err.println("-Dmanager.dir=/path/to/webapps/connector-manager"); System.exit(-1);// w w w. j a va 2 s . c o m } // Establish the webapp keystore configuration before initializing // the Context. try { configureCryptor(webInfDir); } catch (IOException e) { System.err.println("Failed to read keystore configuration: " + e); System.exit(-1); } }
From source file:com.bluexml.side.integration.standalone.GenerateModelHelper.java
/** * Gets an {@link Application} from a given {@link IFile} that has to target a valid * {@link Application} model file.//from www .j a v a 2 s. c o m * * @param applicationIFile * @param updateApplication * @return */ public static Application getApplication(IFile applicationIFile, boolean updateApplication) { Application application = ModelInitializationUtils.getCheckedEObject(applicationIFile, Application.class); // Try to update application file if possible if (updateApplication) { LOGGER.finest("Trying to update application file"); try { ApplicationUtil.updateApplicationFromExtensionPoint(application, applicationIFile); } catch (Exception e) { LOGGER.log(Level.WARNING, String.format("Cannot update Application from file '%s' because of an unexpected Exception", applicationIFile.getName()), e); } } LOGGER.finer("Application static-parameters: " + ApplicationDialog.staticFieldsName); return application; }
From source file:com.softenido.cafedark.io.virtual.ZipVirtualFileSystem.java
public long length() { if (length < 0) { synchronized (this) { int r = 0; long count = 0; byte[] b = new byte[8 * 1024]; try { InputStream data = getInputStream(); try { while ((r = data.read(b)) > 0) { count += r;/*from ww w . ja v a2 s. c om*/ } length = count; } finally { data.close(); } } catch (Exception ex) { length = 0; Logger.getLogger(ZipVirtualFileSystem.class.getName()).log(Level.WARNING, "ZipEntry={0}", this); } } } return length; }
From source file:net.sourceforge.lept4j.util.LoadLibs.java
/** * Extracts Leptonica resources to temp folder. * * @param dirname resource location//from ww w . j a v a 2s. co m * @return target location */ public static File extractNativeResources(String dirname) { File targetTempDir = null; try { targetTempDir = new File(LEPT4J_TEMP_DIR, dirname); URL leptResourceUrl = LoadLibs.class.getResource(dirname.startsWith("/") ? dirname : "/" + dirname); if (leptResourceUrl == null) { return null; } URLConnection urlConnection = leptResourceUrl.openConnection(); /** * Either load from resources from jar or project resource folder. */ if (urlConnection instanceof JarURLConnection) { copyJarResourceToDirectory((JarURLConnection) urlConnection, targetTempDir); } else { FileUtils.copyDirectory(new File(leptResourceUrl.getPath()), targetTempDir); } } catch (Exception e) { logger.log(Level.WARNING, e.getMessage(), e); } return targetTempDir; }
From source file:com.neophob.sematrix.core.output.ArtnetDevice.java
/** * /*ww w. j av a 2 s . c om*/ * @param controller */ public ArtnetDevice(ApplicationConfigurationHelper ph, int nrOfScreens) { super(OutputDeviceEnum.ARTNET, ph, 8, nrOfScreens); this.displayOptions = ph.getArtNetDevice(); //Get dmx specific config this.pixelsPerUniverse = ph.getArtNetPixelsPerUniverse(); try { this.targetAdress = InetAddress.getByName(ph.getArtNetIp()); this.firstUniverseId = ph.getArtNetStartUniverseId(); calculateNrOfUniverse(); this.artnet = new ArtNet(); 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(); this.initialized = true; LOG.log(Level.INFO, "ArtNet device initialized, use " + this.displayOptions.size() + " panels"); } 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:fr.cnes.sitools.extensions.astro.application.OpenSearchSearch.java
/** * Returns the JSON reprepsentation.// w w w . j a v a 2 s .c o m * * @return the JSON reprepsentation */ @Get public Representation getJsonResponse() { if (!isValidInputParameters()) { LOG.log(Level.WARNING, null, "Input parameters are not valid"); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST); } try { final String referenceSystem = getPluginParameters().get("referenceSystem").getValue(); CoordSystem coordSystem = referenceSystem.equals("geocentric") ? CoordSystem.GEOCENTRIC : CoordSystem.EQUATORIAL; final String healpixSchemeParam = getPluginParameters().get("healpixScheme").getValue(); Scheme healpixScheme = Scheme.valueOf(healpixSchemeParam); AbstractSolrQueryRequestFactory querySolr = AbstractSolrQueryRequestFactory .createInstance(queryParameters, coordSystem, getSolrBaseUrl(), healpixScheme); querySolr.createQueryBuilder(); String query = querySolr.getSolrQueryRequest(); LOG.log(Level.INFO, query); ClientResource client = new ClientResource(query); JsonRepresentation jsonRep = new JsonRepresentation( buildJsonResponse(new JSONObject(client.get().getText()))); jsonRep.setIndenting(true); return jsonRep; } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, ex); } }
From source file:eu.edisonproject.rest.FolderWatcherRunnable.java
@Override public void run() { final Path path = FileSystems.getDefault().getPath(dir); try (final WatchService watchService = FileSystems.getDefault().newWatchService()) { final WatchKey watchKey = path.register(watchService, StandardWatchEventKinds.ENTRY_CREATE); while (true) { final WatchKey wk = watchService.take(); for (WatchEvent<?> event : wk.pollEvents()) { final Path changed = (Path) event.context(); executeClassification(new File(dir + File.separator + changed)); }/*from w w w . j av a 2s. c om*/ // reset the key boolean valid = wk.reset(); if (!valid) { Logger.getLogger(FolderWatcherRunnable.class.getName()).log(Level.WARNING, "Key has been unregisterede"); } } } catch (IOException ex) { Logger.getLogger(FolderWatcherRunnable.class.getName()).log(Level.SEVERE, null, ex); } catch (InterruptedException ex) { Logger.getLogger(FolderWatcherRunnable.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(FolderWatcherRunnable.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.subgraph.vega.internal.http.requests.EngineHttpResponse.java
@Override public String getBodyAsString() { synchronized (rawResponse) { if (cachedString != null) { return cachedString; }//w w w . j a v a2s.com if (rawResponse.getEntity() == null) { cachedString = ""; return cachedString; } try { cachedString = EntityUtils.toString(rawResponse.getEntity()); } catch (ParseException e) { logger.log(Level.WARNING, "Error parsing response headers: " + e.getMessage(), e); cachedString = ""; } catch (IOException e) { logger.log(Level.WARNING, "IO error extracting response entity for request " + originalRequest.getRequestLine().getUri() + " : " + e.getMessage(), e); cachedString = ""; } return cachedString; } }
From source file:com.alehuo.wepas2016projekti.controller.UploadController.java
/** * Kuvan latauksen ksittely//w ww .jav a 2s.c o m * @param a Autentikointi * @param m Malli * @param formData Lomakkeen data * @param bs BindingResult * @param l Locale * @return */ @RequestMapping(method = RequestMethod.POST) public String processUpload(Authentication a, Model m, @Valid @ModelAttribute ImageUploadFormData formData, BindingResult bs, Locale l) { //Hae autentikointi UserAccount u = userService.getUserByUsername(a.getName()); m.addAttribute("user", u); if (bs.hasErrors()) { LOG.log(Level.WARNING, "Kayttaja ''{0}'' yritti ladata kuvaa, mutta syotteita ei validoitu. Onko otsikko tyhja?", a.getName()); return "upload"; } MultipartFile file = formData.getFile(); String description = formData.getDescription(); //Tiedostomuodon tarkistus if (!(file.getContentType().equals("image/jpg") || file.getContentType().equals("image/png") || file.getContentType().equals("image/jpeg") || file.getContentType().equals("image/bmp") || file.getContentType().equals("image/gif"))) { if (l.toString().equals("fi")) { bs.rejectValue("file", "error.file", "Tiedostomuotoa ei sallita."); } else { bs.rejectValue("file", "error.file", "File type not permitted."); } if (bs.hasErrors()) { LOG.log(Level.WARNING, "Kayttaja ''{0}'' yritti ladata kuvaa, mutta tiedostomuotoa ''{1}'' ei sallita.", new Object[] { a.getName(), file.getContentType() }); return "upload"; } } else { //Tallenna kuva Image i; try { i = imageService.addImage(u, file.getBytes(), file.getContentType(), description); LOG.log(Level.INFO, "Kayttaja ''{0}'' latasi uuden kuvan palveluun. Kuvan tunniste: ''{1}''", new Object[] { a.getName(), i.getUuid() }); } catch (IOException ex) { LOG.log(Level.SEVERE, null, ex); LOG.log(Level.SEVERE, "Kayttaja ''{0}'' yritti ladata kuvaa palveluun, mutta tapahtui palvelinvirhe.", a.getName()); if (l.toString().equals("fi")) { bs.rejectValue("file", "error.file", "Kuvan lhetys eponnistui."); } else { bs.rejectValue("file", "error.file", "Image upload failed."); } return "upload"; } } return "redirect:/"; }