Code Monkey home page Code Monkey logo

onedrive-sdk-java's Introduction

한국어 (korean) | English

OneDrive API for Java

purse fast, easy to use, intuitive API.

Supported Operation

  • Auto login authorization check and refresh
  • Fetching metadata of folder, file (by id and path)
  • Folder or file's metadata (size, name, path, children list and etc.)
  • Downloading file (sync and async)
  • Delete, copy, move, change metadata(name, description) of folder or file
  • Creating folder
  • Resources that OneDrive support like image, video..
  • Inquiring shared folder
  • Basic RemoteItem handling
  • Inquiring Drives
  • Creating file and upload it (async)
  • Support Microsoft Graph 1.0
  • Support OneDrive for Business (not fully tested)

TODO

  • Searching file or folder (by name or content)
  • Sharing folder or file
  • Documentation
  • Support custom redirect url when login
  • REST-api response error handling
  • JRE6 version
  • HTTPS GZIP support for synchronized operation

Environment

  • JRE7

Dependency

These are already included in gradle configuration file 'build.gradle'.

Build

jar files will be located on build/libs after build

Windows

gradlew.bat build

Linux, MacOS

./gradlew build

if gradle is installed in your computer

gradle build

Simple example

You can see little bit more complicated examples in TestCode.java

1. Construct Client object

  • All OneDrive jobs are performed via Client object.
  • A program can contain multiple different Client object.
  • Basically Client object check expiration and refresh authorization automatically. but it can be done manually.
  • All parameters that pass to Client's constructor can obtain if you fallow OneDrive app instruction of authentication.
import com.bhyoo.onedrive.client.Client;

String clientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
String[] scope = {"files.readwrite.all", "offline_access"};
String redirectURL = "http://localhost:8080/";
String clientSecret = "xxxxxxxxxxxxxxxxxxxxxxx";

// with login
Client client = new Client(clientId, scope, redirectURL, clientSecret);
// without login
Client client = new Client(clientId, scope, redirectURL, clientSecret, false);
client.login();

// With tokens provided from outside source 
String accessToken = "<access_token>";
String refreshToken = "<refresh_token>"
String tokenType = "bearer";
long expiresIn = 0;

Client client = new Client(clientId, scope, redirectURL, clientSecret, accessToken, refreshToken, tokenType, expiresIn);

2. Folder, file fetch

  • It can conduct via either ID or path.
  • FolderItem and FileItem are represent folder and file respectively.
  • FolderItem and FileItem are child class of DriveItem.
import com.bhyoo.onedrive.container.items.DriveItem;
import com.bhyoo.onedrive.container.items.FileItem;
import com.bhyoo.onedrive.container.items.FolderItem;

// assume that Client object is already constructed


// get root directory
FolderItem root = client.getRootDir();


// get folder by ID
FolderItem folder = client.getFolder("XXXXXXXXXXXXXXXX!XXXX");

// get folder by path
FolderItem folder1 = client.getFolder(new PathPointer("/{item-path}"));

// get file by ID
FileItem file = client.getFile("XXXXXXXXXXXXXXXX!XXXX");

// get file by path
FileItem file1 = client.getFile(new PathPointer("/{item-path}/{file-name}"));

// or if you don't know whether ID is file or folder
DriveItem item = client.getItem("XXXXXXXXXXXXXXXX!XXXX");

// or if you don't know whether path is file or folder
DriveItem item1 = client.getItem(new PathPointer("/{item-path}"));

3. get children of a folder

  • FolderItem are Iterable. (it will returns child as DriveItem)
  • Basically if FolderItem object is fetched by Client's method getFolder or getRootDir, the object automatically fetchs children too. (If children list is very long, it could take long time)
  • If you call FolderItem's method getAllChildren or getFolderChildren or getFileChildren, you can get List of all children, only folder children, only file children respectively.
  • if you call above methods, it will load children data and cache it. so First call of those methods can take long time.
import com.bhyoo.onedrive.container.items.DriveItem;
import com.bhyoo.onedrive.container.items.FileItem;
import com.bhyoo.onedrive.container.items.FolderItem;

