Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/main/java/com/sforce/ws/bind/TypeMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.math.BigDecimal;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalQueries;
import java.util.*;
Expand All @@ -66,6 +67,8 @@ public class TypeMapper {
private static final HashSet<String> keywords = getKeyWords();
private static HashMap<String, Class<?>> primitiveClassCache = getPrimitiveClassCache();

private static final DateTimeFormatter DTF = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX");

// True if interfaces are generated for the WSDL
private boolean generateInterfaces;
private boolean generateExtendedErrorCodes;
Expand Down Expand Up @@ -421,7 +424,7 @@ private void writeSingleObject(XmlOutputStream out, TypeInfo info, Object value)
String s = calendarCodec.getValueAsString(value);
writeSimpleType(out, info, s, true, Calendar.class.getName());
} else if (value instanceof OffsetDateTime) {
writeSimpleType(out, info, value.toString(), true, OffsetDateTime.class.getName());
writeSimpleType(out, info, DTF.format((OffsetDateTime)value), true, OffsetDateTime.class.getName());
} else if (value instanceof OffsetDate) {
writeSimpleType(out, info, value.toString(), true, OffsetDate.class.getName());
} else if (value instanceof OffsetTime) {
Expand All @@ -445,7 +448,6 @@ private void writeSingleObject(XmlOutputStream out, TypeInfo info, Object value)
writeString(out, info, value.toString(), true);
}
}

private void writeNull(XmlOutputStream out, TypeInfo info) throws IOException {
out.writeStartTag(getNamespace(info), info.getName());
out.writeAttribute(Constants.SCHEMA_INSTANCE_NS, "nil", "true");
Expand Down
5 changes: 5 additions & 0 deletions src/test/java/com/sforce/ws/bind/TypeMapperTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,9 @@ public void testTimeRead() throws PullParserException, IOException, ConnectionEx
assertEquals(ZoneOffset.of("+05:00"), result2.getOffset());
assertEquals(LocalTime.of(11, 22, 33, 444000000), result2.toLocalTime());
}

@Test
public void writingOffsetDateTimeDoesntDropExtraZeros() {

}
}