@@ -38,7 +38,7 @@ import java.net.URL
38
38
class GetRemoteUserAvatarOperation (private val avatarDimension : Int ) :
39
39
RemoteOperation <RemoteAvatarData >() {
40
40
override fun run (client : OwnCloudClient ): RemoteOperationResult <RemoteAvatarData > {
41
- lateinit var inputStream: InputStream
41
+ var inputStream: InputStream ? = null
42
42
lateinit var getMethod: GetMethod
43
43
44
44
lateinit var result: RemoteOperationResult <RemoteAvatarData >
@@ -71,7 +71,7 @@ class GetRemoteUserAvatarOperation(private val avatarDimension: Int) :
71
71
Timber .d(" Avatar size: Bytes received ${bytesArray.size} of $contentLength " )
72
72
73
73
// find out etag
74
- val etag = WebdavUtils .getEtagFromResponse(getMethod);
74
+ val etag = WebdavUtils .getEtagFromResponse(getMethod)
75
75
if (etag.isEmpty()) {
76
76
Timber .w(" Could not read Etag from avatar" )
77
77
}
@@ -87,14 +87,14 @@ class GetRemoteUserAvatarOperation(private val avatarDimension: Int) :
87
87
88
88
} catch (e: Exception ) {
89
89
result = RemoteOperationResult (e)
90
- Timber .e(e, " Exception while getting OC user avatar" );
90
+ Timber .e(e, " Exception while getting OC user avatar" )
91
91
92
92
} finally {
93
93
try {
94
- client.exhaustResponse(inputStream);
95
- inputStream.close()
94
+ client.exhaustResponse(inputStream)
95
+ inputStream? .close()
96
96
} catch (i: IOException ) {
97
- Timber .e(i, " Unexpected exception closing input stream" );
97
+ Timber .e(i, " Unexpected exception closing input stream" )
98
98
}
99
99
}
100
100
0 commit comments