Skip to content

DiskCheck bad cast is causing build failures #8

@FarmGeek4Life

Description

@FarmGeek4Life

Since you don't have a component in the jenkins JIRA, creating the issue here...

Getting the following error with versions 0.29 and 0.30, on all projects regardless of if the disk check is enabled or not...

Disk space threshold is set to :5Gb
Checking disk space Now 
diskspace is null
Total Disk space in workspace is 968.128
FATAL: For input string: "968.128"
java.lang.NumberFormatException: For input string: "968.128"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Long.parseLong(Long.java:589)
	at java.lang.Long.parseLong(Long.java:631)
	at org.jenkinsci.plugin.Diskcheck.preCheckout(Diskcheck.java:147)
	at jenkins.scm.SCMCheckoutStrategy.preCheckout(SCMCheckoutStrategy.java:76)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:484)
	at hudson.model.Run.execute(Run.java:1735)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:415)

caused by

roundedSize = (int) (Long.parseLong(diskSpace) / (1024 * 1024 * 1024));

at Line 146 in the Jenkinsci fork and at Line 141 in your repo

It appears that it is caused by diskSpaceMonitor.getGbLeft() returning a string that is not a long, but a double, so changing Long.parseLong(diskSpace) to Double.parseDouble seems like the simple answer (but it's not, in this case).

Also, noticed that if DiskSpaceMonitorDescriptor.DiskSpace is used to get the free space left, roundedSize is space left in exabytes, not gigabytes (but it will be gigabytes if the free space is read using the RemotingDiagnostics script).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions