Uncaught exception escaped

982 views
Skip to first unread message

sasi sasindran

unread,
Sep 16, 2011, 9:41:24 AM9/16/11
to Google Web Toolkit
HI sir



I AM SASINDRAN newcomer to gwt i wrote a example(StockWatcher) project
provided by google.When I build this project in development mode using
eclipse IDE.This shows an error "[ERROR] [stockwatchers] - Uncaught
exception escaped"


PROJECT CODE
********************




package com.google.gwt.sample.stockwatchers.client;





import java.util.ArrayList;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.user.client.Random;
import com.google.gwt.user.client.Timer;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;


import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;


import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import java.util.Date;

/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class StockWatchers implements EntryPoint {
/**
* The message displayed to the user when the server cannot be
reached or
* returns an error.
*/
private static final String SERVER_ERROR = "An error occurred while "
+ "attempting to contact the server. Please check your network "
+ "connection and try again.";

/**
* Create a remote service proxy to talk to the server-side Greeting
service.
*/
private final GreetingServiceAsync greetingService = GWT
.create(GreetingService.class);
VerticalPanel mainPanel = new VerticalPanel();
HorizontalPanel addPanel = new HorizontalPanel();
TextBox newSymbolTextBox = new TextBox();
Button addStockButton = new Button("Add");
private ArrayList<String> stocks=new ArrayList<String>();
FlexTable stockFlexTable = new FlexTable();
private static final int REFRESH_INTERVAL=5000;
Label lastUpdateLabel = new Label("");

/**
* This is the entry point method.
*/
public void onModuleLoad() {

// Add the nameField and sendButton to the RootPanel
// Use RootPanel.get() to get the entire body element

RootPanel.get("stockList").add(mainPanel);







mainPanel.add(stockFlexTable);

mainPanel.add(addPanel);

addPanel.add(newSymbolTextBox);

addPanel.add(addStockButton);

mainPanel.add(lastUpdateLabel);

stockFlexTable.setText(0,0,"Symbol");
stockFlexTable.setText(0,1,"Price");
stockFlexTable.setText(0,2,"Change");
stockFlexTable.setText(0,3,"Remove");

newSymbolTextBox.setFocus(true);


addStockButton.addClickHandler(new ClickHandler() {

@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
addStock();

}
});

newSymbolTextBox.addKeyPressHandler(new KeyPressHandler() {

@Override
public void onKeyPress(KeyPressEvent event) {
// TODO Auto-generated method stub
if(event.getCharCode()==KeyCodes.KEY_ENTER)
{
addStock();
}
}
});


/* Timer refreshTimer=new Timer() {

@Override
public void run() {
// TODO Auto-generated method stub
refreshWatchList();
}
};*/
lastUpdateLabel.setText("Last
update :"+DateTimeFormat.getMediumDateTimeFormat().format(new
Date()));
//refreshTimer.scheduleRepeating(REFRESH_INTERVAL);
}

private void addStock()
{
final String symbol=newSymbolTextBox.getText().toUpperCase().trim();
if(stocks.contains(symbol))
return;
newSymbolTextBox.setFocus(true);
if(!symbol.matches("^[0-9A-Z\\.]{1,10}$"))
{
Window.alert("'" + symbol + "' is not a valid symbol.");
newSymbolTextBox.selectAll();
newSymbolTextBox.setText("");

return;
}

int row=stockFlexTable.getRowCount();
stocks.add(symbol);
stockFlexTable.setText(row,0,symbol);
refreshWatchList();

Button removeButton=new Button("X");
removeButton.addClickHandler(new ClickHandler() {

@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
int index=stocks.indexOf(symbol);
stocks.remove(index);
stockFlexTable.removeRow(index+1);

}
});

