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


Java DbxException.printStackTrace方法代码示例

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


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

示例1: delete

import com.dropbox.core.DbxException; //导入方法依赖的package包/类
public void delete(String path) throws IOException {
    linkedOrThrow();

    try {
        dbxClient.files().delete(path);

    } catch (DbxException e) {
        e.printStackTrace();

        if (e.getMessage() != null) {
            throw new IOException("Failed deleting " + path + " on Dropbox: " + e.getMessage());
        } else {
            throw new IOException("Failed deleting " + path + " on Dropbox: " + e.toString());
        }
    }
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:17,代码来源:DropboxClient.java

示例2: isFolderAlreadyExists

import com.dropbox.core.DbxException; //导入方法依赖的package包/类
@Override
public boolean isFolderAlreadyExists(String folder) {
    ListFolderResult dropboxFolders = null;
    if (android.os.Build.VERSION.SDK_INT > 9) {
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
        try {
            String dir = "/" + folder.substring(0, folder.lastIndexOf("/"));
            dropboxFolders = DropboxClientFactory.getClient().files().listFolder(dir);
        } catch (DbxException e) {
            e.printStackTrace();
        }
    }
    if (dropboxFolders != null) {
        Log.d(TAG, dropboxFolders.toString());
        String s = dropboxFolders.toStringMultiline();
        if (s.contains("/" + folder))
            return true;
    }
    return false;
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:22,代码来源:DropboxManager.java

示例3: dropboxGetFiles

import com.dropbox.core.DbxException; //导入方法依赖的package包/类
public static List<String> dropboxGetFiles(String code) {

        DbxRequestConfig config = new DbxRequestConfig("Media Information Service Configuration");
        DbxClientV2 client = new DbxClientV2(config, code);
        ListFolderResult result = null;
        List<String> elements = new LinkedList<String>();


        try {
            result = client.files().listFolderBuilder("/media").withRecursive(true).start();
            while (true) {
                for (Metadata metadata : result.getEntries()) {
                    if (metadata instanceof FileMetadata) {
                        elements.add(metadata.getName());
                    }
                }

                if (!result.getHasMore()) {
                    break;
                }

                result = client.files().listFolderContinue(result.getCursor());
            }

            //System.out.println(elements.toString());
        } catch (DbxException e) {
            e.printStackTrace();
        }


        return elements;


    }
 
开发者ID:LithiumSR,项目名称:media_information_service,代码行数:35,代码来源:DbxAPIOp.java

示例4: uploadFile

import com.dropbox.core.DbxException; //导入方法依赖的package包/类
public Files.FileMetadata uploadFile(String path, InputStream inputStream) throws IOException, DbxException {
    if(Reference.testing) return null;

    try {
        dropbox.dbxClientV2.files.delete(path);
    } catch (DbxException e) {
        e.printStackTrace();
    }

    return dropbox.dbxClientV2.files.uploadBuilder(path).run(inputStream);
}
 
开发者ID:DevWars,项目名称:devwars.tv,代码行数:12,代码来源:FileStorage.java

示例5: shareableUrlForPath

import com.dropbox.core.DbxException; //导入方法依赖的package包/类
public String shareableUrlForPath(String path) {
    if(Reference.testing) return "TESTURL";

    try {
        String url = dropbox.dbxClientV2.sharing.createSharedLink(path).url;
        url = url.split("\\?")[0];
        return url + "?raw=1";
    } catch (DbxException e) {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:DevWars,项目名称:devwars.tv,代码行数:13,代码来源:FileStorage.java

示例6: authenticate

import com.dropbox.core.DbxException; //导入方法依赖的package包/类
@Override
public boolean authenticate(String code) {

    try {
        DbxAuthFinish authFinish = webAuth.finish(code);

        dbClient = new DbxClient(config, authFinish.accessToken);

        Credentials cred = new Credentials();

        //Remove old credentials, if they exist
        cred.removeCredentials("dropbox");

        //Save new credentials
        cred.saveCredentials("dropbox", authFinish.accessToken);

        bearerToken = authFinish.accessToken;

        authenticated = true;

        return true;
    } catch (DbxException e) {
        e.printStackTrace();
        authenticated = false;
        return false;
    }
}
 
开发者ID:modcs,项目名称:caboclo,代码行数:28,代码来源:DropboxClient.java

示例7: finalizeUpload

import com.dropbox.core.DbxException; //导入方法依赖的package包/类
@Override
public void finalizeUpload(MultiPartUpload mpu) {
    try {
        String path = (String) mpu.getObject("path");
        String id = (String) mpu.getObject("id");
        dbClient.chunkedUploadFinish(path, DbxWriteMode.add(), id);
    } catch (DbxException ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:modcs,项目名称:caboclo,代码行数:11,代码来源:DropboxClient.java

示例8: restoreToRevision

import com.dropbox.core.DbxException; //导入方法依赖的package包/类
@Override
public boolean restoreToRevision(String path, String rev) {
	try {
		return client.restoreFile(path, rev) != null;
	} catch (DbxException e) {
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:Rohde-Schwarz-Cybersecurity,项目名称:PanBox,代码行数:10,代码来源:DropboxAPIIntegration.java

示例9: downloadFolder

import com.dropbox.core.DbxException; //导入方法依赖的package包/类
public void downloadFolder(String remotePath, String targetPath, int depth)
		throws CSPException {
	try {
		DbxEntry folder = client.getMetadata(remotePath);
		if (folder.isFolder()) {
			File remoteFolder = new File(remotePath);
			File targetFolder = new File(targetPath + File.separator
					+ remoteFolder.getName());
			if (!targetFolder.exists()) {
				targetFolder.mkdirs();
			}
			DbxEntry.WithChildren folderWithChildren = client
					.getMetadataWithChildren(remotePath);
			for (DbxEntry file : folderWithChildren.children) {
				if (depth >= DropboxConstants.MAX_TREE_SEARCH_DEPTH) {
					break;
				}
				if (file.isFile()) {
					downloadFile(file.path, targetPath + "/" + folder.name
							+ "/" + file.name);
				} else if (file.isFolder()) {
					downloadFolder(file.path, targetPath + "/"
							+ folder.name, depth + 1);
				}
			}
		}
	} catch (DbxException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Rohde-Schwarz-Cybersecurity,项目名称:PanBox,代码行数:31,代码来源:DropboxAPIIntegration.java

示例10: getBooks

import com.dropbox.core.DbxException; //导入方法依赖的package包/类
public List<VersionedRook> getBooks(Uri repoUri) throws IOException {
    linkedOrThrow();

    List<VersionedRook> list = new ArrayList<>();

    String path = repoUri.getPath();

    /* Fix root path. */
    if (path == null || path.equals("/")) {
        path = ROOT_PATH;
    }

    /* Strip trailing slashes. */
    path = path.replaceAll("/+$", "");

    try {
        if (ROOT_PATH.equals(path) || dbxClient.files().getMetadata(path) instanceof FolderMetadata) {
            /* Get folder content. */
            ListFolderResult result = dbxClient.files().listFolder(path);
            while (true) {
                for (Metadata metadata : result.getEntries()) {
                    if (metadata instanceof FileMetadata) {
                        FileMetadata file = (FileMetadata) metadata;

                        if (BookName.isSupportedFormatFileName(file.getName())) {
                            Uri uri = repoUri.buildUpon().appendPath(file.getName()).build();
                            VersionedRook book = new VersionedRook(
                                    repoUri,
                                    uri,
                                    file.getRev(),
                                    file.getServerModified().getTime());

                            list.add(book);
                        }
                    }
                }

                if (!result.getHasMore()) {
                    break;
                }

                result = dbxClient.files().listFolderContinue(result.getCursor());
            }

        } else {
            throw new IOException("Not a directory: " + repoUri);
        }

    } catch (DbxException e) {
        e.printStackTrace();

        /* If we get NOT_FOUND from Dropbox, just return the empty list. */
        if (e instanceof GetMetadataErrorException) {
            if (((GetMetadataErrorException) e).errorValue.getPathValue() == LookupError.NOT_FOUND) {
                return list;
            }
        }

        throw new IOException("Failed getting the list of files in " + repoUri +
                              " listing " + path + ": " +
                              (e.getMessage() != null ? e.getMessage() : e.toString()));
    }

    return list;
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:66,代码来源:DropboxClient.java


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