Skip to content

Commit 6f0532f

Browse files
committed
correctly handle certain optional SOAP message fields
- Criteria.Version - P2PService.SymetricPath - P2PService.SourceSTP - P2PService.DestSTP
1 parent adead3c commit 6f0532f

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/main/java/nl/surf/polynsi/soap/connection/provider/ConnectionServiceProviderPortImpl.java

+14-7
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ public void reserve(javax.xml.ws.Holder<String> connectionId, String globalReser
352352
LOG.fine(String.format("global reservation ID %s", globalReservationId));
353353
LOG.fine(String.format("description %s", description));
354354
LOG.fine(String.format("service type %s", soapCriteria.getServiceType()));
355-
LOG.fine(String.format("version %d", soapCriteria.getVersion()));
355+
if (soapCriteria.getVersion() != null)
356+
LOG.fine(String.format("version %d", soapCriteria.getVersion()));
356357

357358
try {
358359
Header pbHeader = toProtobuf(soapHeader.value);
@@ -369,20 +370,22 @@ public void reserve(javax.xml.ws.Holder<String> connectionId, String globalReser
369370

370371
// ReservationRequestCriteria
371372
ReservationRequestCriteria.Builder pbReservationRequestCriteriaBuilder = ReservationRequestCriteria
372-
.newBuilder().setVersion(soapCriteria.getVersion());
373+
.newBuilder();
374+
if (soapCriteria.getVersion() != null)
375+
pbReservationRequestCriteriaBuilder.setVersion(soapCriteria.getVersion());
373376

374377
// Schedule
375378
if (soapCriteria.getSchedule() != null) {
376379
Schedule.Builder pbScheduleBuilder = Schedule.newBuilder();
377380
if (soapCriteria.getSchedule().getStartTime() != null) {
378381
LOG.fine(String.format("start time %s", soapCriteria.getSchedule().getStartTime()
379382
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)));
380-
LOG.fine(String.format("end time %s", soapCriteria.getSchedule().getEndTime()
381-
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)));
382383
pbScheduleBuilder.setStartTime(Timestamps.parse(soapCriteria.getSchedule().getStartTime()
383384
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)));
384385
}
385386
if (soapCriteria.getSchedule().getEndTime() != null) {
387+
LOG.fine(String.format("end time %s", soapCriteria.getSchedule().getEndTime()
388+
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)));
386389
pbScheduleBuilder.setEndTime(Timestamps.parse(soapCriteria.getSchedule().getEndTime()
387390
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)));
388391
}
@@ -422,15 +425,19 @@ public void reserve(javax.xml.ws.Holder<String> connectionId, String globalReser
422425
pbP2PServiceBuilder.setDirectionality(directionality);
423426
}
424427

425-
/* TODO Need to test each of the following SOAP elements for null. As some might not be set
428+
/* Need to test each of the following SOAP elements for null. As some might not be set
426429
in case of an Reserve message update. An update generally only specifies a subset. Eg
427430
the initial Reservation included the wrong bandwidth. The update Reserve message will then
428431
only specifies the bandwidth (with the correct value).
429432
*/
430433
LOG.fine(String.format("source STP %s", soapP2PService.getSourceSTP()));
431434
LOG.fine(String.format("destination STP %s", soapP2PService.getDestSTP()));
432-
pbP2PServiceBuilder.setSymmetricPath(soapP2PService.isSymmetricPath())
433-
.setSourceStp(soapP2PService.getSourceSTP()).setDestStp(soapP2PService.getDestSTP());
435+
if (soapP2PService.isSymmetricPath() != null)
436+
pbP2PServiceBuilder.setSymmetricPath(soapP2PService.isSymmetricPath());
437+
if (soapP2PService.getSourceSTP() != null)
438+
pbP2PServiceBuilder.setSourceStp(soapP2PService.getSourceSTP());
439+
if (soapP2PService.getDestSTP() != null)
440+
pbP2PServiceBuilder.setDestStp(soapP2PService.getDestSTP());
434441

435442
if (soapP2PService.getEro() != null) {
436443
List<OrderedStpType> soapOrderedSTP = soapP2PService.getEro().getOrderedSTP();

0 commit comments

Comments
 (0)