You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2018/03/03 09:23:10 UTC
[isis] branch master updated: ISIS-1485 proper handling of action
results Blob/Clob when null
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 04e2ac3 ISIS-1485 proper handling of action results Blob/Clob when null
04e2ac3 is described below
commit 04e2ac3ff399cef32d4398e935461f92273384b1
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sat Mar 3 10:23:08 2018 +0100
ISIS-1485 proper handling of action results Blob/Clob when null
---
.../apache/isis/schema/utils/CommonDtoUtils.java | 29 +++++++++++++++++-----
.../widgets/linkandlabel/ActionLink.java | 4 +--
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/core/applib/src/main/java/org/apache/isis/schema/utils/CommonDtoUtils.java b/core/applib/src/main/java/org/apache/isis/schema/utils/CommonDtoUtils.java
index 50854bd..de9a2d6 100644
--- a/core/applib/src/main/java/org/apache/isis/schema/utils/CommonDtoUtils.java
+++ b/core/applib/src/main/java/org/apache/isis/schema/utils/CommonDtoUtils.java
@@ -256,20 +256,37 @@ public final class CommonDtoUtils {
return valueDto;
}
case BLOB: {
+
final Blob blob = (Blob) val;
final BlobDto blobDto = new BlobDto();
- blobDto.setName(blob.getName());
- blobDto.setBytes(blob.getBytes());
- blobDto.setMimeType(blob.getMimeType().toString());
+
+ if(blob==null) {
+ blobDto.setName("#empty");
+ blobDto.setBytes(new byte[0]);
+ blobDto.setMimeType("");
+ } else {
+ blobDto.setName(blob.getName());
+ blobDto.setBytes(blob.getBytes());
+ blobDto.setMimeType(blob.getMimeType().toString());
+ }
+
valueDto.setBlob(blobDto);
return valueDto;
}
case CLOB: {
final Clob clob = (Clob) val;
final ClobDto clobDto = new ClobDto();
- clobDto.setName(clob.getName());
- clobDto.setChars(clob.getChars().toString());
- clobDto.setMimeType(clob.getMimeType().toString());
+
+ if(clob==null) {
+ clobDto.setName("#empty");
+ clobDto.setChars("");
+ clobDto.setMimeType("");
+ } else {
+ clobDto.setName(clob.getName());
+ clobDto.setChars(clob.getChars().toString());
+ clobDto.setMimeType(clob.getMimeType().toString());
+ }
+
valueDto.setClob(clobDto);
return valueDto;
}
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/linkandlabel/ActionLink.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/linkandlabel/ActionLink.java
index df3c2e0..adac775 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/linkandlabel/ActionLink.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/linkandlabel/ActionLink.java
@@ -237,11 +237,11 @@ public abstract class ActionLink extends AjaxLink<ObjectAdapter> implements IAja
@Override
protected IRequestHandler getRequestHandler() {
final ObjectAdapter resultAdapter = actionModel.execute();
- final Object value = resultAdapter.getObject();
+ final Object value = resultAdapter!=null ? resultAdapter.getObject() : null;
final IRequestHandler handler = ActionModel.downloadHandler(value);
- //XXX ISIS-1619, prevent clients from caching the response content
+ //ISIS-1619, prevent clients from caching the response content
return isNonIdempotent(actionModel)
? enforceNoCacheOnClientSide(handler)
: handler
--
To stop receiving notification emails like this one, please contact
ahuber@apache.org.