Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-2831

hudson.remoting.Which makes protocol assumptions, incompatible w/ JBossAS 5.0.0.GA

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None
    • Platform: All, OS: All

      The following:

      public static File jarFile(Class clazz) throws IOException {
      URL res = jarURL(clazz);
      String resURL = res.toExternalForm();
      String originalURL = resURL;
      if(resURL.startsWith("jar:"))
      return fromJarUrlToFile(resURL);
      if(resURL.startsWith("wsjar:"))
      return fromJarUrlToFile(resURL);

      if(resURL.startsWith("code-source:/"))

      { // OC4J apparently uses this. See http://www.nabble.com/Hudson-on-OC4J-tt16702113.html resURL = resURL.substring("code-source:/".length(), resURL.lastIndexOf('!')); // cut off jar: and the file name portion return new File(decode(new URL("file:/"+resURL).getPath())); }

      if(resURL.startsWith("file:")) {
      // unpackaged classes
      int n = clazz.getName().split("
      .").length; // how many slashes do
      wo need to cut?
      for( ; n>0; n-- )

      { int idx = Math.max(resURL.lastIndexOf('/'), resURL.lastIndexOf('\\')); if(idx<0) throw new IllegalArgumentException(originalURL + " - " + resURL); resURL = resURL.substring(0,idx); }

      // won't work if res URL contains ' '
      // return new File(new URI(null,new URL(res).toExternalForm(),null));
      // won't work if res URL contains '%20'
      // return new File(new URL(res).toURI());

      return new File(decode(new URL(resURL).getPath()));
      }

      throw new IllegalArgumentException(originalURL + " - " + resURL);
      }

      ...makes assumptions about the presence of protocols used. JBossAS (and other
      projects based upon JBoss Microcontainer Virtual File System) employs a file
      abstraction layer, leading to errors such as:

      java.lang.IllegalArgumentException:
      vfszip:/home/alrubinger/business/jboss/wc/jbossas/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/hudson.war/WEB-INF/lib/maven-agent-1.274-SNAPSHOT.jar/hudson/maven/agent/Main.class
      -
      vfszip:/home/alrubinger/business/jboss/wc/jbossas/trunk/build/output/jboss-6.0.0.Alpha1/server/default/deploy/hudson.war/WEB-INF/lib/maven-agent-1.274-SNAPSHOT.jar/hudson/maven/agent/Main.class
      at hudson.remoting.Which.jarFile(Which.java:74)
      at hudson.maven.MavenProcessFactory.buildMavenCmdLine(MavenProcessFactory.java:261)
      at hudson.maven.MavenProcessFactory.newProcess(MavenProcessFactory.java:172)
      at hudson.maven.ProcessCache.get(ProcessCache.java:169)
      at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:328)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:244)
      at hudson.model.Run.run(Run.java:831)
      at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:204)
      at hudson.model.ResourceController.execute(ResourceController.java:70)
      at hudson.model.Executor.run(Executor.java:90)

      I've set this issue to "www" subcomponent in absence of "remoting" or "main",
      please adjust as necessary.

            alrubinger alrubinger
            alrubinger alrubinger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: