IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Java Discussion :

Runtime.exec() : overflow?


Sujet :

Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    340
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 340
    Par défaut Runtime.exec() : overflow?
    J'utilise la méthode Runtime.exec(mailto:......) afin d'ouvrir directement un nouveau mail depuis mon application.
    Ca fonctionne, à ce détail près que le body est toujours coupé (je passe de longues chaînes en paramètres, html oblige). En essayant avec du texte quelconque, il n'y a pas de logique "à la coupure".

    les commandes ci dessous contiennent toutes l268 caractères, alors qu'à chaque fois, le body contenait 10 fois tout l'alphabet, soit 260 caractères dans le body. Pourtant, j'ai

    mailto:toto@titi.fr;%20;%20?subject=TEST&cc=;%20;%20&body=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyza


    mailto:totototototottotototototoototototototototoototototootototoooooooooooooooooooooooooottttttttttttttooooooooooouuuuuuuuuuuuuuuuu@titi.fr;%20;%20?subject=TEST&cc=;%20;%20&body=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij



    mailto:rouge@vert.com;%20bleu@noir.fr;%20?subject=TEST&cc=jaune@blanc.net;%20marron@rose.org;%20&body=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi


    mailto:rouge@vert.com;%20bleu@noir.fr;%20?subject=TEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEST&cc=jaune@blanc.net;%20marron@rose.org;%20&body=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx
    J'ai tracé mon string buffer tout le long de l'application : il est complet jusqu'à ce que je fasse Runtime.exec(cmd.toString)...

    Voila le code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
     
    private void sendMail2(String from, String[] to, String[] cc, String Subject, String Text, String[] filesAttachment, String[] filesNames, boolean deleteFiles) {
     
    	String s_to="",s_cc="";
    	for(int i=0; i<to.length; i++) 
    	{
    		s_to+=""+to[i]+"; ";
    	}
    	for(int i=0; i<to.length; i++) 
    	{
    		s_cc+=""+cc[i]+"; ";
    	}
     
    	final String DEFAULT_CMD_LINE = System.getProperty("os.name").startsWith("Windows" ) ? "explorer " : "mozilla"; 
    	StringBuffer url=new StringBuffer(2500);
    	url.append("mailto:"+s_to+"?subject="+Subject+"&cc="+s_cc+"&body="+Text);
    	String[] cmd = new String[2];
    	cmd[0] = DEFAULT_CMD_LINE;
    	cmd[1] = "" + url.toString() + "";
    	System.out.println("le buffer contient "+cmd[0]+""+cmd[1]);
     
    	try {
    		Process process = Runtime.getRuntime().exec(cmd);
    	} catch (IOException e1) {
    		// TODO Auto-generated catch block
    		e1.printStackTrace();
    	}
     
    }

  2. #2
    Membre éclairé
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    340
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 340
    Par défaut
    C'est confirmé.

    si je créé une page html avec un <href> et un mailto+un body de 2000 caractères, ça marche très bien.

    Donc puisque c'est le Runtime.exec() qui a l'air de saturer, il y a une alternative au exec()?

Discussions similaires

  1. [RUNTIME][EXEC]
    Par adrien1977 dans le forum API standards et tierces
    Réponses: 7
    Dernier message: 30/09/2009, 16h28
  2. [Runtime][exec]Récupérer les stdout ET stderr
    Par yveslamand dans le forum API standards et tierces
    Réponses: 2
    Dernier message: 20/05/2005, 13h37
  3. [Runtime]exec() avec une commande paramétrée
    Par nice dans le forum Général Java
    Réponses: 9
    Dernier message: 12/05/2005, 13h15
  4. [Servlet][Windows][System call]Runtime.exec
    Par lucho31 dans le forum Servlets/JSP
    Réponses: 8
    Dernier message: 18/01/2005, 11h55
  5. [Système][Runtime][Exec] Comportement étrange au lancement de BeSweet
    Par divxdede dans le forum API standards et tierces
    Réponses: 1
    Dernier message: 06/06/2004, 09h54

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo