Seeking answers to some (Javamail Gmail reading) problems I'm facing!

I've this code which works ok but don't meet my requirements. It fetches the total list of messages from a Gmail account and prints the sender address, subject, in numerical order.
To print all the messages it takes up a lot of bandwidth and fails to load the target page ( if there are more than 20 messages ). Also, everything that gets printed on the target page is static.
So, my questions are:
(i) if is it possible to fetch messages for upto a desired number, can someone please tell me?
(ii) I don't get it. After so much work, this page is printing data in static manner and I don't have any idea how to read the message contents. I was hoping to read the contents like I would, in my Gmail account. So, if anyone could tell me what I'm doing wrong and what I should be doing, I would be really greateful to that person!
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class read extends HttpServlet
    protected void doGet ( HttpServletRequest rq, HttpServletResponse rp ) throws ServletException, IOException
        int i = 0;
        rp.setContentType ( "text/html" );
        PrintWriter out = rp.getWriter ();
        out.println ( "<html> <body> <br/>" );
        try
            Properties props = new Properties ();
            props.setProperty( "mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
            props.setProperty( "mail.pop3.socketFactory.fallback", "false");
            props.setProperty("mail.pop3.port", "995");
            props.setProperty("mail.pop3.socketFactory.port", "995");
            Session session = Session.getInstance ( props );
            Store store = session.getStore( "pop3" );
            store.connect ( "pop.gmail.com", "gmailUsername", "gmailPassword" );
            Folder folder = store.getDefaultFolder ();
            if ( folder == null )
                out.println ( "Folder null" );
                System.exit(1);
            Folder popFolder = folder.getFolder ( "INBOX" );
            popFolder.open ( Folder.READ_WRITE );
            out.println ( "Opened with: " + popFolder.getMessageCount() + "<br/> <br/>" );
            Message listOfMessages[] = popFolder.getMessages();
            FetchProfile fProfile = new FetchProfile ();
            fProfile.add ( FetchProfile.Item.ENVELOPE );
            popFolder.fetch ( listOfMessages, fProfile );
            out.println ( "<font color=\"blue\"> Message List: </font> <br/><br/>" );
            for ( i=0; i<listOfMessages.length; i++ )
                StringBuffer sb = new StringBuffer ( 32 );
                sb.append ( "# " + ( i + 1 ) );
                Address[] addList = listOfMessages.getFrom();
if ( addList.length > 0)
sb.append ( "\t" + ((InternetAddress)addList[0]).getAddress () );
sb.append ( "\t\t" + listOfMessages[i].getSubject () );
out.println ( sb.toString () + "<br/> <br/>" );
out.println ( "<font color=\"blue\" >End of Message List </font> <br/> <br/>" );
popFolder.close ( false );
store.close ();
catch ( Exception E )
out.println ( "<h1> Failed! </h1> Error: <br/> <font color=\"red\"> <b>" + E + "</b> </font> ");
out.println ( "</body> </html>" );
Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Nevermind. I'm done with what I wanted to. Here's my code (hoping this helps someone):
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class read extends HttpServlet
    protected void doPost ( HttpServletRequest rq, HttpServletResponse rp ) throws ServletException, IOException
        int i = 0, n = 0;
        rp.setContentType ( "text/html" );
        PrintWriter out = rp.getWriter ();
        out.println ( "<html> <body> <br/>" );
        try
            Properties props = new Properties ();
            props.setProperty ( "mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory" );
            props.setProperty ( "mail.pop3.socketFactory.fallback", "false" );
            props.setProperty ( "mail.pop3.port", "995" );
            props.setProperty ( "mail.pop3.socketFactory.port", "995" );
            Session session = Session.getInstance ( props );
            Store store = session.getStore( "pop3" );
            store.connect ( "pop.gmail.com", "****", "****" );
            Folder folder = store.getDefaultFolder ();
            if ( folder == null )
                out.println ( "Folder null" );
                System.exit(1);
            Folder popFolder = folder.getFolder ( "INBOX" );
            popFolder.open ( Folder.READ_ONLY );
            Message listOfMessages[] = popFolder.getMessages();
            out.println ( "<font color=\"blue\"> Message List: </font> <br/>" );
            out.println ( popFolder.getMessageCount() + " messages <br/> <br/>" );
            n = listOfMessages.length;
            out.println ( "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">");
            for ( i=0; i<n; i++ )
                //out.println( j + ": " + listOfMessages.getFrom()[0] + "\t" + listOfMessages[i].getSubject() + "<br/> <br/>" );
out.println ( "<tr>" );
out.println ( "<td>" + "<b>" + ( i + 1 ) + "</b>" + ". " + "</td>" );
out.println ( "<td>" + "<b>" + listOfMessages[i].getFrom()[0] + "</b>" + "</td>" );
out.println ( "<td>" + "<b>" + listOfMessages[i].getSubject() + "</b>" + "</td>" );
out.println ( "<td> <form method=\"post\" action=\"showMessage\" > <input type=\"hidden\" name=\"hidden\" value=" + i + " /> &nbsp <input type=\"submit\" value=\"Read\" /> </form> </td>" );
out.println ( "</tr>" );
//out.println ( "<tr> <td> <br/> </td> </tr>");
//j++;
if ( i > 20 )
break;
out.println ( "</table> <br/>" );
out.println ( "<font color=\"blue\" >End of Message List </font> <br/> <br/>" );
popFolder.close ( false );
store.close ();
catch ( Exception E )
out.println ( "<h1> Failed! </h1> Error: <br/> <font color=\"red\"> <b>" + E + "</b> </font> ");
out.println ( "</body> </html>" );
btw, netbeans rulz!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Answer to some of the K7N2 problems

    Well I've had to go thru three weeks of mind numbing pain and 30 dollars worth of sending back RMA's.  Your board is dead.  Probably because you followed the manual like I did.  The bluetooth connector does not go where the manuall says to plug it in.  It goes where the where the manual says to plug in the front usb connector.  Does MSI not even test there manuals?  Needless to say after 3 weeks and $30. I will not be buying MSI again.

    It maybe the board.  I have the delta.  The manual says to plug in the bluetooth to the pins that are closest to the amr slot.  One time I got the board powered off quick enough that it didn't kill it, but at the time I wasn't sure what the problem was.  I powered it on one more time with nothing connected to those pins it ran fine.  I plugged the bluetooth in again and I could smell the smoke.  After that when you it the power the fans spin for a second but die.  Can anyone else confirm this.  Am I a retard? Does it not say in the manual to plug the front usbs into the pins that are in the blue package and to plug the bluetooth ( blue connector on diag) into the pins that are directly next to the amr.  There are also no directions as to how that blue plug fits on those pins.  I had the end with no wires hanging off the end not plugged into anything.

  • JavaMail Gmail Exception when reading mails

    I am using JavaMail for reading messages in a gmail account.
    My general problem is validationException. My code is the following.
    public class MessagesReader {
         public static String usage = "Usage: java gmailTest user password subject";
         public static void main(String[] args) {
              String username = "username";
              String password = "password";
              Properties pop3Props = new Properties();
              Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
              pop3Props.setProperty("mail.pop3.user", username);
              pop3Props.setProperty("mail.pop3.passwd", password);
              pop3Props.setProperty("mail.pop3.ssl", "true");
              pop3Props.setProperty("mail.pop3.host", "pop.gmail.com");
              try {
                   checkForMessage(pop3Props, null);
              } catch (Exception e) {
                   e.printStackTrace();
         public static void checkForMessage(Properties props, String msgSubject)
                   throws NoSuchProviderException, MessagingException {
              Session session = null;
              Store store = null;
              String user = ((props.getProperty("mail.pop3.user") != null) ? props
                        .getProperty("mail.pop3.user") : props.getProperty("mail.user"));
              String passwd = ((props.getProperty("mail.pop3.passwd") != null) ? props
                        .getProperty("mail.pop3.passwd")
                        : props.getProperty("mail.passwd"));
              String host = ((props.getProperty("mail.pop3.host") != null) ? props
                        .getProperty("mail.pop3.host") : props.getProperty("mail.host"));
              if ((props.getProperty("mail.pop3.ssl") != null)
                        && (props.getProperty("mail.pop3.ssl").equalsIgnoreCase("true"))) {
                   String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
                   //Replace socket factory
                   props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
                   // configure the appropriate properties so JavaMail doesn't
                   // fall back to an unsecure connection when a secure one fails:
                   props.setProperty("mail.pop3.socketFactory.fallback", "false");
                   String portStr = ((props.getProperty("mail.pop3.port") != null) ? props
                             .getProperty("mail.pop3.port")
                             : "995");
                   //change the default port number to the corresponding port that your protocol's secure version uses;
                   //otherwise, you must use a fully qualified address (that includes a port number) in the URL passed
                   //to JavaMail (for example, imap://id:[email protected]:993/folder/), or else you get an
                   //"unrecognized SSL handshake" exception. You specify these properties like so:
                   props.setProperty("mail.pop3.port", portStr);
                   props.setProperty("mail.pop3.socketFactory.port", portStr);
                   URLName url = new URLName("pop3://" + user + ":" + passwd + "@"
                             + host + ":" + portStr);
                   session = Session.getInstance(props, null);
                   store = new POP3SSLStore(session, url);
                   //Unfortunately, you may realize that the code above throws an SSLException "untrusted server cert chain"
                   //if the mail server certificate is not installed locally. In that case, you should obtain a correct,
                   //valid certificate for the server and use the keytool utility to add it to a local key storage at
                   //<javahome>\jre\lib\security\cacerts.
              } else {
                   session = Session.getInstance(props, null);
                   store = session.getStore("pop3");
              session.setDebug(true);
              store.connect(host, user, passwd);
              Folder folder = store.getFolder("INBOX");
              folder.open(Folder.READ_WRITE);
              Message[] allMsgs = folder.getMessages();
              for (int i = 0; i < allMsgs.length; i++) {
                   System.out.println(allMsgs.getSubject());
              folder.close(true);
              store.close();
    When I execute the above code I get the following exception:
    [java] DEBUG: setDebug: JavaMail version 1.4ea
         [java] DEBUG POP3: connecting to host "pop.gmail.com", port 995, isSSL true
         [java] javax.mail.MessagingException: Connect failed;
         [java] nested exception is:
         [java] javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
         [java] at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:148)
         [java] at javax.mail.Service.connect(Service.java:275)
         [java] at javax.mail.Service.connect(Service.java:156)
         [java] at javamail.MessagesReader.checkForMessage(Unknown Source)
         [java] at javamail.MessagesReader.main(Unknown Source)
         [java] Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
         [java] at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA6275)
         [java] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
         [java] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
         [java] at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275)
         [java] at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275)
         [java] at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA6275)
         [java] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
         [java] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA6275)
         [java] at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
         [java] at com.sun.net.ssl.internal.ssl.AppInputStream.read(DashoA6275)
         [java] at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
         [java] at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
         [java] at java.io.DataInputStream.readLine(DataInputStream.java:562)
         [java] at com.sun.mail.pop3.Protocol.simpleCommand(Protocol.java:347)
         [java] at com.sun.mail.pop3.Protocol.<init>(Protocol.java:91)
         [java] at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:201)
         [java] at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:144)
         [java] ... 4 more
         [java] Caused by: sun.security.validator.ValidatorException: No trusted certificate found
         [java] at sun.security.validator.SimpleValidator.buildTrustedChain(SimpleValidator.java:304)
         [java] at sun.security.validator.SimpleValidator.engineValidate(SimpleValidator.java:107)
         [java] at sun.security.validator.Validator.validate(Validator.java:202)
         [java] at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(DashoA6275)
         [java] at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(DashoA6275)From all the relative posts I have understood that the problem is associated with an SSL certificate. I have the gmail certificate. Taken from the padlock of the gmail browser page and so I have a gmail.cer.
    I know that I have to use a keytool to do something that I have not understand.
    Can you please give me some instructions?
    Or the forementioned exception has any other solution??
    Thanking you in advance

    Ok here.. im using this code to read from gmail too....
    * MailSender.java
    * Created on 14 November 2006, 17:07
    * This class is used to send mails to other users
    package jmailer;
    * @author Abubakar Gurnah
    import java.sql.SQLException;
    import java.util.*;
    import java.io.*;
    import java.sql.ResultSet;
    import java.text.DateFormatSymbols;
    import java.text.SimpleDateFormat;
    import javax.mail.*;
    import javax.mail.event.*;
    import javax.mail.internet.InternetAddress;
    /* Monitors given mailbox for new mail */
    class MessageRead implements Runnable{
        private String status;
        private String uname;
        private boolean serverStatus=true;
        private String serverConn;
        private int freq;
        private String account;
        private DbConn db;
        private ResultSet rsA;
        private Properties props;
        private Session session;
        private Store store;
        private Folder folder;
         * @param account get the thread account name
         * @param uname logged in user name
         * @param mailServer pop3 mail server
         * @param mailuname pop3 account username e.g [email protected]
         * @param mailPwd pop3 account password
         * @param port pop3 access port
         * @param SSL pop3 support encryption?
         * @param freq the frequency that the server will check for a new message
        public MessageRead(String account,String uname,String mailServer,String mailuname,
                String mailPwd,String port,String SSL,int freq){
            this.uname=uname;
            this.freq=freq;
            this.account=account;
            db=new DbConn();
            rsA=db.executeQuery("SELECT * " +
                    "FROM Accounts " +
                    "WHERE AccountName='" + uname + "'");
            connectToServer(uname,mailServer,mailuname,
                    mailPwd,port,SSL);
         * @param b set the thread on/off
        public void setStatus(boolean b){
            serverStatus=b;
         * @return if the server is on/off
        public boolean getStatus(){
            return serverStatus;
         * @param uname logged in user name
         * @param mailServer pop3 mail server
         * @param mailuname pop3 account username e.g [email protected]
         * @param mailPwd pop3 account password
         * @param port pop3 access port
         * @param SSL pop3 support encryption?
        public void connectToServer(String uname,String mailServer,String mailuname,
                String mailPwd,String port,String SSL){
            serverConn=mailServer+":"+mailuname;
            try {
                if(SSL.equalsIgnoreCase("true")){
                    Properties props = System.getProperties();
                    props.setProperty( "mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
                    props.setProperty( "mail.pop3.socketFactory.fallback", "false");
                    props.setProperty("mail.pop3.port", port);
                    props.setProperty("mail.pop3.socketFactory.port", port);
                    Session session = Session.getInstance(props);
                    store = session.getStore("pop3");
                }else{
                    props=new Properties();
                    props = System.getProperties();
                    // Get a Session object
                    session = Session.getInstance(props, null);
                    store = session.getStore("imap");
                // session.setDebug(true);
                // Get a Store object
                // Connect
                store.connect(mailServer, mailuname, mailPwd);
                // Open a Folder
                folder = store.getFolder("INBOX");
                System.out.println("Opening the inbox folder for " + mailServer);
                if (folder == null || !folder.exists()) {
                    //Tray.showBallon("Warning","Invalid folder Name:"+folder.getName(),Tray.WARNING);
                    System.exit(1);
                folder.open(Folder.READ_WRITE);
                // Add messageCountListener to listen for new messages
                folder.addMessageCountListener(new MessageCountAdapter() {
                    public void messagesAdded(MessageCountEvent ev) {
                        System.out.println("new mail " + serverConn);
                        readMail(ev);
                // Check mail once in "freq" MILLIseconds
            } catch (Exception ex) {
                ex.printStackTrace();
         * Listen for incoming messages
        public void run(){
            try {
                while(serverStatus){
                    // sleep for freq milliseconds
                    // This is to force the IMAP server to send us
                    // EXISTS notifications.
                    System.out.println("Reading for change for " + serverConn);
                    folder.getMessageCount();
                    Thread.sleep(freq);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            } catch (MessagingException ex) {
                ex.printStackTrace();
         * This method is triggered upon receival of the message
         * @param ev Message Object event
        public void readMail(MessageCountEvent ev){
            Message[] msgs = ev.getMessages();
            String from="";
            String subject="";
            String body="";
            status="New Mail";
            // Message retrival part
            for (int i = 0; i < msgs.length; i++) { // for each new entry
                try {
                    from=((InternetAddress)msgs.getFrom()[0]).getPersonal(); //get From whom the came from
    if (from==null)
    from=((InternetAddress)msgs[i].getFrom()[0]).getAddress();
    subject=msgs[i].getSubject(); //get the subject of the message
    //check message if it contain other parts, such as attachment
    Part messagePart = msgs[i];
    Object content=messagePart.getContent();
    if (content instanceof Multipart){
    messagePart=((Multipart)content).getBodyPart(0);
    // -- Get the content type --
    String contentType=messagePart.getContentType();
    //this the mail is plain mail.. or contain some html
    if (contentType.startsWith("text/plain")|| contentType.startsWith("text/html")){
    //get the mail
    BufferedReader reader=new BufferedReader(new InputStreamReader(messagePart.getInputStream()));
    //start reading line after line
    String b=reader.readLine();
    while (b!=null){
    b=reader.readLine();
    body+=b + "\n";
    writingLogs(from + ":" + ((InternetAddress)msgs[i].getFrom()[0]).getAddress(),subject,body);
    checkMsg(((InternetAddress)msgs[i].getFrom()[0]).getAddress(),subject,body);
    msgs[i].setFlag(Flags.Flag.DELETED, true); //delete the messages
    reader.close();
    } catch (IOException ioex) {
    ioex.printStackTrace();
    } catch (MessagingException mex) {
    mex.printStackTrace();
    * This method is used to write the mail to the log, so as to keep track
    * of all the incoming messages...
    * @param strFrom from where the mail is originated
    * @param strSubject the subject of the message
    * @param strBody the body of the message
    public void writingLogs(String strFrom,String strSubject,String strBody ){
    Date today = new Date();
    DateFormatSymbols symbols;
    SimpleDateFormat formatter;
    symbols = new DateFormatSymbols(new Locale("en","US"));
    formatter = new SimpleDateFormat("yyyyMMddHHmmss", symbols);
    String result = formatter.format(today);
    BufferedWriter bw;
    try {
    String path=new File(".").getCanonicalPath();
    bw = new BufferedWriter(new FileWriter(path+"\\logs\\"+result + ".txt"));
    bw.write("From..." + strFrom +"\n");
    bw.write("---------------------------------------------------------\n");
    bw.write("Subject..."+strSubject+"\n");
    bw.write("---------------------------------------------------------\n");
    bw.write("Body..."+strBody+"\n");
    bw.flush();
    bw.close();
    } catch (IOException ex) {
    ex.printStackTrace();
    public void checkMsg(String from,String subject,String body){
    String msg="";
    ResultSet rsP=db.executeQuery("SELECT * " +
    "FROM priority " +
    "WHERE uname='" + uname + "'");
    try {
    boolean fReading=true;
    int i=1;
    rsP.first();
    while(fReading){
    int p=checkPriority(rsP.getString("Priority"+(i++)));
    if(i>3) {fReading=false;break;}
    switch(p){
    case 1:
    msg=readFrom(from,body);break;
    case 2:
    msg=readSubject(from,subject,body);break;
    case 3:
    msg=readBody(from,body);break;
    case -1:
    fReading=false;break;
    } catch (SQLException ex) {
    ex.printStackTrace();
    public int checkPriority(String p){
    if (p.equalsIgnoreCase("From")){
    return 1;
    }else if(p.equalsIgnoreCase("Subject")){
    return 2;
    }else if(p.equalsIgnoreCase("Body")){
    return 3;
    return -1;
    private String readBody(String from, String body) {
    return null;
    private String readSubject(String from, String subject, String body) {
    return null;
    private String readFrom(String from, String body) {
    boolean Matched=false;
    String s=from.substring(0,from.indexOf("@"));
    ResultSet rsR=db.executeQuery("SELECT * " +
    "FROM Rules " +
    "WHERE [if]='from' and uname='" + uname + "'");
    try {
    rsR.first();
    do{
    Matched=checkPattern(from,rsR.getString("Contains"));
    if(Matched){
    break;
    }while(rsR.next());
    MailSender m=new MailSender();
    m.send(rsA.getString("smtpmailuname"),
    rsA.getString("smtpmailuname"),
    rsA.getString("smtpserver"),
    rsA.getString("smtpport"),
    rsA.getString("smtpmailuname"),
    rsR.getString("phoneNo"),
    "Server Message",
    body
    } catch (SQLException ex) {
    ex.printStackTrace();
    return null;
    public boolean checkPattern(String original, String contains){
    if(contains.indexOf(original)>0){
    return true;
    return false;
    Let me explain... just consider connectToServer
    there is SSL.equalsIgnoreCase("true") which is google.. this is what you want in this if statement... it configure the properties of google... try it..

  • I can't use services from google on Safari 5.1.4: Gmail, Reader or Docs. What can I do to solve that?

    After I updated Safari to its latest version (5.1.4), some Google services stopped working!
    I can't access Gmail, Reader or Docs. Their interface just won't load.
    I've already tried to clean Cache, Cookies, (through Safari and CleanMyMac) but still nothing...
    Could somebody help me please?
    Here are my screenshots for Gmail and Reader:
    Mac OS X Lion 10.7.3
    MacBook Pro - mid 2010
    2,8 GHz Intel Core i7
    4 GB 1067 MHz DDR3

    Ooops... I've just found the solution:
    soonisnow
    Re: Problem with Safari 5.1.4 and Google Documents 
    Mar 13, 2012 5:30 AM (in response to CHFeatherstone)
    Looks like Takohashi figured out that UNchecking "Open in 32-bit mode" under "Get Info" should do the trick: https://discussions.apple.com/message/17843743#17843743.
    Would be curious if this helps solve your issue, too..?

  • JavaMail SPI design problem

    I'm planning to support a corporate proprietary mail system through JavaMail SPI extension. The problem I'm facing is the fact that the system
    has such functions that don't fit well in JavaMail api (Store or the Transport). Most of the functionality can be tweaked to follow the api but in order
    to fully support the underlying system some extra methods must be introduced thus 'breaking / extending' the JavaMail api. The problem with this is
    that one must use concrete classes (ie casting to concrete implementation class) instead of for example Store or Transport.
    The way I see it this kind of cripples the abstraction the API is supposed to give. The idea of using JavaMail is the fact that someday these proprietary
    systems will be replaced with standard smtp / imap protocols.

    props.put("mail.smtp.host", yourhost);i have already set this property
    props.put("mail.smtp.auth", "true");i have set this property as suggested... And its
    still giving me that same message... = (Try to send to another address.

  • I need to upgrade my 10.5.1 os on my G4/1.25 (I'm having some audio-midi setup problems), but it's a machine that is not connected to the internet.  Do I have any options?  Thanks!

    Friends,
    I'm having some audio-midi setup problems on my G4/1.25/10.5.1 machine.  I'm thinking that a routine OS upgrade might help.  However, this machine is not connected to the internet.  Are there any alternate methods for upgrading system software?  Thanks in advance!

    OK, what you should do is download the updates on another machine and burn them to a disc.  Start at this link http://support.apple.com/downloads/#leopard for downloads and find, among other things, the 10.5.8 combo updater that works on PPC machines, plus security, QuickTime and other updates.  Going from 10.5.1 to 10.5.8, there will probably be a bunch of things that you should install.  Being off the internet with the machine, you can't have Software Update sort it out, so something might get missed, unfortunately.
    My suggestion is this: if it looks like you might need a download, get it onto that disc.

  • I have a i-phone 5s which i got recently. Everytime i try to update my apps that i got on my 4s on the new5s i get message to fill in a password for some unknown gmail id. How do I get my  apple id back for my apps?

    I have a i-phone 5s which i got recently. Everytime i try to update my apps that i got on my 4s on the new5s i get message to fill in a password for some unknown gmail id. How do I get my  apple id back for my apps?

    That means that one or more of these apps was obtained using that ID. All apps are forever tied to the ID used to originally obtain them & they cannot be transferred to another ID. Your only option is to delete this content, then re-purchase using your ID.

  • Firefox is slow to shutdown and therefore cannot open again for a few minutes or a restart.This is on 2 different PC's 1 running XP and the other Windows 7.Could you throw some light on this problem Thanks

    Firefox is slow to shutdown and therefore cannot open again for a few minutes or a restart.This is on 2 different PC's 1 running XP and the other Windows 7.Could you throw some light on this problem Latest version running Thanks

    Please see this article: [[Firefox hangs]]

  • GMail POP3 problem: Not getting messages with sender "me"

    HI guys,
    I have an account called [email protected] , I successfully sent mails to the same using javamail.In this messages,sender is marked as "me".
    Now I want to read all the messages in inbox,including the messages sent by same account itself.(messages with "me" sender).
    But I notices that javamail doesnt read any messages which the sender is "me".
    Is there a solution for this?
    thanks in advance,
    umanga
    Edited by: virtualumanga on Jun 6, 2008 7:09 PM
    Edited by: virtualumanga on Jun 6, 2008 7:10 PM

    Ok.Heres what happens.
    When I send emails to the same account using gmail webbase application , those mails (which the sender is "me") are read from my Java-POP3 code.
    But when I send mail using my Java-SMTP code , and try to retrieve them using same Java-POP3 program,those mails are not read.
    Here is my temp account that I am using
    user : [email protected]
    password: umanga123
    You can see there are 3 mails (please dont delete them) , which were sent using my Java-SMTP code.And one mail which is,sent from my yahoo account.
    Below Is the java-POP3 code that I am reading my messages.You can run them your self and see that the messages with "me" and not reading,only the message from yahoo is reading.
    You can test following code without any modifications..
    Please help,
    thanks in advance.
    public class MailGet {
         public static void main(String args[]) throws Exception
              String host="pop.gmail.com";
              String user="fhb.test";
              String pwd="umanga123";
              //String from="[email protected]";
              //String to="umanga@quicksilver";
              Properties props=new Properties();
              props.put("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
              props.put("mail.pop3.socketFactory.fallback", "false");
              props.put("mail.pop3.port", "995");
              props.put("mail.pop3.socketFactory.port", "995");
              //FileInputStream fis=new FileInputStream("/home/umanga/pop.prop");
              //props.load(fis);
              Session session=Session.getDefaultInstance(props,
                        null);
         try {     
              Store store=session.getStore("pop3s");
              store.connect(host,user,pwd);
              Folder folder=store.getDefaultFolder().getFolder("Inbox");
              folder.open(Folder.READ_WRITE);
             System.out.println("Getting messages");
              Message msg[]=folder.getMessages();
             System.out.println(folder.getMessageCount()+" "+folder.getUnreadMessageCount());
             for(int i=0;i<msg.length;i++)
                  System.out.println("Subject: "+msg.getSubject() );          
         folder.close(true);
         } catch (Exception e) {e.printStackTrace(); }     
    Edited by: virtualumanga on Jun 7, 2008 4:45 AM
    Edited by: virtualumanga on Jun 7, 2008 4:46 AM
    Edited by: virtualumanga on Jun 7, 2008 5:21 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • SSL reading problem in server-side

    Hi guys,
    I have a problem in my server implemetation with SSL Server Socket. I have created a server socket with a specfic port and bind address. Whenever a client connecfed, i grap its inputstream and starts to read as bytes. There is no problem to open server socket and certifacate authorization, and also a client successfully connects to server. But when client writes some data to its connected socket, server cannot read anything. Server throws no exception and there is no problem in writing. But the available bytes in inputstream is always 0. When i replace SSL socket with normal socket, everything is ok, server can read everything. I confused very much. since i have no concrete exception and stack trace, I know it is hard to explain and get help about my problem. I have added some parts from my code.
    Could you make any suggestions?
    Listening and connection part
    ServerSocketFactory socketFactory = SSLServerSocketFactory.getDefault();
    socket = socketFactory.createServerSocket(port,backLog,bindAddress);
    Socket clientSocket = socket.accept();
    in = new BufferedInputStream(clientSocket .getInputStream());Reading part
              while (continueRunning){
                   try {
                        Thread.sleep(1);
                        if(in.available()<1){
                             System.err.println(in.available());
                             continue;
                        MessageDecoder decoder= new MessageDecoder();
                        Message msg = decoder.decode(in);
                        if(msg == null){
                                           System.out.println("Decoded message is null");
                             continue;
                        handler.messageReceived(msg);
                   } catch (IOException e) {
                                    e.printStackTrace();
                        continueRunning=false;
                        try {
                             clientSocket.close();
                        } catch (IOException e1) {
                             e1.printStackTrace();
                   } catch (InterruptedException e) {
                        continueRunning=false;
                        e.printStackTrace();          
                        try {
                             clientSocket.close();
                        } catch (IOException e1) {
                             // TODO Auto-generated catch block
                             e1.printStackTrace();
              }

    I process bytes whenever they are available in the
    stream, thus i use available() for checking wheter
    there is any bytes to decode.You are looping and sleeping and calling available(). What's the point? As you have nothing else to do in the loop except sleep according to the above code, the whole sleep/available business is still a waste of time. Why not just read()? You are also burning a lot of CPU cycles for nothing.
    The problem is there is no data in the stream althogh client seems write some data. The problem is that regardless of whether there is data in the stream or not, SSLSocket.getInputStream().available() always returns zero. It always does this, and so you cannot use it for the purpose you intend.
    This is no loss, as the purpose you intend adds no value to just doing a read(). Try it and see.
    I discover the debugging utilities of JSSE and make
    some debugs. I find that client is blocked on its
    socket when it tries to write stream. I am not using
    nio, so my sockets are blocking but i cannot find any
    reasonable explanation for this SSL write blocking on
    socket.The 'reasonable explanation' is that the peer is never reading, so its socket receive buffer is full, so the writer's send buffer eventually fills too, at which point the writer is blocked.
    When i change my implementation and used
    non-SSL socket, everything is ok and there is no
    blocking.That's because Socket.getInputStream().available() returns positive numbers whereas SSLSocket.getInputStream.available() always returns zero.
    Is there anyone who knows something about some kind
    of SSL blocking?There is.

  • I use itunes on a Dell XPS502 with W7/64. In some cases have have problems to import CD's. The sound is very disturbed and the import need a lot more time than in normal cases. Is there a problem between itunes W7/64 or a known hardware issue?

    I use itunes on a Dell XPS502 with W7/64. In some cases have have problems to import CD's. The sound is very disturbed and the import need a lot more time than in normal cases. Is there a problem between itunes and W7/64 or a known hardware issue?
    Example-CD : "Tracy Chapman , Telling stories" is not able to import . I have more such negative cases. But in other cases it works fine and the sound is great.
    The firmware at the inbuild CD/DVD DS-6E2SH is the latest version.
    What can I do??

    hi b noir,
    I don't no about virtuel drives like you mententioned. In the mean time I have rebooted the XPS and run again the iTunes diagnostics. I think the back - chance in the registry was not ready to use.  Now there are another results. They are the same in case of a running CD or a not running CD. The difference in total is like before. It takes more time that iTunes reads the (bad) CD and at the there is no good sound. In both cases ( running or not running CD) iTunes diagnostics gives as a result :
    (the copie from ITunes shows the result of the not running CD from Tracy Chapman)
    Microsoft Windows 7 x64 Ultimate Edition Service Pack 1 (Build 7601)
    Dell Inc. Dell System XPS L502X
    iTunes 10.3.1.55
    QuickTime 7.6.9
    FairPlay 1.11.17
    Apple Application Support 1.5.2
    iPod Updater-Bibliothek 10.0d2
    CD Driver 2.2.0.1
    CD Driver DLL 2.1.1.1
    Apple Mobile Device 3.4.0.25
    Apple Mobile Device Treiber 1.55.0.0
    Bonjour 2.0.5.0 (214.3)
    Gracenote SDK 1.8.2.457
    Gracenote MusicID 1.8.2.89
    Gracenote Submit 1.8.2.123
    Gracenote DSP 1.8.2.34
    iTunes-Seriennummer 00D7B2B00CD25750
    Aktueller Benutzer ist kein Administrator.
    Aktuelles Datum und Uhrzeit sind 2011-06-11 19:33:22.
    iTunes befindet sich nicht im abgesicherten Modus.
    WebKit Accelerated Compositing ist aktiviert.
    HDCP wird unterstützt.
    Core Media wird unterstützt.
    Info zu Video-Anzeige
    NVIDIA, NVIDIA GeForce GT 540M
    Intel Corporation, Intel(R) HD Graphics Family
    **** Info für externe Plug-Ins ****
    Keine externen Plug-Ins installiert.
    iPodService 10.3.1.55 (x64) arbeitet zurzeit.
    iTunesHelper 10.3.1.55 arbeitet zurzeit.
    Apple Mobile Device service 3.3.0.0 arbeitet zurzeit.
    **** CD/DVD-Laufwerkstests****
    LowerFilters: PxHlpa64 (2.0.0.0),
    UpperFilters: GEARAspiWDM (2.2.0.1),
    D: PLDS DVDRWBD DS-6E2SH, Rev CD11
    Audio-CD im Laufwerk
    11 Titel auf der CD gefunden, Spieldauer: 42:07 auf Audio-CD
    Titel 1, Startzeit: 00:02:00
    Titel 2, Startzeit: 03:59:47
    Titel 3, Startzeit: 07:19:27
    Titel 4, Startzeit: 11:31:30
    Titel 5, Startzeit: 15:31:50
    Titel 6, Startzeit: 20:07:50
    Titel 7, Startzeit: 24:27:15
    Titel 8, Startzeit: 27:49:10
    Titel 9, Startzeit: 32:41:25
    Titel 10, Startzeit: 35:29:65
    Titel 11, Startzeit: 38:38:00
    Audio-CD erfolgreich gelesen (Suche nach alter Firmware).
    Laufwerksgeschwindigkeit erfolgreich erkannt
    Die CDR-Geschwindigkeiten des Laufwerks sind:  4 10 16 24
    Die CDRW-Geschwindigkeiten des Laufwerks sind:  4
    Die DVDR-Geschwindigkeiten des Laufwerks sind:  4
    Die DVDRW-Geschwindigkeiten des Laufwerks sind:  4
    After starting the import it is going slower and slower. If it is helpful I can send you a soundfile with these distortions.
    best regards
    tcgerd

  • I purchased photoshop CS5 for my windows vista operating system. I purchased a canon 7 D some yrs ago no problem. I purchased canon 7D mk 11 in december 2014. The supplied software will not work with vista. Photoshop CS5 will not accept canon7D mk11. Can

    I purchased Photoshop CS5 for my windows vista operating system. I purchased a canon 7 D some yrs ago no problem. I purchased canon 7D mk 11 in December 2014. The supplied software will not work with vista. Photoshop CS5 will not accept canon7D mk11. Can someone please tell me how i process canon 7D mk11 photos ?????. (is it possible to bypass camera raw and open the photo straight into CS5 without using camera raw first. if so how do i do that. if not how do i process pictures).
    Thank you.
    Brian in the UK.

    Photoshop by itself cannot process raw image data. That is why the Camera Raw plug-in was developed. You could try the DNG converter and convert your images to the DNG format and then the Camera Raw that you have would be able to open them. I can't recommend Lightroom because you are using Vista, and Lightroom 5 cannot be used with that operating system. It may be time for you to get a new computer and upgrade your software.

  • Telnet read problem -- Telnet read back

    I am trying to use telnet to send TL1 command to my UUT and expect to read back measurement data.  I was able to read proper data once in a while but most of the time I read back the TL1 command that I sent.  I tried different read mode and timeout period but nothing seem to matter.  My vi was written in Labview 8.2.1 with Internet toolkit.  I read in the forum about some limitation of the telnet read problem of the vi from the internet toolkit,  Is there any better read driver around?
    Thanks,
    Patrick 

    Hey!  I have a few questions for you that should help us solve this problem.  First, have you tried out the telnet shipping example "Telnet Line Client.vi".  This will help us minimize programming errors, etc.  Also, what type of device are you trying to communicate with?  Are there other forms of communication available?  For example, does the device also have a serial port, GPIB Port, etc.?  Also, is it possible to write to the device using TCP/IP (This is what telnet is based on)?  Let me know the answers to these questions and I will be better equipped to help you out!!
    Thanks!
    Dan
    Daniel Eaton
    National Instruments
    Systems Engineering
    Embedded and Industrial Control

  • MacBook shuts down abruptly after some time, then has problems starting

    I have 13" MacBook that I'm having some problems with. I have OS X and Windows XP in a dual boot configuration, and the problem happens in either OS. I can only use the computer for anything from 3 to 30 minutes before it suddenly shuts down.
    When this first happens, I get trouble restarting it. It often just comes as far as intialising the DVD-ROM (you hear the sound), then it shuts off again. It can take up to ten starts before it powers up again. And then it's just a matter of time before the whole thing starts again. This happens regardless if I have the charger connected or not, or if I use just the charger and remove the battery.
    At first it was thought that the battery was faulty, and I received a new one last spring. However, the problem quickly returned, and I haven't bother to do anything more about it before now. Suffice to say, I miss using my shiny MacBook, and I hope that someone can point me out in the right direction. As the computer is 2 years this may, I doubt I can get it repaired for free on the warranty(?).
    Long post, but I hope I've explained the problem thourough enough. I believe I did the SMC reset and software update last summer, though I'm not sure which revision I'm on. If there's any more information I can provide, please let me know. It just takes some time to get the computer to stay on long enough to check stuff

    Thank you so much for answering! I've actually read your answer to other similar forum, and have just installed iStatPro. it says that my fan is "exhaust" and at 0rpm. do i HAVE to replace the fan to a new one? can I just open up my mac and clean out the fan? if so, would you recommend this instead of buying a new fan? one last thing, if I buy a new fan, is it easy for me to replace it by myself? again, thank you so much for your answer.

  • I have been using xfinity for some time with no problem. Now when I open it, it shuts down. I have reset, restarted, and done a sync. I also deleted and reloaded to no avail

    I have been using the xfinity ap for some time with no problem. Now every time I open the ap it shuts down. I have updated software, reset, done a sync, rebooted to no avail any ideas

    My Xfinity App does the same thing.  Hope they are coming out with a app update.

Maybe you are looking for

  • Fail to communicat​e with ISCO Series D pump controller

    Hey everyone, I have an Isco Series D Pump Controller (which is connected to an Isco Model 100DX Syringe Pump) that I would like to control using RS232 on Labview. I do not have their LabView Toolkit which Teledyne has mentioned in their Technical Bu

  • Oracle V11.2.0.3 ORA-01578: ORACLE data block corrupted - OBJECT = IDL_UB1$

    Hi, I am running into a data corruption issue. My database is: SQL> select banner from v$version; BANNER Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production PL/SQL Release 11.2.0.3.0 - Production CORE 11.2.0.3.0 Production TNS for

  • Doubt in Client Copy Scenario !!

    Hello Gurus I am in a situation where the inputs from the experts help me to solve this issue. Scenario: Development ECC 6.0 System with 100 (Golden) & 110 (Development) clients available. Industry Best Practices installed and activated in 110 Develo

  • CS6 Help Files

    Are there any CS6 Help PDFs yet? Richard Knight

  • Wireless kept disconnecting itself.

    Im using Macbook Pro 15" retina display 2.3GHz, and after i've updated my OS X to Yosemite, i have problems with my wireless connection, it kept disconnecting itself and i have to manually re-connect it back to my home wifi. It disconnects about 8-10