java.util.logging.Level Java Examples

The following examples show how to use java.util.logging.Level. 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: IndexQueryImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Set<MethodElement> getAllMethods(TypeElement typeElement) {
    final long start = (LOG.isLoggable(Level.FINE)) ? System.currentTimeMillis() : 0;
    final Set<TypeMemberElement> typeMembers =
            getInheritedTypeMembers(typeElement, new LinkedHashSet<TypeElement>(),
            new LinkedHashSet<TypeMemberElement>(getDeclaredMethods(typeElement)),
            EnumSet.of(PhpElementKind.CLASS, PhpElementKind.IFACE, PhpElementKind.TRAIT),
            EnumSet.of(PhpElementKind.METHOD));
    final Set<MethodElement> retval = new HashSet<>();
    for (TypeMemberElement member : typeMembers) {
        if (member instanceof MethodElement) {
            retval.add((MethodElement) member);
        }
    }
    if (LOG.isLoggable(Level.FINE)) {
        logQueryTime("Set<MethodElement> getAllMethods", NameKind.exact(typeElement.getFullyQualifiedName()), start); //NOI18N
    }
    return Collections.unmodifiableSet(retval);
}
 
Example #2
Source File: XmlFactory.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns properly configured (e.g. security features) factory
 * - securityProcessing == is set based on security processing property, default is true
 */
public static XPathFactory createXPathFactory(boolean disableSecureProcessing) throws IllegalStateException {
    try {
        XPathFactory factory = XPathFactory.newInstance();
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, "XPathFactory instance: {0}", factory);
        }
        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing));
        return factory;
    } catch (XPathFactoryConfigurationException ex) {
        LOGGER.log(Level.SEVERE, null, ex);
        throw new IllegalStateException( ex);
    } catch (AbstractMethodError er) {
        LOGGER.log(Level.SEVERE, null, er);
        throw new IllegalStateException(Messages.INVALID_JAXP_IMPLEMENTATION.format(), er);
    }
}
 
Example #3
Source File: Metrics.java    From SubServers-2 with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the first bStat Metrics class.
 *
 * @return The first bStats metrics class.
 */
private Class<?> getFirstBStatsClass() {
    Path configPath = new File(plugin.dir, "plugins").toPath().resolve("bStats");
    configPath.toFile().mkdirs();
    File tempFile = new File(configPath.toFile(), "temp.txt");

    try {
        String className = readFile(tempFile);
        if (className != null) {
            try {
                // Let's check if a class with the given name exists.
                return Class.forName(className);
            } catch (ClassNotFoundException ignored) { }
        }
        writeFile(tempFile, getClass().getName());
        return getClass();
    } catch (IOException e) {
        if (logFailedRequests) {
            plugin.getLogger().log(Level.WARNING, "Failed to get first bStats class!", e);
        }
        return null;
    }
}
 
Example #4
Source File: CheckmobiCLIVerifyProvider.java    From tigase-extension with GNU General Public License v3.0 6 votes vote down vote up
/** Parameters <code>proof</code> is ignored. */
@Override
public boolean endVerification(XMPPResourceConnection session, RegistrationRequest request, String proof) throws IOException, TigaseDBException {
    CheckmobiValidationClient client = CheckmobiValidationClient.callerID(apiKey);

    if (log.isLoggable(Level.FINEST)) {
        log.finest("Checking verification status from CheckMobi: " + request);
    }

    CheckmobiRequest myRequest = (CheckmobiRequest) request;
    StatusResult result = client.status(myRequest.getId());
    if (result != null) {
        if (result.getStatus() == StatusResult.STATUS_SUCCESS) {
            return result.isValidated();
        }
        else {
            throw new IOException("verification did not start (" + result.getError() + ")");
        }
    }
    else {
        throw new IOException("Unknown response");
    }
}
 
