Re: Cannot iterate HashSet
The interesting thing is that there is no nulls in output. If it were null I probably could see this error in GWT Shell, but in hosted browser everyting was ok. The following code also gives me same error: @Override public String toString() { //return "" + getValue(); return getValue() == null ? "" : getValue().toString(); } I'm using GWT 1.5.2, I'll try to swith to newer version some day and check if this error will still appear. Anyway, it works with "" + getValue() by now. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Cannot iterate HashSet
After all day beating my head against the keybord I found where the problem was. I reverted all changes to stable version and statrted to add code bit by bit and noticed that after changes in AttributeValue.toString() method my program started to fail again. This code doesn't work: @Override public String toString() { return getValue().toString(); } But this code works: @Override public String toString() { return ""+getValue(); } But it should be the same... Maybe I misunderstand something, can somebody explain me the difference? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Cannot iterate HashSet
I replaced HashSet with Vector - same problem --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Cannot iterate HashSet
Hello I have a problem with iterating HashSet on client side. The weird thing is that in hosted browser everything works fine without errors, but problems occurs in firefox and IE. In my application I'm triyng to get a list of some properties with their values. I have class PropertyValues, which contains information about property and HashSet of instances of abstract AttributeValue class (for example StringValue, IntegerValue etc). One more strange thing is that there are problems only when property values which are instances of StringValue class. I make RPC call on server and recive a list of PropertyValues. Then I'm trying to iterate HasSets in these PropertyValues on client: for (PropertyValues pvs : pvsList) { //Here it fails inside getTextAttributeLabels method, but only for StringValue addAttributeValuesGrid(pvs.getProperty().getName(), getTextAttributeLabels(pvs)); //But these two lines always works fine, I can see added labels on my page AttributeValue firstValue = pvs.getValues().iterator().next (); this.add(new Label(pvs.getProperty().getName() + " " + firstValue.toString())); } private VerticalPanel getTextAttributeLabels(PropertyValues pvs) { VerticalPanel labels = new VerticalPanel(); int i = 0; int j = 0; for (Iterator it = pvs.getValues().iterator(); it.hasNext();) { try { j = 0; AttributeValue value = it.next();//Here it fails for some reason ??? j = 1; Label l = new Label("" + value); j = 2; labels.add(getExpandapleItem(l, value.getInfo())); j = 3; } catch (Throwable e) { Window.alert(pvs.getProperty().getName()); alertException(e, i, j); break; } i++; } return labels; } private void alertException(Throwable e, int i, int j) { String s = "\n"; for (StackTraceElement stackTraceElement : e.getStackTrace()) { s += stackTraceElement.getClassName() + "." + stackTraceElement.getMethodName() + "." + stackTraceElement.getLineNumber() + "\n"; } Window.alert("i=" + i + " j=" + j + "\n" + e.getMessage() + s); } That's what I see in alert in firefox: i=0 j=1 (TypeError): can't convert n to primitive type fileName: http://localhost:8080/com.biosearch.Main/29776F8905BB64FB7210869C20242586.cache.html lineNumber: 807 stack: zgb([object Object],[object Object])@http://localhost:8080/ com.biosearch.Main/29776F8905BB64FB7210869C20242586.cache.html:807 rgb([object Object],[object Object])@http://localhost:8080/ com.biosearch.Main/29776F8905BB64FB7210869C20242586.cache.html:800 ekb([object Object],"340792_43",[object Array],[object Object])@http:// localhost:8080/com.biosearch.Main/ 29776F8905BB64FB7210869C20242586.cache.html:906 xhb([object Object])@http://localhost:8080/com.biosearch.Main/ 29776F8905BB64FB7210869C20242586.cache.html:864 vhc([object Object],[object Object])@http://localhost:8080/ com.biosearch.Main/29776F8905BB64FB7210869C20242586.cache.html:1705 kvb([object Object],[object Object])@http://localhost:8080/ com.biosearch.Main/29776F8905BB64FB7210869C20242586.cache.html:1147 nvb([object Object])@http://localhost:8080/com.biosearch.Main/ 29776F8905BB64FB7210869C20242586.cache.html:1149 ([object Event])@http://localhost:8080/com.biosearch.Main/ 29776F8905BB64FB7210869C20242586.cache.html:1190 Also in InternetExplorer I don't see any alerts, but all labels for string values are blank. Here is the code of AttributeValue and subclasses: public abstract class AttributeValue implements Serializable { private String datasource; public AttributeValue() { } public abstract Object getValue(); public String getDatasource() { return datasource; } public void setDatasource(String datasource) { this.datasource = datasource; } @Override public String toString() { return getValue().toString(); } public String getInfo() { return "Attribute datasource: " + datasource; } @Override public boolean equals(Object obj) { if (!(obj instanceof AttributeValue)) { return false; } return ((AttributeValue) obj).getValue().equals(this.getValue ()); } @Override public int hashCode() { int hash = 3; hash = 37 * hash + (this.datasource != null ? this.datasource.hashCode() : 0); return hash; } } public class StringValue extends AttributeValue{ private String value; public StringValue() { super(); } public StringValue(String value, String datasource) { setValue(value); setDatasource(datasource); } public String getValue() { return valu
Re: Serialization problem
I didn't try Vector, don't know if it works. I decide to make a class with fields for data I want to return instead of using Vector. Now it works. Thank you! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Serialization problem
Hello I have class StringValue which extends abstract class AttributeValue. I call some method on server side, which should return instance of this class. When the method tries to return value the folowing error happens: SEVERE: Exception while dispatching incoming RPC call com.google.gwt.user.client.rpc.SerializationException: java.lang.reflect.InvocationTargetException at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer (ServerSerializationStreamWriter.java:686) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl (ServerSerializationStreamWriter.java:649) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize (ServerSerializationStreamWriter.java:583) at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject (AbstractSerializationStreamWriter.java:129) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter $ValueWriter$8.write(ServerSerializationStreamWriter.java:146) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue (ServerSerializationStreamWriter.java:520) at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java: 573) at com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess (RPC.java:441) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse (RPC.java:529) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall (RemoteServiceServlet.java:164) at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost (RemoteServiceServlet.java:86) at javax.servlet.http.HttpServlet.service(HttpServlet.java: 710) at javax.servlet.http.HttpServlet.service(HttpServlet.java: 803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter (MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol $Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run (JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeWithCustomSerializer (ServerSerializationStreamWriter.java:668) ... 27 more Caused by: com.google.gwt.user.client.rpc.SerializationException: Type 'com.biosearch.client.database.attributeValues.StringValue' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized. at com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy.validateSerialize (StandardSerializationPolicy.java:83) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize (ServerSerializationStreamWriter.java:581) at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject (AbstractSerializationStreamWriter.java:129) at com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize (Collection_CustomFieldSerializerBase.java:43) at com.google.gwt.user.client.rpc.core.java.util.Vector_CustomFieldSerializer.serialize (Vector_CustomFieldSerializer.java:36) ... 31 more Both classes implement Serializable and have default constructor. Here is the code: public abstract class AttributeValue implements Serializable { private String datasource; public AttributeValue() { } public abstract Object getValue(); public String getDatasource() {