2014-10-16 3 views
0

Android 용 라이브 SDK를 사용하여 하나의 드라이브에 업로드하려고 할 때마다 항상 예외로 "null"이 표시됩니다. 로그에서OneDrive Android SDK 업로드 오류

public void createFile(){ 
     Thread t = new Thread(new Runnable() 
     { 
      @Override 
      public void run() 
      { 

       String fileName = "UploadTest.txt"; 
       String filePath = Environment.getExternalStorageDirectory().toString() + File.separator + fileName; 
       File file = new File(filePth); 
       try { 
        final FileInputStream is = new FileInputStream(file); 
        client.uploadAsync("me/skydrive",file.getName(), is, new LiveUploadOperationListener() { 
         public void onUploadFailed(LiveOperationException exception, LiveOperation operation) { 

          Log.e("OneDrive","Error uploading file 1: " + exception.getMessage()); 
         } 

         public void onUploadCompleted(LiveOperation operation) { 

          Log.e("OneDrive","File uploaded."); 
          try { 
           is.close(); 
          } catch (IOException ioe) { 

           Log.e("OneDrive","Error uploading file 2: " + ioe.getMessage()); 
          } 
         } 

         public void onUploadProgress(int totalBytes, int bytesRemaining, LiveOperation operation) { 

         } 
        }); 
       } catch (IOException ioex) { 

        Log.e("OneDrive","Error uploading file 3: " + ioex.getMessage()); 
        return; 
       } catch (Exception ex) { 

        Log.e("OneDrive","Error uploading file 4: " + ex.getMessage()); 
        return; 
       } 
      } 
     }); 
     t.start(); 
} 

보고서 : : 나는 루트 디렉토리에 업로드하려고

Error uploading file 4:null 

여기 내 코드입니다.

감사합니다.

+0

잡히는 예외를 찾으십시오. 메세지는'null'이므로, Exception 전체를 인쇄 할 수 있습니다 (아마도 toString을 호출 할 수 있습니다). – Kai

+0

http://ideone.com/PE4U21 ... 당신이 NPE를 얻고 있다는 큰 기회가 있습니다. 그래서 당신은 내 downvote를 가지고 있습니다 ... prolly'client'는'null'입니다. – Selvin

+0

@SelvinWell, downvote에 감사드립니다. 나는 그것의 NPE를 알고 있지만, 나는 그것을주는 부분을 찾을 수 없다. 대부분 경로 (me/skydrive)가있을 수 있습니다 ...하지만 마이크로 소프트가 루트 경로로 언급했습니다 – vkm

답변