java.util.logging.Logger Java Examples

The following examples show how to use java.util.logging.Logger. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Logging.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialization function that is called to instantiate the logging system. It takes
 * logger names (keys) and logging labels respectively
 *
 * @param map a map where the key is a logger name and the value a logging level
 * @throws IllegalArgumentException if level or names cannot be parsed
 */
public static void initialize(final Map<String, String> map) throws IllegalArgumentException {
    try {
        for (final Entry<String, String> entry : map.entrySet()) {
            Level level;

            final String key   = entry.getKey();
            final String value = entry.getValue();
            if ("".equals(value)) {
                level = Level.INFO;
            } else {
                level = Level.parse(value.toUpperCase(Locale.ENGLISH));
            }

            final String name = Logging.lastPart(key);
            final Logger logger = instantiateLogger(name, level);

            Logging.loggers.put(name, logger);
        }
    } catch (final IllegalArgumentException | SecurityException e) {
        throw e;
    }
}
 
Example #2
Source File: VideoDHGR.java    From jace with GNU General Public License v2.0 6 votes vote down vote up
protected void showDhgr(WritableImage screen, int xOffset, int y, int dhgrWord) {
    PixelWriter writer = screen.getPixelWriter();
    try {
        for (int i = 0; i < 7; i++) {
            Color color;
            if (!dhgrMode && hiresMode) {
                color = Palette.color[dhgrWord & 15];
            } else {
                color = Palette.color[FLIP_NYBBLE[dhgrWord & 15]];
            }
            writer.setColor(xOffset++, y, color);
            writer.setColor(xOffset++, y, color);
            writer.setColor(xOffset++, y, color);
            writer.setColor(xOffset++, y, color);
            dhgrWord >>= 4;
        }
    } catch (ArrayIndexOutOfBoundsException ex) {
        Logger.getLogger(getClass().getName()).warning("Went out of bounds in video display");
    }
}
 
Example #3
Source File: CreateViewAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void perform(final BaseNode node) {
   DatabaseConnection connection = node.getLookup().lookup(DatabaseConnection.class);

   String schemaName = findSchemaWorkingName(node.getLookup());

   try {
       boolean viewsSupported = connection.getConnector().getDriverSpecification(schemaName).areViewsSupported();
       if (!viewsSupported) {
           String message = NbBundle.getMessage (CreateViewAction.class, "MSG_ViewsAreNotSupported", // NOI18N
                   connection.getJDBCConnection().getMetaData().getDatabaseProductName().trim());
           DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message, NotifyDescriptor.INFORMATION_MESSAGE));
           return;
       }

       Specification spec = connection.getConnector().getDatabaseSpecification();

       boolean viewAdded = AddViewDialog.showDialogAndCreate(spec, schemaName);
       if (viewAdded) {
           SystemAction.get(RefreshAction.class).performAction(new Node[]{node});
       }
   } catch(Exception exc) {
       Logger.getLogger(CreateViewAction.class.getName()).log(Level.INFO, exc.getLocalizedMessage(), exc);
       DbUtilities.reportError(NbBundle.getMessage (CreateViewAction.class, "ERR_UnableToCreateView"), exc.getMessage()); // NOI18N
   }
}
 
Example #4
Source File: HttpMonitorHelper.java    From netbeans with Apache License 2.0 6 votes vote down vote up
static File getDefaultWebXML(String domainLoc, String domainName) {
    String loc = domainLoc+"/"+domainName+"/config/default-web.xml"; // NOI18N
    File webXML = new File(loc);

    if (webXML.exists())  {
        String backupLoc = domainLoc+"/"+domainName+"/config/default-web.xml.orig"; // NOI18N
        File backupXml = new File(backupLoc);
        if (!backupXml.exists()) {
            try {
                copy(webXML,backupXml);
                createCopyAndUpgrade(backupXml, webXML);
            } catch (FileNotFoundException fnfe) {
                Logger.getLogger("payara-eecommon").log(Level.WARNING, "This file existed a few milliseconds ago: "+ webXML.getAbsolutePath(), fnfe);
            } catch (IOException ioe) {
                if (backupXml.exists()) {
                    backupXml.delete();
                    Logger.getLogger("payara-eecommon").log(Level.WARNING,"failed to backup data from "+webXML.getAbsolutePath(), ioe);
                } else {
                    Logger.getLogger("payara-eecommon").log(Level.WARNING,"failed to create backup file "+backupXml.getAbsolutePath(), ioe);
                }
            }
        }
        return webXML.exists() ? webXML : null;
    }
    return null;
}
 
