Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 288309 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java (+2 lines)
Lines 30-35 Link Here
30
30
31
	public final static BugzillaVersion BUGZILLA_3_2 = new BugzillaVersion("3.2"); //$NON-NLS-1$
31
	public final static BugzillaVersion BUGZILLA_3_2 = new BugzillaVersion("3.2"); //$NON-NLS-1$
32
32
33
	public final static BugzillaVersion BUGZILLA_3_4 = new BugzillaVersion("3.4"); //$NON-NLS-1$
34
33
	public final static BugzillaVersion MAX_VERSION = new BugzillaVersion("3.2"); //$NON-NLS-1$
35
	public final static BugzillaVersion MAX_VERSION = new BugzillaVersion("3.2"); //$NON-NLS-1$
34
36
35
	private final int major;
37
	private final int major;
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java (-1 / +1 lines)
Lines 83-89 Link Here
83
	/**
83
	/**
84
	 * Note: Date formatters constructed within method for thread safety
84
	 * Note: Date formatters constructed within method for thread safety
85
	 */
85
	 */
86
	private Date getDate(String attributeId, String dateString) {
86
	protected Date getDate(String attributeId, String dateString) {
87
		Date parsedDate = null;
87
		Date parsedDate = null;
88
88
89
		/**
89
		/**
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java (-2 / +75 lines)
Lines 488-502 Link Here
488
488
489
		String lastKnownMod = task.getAttribute(BugzillaAttribute.DELTA_TS.getKey());
489
		String lastKnownMod = task.getAttribute(BugzillaAttribute.DELTA_TS.getKey());
490
		if (lastKnownMod != null) {
490
		if (lastKnownMod != null) {
491
491
			TaskAttribute attrModification = taskData.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION);
492
			TaskAttribute attrModification = taskData.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION);
492
			if (attrModification != null) {
493
			if (attrModification != null && attrModification.getValue() != null
493
				return !lastKnownMod.equals(attrModification.getValue());
494
					&& attrModification.getValue().length() > 0) {
495
496
				RepositoryConfiguration config = BugzillaCorePlugin.getRepositoryConfiguration(taskRepository.getRepositoryUrl());
497
				if (config == null) {
498
					((AbstractTask) task).setStatus(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
499
							"Repository configuration not found for " + taskRepository.getRepositoryUrl())); //$NON-NLS-1$
500
					return !lastKnownMod.equals(attrModification.getValue());
501
				}
502
503
				BugzillaVersion version = config.getInstallVersion();
504
505
				if (version == null || version.compareTo(BugzillaVersion.BUGZILLA_3_4) < 0) {
506
					return !lastKnownMod.equals(attrModification.getValue());
507
				}
508
509
				BugzillaAttributeMapper mapper = (BugzillaAttributeMapper) taskData.getAttributeMapper();
510
				Date oldModDate = mapper.getDate(BugzillaAttribute.DELTA_TS.getKey(), lastKnownMod);
511
				Date newModDate = mapper.getDateValue(attrModification);
512
513
				if (oldModDate == null) {
514
					((AbstractTask) task).setStatus(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
515
							"Unable to parse cached task modification timestamp " + lastKnownMod)); //$NON-NLS-1$
516
					return !lastKnownMod.equals(attrModification.getValue());
517
				}
518
519
				if (newModDate == null) {
520
					((AbstractTask) task).setStatus(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
521
							"Unable to parse incoming task modification timestamp " + attrModification.getValue())); //$NON-NLS-1$
522
					return !lastKnownMod.equals(attrModification.getValue());
523
				}
524
525
				if (!sameTimeZone(lastKnownMod, attrModification.getValue())) {
526
					// We're talking to BZ 3.4 or greater but time zones differ, potential migration scenario
527
					long delta = Math.abs(newModDate.getTime() - oldModDate.getTime());
528
					long hour = 1000 * 60 * 60;
529
					if (delta > 0 && delta % hour == 0 && delta < 24 * hour) {
530
						return false;
531
					}
532
					return true;
533
				}
534
535
				return oldModDate.compareTo(newModDate) != 0;
536
494
			}
537
			}
495
538
496
		}
539
		}
497
		return true;
540
		return true;
498
	}
541
	}
499
542
543
	private boolean sameTimeZone(String oldDate, String newDate) {
544
		String parts[] = oldDate.split(" ");
545
		String oldTZ = "";
546
		if (parts.length == 3) {
547
			oldTZ = parts[2];
548
		} else {
549
			return false;
550
		}
551
552
		parts = newDate.split(" ");
553
		String newTZ = "";
554
		if (parts.length == 3) {
555
			newTZ = parts[2];
556
		} else {
557
			return false;
558
		}
559
560
		return newTZ.equals(oldTZ);
561
562
	}
563
564
	private boolean hasTimzone(String dateString) {
565
		if (dateString == null || dateString.length() == 0) {
566
			return false;
567
		}
568
		String[] parts = dateString.split(" "); //$NON-NLS-1$
569
		boolean hasTimeZone = (parts != null && parts.length == 3);
570
		return hasTimeZone;
571
	}
572
500
	@Override
573
	@Override
501
	public Collection<TaskRelation> getTaskRelations(TaskData taskData) {
574
	public Collection<TaskRelation> getTaskRelations(TaskData taskData) {
502
		List<TaskRelation> relations = new ArrayList<TaskRelation>();
575
		List<TaskRelation> relations = new ArrayList<TaskRelation>();

Return to bug 288309