Example usage for java.lang RuntimeException getMessage

List of usage examples for java.lang RuntimeException getMessage

Introduction

In this page you can find the example usage for java.lang RuntimeException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:net.aircable.aircam.SL4A.java

public void connect() throws UnknownHostException, IOException, JSONException {
    proxy = AndroidProxy.sProxy;/* w w  w.  j  a  v  a  2  s  .  c om*/
    host = proxy.getAddress().getHostName();
    port = proxy.getAddress().getPort();
    secret = proxy.getSecret();

    connection = new Socket(host, port);
    input = new BufferedReader(new InputStreamReader(connection.getInputStream(), "8859_1"), 1 << 13);
    output = new PrintWriter(
            new OutputStreamWriter(new BufferedOutputStream(connection.getOutputStream(), 1 << 13), "8859_1"),
            true);
    id = 0;
    if (this.secret != null)
        try {
            this.callMethod("_authenticate", new JSONArray('[' + this.secret + ']'));
        } catch (RuntimeException e) {
            if (!e.getMessage().contains("Unknown RPC"))
                throw e;
        }
}

From source file:de.uzk.hki.da.cb.CreateEDMActionTests.java

@Test
public void missingMetadataFileInPublicPIP()
        throws IOException, RepositoryException, JDOMException, ParserConfigurationException, SAXException {
    FolderUtils.deleteQuietlySafe(makeMetadataFile(CB_PACKAGETYPE_EAD));
    try {//w w w  .  j av a  2 s .c  o  m
        action.implementation();
        fail();
    } catch (RuntimeException e) {
        assertTrue(e.getMessage().contains(CB_PACKAGETYPE_EAD));
    }
}

From source file:com.espertech.esper.core.InternalRoutePreprocessView.java

/**
 * Indicate an modifed event and its previous version.
 * @param newEvent modified event//www  .jav  a2s  .c  o  m
 * @param oldEvent previous version event
 */
public void indicate(EventBean newEvent, EventBean oldEvent) {
    try {
        if (statementResultService.isMakeNatural()) {
            NaturalEventBean natural = new NaturalEventBean(eventType,
                    new Object[] { newEvent.getUnderlying() }, newEvent);
            NaturalEventBean naturalOld = new NaturalEventBean(eventType,
                    new Object[] { oldEvent.getUnderlying() }, oldEvent);
            this.updateChildren(new NaturalEventBean[] { natural }, new NaturalEventBean[] { naturalOld });
        } else {
            this.updateChildren(new EventBean[] { newEvent }, new EventBean[] { oldEvent });
        }
    } catch (RuntimeException ex) {
        log.error("Unexpected error updating child view: " + ex.getMessage());
    }
}

From source file:br.com.brunogrossi.MediaScannerPlugin.MediaScannerPlugin.java

@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    try {// w ww .  j  ava 2s  .co m
        if (action.equals("scanFile")) {
            String fileUri = args.optString(0);
            if (fileUri != null && !fileUri.equals("")) {
                Uri contentUri = Uri.parse(fileUri);

                Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
                mediaScanIntent.setData(contentUri);
                this.cordova.getActivity().sendBroadcast(mediaScanIntent);

                callbackContext.success();

                return true;
            } else {
                Log.w(TAG, "No action param provided: " + action);
                callbackContext.error("No action param provided: " + action);
                return false;
            }
        } else {
            Log.w(TAG, "Wrong action was provided: " + action);
            return false;
        }
    } catch (RuntimeException e) {
        e.printStackTrace();
        callbackContext.error(e.getMessage());
        return false;
    }
}

From source file:com.espertech.esper.core.service.StatementEventDispatcherUnthreaded.java

public void observe(StatementLifecycleEvent theEvent) {
    if (theEvent.getEventType() == StatementLifecycleEvent.LifecycleEventType.CREATE) {
        Iterator<EPStatementStateListener> it = statementListeners.iterator();
        for (; it.hasNext();) {
            try {
                it.next().onStatementCreate(serviceProvider, theEvent.getStatement());
            } catch (RuntimeException ex) {
                log.error("Caught runtime exception in onStatementCreate callback:" + ex.getMessage(), ex);
            }//from   w  w w  .  java  2s.  c o m
        }
    } else if (theEvent.getEventType() == StatementLifecycleEvent.LifecycleEventType.STATECHANGE) {
        Iterator<EPStatementStateListener> it = statementListeners.iterator();
        for (; it.hasNext();) {
            try {
                it.next().onStatementStateChange(serviceProvider, theEvent.getStatement());
            } catch (RuntimeException ex) {
                log.error("Caught runtime exception in onStatementCreate callback:" + ex.getMessage(), ex);
            }
        }
    }
}

