Java Code Examples for java.util.logging.Level

The following are top voted examples for showing how to use java.util.logging.Level. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Burp-Hunter   File: HunterRequest.java   View source code 8 votes vote down vote up
public String notifyHunter(byte[] content) throws IOException {
    try {
        String request = new String(content);
        SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, (certificate, authType) -> true).build();
        HttpClient httpclient = HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier(new NoopHostnameVerifier()).build();
        HttpPost httpPost = new HttpPost("https://api"+hunterDomain.substring(hunterDomain.indexOf("."))+"/api/record_injection");
        String json = "{\"request\": \""+request.replace("\\", "\\\\").replace("\"", "\\\"").replace("\r\n", "\\n")+"\", \"owner_correlation_key\": \""+hunterKey+"\", \"injection_key\": \""+injectKey+"\"}";
        StringEntity entity = new StringEntity(json);
        entity.setContentType("applicaiton/json");
        httpPost.setEntity(entity);
        HttpResponse response = httpclient.execute(httpPost);
        String responseString = new BasicResponseHandler().handleResponse(response);
        return responseString;
    } catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException ex) {
        
        Logger.getLogger(HunterRequest.class.getName()).log(Level.SEVERE, null, ex);
    }
    return "Error Notifying Probe Server!";
}
 
Example 2
Project: G2Dj   File: Resources.java   View source code 7 votes vote down vote up
public static final Image loadImage(final String aFileName)
{
    Debug.log(aFileName);
    String name = aFileName.substring(aFileName.lastIndexOf('/') + 1);
    String path = sanitizeFilePath(aFileName);
    
    //.if DESKTOP
    BufferedImage data = null;
    try{data=ImageIO.read(Resources.class.getResource(path));}
    catch (IOException ex) {Logger.getLogger(Resources.class.getName()).log(Level.SEVERE, null, ex);}
    //.elseif ANDROID
    //|android.graphics.Bitmap data = null;
    //|Debug.log("Resources.loadImage*********************************");
    //|Debug.log(path);

    //|InputStream dataStream = Mobile.loadAsset(path);

    //|data = BitmapFactory.decodeStream(dataStream);

    //|Debug.log(data.getByteCount());

    //.endif

    return new Image(name,data);
    
}
 
Example 3
Project: LogiGSK   File: Encryption.java   View source code 7 votes vote down vote up
public static String encrypt(String decryptedString, String password) {
    try {
        // build the initialization vector (randomly).
        SecureRandom random = new SecureRandom();
        byte initialVector[] = new byte[16];
        //generate random 16 byte IV AES is always 16bytes
        random.nextBytes(initialVector);
        IvParameterSpec ivspec = new IvParameterSpec(initialVector);
        SecretKeySpec skeySpec = new SecretKeySpec(password.getBytes("UTF-8"), "AES");
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
        cipher.init(Cipher.ENCRYPT_MODE, skeySpec, ivspec);
        byte[] encrypted = cipher.doFinal(decryptedString.getBytes());
        byte[] encryptedWithIV = new byte[encrypted.length + initialVector.length];
        System.arraycopy(encrypted, 0, encryptedWithIV, 0, encrypted.length);
        System.arraycopy(initialVector, 0, encryptedWithIV, encrypted.length, initialVector.length);
        return Base64.encodeBase64String(encryptedWithIV);
    } catch (Exception ex) {
        Logger.getLogger(Encryption.class.getName()).log(Level.SEVERE, null, ex);
        return "Error";
    }
}
 
Example 4
Project: PetBlocks   File: SkinHelper.java   View source code 6 votes vote down vote up
public static void setItemStackSkin(ItemStack itemStack, String skin) {
    final ItemMeta meta = itemStack.getItemMeta();
    if (!(meta instanceof SkullMeta)) {
        return;
    }

    String newSkin = skin;
    if (newSkin.contains("textures.minecraft.net")) {
        if (!newSkin.startsWith("http://")) {
            newSkin = "http://" + newSkin;
        }
        try {
            final Class<?> cls = createClass("org.bukkit.craftbukkit.VERSION.inventory.CraftMetaSkull");
            final Object real = cls.cast(meta);
            final Field field = real.getClass().getDeclaredField("profile");
            field.setAccessible(true);
            field.set(real, getNonPlayerProfile(newSkin));
            itemStack.setItemMeta(SkullMeta.class.cast(real));
        } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException | ClassNotFoundException e) {
            Bukkit.getLogger().log(Level.WARNING, "Failed to set url of itemstack.", e);
        }
    } else {
        ((SkullMeta) meta).setOwner(skin);
        itemStack.setItemMeta(meta);
    }
}
 
