Merge "Cleanup openssl test generation scripts to work in any directory"
diff --git a/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp b/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp
index ce2e2ee..ee6a57e 100644
--- a/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp
+++ b/luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp
@@ -5985,7 +5985,7 @@
 static jlong NativeCrypto_SSL_CTX_new(JNIEnv* env, jclass) {
     Unique_SSL_CTX sslCtx(SSL_CTX_new(SSLv23_method()));
     if (sslCtx.get() == NULL) {
-        jniThrowRuntimeException(env, "SSL_CTX_new");
+        throwExceptionIfNecessary(env, "SSL_CTX_new");
         return 0;
     }
     SSL_CTX_set_options(sslCtx.get(),
diff --git a/luni/src/test/java/libcore/java/util/CalendarTest.java b/luni/src/test/java/libcore/java/util/CalendarTest.java
index b0e6b6b..dd44789 100644
--- a/luni/src/test/java/libcore/java/util/CalendarTest.java
+++ b/luni/src/test/java/libcore/java/util/CalendarTest.java
@@ -213,13 +213,27 @@
       cal.set(Calendar.MONTH, Calendar.JANUARY);
       cal.set(Calendar.DAY_OF_MONTH, 1);
       cal.clear(Calendar.HOUR_OF_DAY);
+      cal.clear(Calendar.HOUR);
       cal.clear(Calendar.MINUTE);
       cal.clear(Calendar.SECOND);
       cal.clear(Calendar.MILLISECOND);
 
-      assertEquals(75600000, cal.getTimeInMillis());
+      // Now we have a mix of set and unset fields.
+      assertTrue(cal.isSet(Calendar.DAY_OF_MONTH));
+      assertFalse(cal.isSet(Calendar.HOUR_OF_DAY));
 
-      cal.set (Calendar.HOUR_OF_DAY, 0);
+      // When we call get, unset fields are computed.
+      assertEquals(0, cal.get(Calendar.HOUR_OF_DAY));
+      // And set fields stay the same.
+      assertEquals(1, cal.get(Calendar.DAY_OF_MONTH));
+
+      // ...so now everything is set.
+      assertTrue(cal.isSet(Calendar.DAY_OF_MONTH));
+      assertTrue(cal.isSet(Calendar.HOUR_OF_DAY));
+
       assertEquals(28800000, cal.getTimeInMillis());
+
+      cal.set(Calendar.HOUR_OF_DAY, 1);
+      assertEquals(32400000, cal.getTimeInMillis());
     }
 }