Example #5
Source File: MesosRemoteManagerCodec.java    From reef with Apache License 2.0 6 votes vote down vote up
@Override
public byte[] encode(final EvaluatorControl evaluatorControl) {
  try {
    LOG.log(Level.FINEST, "Before Encoding: {0}", evaluatorControl.toString());
    final ByteArrayOutputStream out = new ByteArrayOutputStream();
    final BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(out, null);
    final DatumWriter<EvaluatorControl> writer = new SpecificDatumWriter<>(EvaluatorControl.getClassSchema());
    writer.write(evaluatorControl, encoder);
    encoder.flush();
    out.close();
    LOG.log(Level.FINEST, "After Encoding");
    return out.toByteArray();
  } catch (final IOException ex) {
    throw new RemoteRuntimeException(ex);
  }
}
 
Example #6
Source File: MergePanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void addEmptyLines(StyledDocument doc, int line, int numLines) {
    int lastOffset = doc.getEndPosition().getOffset();
    int totLines = org.openide.text.NbDocument.findLineNumber(doc, lastOffset);
    //int totLines = doc.getDefaultRootElement().getElementIndex(lastOffset);
    int offset = lastOffset;
    if (line <= totLines) {
        offset = org.openide.text.NbDocument.findLineOffset(doc, line);
        //offset = doc.getDefaultRootElement().getElement(line).getStartOffset();
    } else {
        offset = lastOffset - 1;
        Logger logger = Logger.getLogger(MergePanel.class.getName());
        logger.log(Level.WARNING, "line({0}) > totLines({1}): final offset({2})", new Object[] {line, totLines, offset}); //NOI18N
        logger.log(Level.INFO, null, new Exception());
    }
    //int endOffset = doc.getEndPosition().getOffset();
    //if (offset > endOffset) offset = endOffset;
    String insStr = strCharacters('\n', numLines);
    //System.out.println("addEmptyLines = '"+insStr+"'");
    try {
        doc.insertString(offset, insStr, null);
    } catch (BadLocationException e) {
        org.openide.ErrorManager.getDefault().notify(e);
    }
    //initScrollBars();
}
 
Example #7
Source File: DesaElement.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Generates children of this element
 *
 */
@Override
public void fillChildren() throws MetsExportException {
    Node node = MetsUtils.xPathEvaluateNode(relsExt, "*[local-name()='RDF']/*[local-name()='Description']");
    NodeList hasPageNodes = node.getChildNodes();
    for (int a = 0; a < hasPageNodes.getLength(); a++) {
        if (MetsUtils.hasReferenceXML(hasPageNodes.item(a).getNodeName())) {
            Node rdfResourceNode = hasPageNodes.item(a).getAttributes().getNamedItem("rdf:resource");
            String fileName = rdfResourceNode.getNodeValue();

            DigitalObject object = null;
            if (desaContext.getFedoraClient() != null) {
                object = MetsUtils.readRelatedFoXML(fileName, desaContext.getFedoraClient());
            } else {
                object = MetsUtils.readRelatedFoXML(desaContext.getPath(), fileName);
            }
            DesaElement child = new DesaElement(object, this, desaContext, true);
            this.children.add(child);
            LOG.log(Level.FINE, "Child found for:" + getOriginalPid() + "(" + getElementType() + ") - " + child.getOriginalPid() + "(" + child.getElementType() + ")");
        }
    }
}
 
Example #8
Source File: NumberColorMaps.java    From diirt with MIT License 6 votes vote down vote up
private static List<NumberColorMap> loadMapsFromLocal() {
    List<NumberColorMap> maps = new ArrayList<>();
    File path = new File(Configuration.getDirectory(), "graphene/colormaps");
    // If maps are not there, create them first
    if (!path.exists()) {
        path.mkdirs();

        log.log(Level.CONFIG, "Creating path graphene/colormaps under DIIRT_HOME ");
        initializeColorMapDirectory(path);
    }
    // Load maps from local directory
    log.log(Level.CONFIG, "Loading ColorMaps from directory: " + path);
    for (File file : path.listFiles()) {

        log.log(Level.CONFIG, "Loading ColorMap from file: " + file);
        try {
            maps.add(load(file));
        } catch (RuntimeException ex) {
            log.log(Level.WARNING, ex.getMessage());
        }

    }

    return maps;
}
 