Example 5
Project: jdk8u-jdk   File: TestIsLoggable.java   View source code 6 votes vote down vote up
public void loglevel(Level l, Logger logger, String message) {
    LogTest test = LogTest.valueOf("LEV_"+l.getName());
    switch(test) {
        case LEV_SEVERE:
            logger.severe(message);
            break;
        case LEV_WARNING:
            logger.warning(message);
            break;
        case LEV_INFO:
            logger.info(message);
            break;
        case LEV_CONFIG:
            logger.config(message);
            break;
        case LEV_FINE:
            logger.fine(message);
            break;
        case LEV_FINER:
            logger.finer(message);
            break;
        case LEV_FINEST:
            logger.finest(message);
            break;
    }
}
 
Example 6
Project: incubator-netbeans   File: GsfFoldManager.java   View source code 6 votes vote down vote up
private boolean addFoldsOfType(
            String type, Map<String,List<OffsetRange>> folds,
            Collection<FoldInfo> result,
            FoldType foldType) {
    
    List<OffsetRange> ranges = folds.get(type); //NOI18N
    if (ranges != null) {
        if (LOG.isLoggable(Level.FINEST)) {
            LOG.log(Level.FINEST, "Creating folds {0}", new Object[] {
                type
            });
        }
        for (OffsetRange range : ranges) {
            if (LOG.isLoggable(Level.FINEST)) {
                LOG.log(Level.FINEST, "Fold: {0}", range);
            }
            addFold(range, result, foldType);
        }
        folds.remove(type);
        return true;
    } else {
        LOG.log(Level.FINEST, "No folds of type {0}", type);
        return false;
    }
}
 
Example 7
Project: incubator-netbeans   File: ReplaceBar.java   View source code 6 votes vote down vote up
private void replace(boolean replaceAll) {
    searchBar.updateIncSearchComboBoxHistory(searchBar.getIncSearchTextField().getText());
    this.updateReplaceComboBoxHistory(replaceTextField.getText());

    EditorFindSupport findSupport = EditorFindSupport.getInstance();
    Map<String, Object> findProps = new HashMap<>();
    findProps.putAll(searchBar.getSearchProperties());
    findProps.put(EditorFindSupport.FIND_REPLACE_WITH, replaceTextField.getText());
    findProps.put(EditorFindSupport.FIND_BACKWARD_SEARCH, backwardsCheckBox.isSelected());
    findProps.put(EditorFindSupport.FIND_PRESERVE_CASE, preserveCaseCheckBox.isSelected() && preserveCaseCheckBox.isEnabled());
    findSupport.putFindProperties(findProps);
    if (replaceAll) {
        findSupport.replaceAll(findProps);
    } else {
        try {
            findSupport.replace(findProps, false);
            findSupport.find(findProps, false);
        } catch (GuardedException ge) {
            LOG.log(Level.FINE, null, ge);
            Toolkit.getDefaultToolkit().beep();
        } catch (BadLocationException ble) {
            LOG.log(Level.WARNING, null, ble);
        }
    }
}
 
Example 8
Project: task-app   File: TaskDaoImpl.java   View source code 6 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void incStepToTotal(Long taskId) {
    Connection connection = null;

    try {
        connection = ds.getConnection();

        Column currentTimestamp = new ColumnFunction("id", "current_timestamp", DataType.DATE);

        new PostgreSqlBuilder().update(connection, Query
                .UPDATE(TABLE.JMD_TASK())
                .SET(JMD_TASK.LAST_UPDATE(), currentTimestamp)
                .SET(JMD_TASK.ACTUAL_STEP(), JMD_TASK.TOTAL_STEP())
                .WHERE(JMD_TASK.ID(), Condition.EQUALS, taskId)
        );
    } catch (SQLException e) {
        LOGGER.log(Level.SEVERE, e.toString(), e);
        throw new RuntimeException(e);
    } finally {
        SqlUtil.close(connection);
    }
}
 
Example 9
Project: CrashCoin   File: Block.java   View source code 6 votes vote down vote up
/**
 * Get a JSON representation of the Block instance *
 */
@Override
public JSONObject toJSON() {
    final JSONObject json = JSONable.super.toJSON();
    json.put("previousBlock", JsonUtils.encodeBytes(previousBlock));
    json.put("difficulty", difficulty);
    json.put("nonce", nonce);
    json.put("merkleRoot", JsonUtils.encodeBytes(merkleRoot));

    try {
        final JSONArray jArray = new JSONArray();
        for (final Transaction trans : this) {
            jArray.put(trans.toJSON());
        }
        json.put("listTransactions", jArray);
    } catch (JSONException jse) {
        Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, jse);
    }
    return json;
}
 
