changeset 32136:aa92c5a39f90

Merge
author ddehaven
date Tue, 11 Aug 2015 12:32:10 -0700
parents 67aa4920495c 36d881124ca1
children 335cf1796fcd
files
diffstat 61 files changed, 1665 insertions(+), 1089 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/make/lib/SoundLibraries.gmk	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/make/lib/SoundLibraries.gmk	Tue Aug 11 12:32:10 2015 -0700
@@ -123,9 +123,6 @@
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(LIBJSOUND_CFLAGS), \
     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
-    DISABLED_WARNINGS_clang := implicit-function-declaration \
-        deprecated-writable-strings, \
-    WARNINGS_AS_ERRORS_clang := false, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsound/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -171,7 +168,6 @@
           -DUSE_PORTS=TRUE \
           -DUSE_PLATFORM_MIDI_OUT=TRUE \
           -DUSE_PLATFORM_MIDI_IN=TRUE, \
-      DISABLED_WARNINGS_gcc := parentheses, \
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsoundalsa/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFRetainedResource.m	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFRetainedResource.m	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -40,10 +40,17 @@
     if (releaseOnAppKitThread) {
         // Releasing resources on the main AppKit message loop only
         // Releasing resources on the nested loops may cause dangling 
-        // pointers after the nested loop is exited 
-        [NSApp postRunnableEvent:^(){
-            CFRelease(jlong_to_ptr(ptr));
-        }];
+        // pointers after the nested loop is exited
+        if ([NSApp respondsToSelector:@selector(postRunnableEvent:)]) {
+            [NSApp postRunnableEvent:^() {
+                CFRelease(jlong_to_ptr(ptr));
+            }];
+        } else {
+            // could happen if we are embedded inside SWT/FX application,
+            [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
+                CFRelease(jlong_to_ptr(ptr));
+            }];
+        }
     } else {
 
 JNF_COCOA_ENTER(env);
--- a/jdk/src/java.desktop/share/classes/com/sun/beans/introspect/PropertyInfo.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/beans/introspect/PropertyInfo.java	Tue Aug 11 12:32:10 2015 -0700
@@ -40,7 +40,7 @@
 import static com.sun.beans.finder.ClassFinder.findClass;
 
 public final class PropertyInfo {
-    public enum Name {bound, expert, hidden, preferred, visualUpdate, description, enumerationValues}
+    public enum Name {bound, expert, hidden, preferred, required, visualUpdate, description, enumerationValues}
 
     private static final String VETO_EXCEPTION_NAME = "java.beans.PropertyVetoException";
     private static final Class<?> VETO_EXCEPTION;
@@ -120,6 +120,7 @@
                     put(Name.bound, Boolean.FALSE);
                 }
                 put(Name.expert, annotation.expert());
+                put(Name.required, annotation.required());
                 put(Name.hidden, annotation.hidden());
                 put(Name.preferred, annotation.preferred());
                 put(Name.visualUpdate, annotation.visualUpdate());
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -27,19 +27,14 @@
 
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 
 import javax.sound.sampled.AudioFileFormat;
 import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.UnsupportedAudioFileException;
 
-
 /**
  * AIFF file reader and writer.
  *
@@ -49,177 +44,10 @@
  */
 public final class AiffFileReader extends SunFileReader {
 
-    private static final int MAX_READ_LENGTH = 8;
-
-    // METHODS TO IMPLEMENT AudioFileReader
-
-    /**
-     * Obtains the audio file format of the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file providers may
-     * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an IOException.
-     * @param stream the input stream from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     * @see InputStream#markSupported
-     * @see InputStream#mark
-     */
-    public AudioFileFormat getAudioFileFormat(InputStream stream) throws UnsupportedAudioFileException, IOException {
-        // fix for 4489272: AudioSystem.getAudioFileFormat() fails for InputStream, but works for URL
-        AudioFileFormat aff = getCOMM(stream, true);
-        // the following is not strictly necessary - but was implemented like that in 1.3.0 - 1.4.1
-        // so I leave it as it was. May remove this for 1.5.0
-        stream.reset();
-        return aff;
-    }
-
-
-    /**
-     * Obtains the audio file format of the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException {
-        AudioFileFormat fileFormat = null;
-        InputStream urlStream = url.openStream();       // throws IOException
-        try {
-            fileFormat = getCOMM(urlStream, false);
-        } finally {
-            urlStream.close();
-        }
-        return fileFormat;
-    }
-
-
-    /**
-     * Obtains the audio file format of the File provided.  The File must
-     * point to valid audio file data.
-     * @param file the File from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the File does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException {
-        AudioFileFormat fileFormat = null;
-        FileInputStream fis = new FileInputStream(file);       // throws IOException
-        // part of fix for 4325421
-        try {
-            fileFormat = getCOMM(fis, false);
-        } finally {
-            fis.close();
-        }
-
-        return fileFormat;
-    }
-
-
-
-
-    /**
-     * Obtains an audio stream from the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file providers may
-     * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an IOException.
-     * @param stream the input stream from which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data contained
-     * in the input stream.
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     * @see InputStream#markSupported
-     * @see InputStream#mark
-     */
-    public AudioInputStream getAudioInputStream(InputStream stream) throws UnsupportedAudioFileException, IOException {
-        // getCOMM leaves the input stream at the beginning of the audio data
-        AudioFileFormat fileFormat = getCOMM(stream, true);     // throws UnsupportedAudioFileException, IOException
-
-        // we've got everything, and the stream is at the
-        // beginning of the audio data, so return an AudioInputStream.
-        return new AudioInputStream(stream, fileFormat.getFormat(), fileFormat.getFrameLength());
-    }
-
-
-    /**
-     * Obtains an audio stream from the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the URL
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
-        InputStream urlStream = url.openStream();  // throws IOException
-        AudioFileFormat fileFormat = null;
-        try {
-            fileFormat = getCOMM(urlStream, false);
-        } finally {
-            if (fileFormat == null) {
-                urlStream.close();
-            }
-        }
-        return new AudioInputStream(urlStream, fileFormat.getFormat(), fileFormat.getFrameLength());
-    }
-
-
-    /**
-     * Obtains an audio stream from the File provided.  The File must
-     * point to valid audio file data.
-     * @param file the File for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the File
-     * @throws UnsupportedAudioFileException if the File does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioInputStream getAudioInputStream(File file)
-        throws UnsupportedAudioFileException, IOException {
-
-        FileInputStream fis = new FileInputStream(file); // throws IOException
-        AudioFileFormat fileFormat = null;
-        // part of fix for 4325421
-        try {
-            fileFormat = getCOMM(fis, false);
-        } finally {
-            if (fileFormat == null) {
-                fis.close();
-            }
-        }
-        return new AudioInputStream(fis, fileFormat.getFormat(), fileFormat.getFrameLength());
-    }
-
-    //--------------------------------------------------------------------
-
-    private AudioFileFormat getCOMM(InputStream is, boolean doReset)
-        throws UnsupportedAudioFileException, IOException {
-
-        DataInputStream dis = new DataInputStream(is);
-
-        if (doReset) {
-            dis.mark(MAX_READ_LENGTH);
-        }
+    @Override
+    AudioFileFormat getAudioFileFormatImpl(final InputStream stream)
+            throws UnsupportedAudioFileException, IOException {
+        DataInputStream dis = new DataInputStream(stream);
 
         // assumes a stream at the beginning of the file which has already
         // passed the magic number test...
@@ -234,9 +62,6 @@
         // $$fb: fix for 4369044: javax.sound.sampled.AudioSystem.getAudioInputStream() works wrong with Cp037
         if (magic != AiffFileFormat.AIFF_MAGIC) {
             // not AIFF, throw exception
-            if (doReset) {
-                dis.reset();
-            }
             throw new UnsupportedAudioFileException("not an AIFF file");
         }
 
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileReader.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileReader.java	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -25,21 +25,15 @@
 
 package com.sun.media.sound;
 
-import java.io.BufferedInputStream;
 import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 
 import javax.sound.sampled.AudioFileFormat;
 import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.UnsupportedAudioFileException;
 
-
 /**
  * AU file reader.
  *
@@ -49,33 +43,10 @@
  */
 public final class AuFileReader extends SunFileReader {
 
-    // METHODS TO IMPLEMENT AudioFileReader
-
-    /**
-     * Obtains the audio file format of the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file providers may
-     * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an IOException.
-     * @param stream the input stream from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     * @see InputStream#markSupported
-     * @see InputStream#mark
-     */
-    public AudioFileFormat getAudioFileFormat(InputStream stream) throws UnsupportedAudioFileException, IOException {
-
-        AudioFormat format = null;
-        AuFileFormat fileFormat = null;
-        int maxReadLength = 28;
+    @Override
+    public AudioFileFormat getAudioFileFormatImpl(final InputStream stream)
+            throws UnsupportedAudioFileException, IOException {
         boolean bigendian  = false;
-        int magic          = -1;
         int headerSize     = -1;
         int dataSize       = -1;
         int encoding_local = -1;
@@ -90,15 +61,12 @@
 
         DataInputStream dis = new DataInputStream( stream );
 
-        dis.mark(maxReadLength);
-
-        magic = dis.readInt();
+        final int magic = dis.readInt(); nread += 4;
 
         if (! (magic == AuFileFormat.AU_SUN_MAGIC) || (magic == AuFileFormat.AU_DEC_MAGIC) ||
             (magic == AuFileFormat.AU_SUN_INV_MAGIC) || (magic == AuFileFormat.AU_DEC_INV_MAGIC) ) {
 
-            // not AU, reset the stream, place into exception, throw exception
-            dis.reset();
+            // not AU, throw exception
             throw new UnsupportedAudioFileException("not an AU file");
         }
 
@@ -112,7 +80,6 @@
         sampleRate     = (bigendian==true ? dis.readInt() : rllong(dis) );  nread += 4;
         channels       = (bigendian==true ? dis.readInt() : rllong(dis) );  nread += 4;
         if (channels <= 0) {
-            dis.reset();
             throw new UnsupportedAudioFileException("Invalid number of channels");
         }
 
@@ -172,7 +139,6 @@
             */
         default:
                 // unsupported filetype, throw exception
-                dis.reset();
                 throw new UnsupportedAudioFileException("not a valid AU file");
         }
 
@@ -184,189 +150,13 @@
             //$$fb 2003-10-20: fix for 4940459: AudioInputStream.getFrameLength() returns 0 instead of NOT_SPECIFIED
             length = dataSize / frameSize;
         }
-
-        format = new AudioFormat( encoding, (float)sampleRate, sampleSizeInBits,
-                                  channels, frameSize, (float)frameRate, bigendian);
-
-        fileFormat = new AuFileFormat( AudioFileFormat.Type.AU, dataSize+headerSize,
-                                       format, length);
-
-        dis.reset(); // Throws IOException
-        return fileFormat;
-
-    }
-
-
-    /**
-     * Obtains the audio file format of the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException {
-
-        InputStream                             urlStream = null;
-        BufferedInputStream             bis = null;
-        AudioFileFormat                 fileFormat = null;
-        AudioFormat                             format = null;
-
-        urlStream = url.openStream();   // throws IOException
-
-        try {
-            bis = new BufferedInputStream( urlStream, bisBufferSize );
-
-            fileFormat = getAudioFileFormat( bis );             // throws UnsupportedAudioFileException
-        } finally {
-            urlStream.close();
-        }
-
-        return fileFormat;
-    }
-
-
-    /**
-     * Obtains the audio file format of the File provided.  The File must
-     * point to valid audio file data.
-     * @param file the File from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the File does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException {
-
-        FileInputStream                 fis = null;
-        BufferedInputStream             bis = null;
-        AudioFileFormat                 fileFormat = null;
-        AudioFormat                             format = null;
-
-        fis = new FileInputStream( file );      // throws IOException
-        // part of fix for 4325421
-        try {
-            bis = new BufferedInputStream( fis, bisBufferSize );
-            fileFormat = getAudioFileFormat( bis );             // throws UnsupportedAudioFileException
-        } finally {
-            fis.close();
-        }
-
-        return fileFormat;
-    }
-
-
-    /**
-     * Obtains an audio stream from the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file providers may
-     * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an IOException.
-     * @param stream the input stream from which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data contained
-     * in the input stream.
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     * @see InputStream#markSupported
-     * @see InputStream#mark
-     */
-    public AudioInputStream getAudioInputStream(InputStream stream) throws UnsupportedAudioFileException, IOException {
-
-        DataInputStream dis = null;
-        int headerSize;
-        AudioFileFormat fileFormat = null;
-        AudioFormat format = null;
-
-
-        fileFormat = getAudioFileFormat( stream ); // throws UnsupportedAudioFileException, IOException
-
-        // if we passed this call, we have an AU file.
-
-        format = fileFormat.getFormat();
-
-        dis = new DataInputStream(stream);
-
         // now seek past the header
-
-        dis.readInt(); // magic
-        headerSize     = (format.isBigEndian()==true ? dis.readInt() : rllong(dis) );
-        dis.skipBytes( headerSize - 8 );
-
-
-        // we've got everything, and the stream should be at the
-        // beginning of the data chunk, so return an AudioInputStream.
-
-        return new AudioInputStream(dis, format, fileFormat.getFrameLength());
-    }
-
-
-    /**
-     * Obtains an audio stream from the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the URL
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
-
-        InputStream                             urlStream = null;
-        BufferedInputStream             bis = null;
-        AudioFileFormat                 fileFormat = null;
-
-        urlStream = url.openStream();   // throws IOException
-        AudioInputStream result = null;
-        try {
-            bis = new BufferedInputStream( urlStream, bisBufferSize );
-            result = getAudioInputStream( (InputStream)bis );
-        } finally {
-            if (result == null) {
-                urlStream.close();
-            }
-        }
-        return result;
-    }
-
-
-    /**
-     * Obtains an audio stream from the File provided.  The File must
-     * point to valid audio file data.
-     * @param file the File for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the File
-     * @throws UnsupportedAudioFileException if the File does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException {
-
-        FileInputStream                 fis = null;
-        BufferedInputStream             bis = null;
-        AudioFileFormat                 fileFormat = null;
-
-        fis = new FileInputStream( file );      // throws IOException
-        AudioInputStream result = null;
-        // part of fix for 4325421
-        try {
-            bis = new BufferedInputStream( fis, bisBufferSize );
-            result = getAudioInputStream( (InputStream)bis );
-        } finally {
-            if (result == null) {
-                fis.close();
-            }
-        }
-
-        return result;
+        dis.skipBytes(headerSize - nread);
+        AudioFormat format = new AudioFormat(encoding, sampleRate,
+                                             sampleSizeInBits, channels,
+                                             frameSize, (float) frameRate,
+                                             bigendian);
+        return new AuFileFormat(AudioFileFormat.Type.AU, dataSize + headerSize,
+                                format, length);
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -25,10 +25,12 @@
 
 package com.sun.media.sound;
 
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.io.InputStream;
-import java.io.IOException;
-import java.io.DataInputStream;
 import java.net.URL;
 
 import javax.sound.sampled.AudioFileFormat;
@@ -36,8 +38,6 @@
 import javax.sound.sampled.UnsupportedAudioFileException;
 import javax.sound.sampled.spi.AudioFileReader;
 
-
-
 /**
  * Abstract File Reader class.
  *
@@ -45,118 +45,109 @@
  */
 abstract class SunFileReader extends AudioFileReader {
 
-    // buffer size for temporary input streams
-    protected static final int bisBufferSize = 4096;
+    @Override
+    public final AudioFileFormat getAudioFileFormat(final InputStream stream)
+            throws UnsupportedAudioFileException, IOException {
+        stream.mark(200); // The biggest value which was historically used
+        try {
+            return getAudioFileFormatImpl(stream);
+        } finally {
+            // According to specification the following is not strictly
+            // necessary, if we got correct format. But it was implemented like
+            // that in 1.3.0 - 1.8. So I leave it as it was, but it seems
+            // specification should be updated.
+            stream.reset();
+        }
+    }
+
+    @Override
+    public final AudioFileFormat getAudioFileFormat(final URL url)
+            throws UnsupportedAudioFileException, IOException {
+        try (InputStream is = url.openStream()) {
+            return getAudioFileFormatImpl(new BufferedInputStream(is));
+        }
+    }
+
+    @Override
+    public final AudioFileFormat getAudioFileFormat(final File file)
+            throws UnsupportedAudioFileException, IOException {
+        try (InputStream is = new FileInputStream(file)) {
+            return getAudioFileFormatImpl(new BufferedInputStream(is));
+        }
+    }
+
+    @Override
+    public AudioInputStream getAudioInputStream(final InputStream stream)
+            throws UnsupportedAudioFileException, IOException {
+        stream.mark(200); // The biggest value which was historically used
+        try {
+            final AudioFileFormat fileFormat = getAudioFileFormatImpl(stream);
+            // we've got everything, the stream is supported and it is at the
+            // beginning of the audio data, so return an AudioInputStream
+            return new AudioInputStream(stream, fileFormat.getFormat(),
+                                        fileFormat.getFrameLength());
+        } catch (final UnsupportedAudioFileException e) {
+            stream.reset();
+            throw e;
+        }
+    }
+
+    @Override
+    public final AudioInputStream getAudioInputStream(final URL url)
+            throws UnsupportedAudioFileException, IOException {
+        final InputStream urlStream = url.openStream();
+        try {
+            return getAudioInputStream(new BufferedInputStream(urlStream));
+        } catch (final Throwable e) {
+            closeSilently(urlStream);
+            throw e;
+        }
+    }
+
+    @Override
+    public final AudioInputStream getAudioInputStream(final File file)
+            throws UnsupportedAudioFileException, IOException {
+        final InputStream fileStream = new FileInputStream(file);
+        try {
+            return getAudioInputStream(new BufferedInputStream(fileStream));
+        } catch (final Throwable e) {
+            closeSilently(fileStream);
+            throw e;
+        }
+    }
 
     /**
-     * Constructs a new SunFileReader object.
-     */
-    SunFileReader() {
-    }
-
-
-    // METHODS TO IMPLEMENT AudioFileReader
-
-    /**
-     * Obtains the audio file format of the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file providers may
-     * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an IOException.
-     * @param stream the input stream from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     * @see InputStream#markSupported
-     * @see InputStream#mark
-     */
-    abstract public AudioFileFormat getAudioFileFormat(InputStream stream) throws UnsupportedAudioFileException, IOException;
-
-
-    /**
-     * Obtains the audio file format of the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
+     * Obtains the audio file format of the input stream provided. The stream
+     * must point to valid audio file data. Note that default implementation of
+     * {@link #getAudioInputStream(InputStream)} assume that this method leaves
+     * the input stream at the beginning of the audio data.
+     *
+     * @param  stream the input stream from which file format information should
+     *         be extracted
+     * @return an {@code AudioFileFormat} object describing the audio file
+     *         format
+     * @throws UnsupportedAudioFileException if the stream does not point to
+     *         valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
-    abstract public AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException;
-
-
-    /**
-     * Obtains the audio file format of the File provided.  The File must
-     * point to valid audio file data.
-     * @param file the File from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the File does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    abstract public AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException;
-
-
-    /**
-     * Obtains an audio stream from the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file providers may
-     * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an IOException.
-     * @param stream the input stream from which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data contained
-     * in the input stream.
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     * @see InputStream#markSupported
-     * @see InputStream#mark
-     */
-    abstract public AudioInputStream getAudioInputStream(InputStream stream) throws UnsupportedAudioFileException, IOException;
-
-
-    /**
-     * Obtains an audio stream from the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the URL
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    abstract public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException;
-
-
-    /**
-     * Obtains an audio stream from the File provided.  The File must
-     * point to valid audio file data.
-     * @param file the File for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the File
-     * @throws UnsupportedAudioFileException if the File does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    abstract public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException;
-
+    abstract AudioFileFormat getAudioFileFormatImpl(InputStream stream)
+            throws UnsupportedAudioFileException, IOException;
 
     // HELPER METHODS
 
-
+    /**
+     * Closes the InputStream when we have read all necessary data from it, and
+     * ignores an IOException.
+     *
+     * @param is the InputStream which should be closed
+     */
+    private static void closeSilently(final InputStream is) {
+        try {
+            is.close();
+        } catch (final IOException ignored) {
+            // IOException is ignored
+        }
+    }
 
     /**
      * rllong
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, 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
@@ -22,55 +22,40 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 
 import javax.sound.sampled.AudioFileFormat;
 import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.UnsupportedAudioFileException;
-import javax.sound.sampled.AudioFormat.Encoding;
-import javax.sound.sampled.spi.AudioFileReader;
 
 /**
  * WAVE file reader for files using format WAVE_FORMAT_EXTENSIBLE (0xFFFE).
  *
  * @author Karl Helgason
  */
-public final class WaveExtensibleFileReader extends AudioFileReader {
+public final class WaveExtensibleFileReader extends SunFileReader {
 
-    static private class GUID {
-        long i1;
-
-        int s1;
-
-        int s2;
-
-        int x1;
-
-        int x2;
-
-        int x3;
-
-        int x4;
-
-        int x5;
-
-        int x6;
-
-        int x7;
-
-        int x8;
-
+    private static class GUID {
+        private long i1;
+        private int s1;
+        private int s2;
+        private int x1;
+        private int x2;
+        private int x3;
+        private int x4;
+        private int x5;
+        private int x6;
+        private int x7;
+        private int x8;
         private GUID() {
         }
 
@@ -105,10 +90,12 @@
             return d;
         }
 
+        @Override
         public int hashCode() {
             return (int) i1;
         }
 
+        @Override
         public boolean equals(Object obj) {
             if (!(obj instanceof GUID))
                 return false;
@@ -161,7 +148,7 @@
     private static final GUID SUBTYPE_IEEE_FLOAT = new GUID(0x00000003, 0x0000,
             0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
 
-    private String decodeChannelMask(long channelmask) {
+    private static String decodeChannelMask(long channelmask) {
         StringBuilder sb = new StringBuilder();
         long m = 1;
         for (int i = 0; i < allchannelnames.length; i++) {
@@ -180,20 +167,8 @@
 
     }
 
-    public AudioFileFormat getAudioFileFormat(InputStream stream)
-            throws UnsupportedAudioFileException, IOException {
-
-        stream.mark(200);
-        AudioFileFormat format;
-        try {
-            format = internal_getAudioFileFormat(stream);
-        } finally {
-            stream.reset();
-        }
-        return format;
-    }
-
-    private AudioFileFormat internal_getAudioFileFormat(InputStream stream)
+    @Override
+    AudioFileFormat getAudioFileFormatImpl(final InputStream stream)
             throws UnsupportedAudioFileException, IOException {
 
         RIFFReader riffiterator = new RIFFReader(stream);
@@ -244,12 +219,9 @@
                 break;
             }
         }
-
-        if (!fmt_found)
+        if (!fmt_found || !data_found) {
             throw new UnsupportedAudioFileException();
-        if (!data_found)
-            throw new UnsupportedAudioFileException();
-
+        }
         Map<String, Object> p = new HashMap<String, Object>();
         String s_channelmask = decodeChannelMask(channelMask);
         if (s_channelmask != null)
@@ -273,24 +245,22 @@
         } else if (subFormat.equals(SUBTYPE_IEEE_FLOAT)) {
             audioformat = new AudioFormat(Encoding.PCM_FLOAT,
                     samplerate, bits, channels, framesize, samplerate, false, p);
-        } else
+        } else {
             throw new UnsupportedAudioFileException();
-
-        AudioFileFormat fileformat = new AudioFileFormat(
-                AudioFileFormat.Type.WAVE, audioformat,
-                AudioSystem.NOT_SPECIFIED);
-        return fileformat;
+        }
+        return new AudioFileFormat(AudioFileFormat.Type.WAVE, audioformat,
+                                   AudioSystem.NOT_SPECIFIED);
     }
 
-    public AudioInputStream getAudioInputStream(InputStream stream)
+    @Override
+    public AudioInputStream getAudioInputStream(final InputStream stream)
             throws UnsupportedAudioFileException, IOException {
 
         AudioFileFormat format = getAudioFileFormat(stream);
+        // we've got everything, the stream is supported and it is at the
+        // beginning of the header, so find the data chunk again and return an
+        // AudioInputStream
         RIFFReader riffiterator = new RIFFReader(stream);
-        if (!riffiterator.getFormat().equals("RIFF"))
-            throw new UnsupportedAudioFileException();
-        if (!riffiterator.getType().equals("WAVE"))
-            throw new UnsupportedAudioFileException();
         while (riffiterator.hasNextChunk()) {
             RIFFReader chunk = riffiterator.nextChunk();
             if (chunk.getFormat().equals("data")) {
@@ -300,40 +270,4 @@
         }
         throw new UnsupportedAudioFileException();
     }
-
-    public AudioFileFormat getAudioFileFormat(URL url)
-            throws UnsupportedAudioFileException, IOException {
-        InputStream stream = url.openStream();
-        AudioFileFormat format;
-        try {
-            format = getAudioFileFormat(new BufferedInputStream(stream));
-        } finally {
-            stream.close();
-        }
-        return format;
-    }
-
-    public AudioFileFormat getAudioFileFormat(File file)
-            throws UnsupportedAudioFileException, IOException {
-        InputStream stream = new FileInputStream(file);
-        AudioFileFormat format;
-        try {
-            format = getAudioFileFormat(new BufferedInputStream(stream));
-        } finally {
-            stream.close();
-        }
-        return format;
-    }
-
-    public AudioInputStream getAudioInputStream(URL url)
-            throws UnsupportedAudioFileException, IOException {
-        return getAudioInputStream(new BufferedInputStream(url.openStream()));
-    }
-
-    public AudioInputStream getAudioInputStream(File file)
-            throws UnsupportedAudioFileException, IOException {
-        return getAudioInputStream(new BufferedInputStream(new FileInputStream(
-                file)));
-    }
-
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileReader.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileReader.java	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -27,20 +27,14 @@
 
 import java.io.DataInputStream;
 import java.io.EOFException;
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 
 import javax.sound.sampled.AudioFileFormat;
 import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.UnsupportedAudioFileException;
 
-
-
 /**
  * WAVE file reader.
  *
@@ -50,170 +44,12 @@
  */
 public final class WaveFileReader extends SunFileReader {
 
-    private static final int MAX_READ_LENGTH = 12;
-
-    /**
-     * Obtains the audio file format of the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file providers may
-     * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an IOException.
-     * @param stream the input stream from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     * @see InputStream#markSupported
-     * @see InputStream#mark
-     */
-    public AudioFileFormat getAudioFileFormat(InputStream stream) throws UnsupportedAudioFileException, IOException {
-        // fix for 4489272: AudioSystem.getAudioFileFormat() fails for InputStream, but works for URL
-        AudioFileFormat aff = getFMT(stream, true);
-        // the following is not strictly necessary - but was implemented like that in 1.3.0 - 1.4.1
-        // so I leave it as it was. May remove this for 1.5.0
-        stream.reset();
-        return aff;
-    }
-
-
-    /**
-     * Obtains the audio file format of the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException {
-        InputStream urlStream = url.openStream(); // throws IOException
-        AudioFileFormat fileFormat = null;
-        try {
-            fileFormat = getFMT(urlStream, false);
-        } finally {
-            urlStream.close();
-        }
-        return fileFormat;
-    }
-
-
-    /**
-     * Obtains the audio file format of the File provided.  The File must
-     * point to valid audio file data.
-     * @param file the File from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the File does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException {
-        AudioFileFormat fileFormat = null;
-        FileInputStream fis = new FileInputStream(file);       // throws IOException
-        // part of fix for 4325421
-        try {
-            fileFormat = getFMT(fis, false);
-        } finally {
-            fis.close();
-        }
-
-        return fileFormat;
-    }
-
-
-    /**
-     * Obtains an audio stream from the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file providers may
-     * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an IOException.
-     * @param stream the input stream from which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data contained
-     * in the input stream.
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     * @see InputStream#markSupported
-     * @see InputStream#mark
-     */
-    public AudioInputStream getAudioInputStream(InputStream stream) throws UnsupportedAudioFileException, IOException {
-        // getFMT leaves the input stream at the beginning of the audio data
-        AudioFileFormat fileFormat = getFMT(stream, true); // throws UnsupportedAudioFileException, IOException
-
-        // we've got everything, and the stream is at the
-        // beginning of the audio data, so return an AudioInputStream.
-        return new AudioInputStream(stream, fileFormat.getFormat(), fileFormat.getFrameLength());
-    }
-
-
-    /**
-     * Obtains an audio stream from the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the URL
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
-        InputStream urlStream = url.openStream();  // throws IOException
-        AudioFileFormat fileFormat = null;
-        try {
-            fileFormat = getFMT(urlStream, false);
-        } finally {
-            if (fileFormat == null) {
-                urlStream.close();
-            }
-        }
-        return new AudioInputStream(urlStream, fileFormat.getFormat(), fileFormat.getFrameLength());
-    }
-
-
-    /**
-     * Obtains an audio stream from the File provided.  The File must
-     * point to valid audio file data.
-     * @param file the File for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the File
-     * @throws UnsupportedAudioFileException if the File does not point to valid audio
-     * file data recognized by the system
-     * @throws IOException if an I/O exception occurs
-     */
-    public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException {
-        FileInputStream fis = new FileInputStream(file); // throws IOException
-        AudioFileFormat fileFormat = null;
-        // part of fix for 4325421
-        try {
-            fileFormat = getFMT(fis, false);
-        } finally {
-            if (fileFormat == null) {
-                fis.close();
-            }
-        }
-        return new AudioInputStream(fis, fileFormat.getFormat(), fileFormat.getFrameLength());
-    }
-
-
-    //--------------------------------------------------------------------
-
-
-    private AudioFileFormat getFMT(InputStream stream, boolean doReset) throws UnsupportedAudioFileException, IOException {
+    @Override
+    AudioFileFormat getAudioFileFormatImpl(final InputStream stream)
+            throws UnsupportedAudioFileException, IOException {
 
         // assumes sream is rewound
 
-        int bytesRead;
         int nread = 0;
         int fmt;
         int length = 0;
@@ -227,10 +63,6 @@
 
         DataInputStream dis = new DataInputStream( stream );
 
-        if (doReset) {
-            dis.mark(MAX_READ_LENGTH);
-        }
-
         int magic = dis.readInt();
         int fileLength = rllong(dis);
         int waveMagic = dis.readInt();
@@ -244,9 +76,6 @@
 
         if ((magic != WaveFileFormat.RIFF_MAGIC) || (waveMagic != WaveFileFormat.WAVE_MAGIC)) {
             // not WAVE, throw UnsupportedAudioFileException
-            if (doReset) {
-                dis.reset();
-            }
             throw new UnsupportedAudioFileException("not a WAVE file");
         }
 
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileReader.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileReader.java	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, 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
@@ -22,14 +22,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 
 import javax.sound.sampled.AudioFileFormat;
 import javax.sound.sampled.AudioFormat;
@@ -37,29 +34,16 @@
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.UnsupportedAudioFileException;
-import javax.sound.sampled.spi.AudioFileReader;
 
 /**
  * Floating-point encoded (format 3) WAVE file loader.
  *
  * @author Karl Helgason
  */
-public final class WaveFloatFileReader extends AudioFileReader {
+public final class WaveFloatFileReader extends SunFileReader {
 
-    public AudioFileFormat getAudioFileFormat(InputStream stream)
-            throws UnsupportedAudioFileException, IOException {
-
-        stream.mark(200);
-        AudioFileFormat format;
-        try {
-            format = internal_getAudioFileFormat(stream);
-        } finally {
-            stream.reset();
-        }
-        return format;
-    }
-
-    private AudioFileFormat internal_getAudioFileFormat(InputStream stream)
+    @Override
+    AudioFileFormat getAudioFileFormatImpl(final InputStream stream)
             throws UnsupportedAudioFileException, IOException {
 
         RIFFReader riffiterator = new RIFFReader(stream);
@@ -96,30 +80,25 @@
                 break;
             }
         }
-
-        if (!fmt_found)
+        if (!fmt_found || !data_found) {
             throw new UnsupportedAudioFileException();
-        if (!data_found)
-            throw new UnsupportedAudioFileException();
-
+        }
         AudioFormat audioformat = new AudioFormat(
                 Encoding.PCM_FLOAT, samplerate, bits, channels,
                 framesize, samplerate, false);
-        AudioFileFormat fileformat = new AudioFileFormat(
-                AudioFileFormat.Type.WAVE, audioformat,
-                AudioSystem.NOT_SPECIFIED);
-        return fileformat;
+        return new AudioFileFormat(AudioFileFormat.Type.WAVE, audioformat,
+                                   AudioSystem.NOT_SPECIFIED);
     }
 
-    public AudioInputStream getAudioInputStream(InputStream stream)
+    @Override
+    public AudioInputStream getAudioInputStream(final InputStream stream)
             throws UnsupportedAudioFileException, IOException {
 
         AudioFileFormat format = getAudioFileFormat(stream);
+        // we've got everything, the stream is supported and it is at the
+        // beginning of the header, so find the data chunk again and return an
+        // AudioInputStream
         RIFFReader riffiterator = new RIFFReader(stream);
-        if (!riffiterator.getFormat().equals("RIFF"))
-            throw new UnsupportedAudioFileException();
-        if (!riffiterator.getType().equals("WAVE"))
-            throw new UnsupportedAudioFileException();
         while (riffiterator.hasNextChunk()) {
             RIFFReader chunk = riffiterator.nextChunk();
             if (chunk.getFormat().equals("data")) {
@@ -129,39 +108,4 @@
         }
         throw new UnsupportedAudioFileException();
     }
-
-    public AudioFileFormat getAudioFileFormat(URL url)
-            throws UnsupportedAudioFileException, IOException {
-        InputStream stream = url.openStream();
-        AudioFileFormat format;
-        try {
-            format = getAudioFileFormat(new BufferedInputStream(stream));
-        } finally {
-            stream.close();
-        }
-        return format;
-    }
-
-    public AudioFileFormat getAudioFileFormat(File file)
-            throws UnsupportedAudioFileException, IOException {
-        InputStream stream = new FileInputStream(file);
-        AudioFileFormat format;
-        try {
-            format = getAudioFileFormat(new BufferedInputStream(stream));
-        } finally {
-            stream.close();
-        }
-        return format;
-    }
-
-    public AudioInputStream getAudioInputStream(URL url)
-            throws UnsupportedAudioFileException, IOException {
-        return getAudioInputStream(new BufferedInputStream(url.openStream()));
-    }
-
-    public AudioInputStream getAudioInputStream(File file)
-            throws UnsupportedAudioFileException, IOException {
-        return getAudioInputStream(new BufferedInputStream(new FileInputStream(
-                file)));
-    }
 }
--- a/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java	Tue Aug 11 12:32:10 2015 -0700
@@ -229,9 +229,11 @@
                 if (m.peer == null) {
                     m.addNotify();
                 }
+                menus.addElement(m);
                 peer.addMenu(m);
+            } else {
+                menus.addElement(m);
             }
-            menus.addElement(m);
             return m;
         }
     }
--- a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java	Tue Aug 11 12:32:10 2015 -0700
@@ -519,13 +519,7 @@
      * <p>
      * If a system property named {@code "java.awt.headless"} is set
      * to {@code true} then the headless implementation
-     * of {@code Toolkit} is used.
-     * <p>
-     * If there is no {@code "java.awt.headless"} or it is set to
-     * {@code false} and there is a system property named
-     * {@code "awt.toolkit"},
-     * that property is treated as the name of a class that is a subclass
-     * of {@code Toolkit};
+     * of {@code Toolkit} is used,
      * otherwise the default platform-specific implementation of
      * {@code Toolkit} is used.
      * <p>
--- a/jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java	Tue Aug 11 12:32:10 2015 -0700
@@ -160,21 +160,23 @@
         setPropertyType(info.getPropertyType());
         setConstrained(info.isConstrained());
         setBound(bound && info.is(PropertyInfo.Name.bound));
-        if (info.is(PropertyInfo.Name.expert)) {
-            setValue(PropertyInfo.Name.expert.name(), Boolean.TRUE); // compatibility
-            setExpert(true);
-        }
-        if (info.is(PropertyInfo.Name.hidden)) {
-            setValue(PropertyInfo.Name.hidden.name(), Boolean.TRUE); // compatibility
-            setHidden(true);
-        }
-        if (info.is(PropertyInfo.Name.preferred)) {
-            setPreferred(true);
-        }
-        Object visual = info.get(PropertyInfo.Name.visualUpdate);
-        if (visual != null) {
-            setValue(PropertyInfo.Name.visualUpdate.name(), visual);
-        }
+
+        boolean isExpert = info.is(PropertyInfo.Name.expert);
+        setValue(PropertyInfo.Name.expert.name(), isExpert); // compatibility
+        setExpert(isExpert);
+
+        boolean isHidden = info.is(PropertyInfo.Name.hidden);
+        setValue(PropertyInfo.Name.hidden.name(), isHidden); // compatibility
+        setHidden(isHidden);
+
+        setPreferred(info.is(PropertyInfo.Name.preferred));
+
+        boolean isRequired = info.is(PropertyInfo.Name.required);
+        setValue(PropertyInfo.Name.required.name(), isRequired);
+
+        boolean visual = info.is(PropertyInfo.Name.visualUpdate);
+        setValue(PropertyInfo.Name.visualUpdate.name(), visual);
+
         Object description = info.get(PropertyInfo.Name.description);
         if (description != null) {
             setShortDescription(description.toString());
--- a/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java	Tue Aug 11 12:32:10 2015 -0700
@@ -1247,6 +1247,7 @@
      *
      * @param layer  an <code>Integer</code> object specifying this
      *          frame's desktop layer
+     * @throws NullPointerException if {@code layer} is {@code null}
      * @see JLayeredPane
      * @beaninfo
      *     expert: true
--- a/jdk/src/java.desktop/share/classes/javax/swing/TimerQueue.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/TimerQueue.java	Tue Aug 11 12:32:10 2015 -0700
@@ -94,6 +94,9 @@
     void startIfNeeded() {
         if (! running) {
             runningLock.lock();
+            if (running) {
+                return;
+            }
             try {
                 final ThreadGroup threadGroup = AppContext.getAppContext().getThreadGroup();
                 AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
@@ -166,15 +169,17 @@
         try {
             while (running) {
                 try {
-                    Timer timer = queue.take().getTimer();
+                    DelayedTimer runningTimer = queue.take();
+                    Timer timer = runningTimer.getTimer();
                     timer.getLock().lock();
                     try {
                         DelayedTimer delayedTimer = timer.delayedTimer;
-                        if (delayedTimer != null) {
+                        if (delayedTimer == runningTimer) {
                             /*
-                             * Timer is not removed after we get it from
-                             * the queue and before the lock on the timer is
-                             * acquired
+                             * Timer is not removed (delayedTimer != null)
+                             * or not removed and added (runningTimer == delayedTimer)
+                             * after we get it from the queue and before the
+                             * lock on the timer is acquired
                              */
                             timer.post(); // have timer post an event
                             timer.delayedTimer = null;
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextFieldUI.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextFieldUI.java	Tue Aug 11 12:32:10 2015 -0700
@@ -97,12 +97,7 @@
             String kind = elem.getName();
             if (kind != null) {
                 if (kind.equals(AbstractDocument.ContentElementName)) {
-                    return new GlyphView(elem) {
-                        @Override
-                        public int getResizeWeight(int axis) {
-                            return 0;
-                        }
-                    };
+                    return new GlyphView(elem);
                 } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
                     return new I18nFieldView(elem);
                 }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Tue Aug 11 12:32:10 2015 -0700
@@ -940,7 +940,7 @@
                 rootView.setSize(d.width - i.left - i.right -
                         caretMargin, d.height - i.top - i.bottom);
             }
-            else if (d.width == 0 || d.height == 0) {
+            else if (d.width <= 0 || d.height <= 0) {
                 // Probably haven't been layed out yet, force some sort of
                 // initial sizing.
                 rootView.setSize(Integer.MAX_VALUE, Integer.MAX_VALUE);
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java	Tue Aug 11 12:32:10 2015 -0700
@@ -538,17 +538,6 @@
     }
 
     /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int getResizeWeight(int axis) {
-        if (axis == View.X_AXIS) {
-            return 1;
-        }
-        return 0;
-    }
-
-    /**
      * Determines the minimum span for this view along an axis.
      *
      * <p>This implementation returns the longest non-breakable area within
@@ -561,11 +550,13 @@
      */
     @Override
     public float getMinimumSpan(int axis) {
+        int w = getResizeWeight(axis);
+        if (w == 0) {
+            // can't resize
+            return getPreferredSpan(axis);
+        }
         switch (axis) {
             case View.X_AXIS:
-                if (getResizeWeight(X_AXIS) == 0) {
-                    return getPreferredSpan(X_AXIS);
-                }
                 if (minimumSpan < 0) {
                     minimumSpan = 0;
                     int p0 = getStartOffset();
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Tue Aug 11 12:32:10 2015 -0700
@@ -687,12 +687,7 @@
 
         if (toFocus != null) {
             if (parent instanceof EmbeddedFrame) {
-                // JDK-8056915: Try to request focus to the embedder first and
-                // activate the embedded frame through it
-                if (!((EmbeddedFrame) parent).requestFocusToEmbedder()) {
-                    // Otherwise activate the embedded frame directly
-                    ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
-                }
+                ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
             }
             // EmbeddedFrame might have focus before the applet was added.
             // Thus after its activation the most recent focus owner will be
--- a/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java	Tue Aug 11 12:32:10 2015 -0700
@@ -357,15 +357,6 @@
     public void synthesizeWindowActivation(boolean doActivate) {}
 
     /**
-     * Requests the focus to the embedder.
-     *
-     * @return {@code true} if focus request was successful, and {@code false} otherwise.
-     */
-    public boolean requestFocusToEmbedder() {
-        return false;
-    }
-
-    /**
      * Moves this embedded frame to a new location. The top-left corner of
      * the new location is specified by the <code>x</code> and <code>y</code>
      * parameters relative to the native parent component.
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java	Tue Aug 11 12:32:10 2015 -0700
@@ -86,19 +86,24 @@
     @Override
     public int getWidth(ImageObserver observer) {
         updateInfo(observer, ImageObserver.WIDTH);
-        return super.getWidth(observer);
+        return baseImageWidth;
     }
 
     @Override
     public int getHeight(ImageObserver observer) {
         updateInfo(observer, ImageObserver.HEIGHT);
-        return super.getHeight(observer);
+        return baseImageHeight;
     }
 
     @Override
     public Object getProperty(String name, ImageObserver observer) {
         updateInfo(observer, ImageObserver.PROPERTIES);
-        return super.getProperty(name, observer);
+        return Image.UndefinedProperty;
+    }
+
+    @Override
+    public Image getScaledInstance(int width, int height, int hints) {
+        return getResolutionVariant(width, height);
     }
 
     @Override
--- a/jdk/src/java.desktop/share/native/libjsound/PortMixer.c	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/native/libjsound/PortMixer.c	Tue Aug 11 12:32:10 2015 -0700
@@ -272,7 +272,7 @@
 }
 
 void* PORT_NewFloatControl(void* creatorV, void* controlID, char* type,
-                           float min, float max, float precision, char* units) {
+                           float min, float max, float precision, const char* units) {
     ControlCreatorJNI* creator = (ControlCreatorJNI*) creatorV;
     jobject ctrl = NULL;
     jstring unitsString;
--- a/jdk/src/java.desktop/share/native/libjsound/Ports.h	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/share/native/libjsound/Ports.h	Tue Aug 11 12:32:10 2015 -0700
@@ -93,7 +93,7 @@
  * returns an opaque pointer to the created control
  */
 typedef void* (*PORT_NewFloatControlPtr)(void* creator, void* controlID, char* type,
-              float min, float max, float precision, char* units);
+              float min, float max, float precision, const char* units);
 
 /* control: The control to add to current port
  * creator: pointer to the creator struct provided by PORT_GetControls
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java	Tue Aug 11 12:32:10 2015 -0700
@@ -42,6 +42,8 @@
 
     // A pointer to the native GTK FileChooser widget
     private volatile long widget = 0L;
+    private long standaloneWindow;
+    private volatile boolean quit;
 
     GtkFileDialogPeer(FileDialog fd) {
         super(fd);
@@ -111,9 +113,11 @@
     public void setVisible(boolean b) {
         XToolkit.awtLock();
         try {
+            quit = !b;
             if (b) {
                 Runnable task = () -> {
                     showNativeDialog();
+                    standaloneWindow = 0;
                     fd.setVisible(false);
                 };
                 new ManagedLocalsThread(task).start();
@@ -128,7 +132,14 @@
 
     @Override
     public void dispose() {
-        quit();
+        XToolkit.awtLock();
+        try {
+            quit = true;
+            quit();
+        }
+        finally {
+            XToolkit.awtUnlock();
+        }
         super.dispose();
     }
 
@@ -144,6 +155,17 @@
         // have delegated to FileDialog#setFile
     }
 
+    protected void requestXFocus(long time, boolean timeProvided) {
+        if(standaloneWindow == 0) {
+            super.requestXFocus(time, timeProvided);
+            return;
+        }
+        XNETProtocol net_protocol = XWM.getWM().getNETProtocol();
+        if (net_protocol != null) {
+            net_protocol.setActiveWindow(standaloneWindow);
+        }
+    }
+
     @Override
     public void setFilenameFilter(FilenameFilter filter) {
         // We do not implement this method because we
@@ -170,7 +192,21 @@
                 dirname = file.getParent();
             }
         }
-        run(fd.getTitle(), fd.getMode(), dirname, filename,
-            fd.getFilenameFilter(), fd.isMultipleMode(), fd.getX(), fd.getY());
+        if (!quit) {
+            run(fd.getTitle(), fd.getMode(), dirname, filename,
+                    fd.getFilenameFilter(), fd.isMultipleMode(), fd.getX(), fd.getY());
+        }
+    }
+
+    /**
+     * Called by native code when GTK dialog is created.
+     */
+    boolean setWindow(long xid) {
+        if (!quit && widget != 0) {
+            standaloneWindow = xid;
+            requestXFocus();
+            return true;
+        }
+        return false;
     }
 }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java	Tue Aug 11 12:32:10 2015 -0700
@@ -289,7 +289,7 @@
 
             XNETProtocol net_protocol = XWM.getWM().getNETProtocol();
             if (net_protocol != null) {
-                net_protocol.setActiveWindow(this);
+                net_protocol.setActiveWindow(getWindow());
             }
             xSetVisible(true);
         }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XNETProtocol.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XNETProtocol.java	Tue Aug 11 12:32:10 2015 -0700
@@ -326,7 +326,7 @@
         return res;
     }
 
-    public void setActiveWindow(XWindow window) {
+    public void setActiveWindow(long window) {
         if (!active() || !checkProtocol(XA_NET_SUPPORTED, XA_NET_ACTIVE_WINDOW)) {
             return;
         }
@@ -336,7 +336,7 @@
         msg.set_type(XConstants.ClientMessage);
         msg.set_message_type(XA_NET_ACTIVE_WINDOW.getAtom());
         msg.set_display(XToolkit.getDisplay());
-        msg.set_window(window.getWindow());
+        msg.set_window(window);
         msg.set_format(32);
         msg.set_data(0, 1);
         msg.set_data(1, XToolkit.getCurrentServerTime());
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Tue Aug 11 12:32:10 2015 -0700
@@ -316,6 +316,7 @@
     @Override
     public boolean isDisplayChangeSupported() {
         return (isFullScreenSupported()
+                && (getFullScreenWindow() != null)
                 && !((X11GraphicsEnvironment) GraphicsEnvironment
                         .getLocalGraphicsEnvironment()).runningXinerama());
     }
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawImage.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawImage.java	Tue Aug 11 12:32:10 2015 -0700
@@ -46,24 +46,28 @@
         SurfaceData dstData = sg.surfaceData;
         SurfaceData srcData = dstData.getSourceSurfaceData(img,
                 SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor);
-        int compRule = ((AlphaComposite) sg.composite).getRule();
-        float extraAlpha = ((AlphaComposite) sg.composite).getAlpha();
 
-        if (srcData != null && !isBgOperation(srcData, bgColor)
+        if (sg.composite instanceof AlphaComposite) {
+            int compRule = ((AlphaComposite) sg.composite).getRule();
+            float extraAlpha = ((AlphaComposite) sg.composite).getAlpha();
+
+            if (srcData != null && !isBgOperation(srcData, bgColor)
                 && interpType <= AffineTransformOp.TYPE_BILINEAR
                 && (XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(compRule))
-                        || (XRUtils.isTransformQuadrantRotated(tx)) && extraAlpha == 1.0f))
-                         {
-            SurfaceType srcType = srcData.getSurfaceType();
-            SurfaceType dstType = dstData.getSurfaceType();
+                    || (XRUtils.isTransformQuadrantRotated(tx))
+                    && extraAlpha == 1.0f))
+            {
+                SurfaceType srcType = srcData.getSurfaceType();
+                SurfaceType dstType = dstData.getSurfaceType();
 
-            TransformBlit blit = TransformBlit.getFromCache(srcType,
-                    sg.imageComp, dstType);
-            if (blit != null) {
-                blit.Transform(srcData, dstData, sg.composite,
-                        sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2
+                TransformBlit blit = TransformBlit.getFromCache(srcType,
+                        sg.imageComp, dstType);
+                if (blit != null) {
+                    blit.Transform(srcData, dstData, sg.composite,
+                          sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2
                                 - sx1, sy2 - sy1);
                     return;
+                }
             }
         }
 
--- a/jdk/src/java.desktop/unix/native/common/awt/awt.h	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/native/common/awt/awt.h	Tue Aug 11 12:32:10 2015 -0700
@@ -82,7 +82,12 @@
     } while (0)
 
 #define AWT_LOCK_IMPL() \
-    (*env)->CallStaticVoidMethod(env, tkClass, awtLockMID)
+    do { \
+        (*env)->CallStaticVoidMethod(env, tkClass, awtLockMID); \
+        if ((*env)->ExceptionCheck(env)) { \
+            (*env)->ExceptionClear(env); \
+        } \
+    } while(0)
 
 #define AWT_NOFLUSH_UNLOCK_IMPL() \
     do { \
@@ -91,11 +96,10 @@
          (*env)->ExceptionClear(env); \
       } \
       (*env)->CallStaticVoidMethod(env, tkClass, awtUnlockMID); \
+      if ((*env)->ExceptionCheck(env)) { \
+         (*env)->ExceptionClear(env); \
+      } \
       if (pendingException) { \
-         if ((*env)->ExceptionCheck(env)) { \
-            (*env)->ExceptionDescribe(env); \
-            (*env)->ExceptionClear(env); \
-         } \
          (*env)->Throw(env, pendingException); \
       } \
     } while (0)
--- a/jdk/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c	Tue Aug 11 12:32:10 2015 -0700
@@ -71,6 +71,10 @@
         }
         isHeadless = (*env)->CallStaticBooleanMethod(env, graphicsEnvClass,
                                                      headlessFn);
+        if ((*env)->ExceptionCheck(env)) {
+            (*env)->ExceptionClear(env);
+            return JNI_TRUE;
+        }
     }
     return isHeadless;
 }
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/HPkeysym.h	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/HPkeysym.h	Tue Aug 11 12:32:10 2015 -0700
@@ -58,7 +58,7 @@
 
 #ifndef _HPKEYSYM_H
 
-#define _HPKEYSYM
+#define _HPKEYSYM_H
 
 #define hpXK_ClearLine          0x1000FF6F
 #define hpXK_InsertLine         0x1000FF70
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.h	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.h	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, 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
@@ -28,7 +28,7 @@
  ***
  ***/
 #ifndef _AWT_EVENT_H_
-#define _AWT_EVENT_H
+#define _AWT_EVENT_H_
 
 #include "jni_util.h"
 
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Tue Aug 11 12:32:10 2015 -0700
@@ -1564,6 +1564,9 @@
     for (i = 0; i < visScreenInfo->count; i++) {
         XdbeVisualInfo* visInfo = visScreenInfo->visinfo;
         (*env)->CallVoidMethod(env, this, midAddVisual, (visInfo[i]).visual);
+        if ((*env)->ExceptionCheck(env)) {
+            break;
+        }
     }
 #endif /* !HEADLESS */
 }
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_util.c	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_util.c	Tue Aug 11 12:32:10 2015 -0700
@@ -98,5 +98,8 @@
 
     (*env)->CallStaticVoidMethod(env, threadClass, yieldMethodID);
     DASSERT(!((*env)->ExceptionOccurred(env)));
+    if ((*env)->ExceptionCheck(env)) {
+        return JNI_FALSE;
+    }
     return JNI_TRUE;
 } /* awtJNI_ThreadYield() */
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Tue Aug 11 12:32:10 2015 -0700
@@ -576,6 +576,7 @@
     fp_gtk_file_chooser_get_filenames = dl_symbol(
             "gtk_file_chooser_get_filenames");
     fp_gtk_g_slist_length = dl_symbol("g_slist_length");
+    fp_gdk_x11_drawable_get_xid = dl_symbol("gdk_x11_drawable_get_xid");
 }
 
 gboolean gtk2_load(JNIEnv *env)
@@ -904,6 +905,10 @@
 
         // Init the thread system to use GLib in a thread-safe mode
         (*env)->CallStaticVoidMethod(env, clazz, mid_lock);
+        if ((*env)->ExceptionCheck(env)) {
+            AWT_UNLOCK();
+            return FALSE;
+        }
 
         // Calling g_thread_init() multiple times leads to crash on GLib < 2.24
         // We can use g_thread_get_initialized () but it is available only for
@@ -922,7 +927,22 @@
             //called before gtk_init() or gtk_init_check()
             fp_gdk_threads_init();
         }
+        jthrowable pendExcpn = NULL;
+        // Exception raised during mid_getAndSetInitializationNeededFlag
+        // call is saved and error handling is done
+        // after unlock method is called
+        if ((pendExcpn = (*env)->ExceptionOccurred(env)) != NULL) {
+            (*env)->ExceptionClear(env);
+        }
         (*env)->CallStaticVoidMethod(env, clazz, mid_unlock);
+        if (pendExcpn != NULL) {
+            (*env)->Throw(env, pendExcpn);
+        }
+        // check if any exception occured during mid_unlock call
+        if ((*env)->ExceptionCheck(env)) {
+            AWT_UNLOCK();
+            return FALSE;
+        }
     }
     result = (*fp_gtk_init_check)(NULL, NULL);
 
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h	Tue Aug 11 12:32:10 2015 -0700
@@ -27,6 +27,7 @@
 
 #include <stdlib.h>
 #include <jni.h>
+#include <X11/X.h>
 
 #define _G_TYPE_CIC(ip, gt, ct)       ((ct*) ip)
 #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type)    (_G_TYPE_CIC ((instance), (g_type), c_type))
@@ -820,6 +821,7 @@
 void (*fp_gtk_main)(void);
 guint (*fp_gtk_main_level)(void);
 gchar* (*fp_g_path_get_dirname) (const gchar *file_name);
+XID (*fp_gdk_x11_drawable_get_xid) (GdkWindow *drawable);
 
 /**
  * This function is available for GLIB > 2.20, so it MUST be
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <jni_util.h>
 #include <string.h>
+#include <X11/X.h>
 #include "gtk2_interface.h"
 #include "sun_awt_X11_GtkFileDialogPeer.h"
 #include "java_awt_FileDialog.h"
@@ -38,6 +39,7 @@
 static jmethodID filenameFilterCallbackMethodID = NULL;
 static jmethodID setFileInternalMethodID = NULL;
 static jfieldID  widgetFieldID = NULL;
+static jmethodID  setWindowMethodID = NULL;
 
 JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_initIDs
 (JNIEnv *env, jclass cx)
@@ -54,6 +56,10 @@
 
     widgetFieldID = (*env)->GetFieldID(env, cx, "widget", "J");
     DASSERT(widgetFieldID != NULL);
+    CHECK_NULL(widgetFieldID);
+
+    setWindowMethodID = (*env)->GetMethodID(env, cx, "setWindow", "(J)Z");
+    DASSERT(setWindowMethodID != NULL);
 }
 
 static gboolean filenameFilterCallback(const GtkFileFilterInfo * filter_info, gpointer obj)
@@ -401,7 +407,11 @@
 
     fp_gtk_widget_show(dialog);
 
-    fp_gtk_main();
+    XID xid = fp_gdk_x11_drawable_get_xid(dialog->window);
+    if( (*env)->CallBooleanMethod(env, jpeer, setWindowMethodID, xid) ) {
+        fp_gtk_main();
+    }
+
     fp_gdk_threads_leave();
 }
 
--- a/jdk/src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_Ports.c	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_Ports.c	Tue Aug 11 12:32:10 2015 -0700
@@ -431,8 +431,8 @@
             }
         } else { // more than two channels, each channels has its own control.
             for (channel = SND_MIXER_SCHN_FRONT_LEFT; channel <= SND_MIXER_SCHN_LAST; channel++) {
-                if (isPlayback && snd_mixer_selem_has_playback_channel(elem, channel) ||
-                    !isPlayback && snd_mixer_selem_has_capture_channel(elem, channel)) {
+                if ((isPlayback && snd_mixer_selem_has_playback_channel(elem, channel)) ||
+                    (!isPlayback && snd_mixer_selem_has_capture_channel(elem, channel))) {
                     if (getControlSlot(portMixer, &portControl)) {
                         portControl->elem = elem;
                         portControl->portType = portMixer->types[portIndex];
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Tue Aug 11 12:32:10 2015 -0700
@@ -251,15 +251,6 @@
         }
     }
 
-    public boolean requestFocusToEmbedder() {
-        if (isEmbeddedInIE) {
-            final WEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor()
-                                                       .getPeer(this);
-            return peer.requestFocusToEmbedder();
-        }
-        return false;
-    }
-
     public void registerAccelerator(AWTKeyStroke stroke) {}
     public void unregisterAccelerator(AWTKeyStroke stroke) {}
 
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Tue Aug 11 12:32:10 2015 -0700
@@ -79,10 +79,4 @@
         return !Win32GraphicsEnvironment.isDWMCompositionEnabled();
     }
 
-    /**
-     * Sets the focus to plugin control window, the parent of embedded frame.
-     * Eventually, it will synthesizeWindowActivation to activate the embedded frame,
-     * if plugin control window gets the focus.
-     */
-    public native boolean requestFocusToEmbedder();
 }
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WListPeer.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WListPeer.java	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, 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
@@ -39,10 +39,9 @@
     // ListPeer implementation
 
     @Override
-    @SuppressWarnings("deprecation")
     public int[] getSelectedIndexes() {
         List l = (List)target;
-        int len = l.countItems();
+        int len = l.getItemCount();
         int sel[] = new int[len];
         int nsel = 0;
         for (int i = 0 ; i < len ; i++) {
@@ -93,10 +92,9 @@
 
     @Override
     public native void delItems(int start, int end);
-    @SuppressWarnings("deprecation")
     public void clear() {
         List l = (List)target;
-        delItems(0, l.countItems());
+        delItems(0, l.getItemCount());
     }
     @Override
     public native void select(int index);
@@ -131,7 +129,6 @@
     native void create(WComponentPeer parent);
 
     @Override
-    @SuppressWarnings("deprecation")
     void initialize() {
         List li = (List)target;
 
@@ -144,7 +141,7 @@
         }
 
         // add any items that were already inserted in the target.
-        int  nitems = li.countItems();
+        int  nitems = li.getItemCount();
         if (nitems > 0) {
             String[] items = new String[nitems];
             int maxWidth = 0;
@@ -160,7 +157,7 @@
         }
 
         // set whether this list should allow multiple selections.
-        setMultipleSelections(li.allowsMultipleSelections());
+        setMultipleSelections(li.isMultipleMode());
 
         // select the item if necessary.
         int sel[] = li.getSelectedIndexes();
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp	Tue Aug 11 12:32:10 2015 -0700
@@ -1961,29 +1961,6 @@
     CATCH_BAD_ALLOC;
 }
 
-JNIEXPORT jboolean JNICALL
-Java_sun_awt_windows_WEmbeddedFramePeer_requestFocusToEmbedder(JNIEnv *env, jobject self)
-{
-    jboolean result = JNI_FALSE;
-
-    TRY;
-
-    AwtFrame *frame = NULL;
-
-    PDATA pData;
-    JNI_CHECK_PEER_GOTO(self, ret);
-    frame = (AwtFrame *)pData;
-
-    // JDK-8056915: During initial applet activation, set focus to plugin control window
-    HWND hwndParent = ::GetParent(frame->GetHWnd());
-
-    result = SetFocusToPluginControl(hwndParent);
-
-    CATCH_BAD_ALLOC_RET(JNI_FALSE);
-ret:
-    return result;
-}
-
 } /* extern "C" */
 
 static bool SetFocusToPluginControl(HWND hwndPlugin)
--- a/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeATInstance.cpp	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeATInstance.cpp	Tue Aug 11 12:32:10 2015 -0700
@@ -87,7 +87,7 @@
 AccessBridgeATInstance::initiateIPC() {
     DWORD errorCode;
 
-    PrintDebugString("\r\nin AccessBridgeATInstance::initiateIPC()");
+    PrintDebugString("\r\nIn AccessBridgeATInstance::initiateIPC()");
 
     // open Windows-initiated IPC filemap & map it to a ptr
 
--- a/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeJavaEntryPoints.cpp	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeJavaEntryPoints.cpp	Tue Aug 11 12:32:10 2015 -0700
@@ -40,7 +40,7 @@
                                                          jobject bridgeObject) {
     jniEnv = jniEnvironment;
     accessBridgeObject = (jobject)bridgeObject;
-    PrintDebugString("AccessBridgeJavaEntryPoints(%X, %X) called", jniEnv, accessBridgeObject);
+    PrintDebugString("AccessBridgeJavaEntryPoints(%p, %p) called", jniEnv, accessBridgeObject);
 }
 
 
--- a/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/JavaAccessBridge.cpp	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/JavaAccessBridge.cpp	Tue Aug 11 12:32:10 2015 -0700
@@ -89,53 +89,31 @@
         theJavaAccessBridge->javaRun(env, obj);
     }
 
-#if 0 // SetDlgItemText has caused problems with JAWS
-    /**
-     * Append debug info to dialog
-     *
-     */
-    void AppendToCallInfo(char *s) {
-        char buffer[4096];
-
-        PrintDebugString(s);
-
-        GetDlgItemText(theDialogWindow, cCallInfo, buffer, sizeof(buffer));
-        if (strlen(buffer) < (sizeof(buffer) - strlen(s))) {
-            strncat(buffer, s, sizeof(buffer));
-            SetDlgItemText(theDialogWindow, cCallInfo, buffer);
-        } else {
-            SetDlgItemText(theDialogWindow, cCallInfo, s);
-        }
-    }
-#endif
-
-
     /**
      * Our window proc
      *
      */
-    BOOL APIENTRY AccessBridgeDialogProc (HWND hDlg, UINT message, UINT wParam, LONG lParam) {
+    BOOL APIENTRY AccessBridgeDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
         int command;
         COPYDATASTRUCT *sentToUs;
         char *package;
-        //DEBUG_CODE(char buffer[256]);
 
         switch (message) {
         case WM_INITDIALOG:
-            //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, "Initializing"));
+            PrintDebugString("In AccessBridgeDialog - Initializing");
             break;
 
         case WM_COMMAND:
             command = LOWORD (wParam);
+            PrintDebugString("In AccessBridgeDialog - Got WM_COMMAND, command: %X", command);
             break;
 
             // call from Java with data for us to deliver
         case WM_COPYDATA:
             if (theDialogWindow == (HWND) wParam) {
-                //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, "Got WM_COPYDATA from ourselves"));
+                PrintDebugString("In AccessBridgeDialog - Got WM_COPYDATA from ourselves");
             } else {
-                //DEBUG_CODE(sprintf(buffer, "Got WM_COPYDATA from HWND %p", wParam));
-                //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, buffer));
+                PrintDebugString("In AccessBridgeDialog - Got WM_COPYDATA from HWND %p", wParam);
                 sentToUs = (COPYDATASTRUCT *) lParam;
                 package = (char *) sentToUs->lpData;
                 theJavaAccessBridge->processPackage(package, sentToUs->cbData);
@@ -147,18 +125,16 @@
             // wParam == sourceHwnd
             // lParam == buffer size in shared memory
             if (theDialogWindow == (HWND) wParam) {
-                //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, "Got AB_MESSAGE_WAITING from ourselves"));
+                PrintDebugString("In AccessBridgeDialog - Got AB_MESSAGE_WAITING from ourselves");
             } else {
-                //DEBUG_CODE(sprintf(buffer, "Got AB_MESSAGE_WAITING from HWND %p", wParam));
-                //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, buffer));
-                LRESULT returnVal = theJavaAccessBridge->receiveMemoryPackage((HWND) wParam, lParam);
+                PrintDebugString("In AccessBridgeDialog - Got AB_MESSAGE_WAITING from HWND %p", wParam);
+                LRESULT returnVal = theJavaAccessBridge->receiveMemoryPackage((HWND) wParam, (long) lParam);
             }
             break;
 
             // a JavaAccessBridge DLL is going away
         case AB_DLL_GOING_AWAY:
-            // wParam == sourceHwnd
-            //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, "Got AB_DLL_GOING_AWAY message"));
+            PrintDebugString("In AccessBridgeDialog - Got AB_DLL_GOING_AWAY message");
             theJavaAccessBridge->WindowsATDestroyed((HWND) wParam);
             break;
 
@@ -169,6 +145,7 @@
                 // A new Windows AT just said "hi";
                 // say "hi" back so it can mate up with us
                 // otherwise don't do anything (e.g. don't set up data structures yet)
+                PrintDebugString("In AccessBridgeDialog - Got theFromWindowsHelloMsgID message");
                 theJavaAccessBridge->postHelloToWindowsDLLMsg((HWND) wParam);
             }
         }
@@ -324,9 +301,9 @@
  */
 void
 JavaAccessBridge::postHelloToWindowsDLLMsg(HWND destHwnd) {
-    PrintDebugString("\r\nin JavaAccessBridge::postHelloToWindowsDLLMsg");
+    PrintDebugString("\r\nIn JavaAccessBridge::postHelloToWindowsDLLMsg");
     PrintDebugString("  calling PostMessage(%p, %X, %p, %p)",
-                     destHwnd, theFromJavaHelloMsgID, dialogWindow, javaVM);
+                     destHwnd, theFromJavaHelloMsgID, dialogWindow, dialogWindow);
     PostMessage(destHwnd, theFromJavaHelloMsgID, (WPARAM) dialogWindow, (LPARAM) dialogWindow);
 }
 
@@ -2493,7 +2470,7 @@
                                     jobject eventObj, jobject source) {                 \
                                                                                         \
         PrintDebugString("\r\nFiring event id = %d(%p, %p, %p, %p); vmID = %X",         \
-                         eventConstant, env, callingObj, eventObj, source, javaVM);     \
+                         eventConstant, env, callingObj, eventObj, source, dialogWindow); \
                                                                                         \
         /* sanity check */                                                              \
         if (ATs == (AccessBridgeATInstance *) 0) {                                      \
@@ -2531,7 +2508,7 @@
     void JavaAccessBridge::javaShutdown(JNIEnv *env, jobject callingObj) {
 
         PrintDebugString("\r\nFiring event id = %d(%p, %p); vmID = %X",
-                         cJavaShutdownEvent, env, callingObj, javaVM);
+                         cJavaShutdownEvent, env, callingObj, dialogWindow);
 
         /* sanity check */
         if (ATs == (AccessBridgeATInstance *) 0) {
--- a/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/JavaAccessBridge.h	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/JavaAccessBridge.h	Tue Aug 11 12:32:10 2015 -0700
@@ -44,7 +44,7 @@
                             LPVOID lpvReserved);
         void AppendToCallOutput(char *s);
         BOOL APIENTRY AccessBridgeDialogProc(HWND hDlg, UINT message,
-                                             UINT wParam, LONG lParam);
+                                             WPARAM wParam, LPARAM lParam);
 }
 
 /**
--- a/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeJavaVMInstance.cpp	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeJavaVMInstance.cpp	Tue Aug 11 12:32:10 2015 -0700
@@ -188,7 +188,7 @@
  *               with the Java AccessBridge DLL
  *
  *               NOTE: WM_COPYDATA is only for one-way IPC; there
- *               is now way to return parameters (especially big ones)
+ *               is no way to return parameters (especially big ones)
  *               Use sendMemoryPackage() to do that!
  */
 LRESULT
--- a/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeWindowsEntryPoints.cpp	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeWindowsEntryPoints.cpp	Tue Aug 11 12:32:10 2015 -0700
@@ -51,7 +51,6 @@
         // open our window
         if (theWindowsAccessBridge != (WinAccessBridge *) 0) {
             theWindowsAccessBridge->initWindow();
-            DEBUG_CODE(SetDlgItemText(theDialogWindow, cInvokedByText, "Windows"));
         }
     }
 
--- a/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/WinAccessBridge.cpp	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/WinAccessBridge.cpp	Tue Aug 11 12:32:10 2015 -0700
@@ -366,7 +366,7 @@
 WinAccessBridge::rendezvousWithNewJavaDLL(HWND JavaBridgeDLLwindow, long vmID) {
     LRESULT returnVal;
 
-    PrintDebugString("in JavaAccessBridge::rendezvousWithNewJavaDLL(%p, %X)",
+    PrintDebugString("in WinAccessBridge::rendezvousWithNewJavaDLL(%p, %X)",
                      JavaBridgeDLLwindow, vmID);
 
     isVMInstanceChainInUse = true;
@@ -880,7 +880,7 @@
         return FALSE;
     }
 
-    PrintDebugString("  in WinAccessBridge::isJavaWindow");
+    PrintDebugString("In WinAccessBridge::isJavaWindow");
 
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FileDialog/ModalFocus/FileDialogModalFocusTest.java	Tue Aug 11 12:32:10 2015 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2015, 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 8025815
+   @summary Child FileDialog of modal dialog does not get focus on Gnome
+   @author Semyon Sadetsky
+  */
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.BufferedImage;
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
+
+public class FileDialogModalFocusTest {
+    public static void main(String[] args) throws Exception {
+        Frame frame = new Frame();
+        FileDialog fileDialog = new FileDialog((Frame) null);
+        test(frame, fileDialog);
+        frame = new Frame();
+        fileDialog = new FileDialog(frame);
+        test(frame, fileDialog);
+        System.out.println("ok");
+    }
+
+    private static void test(final Frame frame, final FileDialog fileDialog)
+            throws InterruptedException, InvocationTargetException,
+            AWTException {
+        Button button = new Button();
+        button.setBackground(Color.RED);
+        button.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                fileDialog.setVisible(true);
+            }
+        });
+        frame.add(button);
+        frame.setSize(200, 200);
+        EventQueue.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame.setVisible(true);
+            }
+        });
+        Robot robot = new Robot();
+        robot.setAutoDelay(200);
+        robot.waitForIdle();
+        Point point = button.getLocationOnScreen();
+        point.translate(100, 100);
+        robot.mouseMove(point.x, point.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        int delay = 0;
+        while (frame.isFocused() && delay < 2000) {
+            robot.delay(50);
+            delay += 50;
+        }
+        ReentrantLock lock = new ReentrantLock();
+        Condition condition = lock.newCondition();
+        button.addComponentListener(new ComponentAdapter() {
+            @Override
+            public void componentResized(ComponentEvent e) {
+                lock.lock();
+                condition.signal();
+                lock.unlock();
+            }
+        });
+        lock.lock();
+        EventQueue.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
+            }
+        });
+        condition.await(5, TimeUnit.SECONDS);
+        lock.unlock();
+        robot.delay(200);
+        robot.waitForIdle();
+        EventQueue.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                button.requestFocus();
+                Point p = new Point(button.getWidth() - 10, button.getHeight() - 10);
+                SwingUtilities.convertPointToScreen(p, button);
+                robot.mouseMove(p.x, p.y);
+                robot.mousePress(InputEvent.BUTTON1_MASK);
+                robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            }
+        });
+        robot.waitForIdle();
+        Point p = new Point(100, 100);
+        SwingUtilities.convertPointToScreen(p, button);
+        BufferedImage image = robot.createScreenCapture(
+                new Rectangle(p,
+                        new Dimension(button.getWidth() - 200,
+                                button.getHeight() - 200)));
+        boolean found = false;
+        for (int x = 0; x < image.getWidth(); x+=50) {
+            for (int y = 0; y < image.getHeight(); y+=50) {
+                if( (image.getRGB(x, y) & 0x00FFFF) != 0 ) {
+                    found = true;
+                    break;
+                };
+            }
+        }
+        frame.dispose();
+        robot.waitForIdle();
+        fileDialog.dispose();
+        if(!found) {
+            throw new RuntimeException("file chooser is underneath");
+        }
+    }
+}
\ No newline at end of file
--- a/jdk/test/java/awt/event/KeyEvent/KeyTyped/CtrlASCII.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/test/java/awt/event/KeyEvent/KeyTyped/CtrlASCII.java	Tue Aug 11 12:32:10 2015 -0700
@@ -257,8 +257,12 @@
     }// start()
     public void punchCtrlKey( Robot ro, int keyCode ) {
         ro.keyPress(KeyEvent.VK_CONTROL);
-        ro.keyPress(keyCode);
-        ro.keyRelease(keyCode);
+        try {
+            ro.keyPress(keyCode);
+            ro.keyRelease(keyCode);
+        }catch(IllegalArgumentException iae) {
+            System.err.println("skip probably invalid keyCode "+keyCode);
+        }
         ro.keyRelease(KeyEvent.VK_CONTROL);
         ro.delay(200);
     }
