I have absolutly no JAVA experience at all and I’m fumbling around with some code that I bought to make it work in NotesWhen I run my java agent on the client I get these errors on the console
octazen.http.HttpException: sun.io.MalformedInputException
at octazen.http.WebRequestor.httpRequest(Unknown Source)
at octazen.http.WebRequestor.httpPost(Unknown Source)
at octazen.addressbook.impl.YahooImporter.fetchContacts(Unknown Source)
at octazen.addressbook.SimpleAddressBookImporter.fetchContacts(Unknown Source)
at JavaAgent.NotesMain(JavaAgent.java:39)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
Caused by: sun.io.MalformedInputException
at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:270)
at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:287)
at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:337)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:223)
at java.io.InputStreamReader.read(InputStreamReader.java:208)
at java.io.Reader.read(Reader.java:113)
... 7 more
Here is my java code
import lotus.domino.*;
import java.io.PrintWriter;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import octazen.addressbook.AddressBookAuthenticationException;
import octazen.addressbook.AddressBookException;
import octazen.addressbook.Contact;
import octazen.addressbook.SimpleAddressBookImporter;
import octazen.addressbook.UnexpectedFormatException;
import octazen.addressbook.UnsupportedAddressBookException;
import octazen.http.HttpException;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = getAgentOutput();
Document doc = agentContext.getDocumentContext();
Item email = doc.getFirstItem("email");
Item pass = doc.getFirstItem("password");
// (Your code goes here)
List list = SimpleAddressBookImporter.fetchContacts(email.getValueString() , pass.getValueString());
//List list = SimpleAddressBookImporter.fetchContacts(email , pass);
Iterator it = list.iterator();
while (it.hasNext()) {
Contact contact = (Contact) it.next();
System.out.println(contact.getName() + " <" + contact.getEmail() + ">");
}
} catch(Exception e) {
e.printStackTrace();
}
}
}