[Anthill-pro] Avoid NPE's

emerson cargnin echofloripa.yell at gmail.com
Fri May 30 05:11:01 CDT 2008


Cool, honored by the mention ;)

Urbancode could actually set up a wiki, making easier for us to
centralise tips, how-tos, known issues and so on.

On 29/05/2008, Yanko, Curtis <curt_yanko at uhc.com> wrote:
>
>  In  the spirit of Emerson here is a little idiom we have been rolling
> out to protect our reports from NPE's
>
> What is happening is that we periodically get buildlife that have no
> endDate (aborted? Or running while the report is run!) so they'll break
> the reports unless you check fro 'null' endDates or use a try/ catch
> like we did. We capture the project and build life so we can spit it out
> to the logs. We are also working on a clean up script to 'fix' endDates
>
> for (int i = 0; i < summaries.length; i++) {
>   projectname = summaries[i].getProjectName();
>   buildlife = " "+summaries[i].getBuildLifeId();
>
>   Calendar tempCal = Calendar.getInstance(timeZone);
>
>  try {
>    tempCal.setTime(summaries[i].getEndDate());
>     } catch(NullPointerException npe) {
>     System.out.println("Project / BL: "+projectname+" / "+buildlife);
>     }
>
>   boolean failed = (summaries[i].getStatus() ==
> WorkflowStatusEnum.FAILED);
>
>   if (failed) {
>      hoursCountFailed[tempCal.get(Calendar.HOUR_OF_DAY)]++;
>   }
>   else {
>      hoursCount[tempCal.get(Calendar.HOUR_OF_DAY)]++;
>   }
> }
>
>
> ===
> -Curt
> W: 860.702.9059
> M: 860.881.2050
>
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity to
> which it is addressed. If the reader of this e-mail is not the intended
> recipient or his or her authorized agent, the reader is hereby notified
> that any dissemination, distribution or copying of this e-mail is
> prohibited. If you have received this e-mail in error, please notify the
> sender by replying to this message and delete this e-mail immediately.
>
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
>


More information about the Anthill-pro mailing list