Example #5
Source File: CapsuleCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
     * Instantiate the configured shape in Bullet.
     */
    protected void createShape(){
        objectId = createShape(axis, radius, height);
        Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Created Shape {0}", Long.toHexString(objectId));
        setScale(scale);
        setMargin(margin);
//        switch(axis){
//            case 0:
//                objectId=new CapsuleShapeX(radius,height);
//            break;
//            case 1:
//                objectId=new CapsuleShape(radius,height);
//            break;
//            case 2:
//                objectId=new CapsuleShapeZ(radius,height);
//            break;
//        }
//        objectId.setLocalScaling(Converter.convert(getScale()));
//        objectId.setMargin(margin);
    }
 
Example #6
Source File: FrameEmployee.java    From dctb-utfpr-2018-1 with Apache License 2.0 6 votes vote down vote up
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
    jText.setText("");
    openFile();
    Employee e = new Employee();
    try {
        e = readRecords();
        jText.setText(""+e);
    } catch (ClassNotFoundException ex) {
        Logger.getLogger(FrameEmployee.class.getName()).log(Level.SEVERE, null, ex);
    }
    catch (IOException evento){
    
    }
    closeFile();
    
  

}
 
Example #7
Source File: AndHowLog.java    From andhow with Apache License 2.0 6 votes vote down vote up
private AndHowLog(Logger baseLog, Class<?> clazz, Handler handler) {
	baseLogger = baseLog;
	baseLogger.setUseParentHandlers(false);	//Don't double print messages
	
	if (handler == null) {
		handler = DEFAULT_HANDLER;
	}
	
	Handler[] orgHandlers = baseLogger.getHandlers();
	
	//Make sure only have our single handler in place
	for (Handler h : orgHandlers) {
		baseLogger.removeHandler(h);
	}
	
	baseLogger.addHandler(handler);

	this.clazz = clazz;
	reloadLogLevel();
}
 
