Commit 11ae6eb334fdeaae67f89dbcdfb6f16d3d469b30

Authored by Carlos Alberto
1 parent 0abc95ca
Exists in master

Correção de cálculo de data

cit-core/src/main/java/br/com/centralit/framework/model/WorkDay.java
... ... @@ -150,7 +150,7 @@ public class WorkDay extends PersistentObjectAudit{
150 150 * @return
151 151 */
152 152 public long[] startTimeToArray() {
153   - if (this.getWorkTimes() == null)
  153 + if (this.getWorkTimes() == null || this.getWorkTimes().size() == 0)
154 154 return new long[0];
155 155  
156 156 long[] array = new long[this.getWorkTimes().size()];
... ... @@ -172,7 +172,7 @@ public class WorkDay extends PersistentObjectAudit{
172 172 * @return
173 173 */
174 174 public long[] endTimeToArray() {
175   - if (this.getWorkTimes() == null)
  175 + if (this.getWorkTimes() == null || this.getWorkTimes().size() == 0)
176 176 return new long[0];
177 177  
178 178 long[] array = new long[this.getWorkTimes().size()];
... ... @@ -245,7 +245,7 @@ public class WorkDay extends PersistentObjectAudit{
245 245 * @return
246 246 */
247 247 public long getEndWorkTime() {
248   - if (this.getWorkTimes() == null)
  248 + if (this.getWorkTimes() == null || this.getWorkTimes().size() == 0)
249 249 return 0;
250 250  
251 251 final long[] endArray = this.endTimeToArray();
... ... @@ -260,7 +260,7 @@ public class WorkDay extends PersistentObjectAudit{
260 260 * @return
261 261 */
262 262 public long getStartWorkTime() {
263   - if (this.getWorkTimes() == null)
  263 + if (this.getWorkTimes() == null || this.getWorkTimes().size() == 0)
264 264 return 0;
265 265  
266 266 final long[] startArray = this.startTimeToArray();
... ... @@ -275,7 +275,7 @@ public class WorkDay extends PersistentObjectAudit{
275 275 * @return
276 276 */
277 277 public long calculateIntervals(final long startTime, final long endTime) {
278   - if (this.getWorkTimes() == null)
  278 + if (this.getWorkTimes() == null || this.getWorkTimes().size() == 0)
279 279 return 0;
280 280  
281 281 long interval = 0;
... ... @@ -333,7 +333,7 @@ public class WorkDay extends PersistentObjectAudit{
333 333 * @return
334 334 */
335 335 public long getNextEndWorkTime(final long timeRef) {
336   - if (this.getWorkTimes() == null)
  336 + if (this.getWorkTimes() == null || this.getWorkTimes().size() == 0)
337 337 return 0;
338 338  
339 339 final long[] endArray = this.endTimeToArray();
... ...
cit-core/src/main/java/br/com/centralit/framework/util/UtilDate.java
... ... @@ -1168,6 +1168,9 @@ public class UtilDate {
1168 1168 }
1169 1169  
1170 1170 public static boolean isFeriadoNacional(Date data) {
  1171 + if (data == null)
  1172 + return false;
  1173 +
1171 1174 int dia = 0;
1172 1175 int mes = 0;
1173 1176 int c = 0;
... ...