// assume that Client object is already constructed
FolderItem root = client.getRootDir();

DriveItem[] children = root.allChildren();
FolderItem[] folderChildren = root.folderChildren();
FileItem[] fileChildren = root.fileChildren();

4. Create folder

  • It can create via either parent's FolderItem object or Client object.
  • It will return created folder's FolderItem object.
import com.bhyoo.onedrive.container.items.FolderItem;
import com.bhyoo.onedrive.container.items.pointer.PathPointer;

// assume that Client object is already constructed

FolderItem root = client.getRootDir();

// create folder by parent folder object
FolderItem newFolder = root.createFolder("test");


// create folder by client with parent folder id
FolderItem newFolder1 = client.createFolder("XXXXXXXXXXXXXXXX!XXXX", "test1");

// create folder by client with parent folder path
FolderItem newFolder2 = client.createFolder(new PathPointer("/"), "test2");

5. Copy folder or file

  • It can copy via either source item's object or Client object.
import com.bhyoo.onedrive.container.items.*;
import com.bhyoo.onedrive.container.items.pointer.*;

// assume that Client object is already constructed

FileItem item = (FileItem) client.getItem("XXXXXXXXXXXXXXXX!XXXX");
FolderItem destination = client.getFolder("XXXXXXXXXXXXXXXX!XXXX");

// direct copy
item.copyTo(destination);
// direct copy with new name
item.copyTo(destination, "newName");

// copy by reference object
item.copyTo(destination.newReference());
// copy by reference object with new name
item.copyTo(destination.newReference(), "newName");

// copy by path string
item.copyTo(destination.getPathPointer());
// copy by path string with new name
item.copyTo(destination.getPathPointer(), "newName");

// copy by id string
item.copyTo(destination.getId());
// copy by id string with new name
item.copyTo(destination.getId(), "newName");


// using `Client`, copy by path
client.copyItem(new PathPointer("/{item-path}"), new IdPointer("XXXXXXXXXXXXXXXX!XXXX"));

6. Download file synchronously

import java.nio.file.Paths;
import com.bhyoo.onedrive.container.items.FileItem;

// assume that Client object is already constructed
FileItem file = client.getFile("XXXXXXXXXXXXXXXX!XXXX");

String path = "/home/isac322/download";

// download by system path string with original file name
file.download(path);

// download by system path string with new name
file.download(path, "newName");


// download by path object with original file name
file.download(Paths.get(path));

// download by path object with new name
file.download(Paths.get(path), "newName");


client.download(new PathPointer("/{item-path}"), Paths.get(path));

7. Download file asynchronously

  • all async job use Future & Promise mechanism.
  • more detail of DownloadFuture will explain later at wiki...
import java.nio.file.Paths;
import com.bhyoo.container.items.FileItem;
import com.bhyoo.network.async.DownloadFuture;

// assume that Client object is already constructed

FileItem file = client.getFile("XXXXXXXXXXXXXXXX!XXXX");
String path = "/home/isac322/download";

// download by path object with original file name
file.downloadAsync(Paths.get(path));

// download by path object with new name
file.downloadAsync(Paths.get(path), "newName");


DownloadFuture future = client.downloadAsync("{file-id}", Paths.get(path), "newName");

// wait until download is done
future.sync();

8. Move folder or file

  • It can move via either source item's object or Client object.
import com.bhyoo.onedrive.container.items.FileItem;
import com.bhyoo.onedrive.container.items.FolderItem;
import com.bhyoo.onedrive.container.items.pointer.*;

// assume that Client object is already constructed

FileItem item = client.getFile("XXXXXXXXXXXXXXXX!XXXX");
FolderItem destination = client.getFolder("XXXXXXXXXXXXXXXX!XXXX");

// direct move
item.moveTo(destination);

// move by reference object
item.moveTo(destination.newReference());

// move by path string
item.moveTo(destination.getPathPointer());

// move by id string
item.moveTo(destination.getId());


// using `Client` object, move by folder path
client.moveItem(new PathPointer("/{item-path}"), new IdPointer("XXXXXXXXXXXXXXXX!XXXX"));

