Skip to content

Commit

Permalink
[FIXED JENKINS-14983] hpi:run fails with IllegalAccessError.
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Aug 29, 2012
1 parent fc67a14 commit eb7a23f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 3 additions & 1 deletion changelog.html
Expand Up @@ -66,7 +66,9 @@
<li class=bug>
<code>TarArchiver.visitSymlink</code> can throw undeclared <code>PosixException</code>.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-14922">issue 14922</a>)
<li class=>
<li class=bug>
<code>hpi:run</code> failed due to <code>IllegalAccessError</code>s.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-14983">issue 14983</a>)
</ul>
</div><!--=TRUNK-END=-->

Expand Down
14 changes: 11 additions & 3 deletions core/src/main/java/hudson/ExtensionComponent.java
Expand Up @@ -26,6 +26,8 @@

import hudson.model.Describable;
import hudson.model.Descriptor;
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.ExtensionFilter;

/**
Expand All @@ -38,6 +40,7 @@
* @see ExtensionFilter
*/
public class ExtensionComponent<T> implements Comparable<ExtensionComponent<T>> {
private static final Logger LOG = Logger.getLogger(ExtensionComponent.class.getName());
private final T instance;
private final double ordinal;

Expand Down Expand Up @@ -90,9 +93,14 @@ public int compareTo(ExtensionComponent<T> that) {

// make the order bit more deterministic among extensions of the same ordinal
if (this.instance instanceof Descriptor && that.instance instanceof Descriptor) {
return Util.fixNull(((Descriptor)this.instance).getDisplayName()).compareTo(Util.fixNull(((Descriptor)that.instance).getDisplayName()));
} else {
return this.instance.getClass().getName().compareTo(that.instance.getClass().getName());
try {
return Util.fixNull(((Descriptor)this.instance).getDisplayName()).compareTo(Util.fixNull(((Descriptor)that.instance).getDisplayName()));
} catch (RuntimeException x) {
LOG.log(Level.WARNING, null, x);
} catch (LinkageError x) {
LOG.log(Level.WARNING, null, x);
}
}
return this.instance.getClass().getName().compareTo(that.instance.getClass().getName());
}
}
Expand Up @@ -55,9 +55,9 @@ public List<SourceFile> getSourceFiles() {
public static final class DescriptorImpl extends UISampleDescriptor {
}

public static class Fruit implements ExtensionPoint, Describable<Fruit> {
public static abstract class Fruit implements ExtensionPoint, Describable<Fruit> {
protected String name;
private Fruit(String name) { this.name = name; }
protected Fruit(String name) { this.name = name; }

public Descriptor<Fruit> getDescriptor() {
return Jenkins.getInstance().getDescriptor(getClass());
Expand Down

0 comments on commit eb7a23f

Please sign in to comment.