From source file:com.espertech.esper.core.StatementEventDispatcherUnthreaded.java

public void observe(StatementLifecycleEvent event) {
    if (event.getEventType() == StatementLifecycleEvent.LifecycleEventType.CREATE) {
        Iterator<EPStatementStateListener> it = statementListeners.iterator();
        for (; it.hasNext();) {
            try {
                it.next().onStatementCreate(serviceProvider, event.getStatement());
            } catch (RuntimeException ex) {
                log.error("Caught runtime exception in onStatementCreate callback:" + ex.getMessage(), ex);
            }//from  ww  w .j  a  v  a  2s  .  co  m
        }
    } else if (event.getEventType() == StatementLifecycleEvent.LifecycleEventType.STATECHANGE) {
        Iterator<EPStatementStateListener> it = statementListeners.iterator();
        for (; it.hasNext();) {
            try {
                it.next().onStatementStateChange(serviceProvider, event.getStatement());
            } catch (RuntimeException ex) {
                log.error("Caught runtime exception in onStatementCreate callback:" + ex.getMessage(), ex);
            }
        }
    }
}

From source file:com.orchestra.portale.controller.CartController.java

@RequestMapping(value = "/Cart/AddPoi")
public @ResponseBody String addPoi(@RequestParam String id) {

    StringBuilder jsonPois = new StringBuilder();

    try {/*from w w  w . j a va2s .c  o m*/
        CompletePOI poi = pm.getCompletePoiById(id);
        poiCart.addPoi(poi);
        jsonPois.append("{\"code\":\"0\"}");

    } catch (RuntimeException e) {
        jsonPois.append("{\"code\":\"1\", \"error\":\"").append(e.getMessage()).append("\"}");
    }

    return jsonPois.toString();
}

From source file:com.qpark.eip.core.spring.EipWsChannelInterceptorInitializer.java

/**
 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 *//*  w w  w.j a  v a 2s. c  o m*/
@Override
public void afterPropertiesSet() throws Exception {
    this.logger.debug("+afterPropertiesSet");
    int i = 0;
    String[] channelNames = this.applicationContext.getBeanNamesForType(AbstractMessageChannel.class);
    String[] interceptorNames = this.applicationContext.getBeanNamesForType(EipWsChannelInterceptor.class);

    List<EipWsChannelInterceptor> interceptors = new ArrayList<EipWsChannelInterceptor>(
            interceptorNames.length);
    Object proxy;
    for (String interceptorName : interceptorNames) {
        proxy = this.applicationContext.getBean(interceptorName);
        interceptors.add(this.getTargetObject(proxy, EipWsChannelInterceptor.class));
    }
    AbstractMessageChannel channel;
    for (String channelName : channelNames) {
        if (channelName.startsWith("eip")
                && (channelName.endsWith("WsChannelRequest") || channelName.endsWith("WsChannelResponse"))) {
            try {
                proxy = this.applicationContext.getBean(channelName);
                channel = this.getTargetObject(proxy, AbstractMessageChannel.class);
                for (EipWsChannelInterceptor interceptor : interceptors) {
                    channel.addInterceptor(interceptor);
                }
                i++;
            } catch (RuntimeException e) {
                this.logger.error(e.getMessage());
            } catch (Exception e) {
                this.logger.error(e.getMessage());
            } catch (Throwable e) {
                this.logger.error(e.getMessage());
            }
        }
    }

    this.logger.debug(
            "-afterPropertiesSet AbstractMessageChannels {}, EipWsChannnelInterceptors {}, channels changed {}",
            channelNames.length, interceptorNames.length, i);
}

From source file:io.isoft.system.controller.LoginController.java

@RemotingInclude
@RequestMapping(value = "user/stop", method = RequestMethod.GET, produces = "application/json")
public @ResponseBody void logOut(String userCode) {

    try {/*from w  w  w. j  a v a  2s  .c  o m*/
        pushService.stop(userCode);
    } catch (RuntimeException e) {
        logger.error(e.getMessage());
    }
}

From source file:com.github.horrorho.inflatabledonkey.args.ArgsManager.java

String parse(String optionName, String value, UnaryOperator<String> parser) {
    try {/*from   w w  w. j  a v  a 2 s . c o m*/
        return parser.apply(value);
    } catch (RuntimeException ex) {
        logger.debug("-- test() - RuntimeException: {}", ex.getMessage());
        throw new IllegalArgumentException(optionName + " has bad value '" + value + "'");
    }
}