9. Update folder or file's metadata & Refresh

  • refresh will update all variable with fetched latest metadata.
  • That is, if refresh is invoked, all variable can be changed, even if the current program did not modify the variables.
import com.bhyoo.onedrive.container.items.DriveItem;

// assume that Client object is already constructed
DriveItem item = client.getItem("XXXXXXXXXXXXXXXX!XXXX");

// change item's name and flush to server.
item.rename("new name");


// change item's description and flush to server.
item.updateDescription("blah blah");


// refresh item's all variable to latest value
item.refresh();

10. Upload file (asynchronously)

  • like asynchronous downloading, it uses Future & Promise mechanism.
  • more detail of UploadFuture will explain later at wiki...
import java.nio.file.Path;
import com.bhyoo.onedrive.network.async.UploadFuture;

// assume that Client object is already constructed

UploadFuture future;

// start to upload file
future = client.uploadFile("{remote-folder-id}", Paths.get("local-file-path"));
// wait until uploading is done
future.syncUninterruptibly();

*Item diagram

diagram

onedrive-sdk-java's People

Contributors

cgivre avatar isac322 avatar tommy-mor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

onedrive-sdk-java's Issues

Build Failed: Java SE version 12.

Build file '/Users/piyush.bajaj/Downloads/OneDrive-SDK-java-master/build.gradle' line: 63
A problem occurred evaluating root project 'onedrive-sdk-java'.

Could not resolve all files for configuration ':compile'.
Could not find netty-transport-native-epoll-osx-x86_64.jar (io.netty:netty-transport-native-epoll:4.1.38.Final).
Searched in the following locations:
https://jcenter.bintray.com/io/netty/netty-transport-native-epoll/4.1.38.Final/netty-transport-native-epoll-4.1.38.Final-osx-x86_64.jar

So, only till JDK 9 is supported?

Code is not up to date

I see many missing methods.

Error:(268, 37) java: cannot find symbol
symbol: method getCode()
location: variable response of type org.onedrive.network.sync.SyncResponse
Error:(269, 77) java: cannot find symbol
symbol: method getContent()
location: variable response of type org.onedrive.network.sync.SyncResponse
Error:(272, 85) java: cannot find symbol
symbol: method getContent()
location: variable response of type org.onedrive.network.sync.SyncResponse

Download file from OneDrive

Hi,
Im 16 years old and Im new to java with onedirive.So, I would like to know, how can I acces onedrive and download a file from there. Can u help me??? Thanks!!

NPE when trying to deserialize VideoFacet

The following code

Client client = new Client(clientId, SCOPE, REDIRECT_URL, clientSecret);
client.getRootDir();

Produces the given NPE below:

Exception in thread "main" java.lang.NullPointerException
	at com.bhyoo.onedrive.container.facet.VideoFacet.<init>(VideoFacet.java:32)
	at com.bhyoo.onedrive.container.facet.VideoFacet.deserialize(VideoFacet.java:105)
	at com.bhyoo.onedrive.container.items.AbstractDriveItem.deserialize(AbstractDriveItem.java:222)
	at com.bhyoo.onedrive.container.items.AbstractDriveItem.deserialize(AbstractDriveItem.java:244)
	at com.bhyoo.onedrive.client.RequestTool.parseDriveItem(RequestTool.java:131)
	at com.bhyoo.onedrive.client.RequestTool.parseFolderItemAndHandle(RequestTool.java:547)
	at com.bhyoo.onedrive.client.Client.getRootDir(Client.java:144)

This maybe happens if there is a video in root folder, because I have such.

Publish on Maven Central?

Thanks for releasing under the MIT license!! Would you also consider adding a pom.xml file and publishing on MavenCentral?
Thanks again!!

Sample program to connect to OneDrive and get the vsd file in there

  • I have requirement, where in user will be just inputting the OneDrive URL of the .vsd file

  • I need to take that URL and connect to one drive and get the .vsd file in there and that file I need to give it to other API to render the .vsd file in Confluence editor page.

Can you please help me in what are the required parameter to address this like user need to input any other details like AccessToken and how I can get them would be grateful. Thanks in advance.

