當前位置: 首頁>>代碼示例>>Java>>正文


Java Level類代碼示例

本文整理匯總了Java中java.util.logging.Level的典型用法代碼示例。如果您正苦於以下問題:Java Level類的具體用法?Java Level怎麽用?Java Level使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Level類屬於java.util.logging包,在下文中一共展示了Level類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: notifyHunter

import java.util.logging.Level; //導入依賴的package包/類
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!";
}
 
開發者ID:mystech7,項目名稱:Burp-Hunter,代碼行數:20,代碼來源:HunterRequest.java

示例2: loadImage

import java.util.logging.Level; //導入依賴的package包/類
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);
    
}
 
開發者ID:jfcameron,項目名稱:G2Dj,代碼行數:27,代碼來源:Resources.java

示例3: encrypt

import java.util.logging.Level; //導入依賴的package包/類
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";
    }
}
 
開發者ID:MohamadSaada,項目名稱:LogiGSK,代碼行數:22,代碼來源:Encryption.java

示例4: setItemStackSkin

import java.util.logging.Level; //導入依賴的package包/類
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);
    }
}
 
開發者ID:Shynixn,項目名稱:PetBlocks,代碼行數:27,代碼來源:SkinHelper.java

示例5: loglevel

import java.util.logging.Level; //導入依賴的package包/類
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;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:27,代碼來源:TestIsLoggable.java

示例6: addFoldsOfType

import java.util.logging.Level; //導入依賴的package包/類
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;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:GsfFoldManager.java

示例7: replace

import java.util.logging.Level; //導入依賴的package包/類
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);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:ReplaceBar.java

示例8: incStepToTotal

import java.util.logging.Level; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:jmd-stuff,項目名稱:task-app,代碼行數:24,代碼來源:TaskDaoImpl.java

示例9: toJSON

import java.util.logging.Level; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:StanIsAdmin,項目名稱:CrashCoin,代碼行數:23,代碼來源:Block.java

示例10: patchDOMFragment

import java.util.logging.Level; //導入依賴的package包/類
/**
 * 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));
            }
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:23,代碼來源:AbstractSchemaValidationTube.java

示例11: insertindb

import java.util.logging.Level; //導入依賴的package包/類
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);
	}
}
 
開發者ID:rubenswagner,項目名稱:L2J-Global,代碼行數:20,代碼來源:Post.java

示例12: error

import java.util.logging.Level; //導入依賴的package包/類
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});
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:MacProvider.java

示例13: initializeSS7Firewall

import java.util.logging.Level; //導入依賴的package包/類
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);
}
 
開發者ID:P1sec,項目名稱:SigFW,代碼行數:26,代碼來源:Test_SS7Firewall.java

示例14: addAnnReferencesToNakedSecondaryAnnotation

import java.util.logging.Level; //導入依賴的package包/類
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);
    }
}
 
開發者ID:Bibliome,項目名稱:alvisnlp,代碼行數:20,代碼來源:ADBBinder.java

示例15: connect

import java.util.logging.Level; //導入依賴的package包/類
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.");
}
 
開發者ID:SamaGames,項目名稱:Hydroangeas,代碼行數:24,代碼來源:DatabaseConnector.java


注:本文中的java.util.logging.Level類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。