jdk/src/share/classes/java/time/LocalDateTime.java
changeset 20517 1336a85b3d52
parent 19841 15c8e97d6a14
child 20520 0952771e3e25
--- a/jdk/src/share/classes/java/time/LocalDateTime.java	Fri Oct 04 16:05:55 2013 +0100
+++ b/jdk/src/share/classes/java/time/LocalDateTime.java	Thu Aug 29 20:38:46 2013 +0100
@@ -1129,6 +1129,11 @@
      */
     @Override
     public LocalDateTime plus(TemporalAmount amountToAdd) {
+        Objects.requireNonNull(amountToAdd, "amountToAdd");
+        if (amountToAdd instanceof Period) {
+            Period periodToAdd = (Period) amountToAdd;
+            return with(date.plus(periodToAdd), time);
+        }
         return (LocalDateTime) amountToAdd.addTo(this);
     }
 
@@ -1343,6 +1348,11 @@
      */
     @Override
     public LocalDateTime minus(TemporalAmount amountToSubtract) {
+        Objects.requireNonNull(amountToSubtract, "amountToSubtract");
+        if (amountToSubtract instanceof Period) {
+            Period periodToSubtract = (Period) amountToSubtract;
+            return with(date.minus(periodToSubtract), time);
+        }
         return (LocalDateTime) amountToSubtract.subtractFrom(this);
     }