--- a/jdk/test/java/awt/image/DrawImage/IncorrectClipXorModeSurface2Surface.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/test/java/awt/image/DrawImage/IncorrectClipXorModeSurface2Surface.java	Tue Aug 11 12:32:10 2015 -0700
@@ -40,7 +40,7 @@
 
 /**
  * @test
- * @bug 8061831
+ * @bug 8061831 8130400
  * @summary Tests drawing volatile image to volatile image using different
  *          clips + xor mode. Results of the blit compatibleImage to
  *          compatibleImage is used for comparison.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionCachedImageTest.java	Tue Aug 11 12:32:10 2015 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2015, 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.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.geom.Dimension2D;
+import java.awt.image.BufferedImage;
+import sun.awt.image.MultiResolutionCachedImage;
+
+/**
+ * @test
+ * @bug 8132123
+ * @author Alexander Scherbatiy
+ * @summary MultiResolutionCachedImage unnecessarily creates base image to get
+ *          its size
+ * @modules java.desktop/sun.awt.image
+ * @run main MultiResolutionCachedImageTest
+ */
+public class MultiResolutionCachedImageTest {
+
+    private static final Color TEST_COLOR = Color.BLUE;
+
+    public static void main(String[] args) {
+
+        Image image = new TestMultiResolutionCachedImage(100);
+
+        image.getWidth(null);
+        image.getHeight(null);
+        image.getProperty("comment", null);
+
+        int scaledSize = 50;
+        Image scaledImage = image.getScaledInstance(scaledSize, scaledSize,
+                Image.SCALE_SMOOTH);
+
+        if (!(scaledImage instanceof BufferedImage)) {
+            throw new RuntimeException("Wrong scaled image!");
+        }
+
+        BufferedImage buffScaledImage = (BufferedImage) scaledImage;
+
+        if (buffScaledImage.getWidth() != scaledSize
+                || buffScaledImage.getHeight() != scaledSize) {
+            throw new RuntimeException("Wrong scaled image!");
+        }
+
+        if (buffScaledImage.getRGB(scaledSize / 2, scaledSize / 2) != TEST_COLOR.getRGB()) {
+            throw new RuntimeException("Wrong scaled image!");
+        }
+    }
+
+    private static Dimension2D getDimension(int size) {
+        return new Dimension(size, size);
+    }
+
+    private static Dimension2D[] getSizes(int size) {
+        return new Dimension2D[]{getDimension(size), getDimension(2 * size)};
+    }
+
+    private static Image createImage(int width, int height) {
+        BufferedImage buffImage = new BufferedImage(width, height,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics g = buffImage.createGraphics();
+        g.setColor(TEST_COLOR);
+        g.fillRect(0, 0, width, height);
+        return buffImage;
+    }
+
+    private static class TestMultiResolutionCachedImage
+            extends MultiResolutionCachedImage {
+
+        private final int size;
+
+        public TestMultiResolutionCachedImage(int size) {
+            super(size, size, getSizes(size), (w, h) -> createImage(w, h));
+            this.size = size;
+        }
+
+        @Override
+        public Image getResolutionVariant(int width, int height) {
+            if (width == size || height == size) {
+                throw new RuntimeException("Base image is requested!");
+            }
+            return super.getResolutionVariant(width, height);
+        }
+
+        @Override
+        protected Image getBaseImage() {
+            throw new RuntimeException("Base image is used");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/4058433/TestBeanInfoPriority.java	Tue Aug 11 12:32:10 2015 -0700
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2015, 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.event.ActionListener;
+import java.awt.event.MouseListener;
+import java.beans.BeanDescriptor;
+import java.beans.BeanInfo;
+import java.beans.BeanProperty;
+import java.beans.EventSetDescriptor;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.JavaBean;
+import java.beans.MethodDescriptor;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+import javax.swing.SwingContainer;
+import java.util.Arrays;
+
+/**
+ * @test
+ * @bug 4058433 8131055
+ * @summary Check if the user-defined bean info
+ *          is not overridden with the annotated one.
+ * @author a.stepanov
+ */
+
+
+public class TestBeanInfoPriority {
+
+    // ========== test bean (annotations must be ignored!) ==========
+
+    @JavaBean(
+            description = "annotation-description",
+            defaultProperty = "other",
+            defaultEventSet = "mouse")
+    @SwingContainer(value = false)
+    public static class TestClass {
+
+        private int    value;
+        private double other;
+
+        @BeanProperty(
+                bound     = false,
+                expert    = false,
+                hidden    = false,
+                preferred = false,
+                required  = false,
+                visualUpdate = false,
+                description = "annotation-value",
+                enumerationValues = {
+                    "javax.swing.SwingConstants.NORTH"}
+                )
+        public void setValue(int v) { value = v; }
+        public  int getValue()      { return value; }
+
+
+        @BeanProperty(
+            bound     = true,
+            expert    = true,
+            hidden    = true,
+            preferred = true,
+            required  = true,
+            visualUpdate = true,
+            description = "annotation-other",
+            enumerationValues = {
+                "javax.swing.SwingConstants.LEFT",
+                "javax.swing.SwingConstants.RIGHT",
+                "javax.swing.SwingConstants.CENTER"}
+            )
+        public   void setOther(double o) { other = o; }
+        public double getOther()         { return other; }
+
+        public void addActionListener(ActionListener l) {}
+        public void removeActionListener(ActionListener l) {}
+
+        public void addMouseListener(MouseListener l) {}
+        public void removeMouseListener(MouseListener l) {}
+    }
+
+    // ========== user-defined bean info ==========
+
+    public static class TestClassBeanInfo extends SimpleBeanInfo {
+
+        private static final int iOther = 0;
+        private static final int iValue = 1;
+
+        private static final int iAction = 0;
+        private static final int iMouse  = 1;
+
+
+        @Override
+        public BeanDescriptor getBeanDescriptor() {
+
+            BeanDescriptor bd = new BeanDescriptor(TestClass.class, null);
+            bd.setShortDescription("user-defined-description");
+            bd.setValue("isContainer", true);
+            bd.setValue("containerDelegate", "user-defined-delegate");
+
+            return bd;
+        }
+
+        @Override
+        public PropertyDescriptor[] getPropertyDescriptors() {
+
+            PropertyDescriptor[] p = new PropertyDescriptor[2];
+
+            try {
+
+                // value
+                PropertyDescriptor pdValue = new PropertyDescriptor(
+                    "value", TestClass.class, "getValue", "setValue");
+                pdValue.setBound(true);
+                pdValue.setConstrained(true);
+                pdValue.setExpert(true);
+                pdValue.setHidden(true);
+                pdValue.setPreferred(true);
+                pdValue.setValue("required", true);
+                pdValue.setValue("visualUpdate", true);
+                pdValue.setShortDescription("user-defined-value");
+                pdValue.setValue("enumerationValues", new Object[]{
+                        "EAST", 3, "javax.swing.SwingConstants.EAST",
+                        "WEST", 7, "javax.swing.SwingConstants.WEST"});
+                p[iValue] = pdValue;
+
+                // other
+                PropertyDescriptor pdOther = new PropertyDescriptor(
+                        "other", TestClass.class, "getOther", "setOther");
+                pdOther.setBound(false);
+                pdOther.setConstrained(false);
+                pdOther.setExpert(false);
+                pdOther.setHidden(false);
+                pdOther.setPreferred(false);
+                pdOther.setValue("required", false);
+                pdOther.setValue("visualUpdate", false);
+                pdOther.setShortDescription("user-defined-other");
+                pdOther.setValue("enumerationValues", new Object[]{
+                        "TOP", 1, "javax.swing.SwingConstants.TOP"});
+                p[iOther] = pdOther;
+
+            } catch(IntrospectionException e) {
+                e.printStackTrace();
+            }
+
+            return p;
+        }
+
+        @Override
+        public EventSetDescriptor[] getEventSetDescriptors() {
+            EventSetDescriptor[] es = new EventSetDescriptor[2];
+            try {
+                es[iAction] = new EventSetDescriptor(
+                        TestClass.class,
+                        "actionListener",
+                        java.awt.event.ActionListener.class,
+                        new String[] {"actionPerformed"},
+                        "addActionListener",
+                        "removeActionListener");
+                es[iMouse] = new EventSetDescriptor(
+                        TestClass.class,
+                        "mouseListener",
+                        java.awt.event.MouseListener.class,
+                        new String[] {"mouseClicked", "mousePressed", "mouseReleased", "mouseEntered", "mouseExited"},
+                        "addMouseListener",
+                        "removeMouseListener");
+            } catch(IntrospectionException e) {
+                e.printStackTrace();
+            }
+            return es;
+        }
+
+        @Override
+        public MethodDescriptor[] getMethodDescriptors() {
+            MethodDescriptor[] m = new MethodDescriptor[0];
+            return m;
+        }
+
+        @Override
+        public int getDefaultPropertyIndex() { return iValue; } // default: value
+
+        @Override
+        public int getDefaultEventIndex() { return iAction; } // default: action
+
+        @Override
+        public java.awt.Image getIcon(int iconKind) { return null; }
+    }
+
+    // ========== auxiliary functions ==========
+
+    static void checkEq(String what, Object v, Object ref) throws Exception {
+
+        if ((v != null) && v.equals(ref)) {
+            System.out.println(what + ": ok (" + ref.toString() + ")");
+        } else {
+            throw new Exception(
+                "invalid " + what + ", expected: \"" + ref + "\", got: \"" + v + "\"");
+        }
+    }
+
+    static void checkEnumEq(String what, Object v, Object ref[]) throws Exception {
+
+        what = "\"" + what + "\"";
+        if (v == null) {
+            throw new Exception("null " + what + " enumeration values");
+        }
+
+        String msg = "invalid " + what + " enumeration values";
+        if (!(v instanceof Object[])) { throw new Exception(msg); }
+
+        if (Arrays.equals((Object []) v, ref)) {
+            System.out.println(what + " enumeration values: ok");
+        } else { throw new Exception(msg); }
+    }
+
+
+    // ========== test ==========
+
+
+    public static void main(String[] args) throws Exception {
+
+        BeanInfo i = Introspector.getBeanInfo(TestClass.class, Object.class);
+        BeanDescriptor bd = i.getBeanDescriptor();
+
+        checkEq("description", bd.getShortDescription(), "user-defined-description");
+        checkEq("default property index", i.getDefaultPropertyIndex(), 1);
+        checkEq("default event index", i.getDefaultEventIndex(), 0);
+
+        checkEq("isContainer", i.getBeanDescriptor().getValue("isContainer"), true);
+        checkEq("containerDelegate",
+            i.getBeanDescriptor().getValue("containerDelegate"), "user-defined-delegate");
+        System.out.println("");
+
+        PropertyDescriptor[] pds = i.getPropertyDescriptors();
+        for (PropertyDescriptor pd: pds) {
+            String name = pd.getName();
+            switch (name) {
+                case "value":
+                    checkEq("\"value\" isBound",       pd.isBound(),       true);
+                    checkEq("\"value\" isConstrained", pd.isConstrained(), true);
+                    checkEq("\"value\" isExpert",      pd.isExpert(),      true);
+                    checkEq("\"value\" isHidden",      pd.isHidden(),      true);
+                    checkEq("\"value\" isPreferred",   pd.isPreferred(),   true);
+                    checkEq("\"value\" required",      pd.getValue("required"),     true);
+                    checkEq("\"value\" visualUpdate",  pd.getValue("visualUpdate"), true);
+
+                    checkEq("\"value\" description",   pd.getShortDescription(), "user-defined-value");
+
+                    checkEnumEq(pd.getName(), pd.getValue("enumerationValues"),
+                        new Object[]{
+                        "EAST", 3, "javax.swing.SwingConstants.EAST",
+                        "WEST", 7, "javax.swing.SwingConstants.WEST"});
+                    System.out.println("");
+                    break;
+                case "other":
+                    checkEq("\"other\" isBound",       pd.isBound(),       false);
+                    checkEq("\"other\" isConstrained", pd.isConstrained(), false);
+                    checkEq("\"other\" isExpert",      pd.isExpert(),      false);
+                    checkEq("\"other\" isHidden",      pd.isHidden(),      false);
+                    checkEq("\"other\" isPreferred",   pd.isPreferred(),   false);
+                    checkEq("\"other\" required",      pd.getValue("required"),     false);
+                    checkEq("\"other\" visualUpdate",  pd.getValue("visualUpdate"), false);
+
+                    checkEq("\"other\" description",   pd.getShortDescription(), "user-defined-other");
+
+                    checkEnumEq(pd.getName(), pd.getValue("enumerationValues"),
+                        new Object[]{"TOP", 1, "javax.swing.SwingConstants.TOP"});
+                    System.out.println("");
+                    break;
+                default:
+                    throw new Exception("invalid property descriptor: " + name);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/8130937/TestBooleanBeanProperties.java	Tue Aug 11 12:32:10 2015 -0700
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 2015, 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.beans.BeanProperty;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.beans.PropertyDescriptor;
+
+/**
+ * @test
+ * @bug 8130937
+ * @summary Tests the booleans properties of the BeanProperty annotation
+ * @library ..
+ */
+public final class TestBooleanBeanProperties {
+
+    public static void main(final String[] args) {
+        test(Empty.class, false, false, false, false, false, false);
+        test(BoundTrue.class, false, false, false, false, false, false);
+        test(BoundFalse.class, false, false, false, false, false, false);
+        test(BoundListener.class, true, false, false, false, false, false);
+        test(BoundFalseListener.class, false, false, false, false, false, false);
+        test(BoundTrueListener.class, true, false, false, false, false, false);
+        test(ExpertTrue.class, false, true, false, false, false, false);
+        test(ExpertFalse.class, false, false, false, false, false, false);
+        test(HiddenTrue.class, false, false, true, false, false, false);
+        test(HiddenFalse.class, false, false, false, false, false, false);
+        test(PreferredTrue.class, false, false, false, true, false, false);
+        test(PreferredFalse.class, false, false, false, false, false, false);
+        test(RequiredTrue.class, false, false, false, false, true, false);
+        test(RequiredFalse.class, false, false, false, false, false, false);
+        test(VisualUpdateTrue.class, false, false, false, false, false, true);
+        test(VisualUpdateFalse.class, false, false, false, false, false, false);
+        test(All.class, true, true, true, true, true, true);
+    }
+
+    private static void test(Class<?> cls, boolean isBound, boolean isExpert,
+                             boolean isHidden, boolean isPref, boolean isReq,
+                             boolean isVS) {
+        PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(cls, "value");
+        if (pd.isBound() != isBound) {
+            throw new RuntimeException("isBound should be: " + isBound);
+        }
+        if (pd.isExpert() != isExpert || getValue(pd, "expert") != isExpert) {
+            throw new RuntimeException("isExpert should be:" + isExpert);
+        }
+        if (pd.isHidden() != isHidden || getValue(pd, "hidden") != isHidden) {
+            throw new RuntimeException("isHidden should be: " + isHidden);
+        }
+        if (pd.isPreferred() != isPref) {
+            throw new RuntimeException("isPreferred should be: " + isPref);
+        }
+        if (getValue(pd, "required") != isReq) {
+            throw new RuntimeException("required should be: " + isReq);
+        }
+        if (getValue(pd, "visualUpdate") != isVS) {
+            throw new RuntimeException("required should be: " + isVS);
+        }
+    }
+
+    private static boolean getValue(PropertyDescriptor pd, String value) {
+        return (boolean) pd.getValue(value);
+    }
+    ////////////////////////////////////////////////////////////////////////////
+
+    public static final class Empty {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
+    public static final class All {
+
+        private int value;
+
+        private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(bound = true, expert = true, hidden = true,
+                      preferred = true, required = true, visualUpdate = true)
+        public void setValue(int value) {
+            this.value = value;
+        }
+
+        public void addPropertyChangeListener(PropertyChangeListener l) {
+            pcs.addPropertyChangeListener(l);
+        }
+
+        public void removePropertyChangeListener(PropertyChangeListener l) {
+            pcs.removePropertyChangeListener(l);
+        }
+    }
+    ////////////////////////////////////////////////////////////////////////////
+    // bound property
+    ////////////////////////////////////////////////////////////////////////////
+
+    public static final class BoundTrue {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(bound = true)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
+    public static final class BoundFalse {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(bound = false)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
+    public static final class BoundListener {
+
+        private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        public void setValue(int value) {
+            this.value = value;
+        }
+
+        public void addPropertyChangeListener(PropertyChangeListener l) {
+            pcs.addPropertyChangeListener(l);
+        }
+
+        public void removePropertyChangeListener(PropertyChangeListener l) {
+            pcs.removePropertyChangeListener(l);
+        }
+    }
+
+    public static final class BoundFalseListener {
+
+        private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(bound = false)
+        public void setValue(int value) {
+            this.value = value;
+        }
+
+        public void addPropertyChangeListener(PropertyChangeListener l) {
+            pcs.addPropertyChangeListener(l);
+        }
+
+        public void removePropertyChangeListener(PropertyChangeListener l) {
+            pcs.removePropertyChangeListener(l);
+        }
+    }
+
+    public static final class BoundTrueListener {
+
+        private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(bound = true)
+        public void setValue(int value) {
+            this.value = value;
+        }
+
+        public void addPropertyChangeListener(PropertyChangeListener l) {
+            pcs.addPropertyChangeListener(l);
+        }
+
+        public void removePropertyChangeListener(PropertyChangeListener l) {
+            pcs.removePropertyChangeListener(l);
+        }
+    }
+    ////////////////////////////////////////////////////////////////////////////
+    // expert property
+    ////////////////////////////////////////////////////////////////////////////
+
+    public static final class ExpertTrue {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(expert = true)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
+    public static final class ExpertFalse {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(expert = false)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+    ////////////////////////////////////////////////////////////////////////////
+    // hidden property
+    ////////////////////////////////////////////////////////////////////////////
+
+    public static final class HiddenTrue {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(hidden = true)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
+    public static final class HiddenFalse {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(hidden = false)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+    ////////////////////////////////////////////////////////////////////////////
+    // preferred property
+    ////////////////////////////////////////////////////////////////////////////
+
+    public static final class PreferredTrue {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(preferred = true)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
+    public static final class PreferredFalse {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(preferred = false)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+    ////////////////////////////////////////////////////////////////////////////
+    // required property
+    ////////////////////////////////////////////////////////////////////////////
+
+    public static final class RequiredTrue {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(required = true)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
+    public static final class RequiredFalse {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(required = false)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+    ////////////////////////////////////////////////////////////////////////////
+    // visualUpdate property
+    ////////////////////////////////////////////////////////////////////////////
+
+    public static final class VisualUpdateTrue {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(visualUpdate = true)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
+    public static final class VisualUpdateFalse {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(visualUpdate = false)
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+}
--- a/jdk/test/java/beans/Performance/Test4058433.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/test/java/beans/Performance/Test4058433.java	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -33,6 +33,14 @@
 import java.beans.PropertyDescriptor;
 import java.lang.reflect.Array;
 import java.lang.reflect.Method;
+import java.net.URI;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.Enumeration;
@@ -40,19 +48,13 @@
 import java.util.Objects;
 import java.util.TreeMap;
 import java.util.TreeSet;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 /*
  * @test
  * @bug 4058433
  * @summary Generates BeanInfo for public classes in AWT, Accessibility, and Swing
  * @author Sergey Malenkov
- * @run main/manual Test4058433
  */
-
 public class Test4058433 implements Comparator<Object> {
     @Override
     public int compare(Object one, Object two) {
@@ -76,31 +78,41 @@
     }
 
     public static void main(String[] args) throws Exception {
-        String resource = ClassLoader.getSystemResource("java/lang/Object.class").toString();
-
-        Pattern pattern = Pattern.compile("jar:file:(.*)!.*");
-        Matcher matcher = pattern.matcher(resource);
-        matcher.matches();
-        resource = matcher.group(1);
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        fs.getFileStores();
 
         TreeSet<Class<?>> types = new TreeSet<>(new Test4058433());
-        try (JarFile jarFile = new JarFile(resource.replaceAll("%20", " "))) {
-            Enumeration<JarEntry> entries = jarFile.entries();
-            while (entries.hasMoreElements()) {
-                String name = entries.nextElement().getName();
-                if (name.startsWith("java/awt/") || name.startsWith("javax/accessibility/") || name.startsWith("javax/swing/")) {
+        Files.walkFileTree(fs.getPath("/modules/java.desktop"), new SimpleFileVisitor<Path>() {
+            @Override
+            public FileVisitResult visitFile(Path file,
+                                             BasicFileAttributes attrs) {
+                file = file.subpath(2, file.getNameCount());
+                if (file.startsWith("java/awt/")
+                        || file.startsWith("javax/accessibility/")
+                        || file.startsWith("javax/swing/")) {
+                    String name =file.toString();
                     if (name.endsWith(".class")) {
                         name = name.substring(0, name.indexOf(".")).replace('/', '.');
-                        Class<?> type = Class.forName(name);
-                        if (!type.isInterface() && !type.isEnum() && !type.isAnnotation() && !type.isAnonymousClass()) {
+
+                        final Class<?> type;
+                        try {
+                            type = Class.forName(name);
+                        } catch (ClassNotFoundException e) {
+                            throw new RuntimeException(e);
+                        }
+                        if (!BeanInfo.class.isAssignableFrom(type) && !type.isInterface()
+                            && !type.isEnum() && !type.isAnnotation()
+                            && !type.isAnonymousClass()) {
                             if (null == type.getDeclaringClass()) {
                                 types.add(type);
                             }
                         }
                     }
                 }
+                return FileVisitResult.CONTINUE;
             }
-        }
+        });
+
         System.out.println("found " + types.size() + " classes");
         long time = -System.currentTimeMillis();
         for (Class<?> type : types) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/sampled/FileReader/AudioFileClose.java	Tue Aug 11 12:32:10 2015 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, 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.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.UnsupportedAudioFileException;
+
+/**
+ * @test
+ * @bug 8013586
+ * @author Sergey Bylokhov
+ */
+public final class AudioFileClose {
+
+    public static void main(final String[] args) throws Exception {
+        final File file = Files.createTempFile("JavaSound", "Test").toFile();
+        try (OutputStream fos = new FileOutputStream(file)) {
+            fos.write(new byte[200]);
+        }
+        try {
+            final InputStream stream = AudioSystem.getAudioInputStream(file);
+            stream.close();
+        } catch (final IOException | UnsupportedAudioFileException ignored) {
+        }
+        Files.delete(Paths.get(file.getAbsolutePath()));
+    }
+}
--- a/jdk/test/javax/sound/sampled/FileReader/ReadersExceptions.java	Tue Aug 11 08:48:18 2015 -0400
+++ b/jdk/test/javax/sound/sampled/FileReader/ReadersExceptions.java	Tue Aug 11 12:32:10 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, 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
@@ -21,17 +21,19 @@
  * questions.
  */
 
-
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.UnsupportedAudioFileException;
+import javax.sound.sampled.spi.AudioFileReader;
+
+import static java.util.ServiceLoader.load;
 
 /**
  * @test
- * @bug 7058662 7058666 7058672
+ * @bug 7058662 7058666 7058672 8130305
  * @author Sergey Bylokhov
  */
 public final class ReadersExceptions {
@@ -111,16 +113,18 @@
              0, 0, 0, 0, // dataLength
             };
 
+    static byte[][] data = {wrongAIFFCh, wrongAIFFSSL, wrongAIFFSSH, wrongAUCh,
+                            wrongWAVCh, wrongWAVSSB};
+
     public static void main(final String[] args) throws IOException {
-        test(wrongAIFFCh);
-        test(wrongAIFFSSL);
-        test(wrongAIFFSSH);
-        test(wrongAUCh);
-        test(wrongWAVCh);
-        test(wrongWAVSSB);
+        for (final byte[] bytes : data) {
+            testAS(bytes);
+            testAFR(bytes);
+        }
     }
 
-    private static void test(final byte[] buffer) throws IOException {
+    private static void testAS(final byte[] buffer) throws IOException {
+        // AudioSystem API
         final InputStream is = new ByteArrayInputStream(buffer);
         try {
             AudioSystem.getAudioFileFormat(is);
@@ -130,4 +134,19 @@
         }
         throw new RuntimeException("Test Failed");
     }
+
+    private static void testAFR(final byte[] buffer) throws IOException {
+        // AudioFileReader API
+        final InputStream is = new ByteArrayInputStream(buffer);
+        for (final AudioFileReader afr : load(AudioFileReader.class)) {
+            for (int i = 0; i < 10; ++i) {
+                try {
+                    afr.getAudioFileFormat(is);
+                    throw new RuntimeException("UAFE expected");
+                } catch (final UnsupportedAudioFileException ignored) {
+                    // Expected.
+                }
+            }
+        }
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JInternalFrame/SetLayerNPE/SetLayerNPE.java	Tue Aug 11 12:32:10 2015 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015, 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.EventQueue;
+
+import javax.swing.JDesktopPane;
+import javax.swing.JInternalFrame;
+
+/**
+ * @test
+ * @bug 6206439
+ */
+public final class SetLayerNPE {
+
+    public static void main(final String[] args) throws Exception {
+        EventQueue.invokeAndWait(() -> {
+            try {
+                // JInternalFrame without parent
+                new JInternalFrame("My Frame").setLayer(null);
+                throw new AssertionError("expected NPE was not thrown");
+            } catch (final NullPointerException ignored) {
+            }
+        });
+        EventQueue.invokeAndWait(() -> {
+            try {
+                // JInternalFrame with parent
+                JInternalFrame jif = new JInternalFrame("My Frame");
+                new JDesktopPane().add(jif);
+                jif.setLayer(null);
+                throw new AssertionError("expected NPE was not thrown");
+            } catch (final NullPointerException ignored) {
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JSplitPane/8132123/bug8132123.html	Tue Aug 11 12:32:10 2015 -0700
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2015, 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 JSplitPane uses high-resolution system icons for the one-touch expanding
+buttons on HiDPI displays.
+
+If the display does not support HiDPI mode press PASS.
+
+1. Run the test on HiDPI Display.
+2. Check that the one-touch expanding buttons on the JSplitPane are painted
+correctly. If so, press PASS, else press FAIL.
+
+<applet  code="bug8132123.class" width=250 height=250></applet>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JSplitPane/8132123/bug8132123.java	Tue Aug 11 12:32:10 2015 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015, 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.Color;
+import javax.swing.JApplet;
+import javax.swing.JPanel;
+import javax.swing.JSplitPane;
+import javax.swing.SwingUtilities;
+
+/* @test
+ * @bug 8132123
+ * @summary MultiResolutionCachedImage unnecessarily creates base image
+ *           to get its size
+ * @author Alexander Scherbatiy
+ * @run applet/manual=yesno bug8132123.html
+ */
+public class bug8132123 extends JApplet {
+
+    @Override
+    public void init() {
+        SwingUtilities.invokeLater(() -> {
+            JPanel left = new JPanel();
+            left.setBackground(Color.GRAY);
+            JPanel right = new JPanel();
+            right.setBackground(Color.GRAY);
+            JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
+                    left, right);
+            splitPane.setOneTouchExpandable(true);
+            getContentPane().add(splitPane);
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTextPane/JTextPaneDocumentAlignment.java	Tue Aug 11 12:32:10 2015 -0700
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2015, 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 8132136
+   @summary [PIT] RTL orientation in JEditorPane is broken
+   @author Semyon Sadetsky
+  */
+
+import javax.swing.*;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.SimpleAttributeSet;
+import javax.swing.text.StyleConstants;
+import java.awt.*;
+
+public class JTextPaneDocumentAlignment {
+
+    private static JFrame frame;
+    private static JTextPane jTextPane;
+    private static int position;
+
+    public static void main(String[] args) throws Exception{
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame = new JFrame();
+                frame.setUndecorated(true);
+                frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+                frame.setSize(200, 200);
+                jTextPane = new JTextPane();
+                jTextPane.setContentType("text/html");
+                jTextPane.setText(
+                        "<html><body><b id='test'>Test</b></body></html>");
+                SimpleAttributeSet right = new SimpleAttributeSet();
+                StyleConstants.setAlignment(right, StyleConstants.ALIGN_RIGHT);
+                jTextPane.getStyledDocument()
+                        .setParagraphAttributes(0, 10, right, true);
+                frame.getContentPane().add(jTextPane);
+                frame.setVisible(true);
+            }
+        });
+        Robot robot = new Robot();
+        robot.waitForIdle();
+        robot.delay(200);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    position = jTextPane.modelToView(1).x;
+                    SimpleAttributeSet center = new SimpleAttributeSet();
+                    StyleConstants.setAlignment(center,
+                            StyleConstants.ALIGN_CENTER);
+                    jTextPane.getStyledDocument()
+                            .setParagraphAttributes(0, 10, center, true);
+                } catch (BadLocationException e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+        if(position < 100) {
+            throw  new RuntimeException("Text is not right aligned " + position);
+        }
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    position = jTextPane.modelToView(1).x;
+                } catch (BadLocationException e) {
+                    e.printStackTrace();
+                }
+                frame.dispose();
+            }
+        });
+        if(position < 20) {
+            throw  new RuntimeException("Text is not center aligned " + position);
+        }
+        System.out.println("ok");
+    }
+}