2015-06-22 80 views
-1
//if day is sat/sun, set value to W. calendar.set(year,monthNumberForCalendar,dayOfMonth) if(contract.workingDays.id == mondayToFriday.id) 
     {         
     if(calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY){ monthMap.put(dayOfMonth, "W") 

    URI 
     /oulhr/leaveView/show 
    Class 
     java.lang.NullPointerException 
    Message 
     Cannot get property 'id' on null object 

    //leaveMonths = this.getLeaveMonths(year)  
     def employeeContract = new Contract() 
      employeeContract = this.getCurrentContract(employee) leaveMonths = this.getLeaveMonths(year,employeeContract) 

    /*add leave days to month(e.g Jan). When jan is filled up, add to the following month(.e.g Feb) */  
     int monthNumber = 0; 

回答

0

錯誤消息很明顯。

這是因爲workingDaysmondayToFriday爲空而發生的。

要理直氣壯地說:
contract.workingDays.id = mondayToFriday.id

你必須首先確保contract, contract.workingDays, mondayToFridaynull

相關問題