List of usage examples for java.lang NullPointerException getMessage
public String getMessage()
From source file:com.vmihalachi.turboeditor.activity.HomeActivity.java
/** * {@inheritDoc}//from ww w . j a v a2s. c o m */ @Override protected void onDestroy() { try { closeKeyBoard(); } catch (NullPointerException e) { Log.e(TAG, e.getMessage(), e); } super.onDestroy(); }
From source file:org.opendaylight.sfc.util.openflow.SfcOpenflowUtilsTest.java
@Test public void shouldThrowNPExceptionForCreateActionSet() { // Test that null cannot be used for MAC address try {/*from w w w .j a v a 2 s.c o m*/ createActionSetDlSrc(null, randomInt.nextInt(1500 - 0 + 1) + 1); } catch (NullPointerException e) { assertEquals("Error message does not match", "Supplied value may not be null", e.getMessage()); } }
From source file:com.microsoft.live.unittest.UploadTest.java
public void testSyncFilenameNull() throws Exception { try {/*from ww w . j av a2 s . c om*/ this.liveConnectClient.upload(Paths.ME_SKYDRIVE, null, FILE); this.failNoNullPointerExceptionThrown(); } catch (NullPointerException e) { assertNotNull(e.getMessage()); } }
From source file:org.apache.xml.security.utils.XMLUtils.java
/** * This method returns the first non-null owner document of the Nodes in this Set. * This method is necessary because it <I>always</I> returns a * {@link Document}. {@link Node#getOwnerDocument} returns <CODE>null</CODE> * if the {@link Node} is a {@link Document}. * * @param xpathNodeSet//w ww .j a va 2 s . co m * @return the owner document */ public static Document getOwnerDocument(Set<Node> xpathNodeSet) { NullPointerException npe = null; for (Node node : xpathNodeSet) { int nodeType = node.getNodeType(); if (nodeType == Node.DOCUMENT_NODE) { return (Document) node; } try { if (nodeType == Node.ATTRIBUTE_NODE) { return ((Attr) node).getOwnerElement().getOwnerDocument(); } return node.getOwnerDocument(); } catch (NullPointerException e) { npe = e; } } throw new NullPointerException(I18n.translate("endorsed.jdk1.4.0") + " Original message was \"" + (npe == null ? "" : npe.getMessage()) + "\""); }
From source file:com.microsoft.live.unittest.UploadTest.java
public void testAsyncFileNull() { try {// w ww . j ava2 s . co m this.liveConnectClient.uploadAsync(Paths.ME_SKYDRIVE, null, FILE, NullLiveUploadOperationListener.INSTANCE); this.failNoNullPointerExceptionThrown(); } catch (NullPointerException e) { assertNotNull(e.getMessage()); } }
From source file:org.elasticsearch.client.sniff.ElasticsearchHostsSnifferTests.java
public void testConstructorValidation() throws IOException { try {/* w w w . j a v a2s . c o m*/ new ElasticsearchHostsSniffer(null, 1, ElasticsearchHostsSniffer.Scheme.HTTP); fail("should have failed"); } catch (NullPointerException e) { assertEquals("restClient cannot be null", e.getMessage()); } HttpHost httpHost = new HttpHost(httpServer.getAddress().getHostString(), httpServer.getAddress().getPort()); try (RestClient restClient = RestClient.builder(httpHost).build()) { try { new ElasticsearchHostsSniffer(restClient, 1, null); fail("should have failed"); } catch (NullPointerException e) { assertEquals(e.getMessage(), "scheme cannot be null"); } try { new ElasticsearchHostsSniffer(restClient, RandomNumbers.randomIntBetween(getRandom(), Integer.MIN_VALUE, 0), ElasticsearchHostsSniffer.Scheme.HTTP); fail("should have failed"); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), "sniffRequestTimeoutMillis must be greater than 0"); } } }
From source file:com.vmihalachi.turboeditor.activity.HomeActivity.java
/** * When a file is saved/*from w ww . ja v a 2s . c om*/ * Invoked by the EditorFragment * * @param event The event called */ public void onEvent(FileSavedEvent event) { try { closeKeyBoard(); } catch (NullPointerException e) { Log.e(TAG, e.getMessage(), e); } // Get intent, action and MIME type final Intent intent = getIntent(); final String action = intent.getAction(); final String type = intent.getType(); if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_EDIT.equals(action) || Intent.ACTION_PICK.equals(action) && type != null) { //This Activity was called by startActivityForResult final Intent returnIntent = new Intent(); setResult(Activity.RESULT_OK, returnIntent); // finish the activity finish(); } else { //This Activity was called by startActivity // mDrawerLayout.openDrawer(Gravity.LEFT); // getActionBar().setTitle(getString(R.string.nome_app_turbo_editor)); // Replace fragment getFragmentManager().beginTransaction().replace(R.id.fragment_editor, new NoFileOpenedFragment()) .commit(); } }
From source file:com.microsoft.live.unittest.UploadTest.java
public void testSyncFileNull() throws Exception { try {/* w ww. ja va 2 s . c om*/ this.liveConnectClient.upload(Paths.ME_SKYDRIVE, FILENAME, (InputStream) null); this.failNoNullPointerExceptionThrown(); } catch (NullPointerException e) { assertNotNull(e.getMessage()); } try { this.liveConnectClient.upload(Paths.ME_SKYDRIVE, FILENAME, (File) null); this.failNoNullPointerExceptionThrown(); } catch (NullPointerException e) { assertNotNull(e.getMessage()); } }
From source file:com.microsoft.live.unittest.UploadTest.java
public void testAsyncFilenameNull() { try {/* www .j a v a 2s . c om*/ this.liveConnectClient.uploadAsync(Paths.ME_SKYDRIVE, FILENAME, (InputStream) null, NullLiveUploadOperationListener.INSTANCE); this.failNoNullPointerExceptionThrown(); } catch (NullPointerException e) { assertNotNull(e.getMessage()); } try { this.liveConnectClient.uploadAsync(Paths.ME_SKYDRIVE, FILENAME, (File) null, NullLiveUploadOperationListener.INSTANCE); this.failNoNullPointerExceptionThrown(); } catch (NullPointerException e) { assertNotNull(e.getMessage()); } }
From source file:org.openmrs.module.rheapocadapter.handler.ConnectionHandler.java
/** * @param string//from w w w . ja v a 2s. c om * @param implementationId * the implementationId to set */ private void setImplementationId(String string) { try { this.implementationId = Context.getAdministrationService().getImplementationId().getImplementationId(); } catch (NullPointerException e) { log.error("can't get implementationId; value not set " + e.getMessage()); } }