当前位置: 首页>>代码示例>>Java>>正文


Java Log.w方法代码示例

本文整理汇总了Java中com.couchbase.lite.util.Log.w方法的典型用法代码示例。如果您正苦于以下问题:Java Log.w方法的具体用法?Java Log.w怎么用?Java Log.w使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.couchbase.lite.util.Log的用法示例。


在下文中一共展示了Log.w方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: closeIndex

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * in CBL_ForestDBViewStorage.mm
 * - (void) closeIndex
 */
private void closeIndex() {
    // TODO
    //NSObject cancelPreviousPerformRequestsWithTarget: self selector: @selector(closeIndex) object: nil];

    // NOTE: view could be busy for indexing. as result, view.close() could fail.
    //       It requires to wait till view is not busy. CBL Java/Android waits maximum 10 seconds.
    for (int i = 0; i < 100 && _view != null; i++) {
        try {
            _view.close();
            _view = null;
        } catch (ForestException e) {
            Log.w(TAG, "Failed to close Index: [%s] [%s]", _view, Thread.currentThread().getName());
            try {
                Thread.sleep(100); // 100 ms (maximum wait time: 10sec)
            } catch (Exception ex) {
            }
        }
    }
}
 
开发者ID:couchbaselabs,项目名称:couchbase-lite-java-forestdb,代码行数:24,代码来源:ForestDBViewStore.java