Example #8
Source File: Files.java    From Minepacks with GNU General Public License v3.0 6 votes vote down vote up
protected static @Nullable ItemStack[] readFile(@NotNull InventorySerializer itsSerializer, @NotNull File file, @NotNull Logger logger)
{
	if(file.exists())
	{
		try(FileInputStream fis = new FileInputStream(file))
		{
			int version = fis.read();
			byte[] out = new byte[(int) (file.length() - 1)];
			int readCount = fis.read(out);
			if(file.length() - 1 != readCount) logger.warning("Problem reading file, read " + readCount + " of " + (file.length() - 1) + " bytes.");
			return itsSerializer.deserialize(out, version);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
	return null;
}
 
Example #9
Source File: As3PCodeDocs.java    From jpexs-decompiler with GNU General Public License v3.0 6 votes vote down vote up
public static String getJs() {
    String cached = docsCache.get("__js");
    if (cached != null) {
        return cached;
    }
    String js = "";
    InputStream is = As3PCodeDocs.class.getResourceAsStream("/com/jpexs/decompiler/flash/docs/docs.js");
    if (is == null) {
        Logger.getLogger(As3PCodeDocs.class.getName()).log(Level.SEVERE, "docs.js needed for documentation not found");
    } else {
        js = new String(Helper.readStream(is), Utf8Helper.charset);
    }

    docsCache.put("__js", js);
    return js;
}
 
Example #10
Source File: LogWrapper.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
private LogWrapper() {
  logger = Logger.getLogger(this.getClass().getCanonicalName());

  Cache cache = CliUtil.getCacheIfExists();
  if (cache != null && !cache.isClosed()) {
    //TODO - Abhishek how to set different log levels for different handlers???
    logger.addHandler(cache.getLogger().getHandler());
    CommandResponseWriterHandler handler = new CommandResponseWriterHandler();
    handler.setFilter(new Filter() {
      @Override
      public boolean isLoggable(LogRecord record) {
        return record.getLevel().intValue() >= Level.FINE.intValue();
      }
    });
    handler.setLevel(Level.FINE);
    logger.addHandler(handler);
  }
  logger.setUseParentHandlers(false);
}
 
Example #11
Source File: ClientSharedUtils.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public static void initLogger(String loggerName, String logFile,
    boolean initLog4j, Level level, final Handler handler) {
  clearLogger();
  if (initLog4j) {
    try {
      initLog4J(logFile, level);
    } catch (IOException ioe) {
      throw newRuntimeException(ioe.getMessage(), ioe);
    }
  }
  Logger log = Logger.getLogger(loggerName);
  log.addHandler(handler);
  log.setLevel(level);
  log.setUseParentHandlers(false);
  logger = log;
}
 
Example #12
Source File: AssemblyLine.java    From Java-Coding-Problems with MIT License 6 votes vote down vote up
private static void startConsumers() {

        logger.info(() -> "We have a consumers team of "
                + PROCESSORS + " members ...");

        consumerService = Executors.newWorkStealingPool();
        // consumerService = Executors.newCachedThreadPool();
        // consumerService = Executors.newWorkStealingPool(PROCESSORS);
        // consumerService = Executors.newFixedThreadPool(PROCESSORS);
        int queueSize = queue.size();

        startTime = System.currentTimeMillis();
        for (int i = 0; i < queueSize; i++) {    
            consumerService.execute(consumer);
        }

        consumerService.shutdown();
        try {
            consumerService.awaitTermination(Integer.MAX_VALUE, TimeUnit.MILLISECONDS);
        } catch (InterruptedException ex) {
            Logger.getLogger(AssemblyLine.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
 
Example #13
Source File: ChartDataProcessor.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
/**
 * Handles the HTTP <code>POST</code> method.
 *
 * @param request  servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException      if an I/O error occurs
 */

public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    try {
        processRequest(request, response);
    } catch (Exception ex) {
        Logger.getLogger(ReportGenerator.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
Example #14
Source File: LoggerHelper.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static void deleteLoggingOnWriter() {
    Logger cxfLogger = getRootCXFLogger();
    Handler handler = getHandler(cxfLogger, WRITER_HANDLER);

    if (handler != null) {
        cxfLogger.removeHandler(handler);
    }
    enableConsoleLogging();
}
 
Example #15
Source File: Gl_450_clip_control.java    From jogl-samples with MIT License 5 votes vote down vote up
private boolean initTexture(GL4 gl4) {

        try {
            jgli.Texture2d texture = new Texture2d(jgli.Load.load(TEXTURE_ROOT + "/" + TEXTURE_DIFFUSE));
            jgli.Gl.Format format = jgli.Gl.translate(texture.format());

            gl4.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

            gl4.glGenTextures(1, textureName);
            gl4.glActiveTexture(GL_TEXTURE0);
            gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(0));
            gl4.glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_SWIZZLE_R, GL_RED);
            gl4.glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_SWIZZLE_G, GL_GREEN);
            gl4.glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_SWIZZLE_B, GL_BLUE);
            gl4.glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_SWIZZLE_A, GL_ALPHA);
            gl4.glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BASE_LEVEL, 0);
            gl4.glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, texture.levels() - 1);
            gl4.glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
            gl4.glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

            gl4.glTexStorage3D(GL_TEXTURE_2D_ARRAY, texture.levels(), format.internal.value,
                    texture.dimensions(0)[0], texture.dimensions(0)[1], 1);

            for (int level = 0; level < texture.levels(); ++level) {

                gl4.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, level,
                        0, 0, 0,
                        texture.dimensions(level)[0], texture.dimensions(level)[1], 1,
                        format.external.value, format.type.value,
                        texture.data(level));
            }

            gl4.glPixelStorei(GL_UNPACK_ALIGNMENT, 4);

        } catch (IOException ex) {
            Logger.getLogger(Gl_450_clip_control.class.getName()).log(Level.SEVERE, null, ex);
        }
        return true;
    }
 
