Java Code Examples for com.google.gwt.core.client.GWT#setUncaughtExceptionHandler()

The following examples show how to use com.google.gwt.core.client.GWT#setUncaughtExceptionHandler() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JTSWebAppEntry.java    From jts with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void onModuleLoad() {
	sLogger.info("Module loading");

	if (GWT.isScript()) {
		GWT.setUncaughtExceptionHandler(this);

		Scheduler.get().scheduleDeferred(new ScheduledCommand() {
			
			@Override
			public void execute() {
				onLoad();
			}
		});
	} else {
		onLoad();
	}
}
 
Example 2
Source File: Editor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private void initLogging() {
        Dictionary levels = Dictionary.getDictionary("EditorLoggingConfiguration");
        for (String loggerName : levels.keySet()) {
            String levelValue = levels.get(loggerName);
            try {
                Level level = Level.parse(levelValue);
                Logger logger = Logger.getLogger(loggerName);
                logger.setLevel(level);
                Logger.getLogger("").info(ClientUtils.format(
                        "logger: '%s', levelValue: %s", loggerName, level));
            } catch (IllegalArgumentException ex) {
                Logger.getLogger("").log(Level.SEVERE,
                        ClientUtils.format("logger: '%s', levelValue: %s", loggerName, levelValue), ex);
            }
        }

        if (GWT.isProdMode()) {
            // XXX SmartGWT 3.0 ignores thrown exceptions in production mode.
            // Javascript stack traces are useless but messages can be valuable
            GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

                @Override
                public void onUncaughtException(Throwable e) {
                    StringBuilder sb = new StringBuilder();
                    for (Throwable t = e; t != null; t = t.getCause()) {
                        sb.append("* ").append(t.getClass().getName()).append(": ")
                                .append(t.getLocalizedMessage()).append("\n");
                        for (StackTraceElement elm : t.getStackTrace()) {
                            sb.append("  ").append(elm.toString()).append("\n");
                        }
                    }

                    // visible in javascript console; Window.alert is too much intrusive.
                    LOG.log(Level.SEVERE, e.getMessage(), e);
//                    Window.alert(sb.toString());
                }
            });
        }
    }
 
Example 3
Source File: Application.java    From gwt-material-demo with Apache License 2.0 5 votes vote down vote up
@Override
public void onPreBootstrap() {
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        public void onUncaughtException(Throwable e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
        }
    });
}
 
Example 4
Source File: Client.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void onModuleLoad() {
	GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
		@Override
		public void onUncaughtException(Throwable e) {
			Throwable u = ToolBox.unwrap(e);
			sLogger.log(Level.WARNING, MESSAGES.failedUncaughtException(u.getMessage()), u);
		}
	});
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			onModuleLoadDeferred();
		}
	});
}
 
Example 5
Source File: ServerlessEntryPoint.java    From swellrt with Apache License 2.0 5 votes vote down vote up
@JsIgnore
@Override
public void onModuleLoad() {

  // Model factory is used in remote Waves
  ModelFactory.instance = null;
  ServiceConfig.configProvider = getConfigProvider();
  getEditorConfigProvider();

  GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

    @Override
    public void onUncaughtException(Throwable e) {
      Console.log("Uncaught Exception: " + e.getMessage());
      String string = "";
      for (StackTraceElement element : e.getStackTrace()) {
        string += element + "\n";
      }
      Console.log("Trace: ");
      Console.log(string);

    }
  });

  Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
    @Override
    public void execute() {

      service = new ServerlessFrontend();
      notifyOnLoadHandlers(service);

    }
  });

}
 
Example 6
Source File: GpsEmulator.java    From android-gps-emulator with Apache License 2.0 5 votes vote down vote up
/**
 * This is the entry point method.
 */
public void onModuleLoad() {
   GWT.setUncaughtExceptionHandler(
         new GWT.UncaughtExceptionHandler() {
            public void onUncaughtException(Throwable t) {
               GWT.log("Client-side uncaught exception", t);
            }
        }
   );

   initializeUI();
   loadMapApi();
}
 
Example 7
Source File: StageZero.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
@Override
protected final void create(Accessor<StageZero> whenReady) {
  onStageInit();
  // TODO: enable webdriver hook.
  GWT.setUncaughtExceptionHandler(createUncaughtExceptionHandler());
  if (GWT.isScript()) {
    CollectionUtils.setDefaultCollectionFactory(new JsoCollectionFactory());
  }
  onStageLoaded();
  whenReady.use(this);
}
 
