Клуб API Диска

Ошибка запроса retrofit2 yandexsdk. Ошибка Attempt to invoke virtual method?

4 мая, 20:14

Здесь формируется на отправку запрос(в документации яндекс написано, что параметры path и from должны иметь url формат, я параметры написал вручную:

new AsyncTask<Void, Void, Void>() {

                @Override
                protected Void doInBackground(Void... params) {
                    RestClient client = null;
                    try {

                        client = RestClientUtil.getInstance(credentials);
                        client.move("%2F1.jpg", "%2F211.jpg", false);
                    } catch (HttpCodeException ex) {
                        Log.d(TAG, "renameMoveItem", ex);
                        sendException(ex.getResponse().getDescription());
                    } catch (IOException | ServerException ex) {
                        Log.d(TAG, "renameMoveItem", ex);
                        sendException(ex);
                    }
                    return null;
                }

                @Override
                protected void onPostExecute(Void aVoid) {
                    RenameMoveItemFragment targetFragment = (RenameMoveItemFragment) getTargetFragment();
                    if (targetFragment != null) {
                        targetFragment.onComplete();
                    }
                }
            }.execute();
        }

вот сам интерфейс c sdk:

@POST("/v1/disk/resources/move")
    Link move(@Query("from") String from, @Query("path") String path,
              @Query("overwrite") Boolean overwrite)
            throws IOException, ServerIOException;

ВОТ ЛОГИ:

FATAL EXCEPTION: AsyncTask #2
                    Process: com.example.gibkin.multycloud, PID: 10297
                                                                               java.lang.RuntimeException: An error occurred while executing doInBackground()
                                                                                   at android.os.AsyncTask$3.done(AsyncTask.java:309)
                                                                                   at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
                                                                                   at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
                                                                                   at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                                                   at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
                                                                                   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                                   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                                   at java.lang.Thread.run(Thread.java:818)
                                                                                Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Handler.post(java.lang.Runnable)' on a null object reference
                                                                                   at com.example.gibkin.multycloud.yandex.example.IODialogRetainedFragment.sendException(IODialogRetainedFragment.java:32)
                                                                                   at com.example.gibkin.multycloud.yandex.example.IODialogRetainedFragment.sendException(IODialogRetainedFragment.java:28)
                                                                                   at com.example.gibkin.multycloud.yandex.example.RenameMoveItemFragment$RenameMoveItemRetainedFragment$1.doInBackground(RenameMoveItemFragment.java:144)
                                                                                   at com.example.gibkin.multycloud.yandex.example.RenameMoveItemFragment$RenameMoveItemRetainedFragment$1.doInBackground(RenameMoveItemFragment.java:130)
                                                                                   at android.os.AsyncTask$2.call(AsyncTask.java:295)
                                                                                   at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                   at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
                                                                                   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                                                                                   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                                                                                   at java.lang.Thread.run(Thread.java:818) 

1 комментарий
Подписаться на комментарии к посту
gibkin2009
4 мая, 21:39
в загрузке файла код ошибки 416