List of usage examples for java.lang IllegalArgumentException getMessage
public String getMessage()
From source file:org.metawatch.manager.Monitors.java
public static void start(Context context, TelephonyManager telephonyManager) { // start weather updater if (Preferences.logging) Log.d(MetaWatch.TAG, "Monitors.start()"); createBatteryLevelReciever(context); createWifiReceiver(context);/*from w ww. j a v a 2 s . c o m*/ if (Preferences.weatherGeolocation) { if (Preferences.logging) Log.d(MetaWatch.TAG, "Initialising Geolocation"); try { locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); locationProvider = LocationManager.NETWORK_PROVIDER; networkLocationListener = new NetworkLocationListener(context); locationManager.requestLocationUpdates(locationProvider, 30 * 60 * 1000, 500, networkLocationListener); RefreshLocation(); } catch (IllegalArgumentException e) { if (Preferences.logging) Log.d(MetaWatch.TAG, "Failed to initialise Geolocation " + e.getMessage()); } } else { if (Preferences.logging) Log.d(MetaWatch.TAG, "Geolocation disabled"); } CallStateListener phoneListener = new CallStateListener(context); telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); int phoneEvents = PhoneStateListener.LISTEN_CALL_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE; telephonyManager.listen(phoneListener, phoneEvents); if (Utils.isGmailAccessSupported(context)) { gmailMonitor = new GmailMonitor(context); gmailMonitor.startMonitor(); } try { contentObserverMessages = new ContentObserverMessages(context); Uri uri = Uri.parse("content://mms-sms/conversations/"); contentResolverMessages = context.getContentResolver(); contentResolverMessages.registerContentObserver(uri, true, contentObserverMessages); } catch (Exception x) { } try { contentObserverCalls = new ContentObserverCalls(context); //Uri uri = Uri.parse("content://mms-sms/conversations/"); contentResolverCalls = context.getContentResolver(); contentResolverCalls.registerContentObserver(android.provider.CallLog.Calls.CONTENT_URI, true, contentObserverCalls); } catch (Exception x) { } try { contentObserverAppointments = new ContentObserverAppointments(context); Uri uri = Uri.parse("content://com.android.calendar/calendars/"); contentResolverAppointments = context.getContentResolver(); contentResolverAppointments.registerContentObserver(uri, true, contentObserverAppointments); } catch (Exception x) { } // temporary one time update updateWeatherData(context); startAlarmTicker(context); }
From source file:com.auditbucket.helper.GlobalControllerExceptionHandler.java
@ExceptionHandler(IllegalArgumentException.class) @ResponseStatus(HttpStatus.BAD_REQUEST)/* w w w .j a v a2 s .c o m*/ public ModelAndView handleIAException(IllegalArgumentException ex) { return new JsonError(ex.getMessage()).asModelAndView(); }
From source file:org.trustedanalytics.metadata.security.UserOrgAccessFilter.java
@Override protected void doFilterInternal(HttpServletRequest innerRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException { BufferedRequestWrapper request = new BufferedRequestWrapper(innerRequest); UUID orgId;// w w w. ja v a2 s.c o m try { orgId = OrgGuidRetriever.getOrgGuidFromRequestBody(request.getBody()); LOG.debug(String.format("Org user want to access: '%s'", orgId)); } catch (IllegalArgumentException e) { LOG.debug(e.getMessage(), e); httpServletResponse.sendError(404, "Org GUID could not be retreived from request body."); return; } if (authorization.checkAccess(innerRequest, orgId)) { LOG.debug("User access confirmed."); filterChain.doFilter(request, httpServletResponse); } else { LOG.debug("User access denied."); httpServletResponse.sendError(403, "You can't access specified organization."); } }
From source file:com.capgemini.archaius.spring.CamelPropertiesLoadingTest.java
@Test public void nonExistentPropertiesWhenrequestedViaCamelThrowIllegalArgumentExceptions() { try {/* w ww .j a v a 2s . c o m*/ context.resolvePropertyPlaceholders("{{" + nonExistentPropertyKey + "}}"); fail("An IllegalArgument Exception shound be thrown"); } catch (IllegalArgumentException ex) { assertThat(ex.getMessage(), is(equalTo("Property with key [" + nonExistentPropertyKey + "] not found in properties from text: {{" + nonExistentPropertyKey + "}}"))); } catch (Exception ex) { fail("All other exceptions should not be thrown: " + ex.getMessage()); } }
From source file:com.acciente.oacc.encryptor.jasypt.PasswordEncoderDecoderTest.java
@Test public void testDecodeLegacyPassword() throws Exception { try {//from w w w. j av a 2 s. c o m encoderDecoder.decode(ENCODED_LEGACY_PASSWORD); fail("Expected an IllegalArgumentException"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), startsWith("Unexpected marker for Jasypt password:")); } }
From source file:com.acciente.oacc.encryptor.jasypt.PasswordEncoderDecoderTest.java
@Test public void decodePasswordCheckExceptionDoesNotContainFullEncodedPassword() throws Exception { try {/*from w ww .j a v a 2s . c o m*/ encoderDecoder.decode(ENCODED_INVALID_PASSWORD); fail("Expected IllegalArgumentException, but not thrown"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), endsWith(ENCODED_INVALID_PASSWORD.substring(0, MARKER.length()))); } }
From source file:com.capgemini.archaius.spring.jdbc.CamelPropertiesLoadingFromJdbcAndPropertiesFileTest.java
@Test public void nonExistentPropertiesWhenRequestedViaCamelThrowIllegalArgumentExceptions() throws InterruptedException { // When/*from ww w.j av a2s . co m*/ try { context.resolvePropertyPlaceholders("{{" + nonExistentPropertyKey + "}}"); // Then fail("An IllegalArgument Exception shound be thrown"); } catch (IllegalArgumentException ex) { assertThat(ex.getMessage(), is(equalTo("Property with key [" + nonExistentPropertyKey + "] not found in properties from text: {{" + nonExistentPropertyKey + "}}"))); } catch (Exception ex) { fail("All other exceptions should not be thrown: " + ex.getMessage()); } }
From source file:org.nebula.service.exception.NebulaExceptionHandler.java
@ExceptionHandler({ IllegalArgumentException.class, GeneralSecurityException.class }) protected ResponseEntity<Object> badRequest(IllegalArgumentException ex, WebRequest request) { String bodyOfResponse = ex.getMessage(); ResponseEntity<Object> response = handleExceptionInternal(null, bodyOfResponse, new HttpHeaders(), HttpStatus.BAD_REQUEST, request); logger.error("Exception:" + response.toString(), ex); return response; }
From source file:de.kaiserpfalzEdv.iam.core.role.PermissionBuilder.java
@Override public PermissionDO build() { PermissionDO result;//from w w w.j av a2 s . c om try { result = generate(); } catch (IllegalArgumentException e) { throw new IllegalStateException(e.getMessage(), e); } result.validate(); return result; }
From source file:com.alfresco.orm.repository.RepositoryBeanPostProcessor.java
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { Class clazz = bean.getClass(); List<Method> repositoryMethod = ReflectionUtil.setterMethodForAnnotation(clazz, AlfrescoRepositoryBean.class); for (Method method : repositoryMethod) { try {//from w w w . j ava2s . c om method.invoke(bean, AlfrescoRespositoryProxyFactoryBean.getAlfrescoRespositoryProxyFactoryBean() .getObject(method.getParameterTypes()[0])); } catch (IllegalArgumentException e) { throw new BeansException(e.getMessage(), e) { }; } catch (IllegalAccessException e) { throw new BeansException(e.getMessage(), e) { }; } catch (InvocationTargetException e) { throw new BeansException(e.getMessage(), e) { }; } catch (InstantiationException e) { throw new BeansException(e.getMessage(), e) { }; } } return bean; }