Example #9
Source File: ProfilerTest.java    From copybara with Apache License 2.0 6 votes vote down vote up
@Test
public void testListenerLogging() {
  // Keep a strong reference to the Logger we use to capture log records for the duration of the
  // test to avoid any potential race conditions with the weak referencing used by the JDK
  //
  // TODO: This could be migrated to use the package level logger name, which would be less
  // fragile against code being moved around.
  Logger loggerUnderTest = Logger.getLogger(LogProfilerListener.class.getCanonicalName());

  TestLogHandler assertingHandler = new TestLogHandler();
  assertingHandler.setLevel(Level.FINE);
  loggerUnderTest.addHandler(assertingHandler);

  profiler = new Profiler(ticker);
  profiler.init(ImmutableList.of(new LogProfilerListener()));
  try (ProfilerTask ignore = profiler.start("testListenerLogging")) {
    // do something
  }
  LogRecord record = assertingHandler.getStoredLogRecords().get(0);
  assertThat(record.getMessage()).contains("testListenerLogging");
  assertThat(record.getSourceClassName()).contains(this.getClass().getName());

  loggerUnderTest.removeHandler(assertingHandler);
}
 
Example #10
Source File: RedisShardSubscriber.java    From bazel-buildfarm with Apache License 2.0 6 votes vote down vote up
void onOperationChange(String channel, OperationChange operationChange) {
  // FIXME indicate lag/clock skew for OOB timestamps
  switch (operationChange.getTypeCase()) {
    case TYPE_NOT_SET:
      // FIXME present nice timestamp
      logger.log(
          Level.SEVERE,
          format(
              "OperationChange oneof type is not set from %s at %s",
              operationChange.getSource(), operationChange.getEffectiveAt()));
      break;
    case RESET:
      resetOperation(channel, operationChange.getReset());
      break;
    case EXPIRE:
      terminateExpiredWatchers(
          channel,
          toInstant(operationChange.getEffectiveAt()),
          operationChange.getExpire().getForce());
      break;
  }
}
 
Example #11
Source File: SimpleDocumentProcessor.java    From vespa with Apache License 2.0 6 votes vote down vote up
/**
 * Simple process() that follows the official guidelines for
 * looping over {@link DocumentOperation}s, and then calls the appropriate,
 * overloaded process() depending on the type of base.
 * <p>
 * Declared as final, so if you want to handle everything yourself
 * you should of course extend DocumentProcessor instead of
 * SimpleDocumentProcessor and just go about as usual.
 * <p>
 * It is important to note that when iterating over the {@link DocumentOperation}s in
 * {@link com.yahoo.docproc.Processing#getDocumentOperations()}, an exception thrown
 * from any of the process() methods provided by this class will be thrown straight
 * out of this here. This means that failing one document will fail the
 * entire batch.
 *
 * @param processing the Processing to process.
 * @return Progress.DONE, unless a subclass decides to throw an exception
 */
@Override
public final Progress process(Processing processing) {
    int initialSize = processing.getDocumentOperations().size();
    for (DocumentOperation op : processing.getDocumentOperations()) {
        try {
            if (op instanceof DocumentPut) {
                process((DocumentPut) op);
            } else if (op instanceof DocumentUpdate) {
                process((DocumentUpdate) op);
            } else if (op instanceof DocumentRemove) {
                process((DocumentRemove) op);
            }
        } catch (RuntimeException e) {
            if (log.isLoggable(Level.FINE) && initialSize != 1) {
                log.log(Level.FINE,
                        "Processing of document failed, from processing.getDocumentOperations() containing " +
                        initialSize + " DocumentOperation(s).", e);
            }
            throw e;
        }
    }

    return Progress.DONE;
}
 
