This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d2beeb
commit efd23e8
Showing
2 changed files
with
26 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.apache.fineract.data.remote; | ||
|
||
import java.io.IOException; | ||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Type; | ||
|
||
import okhttp3.ResponseBody; | ||
import retrofit2.Converter; | ||
import retrofit2.Retrofit; | ||
|
||
public class NullOnEmptyConverterFactory extends Converter.Factory { | ||
|
||
@Override | ||
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, | ||
Retrofit retrofit) { | ||
final Converter<ResponseBody, ?> delegate = retrofit.nextResponseBodyConverter(this, type, | ||
annotations); | ||
return new Converter<ResponseBody, Object>() { | ||
@Override | ||
public Object convert(ResponseBody body) throws IOException { | ||
if (body.contentLength() == 0) return null; | ||
return delegate.convert(body); | ||
} | ||
}; | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
app/src/main/java/org/apache/fineract/data/remote/NullOnEmptyConverterFactory.kt
This file was deleted.
Oops, something went wrong.