public void start() { if(current != null){ current.show(); return; } try { Util.register("Mails", Mails.class); Externalizable mailraw = WebServiceProxy.getMessage("Mails"); Mails mail = (Mails)mailraw; current = new Form("Mails"); current.addComponent(new Label("ID: "+mail.getMessageID())); <-- the error goes here current.addComponent(new Label("From: "+mail.getFrom())); current.addComponent(new Label("Subject: "+mail.getSubject())); current.addComponent(new Label("Content: "+mail.getContent())); current.addComponent(new Label("To: "+mail.getTo())); } catch (IOException ex) { ex.printStackTrace(); } current.show(); }
public void start() { if(current != null){ current.show(); return; } try { Util.register("Mails", Mails.class); Externalizable mailraw = WebServiceProxy.getMessage("Mails");
Storage s = Storage.getInstance(); s.writeObject("Mails", mailraw); Mails mail = (Mails)s.readObject("Mails");
current = new Form("Mails");
current.addComponent(new Label("ID: "+mail.getMessageID())); <<-- error points in this line.
current.addComponent(new Label("From: "+mail.getFrom())); current.addComponent(new Label("Subject: "+mail.getSubject())); current.addComponent(new Label("Content: "+mail.getContent())); current.addComponent(new Label("To: "+mail.getTo())); } catch (IOException ex) { ex.printStackTrace(); } current.show(); }
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.codename1.impl.javase.Executor$1.run(Executor.java:95) at com.codename1.ui.Display.processSerialCalls(Display.java:1080) at com.codename1.ui.Display.mainEDTLoop(Display.java:902) at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120) at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)Caused by: java.lang.NullPointerException at com.icomm.mails.Mailer.start(Mailer.java:54) ... 9 moreJava Result: 1
public void start() { if(current != null){ current.show(); return; }
current = new Form("Mails");
current.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); Util.register("Mails", Mails.class); Button press = new Button("Press Me!"); current.addComponent(press); press.addActionListener(new ActionListener(){ Mails mail; public void actionPerformed(ActionEvent evt) { try { Mails mailraw = (Mails)WebServiceProxy.getMessage("Mails"); mail = mailraw; System.out.print(mailraw);
if(mail != null){ current.addComponent(new Label("ID: "+mail.getMessageID()));
current.addComponent(new Label("From: "+mail.getFrom())); current.addComponent(new Label("Subject: "+mail.getSubject())); current.addComponent(new Label("Content: "+mail.getContent())); current.addComponent(new Label("To: "+mail.getTo())); } } catch (IOException ex) { ex.printStackTrace(); } }
}); current.show(); }
public void start() { if(current != null){ current.show(); return; }
current = new Form("Mails");
current.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); Util.register("Mails", Mails.class); Button press = new Button("Press Me!"); current.addComponent(press); press.addActionListener(new ActionListener(){ Mails mail; public void actionPerformed(ActionEvent evt) { try {
Mails mailraw = (Mails)WebServiceProxy.getMessage("Mails");
Storage s = Storage.getInstance(); s.writeObject("Mails", mailraw);
mail = (Mails)s.readObject("Mails");
System.out.print(mailraw); if(mail != null){ current.addComponent(new Label("ID: "+mail.getMessageID()));
current.addComponent(new Label("From: "+mail.getFrom())); current.addComponent(new Label("Subject: "+mail.getSubject())); current.addComponent(new Label("Content: "+mail.getContent())); current.addComponent(new Label("To: "+mail.getTo()));
current.forceRevalidate();
} } catch (IOException ex) { ex.printStackTrace(); } } }); current.show(); }
public class Mails implements Externalizable{ private int messageID = 1234; private String subject = "Mails"; private String content = "Example Mails"; private String from = "jm...@icomm.ph"; private String to = "june...@gmail.com"; public void init(){ Util.register("Mails",Mails.class); }
@Override public int getVersion() { return 1; }
@Override public void externalize(DataOutputStream out) throws IOException { out.write(messageID); Util.writeUTF(subject, out); Util.writeUTF(content, out); Util.writeUTF(from, out); Util.writeUTF(to, out); }
@Override public void internalize(int version, DataInputStream in) throws IOException { messageID = in.readInt(); subject = Util.readUTF(in); content = Util.readUTF(in); from = Util.readUTF(in); to = Util.readUTF(in); }
@Override public String getObjectId() { return "Mails"; }
public int getMessageID() { return messageID; }
public void setMessageID(int messageID) { this.messageID = messageID; }
public String getSubject() { return subject; }
public void setSubject(String subject) { this.subject = subject; }
public String getContent() { return content; }
public void setContent(String content) { this.content = content; }
public String getFrom() { return from; }
public void setFrom(String from) { this.from = from; }
public String getTo() { return to; }
public void setTo(String to) { this.to = to; } }
public class WebServiceProxyServer { public static com.codename1.io.Externalizable getMessage(String ObjectName) { Util.register("Mails", Mails.class); Mails mail = new Mails(); mail.setMessageID(123); mail.setFrom("exa...@mail.com"); mail.setSubject("Example"); mail.setContent("Example Mail"); mail.setTo("desti...@mail.com"); return mail; }}
--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/CrHFdAxz7b0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/22f38637-5abc-421e-8b23-e92f29e18c1f%40googlegroups.com.
public class WebServiceProxy { private static final String DESTINATION_URL = "http://localhost:8080/cn1proxy";
private static final WebServiceProxyCall.WSDefinition def_getMails = WebServiceProxyCall.defineWebService(DESTINATION_URL, "getMails", WebServiceProxyCall.TYPE_EXTERNALIABLE); public static com.codename1.io.Externalizable getMails() throws IOException { return ((Externalizable[])WebServiceProxyCall.invokeWebserviceSync(def_getMails)); <--this line is becomes an error. and after removing the brackets, it compiles without error but seems does not work at all. }
public static void getMailsAsync(Callback<com.codename1.io.Externalizable> returnValueFromMethod) { WebServiceProxyCall.invokeWebserviceASync(def_getMails, returnValueFromMethod); }
}
WebServiceProxy.getMailsAsync(new Callback<Externalizable>(){ public void onSucess(Externalizable value) { Mails mail = (Mails)value; System.out.print(value);
if(mail != null){ current.addComponent(new Label("ID: "+mail.getMessageID())); current.addComponent(new Label("From: "+mail.getFrom())); current.addComponent(new Label("Subject: "+mail.getSubject())); current.addComponent(new Label("Content: "+mail.getContent())); current.addComponent(new Label("To: "+mail.getTo())); current.forceRevalidate(); } }
public void onError(Object sender, Throwable err, int errorCode, String errorMessage) { System.out.println(sender); System.out.println(err); System.out.println(errorCode); System.out.println(errorMessage); } });
I suggest you file an issue on the brackets in the generates code. They shouldn't be there.
What are the exceptions with full stacks that you get both on the client and the server?
--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/CrHFdAxz7b0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/cf84bbca-d2bc-4ec9-aadb-71a8ad3114e5%40googlegroups.com.
public void onError(Object sender, Throwable err, int errorCode, String errorMessage) {
System.out.println(sender.toString()); System.out.println(err); System.out.println(errorCode); System.out.println(errorMessage); }
com.codename1.io.WebServiceProxyCall$WSConnection@cda2c188java.io.EOFException-1null
java.io.EOFException at java.io.DataInputStream.readFully(DataInputStream.java:197) at java.io.DataInputStream.readUTF(DataInputStream.java:609) at java.io.DataInputStream.readUTF(DataInputStream.java:564) at com.codename1.io.Util.readUTF(Util.java:969) at com.icomm.models.Mails.internalize(Mails.java:43) at com.codename1.io.Util.readObject(Util.java:624) at com.codename1.io.WebServiceProxyCall$WSConnection.readResponse(WebServiceProxyCall.java:476) at com.codename1.io.ConnectionRequest.performOperation(ConnectionRequest.java:422) at com.codename1.io.NetworkManager$NetworkThread.run(NetworkManager.java:261) at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
public class Mails implements Externalizable{
private int messageID; private String subject; private String content; private String from; private String to; private Message message; <-- I Added and attribute to my class Mails.
try { Mails mailraw = (Mails)WebServiceProxy.getMails();
Storage s = Storage.getInstance(); s.writeObject("Mails", mailraw); mail = (Mails)s.readObject("Mails");
if(mail != null){ current.addComponent(new Label("ID: "+mail.getMessageID())); current.addComponent(new Label("From: "+mail.getFrom())); current.addComponent(new Label("Subject: "+mail.getSubject())); current.addComponent(new Label("Content: "+mail.getContent())); current.addComponent(new Label("To: "+mail.getTo()));
System.out.println(mail.getMessage()); Message message = (Message)mail.getMessage(); <-- how I assigned the value to a variable. if(message != null){ current.addComponent(new Label("To: "+message.getName()));
} current.forceRevalidate(); } } catch (IOException ex) { ex.printStackTrace(); }
I'm totally lost in this thread but from the exception you are getting above it seems the methods do not work.
The issue you filed is related to the code generation bug with the array for which you have a workaround. It seems your externalizable methods don't work.
--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/CrHFdAxz7b0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/a5443f97-8c8a-45dd-bb51-b5fe6fe8b779%40googlegroups.com.
No. I mean you have a bug in your write and read methods as I explained above.
--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/CrHFdAxz7b0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/c0c89088-db19-404c-878f-902d0e659625%40googlegroups.com.
public class Message implements Externalizable{ private String Name[];
@Override public int getVersion() { return 1; }
@Override public void externalize(DataOutputStream out) throws IOException { Util.writeObject(Name, out); <-- I think this makes some problem but I'm not sure. }
@Override public void internalize(int version, DataInputStream in) throws IOException { Name = (String[])Util.readObject(in); <-- I think this makes some problem but I'm not sure. }
@Override public String getObjectId() { return "Message"; }
/** * @return the Name */ public String[] getName() { return Name; }
/** * @param Name the Name to set */ public void setName(String Name[]) { this.Name = Name; } public String getNameOnIndex(int index){ return this.Name[index]; }
}
if(name == null) {
out.writeInt(0);
} else {
out.writeInt(name.length);
for(String n : name) {
Util.writeUTF(n, out);
}
}
name = new String[in.readInt()];
for(int iter = 0 ; iter < name.length ; iter++) {
name[iter] = Util.readUTF(in);
}
--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/CrHFdAxz7b0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/1d9d5a85-3e0f-4dfa-be15-6baf6fcd3fcd%40googlegroups.com.