List of usage examples for java.lang NullPointerException getMessage
public String getMessage()
From source file:com.digits.sdk.android.DigitsSessionTests.java
@Test public void testCreate_nullDigitsSessionResponse() throws Exception { try {/*from w ww.j av a2 s . c o m*/ final DigitsSessionResponse response = null; DigitsSession.create(response, TestConstants.PHONE); fail(); } catch (NullPointerException ex) { assertEquals("result must not be null", ex.getMessage()); } }
From source file:com.digits.sdk.android.DigitsSessionTests.java
@Test public void testCreate_nullResult() throws Exception { try {//from w w w . java 2 s.c o m final Result result = null; DigitsSession.create(result, TestConstants.PHONE); fail(); } catch (NullPointerException ex) { assertEquals("result must not be null", ex.getMessage()); } }
From source file:com.codepiex.droidlibx.permission.PermissionRequestor.java
private boolean requestPermissions(Activity activity, String[] permissions) { boolean status = false; try {/*from www . j a v a2 s . co m*/ ActivityCompat.requestPermissions(activity, permissions, requestCode); status = true; } catch (NullPointerException e) { e.printStackTrace(); Log.e(TAG, e.getMessage() + " At requestPermissions(...) of PermissionRequestor"); } return status; }
From source file:com.digits.sdk.android.DigitsSessionTests.java
@Test public void testCreate_nullResultData() throws Exception { try {//from ww w . j av a2s. co m final Response response = new Response(TestConstants.TWITTER_URL, HttpStatus.SC_ACCEPTED, DigitsSession.DEFAULT_PHONE_NUMBER, new ArrayList<Header>(), null); DigitsSession.create(new Result<DigitsUser>(null, response), TestConstants.PHONE); fail(); } catch (NullPointerException ex) { assertEquals("result.data must not be null", ex.getMessage()); } }
From source file:com.cyberway.issue.crawler.datamodel.ServerCache.java
/** * Get the {@link CrawlServer} associated with <code>curi</code>. * @param cauri CandidateURI we're to get server from. * @return CrawlServer instance that matches the passed CandidateURI. *///from ww w. j av a 2 s . com public CrawlServer getServerFor(CandidateURI cauri) { CrawlServer cs = null; try { String key = CrawlServer.getServerKey(cauri); // TODOSOMEDAY: make this robust against those rare cases // where authority is not a hostname. if (key != null) { cs = getServerFor(key); } } catch (URIException e) { logger.severe(e.getMessage() + ": " + cauri); e.printStackTrace(); } catch (NullPointerException npe) { logger.severe(npe.getMessage() + ": " + cauri); npe.printStackTrace(); } return cs; }
From source file:org.openmrs.module.rheapocadapter.handler.ClientRegistryService.java
public String registerNewPatient(Patient patient) { try {// w w w. ja va 2 s . c o m String result = ""; MessageTransformer messageTransformer = new HL7MessageTransformer(); String message = ""; message += (String) messageTransformer.generateMessage(patient, "Create"); if ("".equals(message) || message.equals(null)) { return "Register failed due to message creation, Contact Administrator"; } log.error("Message to send " + message); TransactionUtil.setCreator(patient.getCreator()); String[] methd = new String[] { "POST", "RegisterNew" }; TreeMap<String, String> parameters = new TreeMap<String, String>(); Thread thread = new Thread(new PatientMessageThread(methd, message, parameters, patient, "Saving ")); thread.setDaemon(true); thread.start(); return null; } catch (NullPointerException e) { log.error(e.getMessage()); return ""; } }
From source file:com.digits.sdk.android.DigitsSessionTests.java
@Test public void testCreate_nullResultResponse() throws Exception { try {//from w w w.j av a 2 s . co m DigitsSession.create( new Result<>(new DigitsUser(TestConstants.USER_ID, DigitsSession.DEFAULT_PHONE_NUMBER), null), TestConstants.PHONE); fail(); } catch (NullPointerException ex) { assertEquals("result.response must not be null", ex.getMessage()); } }
From source file:com.digits.sdk.android.DigitsSessionTests.java
@Test public void testCreate_nullVerifyAccountResponse() throws Exception { try {//from w w w . j av a 2 s . c o m DigitsSession.create(null); fail(); } catch (NullPointerException ex) { assertEquals("verifyAccountResponse must not be null", ex.getMessage()); } }
From source file:org.eel.kitchen.jsonschema.uri.URIManagerTest.java
@Test public void shouldNotBeAbleToRegisterNullScheme() { try {/* w ww . j a va 2s. c o m*/ manager.registerScheme(null, mock); fail("No exception thrown!"); } catch (NullPointerException e) { assertEquals(e.getMessage(), "scheme is null"); } }
From source file:org.eel.kitchen.jsonschema.uri.URIManagerTest.java
@Test public void shouldHandleNullURI() throws JsonSchemaException { try {// w w w . j av a2s. c o m manager.getContent(null); fail("No exception thrown!"); } catch (NullPointerException e) { assertEquals(e.getMessage(), "null URI"); } }