Example 10
Project: OpenJSharp   File: AbstractSchemaValidationTube.java   View source code 6 votes vote down vote up
/**
 * Adds inscope namespaces as attributes to  <xsd:schema> fragment nodes.
 *
 * @param nss namespace context info
 * @param elem that is patched with inscope namespaces
 */
private @Nullable void patchDOMFragment(NamespaceSupport nss, Element elem) {
    NamedNodeMap atts = elem.getAttributes();
    for( Enumeration en = nss.getPrefixes(); en.hasMoreElements(); ) {
        String prefix = (String)en.nextElement();

        for( int i=0; i<atts.getLength(); i++ ) {
            Attr a = (Attr)atts.item(i);
            if (!"xmlns".equals(a.getPrefix()) || !a.getLocalName().equals(prefix)) {
                if (LOGGER.isLoggable(Level.FINE)) {
                    LOGGER.log(Level.FINE, "Patching with xmlns:{0}={1}", new Object[]{prefix, nss.getURI(prefix)});
                }
                elem.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:"+prefix, nss.getURI(prefix));
            }
        }
    }
}
 
Example 11
Project: L2J-Global   File: Post.java   View source code 6 votes vote down vote up
public void insertindb(CPost cp)
{
	try (Connection con = DatabaseFactory.getInstance().getConnection();
		PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"))
	{
		ps.setInt(1, cp.postId);
		ps.setString(2, cp.postOwner);
		ps.setInt(3, cp.postOwnerId);
		ps.setLong(4, cp.postDate);
		ps.setInt(5, cp.postTopicId);
		ps.setInt(6, cp.postForumId);
		ps.setString(7, cp.postTxt);
		ps.execute();
	}
	catch (Exception e)
	{
		LOGGER.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e);
	}
}
 
Example 12
Project: incubator-netbeans   File: MacProvider.java   View source code 6 votes vote down vote up
private static void error(String msg, int code) {
    if (code != 0 && code != /* errSecItemNotFound, always returned from find it seems */-25300) {
        Pointer translated = SecurityLibrary.LIBRARY.SecCopyErrorMessageString(code, null);
        String str;
        if (translated == null) {
            str = String.valueOf(code);
        } else {
            char[] buf = new char[(int) SecurityLibrary.LIBRARY.CFStringGetLength(translated)];
            for (int i = 0; i < buf.length; i++) {
                buf[i] = SecurityLibrary.LIBRARY.CFStringGetCharacterAtIndex(translated, i);
            }
            SecurityLibrary.LIBRARY.CFRelease(translated);
            str = new String(buf) + " (" + code + ")";
        }
        LOG.log(Level.WARNING, "{0}: {1}", new Object[] {msg, str});
    }
}
 
Example 13
Project: SigFW   File: Test_SS7Firewall.java   View source code 6 votes vote down vote up
private static void initializeSS7Firewall() {
    try {
        // Use last config
        SS7FirewallConfig.loadConfigFromFile("ss7fw_junit.json");
        // TODO use the following directive instead to do not use .last configs
        //SS7FirewallConfig.loadConfigFromFile(configName);
    } catch (Exception ex) {
        java.util.logging.Logger.getLogger(SS7FirewallConfig.class.getName()).log(Level.SEVERE, null, ex);
    }

    sigfw = new SS7Firewall();
    sigfw.unitTesting = true;

    try {
        sigfw.initializeStack(IpChannelType.SCTP);
    } catch (Exception e) {
        e.printStackTrace();
    }
    
    // set the calling and called GT for unittests
    GlobalTitle callingGT = sigfw.sccpStack.getSccpProvider().getParameterFactory().createGlobalTitle("111111111111", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_MOBILE, null, NatureOfAddress.INTERNATIONAL);
    GlobalTitle calledGT = sigfw.sccpStack.getSccpProvider().getParameterFactory().createGlobalTitle("000000000000", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_MOBILE, null, NatureOfAddress.INTERNATIONAL);
    callingParty = sigfw.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, callingGT, 1, 8);
    calledParty = sigfw.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, calledGT, 2, 8);
}
 
