jdk/src/share/classes/java/time/LocalDate.java
changeset 20517 1336a85b3d52
parent 19841 15c8e97d6a14
child 20519 eee7a92074fd
--- a/jdk/src/share/classes/java/time/LocalDate.java	Fri Oct 04 16:05:55 2013 +0100
+++ b/jdk/src/share/classes/java/time/LocalDate.java	Thu Aug 29 20:38:46 2013 +0100
@@ -1125,6 +1125,11 @@
      */
     @Override
     public LocalDate plus(TemporalAmount amountToAdd) {
+        Objects.requireNonNull(amountToAdd, "amountToAdd");
+        if (amountToAdd instanceof Period) {
+            Period periodToAdd = (Period) amountToAdd;
+            return plusMonths(periodToAdd.toTotalMonths()).plusDays(periodToAdd.getDays());
+        }
         return (LocalDate) amountToAdd.addTo(this);
     }
 
@@ -1353,6 +1358,11 @@
      */
     @Override
     public LocalDate minus(TemporalAmount amountToSubtract) {
+        Objects.requireNonNull(amountToSubtract, "amountToSubtract");
+        if (amountToSubtract instanceof Period) {
+            Period periodToSubtract = (Period) amountToSubtract;
+            return minusMonths(periodToSubtract.toTotalMonths()).minusDays(periodToSubtract.getDays());
+        }
         return (LocalDate) amountToSubtract.subtractFrom(this);
     }