Related code from release 0.23:

    public static void controlorkspaceExceedSize(AbstractProject project){
        DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class);
        DiskUsageProperty property = (DiskUsageProperty) project.getProperty(DiskUsageProperty.class);
        Long size = property.getAllWorkspaceSize();  // <<<<<<<<<< Line 96 with NPE
                        if(plugin.getConfiguration().warnAboutJobWorkspaceExceedSize() && size>plugin.getConfiguration().getJobWorkspaceExceedSize()){
                            StringBuilder builder = new StringBuilder();
                            builder.append("Workspaces of Job " + project.getDisplayName() + " have size " + size + ".");
                            builder.append("\n");
                            builder.append("List of workspaces:");
                            for(String slaveName : property.getSlaveWorkspaceUsage().keySet()){
                                Long s = 0l;
                                for(Long l :property.getSlaveWorkspaceUsage().get(slaveName).values()){
                                    s += l;
                                }
                                builder.append("\n");
                                builder.append("Slave " + slaveName + " has workspace of job " + project.getDisplayName() + " with size " + getSizeString(s));
                            }
                            try {
                                sendEmail("Workspaces of Job " + project.getDisplayName() + " exceed size", builder.toString());
                            } catch (MessagingException ex) {
                                Logger.getLogger(DiskUsageUtil.class.getName()).log(Level.WARNING, "Disk usage plugin can not send notification about exceeting build size.", ex);
                            }
                        }
        
    }

    /**
     * Gets the specific property, or null if the propert is not configured for
     * this job.
     */
    public <T extends JobProperty> T getProperty(Class<T> clazz) {
        for (JobProperty p : properties) {
            if (clazz.isInstance(p))
                return clazz.cast(p);
        }
        return null;
    }

Fixed in https://github.com/mixalturek/disk-usage-plugin/commit/00379aa6a6d04859b5a7306e26181a2ea3237058, pull request sent.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to