List of usage examples for java.util.logging Level FINE
Level FINE
To view the source code for java.util.logging Level FINE.
Click Source Link
From source file:eu.trentorise.opendata.commons.test.jackson.TodCommonsModuleTest.java
/** * This works as Jackson by default initializes missing fields with null and * builder has always default values to substitute to nulls * //from www. j a v a2s. c o m * @see #testEmptyConstructor() */ @Test public void testEmptyConstructorForBuilder() throws IOException { B b = objectMapper.readValue("{\"prop1\":3}", B.class); LOG.log(Level.FINE, "b.prop2 = {0}", "'" + b.getProp2() + "'"); assertEquals(B.of().withProp1(3), b); }
From source file:com.kenai.redminenb.repository.RedmineRepositoryController.java
private boolean validate() { if (connectError) { panel.connectButton.setEnabled(true); return false; }//w w w .ja va2 s .co m if (!populated) { return false; } errorMessage = null; panel.connectButton.setEnabled(false); panel.createNewProjectButton.setEnabled(false); // check url String url = getUrl(); if (url.equals("")) { // NOI18N errorMessage = Bundle.MSG_MissingUrl(); return false; } try { new URL(url); // check this first even if URL is an URI new URI(url); } catch (Exception ex) { errorMessage = Bundle.MSG_WrongUrl(); Redmine.LOG.log(Level.FINE, errorMessage, ex); return false; } // username and password required if not access key authentication if (getAuthMode() == AuthMode.Credentials) { if (StringUtils.isBlank(getUser())) { errorMessage = Bundle.MSG_MissingUsername(); return false; } else if (ArrayUtils.isEmpty(getPassword())) { errorMessage = Bundle.MSG_MissingPassword(); return false; } } else { if (StringUtils.isBlank(getAccessKey())) { errorMessage = Bundle.MSG_MissingAccessKey(); return false; } } panel.connectButton.setEnabled(true); panel.createNewProjectButton.setEnabled(connected); // check name String name = panel.nameTextField.getText().trim(); if (name.equals("")) { // NOI18N errorMessage = Bundle.MSG_MissingName(); return false; } // is name unique? // if ((repository.isFresh() && Redmine.getInstance().isRepositoryNameExists(name)) // || (!repository.isFresh() && !name.equals(repository.getName()) // && Redmine.getInstance().isRepositoryNameExists(name))) { // if (Redmine.getInstance().isRepositoryNameExists(name)) { // errorMessage = Bundle.MSG_TrackerAlreadyExists(); // return false; // } // is repository unique? // RedmineRepository confRepository = Redmine.getInstance().repositoryExists(repository); // // if ((repository.isFresh() && Redmine.getInstance().isRepositoryExists(repository)) // || (!repository.isFresh() && confRepository != null // && !confRepository.getID().equals(repository.getID()))) { // errorMessage = Bundle.MSG_RepositoryAlreadyExists(); // return false; // } if (panel.projectComboBox.getSelectedIndex() == -1) { errorMessage = Bundle.MSG_MissingProject(); return false; } return true; }
From source file:hudson.XmlFile.java
/** * Loads the contents of this file into a new object. *///from w ww.ja va2 s . c o m public Object read() throws IOException { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Reading " + file); } try (InputStream in = new BufferedInputStream(Files.newInputStream(file.toPath()))) { return xs.fromXML(in); } catch (RuntimeException | Error e) { throw new IOException("Unable to read " + file, e); } }
From source file:com.ibm.ws.lars.rest.RepositoryRESTResource.java
@HEAD @Path("/assets") public Response countAssets(@Context UriInfo info, @Context SecurityContext sc) throws InvalidParameterException { if (logger.isLoggable(Level.FINE)) { logger.fine("countAssets called with query parameters: " + info.getRequestUri().getRawQuery()); }/*from w w w . java2s . c o m*/ AssetQueryParameters params = AssetQueryParameters.create(info); Collection<AssetFilter> filters = params.getFilters(); if (!sc.isUserInRole(ADMIN_ROLE)) { filters.add(ASSET_IS_PUBLISHED); } int count = assetService.countAllAssets(filters, params.getSearchTerm()); return Response.noContent().header("count", count).build(); }
From source file:jenkins.plugins.testopia.result.ResultSeeker.java
/** * Scans a directory for files matching the includes pattern. * /*from w w w. j a v a 2 s .c om*/ * @param directory the directory to scan. * @param includes the includes pattern. * @param listener Hudson Build listener. * @return array of strings of paths for files that match the includes pattern in the directory. * @throws IOException */ protected String[] scan(final File directory, final String includes, final BuildListener listener) throws IOException { String[] fileNames = new String[0]; if (StringUtils.isNotBlank(includes)) { FileSet fs = null; try { fs = Util.createFileSet(directory, includes); DirectoryScanner ds = fs.getDirectoryScanner(); fileNames = ds.getIncludedFiles(); } catch (BuildException e) { e.printStackTrace(listener.getLogger()); throw new IOException(e); } } if (LOGGER.isLoggable(Level.FINE)) { for (String fileName : fileNames) { LOGGER.log(Level.FINE, Messages.Testopia_ResultSeeker_TestResultFound(fileName)); } } return fileNames; }
From source file:com.boundlessgeo.geoserver.api.controllers.MapController.java
@RequestMapping(value = "/{wsName}/{name}", method = RequestMethod.PUT) public @ResponseBody JSONObj put(@PathVariable String wsName, @PathVariable String name, @RequestBody JSONObj obj) {/* w ww.j av a 2s.co m*/ LayerGroupInfo map = findMap(wsName, name); if (obj.has("name")) { map.setName(obj.str("name")); } if (obj.has("title")) { map.setTitle(obj.str("title")); } if (obj.has("abstract")) { map.setAbstract(obj.str("abstract")); } if (obj.has("proj") && obj.has("bbox")) { CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84; if (obj.has("proj")) { String srs = obj.str("proj"); try { crs = CRS.decode(srs); } catch (FactoryException e) { LOG.log(Level.FINE, wsName + "." + name + " unrecorgnized proj:" + srs, e); } } Envelope envelope = IO.bounds(obj.object("bbox")); ReferencedEnvelope bounds = new ReferencedEnvelope(envelope, crs); map.setBounds(bounds); } String user = SecurityContextHolder.getContext().getAuthentication().getName(); map.getMetadata().put("user", user); map.getMetadata().put("modified", new Date()); if (obj.has("change")) { map.getMetadata().put("change", obj.str("change")); } else { map.getMetadata().put("change", "modified " + obj.keys()); } return mapDetails(new JSONObj(), map, wsName); }
From source file:com.stratuscom.harvester.classloading.VirtualFileSystemClassLoader.java
@Override public Enumeration<URL> findResources(final String name) throws IOException { if (log.isLoggable(Level.FINE)) { log.fine("findResourceFileObjects(" + name + ")"); }//from www. j a v a 2 s . co m Enumeration result = (Enumeration) Security.doPrivileged(new PrivilegedAction<Enumeration>() { public Enumeration run() { List<URL> urlList = new ArrayList<URL>(); try { List<FileObject> foList = findResourceFileObjects(name); for (FileObject fo : foList) { urlList.add(fo.getURL()); if (log.isLoggable(Level.FINE)) { log.fine("..found file object with URL:" + fo.getURL()); log.fine("..trying to open it"); } /* For unknown reasons, actually getting the resources will fail iff the target folder is not under the current working directory, unless we try to open it while we're here. */ InputStream in = null; //BufferedReader r = null; try { in = fo.getURL().openStream(); //r = new BufferedReader(new InputStreamReader(in, "utf-8")); } catch (Exception x) { log.log(Level.FINE, "..Got an exception:" + x); } finally { try { // if (r != null) { // r.close(); // } if (in != null) { in.close(); } } catch (IOException y) { log.log(Level.FINE, "..Additionally, got an exception on close:" + y); } } } } catch (FileSystemException ex) { Logger.getLogger(VirtualFileSystemClassLoader.class.getName()).log(Level.SEVERE, null, ex); } return Collections.enumeration(urlList); } }); return result; }
From source file:com.michelin.cio.hudson.plugins.rolestrategy.RoleMap.java
/** * Check if the given sid has the provided {@link Permission}. * @return True if the sid's granted permission *//*from w w w.jav a 2 s .c om*/ private boolean hasPermission(String sid, Permission p, RoleType roleType, AccessControlled controlledItem) { if (DangerousPermissionHelper.isDangerous(p)) { /* if this is a dangerous permission, fall back to Administer unless we're in compat mode */ p = Jenkins.ADMINISTER; } for (Role role : getRolesHavingPermission(p)) { if (this.grantedRoles.get(role).contains(sid)) { // Handle roles macro if (Macro.isMacro(role)) { Macro macro = RoleMacroExtension.getMacro(role.getName()); if (macro != null) { RoleMacroExtension macroExtension = RoleMacroExtension.getMacroExtension(macro.getName()); if (macroExtension.IsApplicable(roleType) && macroExtension.hasPermission(sid, p, roleType, controlledItem, macro)) { return true; } } } // Default handling else { return true; } } else if (Settings.TREAT_USER_AUTHORITIES_AS_ROLES) { try { UserDetails userDetails = cache.getIfPresent(sid); if (userDetails == null) { userDetails = Jenkins.getInstance().getSecurityRealm().loadUserByUsername(sid); cache.put(sid, userDetails); } for (GrantedAuthority grantedAuthority : userDetails.getAuthorities()) { if (grantedAuthority.getAuthority().equals(role.getName())) { return true; } } } catch (BadCredentialsException e) { LOGGER.log(Level.FINE, "Bad credentials", e); } catch (DataAccessException e) { LOGGER.log(Level.FINE, "failed to access the data", e); } catch (RuntimeException ex) { // There maybe issues in the logic, which lead to IllegalStateException in Acegi Security (JENKINS-35652) // So we want to ensure this method does not fail horribly in such case LOGGER.log(Level.WARNING, "Unhandled exception during user authorities processing", ex); } } // TODO: Handle users macro } return false; }
From source file:de.jfachwert.post.Anschrift.java
private static Object[] split(String anschrift) { String[] lines = StringUtils.trimToEmpty(anschrift).split("[,\\n$]"); if (lines.length < 2) { throw new InvalidValueException(anschrift, ADDRESS); }/* w w w .java2 s . c om*/ Object[] parts = new Object[3]; parts[0] = new Adressat(lines[0]); String adresseOrPostfach = anschrift.substring(lines[0].length() + 1).trim(); try { parts[1] = null; parts[2] = new Postfach(adresseOrPostfach); } catch (ValidationException ex) { LOG.log(Level.FINE, "'" + adresseOrPostfach + "' is not a post office box:", ex); parts[1] = new Adresse(adresseOrPostfach); parts[2] = null; } return parts; }
From source file:net.padlocksoftware.padlock.DefaultMacAddressProvider.java
private boolean isVirtualAddress(byte[] address) { // Loop through the virtual mac database to determine if this is a physical // interface address. for (Entry<String, byte[]> entry : virtualAddresses.entrySet()) { String name = entry.getKey(); byte[] data = entry.getValue(); int matchCount = 0; for (int x = 0; x < Math.min(data.length, address.length); x++) { if (data[x] == address[x]) { matchCount++;/* w w w . ja v a 2 s . co m*/ } } if (matchCount == data.length) { logger.log(Level.FINE, "Address {0} matches {1}, ignoring", new Object[] { new String(Hex.encodeHex(address)), name }); return true; } } return false; }