Let me know if anything is not clear. As I am new to this few of the questions may look very basic.

Support for Microsoft Graph

Hey!
Might be a compilation error, but it does not seem to support Microsoft Graph:

The following error occurs upon client.getRootDir() call, using this scope;
String[] scope = {"Files.ReadWrite", "offline_access", "Files.ReadWrite.AppFolder"};

Exception in thread "main" java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonGenerator.writeStartObject(Ljava/lang/Object;)V at com.fasterxml.jackson.databind.node.ObjectNode.serialize(ObjectNode.java:295) at com.fasterxml.jackson.databind.ser.std.SerializableSerializer.serialize(SerializableSerializer.java:39) at com.fasterxml.jackson.databind.ser.std.SerializableSerializer.serialize(SerializableSerializer.java:20) at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480) at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319) at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:3716) at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:3656) at com.bhyoo.onedrive.container.items.DefaultFolderItem.addChildren(DefaultFolderItem.java:56) at com.bhyoo.onedrive.container.items.DefaultFolderItem.parseChildren(DefaultFolderItem.java:122) at com.bhyoo.onedrive.container.items.DefaultFolderItem$PointerInjector.convert(DefaultFolderItem.java:283) at com.bhyoo.onedrive.container.items.DefaultFolderItem$PointerInjector.convert(DefaultFolderItem.java:276) at com.fasterxml.jackson.databind.deser.std.StdDelegatingDeserializer.convertValue(StdDelegatingDeserializer.java:246) at com.fasterxml.jackson.databind.deser.std.StdDelegatingDeserializer.deserialize(StdDelegatingDeserializer.java:173) at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1611) at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1234) at com.bhyoo.onedrive.client.RequestTool.parseAndHandle(RequestTool.java:544) at com.bhyoo.onedrive.client.RequestTool.parseFolderItemAndHandle(RequestTool.java:520) at com.bhyoo.onedrive.client.Client.getRootDir(Client.java:168)

Build error

Running ./gradlew build with jdk8 results in the following output:

> Task :compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7


FAILURE: Build failed with an exception.

* Where:
Build file '/home/nik/git/OneDrive-SDK-java/build.gradle' line: 72

* What went wrong:
Execution failed for task ':delombok'.
> java.lang.NoClassDefFoundError: lombok/permit/Permit

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 25s
3 actionable tasks: 3 executed

It might as well be lombok issue as explained here: projectlombok/lombok#1932

Edit: Nevermind, its a lombok issue. The 1.18.4 version is bugged and delombok doesn't work.

AbstractDriveItem

Hi Isac,

i have trouble with AbstractDriveItem.java:
throw new UnsupportedOperationException("Unsupported type of item. contact author");

	else if (remoteItem.getPackages() != null) {
			throw new UnsupportedOperationException("RemotePackageItem isn't yet supported");
		}
		else {
			throw new UnsupportedOperationException("Unsupported type of item. contact author");
		}
	}
	else {
		**throw new UnsupportedOperationException("Unsupported type of item. contact author");**
	}
}

Maybee new type of items?

Thank you.
David

Problem with autologin

Always when I run application, it's opening page in browser with Microsoft login page. The same behaviour with both auto login on and off. Should it be like that? I hope there is a way to login without any user interaction.

Make thread pool

