Bug 544904: Japanese Calendar - Wrong Japanese era of Data tag in CVS
repos view

Change-Id: I91f6bad5f7c2abcdbb599860bcc2aed65a606ce7
Signed-off-by: Kalyan Prasad Tatavarthi <kalyan_prasad@in.ibm.com>
diff --git a/bundles/org.eclipse.team.cvs.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.cvs.ui/META-INF/MANIFEST.MF
index 162ad94..884d5cd 100644
--- a/bundles/org.eclipse.team.cvs.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.team.cvs.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.team.cvs.ui; singleton:=true
-Bundle-Version: 3.4.400.qualifier
+Bundle-Version: 3.4.500.qualifier
 Bundle-Activator: org.eclipse.team.internal.ccvs.ui.CVSUIPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.team.cvs.ui/pom.xml b/bundles/org.eclipse.team.cvs.ui/pom.xml
index 04b721f..3826c9a 100644
--- a/bundles/org.eclipse.team.cvs.ui/pom.xml
+++ b/bundles/org.eclipse.team.cvs.ui/pom.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  Copyright (c) 2012, 2017 Eclipse Foundation and others.
+  Copyright (c) 2012, 2019 Eclipse Foundation and others.
   All rights reserved. This program and the accompanying materials
   are made available under the terms of the Eclipse Distribution License v1.0
   which accompanies this distribution, and is available at
@@ -19,6 +19,6 @@
   </parent>
   <groupId>org.eclipse.team</groupId>
   <artifactId>org.eclipse.team.cvs.ui</artifactId>
-  <version>3.4.400-SNAPSHOT</version>
+  <version>3.4.500-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
index 1d9a294..0657203 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -41,6 +41,11 @@
 	public class DateArea extends DialogArea {
 		private DateTime date;
 
+		/**
+		 * This is the minimum year that is accepted by {@link DateTime#setYear}.
+		 */
+		private static final int DateTime_MIN_YEAR = 1752;
+
 		public void createArea(Composite parent) {
 			Composite composite = createComposite(parent, 2, false);
 			initializeDialogUnits(composite);
@@ -60,8 +65,16 @@
 		}
 		
 		public void adjustCalendar(Calendar calendar) {
+			int dateYear = date.getYear();
+			int todaysYear = calendar.get(Calendar.YEAR);
+			if (todaysYear < DateTime_MIN_YEAR) {
+				// year would be ignored by DateTime if it is less than MIN_YEAR
+				// The code below is to specify the correct year as per the calendar chosen
+				int extended_year = calendar.get(Calendar.EXTENDED_YEAR);
+				dateYear = todaysYear + (dateYear - extended_year);
+			}
 			calendar.set(
-					date.getYear(),
+					dateYear,
 					date.getMonth(),
 					date.getDay(),
 					0,0,0);