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.cloudbees.simplediskusage.QuickDiskUsagePlugin.java
@Override public void start() throws Exception { try {// ww w . java2 s. c om load(); } catch (IOException e) { logger.log(Level.WARNING, "Failed to load " + getConfigXml(), e); } if (isRunning()) { // It's impossible, the plugin was just loaded. Let's reset end date lastRunEnd = lastRunStart; } }
From source file:com.seekret.data.flickr.FlickrRequestHandler.java
public Set<PointOfInterest> getPOIsForSpot(Spot spot) { Set<PointOfInterest> result = new HashSet<PointOfInterest>(); HashMap<LatLng, Double> calculateNewPoint = calculateNewPoint(spot); List<String> picture_ids = new ArrayList<String>(); for (Entry<LatLng, Double> entry : calculateNewPoint.entrySet()) { int requestedPage = 1; int logBarrier = 1; int numberPages = 1; int maxViewCount = 0; LatLng position = entry.getKey(); double radiusInKm = entry.getValue().doubleValue(); do {/*from ww w .j a v a 2 s . c o m*/ String urlForRequest = buildPhotoRequestURL(requestedPage, position, radiusInKm, LicenseEnum.ALL); JsonObject photosObject; try { if (requestedPage == logBarrier) { logBarrier *= 2; log.log(Level.INFO, "Retrieving all images for spot " + spot + " (page=" + requestedPage + ",numberPages=" + numberPages + ") -> " + urlForRequest); } String jsonResponse = Request.Get(urlForRequest.toString()).execute().returnContent() .asString(); requestedPage++; photosObject = JsonObject.readFrom(jsonResponse); numberPages = handleFlickrPictureResult(result, picture_ids, numberPages, maxViewCount, photosObject); } catch (Exception e) { log.log(Level.WARNING, "Could not load picture page from flickr", e); } // We need to make this algorithm more efficient } while ((requestedPage < numberPages) && (requestedPage < MAX_NUMBER_PAGES_TO_CRAWL) && result.size() < 10000); log.log(Level.INFO, "NUMBER OF PICTURES " + picture_ids.size()); } return result; }
From source file:com.alehuo.wepas2016projekti.controller.CommentController.java
/** * Lis uusi kommentti/*from www. ja v a2s.com*/ * * @param a Autentikointi * @param imageUuid Kuvan UUID * @param comment Kommentin sislt * @param request HTTP Request * @return Uudelleenohjaa aikaisemmalle sivulle */ @RequestMapping(method = RequestMethod.POST) public String addComment(Authentication a, @RequestParam String imageUuid, @RequestParam String comment, HttpServletRequest request) { //Validoidaan syte tss if (comment.length() > 0 && comment.length() <= 40) { Image img = imageService.findOneImageByUuid(imageUuid); if (img != null && img.isVisible()) { UserAccount u = userService.getUserByUsername(a.getName()); Comment comm = commentService.addComment(comment, u); img.addComment(comm); u.addComment(comm); LOG.log(Level.INFO, "Kayttaja ''{0}'' kommentoi kuvaan ''{1}'' viestin sisallolla \"{2}\"", new Object[] { a.getName(), imageUuid, comment }); userService.saveUser(u); imageService.saveImage(img); } else { LOG.log(Level.WARNING, "Kayttaja ''{0}'' yritti kommentoida kuvaa ''{1}'' viestin sisallolla \"{2}\", mutta kuvaa ei lytynyt.", new Object[] { a.getName(), imageUuid, comment }); return "redirect:/"; } } else { LOG.log(Level.WARNING, "Kayttaja ''{0}'' yritti kommentoida kuvaa ''{1}'' viestin sisallolla \"{2}\", mutta viesti oli liian pitk.", new Object[] { a.getName(), imageUuid, comment }); } return "redirect:/photo/" + imageUuid; }
From source file:org.silvertunnel_ng.demo.download_tool.HttpServiceImpl.java
/** * @see HttpService#initHttpClient()/*from w w w . ja v a2s.c o m*/ */ public void initHttpClient() { try { // prepare parameters HttpParams params = new BasicHttpParams(); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params, "UTF-8"); // create http client ClientConnectionManager ccm = new ThreadSafeClientConnManager(params, schemeRegistry); httpClient = new DefaultHttpClient(ccm, params); // user agent settings if (USER_AGENT != null) { HttpProtocolParams.setUserAgent(httpClient.getParams(), USER_AGENT); } } catch (Throwable t) { logger.log(Level.WARNING, "initHttpClient()", t); } }
From source file:com.symbian.driver.plugins.reboot.Activator.java
public synchronized boolean SwitcthOff() { String switchState = "2";// 2- Immediate Off try {//from w w w.j a v a2 s . com switchOp(switchState); } catch (IOException e) { LOGGER.log(Level.WARNING, e.getMessage(), e); return false; } return true; }
From source file:edu.wpi.cs.wpisuitetng.modules.core.entitymanagers.UserManager.java
@Override public User makeEntity(Session s, String content) throws WPISuiteException { //TODO: create a custom de-serializer & serializer so we can hash the desired password & remove it from others. logger.log(Level.FINE, "Attempting new User creation..."); User p;//from w w w . ja v a2 s . c om try { p = User.fromJSON(content); } catch (JsonSyntaxException e) { logger.log(Level.WARNING, "Invalid User entity creation string."); throw new BadRequestException( "The entity creation string had invalid format. Entity String: " + content); } if (getEntity(s, p.getUsername())[0] == null) { String newPassword = UserDeserializer.parsePassword(content); String hashedPassword = this.passwordHash.generateHash(newPassword); p.setPassword(hashedPassword); p.setRole(Role.USER); save(s, p); } else { logger.log(Level.WARNING, "Conflict Exception during User creation."); throw new ConflictException("A user with the given ID already exists. Entity String: " + content); } logger.log(Level.FINE, "User creation success!"); return p; }
From source file:com.oic.event.RegisterProfile.java
@Override public void ActionEvent(JSONObject json, WebSocketListener webSocket) { JSONObject responseJSON = new JSONObject(); responseJSON.put("method", "setprofile"); if (!validation(json, webSocket)) { return;/* www . j a va 2 s. c om*/ } Connection con = DatabaseConnection.getConnection(); PreparedStatement ps; try { con = DatabaseConnection.getConnection(); con.setAutoCommit(false); String sql = "INSERT INTO user SET studentnumber = ?, name = ?, avatarid = ?, grade = ?, sex = ?, birth = ?, comment = ?, secretkey = ?"; ps = con.prepareStatement(sql); ps.setString(1, json.get("studentid").toString()); ps.setString(2, json.get("username").toString()); ps.setInt(3, Integer.parseInt(json.get("avatarid").toString())); ps.setInt(4, Integer.parseInt(json.get("grade").toString())); ps.setInt(5, Integer.parseInt(json.get("gender").toString())); ps.setDate(6, toDate(json.get("birthday").toString())); ps.setString(7, json.get("comment").toString()); ps.setString(8, json.get("secretkey").toString()); ps.executeUpdate(); ps.close(); sql = "SELECT last_insert_id() AS last"; ps = con.prepareStatement(sql); ResultSet rs = ps.executeQuery(); if (!rs.next()) { throw new SQLException(); } long userid = rs.getLong("last"); rs.close(); ps.close(); sql = "INSERT INTO setting SET userid = ?, privategrade = ?, privatesex = ?, privatebirth = ?"; ps = con.prepareStatement(sql); ps.setLong(1, userid); ps.setInt(2, Integer.parseInt(json.get("vgrade").toString())); ps.setInt(3, Integer.parseInt(json.get("vgender").toString())); ps.setInt(4, Integer.parseInt(json.get("vbirthday").toString())); ps.executeUpdate(); ps.close(); con.commit(); responseJSON.put("status", 0); webSocket.userNoLogin(); } catch (Exception e) { try { con.rollback(); } catch (SQLException sq) { LOG.warning("[setProfile]Error Rolling back."); } e.printStackTrace(); responseJSON.put("status", 1); } finally { try { con.setAutoCommit(true); } catch (SQLException ex) { Logger.getLogger(SetProfile.class.getName()).log(Level.WARNING, "Error going back to AutoCommit mode", ex); } } webSocket.sendJson(responseJSON); }
From source file:com.gisgraphy.domain.geoloc.service.fulltextsearch.SolrClientTest.java
@Test public void testSetSolRLogLevel() throws Exception { IsolrClient client = new SolrClient(AbstractIntegrationHttpSolrTestCase.fulltextSearchUrlBinded, new MultiThreadedHttpConnectionManager()); assertTrue(client.isServerAlive());/*from w w w. j av a 2s. c om*/ client.setSolRLogLevel(Level.CONFIG); client.setSolRLogLevel(Level.FINE); client.setSolRLogLevel(Level.FINER); client.setSolRLogLevel(Level.FINEST); client.setSolRLogLevel(Level.INFO); client.setSolRLogLevel(Level.SEVERE); client.setSolRLogLevel(Level.WARNING); client.setSolRLogLevel(Level.ALL); client.setSolRLogLevel(Level.OFF); }
From source file:me.ronghai.sa.dao.impl.AbstractModelDAOWithJDBCImpl.java
private List<?>[] findColumnsAndValues(boolean excludeId, E entity) { List<String> columnNames = new ArrayList<>(); List<Object> values = new ArrayList<>(); Map<String, Field> columnFields = entity.modelMeta().getColumnFields(); Map<String, Method> field2Getter = entity.modelMeta().getField2Getter(); for (Map.Entry<String, Field> entry : columnFields.entrySet()) { Field field = entry.getValue(); if (excludeId && field.isAnnotationPresent(Id.class)) { continue; }// w ww .j a v a 2 s . c o m String cname = entry.getKey(); Object value = null; try { value = field2Getter.get(field.getName()).invoke(entity); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NullPointerException e) { logger.log(Level.WARNING, "filed is {0} ", field); logger.log(Level.WARNING, "{0}", e); } Column annotation = field.isAnnotationPresent(Column.class) ? (Column) field.getAnnotation(Column.class) : null; if (annotation != null && value == null && !annotation.nullable()) { logger.log(Level.SEVERE, "{0}", cname + " is not null. "); return null; } else if (value != null) { columnNames.add(cname); values.add(value); } } /* List<Field> allFieldList = ReflectUtils.getDeclaredFields((List<Field>)null, entityClass, false); Map<String, PropertyDescriptor> fieldName2PropertyDescriptor = ReflectUtils.findFieldName2PropertyDescriptor(entityClass); for ( Field field : allFieldList) { if (field.isAnnotationPresent(Column.class) && !field.isAnnotationPresent(Id.class)) { Column annotation = field.isAnnotationPresent(Column.class) ? (Column) field.getAnnotation(Column.class) : null; String cname; if(annotation != null && org.apache.commons.lang.StringUtils.isNotEmpty(annotation.name())){ cname = annotation.name(); cname = cname.replaceAll("[\\[\\]]", "`"); }else{ cname = field.getName(); } Method getter = ReflectUtils.findGetter(entity, field, fieldName2PropertyDescriptor, null); try { Object value = getter.invoke(entity); if(value == null && annotation != null && !annotation.nullable()){ logger.log(Level.SEVERE, "{0}", cname + " is not null. "); return null; }else if(value != null){ columnNames.add(cname); values.add(value); } }catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { if(annotation != null && !annotation.nullable()){ logger.log(Level.SEVERE, "{0}", ex); return null; }else{ logger.log(Level.WARNING, "{0}", ex); } } } } */ return new List[] { columnNames, values }; }
From source file:com.skcraft.launcher.creator.util.ModInfoReader.java
/** * Detect the mods listed in the given .jar * * @param file The file//from ww w. j av a 2s. c o m * @return A list of detected mods */ public List<? extends ModInfo> detectMods(File file) { Closer closer = Closer.create(); try { FileInputStream fis = closer.register(new FileInputStream(file)); BufferedInputStream bis = closer.register(new BufferedInputStream(fis)); ZipInputStream zis = closer.register(new ZipInputStream(bis)); ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { if (entry.getName().equalsIgnoreCase(FORGE_INFO_FILENAME)) { List<ForgeModInfo> mods; String content = CharStreams.toString(new InputStreamReader(zis, Charsets.UTF_8)); try { mods = mapper.readValue(content, ForgeModManifest.class).getMods(); } catch (JsonMappingException | JsonParseException e) { mods = mapper.readValue(content, new TypeReference<List<ForgeModInfo>>() { }); } if (mods != null) { // Ignore "examplemod" return Collections.unmodifiableList( mods.stream().filter(info -> !info.getModId().equals("examplemod")) .collect(Collectors.toList())); } else { return Collections.emptyList(); } } else if (entry.getName().equalsIgnoreCase(LITELOADER_INFO_FILENAME)) { String content = CharStreams.toString(new InputStreamReader(zis, Charsets.UTF_8)); return new ImmutableList.Builder<ModInfo>() .add(mapper.readValue(content, LiteLoaderModInfo.class)).build(); } } return Collections.emptyList(); } catch (JsonMappingException e) { log.log(Level.WARNING, "Unknown format " + FORGE_INFO_FILENAME + " file in " + file.getAbsolutePath(), e); return Collections.emptyList(); } catch (JsonParseException e) { log.log(Level.WARNING, "Corrupt " + FORGE_INFO_FILENAME + " file in " + file.getAbsolutePath(), e); return Collections.emptyList(); } catch (IOException e) { log.log(Level.WARNING, "Failed to read " + file.getAbsolutePath(), e); return Collections.emptyList(); } finally { try { closer.close(); } catch (IOException ignored) { } } }