mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	Show error message when there is an external storage error
This commit is contained in:
		
							parent
							
								
									28d228b296
								
							
						
					
					
						commit
						21d1265ca5
					
				| @ -118,7 +118,8 @@ public class RemoteOperationResult implements Serializable { | ||||
|         INVALID_CHARACTER_DETECT_IN_SERVER, | ||||
|         DELAYED_FOR_WIFI, | ||||
|         LOCAL_FILE_NOT_FOUND, | ||||
|         MAINTENANCE_MODE | ||||
|         MAINTENANCE_MODE, | ||||
|         SPECIFIC_SERVICE_UNAVAILABLE | ||||
|     } | ||||
| 
 | ||||
|     private boolean mSuccess = false; | ||||
| @ -254,7 +255,7 @@ public class RemoteOperationResult implements Serializable { | ||||
|                 ErrorMessageParser xmlParser = new ErrorMessageParser(); | ||||
|                 try { | ||||
|                     String errorMessage = xmlParser.parseXMLResponse(is); | ||||
|                     if (errorMessage != null && errorMessage != "") { | ||||
|                     if (errorMessage != "" && errorMessage != null) { | ||||
|                         mCode = ResultCode.SPECIFIC_FORBIDDEN; | ||||
|                         mHttpPhrase = errorMessage; | ||||
|                     } | ||||
| @ -264,6 +265,25 @@ public class RemoteOperationResult implements Serializable { | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (mHttpCode == HttpStatus.SC_SERVICE_UNAVAILABLE) { | ||||
|             String bodyResponse = httpMethod.getResponseBodyAsString(); | ||||
| 
 | ||||
|             if (bodyResponse != null && bodyResponse.length() > 0) { | ||||
|                 InputStream is = new ByteArrayInputStream(bodyResponse.getBytes()); | ||||
|                 ErrorMessageParser xmlParser = new ErrorMessageParser(); | ||||
|                 try { | ||||
|                     String errorMessage = xmlParser.parseXMLResponse(is); | ||||
|                     if (errorMessage != "" && errorMessage != null) { | ||||
|                         mCode = ResultCode.SPECIFIC_SERVICE_UNAVAILABLE; | ||||
|                         mHttpPhrase = errorMessage; | ||||
|                     } | ||||
|                 } catch (Exception e) { | ||||
|                     Log_OC.w(TAG, "Error reading exception from server: " + e.getMessage()); | ||||
|                     // mCode stays as set in this(success, httpCode, headers) | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -96,7 +96,6 @@ public class ReadRemoteFolderOperation extends RemoteOperation { | ||||
|                 } | ||||
|             } else { | ||||
|                 // synchronization failed | ||||
|                 client.exhaustResponse(query.getResponseBodyAsStream()); | ||||
|                 result = new RemoteOperationResult(false, query); | ||||
|             } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user