private String hintFieldToString(final Object o) { final Field[] fields = RenderingHints.class.getFields(); for (int i = 0; i < fields.length; i++) { final Field f = fields[i]; if (Modifier.isFinal(f.getModifiers()) && Modifier.isPublic(f.getModifiers()) && Modifier.isStatic(f.getModifiers())) { try { final Object value = f.get(null); if (o.equals(value)) { return f.getName(); } } catch (Exception e) { Log.info ("Unable to write RenderingHint", e); } } } throw new IllegalArgumentException("Invalid value given"); }
/** * Converts a given string into a color. * * @param value the string, either a name or a hex-string. * @return the color. */ public static Color stringToColor(String value) { if (value == null) { return Color.black; } try { // get color by hex or octal value return Color.decode(value); } catch (NumberFormatException nfe) { // if we can't decode lets try to get it by name try { // try to get a color by name using reflection final Field f = Color.class.getField(value); return (Color) f.get(null); } catch (Exception ce) { Log.info("No such Color : " + value); // if we can't get any color return black return Color.black; } } } }
Log.info("No such Color : " + value);
private Object stringToHintField (final String name) { final Field[] fields = RenderingHints.class.getFields(); for (int i = 0; i < fields.length; i++) { final Field f = fields[i]; if (Modifier.isFinal(f.getModifiers()) && Modifier.isPublic(f.getModifiers()) && Modifier.isStatic(f.getModifiers())) { try { final String fieldName = f.getName(); if (fieldName.equals(name)) { return f.get(null); } } catch (Exception e) { Log.info ("Unable to write RenderingHint", e); } } } throw new IllegalArgumentException("Invalid value given"); }
Log.info("No such Color : " + value);
/** * The workerthread. Simply draws the image to a BufferedImage's * Graphics-Object and waits for the AWT to load the image. */ public synchronized void waitImageLoaded() { if (this.lock == false) { return; } final BufferedImage img = new BufferedImage( 1, 1, BufferedImage.TYPE_INT_RGB ); final Graphics g = img.getGraphics(); while (this.lock) { if (g.drawImage(this.image, 0, 0, img.getWidth(this), img.getHeight(this), this)) { return; } try { wait(500); } catch (InterruptedException e) { Log.info( "WaitingImageObserver.waitImageLoaded(): InterruptedException thrown", e ); } } }
/** * Loads the specified booter implementation. * * @param classname the class name. * * @return The boot class. */ protected AbstractBoot loadBooter(final String classname) { if (classname == null) { return null; } try { final Class c = ObjectUtilities.getClassLoader( getClass()).loadClass(classname); final Method m = c.getMethod("getInstance", (Class[]) null); return (AbstractBoot) m.invoke(null, (Object[]) null); } catch (Exception e) { Log.info ("Unable to boot dependent class: " + classname); return null; } }
/** * The workerthread. Simply draws the image to a BufferedImage's * Graphics-Object and waits for the AWT to load the image. */ public synchronized void waitImageLoaded() { if (this.lock == false) { return; } final BufferedImage img = new BufferedImage( 1, 1, BufferedImage.TYPE_INT_RGB ); final Graphics g = img.getGraphics(); while (this.lock) { if (g.drawImage(this.image, 0, 0, img.getWidth(this), img.getHeight(this), this)) { return; } try { wait(500); } catch (InterruptedException e) { Log.info( "WaitingImageObserver.waitImageLoaded(): InterruptedException thrown", e ); } } }
/** * Loads the specified booter implementation. * * @param classname the class name. * * @return The boot class. */ protected AbstractBoot loadBooter(final String classname) { if (classname == null) { return null; } try { final Class c = ObjectUtilities.getClassLoader( getClass()).loadClass(classname); final Method m = c.getMethod("getInstance", (Class[]) null); return (AbstractBoot) m.invoke(null, (Object[]) null); } catch (Exception e) { Log.info ("Unable to boot dependent class: " + classname); return null; } }
/** * Loads the specified booter implementation. * * @param classname the class name. * * @return The boot class. */ protected AbstractBoot loadBooter(final String classname) { if (classname == null) { return null; } try { final Class c = ObjectUtilities.getClassLoader( getClass()).loadClass(classname); final Method m = c.getMethod("getInstance", (Class[]) null); return (AbstractBoot) m.invoke(null, (Object[]) null); } catch (Exception e) { Log.info ("Unable to boot dependent class: " + classname); return null; } }
/** * The workerthread. Simply draws the image to a BufferedImage's * Graphics-Object and waits for the AWT to load the image. */ public synchronized void waitImageLoaded() { if (this.lock == false) { return; } final BufferedImage img = new BufferedImage( 1, 1, BufferedImage.TYPE_INT_RGB ); final Graphics g = img.getGraphics(); while (this.lock) { if (g.drawImage(this.image, 0, 0, img.getWidth(this), img.getHeight(this), this)) { return; } try { wait(500); } catch (InterruptedException e) { Log.info( "WaitingImageObserver.waitImageLoaded(): InterruptedException thrown", e ); } } }
/** * Constructs a new <code>LessSource</code>. * <p> * This will read the metadata and content of the LESS source, and will automatically resolve the imports. * </p> * * @param file The <code>InputStream</code> reference to the LESS source to read. * @throws IOException If the LESS source cannot be read. */ public LessSource(final InputStream stream, final File file, final String folder) throws IOException { if (stream == null) { throw new IllegalArgumentException("Stream must not be null."); } this.file = file; this.content = this.normalizedContent = IOUtils.toString(stream, "UTF-8"); Log.info("Less content: " + this.content); resolveImports(folder); }
/** * Adds a manual mapping. * * @param mappingInfo the mapping. */ public void addManualMapping(final ManualMappingInfo mappingInfo) { if (!this.mappingInfos.containsKey(mappingInfo.getBaseClass())) { this.manualMappings.add(mappingInfo); this.mappingInfos.put(mappingInfo.getBaseClass(), mappingInfo); } else { final Object o = this.mappingInfos.get(mappingInfo.getBaseClass()); if (o instanceof ManualMappingInfo) { Log.info ("Duplicate manual mapping: " + mappingInfo.getBaseClass()); } else { throw new IllegalArgumentException ("This mapping is already a multiplex mapping."); } } }
/** * Adds a multiplex mapping. * * @param mappingInfo the mapping. */ public void addMultiplexMapping(final MultiplexMappingInfo mappingInfo) { if (!this.mappingInfos.containsKey(mappingInfo.getBaseClass())) { this.multiplexMappings.add(mappingInfo); this.mappingInfos.put(mappingInfo.getBaseClass(), mappingInfo); } else { final Object o = this.mappingInfos.get(mappingInfo.getBaseClass()); if (o instanceof ManualMappingInfo) { throw new IllegalArgumentException ("This mapping is already a manual mapping."); } else { Log.info( "Duplicate Multiplex mapping: " + mappingInfo.getBaseClass(), new Exception() ); } } }
Log.info("Exception on method invokation.", e);
public HttpResponse doFinishLogin(StaplerRequest request, StaplerResponse rsp) throws IOException { String code = request.getParameter("code"); if (code == null || code.trim().length() == 0) { Log.info("doFinishLogin: missing code."); return HttpResponses.redirectToContextRoot(); } String content = postForAccessToken(code); String accessToken = extractToken(content); updateOfflineAccessTokenForUser(accessToken); request.getSession().setAttribute("access_token", accessToken); String newProjectSetupUrl = getJenkinsRootUrl() + "/" + GithubReposController.URL; return HttpResponses.redirectTo(newProjectSetupUrl); }
Log.info("Default log target started ... previous log messages " + "could have been ignored.");
Log.info("Default log target started ... previous log messages " + "could have been ignored.");
Log.info("Default log target started ... previous log messages " + "could have been ignored.");
@Test public void testCrashingAlgorithm() { try { MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(ConfigUtils.createConfig()); Population population = scenario.getPopulation(); for (int i = 0; i < 10; i++) { Person person = PopulationUtils.getFactory().createPerson(Id.create(i, Person.class)); population.addPerson(person); } ParallelPersonAlgorithmUtils.run(population, 2, new AbstractPersonAlgorithm() { @Override public void run(Person person) { person.getPlans().get(0).setScore(null); // this will result in an IndexOutOfBoundsException } }); Assert.fail("Expected Exception, got none."); } catch (RuntimeException e) { Log.info("Catched expected exception.", e); } }