sdk 修改npe问题
This commit is contained in:
@ -64,7 +64,7 @@ public class ModelConvertor {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Optional<QueryResult> toQueryResult(String json) {
|
public Optional<QueryResult> toQueryResult(String json) {
|
||||||
return Optional.of(json).map(content -> {
|
return Optional.ofNullable(json).map(content -> {
|
||||||
try {
|
try {
|
||||||
return objectMapper.readValue(content, QueryResult.class);
|
return objectMapper.readValue(content, QueryResult.class);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
@ -79,7 +79,7 @@ public class ModelConvertor {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Optional<byte[]> toByteArray(String json) {
|
public Optional<byte[]> toByteArray(String json) {
|
||||||
return Optional.of(json).map(content -> {
|
return Optional.ofNullable(json).map(content -> {
|
||||||
try {
|
try {
|
||||||
return tpDownPO(content).getFileStream();
|
return tpDownPO(content).getFileStream();
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
@ -94,7 +94,7 @@ public class ModelConvertor {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Optional<DownloadEntity> toDownloadEntity(String json) {
|
public Optional<DownloadEntity> toDownloadEntity(String json) {
|
||||||
return Optional.of(json).map(content -> {
|
return Optional.ofNullable(json).map(content -> {
|
||||||
DownloadEntity entity = null;
|
DownloadEntity entity = null;
|
||||||
try {
|
try {
|
||||||
SysStorageVO vo = tpDownPO(content);
|
SysStorageVO vo = tpDownPO(content);
|
||||||
@ -115,7 +115,7 @@ public class ModelConvertor {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Optional<UploadObject> toUploadObject(String json) {
|
public Optional<UploadObject> toUploadObject(String json) {
|
||||||
return Optional.of(json).map(content -> {
|
return Optional.ofNullable(json).map(content -> {
|
||||||
try {
|
try {
|
||||||
return new UploadObject().setId(toUploadPO(json).getFileId());
|
return new UploadObject().setId(toUploadPO(json).getFileId());
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
|
Reference in New Issue
Block a user