Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-51179] - Check type of the loaded object when loading finger…
…prints
  • Loading branch information
oleg-nenashev committed May 13, 2018
1 parent cc94250 commit 9226175
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/src/main/java/hudson/model/Fingerprint.java
Expand Up @@ -1366,7 +1366,12 @@ public Api getApi() {
start = System.currentTimeMillis();

try {
Fingerprint f = (Fingerprint) configFile.read();
Object loaded = configFile.read();
if (!(loaded instanceof Fingerprint)) {
throw new IOException("Unexpected Fingerprint type. Expected " + Fingerprint.class + " or subclass but got "
+ (loaded != null ? loaded.getClass() : "null"));
}
Fingerprint f = (Fingerprint) loaded;
if(logger.isLoggable(Level.FINE))
logger.fine("Loading fingerprint "+file+" took "+(System.currentTimeMillis()-start)+"ms");
if (f.facets==null)
Expand Down

0 comments on commit 9226175

Please sign in to comment.