stockFlexTable.setWidget(row, 3,removeButton);
//newSymbolTextBox.setText("");


}
private void refreshWatchList()
{
final double MAX_PRICE=100.0;
final double MAX_PRICE_CHANGE=0.02;


StockPrice[] prices=new StockPrice[stocks.size()];
for(int i=0;i<stocks.size();i++)
{
double price=Random.nextDouble()*MAX_PRICE;

double change=price*MAX_PRICE_CHANGE*(Random.nextDouble()*2.0-1.0);

prices[i]=new StockPrice(stocks.get(i),price,change);
}
updateTable(prices);
}
private void updateTable(StockPrice[] prices)
{

for(int i=0;i<prices.length;i++)
{

updateTable(prices[i]);


}

}
private void updateTable(StockPrice price)
{
if(!stocks.contains(price.getSymbol()))
{
return;
}
int row=stocks.indexOf(price.getSymbol())+1;


String priceText=NumberFormat.getFormat("#,##.
0.00").format(price.getPrice());

NumberFormat changeFormat=NumberFormat.getFormat("+#,##0.00;-
#,##0.00");
String changeText=changeFormat.format(price.getChange());
String
changePercentText=changeFormat.format(price.getChangePercent());

stockFlexTable.setText(row, 1,priceText);
stockFlexTable.setText(row,2,changeText.toString()
+"("+changePercentText.toString()+"%)");
}


}







*********************************






19:02:48.734 [ERROR] [stockwatchers] Uncaught exception escaped

com.google.gwt.event.shared.UmbrellaException: One or more exceptions
caught, see full set in UmbrellaException#getCauses
at
com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:
129)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:124)
at
com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:
116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:
172)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1321)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1277)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
167)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
326)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
207)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
132)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
167)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
281)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
531)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
352)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalArgumentException: Multiple decimal
separators in pattern &quot;#,##.0.00&quot;
at
com.google.gwt.i18n.client.NumberFormat.parseTrunk(NumberFormat.java:
1564)
at
com.google.gwt.i18n.client.NumberFormat.parsePattern(NumberFormat.java:
1501)
at com.google.gwt.i18n.client.NumberFormat.&lt;init&gt;
(NumberFormat.java:774)
at com.google.gwt.i18n.client.NumberFormat.&lt;init&gt;
(NumberFormat.java:790)
at
com.google.gwt.i18n.client.NumberFormat.getFormat(NumberFormat.java:
422)
at
com.google.gwt.sample.stockwatchers.client.StockWatchers.updateTable(StockWatchers.java:
206)
at
com.google.gwt.sample.stockwatchers.client.StockWatchers.updateTable(StockWatchers.java:
191)
at
com.google.gwt.sample.stockwatchers.client.StockWatchers.refreshWatchList(StockWatchers.java:
183)
at
com.google.gwt.sample.stockwatchers.client.StockWatchers.addStock(StockWatchers.java:
148)
at com.google.gwt.sample.stockwatchers.client.StockWatchers.access
$0(StockWatchers.java:130)
at com.google.gwt.sample.stockwatchers.client.StockWatchers
$1.onClick(StockWatchers.java:100)
at
com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:
54)
at
com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at
com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:
193)
at
com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
88)
at
com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:
127)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:124)
at
com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:
116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:
172)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1321)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1277)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
167)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
326)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
207)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
132)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
167)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
281)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
531)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
352)
at java.lang.Thread.run(Thread.java:619)

Saul Simhon

unread,
Sep 16, 2011, 10:18:39 AM9/16/11
to google-we...@googlegroups.com

Hi,

Does anyone know of a quick tutorial that explains how to setup bean validation on the client side?

I'm running into gwt compilation problems and before I start describing them here I'd like to read-up on it first. (my attempt to inferred usage from source was unsuccessful.)

In short, I can't seem to get standard validation annotations (such as @NotNull), validation API, validation groups, messages and custom hibernate annotations (such as @Email) to work!

Jens

unread,
Sep 16, 2011, 10:33:14 AM9/16/11
to google-we...@googlegroups.com
Caused by: java.lang.IllegalArgumentException: Multiple decimal 
separators in pattern "#,##.0.00"; 

    at 
com.google.gwt.i18n.client.NumberFormat.parseTrunk(NumberFormat.java: 
1564) 
    at 
com.google.gwt.i18n.client.NumberFormat.parsePattern(NumberFormat.java: 
1501) 
    at com.google.gwt.i18n.client.NumberFormat.&lt;init&gt; 
(NumberFormat.java:774) 
    at com.google.gwt.i18n.client.NumberFormat.&lt;init&gt; 
(NumberFormat.java:790) 
    at 
com.google.gwt.i18n.client.NumberFormat.getFormat(NumberFormat.java: 
422) 
    at 
com.google.gwt.sample.stockwatchers.client.StockWatchers.updateTable(StockWatchers.java: 
206) 




Your format string is incorrect. As the exceptions say you can not have two dots (decimal separator) in the format String. Fix it and it should work.

-- J.

saul

unread,
Sep 16, 2011, 2:47:06 PM9/16/11
to Google Web Toolkit
Anyone know of a quick/good tutorial that explains how to setup bean
validation on the client side?

GWT compilation problems are occurring and before I start describing
them here I'd like to read-up on it first. (my attempt to infer usage
from source was unsuccessful.)

In short, we can't seem to get standard validation annotations (such
as @NotNull), validation API, validation groups, messages and custom
hibernate annotations (such as @NotBlank) to work!

sasindran erambra

unread,
Sep 17, 2011, 12:14:32 AM9/17/11
to google-we...@googlegroups.com

Thank you very much  Jens.....Thank you!    thank you!  ............. Thank you!.............


your timely and valuable advice
Reply all
Reply to author
Forward
0 new messages