示例2: setError

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@InterfaceAudience.Private
protected void setError(Throwable throwable) {

    // TODO - needs to port
    //if (error.code == NSURLErrorCancelled && $equal(error.domain, NSURLErrorDomain))
    //    return;

    if (throwable != this.error) {
        Log.w(Log.TAG_SYNC, "%s: Progress: set error = %s", this, throwable);
        parentReplication.setLastError(throwable);
        this.error = throwable;

        // if permanent error, stop immediately
        if (Utils.isPermanentError(this.error) || !isContinuous()) {
            triggerStopGraceful();
        }

        // iOS version sends notification from stop() method, but java version does not.
        // following codes are always executed.
        Replication.ChangeEvent changeEvent = new Replication.ChangeEvent(this, this.error);
        notifyChangeListeners(changeEvent);
    }
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:24,代码来源:ReplicationInternal.java

示例3: appendInputStream

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
void appendInputStream(InputStream inputStream) throws IOException, SymmetricKeyException {
    byte[] buffer = new byte[1024];
    int len;
    length = 0;
    try {
        while ((len = inputStream.read(buffer)) != -1) {
            appendData(buffer, 0, len);
        }
    } finally {
        try {
            // Question: Should this method close the stream?
            if (inputStream != null)
                inputStream.close();
        } catch (IOException e) {
            Log.w(Log.TAG_BLOB_STORE, "Exception closing input stream", e);
        }
    }
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:19,代码来源:BlobStoreWriter.java

示例4: setChannels

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * For javadocs, see Replication object
 */
public void setChannels(List<String> channels) {
    if (channels != null && !channels.isEmpty()) {
        if (!isPull()) {
            Log.w(Log.TAG_SYNC, "filterChannels can only be set in pull replications");
            return;
        }
        setFilter(BY_CHANNEL_FILTER_NAME);
        Map<String, Object> filterParams = new HashMap<String, Object>();
        filterParams.put(CHANNELS_QUERY_PARAM, TextUtils.join(",", channels));
        setFilterParams(filterParams);
    } else if (BY_CHANNEL_FILTER_NAME.equals(getFilter())) {
        setFilter(null);
        setFilterParams(null);
    }
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:19,代码来源:ReplicationInternal.java

示例5: Body

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
public Body(byte[] json, String docID, String revID, boolean deleted) {

        Map<String, Object> extra = new HashMap<String, Object>();
        extra.put("_id", docID);
        extra.put("_rev", revID);
        if (deleted)
            extra.put("_deleted", true);

        if (json == null || json.length < 2) {
            this.object = extra;
            return;
        }

        Map<String, Object> props = null;
        try {
            props = Manager.getObjectMapper().readValue(json, Map.class);
        } catch (IOException e) {
            Log.w(Log.TAG_DATABASE, "Failed to parse Json document", e);
        }
        props.putAll(extra);
        this.object = props;
    }
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:23,代码来源:Body.java

示例6: preemptivelySetAuthCredentials

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
static Request.Builder preemptivelySetAuthCredentials(
        Request.Builder builder, String userInfo, boolean isUrlBased) {

    if (userInfo == null)
        return builder;

    if (!userInfo.contains(":") || ":".equals(userInfo.trim())) {
        Log.w(TAG, "RemoteRequest Unable to parse user info, not setting credentials");
        return builder;
    }

    String[] userInfoElements = userInfo.split(":");
    String username = isUrlBased ? URIUtils.decode(userInfoElements[0]) : userInfoElements[0];
    String password = "";
    if (userInfoElements.length >= 2)
        password = isUrlBased ? URIUtils.decode(userInfoElements[1]) : userInfoElements[1];
    String credential = Credentials.basic(username, password);
    return builder.addHeader("Authorization", credential);
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:20,代码来源:RequestUtils.java

示例7: markEncrypted

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private void markEncrypted(boolean encrypted) throws CouchbaseLiteException {
    File markerFile = new File(path, ENCRYPTION_MARKER_FILENAME);
    if (encrypted) {
        try {
            TextUtils.write(ENCRYPTION_ALGORITHM, markerFile);
            if (!markerFile.exists()) {
                Log.w(Log.TAG_DATABASE, "BlobStore: Unable to save the encryption marker file into the blob store");
            }
        } catch (IOException e) {
            Log.w(Log.TAG_DATABASE, "BlobStore: Unable to save the encryption marker file into the blob store");
            throw new CouchbaseLiteException(e.getCause(), Status.ATTACHMENT_ERROR);
        }
    } else {
        if (markerFile.exists()) {
            if (!markerFile.delete()) {
                Log.w(Log.TAG_DATABASE, "BlobStore: Unable to delete the encryption marker file in the blob store");
                throw new CouchbaseLiteException(
                        "Unable to delete the encryption marker file in the Blob-store",
                        Status.ATTACHMENT_ERROR);
            }
        }
    }
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:24,代码来源:BlobStore.java

示例8: initWithAuth

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@ReactMethod
public void initWithAuth(String username, String password, Callback callback) {
    Credentials credentials;
    if (username == null && password == null) {
        credentials = null;
        Log.w(TAG, "No credential specified, your listener is unsecured and you are putting your data at risk");
    } else if (username == null || password == null) {
        callback.invoke(null, "username and password must not be null");
        return;
    } else {
        credentials = new Credentials(username, password);
    }

    this.initWithCredentials(credentials, callback);
}
 
开发者ID:couchbaselabs,项目名称:react-native-couchbase-lite,代码行数:16,代码来源:ReactCBLite.java

示例9: escapeViewName

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private static String escapeViewName(String viewName) throws CouchbaseLiteException {
    try {
        viewName = URLEncoder.encode(viewName, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        Log.w(TAG, "Error to url decode: " + viewName, e);
        throw new CouchbaseLiteException(e, Status.BAD_ENCODING);
    }
    return viewName.replaceAll("\\*", "%2A");
}
 
开发者ID:couchbaselabs,项目名称:couchbase-lite-java-forestdb,代码行数:10,代码来源:ForestDBViewStore.java

示例10: unescapeViewName

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private static String unescapeViewName(String viewName) throws CouchbaseLiteException {
    viewName = viewName.replaceAll("%2A", "*");
    try {
        return URLDecoder.decode(viewName, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        Log.w(TAG, "Error to url decode: " + viewName, e);
        throw new CouchbaseLiteException(e, Status.BAD_ENCODING);
    }
}
 
开发者ID:couchbaselabs,项目名称:couchbase-lite-java-forestdb,代码行数:10,代码来源:ForestDBViewStore.java

示例11: jsonObject

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
public Object jsonObject() {

        if (json == null) {
            return null;
        }

        if (cached == null) {

            Object tmp = null;
            if (json[0] == '{') {
                tmp = new LazyJsonObject<String, Object>(json);
            } else if (json[0] == '[') {
                tmp = new LazyJsonArray<Object>(json);
            } else {
                try {
                    // NOTE: This if-else condition is for Jackson 2.5.0
                    // json variable is byte[] which is from Cursor.getBlob().
                    // And json byte array is ended with '\0'.
                    // '\0' causes parsing problem with Jackson 2.5.0 that we upgraded Feb 24, 2015.
                    // We did not observe this problem with Jackson 1.9.2 that we used before.
                    if(json.length > 0 && json[json.length - 1] == 0) {
                        tmp = Manager.getObjectMapper().readValue(json, 0, json.length - 1, Object.class);
                    }
                    else {
                        tmp = Manager.getObjectMapper().readValue(json, Object.class);
                    }
                } catch (Exception e) {
                    //cached will remain null
                    Log.w(Database.TAG, "Exception parsing json", e);
                }
            }

            cached = tmp;
        }
        return cached;
    }
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:37,代码来源:JsonDocument.java

示例12: getFilter

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * Returns the existing filter function (block) registered with the given name.
 * Note that filters are not persistent -- you have to re-register them on every launch.
 */
@InterfaceAudience.Public
public ReplicationFilter getFilter(String filterName) {
    ReplicationFilter result = null;
    if (filters != null) {
        result = filters.get(filterName);
    }
    if (result == null) {
        ReplicationFilterCompiler filterCompiler = getFilterCompiler();
        if (filterCompiler == null) {
            return null;
        }

        List<String> outLanguageList = new ArrayList<String>();
        String sourceCode = getDesignDocFunction(filterName, "filters", outLanguageList);
        if (sourceCode == null) {
            return null;
        }
        String language = outLanguageList.get(0);
        ReplicationFilter filter = filterCompiler.compileFilterFunction(sourceCode, language);
        if (filter == null) {
            Log.w(Database.TAG, "Filter %s failed to compile", filterName);
            return null;
        }
        setFilter(filterName, filter);
        return filter;
    }
    return result;
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:33,代码来源:Database.java

示例13: cancel

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * Call this to cancel before finishing the data.
 */
public void cancel() {
    try {
        // FileOutputStream is also closed cascadingly
        if (outStream != null) {
            outStream.close();
            outStream = null;
        }
        // Clear encryptor:
        encryptor = null;
    } catch (IOException e) {
        Log.w(Log.TAG_BLOB_STORE, "Exception closing buffered output stream", e);
    }
    tempFile.delete();
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:18,代码来源:BlobStoreWriter.java

示例14: toJSONString

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private static String toJSONString(Object object) {
    if (object == null) {
        return null;
    }
    String result = null;
    try {
        result = Manager.getObjectMapper().writeValueAsString(object);
    } catch (Exception e) {
        Log.w(Log.TAG_VIEW, "Exception serializing object to json: %s", e, object);
    }
    return result;
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:13,代码来源:SQLiteViewStore.java

示例15: compileView

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * VIEW QUERIES: *
 */
private View compileView(String viewName, Map<String, Object> viewProps) {
    String language = (String) viewProps.get("language");
    if (language == null) {
        language = "javascript";
    }
    String mapSource = (String) viewProps.get("map");
    if (mapSource == null) {
        return null;
    }
    Mapper mapBlock = View.getCompiler().compileMap(mapSource, language);
    if (mapBlock == null) {
        Log.w(TAG, "View %s has unknown map function: %s", viewName, mapSource);
        return null;
    }
    String reduceSource = (String) viewProps.get("reduce");
    Reducer reduceBlock = null;
    if (reduceSource != null) {
        reduceBlock = View.getCompiler().compileReduce(reduceSource, language);
        if (reduceBlock == null) {
            Log.w(TAG, "View %s has unknown reduce function: %s", viewName, reduceBlock);
            return null;
        }
    }

    String version = Misc.HexSHA1Digest(viewProps.toString().getBytes());

    View view = db.getView(viewName);
    view.setMapReduce(mapBlock, reduceBlock, version);
    String collation = (String) viewProps.get("collation");
    if ("raw".equals(collation)) {
        view.setCollation(View.TDViewCollation.TDViewCollationRaw);
    }
    return view;
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:38,代码来源:Router.java


注:本文中的com.couchbase.lite.util.Log.w方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。