Example #16
Source File: DiffTreeTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    Component comp = delegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if (comp instanceof JComponent) {
        JComponent c = (JComponent) comp;
        if (value == null) {
            c.setToolTipText(null);
        } else {
            String val = value.toString();
            String tooltip = tooltips.get(val);
            if (tooltip == null) {
                tooltip = val.replace("\r\n", "\n").replace("\r", "\n"); //NOI18N
                try {
                    tooltip = XMLUtil.toElementContent(tooltip);
                } catch (CharConversionException e1) {
                    Logger.getLogger(DiffTreeTable.class.getName()).log(Level.INFO, "Can not HTML escape: ", tooltip);  //NOI18N
                }
                if (tooltip.contains("\n")) {
                    tooltip = "<html><body><p>" + tooltip.replace("\n", "<br>") + "</p></body></html>"; //NOI18N
                    c.setToolTipText(tooltip);
                }
                tooltips.put(val, tooltip);
            }
            c.setToolTipText(tooltip);
        }
    }
    return comp;
}
 
Example #17
Source File: VehicleCommanderJFrame.java    From defense-solutions-proofs-of-concept with Apache License 2.0 5 votes vote down vote up
@Override
protected void toggled(boolean selected) {
    if (selected) {
        new Thread() {

            @Override
            public void run() {
                /**
                 * Sleep for a few millis so that any existing component's call to
                 * cancelTrackAsync can finish first.
                 * TODO this depends on a race condition; it's probably fine but we
                 * might want to clean this up in the future.
                 */
                try {
                    Thread.sleep(15);
                } catch (InterruptedException ex) {
                    Logger.getLogger(VehicleCommanderJFrame.class.getName()).log(Level.SEVERE, null, ex);
                }
                mapController.trackAsync(new MapOverlayAdapter() {

                    @Override
                    public void mouseClicked(MouseEvent event) {
                        Point pt = mapController.toMapPointObject(event.getX(), event.getY());
                        chemLightController.sendChemLight(pt.getX(), pt.getY(), mapController.getSpatialReference().getID(), color.getRGB());
                    }

                }, MapController.EVENT_MOUSE_CLICKED);
            }
        }.start();                    
    } else {
        mapController.cancelTrackAsync();
    }
}
 
Example #18
Source File: RestMockResource.java    From development with Apache License 2.0 5 votes vote down vote up
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response postProcess(String json) {

    Gson gson = new Gson();
    TriggerProcessRepresentation content = gson.fromJson(json,
            TriggerProcessRepresentation.class);

    Logger logger = Logger.getLogger(getClass().getName());

    logger.info("Triggerprocess: " + content.getId() + ", " + json);

    return Response.noContent().build();
}
 
Example #19
Source File: ServerConfig.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static void checkLegacyProperties(final Logger logger) {

        // legacy properties that are no longer used
        // print a warning to logger if they are set.

        java.security.AccessController.doPrivileged(
            new PrivilegedAction<Void>() {
                public Void run () {
                    if (System.getProperty("sun.net.httpserver.readTimeout")
                                                !=null)
                    {
                        logger.warning ("sun.net.httpserver.readTimeout "+
                            "property is no longer used. "+
                            "Use sun.net.httpserver.maxReqTime instead."
                        );
                    }
                    if (System.getProperty("sun.net.httpserver.writeTimeout")
                                                !=null)
                    {
                        logger.warning ("sun.net.httpserver.writeTimeout "+
                            "property is no longer used. Use "+
                            "sun.net.httpserver.maxRspTime instead."
                        );
                    }
                    if (System.getProperty("sun.net.httpserver.selCacheTimeout")
                                                !=null)
                    {
                        logger.warning ("sun.net.httpserver.selCacheTimeout "+
                            "property is no longer used."
                        );
                    }
                    return null;
                }
            }
        );
    }
 