Example #12
Source File: SolrWaveIndexerImpl.java    From swellrt with Apache License 2.0 6 votes vote down vote up
@Override
public ListenableFuture<Void> onWaveInit(final WaveletName waveletName) {

  ListenableFutureTask<Void> task = ListenableFutureTask.create(new Callable<Void>() {

    @Override
    public Void call() throws Exception {
      ReadableWaveletData waveletData;
      try {
        waveletData = waveletDataProvider.getReadableWaveletData(waveletName);
        updateIndex(waveletData);
      } catch (WaveServerException e) {
        LOG.log(Level.SEVERE, "Failed to initialize index for " + waveletName, e);
        throw e;
      }
      return null;
    }
  });
  executor.execute(task);
  return task;
}
 
Example #13
Source File: SparseMatrix.java    From JSAT with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void mutableAdd(final double c, ExecutorService threadPool)
{
    final CountDownLatch latch = new CountDownLatch(rows.length);
    for(final SparseVector row : rows)
    {
        threadPool.submit(new Runnable()
        {
            @Override
            public void run()
            {
                row.mutableAdd(c);
                latch.countDown();
            }
        });
    }
    try
    {
        latch.await();
    }
    catch (InterruptedException ex)
    {
        Logger.getLogger(SparseMatrix.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
Example #14
Source File: QueryClient.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
public void query(String name) {
  try {
    QueryRequest request = QueryRequest.newBuilder().setNo(10).setName(name).setAlias(name + "-alias")
  		  .setSex(true).setSalary(1.234f).setTotal(1234).setDesc("aaaa").setMisc("bbbb").build();
    QueryReply response = blockingStub.query(request);
    System.out.println(response.getMessage());
  } catch (Exception e) {
    logger.log(Level.SEVERE, e.getMessage(), e);
  }
}
 
Example #15
Source File: RunnableProcess.java    From reef with Apache License 2.0 5 votes vote down vote up
/**
 * Cancels the running process if it is running.
 */
public void cancel() {

  this.stateLock.lock();

  try {

    if (this.state == RunnableProcessState.RUNNING) {
      this.process.destroy();
      if (!this.doneCond.await(DESTROY_WAIT_TIME, TimeUnit.MILLISECONDS)) {
        LOG.log(Level.FINE, "{0} milliseconds elapsed", DESTROY_WAIT_TIME);
      }
    }

    if (this.state == RunnableProcessState.RUNNING) {
      LOG.log(Level.WARNING, "The child process survived Process.destroy()");
      if (OSUtils.isUnix() || OSUtils.isWindows()) {
        LOG.log(Level.WARNING, "Attempting to kill the process via the kill command line");
        try {
          final long pid = readPID();
          OSUtils.kill(pid);
        } catch (final IOException | InterruptedException | NumberFormatException e) {
          LOG.log(Level.SEVERE, "Unable to kill the process.", e);
        }
      }
    }

  } catch (final InterruptedException ex) {
    LOG.log(Level.SEVERE,
        "Interrupted while waiting for the process \"{0}\" to complete. Exception: {1}",
        new Object[] {this.id, ex});
  } finally {
    this.stateLock.unlock();
  }
}
 
Example #16
Source File: BerkeleyDB.java    From SPADE with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Set<String> getParents(String childHash)
{
    try
    {
        // Instantiate class catalog
        StoredClassCatalog neighborCatalog = new StoredClassCatalog(neighborDatabase);
        // Create the binding
        EntryBinding<Neighbors> neighborBinding = new SerialBinding<>(neighborCatalog, Neighbors.class);
        // Create DatabaseEntry for the key
        DatabaseEntry key = new DatabaseEntry(childHash.getBytes("UTF-8"));
        // Create the DatabaseEntry for the data.
        DatabaseEntry data = new DatabaseEntry();
        // query database to get the key-value
        OperationStatus operationStatus = scaffoldDatabase.get(null, key, data, LockMode.DEFAULT);
        if(operationStatus != OperationStatus.NOTFOUND)
        {
            Neighbors neighbors = neighborBinding.entryToObject(data);
            return neighbors.parents;
        }
    }
    catch (UnsupportedEncodingException ex)
    {
        logger.log(Level.SEVERE, "Scaffold entry insertion error!", ex);
    }
    return null;
}
 
Example #17
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 #18
Source File: ConfigUpdater.java    From BetonQuest with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unused")
private void update_from_v7() {
    ConfigAccessor messages = ch.getConfigs().get("messages");
    messages.getConfig().set("global.date_format", "dd.MM.yyyy HH:mm");
    messages.saveConfig();
    LogUtils.getLogger().log(Level.INFO, "Added date format line to messages.yml");
    config.set("version", "v8");
    instance.saveConfig();
}
 
Example #19
Source File: WLJpa2SwitchSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void replaceManifest(File jarFile, Manifest manifest) throws IOException {
    FileObject fo = FileUtil.toFileObject(jarFile);
    String tmpName = FileUtil.findFreeFileName(fo.getParent(),
            jarFile.getName(), "tmp"); // NOI18N
    File tmpJar = new File(jarFile.getParentFile(), tmpName + ".tmp"); // NOI18N
    try {
        InputStream is = new BufferedInputStream(
                new FileInputStream(jarFile));
        try {
            OutputStream os = new BufferedOutputStream(
                    new FileOutputStream(tmpJar));
            try {
                replaceManifest(is, os, manifest);
            } finally {
                os.close();
            }
        } finally {
            is.close();
        }

        if (tmpJar.renameTo(jarFile)) {
            LOGGER.log(Level.FINE, "Successfully moved {0}", tmpJar);
            return;
        }
        LOGGER.log(Level.FINE, "Byte to byte copy {0}", tmpJar);
        copy(tmpJar, jarFile);
    } finally {
        tmpJar.delete();
    }
}
 
Example #20
Source File: UnixTimestampDeserializer.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Instant deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    String timestamp = jp.getText().trim();
    try {
        return Instant.ofEpochMilli(Long.valueOf(timestamp));
    } catch (NumberFormatException e) {
        logger.log(Level.WARNING, "Unable to deserialize timestamp: " + timestamp, e);
        return null;
    }
}
 
Example #21
Source File: VidBullAccount.java    From neembuu-uploader with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void disableLogin() {
    resetLogin();
    hostsAccountUI().hostUI(HOSTNAME).setEnabled(false);
    hostsAccountUI().hostUI(HOSTNAME).setSelected(false);
    updateSelectedHostsLabel();
    NULogger.getLogger().log(Level.INFO, "{0} account disabled", getHOSTNAME());
}
 
Example #22
Source File: SnmpAdaptorServer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private SnmpInformRequest snmpInformRequest(InetAddress addr,
                                            int port,
                                            String cs,
                                            SnmpInformHandler cb,
                                            SnmpOid trapOid,
                                            SnmpVarBindList varBindList)
    throws IllegalStateException, IOException, SnmpStatusException {

    if (!isActive()) {
        throw new IllegalStateException(
          "Start SNMP adaptor server before carrying out this operation");
    }
    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpInformRequest", "trapOid=" + trapOid);
    }

    // First, make an SNMP inform pdu:
    // We clone varBindList and insert sysUpTime and snmpTrapOid variables.
    //
    SnmpVarBindList fullVbl ;
    if (varBindList != null)
        fullVbl = varBindList.clone() ;
    else
        fullVbl = new SnmpVarBindList(2) ;
    SnmpTimeticks sysUpTimeValue = new SnmpTimeticks(getSysUpTime()) ;
    fullVbl.insertElementAt(new SnmpVarBind(snmpTrapOidOid, trapOid), 0) ;
    fullVbl.insertElementAt(new SnmpVarBind(sysUpTimeOid, sysUpTimeValue),
                            0);

    // Next, send the pdu to the specified destination
    //
    openInformSocketIfNeeded() ;
    return informSession.makeAsyncRequest(addr, cs, cb, fullVbl, port) ;
}
 
Example #23
Source File: AbstractFileServiceProvider.java    From diirt with MIT License 5 votes vote down vote up
/**
 * Creates all the service instances by crawling the configuration
 * directory, creating a service for each file found, and creating
 * the additional services.
 * <p>
 * Given that this method provides the error handling and logging, it
 * is declared final so that subclasses cannot accidently remove it.
 *
 * @return the new service instances
 */
@Override
public final Collection<Service> createServices() {
    List<Service> services = new ArrayList<>();
    File path = directory;
    if (path == null) {
        path = getDefaultConfigurationDirectory();
    }
    if (path.exists()) {
        if (path.isDirectory()) { // We have a configuration directory
            log.log(Level.CONFIG, "Loading {0} services from ''{1}''", new Object[] {getName(), path});
            for (File file : path.listFiles()) {
                try {
                    Service service = createService(file);
                    if (service != null) {
                        services.add(service);
                        log.log(Level.CONFIG, "Created {0} service ''{1}'' from ''{2}''", new Object[] {getName(), service.getName(), file.getName()});
                    }
                } catch (Exception ex) {
                    log.log(Level.WARNING, "Failed to create " + getName() + " service from '" + file + "'", ex);
                }
            }
        } else { // The path is not a directory
            log.log(Level.WARNING, "Configuration path for {0} services ''{1}'' is not a directory", new Object[] {getName(), path});
        }
    } else { // The path does not exist
        path.mkdirs();
        log.log(Level.CONFIG, "Creating configuration path for {0} services at ''{1}''", new Object[] {getName(), path});
    }
    for (Service additionalService : additionalServices()) {
        services.add(additionalService);
        log.log(Level.CONFIG, "Created {0} service ''{1}''", new Object[] {getName(), additionalService.getName()});
    }

    log.log(Level.CONFIG, "Created {0} {1} services", new Object[] {services.size(), getName()});
    return services;
}
 
Example #24
Source File: SpringWebModuleExtender.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private boolean isWebXmlValid(WebModule webModule) {
    FileObject webXml = webModule.getDeploymentDescriptor();
    if (webXml == null) {
        return true;
    }
    WebApp webApp = null;
    try {
        webApp = DDProvider.getDefault().getDDRoot(webXml);
    } catch (IOException ex) {
        LOGGER.log(Level.INFO, "Can't read web.xml file: " + webXml.getPath(), ex);
    }
    return webApp != null && webApp.getStatus() == WebApp.STATE_VALID;
}
 
Example #25
Source File: HandlerChainInvoker.java    From cxf with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private boolean invokeReversedHandleFault(MessageContext ctx) {
    boolean continueProcessing = true;

    try {
        int index = invokedHandlers.size() - 2;
        while (index >= 0 && continueProcessing) {
            Handler<? extends MessageContext> h = invokedHandlers.get(index);
            if (h instanceof LogicalHandler) {
                LogicalHandler<LogicalMessageContext> lh = (LogicalHandler<LogicalMessageContext>)h;
                continueProcessing = lh.handleFault(logicalMessageContext);
            } else {
                Handler<MessageContext> ph = (Handler<MessageContext>)h;
                continueProcessing = ph.handleFault(protocolMessageContext);
            }

            if (!continueProcessing) {
                invokeReversedClose();
                break;
            }
            index--;
        }
    } catch (RuntimeException e) {
        LOG.log(Level.WARNING, "HANDLER_RAISED_RUNTIME_EXCEPTION", e);
        invokeReversedClose();
        continueProcessing = false;
        closed = true;

        throw e;
    }
    invokeReversedClose();
    return continueProcessing;
}
 
Example #26
Source File: MarsProject.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * The starting method for the application
 *
 * @param args the command line arguments
 */
public static void main(String[] args) throws IOException, InterruptedException, URISyntaxException {

	Logger.getLogger("").setLevel(Level.FINE);

	MarsProject.args = args;

	/*
	 * [landrus, 27.11.09]: Read the logging configuration from the classloader, so
	 * that this gets webstart compatible. Also create the logs dir in user.home
	 */
	new File(System.getProperty("user.home"), ".mars-sim" + File.separator + "logs").mkdirs();

	try {
		LogManager.getLogManager().readConfiguration(MarsProject.class.getResourceAsStream(LOGGING_PROPERTIES));
	} catch (IOException e) {
		logger.log(Level.WARNING, "Could not load logging properties", e);
		try {
			LogManager.getLogManager().readConfiguration();
		} catch (IOException e1) {
			logger.log(Level.WARNING, "Could read logging default config", e);
		}
	}

	// general text antialiasing
	System.setProperty("swing.aatext", "true");
	System.setProperty("awt.useSystemAAFontSettings", "lcd"); // for newer VMs

	// starting the simulation
	new MarsProject(args);
}
 
Example #27
Source File: FileLogger.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
private void backupLog() {
    try {
        File bkp = new File(logBackupLoc);
        if (!bkp.exists()) {
            bkp.mkdirs();
        }
        String filename = "log-" + getdatetimeString() + ".txt";
        Files.move(new File(logfile).toPath(), new File(bkp, filename).toPath());
    } catch (IOException ex) {
        java.util.logging.Logger.getLogger(FileLogger.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
Example #28
Source File: PeakListIdentificationTask.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void run() {

  if (!isCanceled()) {
    try {

      setStatus(TaskStatus.PROCESSING);

      // Create database gateway.
      gateway = db.getModule().getGatewayClass().getDeclaredConstructor().newInstance();

      // Identify the feature list rows starting from the biggest
      // peaks.
      final PeakListRow[] rows = peakList.getRows().toArray(PeakListRow[]::new);
      Arrays.sort(rows, new PeakListRowSorter(SortingProperty.Area, SortingDirection.Descending));

      // Initialize counters.
      numItems = rows.length;

      // Process rows.
      for (finishedItems = 0; !isCanceled() && finishedItems < numItems; finishedItems++) {

        // Retrieve results for each row.
        retrieveIdentification(rows[finishedItems]);
      }

      if (!isCanceled()) {
        setStatus(TaskStatus.FINISHED);
      }
    } catch (Throwable t) {

      final String msg = "Could not search " + db;
      logger.log(Level.WARNING, msg, t);
      setStatus(TaskStatus.ERROR);
      setErrorMessage(msg + ": " + ExceptionUtils.exceptionToString(t));
    }
  }
}
 
Example #29
Source File: FXMLTemplateAttributesProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, ?> attributesFor(DataObject template, DataFolder target, String name) {
    FileObject templateFO = template.getPrimaryFile();
    if (!JFXProjectProperties.FXML_EXTENSION.equals(templateFO.getExt()) || templateFO.isFolder()) {
        return null;
    }
    
    FileObject targetFO = target.getPrimaryFile();
    Map<String,Object> result = new HashMap<String,Object>();
    
    ClassPath cp = ClassPath.getClassPath(targetFO, ClassPath.SOURCE);
    if (cp == null) {
        LOG.log(
            Level.WARNING,
            "No classpath was found for folder: {0}",   // NOI18N
            FileUtil.getFileDisplayName(targetFO));
    } else if (cp.findOwnerRoot(targetFO) == null) {
        LOG.log(
            Level.WARNING,
            "Folder {0} is not on its classpath: {1}",  // NOI18N
            new Object[] {
                FileUtil.getFileDisplayName(targetFO),
                cp.toString(ClassPath.PathConversionMode.PRINT)
            });
    }
    else {
        result.put("package", cp.getResourceName(targetFO, '.', false)); // NOI18N
    }
    
    return result;
}
 
Example #30
Source File: UploadedDotToAccount.java    From neembuu-uploader with GNU General Public License v3.0 5 votes vote down vote up
private void initialize() throws Exception{
    httpContext = new BasicHttpContext();
    cookieStore = new BasicCookieStore();
    httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
    
    NULogger.getLogger().info("Getting startup cookie from uploaded.net");
    responseString = NUHttpClientUtils.getData("http://uploaded.net/", httpContext);
    phpsessioncookie = CookieUtils.getCookieValue(httpContext, "PHPSESSID");

    NULogger.getLogger().log(Level.INFO, "phpsessioncookie: {0}", phpsessioncookie);
}