Bonjour
L'appel à url.openStream() a un comportement bizarre : il change le contenu de l'url et plante, car l'url modifiée n'existe pas ; je n'ai pas ce problème pour d'autres url

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
  public static void main(String[] argv){ 
    String adresse = "1rPALU";
    URL url = null;
 
    try{
        url = new URL("http://www.boursorama.com/infos/consensus/consensus_previsions.phtml?symbole="+adresse);
        //url = new URL("http://www.boursorama.com/cours.phtml?symbole="+adresse);
 
        System.out.println(url.toString());
 
        System.out.println(url.openStream().toString());
 
        InputStream is = url.openStream();
    }
    catch(MalformedURLException e){
       System.out.println("Error 1 : url incorrecte");
       e.printStackTrace();
    }    
    catch (FileNotFoundException e) {
        e.printStackTrace();       
        System.out.println("Error Test FNF1");
        System.out.println(e.getMessage());
    }        
    catch (IOException e) {
        e.printStackTrace();
        System.out.println("Error Test IO1");
    }  
  }
Cela donne :
http://www.boursorama.com/infos/cons...symbole=1rPALU
Error Test FNF1
http://www.boursorama.com/cours/cons...symbole=1rPALU

.../infos/... est remplacé par .../cours/...

Merci d'avance