Example #20
Source File: TestTableReader.java    From kamike.divide with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ArrayList<TestTable> find(TestTable t) {
    KamiGenericSelect<TestTable> select = createSelect();

    KamiResultSet rs = null;

    ArrayList<TestTable> ret = null;
    try {

        select.prepareStatement(select.rawSql() + "where t.count=? ", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        select.setLong(1, t.getCount());
        rs = select.executeQuery();
        ret = select.fetch(rs);

    } catch (Exception e) {
        ret = new ArrayList<>();
        System.out.println(this.getClass().getName() + e.toString());

    } finally {
        try {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (select != null) {
                select.close();
                select = null;
            }

        } catch (Exception ex) {
            Logger.getLogger(BaseReader.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    return ret;

}
 
Example #21
Source File: Type.java    From Gaalop with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Type clone() {
  try {
    return (Type) super.clone();
  } catch (CloneNotSupportedException ex) {
    Logger.getLogger(Type.class.getName()).log(Level.SEVERE, null, ex);
  }
  return null;
}
 
Example #22
Source File: ResourceBundleSearchTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean testGetBundleFromSystemClassLoader(String bundleName) {
    // this should succeed if the bundle is on the system classpath.
    try {
        Logger aLogger = Logger.getLogger(ResourceBundleSearchTest.newLoggerName(),
                bundleName);
    } catch (MissingResourceException re) {
        msgs.add("INFO: testGetBundleFromSystemClassLoader() did not find bundle "
                 + bundleName);
        return false;
    }
    msgs.add("INFO: testGetBundleFromSystemClassLoader() found the bundle "
             + bundleName);
    return true;
}
 
Example #23
Source File: PacketDownloadLang.java    From SubServers-2 with Apache License 2.0 5 votes vote down vote up
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
    Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
    try {
        Util.reflect(SubPlugin.class.getDeclaredField("lang"), plugin, new NamedContainer<>(Calendar.getInstance().getTime().getTime(), data.getObject(0x0001)));
        log.info("Lang Settings Downloaded");
    } catch (IllegalAccessException | NoSuchFieldException e) {
        e.printStackTrace();
    }
}
 
Example #24
Source File: AbstractRestaurantControllerTests.java    From Mastering-Microservices-with-Java-Third-Edition with MIT License 5 votes vote down vote up
/**
 * Test method for findById method
 */
@Test
public void validResturantById() throws Exception {
  Logger.getGlobal().info("Start validResturantById test");
  ResponseEntity<Entity> restaurant = restaurantController.findById(RESTAURANT);

  Assert.assertEquals(HttpStatus.OK, restaurant.getStatusCode());
  Assert.assertTrue(restaurant.hasBody());
  Assert.assertNotNull(restaurant.getBody());
  Assert.assertEquals(RESTAURANT, restaurant.getBody().getId());
  Assert.assertEquals(RESTAURANT_NAME, restaurant.getBody().getName());
  Logger.getGlobal().info("End validResturantById test");
}
 
Example #25
Source File: M_Crypto.java    From fastods with GNU General Public License v3.0 5 votes vote down vote up
public static void cryptoExample() throws IOException {
    // >> BEGIN TUTORIAL (directive to extract part of a tutorial from this file)
    // # Encrypt an ODS file
    //
    // In LibreOffice, you can protect a file with a password. This is the "Save with password"
    // option in the *Save As* dialog box. Note that this has nothing to do with the "Tools >
    // Protect Spreadsheet/Protect Sheet" options. The "Save with password" option really
    // encrypts the data, while the "Protect Spreadsheet/Protect Sheet" options are easy to
    // bypass.
    //
    // The file encryption is regarded as robust: the key derivation function is PBKDF2 using
    // HMAC-SHA-1 and 100,000 iterations; the encryption algorithm is AES256 (Cipher block
    // chaining mode). To make a long story short: if you use a strong password and loose it,
    //
    // FastODS provides a `fastods-crypto` module (that has a dependency to Bouncy Castle APIs)
    // to encrypt an ODS file. *This module is still in beta version.*
    //
    // First, we create a simple document, similar to the "Hello, world!" example:
    final OdsFactory odsFactory = OdsFactory.create(Logger.getLogger("hello-world"), Locale.US);
    final AnonymousOdsFileWriter writer = odsFactory.createWriter();
    final OdsDocument document = writer.document();
    final Table table = document.addTable("hello-world-crypto");
    final TableRowImpl row = table.getRow(0);
    final TableCell cell = row.getOrCreateCell(0);
    cell.setStringValue("Hello, world!");
    //
    // Second, we save it with encryption. This is easy: the module provides a class
    // `ZipUTF8CryptoWriterBuilder` that implements `ZipUTF8WriterBuilder` and encrypts the
    // data:
    //
    final char[] password = {'1', '2', '3'};
    writer.saveAs(new File("generated_files", "m_hello_world_crypto_example.ods"),
            new ZipUTF8CryptoWriterBuilder(password));
    Arrays.fill(password, '\0'); // clear sensitive data.
    //
    // (The password in this example is "123", but you'd better choose another password.)
    //
    // << END TUTORIAL (directive to extract part of a tutorial from this file)
}
 
Example #26
Source File: OdfPackage.java    From incubator-taverna-language with Apache License 2.0 5 votes vote down vote up
/**
 * Close the OdfPackage after it is no longer needed. Even after saving it
 * is still necessary to close the package to have again full access about
 * the file. Closing the OdfPackage will release all temporary created data.
 * Do this as the last action to free resources. Closing an already closed
 * document has no effect.
 */
@Override
public void close() {
	if (mTempDir != null)
		TempDir.deleteTempOdfDirectory(mTempDir);
	try {
		if (mZipFile != null)
			mZipFile.close();
	} catch (IOException ex) {
		// log exception and continue
		Logger.getLogger(OdfPackage.class.getName()).log(INFO, null, ex);
	}
	// release all stuff - this class is impossible to use afterwards
	mZipFile = null;
	mTempDirParent = null;
	mTempDir = null;
	mMediaType = null;
	mPackageEntries = null;
	mZipEntries = null;
	mContentDoms = null;
	mContentStreams = null;
	mTempFiles = null;
	mManifestList = null;
	mManifestEntries = null;
	mBaseURI = null;
	mResolver = null;
}
 
Example #27
Source File: SarlBatchCompiler.java    From sarl with Apache License 2.0 5 votes vote down vote up
private void setStaticField(Class<?> type, String name, org.apache.log4j.Logger logger) {
	try {
		final Field field = type.getDeclaredField(name);
		field.setAccessible(true);
		if ((field.getModifiers() & Modifier.FINAL) == Modifier.FINAL) {
			final Field modifiersField = Field.class.getDeclaredField("modifiers"); //$NON-NLS-1$
			modifiersField.setAccessible(true);
			modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
		}
		field.set(null, logger);
	} catch (Exception exception) {
		reportInternalError(exception.getLocalizedMessage(), exception);
	}
}
 
Example #28
Source File: NbPlatform.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Finds label based on intrinsic metadata in the platform, regardless of user configuration.
 * {@link #computeDisplayName} is used where possible.
 * @see #getLabel
 */
@Messages({"# {0} - folder location", "MSG_InvalidPlatform=Invalid Platform ({0})"})
public static String getComputedLabel(File destdir) {
    try {
        return isPlatformDirectory(destdir) ? computeDisplayName(destdir) : MSG_InvalidPlatform(destdir);
    } catch (IOException e) {
        Logger.getLogger(NbPlatform.class.getName()).log(Level.FINE, "could not get label for " + destdir, e);
        return destdir.getAbsolutePath();
    }
}
 
Example #29
Source File: ClassEntry.java    From baratine with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if the source file has been modified.
 */
@Override
public boolean logModified(Logger log)
{
  if (_depend.logModified(log)) {
    return true;
  }
  else if (_sourcePath == null)
    return false;
    
  else if (_sourcePath.getLastModified() != _sourceLastModified) {
    log.info("source modified time: " + _sourcePath +
             " old:" + new Date(_sourceLastModified) +
             " new:" + new Date(_sourcePath.getLastModified()));

    return true;
  }
  else if (_sourcePath.length() != _sourceLength) {
    log.info("source modified length: " + _sourcePath +
             " old:" + _sourceLength +
             " new:" + _sourcePath.length());

    return true;
  }
  else {
    return false;
  }
}
 
Example #30
Source File: TestLogrbResourceBundle.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}