Skip to content

Commit

Permalink
Add block to handle null task payload in pull queue REST sample (#212)
Browse files Browse the repository at this point in the history
* Replaced queue.xml with queue.yaml

* Add block to handle null payload
  • Loading branch information
jsimonweb authored and lesv committed Apr 28, 2016
1 parent 47ecf80 commit 25713c9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions taskqueue/pull/src/main/java/TaskQueueSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,12 @@ private static Tasks getLeasedTasks(Taskqueue taskQueue) throws IOException {
*/
private static void processTask(Task task) {
byte[] payload = Base64.decodeBase64(task.getPayloadBase64());
System.out.println("Payload for the task:");
System.out.println(new String(payload));
if (payload != null) {
System.out.println("Payload for the task:");
System.out.println(new String(payload));
} else {
System.out.println("This task has no payload.");
}
}
/**
* Method that sends a delete request for the specified task object to the taskqueue service.
Expand Down

0 comments on commit 25713c9

Please sign in to comment.