Partage
  • Partager sur Facebook
  • Partager sur Twitter

Où se trouve l'erreur???

Sujet résolu
    18 octobre 2011 à 0:53:23

    Bonjour,

    eclipse m'affiche une erreur dans mon code, mais je comprend pas où elle se trouve...

    Donc voici la partie du code qui a un problème:

    protected InputStream getJarInputStream(String currentFile, URLConnection urlconnection)
        throws Exception
      {
        InputStream[] is = new InputStream[1];
    
       /* for (int j = 0; (j < 3) && (is[0] == null); j++) {
          Thread t = new Thread(is, urlconnection) {
            public void run() {
              try {
                this.val$is[0] = this.val$urlconnection.getInputStream();
              }
              catch (IOException localIOException)
              {
              }
            }
          };*/
          t.setName("JarInputStreamThread");
          t.start();
    
          int iterationCount = 0;
          while ((is[0] == null) && (iterationCount++ < 5)) {
            try {
              t.join(1000L);
            }
            catch (InterruptedException localInterruptedException)
            {
            }
          }
          if (is[0] != null) continue;
          try {
            t.interrupt();
            t.join();
          }
          catch (InterruptedException localInterruptedException1)
          {
          }
        }
    
        if (is[0] == null) {
          if (currentFile.equals("essai.jar")) {
            throw new Exception("Unable to download " + currentFile);
          }
          throw new Exception("Unable to download " + currentFile);
        }
    
        return is[0];
      }
    



    J'ai mis en commentaire la partie de code qui est souligné en rouge par eclipse...
    • Partager sur Facebook
    • Partager sur Twitter
      18 octobre 2011 à 1:10:32

      J'ai passer ton code dans mon Eclipse, mais aucune erreur. Cela vient peut être de ton SDK Java. Quelle version utilises-tu ?
      • Partager sur Facebook
      • Partager sur Twitter
        18 octobre 2011 à 1:19:39

        Citation : El - Key

        J'ai passer ton code dans mon Eclipse, mais aucune erreur. Cela vient peut être de ton SDK Java. Quelle version utilises-tu ?


        Alors la version je m'en souviens vraiment plus, mais je vais peut-être essayer de le mettre à jour ^^.

        En tout cas Merci !

        EDIT: Ah désolé en fait j'ai coller le mauvais code la x), c'est comme ça que corrigeais eclipse mais le bon c'est ça :

        protected InputStream getJarInputStream(String currentFile, URLConnection urlconnection)
            throws Exception
          {
            InputStream[] is = new InputStream[1];
        
           /* for (int j = 0; (j < 3) && (is[0] == null); j++) {
              Thread t = new Thread(is, urlconnection) {
                public void run() {
                  try {
                    this.val$is[0] = this.val$urlconnection.getInputStream();
                  }
                  catch (IOException localIOException)
                  {
                  }
                }
              };*/
              t.setName("JarInputStreamThread");
              t.start();
        
              int iterationCount = 0;
              while ((is[0] == null) && (iterationCount++ < 5)) {
                try {
                  t.join(1000L);
                }
                catch (InterruptedException localInterruptedException)
                {
                }
              }
              if (is[0] != null) continue;
              try {
                t.interrupt();
                t.join();
              }
              catch (InterruptedException localInterruptedException1)
              {
              }
            }
        
            if (is[0] == null) {
              if (currentFile.equals("essai.jar")) {
                throw new Exception("Unable to download " + currentFile);
              }
              throw new Exception("Unable to download " + currentFile);
            }
        
            return is[0];
          }
        
        • Partager sur Facebook
        • Partager sur Twitter

        Où se trouve l'erreur???

        × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
        × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
        • Editeur
        • Markdown