Example 14
Project: alvisnlp   File: ADBBinder.java   View source code 6 votes vote down vote up
public void addAnnReferencesToNakedSecondaryAnnotation(int dbAnnId, Tuple secAnnReferencesHolder, Map<String, Integer> dbAnIdByAlvisAnnId) throws ProcessingException {
    PreparedStatement addAnnRefStatement = getPreparedStatement(PreparedStatementId.AddAnnotationReference);
    try {
        int ordNum = 0;
        for (String role : secAnnReferencesHolder.getRoles()) {
            String referencedAnnAlvisId = secAnnReferencesHolder.getArgument(role).getStringId();
            int referencedAnnId = dbAnIdByAlvisAnnId.get(referencedAnnAlvisId);
            addAnnRefStatement.setInt(1, dbAnnId);
            addAnnRefStatement.setInt(2, referencedAnnId);
            addAnnRefStatement.setString(3, role);
            addAnnRefStatement.setInt(4, ordNum++);
            addAnnRefStatement.addBatch();
        }
        addAnnRefStatement.executeBatch();
    } catch (SQLException ex) {
        logger.log(Level.SEVERE, ex.getMessage());
        throw new ProcessingException("Could not add Annotation references", ex);
    }
}
 
Example 15
Project: Hydroangeas   File: DatabaseConnector.java   View source code 6 votes vote down vote up
public void connect()
{
    this.instance.log(Level.INFO, "Connecting to database...");

    JedisPoolConfig jedisConfiguration = new JedisPoolConfig();
    jedisConfiguration.setMaxTotal(-1);
    jedisConfiguration.setJmxEnabled(false);

    Logger logger = Logger.getLogger(JedisPool.class.getName());
    logger.setLevel(Level.OFF);

    this.jedisPool = new JedisPool(jedisConfiguration, this.instance.getConfiguration().redisIp, this.instance.getConfiguration().redisPort, 0, this.instance.getConfiguration().redisPassword);
    try
    {
        this.jedisPool.getResource().close();
    } catch (Exception e)
    {
        this.instance.log(Level.SEVERE, "Can't connect to the database!");
        System.exit(8);
    }

    this.instance.log(Level.INFO, "Connected to database.");
}
 
Example 16
Project: litiengine   File: GameFile.java   View source code 6 votes vote down vote up
public static GameFile load(final String file) {
  try {
    GameFile gameFile = getGameFileFromFile(file);
    if (gameFile == null) {
      return null;
    }

    for (final Map map : gameFile.getMaps()) {
      map.updateTileTerrain();
      for (final Tileset tileset : map.getRawTileSets()) {
        tileset.load(gameFile.getTilesets());
      }
    }

    return gameFile;
  } catch (final JAXBException | IOException e) {
    log.log(Level.SEVERE, e.getMessage(), e);
  }

  return null;
}
 
Example 17
Project: incubator-netbeans   File: MenuWarmUpTask.java   View source code 6 votes vote down vote up
@Override
public void windowDeactivated(WindowEvent e) {
    // proceed only if switching to external application
    if (e.getOppositeWindow() == null) {
        synchronized (rp) {
            if (task != null) {
                task.cancel();
            } else {
                task = rp.create(this);
            }
            LOG.fine("Window deactivated, preparing refresh task");
        }
        if (UILOG.isLoggable(Level.FINE)) {
            LogRecord r = new LogRecord(Level.FINE, "LOG_WINDOW_DEACTIVATED"); // NOI18N
            r.setResourceBundleName("org.netbeans.core.ui.warmup.Bundle"); // NOI18N
            r.setResourceBundle(NbBundle.getBundle(MenuWarmUpTask.class)); // NOI18N
            r.setLoggerName(UILOG.getName());
            UILOG.log(r);
        }
    }
}
 
Example 18
Project: myfaces-trinidad   File: ComponentDemoRegistry.java   View source code 6 votes vote down vote up
/**
 * Registers the given component demo into a specific category.
 *
 * @param categoryId    the unique id of the category.
 * @param categoryName  the name of the category.
 * @param componentDemo the component demo to be registered.
 */
public void registerComponentDemo(ComponentDemoCategoryId categoryId, String categoryName, IComponentDemo componentDemo) {
    if (componentDemo == null) {
        throw new IllegalArgumentException("Trying to register a null component demo!");
    }

    _LOG.log(Level.INFO, "Register component demo '" + componentDemo.getDisplayName() + "' in category '" + categoryName + "'");

    IComponentDemoCategory category = categoriesRegistry.get(categoryId);
    if (category == null) {
        category = new ComponentDemoCategoryImpl(categoryId, categoryName);

        categories.add(category);
        categoriesRegistry.put(categoryId, category);
    }

    category.addComponentDemo(componentDemo);
    componentsDemoRegistry.put(componentDemo.getId(), componentDemo);
}
 