Example 8
Source File: Application.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onModuleLoad() {
    GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
        public void onUncaughtException(Throwable e) {
            GWT.log("Uncaught Exception", e);
        }
    });
    
    // TODO refactor startup to be more explicit
    getPropertiesManager(); // creates singleton
}
 
Example 9
Source File: Login.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onModuleLoad() {
	if (RootPanel.get("loadingwrapper-login") == null)
		return;

	GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
		@Override
		public void onUncaughtException(Throwable caught) {
			SC.warn("Error", caught.getMessage());
		}

	});

	instance = this;

	declareShowLostDialog(this);

	// Tries to capture locale parameter
	final String lang = Util.detectLocale();
	I18N.setLocale(lang);

	// Tries to capture tenant parameter
	final String tenant = Util.detectTenant();

	// Get grid of scrollbars, and clear out the window's built-in margin,
	// because we want to take advantage of the entire client area.
	Window.enableScrolling(false);
	Window.setMargin("0px");

	InfoService.Instance.get().getInfo(I18N.getLocale(), tenant, true, new AsyncCallback<GUIInfo>() {
		@Override
		public void onFailure(Throwable error) {
			SC.warn(error.getMessage());
		}

		@Override
		public void onSuccess(final GUIInfo info) {
			CookiesManager.saveRelease(info);

			I18N.init(info);

			WindowUtils.setTitle(info, null);

			Feature.init(info);
			Session.get().setInfo(info);

			WindowUtils.setFavicon(info);

			if ("mobile".equals(Util.getJavascriptVariable("j_layout")))
				loginPanel = new MobileLoginPanel(info);
			else
				loginPanel = new LoginPanel(info);

			Login.this.showLogin();
		}

	});
}
 
Example 10
Source File: ApplicationConnection.java    From flow with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an application connection using the given configuration.
 *
 * @param applicationConfiguration
 *            the configuration object for the application
 */
public ApplicationConnection(
        ApplicationConfiguration applicationConfiguration) {

    registry = new DefaultRegistry(this, applicationConfiguration);
    GWT.setUncaughtExceptionHandler(
            registry.getSystemErrorHandler()::handleError);

    StateNode rootNode = registry.getStateTree().getRootNode();

    // Bind UI configuration objects
    PollConfigurator.observe(rootNode, registry.getPoller());
    ReconnectDialogConfiguration.bind(registry.getConnectionStateHandler());
    LoadingIndicatorConfigurator.observe(rootNode,
            registry.getLoadingIndicator());

    Element body = Browser.getDocument().getBody();

    rootNode.setDomNode(body);
    Binder.bind(rootNode, body);

    // When app is run as a WC do not add listener for routing events.
    // Routing is responsability of the hosting application (#6108)
    if (!applicationConfiguration.isWebComponentMode()
            // client router is responsible of routing events
            && !applicationConfiguration.isClientRouting()) {
        new PopStateHandler(registry).bind();
        RouterLinkHandler.bind(registry, body);
    }

    Console.log("Starting application "
            + applicationConfiguration.getApplicationId());

    String appRootPanelName = applicationConfiguration.getApplicationId();
    // remove the end (window name) of autogenerated rootpanel id
    appRootPanelName = appRootPanelName.replaceFirst("-\\d+$", "");

    boolean productionMode = applicationConfiguration.isProductionMode();
    boolean requestTiming = applicationConfiguration.isRequestTiming();
    publishJavascriptMethods(appRootPanelName, productionMode,
            requestTiming,
            applicationConfiguration.getExportedWebComponents());
    if (!productionMode) {
        String servletVersion = applicationConfiguration
                .getServletVersion();
        publishDevelopmentModeJavascriptMethods(appRootPanelName,
                servletVersion);
        Console.log(
                "Vaadin application servlet version: " + servletVersion);
    }

    registry.getLoadingIndicator().show();
}
 
Example 11
Source File: WebClient.java    From swellrt with Apache License 2.0 4 votes vote down vote up
public static void install() {
  GWT.setUncaughtExceptionHandler(new ErrorHandler(GWT.getUncaughtExceptionHandler()));
}
 
Example 12
Source File: DefaultErrorManager.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
private DefaultErrorManager() {
	GWT.setUncaughtExceptionHandler(this);
}
 
Example 13
Source File: WebClient.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
public static void install() {
  GWT.setUncaughtExceptionHandler(new ErrorHandler(GWT.getUncaughtExceptionHandler()));
}