summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTarun Gupta <tarun1995gupta@gmail.com>2015-06-30 13:30:18 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-07-07 07:27:46 (GMT)
commit1f31d8301bbb89a61235d575ac3c5a2061df3a69 (patch)
tree46df5f1c716e74f73fd743291ff3bc7e3e4a3800 /src
parentae1f4d65b253fa1a263556be7419836a37683dd2 (diff)
downloadstroke-1f31d8301bbb89a61235d575ac3c5a2061df3a69.zip
stroke-1f31d8301bbb89a61235d575ac3c5a2061df3a69.tar.bz2
Update JingleFileTransferFileInfo in light of recent discussions related to Date.
Updates VCard Element, JingleFileTransferFileInfo to allow dates to be null, as a indicator for not a valid date time. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Corresponding tests changed, which passes. Change-Id: I9c9b4a84b7bebc18e8ef8ba5050e45ac2f13aa65
Diffstat (limited to 'src')
-rw-r--r--src/com/isode/stroke/elements/JingleFileTransferFileInfo.java18
-rw-r--r--src/com/isode/stroke/elements/VCard.java6
-rw-r--r--src/com/isode/stroke/serializer/payloadserializers/JingleFileTransferFileInfoSerializer.java2
3 files changed, 15 insertions, 11 deletions
diff --git a/src/com/isode/stroke/elements/JingleFileTransferFileInfo.java b/src/com/isode/stroke/elements/JingleFileTransferFileInfo.java
index 100afd9..fc4675e 100644
--- a/src/com/isode/stroke/elements/JingleFileTransferFileInfo.java
+++ b/src/com/isode/stroke/elements/JingleFileTransferFileInfo.java
@@ -39,7 +39,7 @@ public class JingleFileTransferFileInfo extends Payload {
* Default Constructor.
*/
public JingleFileTransferFileInfo() {
- this("", "", 0, new Date(0L));
+ this("", "", 0, null);
}
/**
@@ -47,7 +47,7 @@ public class JingleFileTransferFileInfo extends Payload {
* @param name, NotNull.
*/
public JingleFileTransferFileInfo(String name) {
- this(name, "", 0, new Date(0L));
+ this(name, "", 0, null);
}
/**
@@ -56,7 +56,7 @@ public class JingleFileTransferFileInfo extends Payload {
* @param description, NotNull.
*/
public JingleFileTransferFileInfo(String name, String description) {
- this(name, description, 0, new Date(0L));
+ this(name, description, 0, null);
}
/**
@@ -66,7 +66,7 @@ public class JingleFileTransferFileInfo extends Payload {
* @param size.
*/
public JingleFileTransferFileInfo(String name, String description, long size) {
- this(name, description, size, new Date(0L));
+ this(name, description, size, null);
}
/**
@@ -74,19 +74,18 @@ public class JingleFileTransferFileInfo extends Payload {
* @param name, NotNull.
* @param description, NotNull.
* @param size.
- * @param date, NotNull.
+ * @param date. Null means invalid date.
*/
public JingleFileTransferFileInfo(String name, String description, long size, Date date) {
NotNull.exceptIfNull(name, "name");
NotNull.exceptIfNull(description, "description");
- NotNull.exceptIfNull(date, "date");
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
this.name_ = name;
this.description_ = description;
this.size_ = size;
this.date_ = date;
this.supportsRangeRequests_ = false;
this.rangeOffset_ = 0;
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}
/**
@@ -149,15 +148,14 @@ public class JingleFileTransferFileInfo extends Payload {
}
/**
- * @param date, NotNull.
+ * @param date. Null means invalid date.
*/
public void setDate(Date date) {
- NotNull.exceptIfNull(date, "date");
date_ = date;
}
/**
- * @return date, NotNull.
+ * @return date, which may be null for an invalid date.
*/
public Date getDate() {
return date_;
diff --git a/src/com/isode/stroke/elements/VCard.java b/src/com/isode/stroke/elements/VCard.java
index 2eb26d0..3bd4db2 100644
--- a/src/com/isode/stroke/elements/VCard.java
+++ b/src/com/isode/stroke/elements/VCard.java
@@ -162,10 +162,16 @@ public class VCard extends Payload implements Serializable {
if (emailAddresses_ != null) emailAddresses_.clear();
}
+ /**
+ * @param date, null indicates invalid date.
+ */
public void setBirthday(final Date birthday) {
birthday_ = birthday;
}
+ /**
+ * @return date, may be null which indicates invalid date.
+ */
public final Date getBirthday() {
return birthday_;
}
diff --git a/src/com/isode/stroke/serializer/payloadserializers/JingleFileTransferFileInfoSerializer.java b/src/com/isode/stroke/serializer/payloadserializers/JingleFileTransferFileInfoSerializer.java
index a9ae722..2efea78 100644
--- a/src/com/isode/stroke/serializer/payloadserializers/JingleFileTransferFileInfoSerializer.java
+++ b/src/com/isode/stroke/serializer/payloadserializers/JingleFileTransferFileInfoSerializer.java
@@ -32,7 +32,7 @@ public class JingleFileTransferFileInfoSerializer extends GenericPayloadSerializ
public String serializePayload(JingleFileTransferFileInfo fileInfo) {
XMLElement fileElement = new XMLElement("file", "");
- if (fileInfo.getDate().getTime() != 0L) {
+ if (fileInfo.getDate() != null) {
fileElement.addNode(new XMLElement("date", "", DateTime.dateToString(fileInfo.getDate())));
}