And handle jobs (file downloading, fetching children's metadata and etc.) asynchronously.

New Release?

@isac322 Thanks for your great library. Sorry to be a pest, but would it be possible for you to publish a new release? I'm looking to add this to Apache Drill and it would be best if we had a new release. Thanks!!

Trying to Login in Testcase with my Own App throws null pointer

Hey! I just found your API and tried to use my own App to connect with.
I changed the client id and the client secret but when I start the Test TestCases it always throws a Null Pointer.

 java.lang.NullPointerException

	at com.bhyoo.onedrive.network.sync.SyncRequest.makeResponse(SyncRequest.java:210)
	at com.bhyoo.onedrive.network.sync.SyncRequest.sendContent(SyncRequest.java:148)
	at com.bhyoo.onedrive.network.sync.SyncRequest.doPost(SyncRequest.java:79)
	at com.bhyoo.onedrive.network.sync.SyncRequest.doPost(SyncRequest.java:66)
	at com.bhyoo.onedrive.client.auth.AuthHelper.getToken(AuthHelper.java:249)
	at com.bhyoo.onedrive.client.auth.AuthHelper.redeemToken(AuthHelper.java:230)
	at com.bhyoo.onedrive.client.auth.AuthHelper.login(AuthHelper.java:118)
	at com.bhyoo.onedrive.client.Client.login(Client.java:45)
	at com.bhyoo.onedrive.client.Client.<init>(Client.java:95)
	at com.bhyoo.onedrive.client.Client.<init>(Client.java:69)
	at com.bhyoo.onedrive.TestCases.getClient(TestCases.java:36)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:125)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:132)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptLifecycleMethod(TimeoutExtension.java:111)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptBeforeAllMethod(TimeoutExtension.java:60)
	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:104)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:62)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:43)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:35)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllMethods$8(ClassBasedTestDescriptor.java:371)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllMethods(ClassBasedTestDescriptor.java:369)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:193)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:77)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:102)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:82)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:78)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
	at com.sun.proxy.$Proxy2.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:132)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:175)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:157)
	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:748)

com.bhyoo.onedrive.TestCases > initializationError FAILED
    java.lang.NullPointerException at TestCases.java:36
1 test completed, 1 failed
> Task :test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///Users/jonathan/Documents/GitHub/Lernen/OneDrive-SDK-java/build/reports/tests/test/index.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
6 actionable tasks: 2 executed, 4 up-to-date
There were failing tests. See the report at: file:///Users/jonathan/Documents/GitHub/Lernen/OneDrive-SDK-java/build/reports/tests/test/index.html

Build issue

When I try to build using the command you have shared getting the below error. Pleas suggest the fix. Thanks

ranumola@RK:~/sde/development/onedrive-java-client-master/OneDrive-SDK-java-master$ gradle build
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/ranumola/sde/development/onedrive-java-client-master/OneDrive-SDK-java-master/build.gradle' line: 5

* What went wrong:
An exception occurred applying plugin request [id: 'io.freefair.lombok', version: '3.8.4']
> Failed to apply plugin [id 'io.freefair.lombok']
   > Could not create plugin of type 'LombokPlugin'.
      > Could not generate a decorated class for class io.freefair.gradle.plugins.lombok.LombokPlugin.
         > org/gradle/api/plugins/quality/FindBugsExtension

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s

Can you push the jar to maven if possible, so that we can use directly from there and look for examples here. Thanks

@odata.count throws error

java.lang.IllegalStateException: Unknown attribute detected in DriveItemPager : @odata.count
	at com.bhyoo.onedrive.container.pager.DriveItemPager.deserializeRecursive(DriveItemPager.java:66)
	at com.bhyoo.onedrive.client.RequestTool.parseDriveItemRecursiveAndHandle(RequestTool.java:733)
	at com.bhyoo.onedrive.container.items.DefaultFolderItem.fetchChildren(DefaultFolderItem.java:150)
	at com.bhyoo.onedrive.container.items.DefaultFolderItem.<init>(DefaultFolderItem.java:74)
	at com.bhyoo.onedrive.container.items.AbstractDriveItem.deserialize(AbstractDriveItem.java:320)
	at com.bhyoo.onedrive.client.RequestTool.parseDriveItem(RequestTool.java:131)
	at com.bhyoo.onedrive.client.RequestTool.parseFolderItemAndHandle(RequestTool.java:547)
	at com.bhyoo.onedrive.client.Client.getRootDir(Client.java:144)
	at OneDriveExporter.upload(OneDriveExporter.java:32)
	at MyCanvas.pointerButtonEvent(EntryProcessing.java:329)
	at jwinpointer.JWinPointerReader.PointerButtonEvent(JWinPointerReader.java:130)

The parser failed when just trying to call client.getRootDir()
Maybe the api changed, and now @odata.count is part of the data microsoft returns?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.