提交 0e4f7706 编写于 作者: L lana

Merge

......@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
tzdata2014a
tzdata2014b
......@@ -891,7 +891,10 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
# Another source (specifying the time for start and end in the decree):
# http://www.lemag.ma/Heure-d-ete-au-Maroc-jusqu-au-27-octobre_a75620.html
# From Paul Eggert (2013-10-03):
# From Sebastien Willemijns (2014-03-18):
# http://www.afriquinfos.com/articles/2014/3/18/maroc-heure-dete-avancez-tous-horloges-247891.asp
# From Paul Eggert (2014-03-19):
# To estimate what the Moroccan government will do in future years,
# transition dates for 2014 through 2038 were determined by running
# the following program under GNU Emacs 24.3:
......
......@@ -253,24 +253,41 @@ Zone Antarctica/Syowa 0 - zzz 1957 Jan 29
# year-round base
# Scott Base, Ross Island, since 1957-01.
# See Pacific/Auckland.
#
# These rules for New Zealand are stolen from the 'australasia' file.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule NZAQ 1974 only - Nov 3 2:00s 1:00 D
Rule NZAQ 1975 1988 - Oct lastSun 2:00s 1:00 D
Rule NZAQ 1989 only - Oct 8 2:00s 1:00 D
Rule NZAQ 1990 2006 - Oct Sun>=1 2:00s 1:00 D
Rule NZAQ 1975 only - Feb 23 2:00s 0 S
Rule NZAQ 1976 1989 - Mar Sun>=1 2:00s 0 S
Rule NZAQ 1990 2007 - Mar Sun>=15 2:00s 0 S
Rule NZAQ 2007 max - Sep lastSun 2:00s 1:00 D
Rule NZAQ 2008 max - Apr Sun>=1 2:00s 0 S
# Norway - territories
# Bouvet (never inhabited)
#
# claims
# Peter I Island (never inhabited)
#
# year-round base
# Troll, Queen Maud Land, -720041+0023206, since 2005-02-12
#
# From Paul-Inge Flakstad (2014-03-10):
# I recently had a long dialog about this with the developer of timegenie.com.
# In the absence of specific dates, he decided to choose some likely ones:
# GMT +1 - From March 1 to the last Sunday in March
# GMT +2 - From the last Sunday in March until the last Sunday in October
# GMT +1 - From the last Sunday in October until November 7
# GMT +0 - From November 7 until March 1
# The dates for switching to and from UTC+0 will probably not be absolutely
# correct, but they should be quite close to the actual dates.
#
# From Paul Eggert (2014-03-21):
# The CET-switching Troll rules require zic from tzcode 2014b or later, so as
# suggested by Bengt-Inge Larsson comment them out for now, and approximate
# with only UTC and CEST. Uncomment them when 2014b is more prevalent.
#
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
#Rule Troll 2005 max - Mar 1 1:00u 1:00 CET
Rule Troll 2005 max - Mar lastSun 1:00u 2:00 CEST
#Rule Troll 2005 max - Oct lastSun 1:00u 1:00 CET
#Rule Troll 2004 max - Nov 7 1:00u 0:00 UTC
# Remove the following line when uncommenting the above '#Rule' lines.
Rule Troll 2004 max - Oct lastSun 1:00u 0:00 UTC
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Antarctica/Troll 0 - zzz 2005 Feb 12
0:00 Troll %s
# Poland - year-round base
# Arctowski, King George Island, -620945-0582745, since 1977
......
......@@ -786,14 +786,29 @@ Zone Pacific/Funafuti 11:56:52 - LMT 1901
# Johnston
#
# From Paul Eggert (2013-09-03):
# From Paul Eggert (2014-03-11):
# Sometimes Johnston kept Hawaii time, and sometimes it was an hour behind.
# Details are uncertain. We have no data for Johnston after 1970, so
# treat it like Hawaii for now.
#
# In his memoirs of June 6th to October 4, 1945
# <http://www.315bw.org/Herb_Bach.htm> (2005), Herbert C. Bach writes,
# "We started our letdown to Kwajalein Atoll and landed there at 5:00 AM
# Johnston time, 1:30 AM Kwajalein time." This was in June 1945, and
# confirms that Johnston kept the same time as Honolulu in summer 1945.
# We have no better information, so for now, assume this has been true
# indefinitely into the past.
#
# From Lyle McElhaney (2014-03-11):
# [W]hen JI was being used for that [atomic bomb] testing, the time being used
# was not Hawaiian time but rather the same time being used on the ships,
# which had a GMT offset of -11 hours. This apparently applied to at least the
# time from Operation Newsreel (Hardtack I/Teak shot, 1958-08-01) to the last
# Operation Fishbowl shot (Tightrope, 1962-11-04).... [See] Herman Hoerlin,
# "The United States High-Altitude Test Experience: A Review Emphasizing the
# Impact on the Environment", Los Alamos LA-6405, Oct 1976
# <http://www.fas.org/sgp/othergov/doe/lanl/docs1/00322994.pdf>.
# See the table on page 4 where he lists GMT and local times for the tests; a
# footnote for the JI tests reads that local time is "JI time = Hawaii Time
# Minus One Hour".
#
# See 'northamerica' for Pacific/Johnston.
......
......@@ -2986,7 +2986,11 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880
# Assume it happened in March by not changing the clocks.
3:00 Russia MSK/MSD 1997
3:00 - MSK 1997 Mar lastSun 1:00u
2:00 EU EE%sT
# From Alexander Krivenyshev (2014-03-17):
# time change at 2:00 (2am) on March 30, 2014
# http://vz.ru/news/2014/3/17/677464.html
2:00 EU EE%sT 2014 Mar 30 2:00
4:00 - MSK
# Vatican City
# See Europe/Rome.
......
......@@ -20,7 +20,7 @@
# 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.
#
# Allowance for leapseconds added to each timezone file.
# This file is in the public domain.
......
......@@ -74,6 +74,7 @@ AQ -6617+11031 Antarctica/Casey Casey Station, Bailey Peninsula
AQ -7824+10654 Antarctica/Vostok Vostok Station, Lake Vostok
AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie
AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I
AQ -720041+0023206 Antarctica/Troll Troll Station, Queen Maud Land
AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF)
AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, MN, SE, SF)
AR -2447-06525 America/Argentina/Salta (SA, LP, NQ, RN)
......@@ -366,6 +367,7 @@ RU +5443+02030 Europe/Kaliningrad Moscow-01 - Kaliningrad
RU +5545+03735 Europe/Moscow Moscow+00 - west Russia
RU +4844+04425 Europe/Volgograd Moscow+00 - Caspian Sea
RU +5312+05009 Europe/Samara Moscow+00 - Samara, Udmurtia
RU +4457+03406 Europe/Simferopol Moscow+00 - Crimea
RU +5651+06036 Asia/Yekaterinburg Moscow+02 - Urals
RU +5500+07324 Asia/Omsk Moscow+03 - west Siberia
RU +5502+08255 Asia/Novosibirsk Moscow+03 - Novosibirsk
......@@ -421,7 +423,6 @@ TZ -0648+03917 Africa/Dar_es_Salaam
UA +5026+03031 Europe/Kiev most locations
UA +4837+02218 Europe/Uzhgorod Ruthenia
UA +4750+03510 Europe/Zaporozhye Zaporozh'ye, E Lugansk / Zaporizhia, E Luhansk
UA +4457+03406 Europe/Simferopol central Crimea
UG +0019+03225 Africa/Kampala
UM +1645-16931 Pacific/Johnston Johnston Atoll
UM +2813-17722 Pacific/Midway Midway Islands
......
......@@ -1266,64 +1266,70 @@ public class AquaFileChooserUI extends FileChooserUI {
/**
* Data model for a type-face selection combo-box.
*/
protected class FilterComboBoxModel extends DefaultListModel implements ComboBoxModel, PropertyChangeListener {
int selectedIndex = -1;
protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
PropertyChangeListener {
protected FileFilter[] filters;
protected FilterComboBoxModel() {
super();
final FileFilter filters[] = getFileChooser().getChoosableFileFilters();
for (int i = 0; i < filters.length; i++) {
this.add(i, filters[i]);
}
filters = getFileChooser().getChoosableFileFilters();
}
public void propertyChange(final PropertyChangeEvent e) {
final String prop = e.getPropertyName();
if (prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
this.clear();
final FileFilter filters[] = (FileFilter[])e.getNewValue();
for (int i = 0; i < filters.length; i++) {
this.add(i, filters[i]);
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
filters = (FileFilter[]) e.getNewValue();
fireContentsChanged(this, -1, -1);
} else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
fireContentsChanged(this, -1, -1);
}
}
public void setSelectedItem(Object filter) {
if(filter != null) {
getFileChooser().setFileFilter((FileFilter) filter);
fireContentsChanged(this, -1, -1);
} else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
final FileFilter currentFilter = (FileFilter)e.getNewValue();
FileFilter filters[] = getFileChooser().getChoosableFileFilters();
}
}
public Object getSelectedItem() {
// Ensure that the current filter is in the list.
// NOTE: we shouldnt' have to do this, since JFileChooser adds
// the filter to the choosable filters list when the filter
// is set. Lets be paranoid just in case someone overrides
// setFileFilter in JFileChooser.
FileFilter currentFilter = getFileChooser().getFileFilter();
boolean found = false;
if (currentFilter != null) {
for (final FileFilter element : filters) {
if (element == currentFilter) {
if(currentFilter != null) {
for (FileFilter filter : filters) {
if (filter == currentFilter) {
found = true;
}
}
if (found == false) {
if(found == false) {
getFileChooser().addChoosableFileFilter(currentFilter);
}
}
filters = getFileChooser().getChoosableFileFilters();
setSelectedItem(e.getNewValue());
}
return getFileChooser().getFileFilter();
}
public void setSelectedItem(final Object filter) {
if (filter != null) {
selectedIndex = this.indexOf(filter);
fireContentsChanged(this, -1, -1);
public int getSize() {
if(filters != null) {
return filters.length;
} else {
return 0;
}
}
public Object getSelectedItem() {
final Object returnValue = null;
if (this.size() > 0) {
if ((selectedIndex != -1) && (selectedIndex < size())) { return this.get(selectedIndex); }
public FileFilter getElementAt(int index) {
if(index > getSize() - 1) {
// This shouldn't happen. Try to recover gracefully.
return getFileChooser().getFileFilter();
}
if(filters != null) {
return filters[index];
} else {
return null;
}
return returnValue;
}
}
......
......@@ -44,7 +44,8 @@ public class AquaIcon {
}
static UIResource getIconFor(final JRSUIControlSpec spec, final int width, final int height) {
return new CachableJRSUIIcon(width, height) {
return new ScalingJRSUIIcon(width, height) {
@Override
public void initIconPainter(final AquaPainter<JRSUIState> painter) {
spec.initIconPainter(painter);
}
......@@ -128,35 +129,12 @@ public class AquaIcon {
if (image != null) return image;
if (!GraphicsEnvironment.isHeadless()) {
image = getOptimizedImage();
image = createImage();
}
return image;
}
private Image getOptimizedImage() {
final Image img = createImage();
// TODO: no RuntimeOptions for now
//if (RuntimeOptions.getRenderer(null) != RuntimeOptions.Sun) return img;
return getProgressiveOptimizedImage(img, getIconWidth(), getIconHeight());
}
static Image getProgressiveOptimizedImage(final Image img, final int w, final int h) {
if (img == null) return null;
final int halfImgW = img.getWidth(null) / 2;
final int halfImgH = img.getHeight(null) / 2;
if (w * 2 > halfImgW && h * 2 > halfImgH) return img;
final BufferedImage halfImage = new BufferedImage(halfImgW, halfImgH, BufferedImage.TYPE_INT_ARGB);
final Graphics g = halfImage.getGraphics();
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g.drawImage(img, 0, 0, halfImgW, halfImgH, null);
g.dispose();
return getProgressiveOptimizedImage(halfImage, w, h);
}
abstract Image createImage();
public boolean hasIconRef() {
......@@ -189,24 +167,50 @@ public class AquaIcon {
}
static abstract class CachableJRSUIIcon extends CachingScalingIcon implements UIResource {
public CachableJRSUIIcon(final int width, final int height) {
super(width, height);
static abstract class ScalingJRSUIIcon implements Icon, UIResource {
final int width;
final int height;
public ScalingJRSUIIcon(final int width, final int height) {
this.width = width;
this.height = height;
}
Image createImage() {
final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIState.getInstance());
@Override
public void paintIcon(final Component c, Graphics g,
final int x, final int y) {
if (GraphicsEnvironment.isHeadless()) {
return;
}
g = g.create();
if (g instanceof Graphics2D) {
// improves icon rendering quality in Quartz
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
}
final AquaPainter<JRSUIState> painter =
AquaPainter.create(JRSUIState.getInstance());
initIconPainter(painter);
final BufferedImage img = new BufferedImage(getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB_PRE);
final Graphics g = img.getGraphics();
g.setClip(new Rectangle(0, 0, getIconWidth(), getIconHeight()));
painter.paint(g, null, 0, 0, getIconWidth(), getIconHeight());
g.setClip(new Rectangle(x, y, width, height));
painter.paint(g, c, x, y, width, height);
g.dispose();
return img;
}
public abstract void initIconPainter(final AquaPainter<JRSUIState> painter);
@Override
public int getIconWidth() {
return width;
}
@Override
public int getIconHeight() {
return height;
}
}
static class FileIcon extends CachingScalingIcon {
......
......@@ -786,8 +786,9 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
}
static final RecyclableSingleton<Icon> RESIZE_ICON = new RecyclableSingleton<Icon>() {
@Override
protected Icon getInstance() {
return new AquaIcon.CachableJRSUIIcon(11, 11) {
return new AquaIcon.ScalingJRSUIIcon(11, 11) {
public void initIconPainter(final AquaPainter<JRSUIState> iconState) {
iconState.state.set(Widget.GROW_BOX_TEXTURED);
iconState.state.set(WindowType.UTILITY);
......
......@@ -148,22 +148,34 @@ abstract class AquaPainter <T extends JRSUIState> {
return;
}
int scale = 1;
if (g instanceof SunGraphics2D) {
scale = ((SunGraphics2D) g).surfaceData.getDefaultScale();
}
final GraphicsConfiguration config = g.getDeviceConfiguration();
final ImageCache cache = ImageCache.getInstance();
final int imgW = bounds.width * scale;
final int imgH = bounds.height * scale;
final int width = bounds.width;
final int height = bounds.height;
AquaPixelsKey key = new AquaPixelsKey(config,
imgW, imgH, scale, controlState);
BufferedImage img = (BufferedImage) cache.getImage(key);
width, height, bounds, controlState);
Image img = (BufferedImage) cache.getImage(key);
if (img == null) {
img = new BufferedImage(imgW, imgH, BufferedImage.TYPE_INT_ARGB_PRE);
Image baseImage = createImage(width, height, bounds, control,
controlState);
img = new MultiResolutionBufferedImage(baseImage,
(rvWidth, rvHeight) -> createImage(rvWidth, rvHeight,
bounds, control, controlState));
if (!controlState.is(JRSUIConstants.Animating.YES)) {
cache.setImage(key, img);
}
}
g.drawImage(img, bounds.x, bounds.y, bounds.width, bounds.height, null);
}
private static Image createImage(int imgW, int imgH, final Rectangle bounds,
final JRSUIControl control, JRSUIState controlState) {
BufferedImage img = new BufferedImage(imgW, imgH,
BufferedImage.TYPE_INT_ARGB_PRE);
final WritableRaster raster = img.getRaster();
final DataBufferInt buffer = (DataBufferInt) raster.getDataBuffer();
......@@ -172,9 +184,7 @@ abstract class AquaPainter <T extends JRSUIState> {
control.paint(SunWritableRaster.stealData(buffer, 0),
imgW, imgH, 0, 0, bounds.width, bounds.height);
SunWritableRaster.markDirty(buffer);
}
g.drawImage(img, bounds.x, bounds.y, bounds.width, bounds.height, null);
return img;
}
}
......@@ -187,17 +197,17 @@ abstract class AquaPainter <T extends JRSUIState> {
private final GraphicsConfiguration config;
private final int w;
private final int h;
private final int scale;
private final Rectangle bounds;
private final JRSUIState state;
AquaPixelsKey(final GraphicsConfiguration config,
final int w, final int h, final int scale,
final int w, final int h, final Rectangle bounds,
final JRSUIState state) {
this.pixelCount = w * h;
this.config = config;
this.w = w;
this.h = h;
this.scale = scale;
this.bounds = bounds;
this.state = state;
this.hash = hash();
}
......@@ -210,7 +220,7 @@ abstract class AquaPainter <T extends JRSUIState> {
int hash = config != null ? config.hashCode() : 0;
hash = 31 * hash + w;
hash = 31 * hash + h;
hash = 31 * hash + scale;
hash = 31 * hash + bounds.hashCode();
hash = 31 * hash + state.hashCode();
return hash;
}
......@@ -225,7 +235,7 @@ abstract class AquaPainter <T extends JRSUIState> {
if (obj instanceof AquaPixelsKey) {
AquaPixelsKey key = (AquaPixelsKey) obj;
return config == key.config && w == key.w && h == key.h
&& scale == key.scale && state.equals(key.state);
&& bounds.equals(key.bounds) && state.equals(key.state);
}
return false;
}
......
......@@ -806,7 +806,7 @@ public class Introspector {
}
private static boolean isAssignable(Class<?> current, Class<?> candidate) {
return current == null ? candidate == null : current.isAssignableFrom(candidate);
return ((current == null) || (candidate == null)) ? current == candidate : current.isAssignableFrom(candidate);
}
/**
......
......@@ -104,7 +104,7 @@ import java.util.TimeZone;
* resolution clock if one is available.
*
* @implSpec
* This abstract class must be implemented with care to ensure other operate correctly.
* This abstract class must be implemented with care to ensure other classes operate correctly.
* All implementations that can be instantiated must be final, immutable and thread-safe.
* <p>
* The principal methods are defined to allow the throwing of an exception.
......
......@@ -1326,6 +1326,7 @@ public final class Duration
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -100,11 +100,6 @@ import java.util.Objects;
* This class models a single instantaneous point on the time-line.
* This might be used to record event time-stamps in the application.
* <p>
* For practicality, the instant is stored with some constraints.
* The measurable time-line is restricted to the number of seconds that can be held
* in a {@code long}. This is greater than the current estimated age of the universe.
* The instant is stored to nanosecond resolution.
* <p>
* The range of an instant requires the storage of a number larger than a {@code long}.
* To achieve this, the class stores a {@code long} representing epoch-seconds and an
* {@code int} representing nanosecond-of-second, which will always be between 0 and 999,999,999.
......@@ -1348,6 +1343,7 @@ public final class Instant
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -2053,6 +2053,7 @@ public final class LocalDate
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -1986,6 +1986,7 @@ public final class LocalDateTime
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -838,9 +838,9 @@ public final class LocalTime
case NANO_OF_SECOND: return withNano((int) newValue);
case NANO_OF_DAY: return LocalTime.ofNanoOfDay(newValue);
case MICRO_OF_SECOND: return withNano((int) newValue * 1000);
case MICRO_OF_DAY: return plusNanos((newValue - toNanoOfDay() / 1000) * 1000);
case MICRO_OF_DAY: return LocalTime.ofNanoOfDay(newValue * 1000);
case MILLI_OF_SECOND: return withNano((int) newValue * 1000_000);
case MILLI_OF_DAY: return plusNanos((newValue - toNanoOfDay() / 1000_000) * 1000_000);
case MILLI_OF_DAY: return LocalTime.ofNanoOfDay(newValue * 1000_000);
case SECOND_OF_MINUTE: return withSecond((int) newValue);
case SECOND_OF_DAY: return plusSeconds(newValue - toSecondOfDay());
case MINUTE_OF_HOUR: return withMinute((int) newValue);
......@@ -1638,6 +1638,7 @@ public final class LocalTime
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -771,6 +771,7 @@ public final class MonthDay
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -1925,6 +1925,7 @@ public final class OffsetDateTime
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -1396,6 +1396,7 @@ public final class OffsetTime
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -1058,6 +1058,7 @@ public final class Period
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws java.io.InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -1104,6 +1104,7 @@ public final class Year
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -1230,6 +1230,7 @@ public final class YearMonth
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -624,6 +624,7 @@ public abstract class ZoneId implements Serializable {
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -769,6 +769,7 @@ public final class ZoneOffset
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -196,6 +196,7 @@ final class ZoneRegion extends ZoneId implements Serializable {
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -2225,6 +2225,7 @@ public final class ZonedDateTime
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -766,6 +766,7 @@ public abstract class AbstractChronology implements Chronology {
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws java.io.InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws ObjectStreamException {
......
......@@ -101,19 +101,12 @@ import java.util.Objects;
* <h3>When to use this interface</h3>
* The design of the API encourages the use of {@code LocalDate} rather than this
* interface, even in the case where the application needs to deal with multiple
* calendar systems. The rationale for this is explored in the following documentation.
* calendar systems.
* <p>
* The primary use case where this interface should be used is where the generic
* type parameter {@code <D>} is fully defined as a specific chronology.
* In that case, the assumptions of that chronology are known at development
* time and specified in the code.
* <p>
* When the chronology is defined in the generic type parameter as ? or otherwise
* unknown at development time, the rest of the discussion below applies.
* <p>
* To emphasize the point, declaring a method signature, field or variable as this
* interface type can initially seem like the sensible way to globalize an application,
* however it is usually the wrong approach.
* This concept can seem surprising at first, as the natural way to globalize an
* application might initially appear to be to abstract the calendar system.
* However, as explored below, abstracting the calendar system is usually the wrong
* approach, resulting in logic errors and hard to find bugs.
* As such, it should be considered an application-wide architectural decision to choose
* to use this interface as opposed to {@code LocalDate}.
*
......
......@@ -416,6 +416,7 @@ final class ChronoLocalDateTimeImpl<D extends ChronoLocalDate>
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -376,6 +376,7 @@ final class ChronoPeriodImpl
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws ObjectStreamException {
......
......@@ -340,6 +340,7 @@ final class ChronoZonedDateTimeImpl<D extends ChronoLocalDate>
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -1096,6 +1096,7 @@ public final class HijrahChronology extends AbstractChronology implements Serial
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -654,6 +654,7 @@ public final class HijrahDate
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -604,6 +604,7 @@ public final class IsoChronology extends AbstractChronology implements Serializa
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -525,6 +525,7 @@ public final class JapaneseChronology extends AbstractChronology implements Seri
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -716,6 +716,7 @@ public final class JapaneseDate
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -357,6 +357,7 @@ public final class JapaneseEra
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -355,6 +355,7 @@ public final class MinguoChronology extends AbstractChronology implements Serial
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -478,6 +478,7 @@ public final class MinguoDate
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -391,6 +391,7 @@ public final class ThaiBuddhistChronology extends AbstractChronology implements
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -478,6 +478,7 @@ public final class ThaiBuddhistDate
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -344,10 +344,7 @@ import java.util.Set;
* <b>Fraction</b>: Outputs the nano-of-second field as a fraction-of-second.
* The nano-of-second value has nine digits, thus the count of pattern letters
* is from 1 to 9. If it is less than 9, then the nano-of-second value is
* truncated, with only the most significant digits being output. When parsing
* in strict mode, the number of parsed digits must match the count of pattern
* letters. When parsing in lenient mode, the number of parsed digits must be at
* least the count of pattern letters, up to 9 digits.
* truncated, with only the most significant digits being output.
* <p>
* <b>Year</b>: The count of letters determines the minimum field width below
* which padding is used. If the count of letters is two, then a
......@@ -1647,12 +1644,13 @@ public final class DateTimeFormatter {
* @return a formatter based on this formatter with the requested resolver style, not null
*/
public DateTimeFormatter withResolverFields(TemporalField... resolverFields) {
Objects.requireNonNull(resolverFields, "resolverFields");
Set<TemporalField> fields = new HashSet<>(Arrays.asList(resolverFields));
Set<TemporalField> fields = null;
if (resolverFields != null) {
fields = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(resolverFields)));
}
if (Objects.equals(this.resolverFields, fields)) {
return this;
}
fields = Collections.unmodifiableSet(fields);
return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, fields, chrono, zone);
}
......@@ -1696,11 +1694,12 @@ public final class DateTimeFormatter {
* @return a formatter based on this formatter with the requested resolver style, not null
*/
public DateTimeFormatter withResolverFields(Set<TemporalField> resolverFields) {
Objects.requireNonNull(resolverFields, "resolverFields");
if (Objects.equals(this.resolverFields, resolverFields)) {
return this;
}
if (resolverFields != null) {
resolverFields = Collections.unmodifiableSet(new HashSet<>(resolverFields));
}
return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono, zone);
}
......
......@@ -2596,8 +2596,16 @@ public final class DateTimeFormatterBuilder {
return value;
}
boolean isFixedWidth() {
return subsequentWidth == -1;
/**
* For NumberPrinterParser, the width is fixed depending on the
* minWidth, maxWidth, signStyle and whether subsequent fields are fixed.
* @param context the context
* @return true if the field is fixed width
* @see DateTimeFormatterBuilder#appendValue(java.time.temporal.TemporalField, int)
*/
boolean isFixedWidth(DateTimeParseContext context) {
return subsequentWidth == -1 ||
(subsequentWidth > 0 && minWidth == maxWidth && signStyle == SignStyle.NOT_NEGATIVE);
}
@Override
......@@ -2626,12 +2634,12 @@ public final class DateTimeFormatterBuilder {
return ~position;
}
}
int effMinWidth = (context.isStrict() || isFixedWidth() ? minWidth : 1);
int effMinWidth = (context.isStrict() || isFixedWidth(context) ? minWidth : 1);
int minEndPos = position + effMinWidth;
if (minEndPos > length) {
return ~position;
}
int effMaxWidth = (context.isStrict() || isFixedWidth() ? maxWidth : 9) + Math.max(subsequentWidth, 0);
int effMaxWidth = (context.isStrict() || isFixedWidth(context) ? maxWidth : 9) + Math.max(subsequentWidth, 0);
long total = 0;
BigInteger totalBig = null;
int pos = position;
......@@ -2866,6 +2874,21 @@ public final class DateTimeFormatterBuilder {
this.subsequentWidth + subsequentWidth);
}
/**
* For a ReducedPrinterParser, fixed width is false if the mode is strict,
* otherwise it is set as for NumberPrinterParser.
* @param context the context
* @return if the field is fixed width
* @see DateTimeFormatterBuilder#appendValueReduced(java.time.temporal.TemporalField, int, int, int)
*/
@Override
boolean isFixedWidth(DateTimeParseContext context) {
if (context.isStrict() == false) {
return false;
}
return super.isFixedWidth(context);
}
@Override
public String toString() {
return "ReducedValue(" + field + "," + minWidth + "," + maxWidth + "," + (baseDate != null ? baseDate : baseValue) + ")";
......
......@@ -289,7 +289,7 @@ final class Parsed implements TemporalAccessor {
changedCount++;
continue outer; // have to restart to avoid concurrent modification
}
throw new DateTimeException("Method resolveFields() can only return ChronoZonedDateTime," +
throw new DateTimeException("Method resolve() can only return ChronoZonedDateTime, " +
"ChronoLocalDateTime, ChronoLocalDate or LocalTime");
} else if (fieldValues.containsKey(targetField) == false) {
changedCount++;
......
......@@ -217,7 +217,7 @@ public interface TemporalAccessor {
default int get(TemporalField field) {
ValueRange range = range(field);
if (range.isIntValue() == false) {
throw new UnsupportedTemporalTypeException("Invalid field " + field + " + for get() method, use getLong() instead");
throw new UnsupportedTemporalTypeException("Invalid field " + field + " for get() method, use getLong() instead");
}
long value = getLong(field);
if (range.isValidValue(value) == false) {
......
......@@ -344,10 +344,13 @@ public final class ValueRange implements Serializable {
/**
* Restore the state of an ValueRange from the stream.
* Check that the values are valid.
*
* @param s the stream to read
* @throws InvalidObjectException if
* the smallest minimum is greater than the smallest maximum,
* or the smallest maximum is greater than the largest maximum
* or the largest minimum is greater than the largest maximum
* @throws ClassNotFoundException if a class cannot be resolved
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException, InvalidObjectException
......
......@@ -344,8 +344,11 @@ public final class WeekFields implements Serializable {
/**
* Restore the state of a WeekFields from the stream.
* Check that the values are valid.
*
* @param s the stream to read
* @throws InvalidObjectException if the serialized object has an invalid
* value for firstDayOfWeek or minimalDays.
* @throws ClassNotFoundException if a class cannot be resolved
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException, InvalidObjectException
......
......@@ -173,6 +173,8 @@ public final class ZoneOffsetTransition
//-----------------------------------------------------------------------
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -235,6 +235,7 @@ public final class ZoneOffsetTransitionRule implements Serializable {
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -319,6 +319,7 @@ public final class ZoneRules implements Serializable {
/**
* Defend against malicious streams.
*
* @param s the stream to read
* @throws InvalidObjectException always
*/
private void readObject(ObjectInputStream s) throws InvalidObjectException {
......
......@@ -24,6 +24,7 @@
*/
package sun.awt.image;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Graphics;
import java.awt.geom.Dimension2D;
......@@ -42,6 +43,13 @@ public class MultiResolutionBufferedImage extends BufferedImage
private final Dimension2D[] sizes;
private int availableInfo;
public MultiResolutionBufferedImage(Image baseImage,
BiFunction<Integer, Integer, Image> mapper) {
this(baseImage, new Dimension[]{new Dimension(
baseImage.getWidth(null), baseImage.getHeight(null))
}, mapper);
}
public MultiResolutionBufferedImage(Image baseImage,
Dimension2D[] sizes, BiFunction<Integer, Integer, Image> mapper) {
super(baseImage.getWidth(null), baseImage.getHeight(null),
......@@ -115,7 +123,7 @@ public class MultiResolutionBufferedImage extends BufferedImage
}
private static void preload(Image image, int availableInfo) {
if (image instanceof ToolkitImage) {
if (availableInfo != 0 && image instanceof ToolkitImage) {
((ToolkitImage) image).preload(new ImageObserver() {
int flags = availableInfo;
......
......@@ -570,6 +570,9 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
{"Antarctica/Syowa", new String[] {"Syowa Time", "SYOT",
"Syowa Summer Time", "SYOST",
"Syowa Time", "SYOT"}},
{"Antarctica/Troll", new String[] {"Coordinated Universal Time", "UTC",
"Central European Summer Time", "CEST",
"Troll Time", "ATT"}},
{"Antarctica/Vostok", new String[] {"Vostok Time", "VOST",
"Vostok Summer Time", "VOSST",
"Vostok Time", "VOST"}},
......@@ -839,7 +842,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
"Samara Time", "SAMT"}},
{"Europe/San_Marino", CET},
{"Europe/Sarajevo", CET},
{"Europe/Simferopol", EET},
{"Europe/Simferopol", MSK},
{"Europe/Skopje", CET},
{"Europe/Sofia", EET},
{"Europe/Stockholm", CET},
......
......@@ -570,6 +570,9 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle {
{"Antarctica/Syowa", new String[] {"Syowa Zeit", "SYOT",
"Syowa Sommerzeit", "SYOST",
"Syowa Zeit", "SYOT"}},
{"Antarctica/Troll", new String[] {"Koordinierte Universalzeit", "UTC",
"Mitteleurop\u00e4ische Sommerzeit", "MESZ",
"Troll Time", "ATT"}},
{"Antarctica/Vostok", new String[] {"Vostok Zeit", "VOST",
"Vostok Sommerzeit", "VOSST",
"Vostok Zeit", "VOST"}},
......@@ -838,7 +841,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle {
"Samarische Zeit", "SAMT"}},
{"Europe/San_Marino", CET},
{"Europe/Sarajevo", CET},
{"Europe/Simferopol", EET},
{"Europe/Simferopol", MSK},
{"Europe/Skopje", CET},
{"Europe/Sofia", EET},
{"Europe/Stockholm", CET},
......
......@@ -570,6 +570,9 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle {
{"Antarctica/Syowa", new String[] {"Hora de Syowa", "SYOT",
"Hora de verano de Syowa", "SYOST",
"Hora de Syowa", "SYOT"}},
{"Antarctica/Troll", new String[] {"Hora Universal Coordinada", "UTC",
"Hora de verano de Europa Central", "CEST",
"Troll Time", "ATT"}},
{"Antarctica/Vostok", new String[] {"Hora de Vostok", "VOST",
"Hora de verano de Vostok", "VOSST",
"Hora de Vostok", "VOST"}},
......@@ -838,7 +841,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle {
"Hora de Samara", "SAMT"}},
{"Europe/San_Marino", CET},
{"Europe/Sarajevo", CET},
{"Europe/Simferopol", EET},
{"Europe/Simferopol", MSK},
{"Europe/Skopje", CET},
{"Europe/Sofia", EET},
{"Europe/Stockholm", CET},
......
......@@ -570,6 +570,9 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle {
{"Antarctica/Syowa", new String[] {"Heure de Syowa", "SYOT",
"Heure d'\u00e9t\u00e9 de Syowa", "SYOST",
"Heure de Syowa", "SYOT"}},
{"Antarctica/Troll", new String[] {"Temps universel coordonn\u00e9", "UTC",
"Heure d'\u00e9t\u00e9 d'Europe centrale", "CEST",
"Troll Time", "ATT"}},
{"Antarctica/Vostok", new String[] {"Heure de Vostok", "VOST",
"Heure d'\u00e9t\u00e9 de Vostok", "VOSST",
"Heure de Vostok", "VOST"}},
......@@ -838,7 +841,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle {
"Heure de Samara", "SAMT"}},
{"Europe/San_Marino", CET},
{"Europe/Sarajevo", CET},
{"Europe/Simferopol", EET},
{"Europe/Simferopol", MSK},
{"Europe/Skopje", CET},
{"Europe/Sofia", EET},
{"Europe/Stockholm", CET},
......
......@@ -570,6 +570,9 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle {
{"Antarctica/Syowa", new String[] {"Ora di Syowa", "SYOT",
"Ora estiva di Syowa", "SYOST",
"Ora di Syowa", "SYOT"}},
{"Antarctica/Troll", new String[] {"Tempo universale coordinato", "UTC",
"Ora estiva dell'Europa centrale", "CEST",
"Troll Time", "ATT"}},
{"Antarctica/Vostok", new String[] {"Ora di Vostok", "VOST",
"Ora estiva di Vostok", "VOSST",
"Ora di Vostok", "VOST"}},
......@@ -838,7 +841,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle {
"Ora di Samara", "SAMT"}},
{"Europe/San_Marino", CET},
{"Europe/Sarajevo", CET},
{"Europe/Simferopol", EET},
{"Europe/Simferopol", MSK},
{"Europe/Skopje", CET},
{"Europe/Sofia", EET},
{"Europe/Stockholm", CET},
......
......@@ -570,6 +570,9 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle {
{"Antarctica/Syowa", new String[] {"\u662d\u548c\u57fa\u5730\u6642\u9593", "SYOT",
"\u662d\u548c\u57fa\u5730\u590f\u6642\u9593", "SYOST",
"\u662D\u548C\u57FA\u5730\u6642\u9593", "SYOT"}},
{"Antarctica/Troll", new String[] {"\u5354\u5b9a\u4e16\u754c\u6642", "UTC",
"\u4e2d\u90e8\u30e8\u30fc\u30ed\u30c3\u30d1\u590f\u6642\u9593", "CEST",
"Troll Time", "ATT"}},
{"Antarctica/Vostok", new String[] {"\u30dc\u30b9\u30c8\u30fc\u30af\u57fa\u5730\u6642\u9593", "VOST",
"\u30dc\u30b9\u30c8\u30fc\u30af\u57fa\u5730\u590f\u6642\u9593", "VOSST",
"\u30DC\u30B9\u30C8\u30FC\u30AF\u6642\u9593", "VOST"}},
......@@ -838,7 +841,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle {
"\u30B5\u30DE\u30E9\u6642\u9593", "SAMT"}},
{"Europe/San_Marino", CET},
{"Europe/Sarajevo", CET},
{"Europe/Simferopol", EET},
{"Europe/Simferopol", MSK},
{"Europe/Skopje", CET},
{"Europe/Sofia", EET},
{"Europe/Stockholm", CET},
......
......@@ -570,6 +570,9 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle {
{"Antarctica/Syowa", new String[] {"Syowa \uc2dc\uac04", "SYOT",
"Syowa \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "SYOST",
"\uC1FC\uC640 \uD45C\uC900\uC2DC", "SYOT"}},
{"Antarctica/Troll", new String[] {"\uc138\uacc4 \ud45c\uc900\uc2dc", "UTC",
"\uc911\uc559 \uc720\ub7fd \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "CEST",
"Troll Time", "ATT"}},
{"Antarctica/Vostok", new String[] {"Vostok \uc2dc\uac04", "VOST",
"Vostok \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "VOSST",
"\uBCF4\uC2A4\uD1A1 \uD45C\uC900\uC2DC", "VOST"}},
......@@ -838,7 +841,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle {
"\uC0AC\uB9C8\uB77C \uD45C\uC900\uC2DC", "SAMT"}},
{"Europe/San_Marino", CET},
{"Europe/Sarajevo", CET},
{"Europe/Simferopol", EET},
{"Europe/Simferopol", MSK},
{"Europe/Skopje", CET},
{"Europe/Sofia", EET},
{"Europe/Stockholm", CET},
......
......@@ -570,6 +570,9 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle {
{"Antarctica/Syowa", new String[] {"Fuso hor\u00e1rio de Syowa", "SYOT",
"Fuso hor\u00e1rio de ver\u00e3o de Syowa", "SYOST",
"Hor\u00E1rio de Syowa", "SYOT"}},
{"Antarctica/Troll", new String[] {"Tempo universal coordenado", "UTC",
"Fuso hor\u00e1rio de ver\u00e3o da Europa Central", "CEST",
"Troll Time", "ATT"}},
{"Antarctica/Vostok", new String[] {"Fuso hor\u00e1rio de Vostok", "VOST",
"Fuso hor\u00e1rio de ver\u00e3o de Vostok", "VOSST",
"Hor\u00E1rio de Vostok", "VOST"}},
......@@ -838,7 +841,7 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle {
"Hor\u00E1rio de Samara", "SAMT"}},
{"Europe/San_Marino", CET},
{"Europe/Sarajevo", CET},
{"Europe/Simferopol", EET},
{"Europe/Simferopol", MSK},
{"Europe/Skopje", CET},
{"Europe/Sofia", EET},
{"Europe/Stockholm", CET},
......
......@@ -570,6 +570,9 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle {
{"Antarctica/Syowa", new String[] {"Syowa, normaltid", "SYOT",
"Syowa, sommartid", "SYOST",
"Syowa-tid", "SYOT"}},
{"Antarctica/Troll", new String[] {"Koordinerad universell tid", "UTC",
"Centraleuropeisk sommartid", "CEST",
"Troll Time", "ATT"}},
{"Antarctica/Vostok", new String[] {"Vostok, normaltid", "VOST",
"Vostok, sommartid", "VOSST",
"Vostok-tid", "VOST"}},
......@@ -838,7 +841,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle {
"Samara-tid", "SAMT"}},
{"Europe/San_Marino", CET},
{"Europe/Sarajevo", CET},
{"Europe/Simferopol", EET},
{"Europe/Simferopol", MSK},
{"Europe/Skopje", CET},
{"Europe/Sofia", EET},
{"Europe/Stockholm", CET},
......
......@@ -570,6 +570,9 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle {
{"Antarctica/Syowa", new String[] {"Syowa \u65f6\u95f4", "SYOT",
"Syowa \u590f\u4ee4\u65f6", "SYOST",
"Syowa \u65F6\u95F4", "SYOT"}},
{"Antarctica/Troll", new String[] {"\u534f\u8c03\u4e16\u754c\u65f6\u95f4", "UTC",
"\u4e2d\u6b27\u590f\u4ee4\u65f6", "CEST",
"Troll Time", "ATT"}},
{"Antarctica/Vostok", new String[] {"\u83ab\u65af\u6258\u514b\u65f6\u95f4", "VOST",
"\u83ab\u65af\u6258\u514b\u590f\u4ee4\u65f6", "VOSST",
"\u83AB\u65AF\u6258\u514B\u65F6\u95F4", "VOST"}},
......@@ -838,7 +841,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle {
"\u6C99\u9A6C\u62C9\u65F6\u95F4", "SAMT"}},
{"Europe/San_Marino", CET},
{"Europe/Sarajevo", CET},
{"Europe/Simferopol", EET},
{"Europe/Simferopol", MSK},
{"Europe/Skopje", CET},
{"Europe/Sofia", EET},
{"Europe/Stockholm", CET},
......
......@@ -570,6 +570,9 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle {
{"Antarctica/Syowa", new String[] {"\u5915\u6b50\u74e6 (Syowa) \u6642\u9593", "SYOT",
"\u5915\u6b50\u74e6 (Syowa) \u590f\u4ee4\u6642\u9593", "SYOST",
"\u5915\u6B50\u74E6 (Syowa) \u6642\u9593", "SYOT"}},
{"Antarctica/Troll", new String[] {"\u5354\u8abf\u4e16\u754c\u6642\u9593", "UTC",
"\u4e2d\u6b50\u590f\u4ee4\u6642\u9593", "CEST",
"Troll Time", "ATT"}},
{"Antarctica/Vostok", new String[] {"\u4f5b\u65af\u6258 (Vostok) \u6642\u9593", "VOST",
"\u4f5b\u65af\u6258 (Vostok) \u590f\u4ee4\u6642\u9593", "VOSST",
"\u4F5B\u65AF\u6258 (Vostok) \u6642\u9593", "VOST"}},
......@@ -840,7 +843,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle {
"\u6C99\u99AC\u62C9\u6642\u9593", "SAMT"}},
{"Europe/San_Marino", CET},
{"Europe/Sarajevo", CET},
{"Europe/Simferopol", EET},
{"Europe/Simferopol", MSK},
{"Europe/Skopje", CET},
{"Europe/Sofia", EET},
{"Europe/Stockholm", CET},
......
......@@ -543,7 +543,9 @@ OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo,
}
JNU_SetFieldByName(env, NULL, sdObject, "nativeWidth", "I", width);
if (!((*env)->ExceptionOccurred(env))) {
JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height);
}
(*env)->DeleteLocalRef(env, sdObject);
}
......
......@@ -396,7 +396,7 @@ utf8mToUtf8s(struct UtfInst *ui, jbyte *string, int length, jbyte *newString, in
/* ================================================================= */
#if 1 /* Test program */
#ifdef COMPILE_WITH_UTF_TEST /* Test program */
/*
* Convert any byte array into a printable string.
......
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2014, 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
......@@ -38,12 +38,14 @@
JNIEXPORT jint JNICALL
Java_java_util_prefs_FileSystemPreferences_chmod(JNIEnv *env,
jclass thisclass, jstring java_fname, jint permission) {
const char *fname = JNU_GetStringPlatformChars(env, java_fname, JNI_FALSE);
int result;
const char *fname = JNU_GetStringPlatformChars(env, java_fname, NULL);
int result = -1;
if (fname) {
result = chmod(fname, permission);
if (result != 0)
result = errno;
JNU_ReleaseStringPlatformChars(env, java_fname, fname);
}
return (jint) result;
}
......@@ -61,13 +63,16 @@ typedef struct flock64 FLOCK;
JNIEXPORT jintArray JNICALL
Java_java_util_prefs_FileSystemPreferences_lockFile0(JNIEnv *env,
jclass thisclass, jstring java_fname, jint permission, jboolean shared) {
const char *fname = JNU_GetStringPlatformChars(env, java_fname, JNI_FALSE);
const char *fname = JNU_GetStringPlatformChars(env, java_fname, NULL);
int fd, rc;
int result[2];
jintArray javaResult;
jintArray javaResult = NULL;
int old_umask;
FLOCK fl;
if (!fname)
return javaResult;
fl.l_whence = SEEK_SET;
fl.l_len = 0;
fl.l_start = 0;
......@@ -104,6 +109,7 @@ Java_java_util_prefs_FileSystemPreferences_lockFile0(JNIEnv *env,
}
JNU_ReleaseStringPlatformChars(env, java_fname, fname);
javaResult = (*env)->NewIntArray(env,2);
if (javaResult)
(*env)->SetIntArrayRegion(env, javaResult, 0, 2, result);
return javaResult;
}
......
......@@ -540,6 +540,19 @@ awtJNI_GetFontData(JNIEnv * env, jobject font, char **errmsg)
fdata->xfont = fdata->flist[i].xfont;
fdata->flist[i].index_length = 1;
} else {
/* Free any already allocated storage and fonts */
int j = i;
for (j = 0; j <= i; j++) {
free((void *)fdata->flist[j].xlfd);
JNU_ReleaseStringPlatformChars(env, NULL,
fdata->flist[j].charset_name);
if (fdata->flist[j].load) {
XFreeFont(awt_display, fdata->flist[j].xfont);
}
}
free((void *)fdata->flist);
free((void *)fdata);
if (errmsg != NULL) {
*errmsg = "java/lang" "NullPointerException";
}
......
......@@ -152,6 +152,10 @@ static int CALLBACK EnumFontFacesInFamilyProcA(
/* printf("FULL=%s\n",lpelfe->elfFullName);fflush(stdout); */
fullname = JNU_NewStringPlatform(env, lpelfe->elfFullName);
if (fullname == NULL) {
(*env)->ExceptionClear(env);
return 1;
}
fullnameLC = (*env)->CallObjectMethod(env, fullname,
fmi->toLowerCaseMID, fmi->locale);
(*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
......@@ -242,6 +246,10 @@ static int CALLBACK EnumFontFacesInFamilyProcW(
fullname = (*env)->NewString(env, lpelfe->elfFullName,
(jsize)wcslen((LPWSTR)lpelfe->elfFullName));
if (fullname == NULL) {
(*env)->ExceptionClear(env);
return 1;
}
fullnameLC = (*env)->CallObjectMethod(env, fullname,
fmi->toLowerCaseMID, fmi->locale);
(*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
......@@ -287,6 +295,10 @@ static int CALLBACK EnumFamilyNamesA(
return 1;
}
fmi->family = JNU_NewStringPlatform(env,lpelfe->elfLogFont.lfFaceName);
if (fmi->family == NULL) {
(*env)->ExceptionClear(env);
return 1;
}
familyLC = (*env)->CallObjectMethod(env, fmi->family,
fmi->toLowerCaseMID, fmi->locale);
/* check if already seen this family with a different charset */
......@@ -296,7 +308,10 @@ static int CALLBACK EnumFamilyNamesA(
}
fmi->list = (*env)->NewObject(env,
fmi->arrayListClass, fmi->arrayListCtr, 4);
if (fmi->list == NULL) {
(*env)->ExceptionClear(env);
return 1;
}
(*env)->CallObjectMethod(env, fmi->familyToFontListMap,
fmi->putMID, familyLC, fmi->list);
......@@ -343,6 +358,10 @@ static int CALLBACK EnumFamilyNamesW(
}
slen = wcslen(lpelfe->elfLogFont.lfFaceName);
fmi->family = (*env)->NewString(env,lpelfe->elfLogFont.lfFaceName, (jsize)slen);
if (fmi->family == NULL) {
(*env)->ExceptionClear(env);
return 1;
}
familyLC = (*env)->CallObjectMethod(env, fmi->family,
fmi->toLowerCaseMID, fmi->locale);
/* check if already seen this family with a different charset */
......@@ -352,7 +371,10 @@ static int CALLBACK EnumFamilyNamesW(
}
fmi->list = (*env)->NewObject(env,
fmi->arrayListClass, fmi->arrayListCtr, 4);
if (fmi->list == NULL) {
(*env)->ExceptionClear(env);
return 1;
}
(*env)->CallObjectMethod(env, fmi->familyToFontListMap,
fmi->putMID, familyLC, fmi->list);
......@@ -447,6 +469,10 @@ static void registerFontA(GdiFontMapInfo *fmi, jobject fontToFileMap,
JNIEnv *env = fmi->env;
size_t dslen = strlen(data);
jstring fileStr = JNU_NewStringPlatform(env, data);
if (fileStr == NULL) {
(*env)->ExceptionClear(env);
return;
}
/* TTC or ttc means it may be a collection. Need to parse out
* multiple font face names separated by " & "
......@@ -467,6 +493,10 @@ static void registerFontA(GdiFontMapInfo *fmi, jobject fontToFileMap,
ptr1 = ptr2+3;
}
fontStr = JNU_NewStringPlatform(env, ptr1);
if (fontStr == NULL) {
(*env)->ExceptionClear(env);
return;
}
fontStr = (*env)->CallObjectMethod(env, fontStr,
fmi->toLowerCaseMID,
fmi->locale);
......@@ -481,6 +511,10 @@ static void registerFontA(GdiFontMapInfo *fmi, jobject fontToFileMap,
}
} else {
fontStr = JNU_NewStringPlatform(env, name);
if (fontStr == NULL) {
(*env)->ExceptionClear(env);
return;
}
fontStr = (*env)->CallObjectMethod(env, fontStr,
fmi->toLowerCaseMID, fmi->locale);
(*env)->CallObjectMethod(env, fontToFileMap, fmi->putMID,
......@@ -496,6 +530,10 @@ static void registerFontW(GdiFontMapInfo *fmi, jobject fontToFileMap,
JNIEnv *env = fmi->env;
size_t dslen = wcslen(data);
jstring fileStr = (*env)->NewString(env, data, (jsize)dslen);
if (fileStr == NULL) {
(*env)->ExceptionClear(env);
return;
}
/* TTC or ttc means it may be a collection. Need to parse out
* multiple font face names separated by " & "
......@@ -517,6 +555,10 @@ static void registerFontW(GdiFontMapInfo *fmi, jobject fontToFileMap,
ptr1 = ptr2+3;
}
fontStr = (*env)->NewString(env, ptr1, (jsize)wcslen(ptr1));
if (fontStr == NULL) {
(*env)->ExceptionClear(env);
return;
}
fontStr = (*env)->CallObjectMethod(env, fontStr,
fmi->toLowerCaseMID,
fmi->locale);
......@@ -531,6 +573,10 @@ static void registerFontW(GdiFontMapInfo *fmi, jobject fontToFileMap,
}
} else {
fontStr = (*env)->NewString(env, name, (jsize)wcslen(name));
if (fontStr == NULL) {
(*env)->ExceptionClear(env);
return;
}
fontStr = (*env)->CallObjectMethod(env, fontStr,
fmi->toLowerCaseMID, fmi->locale);
(*env)->CallObjectMethod(env, fontToFileMap, fmi->putMID,
......
......@@ -33,9 +33,16 @@
#include "awt_BitmapUtil.h"
#include "D3DRenderQueue.h"
// REMIND: move to awt_Component.h
extern "C" HWND AwtComponent_GetHWnd(JNIEnv *env, jlong pData);
/* This looks weird. but since some AWT headers need to be included,
* we end up with AWT's alloc.h macro definition of ExceptionOccurred.
* The reasons for that re-defintion do not apply to this code, so undef it.
*/
#undef ExceptionOccurred
/**
* Initializes nativeWidth/Height fields of the SurfaceData object with
* dimensions on the native surface.
......@@ -55,7 +62,9 @@ void D3DSD_SetNativeDimensions(JNIEnv *env, D3DSDOps *d3dsdo) {
}
JNU_SetFieldByName(env, NULL, sdObject, "nativeWidth", "I", width);
if (!(env->ExceptionOccurred())) {
JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height);
}
env->DeleteLocalRef(sdObject);
}
......
......@@ -49,9 +49,12 @@ extern jboolean IsMultiFont(JNIEnv *env, jobject obj)
if (obj == NULL) {
return JNI_FALSE;
}
if (env->EnsureLocalCapacity(2))
if (env->EnsureLocalCapacity(2)) {
env->ExceptionClear();
return JNI_FALSE;
}
jobject peer = env->CallObjectMethod(obj, AwtFont::peerMID);
env->ExceptionClear();
if (peer == NULL) {
return JNI_FALSE;
}
......@@ -66,10 +69,12 @@ extern jstring GetTextComponentFontName(JNIEnv *env, jobject font)
{
DASSERT(font != NULL);
if (env->EnsureLocalCapacity(2)) {
env->ExceptionClear();
return NULL;
}
jobject peer = env->CallObjectMethod(font, AwtFont::peerMID);
DASSERT(peer != NULL);
if (peer == NULL) return NULL;
jstring textComponentFontName =
(jstring) env->GetObjectField(peer, AwtFont::textComponentFontNameID);
env->DeleteLocalRef(peer);
......@@ -191,6 +196,9 @@ AwtFont* AwtFont::GetFont(JNIEnv *env, jobject font,
}
awtFont = Create(env, font, angle, awScale);
if (awtFont == NULL) {
return NULL;
}
env->SetLongField(font, AwtFont::pDataID,
reinterpret_cast<jlong>(awtFont));
......@@ -272,6 +280,9 @@ AwtFont* AwtFont::Create(JNIEnv *env, jobject font, jint angle, jfloat awScale)
if (cfnum > 0) {
// Ask peer class for the text component font name
jstring jTextComponentFontName = GetTextComponentFontName(env, font);
if (jTextComponentFontName == NULL) {
return NULL;
}
LPCWSTR textComponentFontName = JNU_GetStringPlatformChars(env, jTextComponentFontName, NULL);
awtFont->m_textInput = -1;
......@@ -285,6 +296,9 @@ AwtFont* AwtFont::Create(JNIEnv *env, jobject font, jint angle, jfloat awScale)
AwtFont::nativeNameID);
wName = JNU_GetStringPlatformChars(env, nativeName, NULL);
DASSERT(wName);
if (wName == NULL) {
wName = L"Arial";
}
//On NT platforms, if the font is not Symbol or Dingbats
//use "W" version of Win32 APIs directly, info the FontDescription
......@@ -321,7 +335,12 @@ AwtFont* AwtFont::Create(JNIEnv *env, jobject font, jint angle, jfloat awScale)
// Instantiation for English version.
jstring fontName = (jstring)env->GetObjectField(font,
AwtFont::nameID);
if (fontName != NULL) {
wName = JNU_GetStringPlatformChars(env, fontName, NULL);
}
if (wName == NULL) {
wName = L"Arial";
}
WCHAR* wEName;
if (!wcscmp(wName, L"Helvetica") || !wcscmp(wName, L"SansSerif")) {
......@@ -647,6 +666,9 @@ SIZE AwtFont::DrawStringSize_sub(jstring str, HDC hDC,
//"useUnicode" field might not be initialized correctly (font in Menu Component,
//for example").
AwtFont* awtFont = AwtFont::GetFont(env, font);
if (awtFont == NULL) {
return size;
}
if (IsMultiFont(env, font)) {
jobject peer = env->CallObjectMethod(font, AwtFont::peerMID);
......@@ -668,6 +690,9 @@ SIZE AwtFont::DrawStringSize_sub(jstring str, HDC hDC,
if (arrayLength == 0) {
int length = env->GetStringLength(str);
LPCWSTR strW = JNU_GetStringPlatformChars(env, str, NULL);
if (strW == NULL) {
return size;
}
VERIFY(::SelectObject(hDC, awtFont->GetHFont()));
if (AwtComponent::GetRTLReadingOrder()){
VERIFY(!draw || ::ExtTextOut(hDC, x, y, ETO_RTLREADING, NULL,
......@@ -692,6 +717,9 @@ SIZE AwtFont::DrawStringSize_sub(jstring str, HDC hDC,
}
int fdIndex = getFontDescriptorNumber(env, font, fontDescriptor);
if (env->ExceptionCheck()) {
return size; //fdIndex==0 return could be exception or not.
}
VERIFY(::SelectObject(hDC, awtFont->GetHFont(fdIndex)));
/*
......@@ -705,10 +733,14 @@ SIZE AwtFont::DrawStringSize_sub(jstring str, HDC hDC,
* extend buflen and bad things will happen.
*/
unsigned char* buffer = NULL;
jboolean unicodeUsed = env->GetBooleanField(fontDescriptor, AwtFont::useUnicodeID);
jboolean unicodeUsed =
env->GetBooleanField(fontDescriptor, AwtFont::useUnicodeID);
try {
buffer = (unsigned char *)
env->GetPrimitiveArrayCritical(convertedBytes, 0);
if (buffer == NULL) {
return size;
}
int buflen = (buffer[0] << 24) | (buffer[1] << 16) |
(buffer[2] << 8) | buffer[3];
......@@ -816,8 +848,11 @@ Java_sun_awt_windows_WFontMetrics_charsWidth(JNIEnv *env, jobject self,
jchar *strp = new jchar[len];
env->GetCharArrayRegion(str, off, len, strp);
jstring jstr = env->NewString(strp, len);
jint result = Java_sun_awt_windows_WFontMetrics_stringWidth(env, self,
jint result = 0;
if (jstr != NULL) {
result = Java_sun_awt_windows_WFontMetrics_stringWidth(env, self,
jstr);
}
delete [] strp;
return result;
......@@ -850,13 +885,25 @@ Java_sun_awt_windows_WFontMetrics_bytesWidth(JNIEnv *env, jobject self,
try {
jintArray array = (jintArray)env->GetObjectField(self,
AwtFont::widthsID);
if (array == NULL) {
JNU_ThrowNullPointerException(env, "Can't access widths array.");
return NULL;
}
pStrBody = (char *)env->GetPrimitiveArrayCritical(str, 0);
if (pStrBody == NULL) {
JNU_ThrowNullPointerException(env, "Can't access str bytes.");
return NULL;
}
char *pStr = pStrBody + off;
jint *widths = NULL;
try {
widths = (jint *)env->GetPrimitiveArrayCritical(array, 0);
if (widths == NULL) {
env->ReleasePrimitiveArrayCritical(str, pStrBody, 0);
JNU_ThrowNullPointerException(env, "Can't access widths.");
return NULL;
}
for (; len; len--) {
result += widths[*pStr++];
}
......@@ -915,29 +962,15 @@ Java_sun_awt_windows_WFontMetrics_init(JNIEnv *env, jobject self)
JNIEXPORT void JNICALL
Java_sun_awt_windows_WFontMetrics_initIDs(JNIEnv *env, jclass cls)
{
TRY;
AwtFont::widthsID = env->GetFieldID(cls, "widths", "[I");
AwtFont::ascentID = env->GetFieldID(cls, "ascent", "I");
AwtFont::descentID = env->GetFieldID(cls, "descent", "I");
AwtFont::leadingID = env->GetFieldID(cls, "leading", "I");
AwtFont::heightID = env->GetFieldID(cls, "height", "I");
AwtFont::maxAscentID = env->GetFieldID(cls, "maxAscent", "I");
AwtFont::maxDescentID = env->GetFieldID(cls, "maxDescent", "I");
AwtFont::maxHeightID = env->GetFieldID(cls, "maxHeight", "I");
CHECK_NULL(AwtFont::widthsID = env->GetFieldID(cls, "widths", "[I"));
CHECK_NULL(AwtFont::ascentID = env->GetFieldID(cls, "ascent", "I"));
CHECK_NULL(AwtFont::descentID = env->GetFieldID(cls, "descent", "I"));
CHECK_NULL(AwtFont::leadingID = env->GetFieldID(cls, "leading", "I"));
CHECK_NULL(AwtFont::heightID = env->GetFieldID(cls, "height", "I"));
CHECK_NULL(AwtFont::maxAscentID = env->GetFieldID(cls, "maxAscent", "I"));
CHECK_NULL(AwtFont::maxDescentID = env->GetFieldID(cls, "maxDescent", "I"));
CHECK_NULL(AwtFont::maxHeightID = env->GetFieldID(cls, "maxHeight", "I"));
AwtFont::maxAdvanceID = env->GetFieldID(cls, "maxAdvance", "I");
DASSERT(AwtFont::widthsID != NULL);
DASSERT(AwtFont::ascentID != NULL);
DASSERT(AwtFont::descentID != NULL);
DASSERT(AwtFont::leadingID != NULL);
DASSERT(AwtFont::heightID != NULL);
DASSERT(AwtFont::maxAscentID != NULL);
DASSERT(AwtFont::maxDescentID != NULL);
DASSERT(AwtFont::maxHeightID != NULL);
DASSERT(AwtFont::maxAdvanceID != NULL);
CATCH_BAD_ALLOC;
}
} /* extern "C" */
......@@ -952,28 +985,16 @@ extern "C" {
JNIEXPORT void JNICALL
Java_java_awt_Font_initIDs(JNIEnv *env, jclass cls)
{
TRY;
AwtFont::peerMID = env->GetMethodID(cls, "getPeer",
"()Ljava/awt/peer/FontPeer;");
AwtFont::pDataID = env->GetFieldID(cls, "pData", "J");
AwtFont::nameID = env->GetFieldID(cls, "name", "Ljava/lang/String;");
AwtFont::sizeID = env->GetFieldID(cls, "size", "I");
AwtFont::styleID = env->GetFieldID(cls, "style", "I");
CHECK_NULL(AwtFont::peerMID = env->GetMethodID(cls, "getPeer",
"()Ljava/awt/peer/FontPeer;"));
CHECK_NULL(AwtFont::pDataID = env->GetFieldID(cls, "pData", "J"));
CHECK_NULL(AwtFont::nameID =
env->GetFieldID(cls, "name", "Ljava/lang/String;"));
CHECK_NULL(AwtFont::sizeID = env->GetFieldID(cls, "size", "I"));
CHECK_NULL(AwtFont::styleID = env->GetFieldID(cls, "style", "I"));
AwtFont::getFontMID =
env->GetStaticMethodID(cls, "getFont",
"(Ljava/lang/String;)Ljava/awt/Font;");
DASSERT(AwtFont::peerMID != NULL);
DASSERT(AwtFont::pDataID != NULL);
DASSERT(AwtFont::nameID != NULL);
DASSERT(AwtFont::sizeID != NULL);
DASSERT(AwtFont::styleID != NULL);
DASSERT(AwtFont::getFontMID != NULL);
CATCH_BAD_ALLOC;
}
} /* extern "C" */
......@@ -988,15 +1009,9 @@ extern "C" {
JNIEXPORT void JNICALL
Java_java_awt_FontMetrics_initIDs(JNIEnv *env, jclass cls)
{
TRY;
AwtFont::fontID = env->GetFieldID(cls, "font", "Ljava/awt/Font;");
CHECK_NULL(AwtFont::fontID =
env->GetFieldID(cls, "font", "Ljava/awt/Font;"));
AwtFont::getHeightMID = env->GetMethodID(cls, "getHeight", "()I");
DASSERT(AwtFont::fontID);
DASSERT(AwtFont::getHeightMID);
CATCH_BAD_ALLOC;
}
} /* extern "C" */
......@@ -1010,16 +1025,10 @@ extern "C" {
JNIEXPORT void JNICALL
Java_sun_awt_FontDescriptor_initIDs(JNIEnv *env, jclass cls)
{
TRY;
AwtFont::nativeNameID = env->GetFieldID(cls, "nativeName",
"Ljava/lang/String;");
CHECK_NULL(AwtFont::nativeNameID =
env->GetFieldID(cls, "nativeName", "Ljava/lang/String;"));
AwtFont::useUnicodeID = env->GetFieldID(cls, "useUnicode", "Z");
DASSERT(AwtFont::nativeNameID != NULL);
DASSERT(AwtFont::useUnicodeID != NULL);
CATCH_BAD_ALLOC;
}
} /* extern "C" */
......@@ -1034,20 +1043,13 @@ extern "C" {
JNIEXPORT void JNICALL
Java_sun_awt_PlatformFont_initIDs(JNIEnv *env, jclass cls)
{
TRY;
AwtFont::fontConfigID = env->GetFieldID(cls, "fontConfig", "Lsun/awt/FontConfiguration;");
AwtFont::componentFontsID =
env->GetFieldID(cls, "componentFonts", "[Lsun/awt/FontDescriptor;");
CHECK_NULL(AwtFont::fontConfigID =
env->GetFieldID(cls, "fontConfig", "Lsun/awt/FontConfiguration;"));
CHECK_NULL(AwtFont::componentFontsID =
env->GetFieldID(cls, "componentFonts", "[Lsun/awt/FontDescriptor;"));
AwtFont::makeConvertedMultiFontStringMID =
env->GetMethodID(cls, "makeConvertedMultiFontString",
"(Ljava/lang/String;)[Ljava/lang/Object;");
DASSERT(AwtFont::makeConvertedMultiFontStringMID != NULL);
DASSERT(AwtFont::componentFontsID != NULL);
DASSERT(AwtFont::fontConfigID != NULL);
CATCH_BAD_ALLOC;
}
} /* extern "C" */
......@@ -1862,8 +1864,10 @@ Java_sun_awt_windows_WDefaultFontCharset_canConvert(JNIEnv *env, jobject self,
static CCombinedSegTableManager tableManager;
jstring fontName = (jstring)env->GetObjectField(self, AwtFont::fontNameID);
DASSERT(fontName != NULL);
DASSERT(fontName != NULL); // leave in for debug mode.
CHECK_NULL_RETURN(fontName, FALSE); // in production, just return
LPCWSTR fontNameW = JNU_GetStringPlatformChars(env, fontName, NULL);
CHECK_NULL_RETURN(fontNameW, FALSE);
CCombinedSegTable* pTable = tableManager.GetTable(fontNameW);
JNU_ReleaseStringPlatformChars(env, fontName, fontNameW);
return (pTable->In((USHORT) ch) ? JNI_TRUE : JNI_FALSE);
......
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, 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
......@@ -233,107 +233,166 @@ void AwtPrintControl::initIDs(JNIEnv *env, jclass cls)
TRY;
jclass cls = env->FindClass("sun/awt/windows/WPrinterJob");
CHECK_NULL(cls);
AwtPrintControl::dialogOwnerPeerID =
env->GetFieldID(cls, "dialogOwnerPeer", "Ljava/awt/peer/ComponentPeer;");
DASSERT(AwtPrintControl::dialogOwnerPeerID != NULL);
CHECK_NULL(AwtPrintControl::dialogOwnerPeerID);
AwtPrintControl::getPrintDCID = env->GetMethodID(cls, "getPrintDC", "()J");
DASSERT(AwtPrintControl::getPrintDCID != NULL);
CHECK_NULL(AwtPrintControl::getPrintDCID);
AwtPrintControl::setPrintDCID =
env->GetMethodID(cls, "setPrintDC", "(J)V");
DASSERT(AwtPrintControl::setPrintDCID != NULL);
CHECK_NULL(AwtPrintControl::setPrintDCID);
AwtPrintControl::getDevmodeID = env->GetMethodID(cls, "getDevMode", "()J");
DASSERT(AwtPrintControl::getDevmodeID != NULL);
CHECK_NULL(AwtPrintControl::getDevmodeID);
AwtPrintControl::setDevmodeID =
env->GetMethodID(cls, "setDevMode", "(J)V");
DASSERT(AwtPrintControl::setDevmodeID != NULL);
CHECK_NULL(AwtPrintControl::setDevmodeID);
AwtPrintControl::getDevnamesID =
env->GetMethodID(cls, "getDevNames", "()J");
DASSERT(AwtPrintControl::getDevnamesID != NULL);
CHECK_NULL(AwtPrintControl::getDevnamesID);
AwtPrintControl::setDevnamesID =
env->GetMethodID(cls, "setDevNames", "(J)V");
DASSERT(AwtPrintControl::setDevnamesID != NULL);
CHECK_NULL(AwtPrintControl::setDevnamesID);
AwtPrintControl::driverDoesMultipleCopiesID =
env->GetFieldID(cls, "driverDoesMultipleCopies", "Z");
DASSERT(AwtPrintControl::driverDoesMultipleCopiesID != NULL);
CHECK_NULL(AwtPrintControl::driverDoesMultipleCopiesID);
AwtPrintControl::driverDoesCollationID =
env->GetFieldID(cls, "driverDoesCollation", "Z");
DASSERT(AwtPrintControl::driverDoesCollationID != NULL);
CHECK_NULL(AwtPrintControl::driverDoesCollationID);
AwtPrintControl::getCopiesID =
env->GetMethodID(cls, "getCopiesAttrib", "()I");
DASSERT(AwtPrintControl::getCopiesID != NULL);
CHECK_NULL(AwtPrintControl::getCopiesID);
AwtPrintControl::getCollateID =
env->GetMethodID(cls, "getCollateAttrib","()I");
DASSERT(AwtPrintControl::getCollateID != NULL);
CHECK_NULL(AwtPrintControl::getCollateID);
AwtPrintControl::getOrientID =
env->GetMethodID(cls, "getOrientAttrib", "()I");
DASSERT(AwtPrintControl::getOrientID != NULL);
CHECK_NULL(AwtPrintControl::getOrientID);
AwtPrintControl::getFromPageID =
env->GetMethodID(cls, "getFromPageAttrib", "()I");
DASSERT(AwtPrintControl::getFromPageID != NULL);
CHECK_NULL(AwtPrintControl::getFromPageID);
AwtPrintControl::getToPageID =
env->GetMethodID(cls, "getToPageAttrib", "()I");
DASSERT(AwtPrintControl::getToPageID != NULL);
CHECK_NULL(AwtPrintControl::getToPageID);
AwtPrintControl::getMinPageID =
env->GetMethodID(cls, "getMinPageAttrib", "()I");
DASSERT(AwtPrintControl::getMinPageID != NULL);
CHECK_NULL(AwtPrintControl::getMinPageID);
AwtPrintControl::getMaxPageID =
env->GetMethodID(cls, "getMaxPageAttrib", "()I");
DASSERT(AwtPrintControl::getMaxPageID != NULL);
CHECK_NULL(AwtPrintControl::getMaxPageID);
AwtPrintControl::getDestID =
env->GetMethodID(cls, "getDestAttrib", "()Z");
DASSERT(AwtPrintControl::getDestID != NULL);
CHECK_NULL(AwtPrintControl::getDestID);
AwtPrintControl::getQualityID =
env->GetMethodID(cls, "getQualityAttrib", "()I");
DASSERT(AwtPrintControl::getQualityID != NULL);
CHECK_NULL(AwtPrintControl::getQualityID);
AwtPrintControl::getColorID =
env->GetMethodID(cls, "getColorAttrib", "()I");
DASSERT(AwtPrintControl::getColorID != NULL);
CHECK_NULL(AwtPrintControl::getColorID);
AwtPrintControl::getSidesID =
env->GetMethodID(cls, "getSidesAttrib", "()I");
DASSERT(AwtPrintControl::getSidesID != NULL);
CHECK_NULL(AwtPrintControl::getSidesID);
AwtPrintControl::getPrinterID =
env->GetMethodID(cls, "getPrinterAttrib", "()Ljava/lang/String;");
DASSERT(AwtPrintControl::getPrinterID != NULL);
CHECK_NULL(AwtPrintControl::getPrinterID);
AwtPrintControl::getWin32MediaID =
env->GetMethodID(cls, "getWin32MediaAttrib", "()[I");
DASSERT(AwtPrintControl::getWin32MediaID != NULL);
CHECK_NULL(AwtPrintControl::getWin32MediaID);
AwtPrintControl::setWin32MediaID =
env->GetMethodID(cls, "setWin32MediaAttrib", "(III)V");
DASSERT(AwtPrintControl::setWin32MediaID != NULL);
CHECK_NULL(AwtPrintControl::setWin32MediaID);
AwtPrintControl::getWin32MediaTrayID =
env->GetMethodID(cls, "getMediaTrayAttrib", "()I");
DASSERT(AwtPrintControl::getWin32MediaTrayID != NULL);
CHECK_NULL(AwtPrintControl::getWin32MediaTrayID);
AwtPrintControl::setWin32MediaTrayID =
env->GetMethodID(cls, "setMediaTrayAttrib", "(I)V");
DASSERT(AwtPrintControl::setWin32MediaTrayID != NULL);
CHECK_NULL(AwtPrintControl::setWin32MediaTrayID);
AwtPrintControl::getSelectID =
env->GetMethodID(cls, "getSelectAttrib", "()I");
DASSERT(AwtPrintControl::getSelectID != NULL);
CHECK_NULL(AwtPrintControl::getSelectID);
AwtPrintControl::getPrintToFileEnabledID =
env->GetMethodID(cls, "getPrintToFileEnabled", "()Z");
DASSERT(AwtPrintControl::getPrintToFileEnabledID != NULL);
CHECK_NULL(AwtPrintControl::getPrintToFileEnabledID);
AwtPrintControl::setNativeAttID =
env->GetMethodID(cls, "setNativeAttributes", "(III)V");
DASSERT(AwtPrintControl::setNativeAttID != NULL);
CHECK_NULL(AwtPrintControl::setNativeAttID);
AwtPrintControl::setRangeCopiesID =
env->GetMethodID(cls, "setRangeCopiesAttribute", "(IIZI)V");
DASSERT(AwtPrintControl::setRangeCopiesID != NULL);
CHECK_NULL(AwtPrintControl::setRangeCopiesID);
AwtPrintControl::setResID =
env->GetMethodID(cls, "setResolutionDPI", "(II)V");
DASSERT(AwtPrintControl::setResID != NULL);
CHECK_NULL(AwtPrintControl::setResID);
AwtPrintControl::setPrinterID =
env->GetMethodID(cls, "setPrinterNameAttrib", "(Ljava/lang/String;)V");
DASSERT(AwtPrintControl::setPrinterID != NULL);
CHECK_NULL(AwtPrintControl::setPrinterID);
AwtPrintControl::setJobAttributesID =
env->GetMethodID(cls, "setJobAttributes",
"(Ljavax/print/attribute/PrintRequestAttributeSet;IISSSSSSS)V");
DASSERT(AwtPrintControl::driverDoesMultipleCopiesID != NULL);
DASSERT(AwtPrintControl::getPrintDCID != NULL);
DASSERT(AwtPrintControl::setPrintDCID != NULL);
DASSERT(AwtPrintControl::getDevmodeID != NULL);
DASSERT(AwtPrintControl::setDevmodeID != NULL);
DASSERT(AwtPrintControl::getDevnamesID != NULL);
DASSERT(AwtPrintControl::setDevnamesID != NULL);
DASSERT(AwtPrintControl::driverDoesCollationID != NULL);
DASSERT(AwtPrintControl::getWin32MediaID != NULL);
DASSERT(AwtPrintControl::setWin32MediaID != NULL);
DASSERT(AwtPrintControl::getWin32MediaTrayID != NULL);
DASSERT(AwtPrintControl::setWin32MediaTrayID != NULL);
DASSERT(AwtPrintControl::setRangeCopiesID != NULL);
DASSERT(AwtPrintControl::setResID != NULL);
DASSERT(AwtPrintControl::setNativeAttID != NULL);
DASSERT(AwtPrintControl::dialogOwnerPeerID != NULL);
DASSERT(AwtPrintControl::getCopiesID != NULL);
DASSERT(AwtPrintControl::getOrientID != NULL);
DASSERT(AwtPrintControl::getPrinterID != NULL);
DASSERT(AwtPrintControl::getCollateID != NULL);
DASSERT(AwtPrintControl::getFromPageID != NULL);
DASSERT(AwtPrintControl::getToPageID != NULL);
DASSERT(AwtPrintControl::getMinPageID != NULL);
DASSERT(AwtPrintControl::getMaxPageID != NULL);
DASSERT(AwtPrintControl::getDestID != NULL);
DASSERT(AwtPrintControl::getQualityID != NULL);
DASSERT(AwtPrintControl::getColorID != NULL);
DASSERT(AwtPrintControl::getSidesID != NULL);
DASSERT(AwtPrintControl::getSelectID != NULL);
DASSERT(AwtPrintControl::getPrintToFileEnabledID != NULL);
DASSERT(AwtPrintControl::setJobAttributesID != NULL);
CHECK_NULL(AwtPrintControl::setJobAttributesID);
CATCH_BAD_ALLOC;
}
......@@ -606,6 +665,10 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
LPTSTR getName = (LPTSTR)JNU_GetStringPlatformChars(env,
printerName, NULL);
if (getName == NULL) {
env->DeleteLocalRef(printerName);
throw std::bad_alloc();
}
BOOL samePrinter = FALSE;
......@@ -652,6 +715,7 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
if (portName != NULL) {
free(portName);
}
env->DeleteLocalRef(printerName);
return FALSE;
}
......@@ -664,11 +728,13 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
if (portName != NULL) {
free(portName);
}
env->DeleteLocalRef(printerName);
return FALSE;
}
delete [] buffer;
}
env->DeleteLocalRef(printerName);
// PrintDlg may change the values of hDevMode and hDevNames so we
// re-initialize our saved handles.
AwtPrintControl::setPrintHDMode(env, printCtrl, NULL);
......
......@@ -204,11 +204,24 @@ Java_sun_awt_windows_WPrintDialogPeer__1show(JNIEnv *env, jobject peer)
// as peer object is used later on another thread, create a global ref
jobject peerGlobalRef = env->NewGlobalRef(peer);
DASSERT(peerGlobalRef != NULL);
CHECK_NULL_RETURN(peerGlobalRef, 0);
jobject target = env->GetObjectField(peerGlobalRef, AwtObject::targetID);
DASSERT(target != NULL);
if (target == NULL) {
env->DeleteGlobalRef(peerGlobalRef);
return 0;
}
jobject parent = env->GetObjectField(peerGlobalRef, AwtPrintDialog::parentID);
jobject control = env->GetObjectField(target, AwtPrintDialog::controlID);
DASSERT(control != NULL);
if (control == NULL) {
env->DeleteGlobalRef(peerGlobalRef);
env->DeleteLocalRef(target);
if (parent != NULL) {
env->DeleteLocalRef(parent);
}
return 0;
}
AwtComponent *awtParent = (parent != NULL) ? (AwtComponent *)JNI_GET_PDATA(parent) : NULL;
HWND hwndOwner = awtParent ? awtParent->GetHWnd() : NULL;
......@@ -217,7 +230,18 @@ Java_sun_awt_windows_WPrintDialogPeer__1show(JNIEnv *env, jobject peer)
memset(&pd, 0, sizeof(PRINTDLG));
pd.lStructSize = sizeof(PRINTDLG);
pd.lCustData = (LPARAM)peerGlobalRef;
BOOL ret = AwtPrintControl::InitPrintDialog(env, control, pd);
BOOL ret;
try {
ret = AwtPrintControl::InitPrintDialog(env, control, pd);
} catch (std::bad_alloc&) {
env->DeleteGlobalRef(peerGlobalRef);
env->DeleteLocalRef(target);
if (parent != NULL) {
env->DeleteLocalRef(parent);
}
env->DeleteLocalRef(control);
throw;
}
if (!ret) {
/* Couldn't use the printer, or spooler isn't running
* Call Page dialog with ' PD_RETURNDEFAULT' so it doesn't try
......
......@@ -149,7 +149,7 @@ void
handle_bad_alloc(void) {
if (jvm != NULL) {
JNIEnv* env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
if (env != NULL) {
if (env != NULL && !env->ExceptionCheck()) {
JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
}
}
......
/*
* Copyright (c) 2014, 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 java.util.Set;
import java.util.SortedSet;
import static java.beans.Introspector.getBeanInfo;
/*
* @test
* @bug 8039776
* @summary Tests that Introspector does not throw NPE
* @author Sergey Malenkov
*/
public class Test8039776 {
public static void main(String[] args) throws Exception {
getBeanInfo(Base.class, Object.class);
getBeanInfo(Child.class, Base.class);
getBeanInfo(Child.class, Object.class);
}
public static class Base {
private SortedSet<Object> value;
public Set<Object> getValue() {
return this.value;
}
public void setValue(SortedSet<Object> value) {
this.value = value;
}
}
public static class Child extends Base {
public Set<Object> getValue() {
return super.getValue();
}
public void setValue(SortedSet<Object> items) {
super.setValue(items);
}
}
}
......@@ -88,11 +88,10 @@ import static java.time.temporal.ChronoUnit.WEEKS;
import static java.time.temporal.ChronoUnit.YEARS;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.time.Clock;
import java.time.DateTimeException;
import java.time.Duration;
......@@ -120,6 +119,7 @@ import java.time.temporal.TemporalQueries;
import java.time.temporal.TemporalQuery;
import java.time.temporal.TemporalUnit;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
......@@ -760,7 +760,7 @@ public class TCKLocalTime extends AbstractDateTimeTest {
}
//-----------------------------------------------------------------------
// with()
// with(TemporalAdjuster)
//-----------------------------------------------------------------------
@Test
public void test_with_adjustment() {
......@@ -779,6 +779,331 @@ public class TCKLocalTime extends AbstractDateTimeTest {
TEST_12_30_40_987654321.with((TemporalAdjuster) null);
}
//-----------------------------------------------------------------------
// with(TemporalField, long)
//-----------------------------------------------------------------------
private long[] testPoints(long max) {
long[] points = new long[9];
points[0] = 0;
points[1] = 1;
points[2] = 2;
points[3] = max / 7;
points[4] = (max / 7) * 2;
points[5] = (max / 2);
points[6] = (max / 7) * 6;;
points[7] = max - 2;
points[8] = max - 1;
return points;
}
// Returns a {@code LocalTime} with the specified nano-of-second.
// The hour, minute and second will be unchanged.
@Test
public void test_with_longTemporalField_nanoOfSecond() {
for (long i : testPoints(1_000_000_000L)) {
LocalTime test = TEST_12_30_40_987654321.with(NANO_OF_SECOND, i);
assertEquals(test.get(NANO_OF_SECOND), i);
assertEquals(test.get(HOUR_OF_DAY), TEST_12_30_40_987654321.get(HOUR_OF_DAY));
assertEquals(test.get(MINUTE_OF_HOUR), TEST_12_30_40_987654321.get(MINUTE_OF_HOUR));
assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
}
}
// Returns a {@code LocalTime} with the specified nano-of-day.
// This completely replaces the time and is equivalent to {@link #ofNanoOfDay(long)}.
@Test
public void test_with_longTemporalField_nanoOfDay() {
for (long i : testPoints(86_400_000_000_000L)) {
LocalTime test = TEST_12_30_40_987654321.with(NANO_OF_DAY, i);
assertEquals(test, LocalTime.ofNanoOfDay(i));
}
}
// Returns a {@code LocalTime} with the nano-of-second replaced by the specified
// micro-of-second multiplied by 1,000.
// The hour, minute and second will be unchanged.
@Test
public void test_with_longTemporalField_microOfSecond() {
for (long i : testPoints(1_000_000L)) {
LocalTime test = TEST_12_30_40_987654321.with(MICRO_OF_SECOND, i);
assertEquals(test.get(NANO_OF_SECOND), i * 1_000);
assertEquals(test.get(HOUR_OF_DAY), TEST_12_30_40_987654321.get(HOUR_OF_DAY));
assertEquals(test.get(MINUTE_OF_HOUR), TEST_12_30_40_987654321.get(MINUTE_OF_HOUR));
assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
}
}
// Returns a {@code LocalTime} with the specified micro-of-day.
// This completely replaces the time and is equivalent to using {@link #ofNanoOfDay(long)}
// with the micro-of-day multiplied by 1,000.
@Test
public void test_with_longTemporalField_microOfDay() {
for (long i : testPoints(86_400_000_000L)) {
LocalTime test = TEST_12_30_40_987654321.with(MICRO_OF_DAY, i);
assertEquals(test, LocalTime.ofNanoOfDay(i * 1000));
}
}
// Returns a {@code LocalTime} with the nano-of-second replaced by the specified
// milli-of-second multiplied by 1,000,000.
// The hour, minute and second will be unchanged.
@Test
public void test_with_longTemporalField_milliOfSecond() {
for (long i : testPoints(1_000L)) {
LocalTime test = TEST_12_30_40_987654321.with(MILLI_OF_SECOND, i);
assertEquals(test.get(NANO_OF_SECOND), i * 1_000_000);
assertEquals(test.get(HOUR_OF_DAY), TEST_12_30_40_987654321.get(HOUR_OF_DAY));
assertEquals(test.get(MINUTE_OF_HOUR), TEST_12_30_40_987654321.get(MINUTE_OF_HOUR));
assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
}
}
// Returns a {@code LocalTime} with the specified milli-of-day.
// This completely replaces the time and is equivalent to using {@link #ofNanoOfDay(long)}
// with the milli-of-day multiplied by 1,000,000.
@Test
public void test_with_longTemporalField_milliOfDay() {
for (long i : testPoints(86_400_000L)) {
LocalTime test = TEST_12_30_40_987654321.with(MILLI_OF_DAY, i);
assertEquals(test, LocalTime.ofNanoOfDay(i * 1_000_000));
}
}
// Returns a {@code LocalTime} with the specified second-of-minute.
// The hour, minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_secondOfMinute() {
for (long i : testPoints(60L)) {
LocalTime test = TEST_12_30_40_987654321.with(SECOND_OF_MINUTE, i);
assertEquals(test.get(SECOND_OF_MINUTE), i);
assertEquals(test.get(HOUR_OF_DAY), TEST_12_30_40_987654321.get(HOUR_OF_DAY));
assertEquals(test.get(MINUTE_OF_HOUR), TEST_12_30_40_987654321.get(MINUTE_OF_HOUR));
assertEquals(test.get(NANO_OF_SECOND), TEST_12_30_40_987654321.get(NANO_OF_SECOND));
}
}
// Returns a {@code LocalTime} with the specified second-of-day.
// The nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_secondOfDay() {
for (long i : testPoints(24 * 60 * 60)) {
LocalTime test = TEST_12_30_40_987654321.with(SECOND_OF_DAY, i);
assertEquals(test.get(SECOND_OF_DAY), i);
assertEquals(test.get(NANO_OF_SECOND), TEST_12_30_40_987654321.get(NANO_OF_SECOND));
}
}
// Returns a {@code LocalTime} with the specified minute-of-hour.
// The hour, second-of-minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_minuteOfHour() {
for (long i : testPoints(60)) {
LocalTime test = TEST_12_30_40_987654321.with(MINUTE_OF_HOUR, i);
assertEquals(test.get(MINUTE_OF_HOUR), i);
assertEquals(test.get(HOUR_OF_DAY), TEST_12_30_40_987654321.get(HOUR_OF_DAY));
assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
assertEquals(test.get(NANO_OF_SECOND), TEST_12_30_40_987654321.get(NANO_OF_SECOND));
}
}
// Returns a {@code LocalTime} with the specified minute-of-day.
// The second-of-minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_minuteOfDay() {
for (long i : testPoints(24 * 60)) {
LocalTime test = TEST_12_30_40_987654321.with(MINUTE_OF_DAY, i);
assertEquals(test.get(MINUTE_OF_DAY), i);
assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
assertEquals(test.get(NANO_OF_SECOND), TEST_12_30_40_987654321.get(NANO_OF_SECOND));
}
}
// Returns a {@code LocalTime} with the specified hour-of-am-pm.
// The AM/PM, minute-of-hour, second-of-minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_hourOfAmPm() {
for (int i = 0; i < 12; i++) {
LocalTime test = TEST_12_30_40_987654321.with(HOUR_OF_AMPM, i);
assertEquals(test.get(HOUR_OF_AMPM), i);
assertEquals(test.get(AMPM_OF_DAY), TEST_12_30_40_987654321.get(AMPM_OF_DAY));
assertEquals(test.get(MINUTE_OF_HOUR), TEST_12_30_40_987654321.get(MINUTE_OF_HOUR));
assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
assertEquals(test.get(NANO_OF_SECOND), TEST_12_30_40_987654321.get(NANO_OF_SECOND));
}
}
// Returns a {@code LocalTime} with the specified clock-hour-of-am-pm.
// The AM/PM, minute-of-hour, second-of-minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_clockHourOfAmPm() {
for (int i = 1; i <= 12; i++) {
LocalTime test = TEST_12_30_40_987654321.with(CLOCK_HOUR_OF_AMPM, i);
assertEquals(test.get(CLOCK_HOUR_OF_AMPM), i);
assertEquals(test.get(AMPM_OF_DAY), TEST_12_30_40_987654321.get(AMPM_OF_DAY));
assertEquals(test.get(MINUTE_OF_HOUR), TEST_12_30_40_987654321.get(MINUTE_OF_HOUR));
assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
assertEquals(test.get(NANO_OF_SECOND), TEST_12_30_40_987654321.get(NANO_OF_SECOND));
}
}
// Returns a {@code LocalTime} with the specified hour-of-day.
// The minute-of-hour, second-of-minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_hourOfDay() {
for (int i = 0; i < 24; i++) {
LocalTime test = TEST_12_30_40_987654321.with(HOUR_OF_DAY, i);
assertEquals(test.get(HOUR_OF_DAY), i);
assertEquals(test.get(MINUTE_OF_HOUR), TEST_12_30_40_987654321.get(MINUTE_OF_HOUR));
assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
assertEquals(test.get(NANO_OF_SECOND), TEST_12_30_40_987654321.get(NANO_OF_SECOND));
}
}
// Returns a {@code LocalTime} with the specified clock-hour-of-day.
// The minute-of-hour, second-of-minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_clockHourOfDay() {
for (int i = 1; i <= 24; i++) {
LocalTime test = TEST_12_30_40_987654321.with(CLOCK_HOUR_OF_DAY, i);
assertEquals(test.get(CLOCK_HOUR_OF_DAY), i);
assertEquals(test.get(MINUTE_OF_HOUR), TEST_12_30_40_987654321.get(MINUTE_OF_HOUR));
assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
assertEquals(test.get(NANO_OF_SECOND), TEST_12_30_40_987654321.get(NANO_OF_SECOND));
}
}
// Returns a {@code LocalTime} with the specified AM/PM.
// The hour-of-am-pm, minute-of-hour, second-of-minute and nano-of-second will be unchanged.
@Test
public void test_with_longTemporalField_amPmOfDay() {
for (int i = 0; i <= 1; i++) {
LocalTime test = TEST_12_30_40_987654321.with(AMPM_OF_DAY, i);
assertEquals(test.get(AMPM_OF_DAY), i);
assertEquals(test.get(HOUR_OF_AMPM), TEST_12_30_40_987654321.get(HOUR_OF_AMPM));
assertEquals(test.get(MINUTE_OF_HOUR), TEST_12_30_40_987654321.get(MINUTE_OF_HOUR));
assertEquals(test.get(SECOND_OF_MINUTE), TEST_12_30_40_987654321.get(SECOND_OF_MINUTE));
assertEquals(test.get(NANO_OF_SECOND), TEST_12_30_40_987654321.get(NANO_OF_SECOND));
}
}
// The supported fields behave as follows...
// In all cases, if the new value is outside the valid range of values for the field
// then a {@code DateTimeException} will be thrown.
@DataProvider(name = "withTemporalField_outOfRange")
Object[][] data_withTemporalField_outOfRange() {
return new Object[][] {
{NANO_OF_SECOND, time(0, 0, 0, 0), NANO_OF_SECOND.range().getMinimum() - 1},
{NANO_OF_SECOND, time(0, 0, 0, 0), NANO_OF_SECOND.range().getMaximum() + 1},
{NANO_OF_DAY, time(0, 0, 0, 0), NANO_OF_DAY.range().getMinimum() - 1},
{NANO_OF_DAY, time(0, 0, 0, 0), NANO_OF_DAY.range().getMaximum() + 1},
{MICRO_OF_SECOND, time(0, 0, 0, 0), MICRO_OF_SECOND.range().getMinimum() - 1},
{MICRO_OF_SECOND, time(0, 0, 0, 0), MICRO_OF_SECOND.range().getMaximum() + 1},
{MICRO_OF_DAY, time(0, 0, 0, 0), MICRO_OF_DAY.range().getMinimum() - 1},
{MICRO_OF_DAY, time(0, 0, 0, 0), MICRO_OF_DAY.range().getMaximum() + 1},
{MILLI_OF_SECOND, time(0, 0, 0, 0), MILLI_OF_SECOND.range().getMinimum() - 1},
{MILLI_OF_SECOND, time(0, 0, 0, 0), MILLI_OF_SECOND.range().getMaximum() + 1},
{MILLI_OF_DAY, time(0, 0, 0, 0), MILLI_OF_DAY.range().getMinimum() - 1},
{MILLI_OF_DAY, time(0, 0, 0, 0), MILLI_OF_DAY.range().getMaximum() + 1},
{SECOND_OF_MINUTE, time(0, 0, 0, 0), SECOND_OF_MINUTE.range().getMinimum() - 1},
{SECOND_OF_MINUTE, time(0, 0, 0, 0), SECOND_OF_MINUTE.range().getMaximum() + 1},
{SECOND_OF_DAY, time(0, 0, 0, 0), SECOND_OF_DAY.range().getMinimum() - 1},
{SECOND_OF_DAY, time(0, 0, 0, 0), SECOND_OF_DAY.range().getMaximum() + 1},
{MINUTE_OF_HOUR, time(0, 0, 0, 0), MINUTE_OF_HOUR.range().getMinimum() - 1},
{MINUTE_OF_HOUR, time(0, 0, 0, 0), MINUTE_OF_HOUR.range().getMaximum() + 1},
{MINUTE_OF_DAY, time(0, 0, 0, 0), MINUTE_OF_DAY.range().getMinimum() - 1},
{MINUTE_OF_DAY, time(0, 0, 0, 0), MINUTE_OF_DAY.range().getMaximum() + 1},
{HOUR_OF_AMPM, time(0, 0, 0, 0), HOUR_OF_AMPM.range().getMinimum() - 1},
{HOUR_OF_AMPM, time(0, 0, 0, 0), HOUR_OF_AMPM.range().getMaximum() + 1},
{CLOCK_HOUR_OF_AMPM, time(0, 0, 0, 0), CLOCK_HOUR_OF_AMPM.range().getMinimum() - 1},
{CLOCK_HOUR_OF_AMPM, time(0, 0, 0, 0), CLOCK_HOUR_OF_AMPM.range().getMaximum() + 1},
{HOUR_OF_DAY, time(0, 0, 0, 0), HOUR_OF_DAY.range().getMinimum() - 1},
{HOUR_OF_DAY, time(0, 0, 0, 0), HOUR_OF_DAY.range().getMaximum() + 1},
{CLOCK_HOUR_OF_DAY, time(0, 0, 0, 0), CLOCK_HOUR_OF_DAY.range().getMinimum() - 1},
{CLOCK_HOUR_OF_DAY, time(0, 0, 0, 0), CLOCK_HOUR_OF_DAY.range().getMaximum() + 1},
{AMPM_OF_DAY, time(0, 0, 0, 0), AMPM_OF_DAY.range().getMinimum() - 1},
{AMPM_OF_DAY, time(0, 0, 0, 0), AMPM_OF_DAY.range().getMaximum() + 1},
};
}
@Test(dataProvider = "withTemporalField_outOfRange")
public void test_with_longTemporalField_invalid(TemporalField field, LocalTime base, long newValue) {
try {
base.with(field, newValue);
fail("Field should not be allowed " + field);
} catch (DateTimeException ex) {
// expected
}
}
// All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
@Test(expectedExceptions=UnsupportedTemporalTypeException.class)
public void test_with_longTemporalField_otherChronoField() {
TEST_12_30_40_987654321.with(ChronoField.DAY_OF_MONTH, 1);
}
// If the field is not a {@code ChronoField}, then the result of this method
// is obtained by invoking {@code TemporalField.adjustInto(Temporal, long)}
// passing {@code this} as the argument.
@Test
public void test_with_longTemporalField_notChronoField() {
final LocalTime result = LocalTime.of(12, 30);
final LocalTime base = LocalTime.of(15, 45);
TemporalField field = new TemporalField() {
public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
throw new UnsupportedOperationException();
}
public ValueRange range() {
return null;
}
public boolean isTimeBased() {
throw new UnsupportedOperationException();
}
public boolean isSupportedBy(TemporalAccessor temporal) {
throw new UnsupportedOperationException();
}
public boolean isDateBased() {
throw new UnsupportedOperationException();
}
public TemporalUnit getRangeUnit() {
throw new UnsupportedOperationException();
}
public long getFrom(TemporalAccessor temporal) {
throw new UnsupportedOperationException();
}
public TemporalUnit getBaseUnit() {
throw new UnsupportedOperationException();
}
public <R extends Temporal> R adjustInto(R temporal, long newValue) {
assertEquals(temporal, base);
assertEquals(newValue, 12L);
@SuppressWarnings("unchecked")
R r = (R) result;
return r;
}
};
LocalTime test = base.with(field, 12L);
assertSame(test, result);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_with_longTemporalField_null() {
TEST_12_30_40_987654321.with((TemporalField) null, 1);
}
//-----------------------------------------------------------------------
// withHour()
//-----------------------------------------------------------------------
......
......@@ -254,14 +254,20 @@ public class TCKDateTimeFormatter {
assertEquals(parsed.isSupported(YEAR), false); // not in the list of resolverFields
}
@Test(expectedExceptions = NullPointerException.class)
@Test
public void test_resolverFields_Array_null() throws Exception {
DateTimeFormatter.ISO_DATE.withResolverFields((TemporalField[]) null);
DateTimeFormatter f = DateTimeFormatter.ISO_DATE.withResolverFields(MONTH_OF_YEAR);
assertEquals(f.getResolverFields().size(), 1);
f = f.withResolverFields((TemporalField[]) null);
assertEquals(f.getResolverFields(), null);
}
@Test(expectedExceptions = NullPointerException.class)
@Test
public void test_resolverFields_Set_null() throws Exception {
DateTimeFormatter.ISO_DATE.withResolverFields((Set<TemporalField>) null);
DateTimeFormatter f = DateTimeFormatter.ISO_DATE.withResolverFields(MONTH_OF_YEAR);
assertEquals(f.getResolverFields().size(), 1);
f = f.withResolverFields((Set<TemporalField>) null);
assertEquals(f.getResolverFields(), null);
}
//-----------------------------------------------------------------------
......
......@@ -60,11 +60,14 @@
package tck.java.time.format;
import static java.time.temporal.ChronoField.DAY_OF_MONTH;
import static java.time.temporal.ChronoField.HOUR_OF_DAY;
import static java.time.temporal.ChronoField.MINUTE_OF_HOUR;
import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
import static java.time.temporal.ChronoField.NANO_OF_SECOND;
import static java.time.temporal.ChronoField.YEAR;
import static org.testng.Assert.assertEquals;
import java.text.ParsePosition;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.ZoneOffset;
......@@ -73,6 +76,7 @@ import java.time.format.DateTimeFormatterBuilder;
import java.time.format.SignStyle;
import java.time.format.TextStyle;
import java.time.temporal.Temporal;
import java.time.temporal.TemporalAccessor;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
......@@ -728,4 +732,150 @@ public class TCKDateTimeFormatterBuilder {
return LocalDate.of(y, m, d);
}
//-----------------------------------------------------------------------
@Test
public void test_adjacent_strict_firstFixedWidth() throws Exception {
// succeeds because both number elements are fixed width
DateTimeFormatter f = builder.appendValue(HOUR_OF_DAY, 2).appendValue(MINUTE_OF_HOUR, 2).appendLiteral('9').toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("12309", pp);
assertEquals(pp.getErrorIndex(), -1);
assertEquals(pp.getIndex(), 5);
assertEquals(parsed.getLong(HOUR_OF_DAY), 12L);
assertEquals(parsed.getLong(MINUTE_OF_HOUR), 30L);
}
@Test
public void test_adjacent_strict_firstVariableWidth_success() throws Exception {
// succeeds greedily parsing variable width, then fixed width, to non-numeric Z
DateTimeFormatter f = builder.appendValue(HOUR_OF_DAY).appendValue(MINUTE_OF_HOUR, 2).appendLiteral('Z').toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("12309Z", pp);
assertEquals(pp.getErrorIndex(), -1);
assertEquals(pp.getIndex(), 6);
assertEquals(parsed.getLong(HOUR_OF_DAY), 123L);
assertEquals(parsed.getLong(MINUTE_OF_HOUR), 9L);
}
@Test
public void test_adjacent_strict_firstVariableWidth_fails() throws Exception {
// fails because literal is a number and variable width parse greedily absorbs it
DateTimeFormatter f = builder.appendValue(HOUR_OF_DAY).appendValue(MINUTE_OF_HOUR, 2).appendLiteral('9').toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("12309", pp);
assertEquals(pp.getErrorIndex(), 5);
assertEquals(parsed, null);
}
@Test
public void test_adjacent_lenient() throws Exception {
// succeeds because both number elements are fixed width even in lenient mode
DateTimeFormatter f = builder.parseLenient().appendValue(HOUR_OF_DAY, 2).appendValue(MINUTE_OF_HOUR, 2).appendLiteral('9').toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("12309", pp);
assertEquals(pp.getErrorIndex(), -1);
assertEquals(pp.getIndex(), 5);
assertEquals(parsed.getLong(HOUR_OF_DAY), 12L);
assertEquals(parsed.getLong(MINUTE_OF_HOUR), 30L);
}
@Test
public void test_adjacent_lenient_firstVariableWidth_success() throws Exception {
// succeeds greedily parsing variable width, then fixed width, to non-numeric Z
DateTimeFormatter f = builder.parseLenient().appendValue(HOUR_OF_DAY).appendValue(MINUTE_OF_HOUR, 2).appendLiteral('Z').toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("12309Z", pp);
assertEquals(pp.getErrorIndex(), -1);
assertEquals(pp.getIndex(), 6);
assertEquals(parsed.getLong(HOUR_OF_DAY), 123L);
assertEquals(parsed.getLong(MINUTE_OF_HOUR), 9L);
}
@Test
public void test_adjacent_lenient_firstVariableWidth_fails() throws Exception {
// fails because literal is a number and variable width parse greedily absorbs it
DateTimeFormatter f = builder.parseLenient().appendValue(HOUR_OF_DAY).appendValue(MINUTE_OF_HOUR, 2).appendLiteral('9').toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("12309", pp);
assertEquals(pp.getErrorIndex(), 5);
assertEquals(parsed, null);
}
//-----------------------------------------------------------------------
@Test
public void test_adjacent_strict_fractionFollows() throws Exception {
// succeeds because hour/min are fixed width
DateTimeFormatter f = builder.appendValue(HOUR_OF_DAY, 2).appendValue(MINUTE_OF_HOUR, 2).appendFraction(NANO_OF_SECOND, 0, 3, false).toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("1230567", pp);
assertEquals(pp.getErrorIndex(), -1);
assertEquals(pp.getIndex(), 7);
assertEquals(parsed.getLong(HOUR_OF_DAY), 12L);
assertEquals(parsed.getLong(MINUTE_OF_HOUR), 30L);
assertEquals(parsed.getLong(NANO_OF_SECOND), 567_000_000L);
}
@Test
public void test_adjacent_strict_fractionFollows_2digit() throws Exception {
// succeeds because hour/min are fixed width
DateTimeFormatter f = builder.appendValue(HOUR_OF_DAY, 2).appendValue(MINUTE_OF_HOUR, 2).appendFraction(NANO_OF_SECOND, 0, 3, false).toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("123056", pp);
assertEquals(pp.getErrorIndex(), -1);
assertEquals(pp.getIndex(), 6);
assertEquals(parsed.getLong(HOUR_OF_DAY), 12L);
assertEquals(parsed.getLong(MINUTE_OF_HOUR), 30L);
assertEquals(parsed.getLong(NANO_OF_SECOND), 560_000_000L);
}
@Test
public void test_adjacent_strict_fractionFollows_0digit() throws Exception {
// succeeds because hour/min are fixed width
DateTimeFormatter f = builder.appendValue(HOUR_OF_DAY, 2).appendValue(MINUTE_OF_HOUR, 2).appendFraction(NANO_OF_SECOND, 0, 3, false).toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("1230", pp);
assertEquals(pp.getErrorIndex(), -1);
assertEquals(pp.getIndex(), 4);
assertEquals(parsed.getLong(HOUR_OF_DAY), 12L);
assertEquals(parsed.getLong(MINUTE_OF_HOUR), 30L);
}
@Test
public void test_adjacent_lenient_fractionFollows() throws Exception {
// succeeds because hour/min are fixed width
DateTimeFormatter f = builder.parseLenient().appendValue(HOUR_OF_DAY, 2).appendValue(MINUTE_OF_HOUR, 2).appendFraction(NANO_OF_SECOND, 3, 3, false).toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("1230567", pp);
assertEquals(pp.getErrorIndex(), -1);
assertEquals(pp.getIndex(), 7);
assertEquals(parsed.getLong(HOUR_OF_DAY), 12L);
assertEquals(parsed.getLong(MINUTE_OF_HOUR), 30L);
assertEquals(parsed.getLong(NANO_OF_SECOND), 567_000_000L);
}
@Test
public void test_adjacent_lenient_fractionFollows_2digit() throws Exception {
// succeeds because hour/min are fixed width
DateTimeFormatter f = builder.parseLenient().appendValue(HOUR_OF_DAY, 2).appendValue(MINUTE_OF_HOUR, 2).appendFraction(NANO_OF_SECOND, 3, 3, false).toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("123056", pp);
assertEquals(pp.getErrorIndex(), -1);
assertEquals(pp.getIndex(), 6);
assertEquals(parsed.getLong(HOUR_OF_DAY), 12L);
assertEquals(parsed.getLong(MINUTE_OF_HOUR), 30L);
assertEquals(parsed.getLong(NANO_OF_SECOND), 560_000_000L);
}
@Test
public void test_adjacent_lenient_fractionFollows_0digit() throws Exception {
// succeeds because hour/min are fixed width
DateTimeFormatter f = builder.parseLenient().appendValue(HOUR_OF_DAY, 2).appendValue(MINUTE_OF_HOUR, 2).appendFraction(NANO_OF_SECOND, 3, 3, false).toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("1230", pp);
assertEquals(pp.getErrorIndex(), -1);
assertEquals(pp.getIndex(), 4);
assertEquals(parsed.getLong(HOUR_OF_DAY), 12L);
assertEquals(parsed.getLong(MINUTE_OF_HOUR), 30L);
}
}
......@@ -356,7 +356,7 @@ public class TestReducedParser extends AbstractTestPrinterParser {
{"yyMMdd", "200703", STRICT, 0, 6, 2020, 7, 3},
{"ddMMyy", "230714", LENIENT, 0, 6, 2014, 7, 23},
{"ddMMyy", "230714", STRICT, 0, 6, 2014, 7, 23},
{"ddMMyy", "25062001", LENIENT, 0, 8, 2001, 20, 2506},
{"ddMMyy", "25062001", LENIENT, 0, 8, 2001, 6, 25},
{"ddMMyy", "25062001", STRICT, 0, 6, 2020, 6, 25},
{"ddMMy", "27052002", LENIENT, 0, 8, 2002, 5, 27},
{"ddMMy", "27052002", STRICT, 0, 8, 2002, 5, 27},
......
<!--
Copyright (c) 2014, 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.
-->
<html>
<body>
Verify that scaled components are rendered smoothly to image.
1. Run the test.
2. Check that Selected and Deselected JCheckBox icons are drawn smoothly.
If so, press PASS, else press FAIL.
<applet code="bug8032667.class" width=400 height=400></applet>
</body>
</html>
/*
* Copyright (c) 2014, 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 java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import javax.swing.JApplet;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
/* @test
* @bug 8032667
* @summary [macosx] Components cannot be rendered in HiDPI to BufferedImage
* @run applet/manual=yesno bug8032667.html
*/
public class bug8032667 extends JApplet {
static final int scale = 2;
static final int width = 130;
static final int height = 50;
static final int scaledWidth = scale * width;
static final int scaledHeight = scale * height;
@Override
public void init() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
final Image image1 = getImage(getCheckBox("Deselected", false));
final Image image2 = getImage(getCheckBox("Selected", true));
Canvas canvas = new Canvas() {
@Override
public void paint(Graphics g) {
super.paint(g);
g.drawImage(image1, 0, 0, scaledWidth, scaledHeight, this);
g.drawImage(image2, 0, scaledHeight + 5,
scaledWidth, scaledHeight, this);
}
};
getContentPane().add(canvas, BorderLayout.CENTER);
}
});
}
static JCheckBox getCheckBox(String text, boolean selected) {
JCheckBox checkBox = new JCheckBox(text);
checkBox.setSelected(selected);
checkBox.setSize(new Dimension(width, height));
return checkBox;
}
static Image getImage(JComponent component) {
final BufferedImage image = new BufferedImage(
scaledWidth, scaledHeight, BufferedImage.TYPE_INT_ARGB);
final Graphics g = image.getGraphics();
((Graphics2D) g).scale(scale, scale);
component.paint(g);
g.dispose();
return image;
}
}
/*
* Copyright (c) 2014, 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 java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import sun.awt.OSInfo;
/* @test
* @bug 8032667
* @summary [macosx] Components cannot be rendered in HiDPI to BufferedImage
* @run main bug8032667_image_diff
*/
public class bug8032667_image_diff {
static final int IMAGE_WIDTH = 130;
static final int IMAGE_HEIGHT = 50;
public static void main(String[] args) throws Exception {
if(!OSInfo.OSType.MACOSX.equals(OSInfo.getOSType())){
return;
}
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
JCheckBox checkBox = new JCheckBox();
checkBox.setSelected(true);
checkBox.setSize(new Dimension(IMAGE_WIDTH, IMAGE_HEIGHT));
final BufferedImage image1 = getHiDPIImage(checkBox);
final BufferedImage image2 = getScaledImage(checkBox);
if(equal(image1, image2)){
throw new RuntimeException("2x image equals to non smooth image");
}
}
});
}
static boolean equal(BufferedImage image1, BufferedImage image2) {
int w = image1.getWidth();
int h = image1.getHeight();
if (w != image2.getWidth() || h != image2.getHeight()) {
return false;
}
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
int color1 = image1.getRGB(i, j);
int color2 = image2.getRGB(i, j);
if (color1 != color2) {
return false;
}
}
}
return true;
}
static BufferedImage getHiDPIImage(JComponent component) {
return getImage(component, 2, IMAGE_WIDTH, IMAGE_HEIGHT);
}
static BufferedImage getScaledImage(JComponent component) {
Image image1x = getImage(component, 1, IMAGE_WIDTH, IMAGE_HEIGHT);
final BufferedImage image2x = new BufferedImage(
2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_ARGB);
final Graphics g = image2x.getGraphics();
((Graphics2D) g).scale(2, 2);
g.drawImage(image1x, 0, 0, null);
g.dispose();
return image2x;
}
static BufferedImage getImage(JComponent component, int scale, int width, int height) {
final BufferedImage image = new BufferedImage(
scale * width, scale * height, BufferedImage.TYPE_INT_ARGB);
final Graphics g = image.getGraphics();
((Graphics2D) g).scale(scale, scale);
component.paint(g);
g.dispose();
return image;
}
}
<!--
Copyright (c) 2014, 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.
-->
<html>
<body>
Verify that scaled icons are rendered smoothly.
1. Run the test.
2. Check that Collapsed and Expanded JTree icons are drawn smoothly.
If so, press PASS, else press FAIL.
<applet code="bug8038113.class" width=400 height=400></applet>
</body>
</html>
/*
* Copyright (c) 2014, 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 java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.Icon;
import javax.swing.JApplet;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.plaf.basic.BasicTreeUI;
/* @test
* @bug 8038113
* @summary [macosx] JTree icon is not rendered in high resolution on Retina
* @run applet/manual=yesno bug8038113.html
*/
public class bug8038113 extends JApplet {
@Override
public void init() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
final JTree tree = new JTree();
final BasicTreeUI treeUI = (BasicTreeUI) tree.getUI();
final JPanel panel = new JPanel() {
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(new BasicStroke(0.5f));
g2.scale(2, 2);
int x = 10;
int y = 10;
Icon collapsedIcon = treeUI.getCollapsedIcon();
Icon expandeIcon = treeUI.getExpandedIcon();
int w = collapsedIcon.getIconWidth();
int h = collapsedIcon.getIconHeight();
collapsedIcon.paintIcon(this, g, x, y);
g.drawRect(x, y, w, h);
y += 10 + h;
w = expandeIcon.getIconWidth();
h = expandeIcon.getIconHeight();
expandeIcon.paintIcon(this, g, x, y);
g.drawRect(x, y, w, h);
}
};
getContentPane().setLayout(new BorderLayout());
getContentPane().add(panel, BorderLayout.CENTER);
}
});
}
}
/*
* Copyright (c) 2014, 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 8038307
* @summary JAX-WS conformance tests fail when running JCK-devtools-8 suite against RI in EBCDIC emulation mode
* @run main/othervm WsImportTest
*/
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.FileVisitResult;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import static java.nio.file.FileVisitResult.*;
public class WsImportTest {
public static void main(String[] args) throws IOException {
String wsimport = getWsImport();
String wsdl = getWSDLFilePath("test-service.wsdl");
try {
log("Importing wsdl: " + wsdl);
String[] wsargs = {
wsimport,
"-p",
"generated",
"-J-Dfile.encoding=Cp037",
wsdl
};
ProcessBuilder pb = new ProcessBuilder(wsargs);
pb.redirectErrorStream(true);
Process p = pb.start();
logOutput(p);
int result = p.waitFor();
p.destroy();
if (result != 0) {
fail("WsImport failed. TEST FAILED.");
} else {
log("Test PASSED.");
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
} finally {
deleteGeneratedFiles();
}
}
private static void fail(String message) {
throw new RuntimeException(message);
}
private static void log(String msg) {
System.out.println(msg);
}
private static void logOutput(Process p) throws IOException {
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String s = r.readLine();
while (s != null) {
log(s.trim());
s = r.readLine();
}
}
private static void deleteGeneratedFiles() {
Path p = Paths.get("generated");
if (Files.exists(p)) {
try {
Files.walkFileTree(p, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir,
IOException exc) throws IOException {
if (exc == null) {
Files.delete(dir);
return CONTINUE;
} else {
throw exc;
}
}
});
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
private static String getWSDLFilePath(String filename) {
String testSrc = System.getProperty("test.src");
if (testSrc == null) testSrc = ".";
return Paths.get(testSrc).resolve(filename).toString();
}
private static String getWsImport() {
String javaHome = System.getProperty("java.home");
if (javaHome.endsWith("jre")) {
javaHome = new File(javaHome).getParent();
}
String wsimport = javaHome + File.separator + "bin" + File.separator + "wsimport";
if (System.getProperty("os.name").startsWith("Windows")) {
wsimport = wsimport.concat(".exe");
}
return wsimport;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2014, 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.
-->
<definitions name="W2JDLAnnotations"
targetNamespace="http://w2jdlannotations.org/wsdl"
xmlns:tns="http://w2jdlannotations.org/wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:types="http://w2jdlannotations.org/types"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema targetNamespace="http://w2jdlannotations.org/types" attributeFormDefault="qualified"
elementFormDefault="qualified">
<xsd:element name="OneWayStringElement">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="argument" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="oneway">
<part name="varString" element="types:OneWayStringElement"/>
</message>
<portType name="W2JDLAnnotationsEndpoint">
<operation name="onewayOperation">
<input message="tns:oneway"/>
</operation>
</portType>
<binding name="W2JDLAnnotationsEndpointBinding" type="tns:W2JDLAnnotationsEndpoint">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="onewayOperation">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
</binding>
<service name="W2JDLAnnotations">
<port name="W2JDLAnnotationsEndpointPort" binding="tns:W2JDLAnnotationsEndpointBinding">
<soap:address location="http://foo:9999/bar"/>
</port>
</service>
</definitions>
......@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
tzdata2014a
tzdata2014b
......@@ -891,7 +891,10 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
# Another source (specifying the time for start and end in the decree):
# http://www.lemag.ma/Heure-d-ete-au-Maroc-jusqu-au-27-octobre_a75620.html
# From Paul Eggert (2013-10-03):
# From Sebastien Willemijns (2014-03-18):
# http://www.afriquinfos.com/articles/2014/3/18/maroc-heure-dete-avancez-tous-horloges-247891.asp
# From Paul Eggert (2014-03-19):
# To estimate what the Moroccan government will do in future years,
# transition dates for 2014 through 2038 were determined by running
# the following program under GNU Emacs 24.3:
......
......@@ -253,24 +253,41 @@ Zone Antarctica/Syowa 0 - zzz 1957 Jan 29
# year-round base
# Scott Base, Ross Island, since 1957-01.
# See Pacific/Auckland.
#
# These rules for New Zealand are stolen from the 'australasia' file.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule NZAQ 1974 only - Nov 3 2:00s 1:00 D
Rule NZAQ 1975 1988 - Oct lastSun 2:00s 1:00 D
Rule NZAQ 1989 only - Oct 8 2:00s 1:00 D
Rule NZAQ 1990 2006 - Oct Sun>=1 2:00s 1:00 D
Rule NZAQ 1975 only - Feb 23 2:00s 0 S
Rule NZAQ 1976 1989 - Mar Sun>=1 2:00s 0 S
Rule NZAQ 1990 2007 - Mar Sun>=15 2:00s 0 S
Rule NZAQ 2007 max - Sep lastSun 2:00s 1:00 D
Rule NZAQ 2008 max - Apr Sun>=1 2:00s 0 S
# Norway - territories
# Bouvet (never inhabited)
#
# claims
# Peter I Island (never inhabited)
#
# year-round base
# Troll, Queen Maud Land, -720041+0023206, since 2005-02-12
#
# From Paul-Inge Flakstad (2014-03-10):
# I recently had a long dialog about this with the developer of timegenie.com.
# In the absence of specific dates, he decided to choose some likely ones:
# GMT +1 - From March 1 to the last Sunday in March
# GMT +2 - From the last Sunday in March until the last Sunday in October
# GMT +1 - From the last Sunday in October until November 7
# GMT +0 - From November 7 until March 1
# The dates for switching to and from UTC+0 will probably not be absolutely
# correct, but they should be quite close to the actual dates.
#
# From Paul Eggert (2014-03-21):
# The CET-switching Troll rules require zic from tzcode 2014b or later, so as
# suggested by Bengt-Inge Larsson comment them out for now, and approximate
# with only UTC and CEST. Uncomment them when 2014b is more prevalent.
#
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
#Rule Troll 2005 max - Mar 1 1:00u 1:00 CET
Rule Troll 2005 max - Mar lastSun 1:00u 2:00 CEST
#Rule Troll 2005 max - Oct lastSun 1:00u 1:00 CET
#Rule Troll 2004 max - Nov 7 1:00u 0:00 UTC
# Remove the following line when uncommenting the above '#Rule' lines.
Rule Troll 2004 max - Oct lastSun 1:00u 0:00 UTC
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Antarctica/Troll 0 - zzz 2005 Feb 12
0:00 Troll %s
# Poland - year-round base
# Arctowski, King George Island, -620945-0582745, since 1977
......
......@@ -786,14 +786,29 @@ Zone Pacific/Funafuti 11:56:52 - LMT 1901
# Johnston
#
# From Paul Eggert (2013-09-03):
# From Paul Eggert (2014-03-11):
# Sometimes Johnston kept Hawaii time, and sometimes it was an hour behind.
# Details are uncertain. We have no data for Johnston after 1970, so
# treat it like Hawaii for now.
#
# In his memoirs of June 6th to October 4, 1945
# <http://www.315bw.org/Herb_Bach.htm> (2005), Herbert C. Bach writes,
# "We started our letdown to Kwajalein Atoll and landed there at 5:00 AM
# Johnston time, 1:30 AM Kwajalein time." This was in June 1945, and
# confirms that Johnston kept the same time as Honolulu in summer 1945.
# We have no better information, so for now, assume this has been true
# indefinitely into the past.
#
# From Lyle McElhaney (2014-03-11):
# [W]hen JI was being used for that [atomic bomb] testing, the time being used
# was not Hawaiian time but rather the same time being used on the ships,
# which had a GMT offset of -11 hours. This apparently applied to at least the
# time from Operation Newsreel (Hardtack I/Teak shot, 1958-08-01) to the last
# Operation Fishbowl shot (Tightrope, 1962-11-04).... [See] Herman Hoerlin,
# "The United States High-Altitude Test Experience: A Review Emphasizing the
# Impact on the Environment", Los Alamos LA-6405, Oct 1976
# <http://www.fas.org/sgp/othergov/doe/lanl/docs1/00322994.pdf>.
# See the table on page 4 where he lists GMT and local times for the tests; a
# footnote for the JI tests reads that local time is "JI time = Hawaii Time
# Minus One Hour".
#
# See 'northamerica' for Pacific/Johnston.
......
......@@ -2986,7 +2986,11 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880
# Assume it happened in March by not changing the clocks.
3:00 Russia MSK/MSD 1997
3:00 - MSK 1997 Mar lastSun 1:00u
2:00 EU EE%sT
# From Alexander Krivenyshev (2014-03-17):
# time change at 2:00 (2am) on March 30, 2014
# http://vz.ru/news/2014/3/17/677464.html
2:00 EU EE%sT 2014 Mar 30 2:00
4:00 - MSK
# Vatican City
# See Europe/Rome.
......
......@@ -20,7 +20,7 @@
# 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.
#
# Allowance for leapseconds added to each timezone file.
# This file is in the public domain.
......
......@@ -74,6 +74,7 @@ AQ -6617+11031 Antarctica/Casey Casey Station, Bailey Peninsula
AQ -7824+10654 Antarctica/Vostok Vostok Station, Lake Vostok
AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie
AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I
AQ -720041+0023206 Antarctica/Troll Troll Station, Queen Maud Land
AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF)
AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, MN, SE, SF)
AR -2447-06525 America/Argentina/Salta (SA, LP, NQ, RN)
......@@ -366,6 +367,7 @@ RU +5443+02030 Europe/Kaliningrad Moscow-01 - Kaliningrad
RU +5545+03735 Europe/Moscow Moscow+00 - west Russia
RU +4844+04425 Europe/Volgograd Moscow+00 - Caspian Sea
RU +5312+05009 Europe/Samara Moscow+00 - Samara, Udmurtia
RU +4457+03406 Europe/Simferopol Moscow+00 - Crimea
RU +5651+06036 Asia/Yekaterinburg Moscow+02 - Urals
RU +5500+07324 Asia/Omsk Moscow+03 - west Siberia
RU +5502+08255 Asia/Novosibirsk Moscow+03 - Novosibirsk
......@@ -421,7 +423,6 @@ TZ -0648+03917 Africa/Dar_es_Salaam
UA +5026+03031 Europe/Kiev most locations
UA +4837+02218 Europe/Uzhgorod Ruthenia
UA +4750+03510 Europe/Zaporozhye Zaporozh'ye, E Lugansk / Zaporizhia, E Luhansk
UA +4457+03406 Europe/Simferopol central Crimea
UG +0019+03225 Africa/Kampala
UM +1645-16931 Pacific/Johnston Johnston Atoll
UM +2813-17722 Pacific/Midway Midway Islands
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册