Java Code Examples for java.lang.RuntimeException
The following examples show how to use
java.lang.RuntimeException. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: android_9.0.0_r45 Source File: ConsumerIrService.java License: Apache License 2.0 | 6 votes |
ConsumerIrService(Context context) { mContext = context; PowerManager pm = (PowerManager)context.getSystemService( Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); mWakeLock.setReferenceCounted(true); mHasNativeHal = halOpen(); if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CONSUMER_IR)) { if (!mHasNativeHal) { throw new RuntimeException("FEATURE_CONSUMER_IR present, but no IR HAL loaded!"); } } else if (mHasNativeHal) { throw new RuntimeException("IR HAL present, but FEATURE_CONSUMER_IR is not set!"); } }
Example 2
Source Project: jdk8u-jdk Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void cbc_shortRead600() throws Exception { System.out.println("Running cbc_shortRead600"); // Encrypt 600 byte with AES/CBC/PKCS5Padding byte[] ct = encryptedText("CBC", 600); // Create stream with encrypted data CipherInputStream in = getStream("CBC", ct); try { in.read(); in.close(); System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 3
Source Project: jdk8u-jdk Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void cbc_shortRead400() throws Exception { System.out.println("Running cbc_shortRead400"); // Encrypt 400 byte with AES/CBC/PKCS5Padding byte[] ct = encryptedText("CBC", 400); // Create stream with encrypted data CipherInputStream in = getStream("CBC", ct); try { in.read(); in.close(); System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 4
Source Project: sakai Source File: SakaiScriptAddMemberToSiteWithRoleBatchTest.java License: Educational Community License v2.0 | 6 votes |
@Test public void testRemoveMemberFromSiteBatchNotExistingUser() { WebClient client = WebClient.create(getFullEndpointAddress()); addClientMocks(client); // client call client.accept("text/plain"); client.path("/" + getOperation()); client.query("sessionid", SESSION_ID); client.query("siteid", "site1"); client.query("eids", "user1,nouser"); client.query("roleid", "student"); // client result thrown.expect(RuntimeException.class); client.get(String.class); }
Example 5
Source Project: dragonwell8_jdk Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void cbc_shortStream() throws Exception { Cipher c; AlgorithmParameters params; byte[] read = new byte[200]; System.out.println("Running cbc_shortStream"); // Encrypt 97 byte with AES/CBC/PKCS5Padding byte[] ct = encryptedText("CBC", 97); // Create stream with only 96 bytes of encrypted data CipherInputStream in = getStream("CBC", ct, 96); try { int size = in.read(read); in.close(); if (size != 80) { throw new RuntimeException("Fail: CipherInputStream.read() " + "returned " + size + ". Should have been 80"); } System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 6
Source Project: openjdk-jdk9 Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void gcm_suppressUnreadCorrupt() throws Exception { Cipher c; byte[] read = new byte[200]; System.out.println("Running supressUnreadCorrupt test"); // Encrypt 100 bytes with AES/GCM/PKCS5Padding byte[] ct = encryptedText("GCM", 100); // Corrupt the encrypted message ct = corruptGCM(ct); // Create stream for decryption CipherInputStream in = getStream("GCM", ct); try { in.close(); System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 7
Source Project: hottub Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void cbc_shortRead600() throws Exception { System.out.println("Running cbc_shortRead600"); // Encrypt 600 byte with AES/CBC/PKCS5Padding byte[] ct = encryptedText("CBC", 600); // Create stream with encrypted data CipherInputStream in = getStream("CBC", ct); try { in.read(); in.close(); System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 8
Source Project: sakai Source File: SakaiScriptChangeSiteMemberStatusTest.java License: Educational Community License v2.0 | 6 votes |
@Test public void testChangeSiteMemberStatusNotExitingUser() { WebClient client = WebClient.create(getFullEndpointAddress()); addClientMocks(client); // client call client.accept("text/plain"); client.path("/" + getOperation()); client.query("sessionid", SESSION_ID); client.query("siteid", "siteid"); client.query("eid", "nouser"); client.query("active", true); // client result thrown.expect(RuntimeException.class); client.get(String.class); }
Example 9
Source Project: TencentKona-8 Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void gcm_suppressUnreadCorrupt() throws Exception { Cipher c; byte[] read = new byte[200]; System.out.println("Running supressUnreadCorrupt test"); // Encrypt 100 bytes with AES/GCM/PKCS5Padding byte[] ct = encryptedText("GCM", 100); // Corrupt the encrypted message ct = corruptGCM(ct); // Create stream for decryption CipherInputStream in = getStream("GCM", ct); try { in.close(); System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 10
Source Project: sakai Source File: SakaiScriptSetUserPropertyTest.java License: Educational Community License v2.0 | 6 votes |
@Test public void testSetUserTimeZoneNotExistingUser() { WebClient client = WebClient.create(getFullEndpointAddress()); addClientMocks(client); // client call client.accept("text/plain"); client.path("/" + getOperation()); client.query("sessionid", SESSION_ID); client.query("eid", "nouser"); client.query("key", "Company"); client.query("value", "Apereo"); // client result thrown.expect(RuntimeException.class); client.get(String.class); }
Example 11
Source Project: TencentKona-8 Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void cbc_shortStream() throws Exception { Cipher c; AlgorithmParameters params; byte[] read = new byte[200]; System.out.println("Running cbc_shortStream"); // Encrypt 97 byte with AES/CBC/PKCS5Padding byte[] ct = encryptedText("CBC", 97); // Create stream with only 96 bytes of encrypted data CipherInputStream in = getStream("CBC", ct, 96); try { int size = in.read(read); in.close(); if (size != 80) { throw new RuntimeException("Fail: CipherInputStream.read() " + "returned " + size + ". Should have been 80"); } System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 12
Source Project: TencentKona-8 Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void cbc_shortRead400() throws Exception { System.out.println("Running cbc_shortRead400"); // Encrypt 400 byte with AES/CBC/PKCS5Padding byte[] ct = encryptedText("CBC", 400); // Create stream with encrypted data CipherInputStream in = getStream("CBC", ct); try { in.read(); in.close(); System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 13
Source Project: TencentKona-8 Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void cbc_shortRead600() throws Exception { System.out.println("Running cbc_shortRead600"); // Encrypt 600 byte with AES/CBC/PKCS5Padding byte[] ct = encryptedText("CBC", 600); // Create stream with encrypted data CipherInputStream in = getStream("CBC", ct); try { in.read(); in.close(); System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 14
Source Project: openjdk-jdk9 Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void gcm_oneReadByteCorrupt() throws Exception { System.out.println("Running gcm_oneReadByteCorrupt test"); // Encrypt 100 bytes with AES/GCM/PKCS5Padding byte[] ct = encryptedText("GCM", 100); // Corrupt the encrypted message ct = corruptGCM(ct); // Create stream for decryption CipherInputStream in = getStream("GCM", ct); try { in.read(); System.out.println(" Fail. No exception thrown."); } catch (IOException e) { Throwable ec = e.getCause(); if (ec instanceof AEADBadTagException) { System.out.println(" Pass."); } else { System.out.println(" Fail: " + ec.getMessage()); throw new RuntimeException(ec); } } }
Example 15
Source Project: sakai Source File: SakaiScriptChangeSiteMemberStatusTest.java License: Educational Community License v2.0 | 6 votes |
@Test public void testChangeSiteMemberStatusNotExitingUser() { WebClient client = WebClient.create(getFullEndpointAddress()); addClientMocks(client); // client call client.accept("text/plain"); client.path("/" + getOperation()); client.query("sessionid", SESSION_ID); client.query("siteid", "siteid"); client.query("eid", "nouser"); client.query("active", true); // client result thrown.expect(RuntimeException.class); client.get(String.class); }
Example 16
Source Project: openjdk-jdk9 Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void cbc_shortRead400() throws Exception { System.out.println("Running cbc_shortRead400"); // Encrypt 400 byte with AES/CBC/PKCS5Padding byte[] ct = encryptedText("CBC", 400); // Create stream with encrypted data CipherInputStream in = getStream("CBC", ct); try { in.read(); in.close(); System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 17
Source Project: jdk8u60 Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void gcm_suppressUnreadCorrupt() throws Exception { Cipher c; byte[] read = new byte[200]; System.out.println("Running supressUnreadCorrupt test"); // Encrypt 100 bytes with AES/GCM/PKCS5Padding byte[] ct = encryptedText("GCM", 100); // Corrupt the encrypted message ct = corruptGCM(ct); // Create stream for decryption CipherInputStream in = getStream("GCM", ct); try { in.close(); System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 18
Source Project: jdk8u60 Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void gcm_oneReadByte() throws Exception { System.out.println("Running gcm_oneReadByte test"); // Encrypt 100 bytes with AES/GCM/PKCS5Padding byte[] ct = encryptedText("GCM", 100); // Create stream for decryption CipherInputStream in = getStream("GCM", ct); try { in.read(); System.out.println(" Pass."); } catch (Exception e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 19
Source Project: olingo-odata4 Source File: DemoServlet.java License: Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); handler.register(new DemoActionProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 20
Source Project: jdk8u_jdk Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void cbc_shortStream() throws Exception { Cipher c; AlgorithmParameters params; byte[] read = new byte[200]; System.out.println("Running cbc_shortStream"); // Encrypt 97 byte with AES/CBC/PKCS5Padding byte[] ct = encryptedText("CBC", 97); // Create stream with only 96 bytes of encrypted data CipherInputStream in = getStream("CBC", ct, 96); try { int size = in.read(read); in.close(); if (size != 80) { throw new RuntimeException("Fail: CipherInputStream.read() " + "returned " + size + ". Should have been 80"); } System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 21
Source Project: jdk8u60 Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void cbc_shortRead400() throws Exception { System.out.println("Running cbc_shortRead400"); // Encrypt 400 byte with AES/CBC/PKCS5Padding byte[] ct = encryptedText("CBC", 400); // Create stream with encrypted data CipherInputStream in = getStream("CBC", ct); try { in.read(); in.close(); System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 22
Source Project: sakai Source File: SakaiScriptRemoveMemberFromSiteBatchTest.java License: Educational Community License v2.0 | 6 votes |
@Test public void testRemoveMemberFromSiteBatchNotExistingSite() { WebClient client = WebClient.create(getFullEndpointAddress()); //MODIFY addClientMocks(client); // client call client.accept("text/plain"); client.path("/" + getOperation()); client.query("sessionid", SESSION_ID); client.query("siteid", "nosite"); client.query("eids", "user1,nouser"); // client result thrown.expect(RuntimeException.class); client.get(String.class); }
Example 23
Source Project: react-native-geolocation-service Source File: RNFusedLocationModule.java License: MIT License | 6 votes |
/** * Helper method to invoke success callback */ private void invokeSuccess(WritableMap data, boolean isSingleUpdate) { if (!isSingleUpdate) { getContext().getJSModule(RCTDeviceEventEmitter.class) .emit("geolocationDidChange", data); return; } try { if (mSuccessCallback != null) { mSuccessCallback.invoke(data); } clearCallbacks(); } catch (RuntimeException e) { // Illegal callback invocation Log.w(TAG, e.getMessage()); } }
Example 24
Source Project: react-native-geolocation-service Source File: RNFusedLocationModule.java License: MIT License | 6 votes |
/** * Helper method to invoke error callback */ private void invokeError(int code, String message, boolean isSingleUpdate) { if (!isSingleUpdate) { getContext().getJSModule(RCTDeviceEventEmitter.class) .emit("geolocationError", LocationUtils.buildError(code, message)); return; } try { if (mErrorCallback != null) { mErrorCallback.invoke(LocationUtils.buildError(code, message)); } clearCallbacks(); } catch (RuntimeException e) { // Illegal callback invocation Log.w(TAG, e.getMessage()); } }
Example 25
Source Project: olingo-odata4 Source File: DemoServlet.java License: Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 26
Source Project: sakai Source File: SakaiScriptAddMemberToSiteWithRoleBatchTest.java License: Educational Community License v2.0 | 6 votes |
@Test public void testRemoveMemberFromSiteBatchNotExistingUser() { WebClient client = WebClient.create(getFullEndpointAddress()); addClientMocks(client); // client call client.accept("text/plain"); client.path("/" + getOperation()); client.query("sessionid", SESSION_ID); client.query("siteid", "site1"); client.query("eids", "user1,nouser"); client.query("roleid", "student"); // client result thrown.expect(RuntimeException.class); client.get(String.class); }
Example 27
Source Project: jdk8u-jdk Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void gcm_oneReadByte() throws Exception { System.out.println("Running gcm_oneReadByte test"); // Encrypt 100 bytes with AES/GCM/PKCS5Padding byte[] ct = encryptedText("GCM", 100); // Create stream for decryption CipherInputStream in = getStream("GCM", ct); try { in.read(); System.out.println(" Pass."); } catch (Exception e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 28
Source Project: Android-POS Source File: DataBinderMapperImpl.java License: MIT License | 6 votes |
@Override public ViewDataBinding getDataBinder(DataBindingComponent component, View[] views, int layoutId) { if(views == null || views.length == 0) { return null; } int localizedLayoutId = INTERNAL_LAYOUT_ID_LOOKUP.get(layoutId); if(localizedLayoutId > 0) { final Object tag = views[0].getTag(); if(tag == null) { throw new RuntimeException("view must have a tag"); } switch(localizedLayoutId) { } } return null; }
Example 29
Source Project: hottub Source File: CipherInputStreamExceptions.java License: GNU General Public License v2.0 | 6 votes |
static void gcm_suppressUnreadCorrupt() throws Exception { Cipher c; byte[] read = new byte[200]; System.out.println("Running supressUnreadCorrupt test"); // Encrypt 100 bytes with AES/GCM/PKCS5Padding byte[] ct = encryptedText("GCM", 100); // Corrupt the encrypted message ct = corruptGCM(ct); // Create stream for decryption CipherInputStream in = getStream("GCM", ct); try { in.close(); System.out.println(" Pass."); } catch (IOException e) { System.out.println(" Fail: " + e.getMessage()); throw new RuntimeException(e.getCause()); } }
Example 30
Source Project: sakai Source File: SakaiScriptSetUserTimeZoneTest.java License: Educational Community License v2.0 | 6 votes |
@Test public void testSetUserTimeZoneNotExistingUser() { WebClient client = WebClient.create(getFullEndpointAddress()); addClientMocks(client); // client call client.accept("text/plain"); client.path("/" + getOperation()); client.query("sessionid", SESSION_ID); client.query("eid", "nouser"); client.query("timeZoneId", "Europe/Oslo"); // client result thrown.expect(RuntimeException.class); client.get(String.class); }