Example 19
Project: incubator-netbeans   File: MercurialInterceptor.java   View source code 6 votes vote down vote up
@Override
public void afterDelete(final File file) {
    Mercurial.LOG.log(Level.FINE, "afterDelete {0}", file);
    if (file == null) return;
    if (HgUtils.isPartOfMercurialMetadata(file) && HgUtils.WLOCK_FILE.equals(file.getName())) {
        commandLogger.unlocked(file);
    }
    if (HgUtils.HG_FOLDER_NAME.equals(file.getName())) {
        // new metadata created, we should refresh owners
        refreshOwnersTask.schedule(3000);
    }
    // we don't care about ignored files
    // IMPORTANT: false means mind checking the sharability as this might cause deadlock situations
    if(HgUtils.isIgnored(file, false)) {
        if (Mercurial.LOG.isLoggable(Level.FINER)) {
            Mercurial.LOG.log(Level.FINE, "skipping afterDelete(): File: {0} is ignored", new Object[] {file.getAbsolutePath()}); // NOI18N
        }
        return;
    }
    reScheduleRefresh(800, file, true);
}
 
Example 20
Project: Java_Swing_Programming   File: Soru3.java   View source code 6 votes vote down vote up
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
    // TODO add your handling code here:

    try {
        // TODO add your handling code here:

        Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/DEPO", "sa", "as");
        String query = "INSERT INTO SATIS (ID,ID_MUSTERI,ID_MALZEME,TUTAR,ADET) VALUES (?,?,?,?,?)";
        PreparedStatement stm = con.prepareStatement(query);
        for (Object[] mrow : kayitbekleyen) {

            stm.setInt(1, (int) mrow[0]);
            stm.setInt(2, (int) mrow[2]);
            stm.setInt(3, (int) mrow[4]);
            stm.setInt(4, (int) mrow[6]);
            stm.setInt(5, (int) mrow[7]);
            stm.executeUpdate();
        }

        kayitbekleyen.clear();
    } catch (SQLException ex) {
        Logger.getLogger(Soru2.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
Example 21
Project: ServerConnect   File: Metrics.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
protected JSONObject getRequestJsonObject() {
          JSONObject chart = new JSONObject();
          chart.put("chartId", chartId);
          try {
              JSONObject data = getChartData();
              if (data == null) {
                  // If the data is null we don't send the chart.
                  return null;
              }
              chart.put("data", data);
          } catch (Throwable t) {
              if (logFailedRequests) {
                  Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t);
              }
              return null;
          }
          return chart;
      }
 
Example 22
Project: incubator-netbeans   File: ShellRegistry.java   View source code 6 votes vote down vote up
private void createAndCleanTrashArea() throws IOException {
    if (trashRoot != null) {
        return;
    }
    FileObject r = FileUtil.toFileObject(Places.getCacheSubdirectory("jshell"));
    if (r == null) {
        throw new IOException("Unable to create cache for generated snippets");
    }
    LOG.log(Level.FINE, "Clearing trash area");
    trashRoot = r;
    for (FileObject f : r.getChildren()) {
        LOG.log(Level.FINE, "Deleting: {0}", f);
        try {
            f.delete();
        } catch (IOException ex) {
            LOG.log(Level.WARNING, "Could not delete Java Shell work area {0}: {1}", new Object[] { f, ex });
            ignoreNames.add(f.getNameExt());
        }
    }
}
 
Example 23
Project: L2J-Global   File: InstanceManager.java   View source code 6 votes vote down vote up
/**
 * Remove re-enter penalty for specified instance from player.
 * @param player player who wants to delete penalty
 * @param id template id of instance world
 */
public void deleteInstanceTime(L2PcInstance player, int id)
{
	try (Connection con = DatabaseFactory.getInstance().getConnection();
		PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
	{
		ps.setInt(1, player.getObjectId());
		ps.setInt(2, id);
		ps.execute();
		_playerInstanceTimes.get(player.getObjectId()).remove(id);
	}
	catch (Exception e)
	{
		LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not delete character instance reenter data: ", e);
	}
}
 
Example 24
Project: incubator-netbeans   File: DataLoaderPool.java   View source code 6 votes vote down vote up
/**
 * Just avoids loaders.ser, which is not a well-formed ser file and causes confusing
 * exceptions when browsing system file system.
 * Anyway reading the contents would mutate loader singletons! Evil.
 */
@Override
protected FileObject findPrimaryFile(FileObject fo) {
    FileObject r = super.findPrimaryFile(fo);
    if (r != null && r.getPath().equals("loaders.ser")) { // NOI18N
        try {
            if (r.getFileSystem().isDefault()) {
                // Skip it.
                return null;
            }
        } catch (FileStateInvalidException e) {
            Logger.getLogger(DataLoaderPool.class.getName()).log(Level.WARNING, null, e);
        }
    }
    return r;
}
 
Example 25
Project: incubator-netbeans   File: SourceFileObject.java   View source code 6 votes vote down vote up
@CheckForNull
public static SourceFileObject create (
        @NonNull final FileObject file,
        @NonNull final FileObject root) {
    try {
        return new SourceFileObject (
            new Handle(file, root),
            null,
            null,
            false);
    } catch (IOException ioe) {
        if (LOG.isLoggable(Level.SEVERE))
            LOG.log(Level.SEVERE, ioe.getMessage(), ioe);
        return null;
    }
}
 
Example 26
Project: twister2   File: GetInfoTaskAddedListener.java   View source code 5 votes vote down vote up
@Override
public void onTaskAdded(Task task) {
  LOGGER.log( Level.FINE, "\n Task Added : {0} ", task.toString());
  System.out.println("=================================");
  System.out.println("Task Added ");
  System.out.println(task.toString());
  System.out.println("=================================");
}
 
Example 27
Project: OpenJSharp   File: OMGSystemException.java   View source code 5 votes vote down vote up
public TRANSACTION_ROLLEDBACK xaEndTrueRollbackDeferred( CompletionStatus cs, Throwable t ) {
    TRANSACTION_ROLLEDBACK exc = new TRANSACTION_ROLLEDBACK( XA_END_TRUE_ROLLBACK_DEFERRED, cs ) ;
    if (t != null)
        exc.initCause( t ) ;
    
    if (logger.isLoggable( Level.WARNING )) {
        Object[] parameters = null ;
        doLog( Level.WARNING, "OMG.xaEndTrueRollbackDeferred",
            parameters, OMGSystemException.class, exc ) ;
    }
    
    return exc ;
}
 
Example 28
Project: incubator-netbeans   File: BaseDocument.java   View source code 5 votes vote down vote up
@Override
   public void removeDocumentListener(DocumentListener listener) {
       if (LOG_LISTENER.isLoggable(Level.FINE)) {
           LOG_LISTENER.fine("REMOVE DocumentListener of class " + listener.getClass() + " from existing " +
                   org.netbeans.lib.editor.util.swing.DocumentUtilities.getDocumentListenerCount(this) +
                   " listeners. Listener: " + listener + '\n'
           );
           if (LOG_LISTENER.isLoggable(Level.FINER)) {
               LOG_LISTENER.log(Level.FINER, "    StackTrace:\n", new Exception());
           }
       }
if (!org.netbeans.lib.editor.util.swing.DocumentUtilities.removePriorityDocumentListener(
               this, listener, DocumentListenerPriority.DEFAULT))
           super.removeDocumentListener(listener);
   }
 
Example 29
Project: uyariSistemi   File: dbConnection.java   View source code 5 votes vote down vote up
public List<sensor> sensor_listele() throws SQLException{
    baglan();
    List<sensor> gelen = new ArrayList<>();
 
    sensor veriler ;
    Statement stmt;
    try {
        stmt = connection.createStatement();
        ResultSet rs;
        rs = stmt.executeQuery("SELECT * FROM gelen_sensor");
       
        while (rs.next()) {
            System.out.println(rs.getString("gelen_sicaklik"));
            System.out.println(rs.getString("gelen_gaz"));
            veriler = new sensor();
            veriler.setSicaklik(rs.getString("gelen_sicaklik"));
            veriler.setGaz(rs.getString("gelen_gaz"));
            
                gelen.add(veriler);
            
        }
        
        
    } catch (SQLException ex) {
        Logger.getLogger(dbConnection.class.getName()).log(Level.SEVERE, null, ex);
    }
    return gelen;
}
 
Example 30
Project: incubator-netbeans   File: VisualizerNode.java   View source code 5 votes vote down vote up
Icon getIcon(boolean opened, boolean large) {
    int newCacheType = getCacheType(opened, large);

    if (cachedIconType != newCacheType) {
        int iconType = large ? BeanInfo.ICON_COLOR_32x32 : BeanInfo.ICON_COLOR_16x16;

        Image image;
        try {
            image = opened ? node.getOpenedIcon(iconType) : node.getIcon(iconType);

            // bugfix #28515, check if getIcon contract isn't broken
            if (image == null) {
                String method = opened ? "getOpenedIcon" : "getIcon"; // NOI18N
                LOG.warning(
                    "Node \"" + node.getName() + "\" [" + node.getClass().getName() + "] cannot return null from " +
                    method + "(). See Node." + method + " contract."
                    ); // NOI18N
            }
        } catch (RuntimeException x) {
            LOG.log(Level.INFO, null, x);
            image = null;
        }

        if (image == null) {
            icon = getDefaultIcon();
        } else {
            icon = ImageUtilities.image2Icon(image);
        }
    }

    cachedIconType = newCacheType;

    return icon;
}
 
Example 31
Project: openjdk-jdk10   File: TestAnonymousLogger.java   View source code 5 votes vote down vote up
public static void main(String[] args) {
    System.setSecurityManager(new SecurityManager());
    Logger anonymous = Logger.getAnonymousLogger();

    final TestHandler handler = new TestHandler();
    final TestFilter filter = new TestFilter();
    final ResourceBundle bundle = ResourceBundle.getBundle(TestBundle.class.getName());
    anonymous.setLevel(Level.FINEST);
    anonymous.addHandler(handler);
    anonymous.setFilter(filter);
    anonymous.setUseParentHandlers(true);
    anonymous.setResourceBundle(bundle);

    if (anonymous.getLevel() != Level.FINEST) {
        throw new RuntimeException("Unexpected level: " + anonymous.getLevel());
    } else {
        System.out.println("Got expected level: " + anonymous.getLevel());
    }
    if (!Arrays.asList(anonymous.getHandlers()).contains(handler)) {
        throw new RuntimeException("Expected handler not found in: "
                + Arrays.asList(anonymous.getHandlers()));
    } else {
        System.out.println("Got expected handler in: " + Arrays.asList(anonymous.getHandlers()));
    }
    if (anonymous.getFilter() != filter) {
        throw new RuntimeException("Unexpected filter: " + anonymous.getFilter());
    } else {
        System.out.println("Got expected filter: " + anonymous.getFilter());
    }
    if (!anonymous.getUseParentHandlers()) {
        throw new RuntimeException("Unexpected flag: " + anonymous.getUseParentHandlers());
    } else {
        System.out.println("Got expected flag: " + anonymous.getUseParentHandlers());
    }
    if (anonymous.getResourceBundle() != bundle) {
        throw new RuntimeException("Unexpected bundle: " + anonymous.getResourceBundle());
    } else {
        System.out.println("Got expected bundle: " + anonymous.getResourceBundle());
    }
    try {
        anonymous.setParent(Logger.getLogger("foo.bar"));
        throw new RuntimeException("Expected SecurityException not raised!");
    } catch (SecurityException x) {
        System.out.println("Got expected exception: " + x);
    }
    if (anonymous.getParent() != Logger.getLogger("")) {
        throw new RuntimeException("Unexpected parent: " + anonymous.getParent());
    } else {
        System.out.println("Got expected parent: " + anonymous.getParent());
    }
}
 
Example 32
Project: incubator-netbeans   File: FileUtils.java   View source code 5 votes vote down vote up
public static VCSFileProxy createProxy(String path) {
    try {
        URI uri = new URI(path);
        String scheme = uri.getScheme();
        if (scheme == null) {
            // handle as local file
            return VCSFileProxy.createFileProxy(new File(path));
        } else {
            return VCSFileProxy.createFileProxy(uri);
        }
    } catch (URISyntaxException ex) {
        LocalHistory.LOG.log(Level.FINE, path, ex);
    }
    return VCSFileProxy.createFileProxy(new File(path));
}
 
Example 33
Project: OpenVertretung   File: Jdk14Logger.java   View source code 5 votes vote down vote up
private void logInternal(Level level, Object msg, Throwable exception) {
    //
    // only go through this exercise if the message will actually be logged.
    //

    if (this.jdkLogger.isLoggable(level)) {
        String messageAsString = null;
        String callerMethodName = "N/A";
        String callerClassName = "N/A";
        //int lineNumber = 0;
        //String fileName = "N/A";

        if (msg instanceof ProfilerEvent) {
            messageAsString = LogUtils.expandProfilerEventIfNecessary(msg).toString();
        } else {
            Throwable locationException = new Throwable();
            StackTraceElement[] locations = locationException.getStackTrace();

            int frameIdx = findCallerStackDepth(locations);

            if (frameIdx != 0) {
                callerClassName = locations[frameIdx].getClassName();
                callerMethodName = locations[frameIdx].getMethodName();
                //lineNumber = locations[frameIdx].getLineNumber();
                //fileName = locations[frameIdx].getFileName();
            }

            messageAsString = String.valueOf(msg);
        }

        if (exception == null) {
            this.jdkLogger.logp(level, callerClassName, callerMethodName, messageAsString);
        } else {
            this.jdkLogger.logp(level, callerClassName, callerMethodName, messageAsString, exception);
        }
    }
}
 
Example 34
Project: vrwiimote   File: VRidgeRunner.java   View source code 5 votes vote down vote up
private void handleConnectController() {
	try {
		controllerEndpoint = (VRidgeControllerEndpoint) controlChannel.connectEndpoint("Controller");
		LOGGER.log(Level.INFO, controllerEndpoint.getEndpointAddress());
		LOGGER.log(Level.INFO, String.valueOf(controllerEndpoint.getTimeoutSec()));
		controllerEndpoint.connect();
		LOGGER.log(Level.INFO, "Connected!");
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		LOGGER.log(Level.SEVERE, e.toString(), e);
	}
}
 
Example 35
Project: Proyecto-DASI   File: NotificadorInfoUsuarioSimulador.java   View source code 5 votes vote down vote up
public void sendPeticionMostrarEscenarioSimulacion() {
    try {
        this.informaraOtroAgenteReactivo(peticionMostrarEscenario, identificadorAgenteaReportar);
    } catch (Exception ex) {
        Logger.getLogger(NotificadorInfoUsuarioSimulador.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
Example 36
Project: Byter   File: Commander.java   View source code 5 votes vote down vote up
/**
 * construct a jmx connector with login data.
 * @param sc server configuration to use
 * @return connected JMXConnector | null
 */
private JMXConnector buildServerConnectorWithLogin(final ServerConfiguration sc){
    try{
        return JmxConnectionHelper.buildJmxMPConnector(sc.getServerJmxHost(),sc.getServerJmxPort(),
                sc.getUsername(),sc.getPassword());
    } catch (IOException e) {
        log.log(Level.WARNING,"IO Exception during building JMXConnector to Server.");
        return null;
    }
}
 
Example 37
Project: KSP-AGuS-Automatic-Guidance-System   File: DATA_MISSION.java   View source code 5 votes vote down vote up
/**
 * returns null if docking is not set as the end of the orbit
 * 
 * @return The target vessel for docking
 */
public Vessel getTargetVessel() {
	try {
		if (getMissionEndingState().equals(MISSION_ENDING_STATES.DOCKED)) {
			Iterator<Vessel> vesIt;
			vesIt = spaceCenter.getVessels().iterator();
			while (vesIt.hasNext()) {
				Vessel vessel = vesIt.next();
				if (vessel.getName().equals(properties.getProperty("targetSpacecraft"))) {
					return vessel;
				}
			}
		}
	} catch (RPCException | IOException e) {
		e.printStackTrace();
		LOGGER.logger.log(Level.SEVERE, "", e);
	}
	return null;
}
 
Example 38
Project: incubator-netbeans   File: JFXGeneratedFilesInterceptor.java   View source code 5 votes vote down vote up
@Override
public void fileGenerated(
        final Project project,
        final String path) {
    if (reenter.get() == Boolean.TRUE) {
        return;
    }
    if (GeneratedFilesHelper.BUILD_IMPL_XML_PATH.equals(path)) {
        final AntBuildExtender extender = project.getLookup().lookup(AntBuildExtender.class);
        if (extender == null) {
            LOG.log(
                Level.WARNING,
                "The project {0} ({1}) does not support AntBuildExtender.",     //NOI18N
                new Object[] {
                    ProjectUtils.getInformation(project).getDisplayName(),
                    FileUtil.getFileDisplayName(project.getProjectDirectory())
                });
            return;
        }
        runDeferred(new Runnable() {
            @Override
            public void run() {
                updateIfNeeded(project, extender);
            }
        });
    }
}
 
Example 39
Project: OperatieBRP   File: ServerConnection.java   View source code 5 votes vote down vote up
/**
 * Handle logon.
 * @param request request
 * @return response
 */
private Response handleLogon(final RequestLogon request) {
    try {
        subject = authenticator.authenticate(request.getCredentials());
        return new Response(request.getRequestId(), connectionId);
    } catch (final SecurityException e) {
        LOGGER.log(Level.WARNING, "Invalid logon attempt.", e);
        return new Response(request.getRequestId(), new InvalidCredentialsException());
    }
}
 
Example 40
Project: incubator-netbeans   File: AutoupdateSettings.java   View source code 5 votes vote down vote up
private static String getQualifiedIdentity (String ideIdentity) {
    if (getSuperIdentity () != null) {
        err.log (Level.FINE, "Returns Qualified Id: " + ideIdentity + QUALIFIED_ID_DELIMETER + getSuperIdentity ());
        return ideIdentity + QUALIFIED_ID_DELIMETER + getSuperIdentity ();
    } else {
        err.log (Level.FINE, "Was problem while handling Qualified Id. Returns only original Id: " + ideIdentity);
        return ideIdentity;
    }

}