提交 ea20b986 编写于 作者: R robm

Merge

...@@ -21,4 +21,4 @@ ...@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any # or visit www.oracle.com if you need additional information or have any
# questions. # questions.
# #
tzdata2017a tzdata2017b
...@@ -443,18 +443,25 @@ Link Africa/Nairobi Indian/Mayotte ...@@ -443,18 +443,25 @@ Link Africa/Nairobi Indian/Mayotte
# See Africa/Johannesburg. # See Africa/Johannesburg.
# Liberia # Liberia
# From Paul Eggert (2006-03-22): #
# In 1972 Liberia was the last country to switch # From Paul Eggert (2017-03-02):
# from a UTC offset that was not a multiple of 15 or 20 minutes. #
# Howse reports that it was in honor of their president's birthday. # The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30.
# Shank & Pottenger report the date as May 1, whereas Howse reports Jan; #
# go with Shanks & Pottenger. # In 1972 Liberia was the last country to switch from a UTC offset
# For Liberia before 1972, Shanks & Pottenger report -0:44, whereas Howse and # that was not a multiple of 15 or 20 minutes. The 1972 change was on
# Whitman each report -0:44:30; go with the more precise figure. # 1972-01-07, according to an entry dated 1972-01-04 on p 330 of:
# Presidential Papers: First year of the administration of
# President William R. Tolbert, Jr., July 23, 1971-July 31, 1972.
# Monrovia: Executive Mansion.
#
# Use the abbreviation "MMT" before 1972, as the more-accurate numeric
# abbreviation "-004430" would be one byte over the POSIX limit.
#
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Monrovia -0:43:08 - LMT 1882 Zone Africa/Monrovia -0:43:08 - LMT 1882
-0:43:08 - MMT 1919 Mar # Monrovia Mean Time -0:43:08 - MMT 1919 Mar # Monrovia Mean Time
-0:44:30 - -004430 1972 May -0:44:30 - MMT 1972 Jan 7 # approximately MMT
0:00 - GMT 0:00 - GMT
############################################################################### ###############################################################################
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
# All text uses UTF-8 encoding. The columns of the table are as follows: # All text uses UTF-8 encoding. The columns of the table are as follows:
# #
# 1. ISO 3166-1 alpha-2 country code, current as of # 1. ISO 3166-1 alpha-2 country code, current as of
# ISO 3166-1 Newsletter VI-16 (2013-07-11). See: Updates on ISO 3166 # ISO 3166-1 N905 (2016-11-15). See: Updates on ISO 3166-1
# http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm # http://isotc.iso.org/livelink/livelink/Open/16944257
# 2. The usual English name for the coded region, # 2. The usual English name for the coded region,
# chosen so that alphabetic sorting of subsets produces helpful lists. # chosen so that alphabetic sorting of subsets produces helpful lists.
# This is not the same as the English name in the ISO 3166 tables. # This is not the same as the English name in the ISO 3166 tables.
......
...@@ -3162,6 +3162,12 @@ Zone America/Guatemala -6:02:04 - LMT 1918 Oct 5 ...@@ -3162,6 +3162,12 @@ Zone America/Guatemala -6:02:04 - LMT 1918 Oct 5
# http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/ # http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/
# http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/ # http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/
# From Steffen Thorsen (2017-03-12):
# We have received 4 mails from different people telling that Haiti
# has started DST again today, and this source seems to confirm that,
# I have not been able to find a more authoritative source:
# https://www.haitilibre.com/en/news-20319-haiti-notices-time-change-in-haiti.html
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Haiti 1983 only - May 8 0:00 1:00 D Rule Haiti 1983 only - May 8 0:00 1:00 D
Rule Haiti 1984 1987 - Apr lastSun 0:00 1:00 D Rule Haiti 1984 1987 - Apr lastSun 0:00 1:00 D
...@@ -3174,6 +3180,8 @@ Rule Haiti 2005 2006 - Apr Sun>=1 0:00 1:00 D ...@@ -3174,6 +3180,8 @@ Rule Haiti 2005 2006 - Apr Sun>=1 0:00 1:00 D
Rule Haiti 2005 2006 - Oct lastSun 0:00 0 S Rule Haiti 2005 2006 - Oct lastSun 0:00 0 S
Rule Haiti 2012 2015 - Mar Sun>=8 2:00 1:00 D Rule Haiti 2012 2015 - Mar Sun>=8 2:00 1:00 D
Rule Haiti 2012 2015 - Nov Sun>=1 2:00 0 S Rule Haiti 2012 2015 - Nov Sun>=1 2:00 0 S
Rule Haiti 2017 max - Mar Sun>=8 2:00 1:00 D
Rule Haiti 2017 max - Nov Sun>=1 2:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Port-au-Prince -4:49:20 - LMT 1890 Zone America/Port-au-Prince -4:49:20 - LMT 1890
-4:49 - PPMT 1917 Jan 24 12:00 # P-a-P MT -4:49 - PPMT 1917 Jan 24 12:00 # P-a-P MT
......
...@@ -211,6 +211,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo ...@@ -211,6 +211,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
private boolean isFullScreenAnimationOn; private boolean isFullScreenAnimationOn;
private volatile boolean isIconifyAnimationActive; private volatile boolean isIconifyAnimationActive;
private volatile boolean isZoomed;
private Window target; private Window target;
private LWWindowPeer peer; private LWWindowPeer peer;
...@@ -480,7 +481,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo ...@@ -480,7 +481,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
private boolean isMaximized() { private boolean isMaximized() {
return undecorated ? this.normalBounds != null return undecorated ? this.normalBounds != null
: CWrapper.NSWindow.isZoomed(getNSWindowPtr()); : isZoomed;
} }
private void maximize() { private void maximize() {
...@@ -936,6 +937,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo ...@@ -936,6 +937,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
protected void deliverMoveResizeEvent(int x, int y, int width, int height, protected void deliverMoveResizeEvent(int x, int y, int width, int height,
boolean byUser) { boolean byUser) {
isZoomed = CWrapper.NSWindow.isZoomed(getNSWindowPtr());
checkZoom(); checkZoom();
final Rectangle oldB = nativeBounds; final Rectangle oldB = nativeBounds;
......
...@@ -361,9 +361,11 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj ...@@ -361,9 +361,11 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj
static JNF_MEMBER_CACHE(jm_isCollated, sjc_CPrinterJob, "isCollated", "()Z"); static JNF_MEMBER_CACHE(jm_isCollated, sjc_CPrinterJob, "isCollated", "()Z");
static JNF_MEMBER_CACHE(jm_getFromPage, sjc_CPrinterJob, "getFromPageAttrib", "()I"); static JNF_MEMBER_CACHE(jm_getFromPage, sjc_CPrinterJob, "getFromPageAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getToPage, sjc_CPrinterJob, "getToPageAttrib", "()I"); static JNF_MEMBER_CACHE(jm_getToPage, sjc_CPrinterJob, "getToPageAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getMinPage, sjc_CPrinterJob, "getMinPageAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getMaxPage, sjc_CPrinterJob, "getMaxPageAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getSelectAttrib, sjc_CPrinterJob, "getSelectAttrib", "()I"); static JNF_MEMBER_CACHE(jm_getSelectAttrib, sjc_CPrinterJob, "getSelectAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I"); static JNF_MEMBER_CACHE(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I");
static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;"); static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormat", "(I)Ljava/awt/print/PageFormat;");
NSMutableDictionary* printingDictionary = [dst dictionary]; NSMutableDictionary* printingDictionary = [dst dictionary];
...@@ -372,32 +374,34 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj ...@@ -372,32 +374,34 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj
jboolean collated = JNFCallBooleanMethod(env, srcPrinterJob, jm_isCollated); // AWT_THREADING Safe (known object) jboolean collated = JNFCallBooleanMethod(env, srcPrinterJob, jm_isCollated); // AWT_THREADING Safe (known object)
[printingDictionary setObject:[NSNumber numberWithBool:collated ? YES : NO] forKey:NSPrintMustCollate]; [printingDictionary setObject:[NSNumber numberWithBool:collated ? YES : NO] forKey:NSPrintMustCollate];
jint jNumPages = JNFCallIntMethod(env, srcPageable, jm_getNumberOfPages); // AWT_THREADING Safe (!appKit) jint selectID = JNFCallIntMethod(env, srcPrinterJob, jm_getSelectAttrib);
if (jNumPages != java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES) jint fromPage = JNFCallIntMethod(env, srcPrinterJob, jm_getFromPage);
{ jint toPage = JNFCallIntMethod(env, srcPrinterJob, jm_getToPage);
jint selectID = JNFCallIntMethod(env, srcPrinterJob, jm_getSelectAttrib); if (selectID ==0) {
if (selectID ==0) { [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
[printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages]; } else if (selectID == 2) {
} else if (selectID == 2) { // In Mac 10.7, Print ALL is deselected if PrintSelection is YES whether
// In Mac 10.7, Print ALL is deselected if PrintSelection is YES whether // NSPrintAllPages is YES or NO
// NSPrintAllPages is YES or NO [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
[printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintSelectionOnly];
} else {
jint minPage = JNFCallIntMethod(env, srcPrinterJob, jm_getMinPage);
jint maxPage = JNFCallIntMethod(env, srcPrinterJob, jm_getMaxPage);
// for PD_SELECTION or PD_NOSELECTION, check from/to page
// to determine which radio button to select
if (fromPage > minPage || toPage < maxPage) {
[printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages]; [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
[printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintSelectionOnly];
} else { } else {
[printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages]; [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
} }
jint fromPage = JNFCallIntMethod(env, srcPrinterJob, jm_getFromPage);
jint toPage = JNFCallIntMethod(env, srcPrinterJob, jm_getToPage);
// setting fromPage and toPage will not be shown in the dialog if printing All pages
[printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
[printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
}
else
{
[printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
} }
jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat);
// setting fromPage and toPage will not be shown in the dialog if printing All pages
[printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
[printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat, (jint)0);
if (page != NULL) { if (page != NULL) {
javaPageFormatToNSPrintInfo(env, NULL, page, dst); javaPageFormatToNSPrintInfo(env, NULL, page, dst);
} }
......
...@@ -72,7 +72,7 @@ static pthread_mutex_t gColorCacheLock = PTHREAD_MUTEX_INITIALIZER; ...@@ -72,7 +72,7 @@ static pthread_mutex_t gColorCacheLock = PTHREAD_MUTEX_INITIALIZER;
// given a UInt32 color, it tries to find that find the corresponding CGColorRef in the hash cache. If the CGColorRef // given a UInt32 color, it tries to find that find the corresponding CGColorRef in the hash cache. If the CGColorRef
// doesn't exist or there is a collision, it creates a new one CGColorRef and put's in the cache. Then, // doesn't exist or there is a collision, it creates a new one CGColorRef and put's in the cache. Then,
// it sets with current fill/stroke color for the the CGContext passed in (qsdo->cgRef). // it sets with current fill/stroke color for the CGContext passed in (qsdo->cgRef).
void setCachedColor(QuartzSDOps *qsdo, UInt32 color) void setCachedColor(QuartzSDOps *qsdo, UInt32 color)
{ {
static const CGFloat kColorConversionMultiplier = 1.0f/255.0f; static const CGFloat kColorConversionMultiplier = 1.0f/255.0f;
...@@ -286,26 +286,19 @@ PRINT(" contextQuartzLinearGradientPath"); ...@@ -286,26 +286,19 @@ PRINT(" contextQuartzLinearGradientPath");
for (i = 0; i < num_locations; i++) { for (i = 0; i < num_locations; i++) {
locations[i] = gradientInfo->fractionsdata[i]; locations[i] = gradientInfo->fractionsdata[i];
//fprintf(stderr, "locations[%d] %f\n", i, locations[i]);
} }
for (i = 0; i < component_size; i++) { for (i = 0; i < component_size; i++) {
components[i] = gradientInfo->colordata[i]; components[i] = gradientInfo->colordata[i];
//fprintf(stderr, "components[%d] %f, gradientInfo->colordata[%d] %f\n",
// i, components[i], i, gradientInfo->colordata[i]);
} }
CGContextSaveGState(cgRef); CGContextSaveGState(cgRef);
gradient = CGGradientCreateWithColorComponents(colorspace, components, locations, num_locations); gradient = CGGradientCreateWithColorComponents(colorspace, components, locations, num_locations);
//fprintf(stderr, "gradientInfo->start.x %f, gradientInfo->start.y %f\n",
// gradientInfo->start.x, gradientInfo->start.y);
//fprintf(stderr, "gradientInfo->end.x %f, gradientInfo->end.y %f\n",
// gradientInfo->end.x, gradientInfo->end.y);
if (qsdo->isEvenOddFill) { if (qsdo->isEvenOddFill) {
CGContextEOClip(cgRef); CGContextEOClip(cgRef);
} else { } else {
CGContextClip(cgRef); CGContextClip(cgRef);
} }
CGContextDrawLinearGradient(cgRef, gradient, gradientInfo->start, gradientInfo->end, kCGGradientDrawsAfterEndLocation); CGContextDrawLinearGradient(cgRef, gradient, gradientInfo->start, gradientInfo->end, kCGGradientDrawsAfterEndLocation);
CGContextRestoreGState(cgRef); CGContextRestoreGState(cgRef);
CGColorSpaceRelease(colorspace); CGColorSpaceRelease(colorspace);
CGGradientRelease(gradient); CGGradientRelease(gradient);
...@@ -334,25 +327,17 @@ PRINT(" contextQuartzRadialGradientPath"); ...@@ -334,25 +327,17 @@ PRINT(" contextQuartzRadialGradientPath");
for (i = 0; i < num_locations; i++) { for (i = 0; i < num_locations; i++) {
locations[i] = gradientInfo->fractionsdata[i]; locations[i] = gradientInfo->fractionsdata[i];
//fprintf(stderr, "locations[%d] %f\n", i, locations[i]);
} }
for (i = 0; i < component_size; i++) { for (i = 0; i < component_size; i++) {
components[i] = gradientInfo->colordata[i]; components[i] = gradientInfo->colordata[i];
//fprintf(stderr, "components[%d] %f, gradientInfo->colordata[%d] %f\n",
// i, components[i], i, gradientInfo->colordata[i]);
} }
CGContextSaveGState(cgRef); CGContextSaveGState(cgRef);
gradient = CGGradientCreateWithColorComponents(colorspace, components, locations, num_locations); gradient = CGGradientCreateWithColorComponents(colorspace, components, locations, num_locations);
//fprintf(stderr, "gradientInfo->start.x %f, gradientInfo->start.y %f\n",
// gradientInfo->start.x, gradientInfo->start.y);
//fprintf(stderr, "gradientInfo->end.x %f, gradientInfo->end.y %f\n",
// gradientInfo->end.x, gradientInfo->end.y);
if (qsdo->isEvenOddFill) { if (qsdo->isEvenOddFill) {
CGContextEOClip(cgRef); CGContextEOClip(cgRef);
} else { } else {
CGContextClip(cgRef); CGContextClip(cgRef);
} }
//fprintf(stderr, "gradientInfo->startRadius %f, gradientInfo->endRadius %f\n",startRadius,endRadius);
CGContextDrawRadialGradient(cgRef, gradient, gradientInfo->start, 0, gradientInfo->end, endRadius, kCGGradientDrawsAfterEndLocation); CGContextDrawRadialGradient(cgRef, gradient, gradientInfo->start, 0, gradientInfo->end, endRadius, kCGGradientDrawsAfterEndLocation);
CGContextRestoreGState(cgRef); CGContextRestoreGState(cgRef);
...@@ -944,55 +929,41 @@ void setupGradient(JNIEnv *env, QuartzSDOps* qsdo, jfloat* javaFloatGraphicsStat ...@@ -944,55 +929,41 @@ void setupGradient(JNIEnv *env, QuartzSDOps* qsdo, jfloat* javaFloatGraphicsStat
if (colorArray != NULL) if (colorArray != NULL)
{ {
jint length = (*env)->GetArrayLength(env, colorArray); jint length = (*env)->GetArrayLength(env, colorArray);
//fprintf(stderr, "length %d\n", length);
jint* jcolorData = (jint*)(*env)->GetPrimitiveArrayCritical(env, colorArray, NULL); jint* jcolorData = (jint*)(*env)->GetPrimitiveArrayCritical(env, colorArray, NULL);
CGFloat* colors= (CGFloat*)calloc(0, sizeof(CGFloat)*length); qsdo->gradientInfo->colordata = (CGFloat*)malloc(sizeof(CGFloat)*4*length);
int i = 0; memset(qsdo->gradientInfo->colordata, 0, sizeof(CGFloat)*4*length);
if (jcolorData != NULL) if (jcolorData != NULL)
{ {
jint ival; int i;
for (ival=0; ival<length; ival++) for (i=0; i<length; i++)
{ {
colors[ival] = (CGFloat)jcolorData[ival]; qsdo->gradientInfo->colordata[i*4] = ((jcolorData[i]>>16)&0xff)*kColorConversionMultiplier;
}
}
(*env)->ReleasePrimitiveArrayCritical(env, colorArray, jcolorData, 0);
qsdo->gradientInfo->colordata = (CGFloat*)calloc(0, sizeof(CGFloat)*4*length);
for (i = 0; i < length; i++)
{
jint c1 = colors[i];
//fprintf(stderr, "c1 %x\n", c1);
qsdo->gradientInfo->colordata[i*4] = ((c1>>16)&0xff)*kColorConversionMultiplier;
//fprintf(stderr, "qsdo->gradientInfo->colordata[%d] %f\n", i*4, qsdo->gradientInfo->colordata[i*4]);
qsdo->gradientInfo->colordata[i*4+1] = ((c1>>8)&0xff)*kColorConversionMultiplier; qsdo->gradientInfo->colordata[i*4+1] = ((jcolorData[i]>>8)&0xff)*kColorConversionMultiplier;
//fprintf(stderr, "qsdo->gradientInfo->colordata[%d] %f\n", i*4+1, qsdo->gradientInfo->colordata[i*4+1]);
qsdo->gradientInfo->colordata[i*4+2] = ((c1>>0)&0xff)*kColorConversionMultiplier; qsdo->gradientInfo->colordata[i*4+2] = ((jcolorData[i]>>0)&0xff)*kColorConversionMultiplier;
//fprintf(stderr, "qsdo->gradientInfo->colordata[%d] %f\n", i*4+2, qsdo->gradientInfo->colordata[i*4+2]);
qsdo->gradientInfo->colordata[i*4+3] = ((c1>>24)&0xff)*kColorConversionMultiplier; qsdo->gradientInfo->colordata[i*4+3] = ((jcolorData[i]>>24)&0xff)*kColorConversionMultiplier;
//fprintf(stderr, "qsdo->gradientInfo->colordata[%d] %f\n", i*4+3, qsdo->gradientInfo->colordata[i*4+3]); }
} }
free(colors); (*env)->ReleasePrimitiveArrayCritical(env, colorArray, jcolorData, 0);
} }
jobject fractionsArray = ((*env)->GetObjectArrayElement(env, qsdo->javaGraphicsStatesObjects, sun_java2d_OSXSurfaceData_kFractionsArrayIndex)); jobject fractionsArray = ((*env)->GetObjectArrayElement(env, qsdo->javaGraphicsStatesObjects, sun_java2d_OSXSurfaceData_kFractionsArrayIndex));
if (fractionsArray != NULL) if (fractionsArray != NULL)
{ {
jint length = (*env)->GetArrayLength(env, fractionsArray); jint length = (*env)->GetArrayLength(env, fractionsArray);
//fprintf(stderr, "fractions length %d\n", length);
qsdo->gradientInfo->fractionsLength = length; qsdo->gradientInfo->fractionsLength = length;
jfloat* jfractionsData = (jfloat*)(*env)->GetPrimitiveArrayCritical(env, fractionsArray, NULL); jfloat* jfractionsData = (jfloat*)(*env)->GetPrimitiveArrayCritical(env, fractionsArray, NULL);
if (jfractionsData != NULL) if (jfractionsData != NULL)
{ {
int i;
qsdo->gradientInfo->fractionsdata = (CGFloat *)malloc(sizeof(CGFloat) *length); qsdo->gradientInfo->fractionsdata = (CGFloat *)malloc(sizeof(CGFloat) *length);
jint i; memset(qsdo->gradientInfo->fractionsdata, 0, sizeof(CGFloat)*length);
for (i=0; i<length; i++) for (i=0; i<length; i++)
{ {
qsdo->gradientInfo->fractionsdata[i] = jfractionsData[i]; qsdo->gradientInfo->fractionsdata[i] = jfractionsData[i];
//fprintf(stderr, "jfrationsData[%d] %f, qsdo->gradientInfo->fractionsdata[%d] = %f\n", i, jfractionsData[i], i, qsdo->gradientInfo->fractionsdata[i]);
} }
(*env)->ReleasePrimitiveArrayCritical(env, fractionsArray, jfractionsData, 0); (*env)->ReleasePrimitiveArrayCritical(env, fractionsArray, jfractionsData, 0);
} }
......
/* /*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -310,8 +310,8 @@ public interface Era extends TemporalAccessor, TemporalAdjuster { ...@@ -310,8 +310,8 @@ public interface Era extends TemporalAccessor, TemporalAdjuster {
* The parameters control the style of the returned text and the locale. * The parameters control the style of the returned text and the locale.
* <p> * <p>
* If no textual mapping is found then the {@link #getValue() numeric value} is returned. * If no textual mapping is found then the {@link #getValue() numeric value} is returned.
* <p> *
* This default implementation is suitable for all implementations. * @apiNote This default implementation is suitable for most implementations.
* *
* @param style the style of the text required, not null * @param style the style of the text required, not null
* @param locale the locale to use, not null * @param locale the locale to use, not null
......
/* /*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -73,11 +73,13 @@ import java.io.ObjectStreamException; ...@@ -73,11 +73,13 @@ import java.io.ObjectStreamException;
import java.io.Serializable; import java.io.Serializable;
import java.time.DateTimeException; import java.time.DateTimeException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.TextStyle;
import java.time.temporal.ChronoField; import java.time.temporal.ChronoField;
import java.time.temporal.TemporalField; import java.time.temporal.TemporalField;
import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange; import java.time.temporal.ValueRange;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import sun.util.calendar.CalendarDate; import sun.util.calendar.CalendarDate;
...@@ -125,8 +127,8 @@ public final class JapaneseEra ...@@ -125,8 +127,8 @@ public final class JapaneseEra
*/ */
public static final JapaneseEra HEISEI = new JapaneseEra(2, LocalDate.of(1989, 1, 8)); public static final JapaneseEra HEISEI = new JapaneseEra(2, LocalDate.of(1989, 1, 8));
// the number of defined JapaneseEra constants. // The number of predefined JapaneseEra constants.
// There could be an extra era defined in its configuration. // There may be a supplemental era defined by the property.
private static final int N_ERA_CONSTANTS = HEISEI.getValue() + ERA_OFFSET; private static final int N_ERA_CONSTANTS = HEISEI.getValue() + ERA_OFFSET;
/** /**
...@@ -236,6 +238,23 @@ public final class JapaneseEra ...@@ -236,6 +238,23 @@ public final class JapaneseEra
return Arrays.copyOf(KNOWN_ERAS, KNOWN_ERAS.length); return Arrays.copyOf(KNOWN_ERAS, KNOWN_ERAS.length);
} }
/**
* {@inheritDoc}
*
* @param style {@inheritDoc}
* @param locale {@inheritDoc}
*/
@Override
public String getDisplayName(TextStyle style, Locale locale) {
// If this JapaneseEra is a supplemental one, obtain the name from
// the era definition.
if (getValue() > N_ERA_CONSTANTS - ERA_OFFSET) {
Objects.requireNonNull(locale, "locale");
return style.asNormal() == TextStyle.NARROW ? getAbbreviation() : getName();
}
return Era.super.getDisplayName(style, locale);
}
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
/** /**
* Obtains an instance of {@code JapaneseEra} from a date. * Obtains an instance of {@code JapaneseEra} from a date.
...@@ -337,11 +356,7 @@ public final class JapaneseEra ...@@ -337,11 +356,7 @@ public final class JapaneseEra
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
String getAbbreviation() { String getAbbreviation() {
int index = ordinal(getValue()); return ERA_CONFIG[ordinal(getValue())].getAbbreviation();
if (index == 0) {
return "";
}
return ERA_CONFIG[index].getAbbreviation();
} }
String getName() { String getName() {
......
...@@ -2021,8 +2021,11 @@ class Parser implements DTDConstants { ...@@ -2021,8 +2021,11 @@ class Parser implements DTDConstants {
} }
/* To account for extra read()'s that happened */ /* To account for extra read()'s that happened */
for (int j = 0; j < i; j++) { if (i > 0) {
addString(charsToAdd[j]); for (int j = 0; j < i; j++) {
addString(charsToAdd[j]);
}
continue;
} }
switch (ch) { switch (ch) {
case -1: case -1:
......
...@@ -843,14 +843,6 @@ public abstract class RasterPrinterJob extends PrinterJob { ...@@ -843,14 +843,6 @@ public abstract class RasterPrinterJob extends PrinterJob {
} }
} }
protected PageFormat getPageFormatFromAttributes() {
if (attributes == null || attributes.isEmpty()) {
return null;
}
return attributeToPageFormat(getPrintService(), this.attributes);
}
/** /**
* Presents the user a dialog for changing properties of the * Presents the user a dialog for changing properties of the
* print job interactively. * print job interactively.
......
/* /*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -31,6 +31,8 @@ import java.util.Map; ...@@ -31,6 +31,8 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.spi.CalendarNameProvider; import java.util.spi.CalendarNameProvider;
import sun.util.calendar.CalendarSystem;
import sun.util.calendar.Era;
/** /**
* Concrete implementation of the {@link java.util.spi.CalendarDataProvider * Concrete implementation of the {@link java.util.spi.CalendarDataProvider
...@@ -67,7 +69,21 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av ...@@ -67,7 +69,21 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av
if (field == DAY_OF_WEEK || field == YEAR) { if (field == DAY_OF_WEEK || field == YEAR) {
--value; --value;
} }
if (value < 0 || value >= strings.length) { if (value < 0 || value > strings.length) {
return null;
} else if (value == strings.length) {
if (field == ERA && "japanese".equals(calendarType)) {
// get the supplemental era, if any, specified through
// the property "jdk.calendar.japanese.supplemental.era"
// which is always the last element.
Era[] jeras = CalendarSystem.forName("japanese").getEras();
if (jeras.length == value) {
Era supEra = jeras[value - 1]; // 0-based index
return style == LONG ?
supEra.getName() :
supEra.getAbbreviation();
}
}
return null; return null;
} }
name = strings[value]; name = strings[value];
......
/* /*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
* questions. * questions.
*/ */
#include <dlfcn.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <objc/objc-runtime.h>
#include <Security/AuthSession.h> #include <Security/AuthSession.h>
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
...@@ -35,16 +35,6 @@ ...@@ -35,16 +35,6 @@
#include "java_props_macosx.h" #include "java_props_macosx.h"
// need dlopen/dlsym trick to avoid pulling in JavaRuntimeSupport before libjava.dylib is loaded
static void *getJRSFramework() {
static void *jrsFwk = NULL;
if (jrsFwk == NULL) {
jrsFwk = dlopen("/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/JavaRuntimeSupport", RTLD_LAZY | RTLD_LOCAL);
}
return jrsFwk;
}
char *getPosixLocale(int cat) { char *getPosixLocale(int cat) {
char *lc = setlocale(cat, NULL); char *lc = setlocale(cat, NULL);
if ((lc == NULL) || (strcmp(lc, "C") == 0)) { if ((lc == NULL) || (strcmp(lc, "C") == 0)) {
...@@ -56,48 +46,106 @@ char *getPosixLocale(int cat) { ...@@ -56,48 +46,106 @@ char *getPosixLocale(int cat) {
#define LOCALEIDLENGTH 128 #define LOCALEIDLENGTH 128
char *getMacOSXLocale(int cat) { char *getMacOSXLocale(int cat) {
const char* retVal = NULL;
switch (cat) { switch (cat) {
case LC_MESSAGES: case LC_MESSAGES:
{ {
void *jrsFwk = getJRSFramework(); // get preferred language code
if (jrsFwk == NULL) return NULL; CFArrayRef languages = CFLocaleCopyPreferredLanguages();
if (languages == NULL) {
return NULL;
}
if (CFArrayGetCount(languages) <= 0) {
CFRelease(languages);
return NULL;
}
char *(*JRSCopyPrimaryLanguage)() = dlsym(jrsFwk, "JRSCopyPrimaryLanguage"); CFStringRef primaryLanguage = (CFStringRef)CFArrayGetValueAtIndex(languages, 0);
char *primaryLanguage = JRSCopyPrimaryLanguage ? JRSCopyPrimaryLanguage() : NULL; if (primaryLanguage == NULL) {
if (primaryLanguage == NULL) return NULL; CFRelease(languages);
return NULL;
}
char languageString[LOCALEIDLENGTH];
if (CFStringGetCString(primaryLanguage, languageString,
LOCALEIDLENGTH, CFStringGetSystemEncoding()) == false) {
CFRelease(languages);
return NULL;
}
CFRelease(languages);
char *(*JRSCopyCanonicalLanguageForPrimaryLanguage)(char *) = dlsym(jrsFwk, "JRSCopyCanonicalLanguageForPrimaryLanguage"); retVal = languageString;
char *canonicalLanguage = JRSCopyCanonicalLanguageForPrimaryLanguage ? JRSCopyCanonicalLanguageForPrimaryLanguage(primaryLanguage) : NULL;
free (primaryLanguage);
return canonicalLanguage; // Special case for Portuguese in Brazil:
// The language code needs the "_BR" region code (to distinguish it
// from Portuguese in Portugal), but this is missing when using the
// "Portuguese (Brazil)" language.
// If language is "pt" and the current locale is pt_BR, return pt_BR.
char localeString[LOCALEIDLENGTH];
if (strcmp(retVal, "pt") == 0 &&
CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding()) &&
strcmp(localeString, "pt_BR") == 0) {
retVal = localeString;
}
} }
break; break;
default: default:
{ {
char localeString[LOCALEIDLENGTH]; char localeString[LOCALEIDLENGTH];
if (CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()), if (!CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding())) { localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding())) {
return strdup(localeString); return NULL;
} }
retVal = localeString;
} }
break; break;
} }
if (retVal != NULL) {
// Language IDs use the language designators and (optional) region
// and script designators of BCP 47. So possible formats are:
//
// "en" (language designator only)
// "haw" (3-letter lanuage designator)
// "en-GB" (language with alpha-2 region designator)
// "es-419" (language with 3-digit UN M.49 area code)
// "zh-Hans" (language with ISO 15924 script designator)
// "zh-Hans-US" (language with ISO 15924 script designator and region)
// "zh-Hans-419" (language with ISO 15924 script designator and UN M.49)
//
// In the case of region designators (alpha-2 and/or UN M.49), we convert
// to our locale string format by changing '-' to '_'. That is, if
// the '-' is followed by fewer than 4 chars.
char* scriptOrRegion = strchr(retVal, '-');
if (scriptOrRegion != NULL) {
int length = strlen(scriptOrRegion);
if (length > 5) {
// Region and script both exist. Honor the script for now
scriptOrRegion[5] = '\0';
} else if (length < 5) {
*scriptOrRegion = '_';
assert((length == 3 &&
// '-' followed by a 2 character region designator
isalpha(scriptOrRegion[1]) &&
isalpha(scriptOrRegion[2])) ||
(length == 4 &&
// '-' followed by a 3-digit UN M.49 area code
isdigit(scriptOrRegion[1]) &&
isdigit(scriptOrRegion[2]) &&
isdigit(scriptOrRegion[3])));
}
}
return strdup(retVal);
}
return NULL; return NULL;
} }
char *setupMacOSXLocale(int cat) { char *setupMacOSXLocale(int cat) {
char * ret = getMacOSXLocale(cat); char * ret = getMacOSXLocale(cat);
if (cat == LC_MESSAGES && ret != NULL) {
void *jrsFwk = getJRSFramework();
if (jrsFwk != NULL) {
void (*JRSSetDefaultLocalization)(char *) = dlsym(jrsFwk, "JRSSetDefaultLocalization");
if (JRSSetDefaultLocalization) JRSSetDefaultLocalization(ret);
}
}
if (ret == NULL) { if (ret == NULL) {
return getPosixLocale(cat); return getPosixLocale(cat);
} else { } else {
...@@ -124,26 +172,57 @@ int isInAquaSession() { ...@@ -124,26 +172,57 @@ int isInAquaSession() {
return 0; return 0;
} }
// 10.9 SDK does not include the NSOperatingSystemVersion struct.
// For now, create our own
typedef struct {
NSInteger majorVersion;
NSInteger minorVersion;
NSInteger patchVersion;
} OSVerStruct;
void setOSNameAndVersion(java_props_t *sprops) { void setOSNameAndVersion(java_props_t *sprops) {
/* Don't rely on JRSCopyOSName because there's no guarantee the value will // Hardcode os_name, and fill in os_version
* remain the same, or even if the JRS functions will continue to be part of
* Mac OS X. So hardcode os_name, and fill in os_version if we can.
*/
sprops->os_name = strdup("Mac OS X"); sprops->os_name = strdup("Mac OS X");
void *jrsFwk = getJRSFramework(); char* osVersionCStr = NULL;
if (jrsFwk != NULL) { // Mac OS 10.9 includes the [NSProcessInfo operatingSystemVersion] function,
char *(*copyOSVersion)() = dlsym(jrsFwk, "JRSCopyOSVersion"); // but it's not in the 10.9 SDK. So, call it via objc_msgSend_stret.
if (copyOSVersion != NULL) { if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) {
sprops->os_version = copyOSVersion(); OSVerStruct (*procInfoFn)(id rec, SEL sel) = (OSVerStruct(*)(id, SEL))objc_msgSend_stret;
return; OSVerStruct osVer = procInfoFn([NSProcessInfo processInfo],
@selector(operatingSystemVersion));
NSString *nsVerStr;
if (osVer.patchVersion == 0) { // Omit trailing ".0"
nsVerStr = [NSString stringWithFormat:@"%ld.%ld",
(long)osVer.majorVersion, (long)osVer.minorVersion];
} else {
nsVerStr = [NSString stringWithFormat:@"%ld.%ld.%ld",
(long)osVer.majorVersion, (long)osVer.minorVersion, (long)osVer.patchVersion];
} }
// Copy out the char*
osVersionCStr = strdup([nsVerStr UTF8String]);
}
// Fallback if running on pre-10.9 Mac OS
if (osVersionCStr == NULL) {
NSDictionary *version = [NSDictionary dictionaryWithContentsOfFile :
@"/System/Library/CoreServices/SystemVersion.plist"];
if (version != NULL) {
NSString *nsVerStr = [version objectForKey : @"ProductVersion"];
if (nsVerStr != NULL) {
osVersionCStr = strdup([nsVerStr UTF8String]);
}
}
}
if (osVersionCStr == NULL) {
osVersionCStr = strdup("Unknown");
} }
sprops->os_version = strdup("Unknown"); sprops->os_version = osVersionCStr;
} }
static Boolean getProxyInfoForProtocol(CFDictionaryRef inDict, CFStringRef inEnabledKey, CFStringRef inHostKey, CFStringRef inPortKey, CFStringRef *outProxyHost, int *ioProxyPort) { static Boolean getProxyInfoForProtocol(CFDictionaryRef inDict, CFStringRef inEnabledKey,
CFStringRef inHostKey, CFStringRef inPortKey,
CFStringRef *outProxyHost, int *ioProxyPort) {
/* See if the proxy is enabled. */ /* See if the proxy is enabled. */
CFNumberRef cf_enabled = CFDictionaryGetValue(inDict, inEnabledKey); CFNumberRef cf_enabled = CFDictionaryGetValue(inDict, inEnabledKey);
if (cf_enabled == NULL) { if (cf_enabled == NULL) {
......
...@@ -91,46 +91,6 @@ mapLookup(char* map[], const char* key, char** value) { ...@@ -91,46 +91,6 @@ mapLookup(char* map[], const char* key, char** value) {
return 0; return 0;
} }
/* This function sets an environment variable using envstring.
* The format of envstring is "name=value".
* If the name has already existed, it will append value to the name.
*/
static void
setPathEnvironment(char *envstring)
{
char name[20], *value, *current;
value = strchr(envstring, '='); /* locate name and value separator */
if (! value)
return; /* not a valid environment setting */
/* copy first part as environment name */
strncpy(name, envstring, value - envstring);
name[value-envstring] = '\0';
value++; /* set value point to value of the envstring */
current = getenv(name);
if (current) {
if (! strstr(current, value)) {
/* value is not found in current environment, append it */
char *temp = malloc(strlen(envstring) + strlen(current) + 2);
strcpy(temp, name);
strcat(temp, "=");
strcat(temp, current);
strcat(temp, ":");
strcat(temp, value);
putenv(temp);
}
/* else the value has already been set, do nothing */
}
else {
/* environment variable is not found */
putenv(envstring);
}
}
#ifndef P_tmpdir #ifndef P_tmpdir
#define P_tmpdir "/var/tmp" #define P_tmpdir "/var/tmp"
#endif #endif
...@@ -615,16 +575,6 @@ GetJavaProperties(JNIEnv *env) ...@@ -615,16 +575,6 @@ GetJavaProperties(JNIEnv *env)
sprops.path_separator = ":"; sprops.path_separator = ":";
sprops.line_separator = "\n"; sprops.line_separator = "\n";
#if !defined(_ALLBSD_SOURCE)
/* Append CDE message and resource search path to NLSPATH and
* XFILESEARCHPATH, in order to pick localized message for
* FileSelectionDialog window (Bug 4173641).
*/
setPathEnvironment("NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat");
setPathEnvironment("XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt");
#endif
#ifdef MACOSX #ifdef MACOSX
setProxyProperties(&sprops); setProxyProperties(&sprops);
#endif #endif
......
...@@ -134,6 +134,16 @@ ...@@ -134,6 +134,16 @@
"no_NY", "no_NO@nynorsk", "no_NY", "no_NO@nynorsk",
"sr_SP", "sr_YU", "sr_SP", "sr_YU",
"tchinese", "zh_TW", "tchinese", "zh_TW",
#endif
#ifdef MACOSX
"sr-Latn", "sr_CS", // Mappings as done by old Apple JRS code
"tk", "tk-Cyrl",
"tt-Latn", "tt-Cyrl",
"uz", "uz_UZ",
"uz-Arab", "uz_UZ",
"uz-Latn", "uz_UZ",
"zh-Hans", "zh_CN",
"zh-Hant", "zh_TW",
#endif #endif
"", "", "", "",
}; };
......
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8176490
* @summary Tests that there is no hang or deadlock when the visibility
* of parent and child windows is changed.
* @library ../../regtesthelpers
* @build Util
* @run main/timeout=20 WindowDeadlockTest
*/
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Robot;
import test.java.awt.regtesthelpers.Util;
public class WindowDeadlockTest {
public static void main(String[] args) throws Exception {
Robot robot = Util.createRobot();
Frame main = new Frame("Main");
main.setBounds(0, 0, 200, 100);
main.setVisible(true);
Dialog first = new Dialog(main, "First");
first.setBounds(250, 0, 200, 100);
first.setVisible(true);
Dialog second = new Dialog(first, "Second");
second.setBounds(0, 150, 200, 100);
second.setVisible(true);
Util.waitForIdle(robot);
robot.delay(2000);
Dialog third = new Dialog(first, "Third", false);
third.setBounds(250, 150, 200, 100);
third.setVisible(true);
first.setVisible(false); // the hang takes place here
Util.waitForIdle(robot);
robot.delay(2000);
third.dispose();
second.dispose();
first.dispose();
main.dispose();
}
}
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 8167102
@summary PrintRequestAttributeSet breaks page size set using PageFormat
@run main/manual WrongPaperPrintingTest
*/
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.Size2DSyntax;
import javax.print.attribute.standard.Chromaticity;
import javax.print.attribute.standard.MediaSize;
import javax.print.attribute.standard.MediaSizeName;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.WindowConstants;
public class WrongPaperPrintingTest implements Printable {
private static final CountDownLatch testEndedSignal = new CountDownLatch(1);
private static final int testTimeout = 300000;
private static volatile String testFailureMsg;
private static volatile boolean testPassed;
private static volatile boolean testFinished;
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> createAndShowTestDialog());
try {
if (!testEndedSignal.await(testTimeout, TimeUnit.MILLISECONDS)) {
throw new RuntimeException(String.format(
"Test timeout '%d ms' elapsed.", testTimeout));
}
if (!testPassed) {
String failureMsg = testFailureMsg;
if ((failureMsg != null) && (!failureMsg.trim().isEmpty())) {
throw new RuntimeException(failureMsg);
} else {
throw new RuntimeException("Test failed.");
}
}
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
} finally {
testFinished = true;
}
}
private static void doTest() {
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(Chromaticity.MONOCHROME);
MediaSize isoA5Size = MediaSize.getMediaSizeForName(MediaSizeName.ISO_A5);
float[] size = isoA5Size.getSize(Size2DSyntax.INCH);
Paper paper = new Paper();
paper.setSize(size[0] * 72.0, size[1] * 72.0);
paper.setImageableArea(0.0, 0.0, size[0] * 72.0, size[1] * 72.0);
PageFormat pf = new PageFormat();
pf.setPaper(paper);
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(new WrongPaperPrintingTest(), job.validatePage(pf));
if (job.printDialog()) {
try {
job.print(aset);
} catch (PrinterException pe) {
throw new RuntimeException(pe);
}
}
}
private static void pass() {
testPassed = true;
testEndedSignal.countDown();
}
private static void fail(String failureMsg) {
testFailureMsg = failureMsg;
testPassed = false;
testEndedSignal.countDown();
}
private static String convertMillisToTimeStr(int millis) {
if (millis < 0) {
return "00:00:00";
}
int hours = millis / 3600000;
int minutes = (millis - hours * 3600000) / 60000;
int seconds = (millis - hours * 3600000 - minutes * 60000) / 1000;
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
}
private static void createAndShowTestDialog() {
String description =
" To run this test it is required to have a virtual PDF\r\n" +
" printer or any other printer supporting A5 paper size.\r\n" +
"\r\n" +
" 1. Verify that NOT A5 paper size is set as default for the\r\n" +
" printer to be used.\r\n" +
" 2. Click on \"Start Test\" button.\r\n" +
" 3. In the shown print dialog select the printer and click\r\n" +
" on \"Print\" button.\r\n" +
" 4. Verify that a page with a drawn rectangle is printed on\r\n" +
" a paper of A5 size which is (5.8 x 8.3 in) or\r\n" +
" (148 x 210 mm).\r\n" +
"\r\n" +
" If the printed page size is correct, click on \"PASS\"\r\n" +
" button, otherwise click on \"FAIL\" button.";
final JDialog dialog = new JDialog();
dialog.setTitle("WrongPaperPrintingTest");
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
dialog.dispose();
fail("Main dialog was closed.");
}
});
final JLabel testTimeoutLabel = new JLabel(String.format(
"Test timeout: %s", convertMillisToTimeStr(testTimeout)));
final long startTime = System.currentTimeMillis();
final Timer timer = new Timer(0, null);
timer.setDelay(1000);
timer.addActionListener((e) -> {
int leftTime = testTimeout - (int)(System.currentTimeMillis() - startTime);
if ((leftTime < 0) || testFinished) {
timer.stop();
dialog.dispose();
}
testTimeoutLabel.setText(String.format(
"Test timeout: %s", convertMillisToTimeStr(leftTime)));
});
timer.start();
JTextArea textArea = new JTextArea(description);
textArea.setEditable(false);
final JButton testButton = new JButton("Start Test");
final JButton passButton = new JButton("PASS");
final JButton failButton = new JButton("FAIL");
testButton.addActionListener((e) -> {
testButton.setEnabled(false);
new Thread(() -> {
try {
doTest();
SwingUtilities.invokeLater(() -> {
passButton.setEnabled(true);
failButton.setEnabled(true);
});
} catch (Throwable t) {
t.printStackTrace();
dialog.dispose();
fail("Exception occurred in a thread executing the test.");
}
}).start();
});
passButton.setEnabled(false);
passButton.addActionListener((e) -> {
dialog.dispose();
pass();
});
failButton.setEnabled(false);
failButton.addActionListener((e) -> {
dialog.dispose();
fail("Size of a printed page is wrong.");
});
JPanel mainPanel = new JPanel(new BorderLayout());
JPanel labelPanel = new JPanel(new FlowLayout());
labelPanel.add(testTimeoutLabel);
mainPanel.add(labelPanel, BorderLayout.NORTH);
mainPanel.add(textArea, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel(new FlowLayout());
buttonPanel.add(testButton);
buttonPanel.add(passButton);
buttonPanel.add(failButton);
mainPanel.add(buttonPanel, BorderLayout.SOUTH);
dialog.add(mainPanel);
dialog.pack();
dialog.setVisible(true);
}
@Override
public int print(Graphics g, PageFormat pf, int pageIndex)
throws PrinterException {
if (pageIndex == 0) {
g.setColor(Color.RED);
g.drawRect((int)pf.getImageableX(), (int)pf.getImageableY(),
(int)pf.getImageableWidth(), (int)pf.getImageableHeight());
return Printable.PAGE_EXISTS;
} else {
return Printable.NO_SUCH_PAGE;
}
}
}
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8061258
* @summary PrinterJob's native Print Dialog does not reflect
* specified Copies or Page Ranges
* @run main/manual DlgAttrsBug
*/
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.standard.Copies;
import javax.print.attribute.standard.PageRanges;
import javax.print.attribute.standard.DialogTypeSelection;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
public class DlgAttrsBug implements Printable {
private static Thread mainThread;
private static boolean testPassed;
private static boolean testGeneratedInterrupt;
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(() -> {
doTest(DlgAttrsBug::printTest);
});
mainThread = Thread.currentThread();
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
if (!testPassed && testGeneratedInterrupt) {
throw new RuntimeException("Print Dialog does not " +
"reflect Copies or Page Ranges");
}
}
if (!testGeneratedInterrupt) {
throw new RuntimeException("user has not executed the test");
}
}
private static void printTest() {
PrinterJob job = PrinterJob.getPrinterJob();
if (job.getPrintService() == null) {
System.out.println("No printers. Test cannot continue");
return;
}
job.setPrintable(new DlgAttrsBug());
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(new Copies(5));
aset.add(new PageRanges(3,4));
aset.add(DialogTypeSelection.NATIVE);
job.printDialog(aset);
}
public static synchronized void pass() {
testPassed = true;
testGeneratedInterrupt = true;
mainThread.interrupt();
}
public static synchronized void fail() {
testPassed = false;
testGeneratedInterrupt = true;
mainThread.interrupt();
}
private static void doTest(Runnable action) {
String description
= " Visual inspection of print dialog is required.\n"
+ " A print dialog will be shown.\n "
+ " Please verify Copies 5 is selected.\n"
+ " Also verify, Page Range is selected with "
+ " from page 3 and to Page 4.\n"
+ " If ok, press PASS else press FAIL";
final JDialog dialog = new JDialog();
dialog.setTitle("printSelectionTest");
JTextArea textArea = new JTextArea(description);
textArea.setEditable(false);
final JButton testButton = new JButton("Start Test");
final JButton passButton = new JButton("PASS");
passButton.setEnabled(false);
passButton.addActionListener((e) -> {
dialog.dispose();
pass();
});
final JButton failButton = new JButton("FAIL");
failButton.setEnabled(false);
failButton.addActionListener((e) -> {
dialog.dispose();
fail();
});
testButton.addActionListener((e) -> {
testButton.setEnabled(false);
action.run();
passButton.setEnabled(true);
failButton.setEnabled(true);
});
JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.add(textArea, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel(new FlowLayout());
buttonPanel.add(testButton);
buttonPanel.add(passButton);
buttonPanel.add(failButton);
mainPanel.add(buttonPanel, BorderLayout.SOUTH);
dialog.add(mainPanel);
dialog.pack();
dialog.setVisible(true);
}
public int print(Graphics g, PageFormat pf, int pi)
throws PrinterException {
System.out.println("pi = " + pi);
if (pi >= 5) {
return NO_SUCH_PAGE;
}
g.drawString("Page : " + (pi+1), 200, 200);
return PAGE_EXISTS;
}
}
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8054214 8173423 8177776
* @summary Create an equivalent test case for JDK9's SupplementalJapaneseEraTest
* @library /lib/testlibrary
* @run testng SupplementalJapaneseEraTest
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.text.SimpleDateFormat;
import java.time.chrono.JapaneseChronology;
import java.time.chrono.JapaneseDate;
import java.time.chrono.JapaneseEra;
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.TextStyle;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import static java.util.GregorianCalendar.*;
import java.util.Locale;
import java.util.Properties;
import java.util.TimeZone;
import jdk.testlibrary.ProcessTools;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
public class SupplementalJapaneseEraTest {
private static final Locale WAREKI_LOCALE = Locale.forLanguageTag("ja-JP-u-ca-japanese");
private static final String NEW_ERA_NAME = "NewEra";
private static final String NEW_ERA_ABBR = "N.E.";
private static final int NEW_ERA_YEAR = 200;
private static final int NEW_ERA_MONTH = FEBRUARY;
private static final int NEW_ERA_DAY = 11;
private static int errors = 0;
@BeforeTest
public void prepareTestJDK() throws IOException {
Path src = Paths.get(System.getProperty("test.jdk")).toAbsolutePath();
Path dst = Paths.get("testjava").toAbsolutePath();
Files.walkFileTree(src, new CopyFileVisitor(src, dst));
}
@Test
public void invokeTestJDK() throws Throwable {
assertTrue(ProcessTools.executeCommand(
Paths.get("testjava", "bin", "java").toAbsolutePath().toString(),
"-cp",
System.getProperty("test.classes"),
"SupplementalJapaneseEraTest")
.getExitValue() == 0);
}
public static void main(String[] args) {
testProperty();
if (errors != 0) {
throw new RuntimeException("test failed");
}
}
// copied from JDK9's test
private static void testProperty() {
Calendar jcal = new Calendar.Builder()
.setCalendarType("japanese")
.setFields(YEAR, 1, DAY_OF_YEAR, 1)
.build();
Date firstDayOfEra = jcal.getTime();
jcal.set(ERA, jcal.get(ERA) - 1); // previous era
jcal.set(YEAR, 1);
jcal.set(DAY_OF_YEAR, 1);
Calendar cal = new GregorianCalendar();
cal.setTimeInMillis(jcal.getTimeInMillis());
cal.add(YEAR, 199);
int year = cal.get(YEAR);
SimpleDateFormat sdf;
String expected, got;
// test long era name
sdf = new SimpleDateFormat("GGGG y-MM-dd", WAREKI_LOCALE);
got = sdf.format(firstDayOfEra);
expected = NEW_ERA_NAME + " 1-02-11";
if (!expected.equals(got)) {
System.err.printf("GGGG y-MM-dd: got=\"%s\", expected=\"%s\"%n", got, expected);
errors++;
}
// test era abbreviation
sdf = new SimpleDateFormat("G y-MM-dd", WAREKI_LOCALE);
got = sdf.format(firstDayOfEra);
expected = NEW_ERA_ABBR+" 1-02-11";
if (!expected.equals(got)) {
System.err.printf("G y-MM-dd: got=\"%s\", expected=\"%s\"%n", got, expected);
errors++;
}
// confirm the gregorian year
sdf = new SimpleDateFormat("y", Locale.US);
int y = Integer.parseInt(sdf.format(firstDayOfEra));
if (y != year) {
System.err.printf("Gregorian year: got=%d, expected=%d%n", y, year);
errors++;
}
// test java.time.chrono.JapaneseEra
JapaneseDate jdate = JapaneseDate.of(year, 2, 11);
got = jdate.toString();
expected = "Japanese " + NEW_ERA_NAME + " 1-02-11";
if (!expected.equals(got)) {
System.err.printf("JapaneseDate: got=\"%s\", expected=\"%s\"%n", got, expected);
errors++;
}
JapaneseEra jera = jdate.getEra();
got = jera.getDisplayName(TextStyle.FULL, Locale.US);
if (!NEW_ERA_NAME.equals(got)) {
System.err.printf("JapaneseEra (FULL): got=\"%s\", expected=\"%s\"%n", got, NEW_ERA_NAME);
errors++;
}
got = jera.getDisplayName(TextStyle.SHORT, Locale.US);
if (!NEW_ERA_NAME.equals(got)) {
System.err.printf("JapaneseEra (SHORT): got=\"%s\", expected=\"%s\"%n", got, NEW_ERA_NAME);
errors++;
}
got = jera.getDisplayName(TextStyle.NARROW, Locale.US);
if (!NEW_ERA_ABBR.equals(got)) {
System.err.printf("JapaneseEra (NARROW): got=\"%s\", expected=\"%s\"%n", got, NEW_ERA_ABBR);
errors++;
}
got = jera.getDisplayName(TextStyle.NARROW_STANDALONE, Locale.US);
if (!NEW_ERA_ABBR.equals(got)) {
System.err.printf("JapaneseEra (NARROW_STANDALONE): got=\"%s\", expected=\"%s\"%n", got, NEW_ERA_ABBR);
errors++;
}
// test long/abbreviated names with java.time.format
got = new DateTimeFormatterBuilder()
.appendPattern("GGGG")
.appendLiteral(" ")
.appendPattern("G")
.toFormatter(Locale.US)
.withChronology(JapaneseChronology.INSTANCE)
.format(jdate);
expected = NEW_ERA_NAME + " " + NEW_ERA_ABBR;
if (!expected.equals(got)) {
System.err.printf("java.time formatter long/abbr names: got=\"%s\", expected=\"%s\"%n", got, expected);
errors++;
}
}
private static class CopyFileVisitor extends SimpleFileVisitor<Path> {
private final Path copyFrom;
private final Path copyTo;
private final Path calProps = Paths.get("calendars.properties");
private final String JA_CAL_KEY = "calendar.japanese.eras";
public CopyFileVisitor(Path copyFrom, Path copyTo) {
this.copyFrom = copyFrom;
this.copyTo = copyTo;
}
@Override
public FileVisitResult preVisitDirectory(Path file,
BasicFileAttributes attrs) throws IOException {
Path relativePath = copyFrom.relativize(file);
Path destination = copyTo.resolve(relativePath);
if (!destination.toFile().exists()) {
Files.createDirectories(destination);
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs) throws IOException {
if (!file.toFile().isFile()) {
return FileVisitResult.CONTINUE;
}
Path relativePath = copyFrom.relativize(file);
Path destination = copyTo.resolve(relativePath);
if (relativePath.getFileName().equals(calProps)) {
modifyCalendarProperties(file, destination);
} else {
Files.copy(file, destination, StandardCopyOption.COPY_ATTRIBUTES);
}
return FileVisitResult.CONTINUE;
}
private void modifyCalendarProperties(Path src, Path dst) throws IOException {
Properties p = new Properties();
try (BufferedReader br = Files.newBufferedReader(src)) {
p.load(br);
}
String eras = p.getProperty(JA_CAL_KEY);
if (eras != null) {
p.setProperty(JA_CAL_KEY,
eras +
"; name=" + SupplementalJapaneseEraTest.NEW_ERA_NAME +
",abbr=" + SupplementalJapaneseEraTest.NEW_ERA_ABBR +
",since=" + since());
}
try (BufferedWriter bw = Files.newBufferedWriter(dst)) {
p.store(bw, "test calendars.properties for supplemental Japanese era");
}
}
private long since() {
return new Calendar.Builder()
.setCalendarType("japanese")
.setTimeZone(TimeZone.getTimeZone("GMT"))
.setDate(SupplementalJapaneseEraTest.NEW_ERA_YEAR,
SupplementalJapaneseEraTest.NEW_ERA_MONTH,
SupplementalJapaneseEraTest.NEW_ERA_DAY)
.build()
.getTimeInMillis();
}
}
}
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import javax.swing.*;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.html.HTML;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
/* @test
@bug 8177450
@summary javax.swing.text.html.parser.Parser parseScript ignores a character after commend end
@author Mikhail Cherkasov
@run main HtmlCommentTagParseTest
*/
public class HtmlCommentTagParseTest {
private static volatile boolean failed = false;
public static void main(String[] args) throws IOException, InvocationTargetException, InterruptedException {
SwingUtilities.invokeAndWait(() -> {
MyParser cb = new MyParser();
HTMLEditorKit htmlKit = new HTMLEditorKit();
HTMLDocument htmlDoc = (HTMLDocument)
htmlKit.createDefaultDocument();
FileReader reader = null;
try {
reader = new FileReader(getDirURL() + "test.html");
htmlDoc.getParser().parse(reader, cb, true);
if(failed) {
throw new RuntimeException("Test failed");
}
} catch (IOException e) {
throw new RuntimeException(e);
}
});
}
private static String getDirURL() {
return new File(System.getProperty("test.src", ".")).getAbsolutePath() +
File.separator;
}
private static class MyParser extends HTMLEditorKit.ParserCallback {
@Override
public void handleError(String errorMsg, int pos) {
failed = errorMsg.contains("eof.script");
}
}
}
\ No newline at end of file
<html>
<body>
<script><!-- --></script>
</body>
</html>
\ No newline at end of file
...@@ -21,4 +21,4 @@ ...@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any # or visit www.oracle.com if you need additional information or have any
# questions. # questions.
# #
tzdata2017a tzdata2017b
...@@ -443,18 +443,25 @@ Link Africa/Nairobi Indian/Mayotte ...@@ -443,18 +443,25 @@ Link Africa/Nairobi Indian/Mayotte
# See Africa/Johannesburg. # See Africa/Johannesburg.
# Liberia # Liberia
# From Paul Eggert (2006-03-22): #
# In 1972 Liberia was the last country to switch # From Paul Eggert (2017-03-02):
# from a UTC offset that was not a multiple of 15 or 20 minutes. #
# Howse reports that it was in honor of their president's birthday. # The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30.
# Shank & Pottenger report the date as May 1, whereas Howse reports Jan; #
# go with Shanks & Pottenger. # In 1972 Liberia was the last country to switch from a UTC offset
# For Liberia before 1972, Shanks & Pottenger report -0:44, whereas Howse and # that was not a multiple of 15 or 20 minutes. The 1972 change was on
# Whitman each report -0:44:30; go with the more precise figure. # 1972-01-07, according to an entry dated 1972-01-04 on p 330 of:
# Presidential Papers: First year of the administration of
# President William R. Tolbert, Jr., July 23, 1971-July 31, 1972.
# Monrovia: Executive Mansion.
#
# Use the abbreviation "MMT" before 1972, as the more-accurate numeric
# abbreviation "-004430" would be one byte over the POSIX limit.
#
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Monrovia -0:43:08 - LMT 1882 Zone Africa/Monrovia -0:43:08 - LMT 1882
-0:43:08 - MMT 1919 Mar # Monrovia Mean Time -0:43:08 - MMT 1919 Mar # Monrovia Mean Time
-0:44:30 - -004430 1972 May -0:44:30 - MMT 1972 Jan 7 # approximately MMT
0:00 - GMT 0:00 - GMT
############################################################################### ###############################################################################
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
# All text uses UTF-8 encoding. The columns of the table are as follows: # All text uses UTF-8 encoding. The columns of the table are as follows:
# #
# 1. ISO 3166-1 alpha-2 country code, current as of # 1. ISO 3166-1 alpha-2 country code, current as of
# ISO 3166-1 Newsletter VI-16 (2013-07-11). See: Updates on ISO 3166 # ISO 3166-1 N905 (2016-11-15). See: Updates on ISO 3166-1
# http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm # http://isotc.iso.org/livelink/livelink/Open/16944257
# 2. The usual English name for the coded region, # 2. The usual English name for the coded region,
# chosen so that alphabetic sorting of subsets produces helpful lists. # chosen so that alphabetic sorting of subsets produces helpful lists.
# This is not the same as the English name in the ISO 3166 tables. # This is not the same as the English name in the ISO 3166 tables.
......
...@@ -3162,6 +3162,12 @@ Zone America/Guatemala -6:02:04 - LMT 1918 Oct 5 ...@@ -3162,6 +3162,12 @@ Zone America/Guatemala -6:02:04 - LMT 1918 Oct 5
# http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/ # http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/
# http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/ # http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/
# From Steffen Thorsen (2017-03-12):
# We have received 4 mails from different people telling that Haiti
# has started DST again today, and this source seems to confirm that,
# I have not been able to find a more authoritative source:
# https://www.haitilibre.com/en/news-20319-haiti-notices-time-change-in-haiti.html
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Haiti 1983 only - May 8 0:00 1:00 D Rule Haiti 1983 only - May 8 0:00 1:00 D
Rule Haiti 1984 1987 - Apr lastSun 0:00 1:00 D Rule Haiti 1984 1987 - Apr lastSun 0:00 1:00 D
...@@ -3174,6 +3180,8 @@ Rule Haiti 2005 2006 - Apr Sun>=1 0:00 1:00 D ...@@ -3174,6 +3180,8 @@ Rule Haiti 2005 2006 - Apr Sun>=1 0:00 1:00 D
Rule Haiti 2005 2006 - Oct lastSun 0:00 0 S Rule Haiti 2005 2006 - Oct lastSun 0:00 0 S
Rule Haiti 2012 2015 - Mar Sun>=8 2:00 1:00 D Rule Haiti 2012 2015 - Mar Sun>=8 2:00 1:00 D
Rule Haiti 2012 2015 - Nov Sun>=1 2:00 0 S Rule Haiti 2012 2015 - Nov Sun>=1 2:00 0 S
Rule Haiti 2017 max - Mar Sun>=8 2:00 1:00 D
Rule Haiti 2017 max - Nov Sun>=1 2:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Port-au-Prince -4:49:20 - LMT 1890 Zone America/Port-au-Prince -4:49:20 - LMT 1890
-4:49 - PPMT 1917 Jan 24 12:00 # P-a-P MT -4:49 - PPMT 1917 Jan 24 12:00 # P-a-P MT
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册