Example usage for java.lang RuntimeException printStackTrace

List of usage examples for java.lang RuntimeException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.red5.server.war.WarLoaderServlet.java

/**
 * Clearing the in-memory configuration parameters, we will receive
 * notification that the servlet context is about to be shut down
 *//* w ww  .jav a2s.  com*/
@Override
public void contextDestroyed(ServletContextEvent sce) {
    synchronized (servletContext) {
        logger.info("Webapp shutdown");
        // XXX Paul: grabbed this from
        // http://opensource.atlassian.com/confluence/spring/display/DISC/Memory+leak+-+classloader+won%27t+let+go
        // in hopes that we can clear all the issues with J2EE containers
        // during shutdown
        try {
            ServletContext ctx = sce.getServletContext();
            // prepare spring for shutdown
            Introspector.flushCaches();
            // dereg any drivers
            for (Enumeration e = DriverManager.getDrivers(); e.hasMoreElements();) {
                Driver driver = (Driver) e.nextElement();
                if (driver.getClass().getClassLoader() == getClass().getClassLoader()) {
                    DriverManager.deregisterDriver(driver);
                }
            }
            // shutdown jmx
            JMXAgent.shutdown();
            // shutdown the persistence thread
            FilePersistenceThread persistenceThread = FilePersistenceThread.getInstance();
            if (persistenceThread != null) {
                persistenceThread.shutdown();
            }
            // shutdown spring
            Object attr = ctx.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
            if (attr != null) {
                // get web application context from the servlet context
                ConfigurableWebApplicationContext applicationContext = (ConfigurableWebApplicationContext) attr;
                ConfigurableBeanFactory factory = applicationContext.getBeanFactory();
                // for (String scope : factory.getRegisteredScopeNames()) {
                // logger.debug("Registered scope: " + scope);
                // }
                try {
                    for (String singleton : factory.getSingletonNames()) {
                        logger.debug("Registered singleton: " + singleton);
                        factory.destroyScopedBean(singleton);
                    }
                } catch (RuntimeException e) {
                }
                factory.destroySingletons();
                ctx.removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
                applicationContext.close();
            }
            getContextLoader().closeWebApplicationContext(ctx);
            //            org.apache.commons.logging.LogFactory.releaseAll();
            //            org.apache.log4j.LogManager.getLoggerRepository().shutdown();
            //            org.apache.log4j.LogManager.shutdown();
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
}

From source file:com.frostwire.android.gui.adapters.FileListAdapter.java

private void localPlay(FileDescriptor fd, View view, int position) {
    if (fd == null) {
        return;/*w  w w .j  a v  a  2 s  . c o  m*/
    }

    onLocalPlay();
    Context ctx = getContext();
    if (fd.mime != null && fd.mime.contains("audio")) {
        if (fd.equals(Engine.instance().getMediaPlayer().getCurrentFD(getContext()))) {
            Engine.instance().getMediaPlayer().stop();
        } else {
            try {
                UIUtils.playEphemeralPlaylist(ctx, fd);
                UXStats.instance().log(UXAction.LIBRARY_PLAY_AUDIO_FROM_FILE);
            } catch (RuntimeException re) {
                re.printStackTrace();
                UIUtils.showShortMessage(ctx, R.string.media_player_failed);
            }
        }
        notifyDataSetChanged();
    } else {
        if (fd.filePath != null && fd.mime != null) {
            //special treatment of ringtones
            if (fd.fileType == Constants.FILE_TYPE_RINGTONES) {
                playRingtone(fd);
            } else if (fd.fileType == Constants.FILE_TYPE_PICTURES && ctx instanceof MainActivity) {
                Intent intent = new Intent(ctx, ImageViewerActivity.class);
                intent.putExtra(ImageViewerFragment.EXTRA_FILE_DESCRIPTOR_BUNDLE, fd.toBundle());
                intent.putExtra(ImageViewerFragment.EXTRA_ADAPTER_FILE_OFFSET, position);
                ctx.startActivity(intent);
            } else if ("application/x-bittorrent".equals(fd.mime)) {
                // torrents are often DOCUMENT typed
                TransferManager.instance()
                        .downloadTorrent(UIUtils.getFileUri(ctx, fd.filePath, false).toString());
                UIUtils.showTransfersOnDownloadStart(ctx);
            } else {
                UIUtils.openFile(ctx, fd.filePath, fd.mime, true);
            }
        } else {
            // it will automatically remove the 'Open' entry.
            MenuAdapter menuAdapter = getMenuAdapter(view);
            if (menuAdapter != null) {
                new MenuBuilder(menuAdapter).show();
                UIUtils.showShortMessage(ctx, R.string.cant_open_file);
            }
        }
    }
}

From source file:com.doculibre.constellio.wicket.pages.SearchResultsPage.java

private void initComponents() {
    final SimpleSearch simpleSearch = getSimpleSearch();
    String collectionName = simpleSearch.getCollectionName();
    ConstellioUser currentUser = ConstellioSession.get().getUser();
    RecordCollectionServices recordCollectionServices = ConstellioSpringUtils.getRecordCollectionServices();
    RecordCollection collection = recordCollectionServices.get(collectionName);
    boolean userHasPermission = false;
    if (collection != null) {
        userHasPermission = (!collection.hasSearchPermission())
                || (currentUser != null && currentUser.hasSearchPermission(collection));
    }//  www . ja  v a  2  s .  co m
    if (StringUtils.isEmpty(collectionName) || !userHasPermission) {
        setResponsePage(ConstellioApplication.get().getHomePage());
    } else {

        final IModel suggestedSearchKeyListModel = new LoadableDetachableModel() {
            @Override
            protected Object load() {
                ListOrderedMap suggestedSearch = new ListOrderedMap();
                if (simpleSearch.isQueryValid() && simpleSearch.getQuery() != null) {
                    SpellChecker spellChecker = new SpellChecker(ConstellioApplication.get().getDictionaries());
                    try {
                        if (!simpleSearch.getQuery().equals("*:*")) {
                            suggestedSearch = spellChecker.suggest(simpleSearch.getQuery(),
                                    simpleSearch.getCollectionName());
                        }
                    } catch (RuntimeException e) {
                        e.printStackTrace();
                        // chec du spellchecker, pas besoin de faire planter la page
                    }
                }
                return suggestedSearch;
            }
        };

        BaseSearchResultsPageHeaderPanel headerPanel = (BaseSearchResultsPageHeaderPanel) getHeaderComponent();
        headerPanel.setAdvancedForm(simpleSearch.getAdvancedSearchRule() != null);
        SearchFormPanel searchFormPanel = headerPanel.getSearchFormPanel();

        final ThesaurusSuggestionPanel thesaurusSuggestionPanel = new ThesaurusSuggestionPanel(
                "thesaurusSuggestion", simpleSearch, getLocale());
        add(thesaurusSuggestionPanel);

        SpellCheckerPanel spellCheckerPanel = new SpellCheckerPanel("spellChecker",
                searchFormPanel.getSearchTxtField(), searchFormPanel.getSearchButton(),
                suggestedSearchKeyListModel) {
            @SuppressWarnings("unchecked")
            public boolean isVisible() {
                boolean visible = false;
                if (dataProvider != null && !thesaurusSuggestionPanel.isVisible()) {
                    RecordCollectionServices collectionServices = ConstellioSpringUtils
                            .getRecordCollectionServices();
                    RecordCollection collection = collectionServices.get(simpleSearch.getCollectionName());
                    if (collection != null && collection.isSpellCheckerActive()
                            && simpleSearch.getAdvancedSearchRule() == null) {
                        ListOrderedMap spell = (ListOrderedMap) suggestedSearchKeyListModel.getObject();
                        if (spell.size() > 0/* && dataProvider.size() == 0 */) {
                            for (String key : (List<String>) spell.keyList()) {
                                if (spell.get(key) != null) {
                                    return visible = true;
                                }
                            }
                        }
                    }
                }
                return visible;
            }
        };
        add(spellCheckerPanel);

        dataProvider = new SearchResultsDataProvider(simpleSearch, 10);

        WebMarkupContainer searchResultsSection = new WebMarkupContainer("searchResultsSection") {
            @Override
            public boolean isVisible() {
                return StringUtils.isNotBlank(simpleSearch.getLuceneQuery());
            }
        };
        add(searchResultsSection);

        IModel detailsLabelModel = new LoadableDetachableModel() {
            @Override
            protected Object load() {
                String detailsLabel;
                QueryResponse queryResponse = dataProvider.getQueryResponse();
                long start;
                long nbRes;
                double elapsedTimeSeconds;
                if (queryResponse != null) {
                    start = queryResponse.getResults().getStart();
                    nbRes = dataProvider.size();
                    elapsedTimeSeconds = (double) queryResponse.getElapsedTime() / 1000;
                } else {
                    start = 0;
                    nbRes = 0;
                    elapsedTimeSeconds = 0;
                }
                long end = start + 10;
                if (nbRes < end) {
                    end = nbRes;
                }

                String pattern = "#.####";
                DecimalFormat elapsedTimeFormatter = new DecimalFormat(pattern);
                String elapsedTimeStr = elapsedTimeFormatter.format(elapsedTimeSeconds);

                String forTxt = new StringResourceModel("for", SearchResultsPage.this, null).getString();
                String noResultTxt = new StringResourceModel("noResult", SearchResultsPage.this, null)
                        .getString();
                String resultsTxt = new StringResourceModel("results", SearchResultsPage.this, null)
                        .getString();
                String ofTxt = new StringResourceModel("of", SearchResultsPage.this, null).getString();
                String secondsTxt = new StringResourceModel("seconds", SearchResultsPage.this, null)
                        .getString();

                String queryTxt = " ";
                if (simpleSearch.isQueryValid() && simpleSearch.getQuery() != null
                        && simpleSearch.getAdvancedSearchRule() == null) {
                    queryTxt = " " + forTxt + " " + simpleSearch.getQuery() + " ";
                }

                if (nbRes > 0) {
                    Locale locale = getLocale();
                    detailsLabel = resultsTxt + " " + NumberFormatUtils.format(start + 1, locale) + " - "
                            + NumberFormatUtils.format(end, locale) + " " + ofTxt + " "
                            + NumberFormatUtils.format(nbRes, locale) + queryTxt + "(" + elapsedTimeStr + " "
                            + secondsTxt + ")";
                } else {
                    detailsLabel = noResultTxt + " " + queryTxt + "(" + elapsedTimeStr + " " + secondsTxt + ")";
                }

                String collectionName = dataProvider.getSimpleSearch().getCollectionName();
                if (collectionName != null) {
                    RecordCollectionServices collectionServices = ConstellioSpringUtils
                            .getRecordCollectionServices();
                    RecordCollection collection = collectionServices.get(collectionName);
                    Locale displayLocale = collection.getDisplayLocale(getLocale());
                    String collectionTitle = collection.getTitle(displayLocale);
                    detailsLabel = collectionTitle + " > " + detailsLabel;
                }
                return detailsLabel;
            }
        };
        Label detailsLabel = new Label("detailsRes", detailsLabelModel);
        add(detailsLabel);

        final IModel sortOptionsModel = new LoadableDetachableModel() {

            @Override
            protected Object load() {
                List<SortChoice> choices = new ArrayList<SortChoice>();
                choices.add(new SortChoice(null, null, null));
                String collectionName = dataProvider.getSimpleSearch().getCollectionName();
                if (collectionName != null) {
                    IndexFieldServices indexFieldServices = ConstellioSpringUtils.getIndexFieldServices();
                    RecordCollectionServices collectionServices = ConstellioSpringUtils
                            .getRecordCollectionServices();
                    RecordCollection collection = collectionServices.get(collectionName);
                    for (IndexField indexField : indexFieldServices.getSortableIndexFields(collection)) {
                        String label = indexField.getLabel(IndexField.LABEL_TITLE,
                                ConstellioSession.get().getLocale());
                        if (label == null || label.isEmpty()) {
                            label = indexField.getName();
                        }
                        choices.add(new SortChoice(indexField.getName(), label, "asc"));
                        choices.add(new SortChoice(indexField.getName(), label, "desc"));
                    }
                }
                return choices;
            }
        };

        IChoiceRenderer triChoiceRenderer = new ChoiceRenderer() {
            @Override
            public Object getDisplayValue(Object object) {
                SortChoice choice = (SortChoice) object;
                String displayValue;
                if (choice.title == null) {
                    displayValue = new StringResourceModel("sort.relevance", SearchResultsPage.this, null)
                            .getString();
                } else {
                    String order = new StringResourceModel("sortOrder." + choice.order, SearchResultsPage.this,
                            null).getString();
                    displayValue = choice.title + " " + order;
                }
                return displayValue;
            }
        };
        IModel value = new Model(new SortChoice(simpleSearch.getSortField(), simpleSearch.getSortField(),
                simpleSearch.getSortOrder()));
        DropDownChoice sortField = new DropDownChoice("sortField", value, sortOptionsModel, triChoiceRenderer) {
            @Override
            protected boolean wantOnSelectionChangedNotifications() {
                return true;
            }

            @Override
            protected void onSelectionChanged(Object newSelection) {
                SortChoice choice = (SortChoice) newSelection;
                if (choice.name == null) {
                    simpleSearch.setSortField(null);
                    simpleSearch.setSortOrder(null);
                } else {
                    simpleSearch.setSortField(choice.name);
                    simpleSearch.setSortOrder(choice.order);
                }
                simpleSearch.setPage(0);

                PageFactoryPlugin pageFactoryPlugin = PluginFactory.getPlugin(PageFactoryPlugin.class);
                RequestCycle.get().setResponsePage(pageFactoryPlugin.getSearchResultsPage(),
                        SearchResultsPage.getParameters(simpleSearch));
            }

            @Override
            public boolean isVisible() {
                return ((List<?>) sortOptionsModel.getObject()).size() > 1;
            }
        };
        searchResultsSection.add(sortField);
        sortField.setNullValid(false);

        add(new AjaxLazyLoadPanel("facetsPanel") {
            @Override
            public Component getLazyLoadComponent(String markupId) {
                return new FacetsPanel(markupId, dataProvider);
            }
        });

        final IModel featuredLinkModel = new LoadableDetachableModel() {
            @Override
            protected Object load() {
                FeaturedLink suggestion;
                RecordCollectionServices collectionServices = ConstellioSpringUtils
                        .getRecordCollectionServices();
                FeaturedLinkServices featuredLinkServices = ConstellioSpringUtils.getFeaturedLinkServices();
                Long featuredLinkId = simpleSearch.getFeaturedLinkId();
                if (featuredLinkId != null) {
                    suggestion = featuredLinkServices.get(featuredLinkId);
                } else {
                    String collectionName = simpleSearch.getCollectionName();
                    if (simpleSearch.getAdvancedSearchRule() == null) {
                        String text = simpleSearch.getQuery();
                        RecordCollection collection = collectionServices.get(collectionName);
                        suggestion = featuredLinkServices.suggest(text, collection);
                        if (suggestion == null) {
                            SynonymServices synonymServices = ConstellioSpringUtils.getSynonymServices();
                            List<String> synonyms = synonymServices.getSynonyms(text, collectionName);
                            if (!synonyms.isEmpty()) {
                                for (String synonym : synonyms) {
                                    if (!synonym.equals(text)) {
                                        suggestion = featuredLinkServices.suggest(synonym, collection);
                                    }
                                    if (suggestion != null) {
                                        break;
                                    }
                                }
                            }
                        }
                    } else {
                        suggestion = new FeaturedLink();
                    }
                }
                return suggestion;
            }
        };
        IModel featuredLinkTitleModel = new LoadableDetachableModel() {
            @Override
            protected Object load() {
                FeaturedLink featuredLink = (FeaturedLink) featuredLinkModel.getObject();
                return featuredLink.getTitle(getLocale());
            }
        };
        final IModel featuredLinkDescriptionModel = new LoadableDetachableModel() {
            @Override
            protected Object load() {
                FeaturedLink featuredLink = (FeaturedLink) featuredLinkModel.getObject();
                StringBuffer descriptionSB = new StringBuffer();
                String description = featuredLink.getDescription(getLocale());
                if (description != null) {
                    descriptionSB.append(description);
                    String lookFor = "${";
                    int indexOfLookFor = -1;
                    while ((indexOfLookFor = descriptionSB.indexOf(lookFor)) != -1) {
                        int indexOfEnclosingQuote = descriptionSB.indexOf("}", indexOfLookFor);
                        String featuredLinkIdStr = descriptionSB.substring(indexOfLookFor + lookFor.length(),
                                indexOfEnclosingQuote);

                        int indexOfTagBodyStart = descriptionSB.indexOf(">", indexOfEnclosingQuote) + 1;
                        int indexOfTagBodyEnd = descriptionSB.indexOf("</a>", indexOfTagBodyStart);
                        String capsuleQuery = descriptionSB.substring(indexOfTagBodyStart, indexOfTagBodyEnd);
                        if (capsuleQuery.indexOf("<br/>") != -1) {
                            capsuleQuery = StringUtils.remove(capsuleQuery, "<br/>");
                        }
                        if (capsuleQuery.indexOf("<br />") != -1) {
                            capsuleQuery = StringUtils.remove(capsuleQuery, "<br />");
                        }

                        try {
                            String linkedCapsuleURL = getFeaturedLinkURL(new Long(featuredLinkIdStr));
                            descriptionSB.replace(indexOfLookFor, indexOfEnclosingQuote + 1, linkedCapsuleURL);
                        } catch (NumberFormatException e) {
                            // Ignore
                        }
                    }
                }
                return descriptionSB.toString();
            }

            private String getFeaturedLinkURL(Long featuredLinkId) {
                SimpleSearch clone = simpleSearch.clone();
                clone.setFeaturedLinkId(featuredLinkId);
                PageFactoryPlugin pageFactoryPlugin = PluginFactory.getPlugin(PageFactoryPlugin.class);
                String url = RequestCycle.get()
                        .urlFor(pageFactoryPlugin.getSearchResultsPage(), getParameters(clone)).toString();
                return url;
            }
        };

        WebMarkupContainer featuredLink = new WebMarkupContainer("featuredLink", featuredLinkModel) {
            @Override
            public boolean isVisible() {
                boolean visible = super.isVisible();
                if (visible) {
                    if (featuredLinkModel.getObject() != null) {
                        String description = (String) featuredLinkDescriptionModel.getObject();
                        visible = StringUtils.isNotEmpty(description);
                    } else {
                        visible = false;
                    }
                }
                DataView dataView = (DataView) searchResultsPanel.getDataView();
                return visible && dataView.getCurrentPage() == 0;
            }
        };
        searchResultsSection.add(featuredLink);
        featuredLink.add(new Label("title", featuredLinkTitleModel));
        featuredLink.add(new WebMarkupContainer("description", featuredLinkDescriptionModel) {
            @Override
            protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
                String descriptionHTML = (String) getModel().getObject();
                replaceComponentTagBody(markupStream, openTag, descriptionHTML);
            }
        });

        searchResultsSection
                .add(searchResultsPanel = new SearchResultsPanel("resultatsRecherchePanel", dataProvider));
    }
}

From source file:eu.intermodalics.tango_ros_streamer.activities.RunningActivity.java

private void restartTango() {
    if (mParameterNode != null) {
        try {/*from   ww w  .  ja va 2s.  c  om*/
            mParameterNode.setPreferencesFromParameterServer();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
    }
    mTangoServiceClientNode.callTangoConnectService(TangoConnectRequest.RECONNECT);
}

From source file:eu.intermodalics.tango_ros_streamer.activities.RunningActivity.java

@Override
protected void onDestroy() {
    super.onDestroy();
    if (mParameterNode != null) {
        try {//ww w.j  a  v a  2s. c  o  m
            mParameterNode.setPreferencesFromParameterServer();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
    }
    this.nodeMainExecutorService.forceShutdown();
}

From source file:wicket.ajax.AjaxRequestTarget.java

/**
 * @see wicket.IRequestTarget#respond(wicket.RequestCycle)
 *//*ww w.j  a va  2s . c o  m*/
public final void respond(final RequestCycle requestCycle) {
    try {
        final Application app = Application.get();

        // disable component use check since we want to ignore header
        // contribs
        final boolean oldUseCheck = app.getDebugSettings().getComponentUseCheck();
        app.getDebugSettings().setComponentUseCheck(false);

        // Determine encoding
        final String encoding = app.getRequestCycleSettings().getResponseRequestEncoding();

        // Set content type based on markup type for page
        WebResponse response = (WebResponse) requestCycle.getResponse();
        response.setCharacterEncoding(encoding);
        response.setContentType("text/xml; charset=" + encoding);

        // Make sure it is not cached by a
        response.setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
        response.setHeader("Cache-Control", "no-cache, must-revalidate");
        response.setHeader("Pragma", "no-cache");

        response.write("<?xml version=\"1.0\" encoding=\"");
        response.write(encoding);
        response.write("\"?>");
        response.write("<ajax-response>");

        // normal behavior

        for (String js : prependJavascripts) {
            respondInvocation(response, js);
        }

        Iterator<Entry<String, Component>> it = markupIdToComponent.entrySet().iterator();
        while (it.hasNext()) {
            final Map.Entry<String, Component> entry = it.next();
            final Component component = entry.getValue();
            final String markupId = entry.getKey();
            respondHeaderContribution(response, component);
            respondComponent(response, markupId, component);
        }

        for (String js : appendJavascripts) {
            respondInvocation(response, js);
        }

        response.write("</ajax-response>");

        // restore component use check
        app.getDebugSettings().setComponentUseCheck(oldUseCheck);
    } catch (RuntimeException ex) {
        // log the error but output nothing in the response, parse failure
        // of response will cause any javascript failureHandler to be
        // invoked
        LOG.error("Error while responding to an AJAX request: " + toString(), ex);
        System.out.println(ex.getMessage());
        ex.printStackTrace();
    }
}

From source file:org.apache.hadoop.corona.ClusterManager.java

@Override
public void requestResource(String handle, List<ResourceRequest> requestList)
        throws TException, InvalidSessionHandle, SafeModeException {
    checkSafeMode("requestResource");
    try {/*from w w  w.  jav  a2  s  .  c o  m*/
        LOG.info("Request " + requestList.size() + " resources from session: " + handle);
        if (!checkResourceRequestType(requestList)) {
            LOG.error("Bad resource type from session: " + handle);
            throw new TApplicationException("Bad resource type");
        }
        if (!checkResourceRequestExcluded(requestList)) {
            LOG.error("Bad excluded hosts from session: " + handle);
            throw new TApplicationException("Requesting excluded hosts");
        }
        checkResourceRequestLimit(requestList, handle);

        sessionManager.heartbeat(handle);
        sessionManager.getSession(handle).setResourceRequest(requestList);
        List<ResourceRequestInfo> reqInfoList = new ArrayList<ResourceRequestInfo>(requestList.size());
        for (ResourceRequest request : requestList) {
            List<String> hosts = request.getHosts();
            List<RequestedNode> requestedNodes = null;
            if (hosts != null && hosts.size() > 0) {
                requestedNodes = new ArrayList<RequestedNode>(hosts.size());
                for (String host : hosts) {
                    requestedNodes.add(nodeManager.resolve(host, request.type));
                }
            }
            ResourceRequestInfo info = new ResourceRequestInfo(request, requestedNodes);
            reqInfoList.add(info);
        }
        sessionManager.requestResource(handle, reqInfoList);
        for (ResourceRequest req : requestList) {
            metrics.requestResource(req.type);
        }
        scheduler.notifyScheduler();
    } catch (RuntimeException e) {
        e.printStackTrace();
        throw new TApplicationException(e.getMessage());
    }
}

From source file:eu.intermodalics.tango_ros_streamer.activities.RunningActivity.java

public void onGetMapUuidsFinish(List<String> mapUuids, List<String> mapNames) {
    mUuidsNamesHashMap = new HashMap<>();
    if (mapUuids == null || mapNames == null)
        return;//from ww  w .ja va2  s .c  o  m
    assert (mapUuids.size() == mapNames.size());
    for (int i = 0; i < mapUuids.size(); ++i) {
        mUuidsNamesHashMap.put(mapUuids.get(i), mapNames.get(i));
    }
    if (mParameterNode != null) {
        try {
            mParameterNode.setPreferencesFromParameterServer();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
    }
    Intent settingsActivityIntent = new Intent(SettingsActivity.NEW_UUIDS_NAMES_MAP_ALERT);
    settingsActivityIntent.putExtra(getString(R.string.uuids_names_map), mUuidsNamesHashMap);
    this.sendBroadcast(settingsActivityIntent);
}

From source file:eu.intermodalics.tango_ros_streamer.activities.RunningActivity.java

@Override
public void onTangoStatus(int status) {
    if (status >= TangoStatus.values().length) {
        Log.e(TAG, "Invalid Tango status " + status);
        return;//  w w w .  java  2 s .  co m
    }
    if (status == TangoStatus.SERVICE_CONNECTED.ordinal() && mTangoStatus != TangoStatus.SERVICE_CONNECTED) {
        saveUuidsNamestoHashMap();
        try {
            mParameterNode.setPreferencesFromParameterServer();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
        mMapSaved = false;
        if (mSnackbarLoadNewMap != null && mSnackbarLoadNewMap.isShown()) {
            mSnackbarLoadNewMap.dismiss();
        }
    }
    updateLoadAndSaveMapButtons();
    updateTangoStatus(TangoStatus.values()[status]);
}

From source file:eu.intermodalics.tango_ros_streamer.activities.RunningActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.settings:
        if (mParameterNode != null) {
            try {
                mParameterNode.setPreferencesFromParameterServer();
            } catch (RuntimeException e) {
                e.printStackTrace();
            }/* w  w  w. j  a v a 2s . co  m*/
        }
        Intent settingsActivityIntent = new Intent(this, SettingsActivity.class);
        settingsActivityIntent.putExtra(getString(R.string.uuids_names_map), mUuidsNamesHashMap);
        startActivityForResult(settingsActivityIntent, StartSettingsActivityRequest.STANDARD_RUN);
        return true;
    case R.id.share:
        mLogger.saveLogToFile();
        Intent shareFileIntent = new Intent(Intent.ACTION_SEND);
        shareFileIntent.setType("text/plain");
        shareFileIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(mLogger.getLogFile()));
        startActivity(shareFileIntent);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}