diff --git a/src/share/classes/java/awt/image/BufferedImage.java b/src/share/classes/java/awt/image/BufferedImage.java
index bb272aa..5ad5bd5 100644
--- a/src/share/classes/java/awt/image/BufferedImage.java
+++ b/src/share/classes/java/awt/image/BufferedImage.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,26 +25,23 @@
 
 package java.awt.image;
 
-import java.awt.Transparency;
-import java.awt.color.ColorSpace;
 import java.awt.Graphics2D;
-import java.awt.GraphicsConfiguration;
 import java.awt.GraphicsEnvironment;
-import java.awt.ImageCapabilities;
-import java.awt.geom.Rectangle2D;
-import java.awt.geom.Point2D;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.Transparency;
+import java.awt.color.ColorSpace;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Hashtable;
+import java.util.Set;
 import java.util.Vector;
 
-import sun.awt.image.BytePackedRaster;
-import sun.awt.image.ShortComponentRaster;
 import sun.awt.image.ByteComponentRaster;
+import sun.awt.image.BytePackedRaster;
 import sun.awt.image.IntegerComponentRaster;
 import sun.awt.image.OffScreenImageSource;
+import sun.awt.image.ShortComponentRaster;
 
 /**
  *
@@ -68,18 +65,14 @@
  * @see Raster
  * @see WritableRaster
  */
-
 public class BufferedImage extends java.awt.Image
                            implements WritableRenderedImage, Transparency
 {
-    int        imageType = TYPE_CUSTOM;
-    ColorModel colorModel;
-    WritableRaster raster;
-    OffScreenImageSource osis;
-    Hashtable properties;
-
-    boolean    isAlphaPremultiplied;// If true, alpha has been premultiplied in
-    // color channels
+    private int imageType = TYPE_CUSTOM;
+    private ColorModel colorModel;
+    private final WritableRaster raster;
+    private OffScreenImageSource osis;
+    private Hashtable<String, Object> properties;
 
     /**
      * Image Type Constants
@@ -328,8 +321,8 @@
                                                   0x000000ff,   // Blue
                                                   0x0           // Alpha
                                                   );
-                  raster = colorModel.createCompatibleWritableRaster(width,
-                                                                      height);
+                raster = colorModel.createCompatibleWritableRaster(width,
+                                                                   height);
             }
         break;
 
@@ -355,9 +348,8 @@
                                      true,       // Alpha Premultiplied
                                      DataBuffer.TYPE_INT
                                      );
-
-                  raster = colorModel.createCompatibleWritableRaster(width,
-                                                                      height);
+                raster = colorModel.createCompatibleWritableRaster(width,
+                                                                   height);
             }
         break;
 
@@ -368,8 +360,8 @@
                                                   0x0000ff00,   // Green
                                                   0x00ff0000    // Blue
                                                   );
-                  raster = colorModel.createCompatibleWritableRaster(width,
-                                                                      height);
+                raster = colorModel.createCompatibleWritableRaster(width,
+                                                                   height);
             }
         break;
 
@@ -642,7 +634,14 @@
 
         colorModel = cm;
         this.raster  = raster;
-        this.properties = properties;
+        if (properties != null && !properties.isEmpty()) {
+            this.properties = new Hashtable<>();
+            for (final Object key : properties.keySet()) {
+                if (key instanceof String) {
+                    this.properties.put((String) key, properties.get(key));
+                }
+            }
+        }
         int numBands = raster.getNumBands();
         boolean isAlphaPre = cm.isAlphaPremultiplied();
         final boolean isStandard = isStandard(cm, raster);
@@ -1272,7 +1271,11 @@
      *          or <code>null</code> if no property names are recognized.
      */
     public String[] getPropertyNames() {
-         return null;
+        if (properties == null || properties.isEmpty()) {
+            return null;
+        }
+        final Set<String> keys = properties.keySet();
+        return keys.toArray(new String[keys.size()]);
     }
 
     /**
diff --git a/test/java/awt/image/BufferedImage/GetPropertyNames.java b/test/java/awt/image/BufferedImage/GetPropertyNames.java
new file mode 100644
index 0000000..244da3a
--- /dev/null
+++ b/test/java/awt/image/BufferedImage/GetPropertyNames.java
@@ -0,0 +1,103 @@
+/*
+ * 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.Image;
+import java.awt.image.BufferedImage;
+import java.util.Properties;
+
+import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
+
+/**
+ * @test
+ * @bug 8066132
+ * @author Sergey Bylokhov
+ */
+public final class GetPropertyNames {
+
+    static BufferedImage defaultProps = new BufferedImage(1, 1, TYPE_INT_ARGB);
+
+    public static void main(final String[] args) {
+        // default result is null
+        if (defaultProps.getPropertyNames() != null) {
+            throw new RuntimeException("PropertyNames should be null");
+        }
+        // for null properties result is null
+        final BufferedImage emptyProps = getBufferedImage(null);
+        if (emptyProps.getPropertyNames() != null) {
+            throw new RuntimeException("PropertyNames should be null");
+        }
+        // for empty properties result is null
+        final BufferedImage nullProps = getBufferedImage(new Properties());
+        if (nullProps.getPropertyNames() != null) {
+            throw new RuntimeException("PropertyNames should be null");
+        }
+        // for non-string keys result is null
+        final Properties properties = new Properties();
+        properties.put(1, 1);
+        properties.put(2, 2);
+        properties.put(3, 3);
+        final BufferedImage nonStringProps = getBufferedImage(properties);
+        if (nonStringProps.getPropertyNames() != null) {
+            throw new RuntimeException("PropertyNames should be null");
+        }
+        // for string keys result is not null
+        properties.clear();
+        properties.setProperty("1", "1");
+        properties.setProperty("2", "2");
+        validate(getBufferedImage(properties), 2);
+        // for the mix of strings and objects result is not null
+        properties.clear();
+        properties.put(1, 1);
+        properties.put(2, 2);
+        properties.put(3, 3);
+        properties.setProperty("key1", "value1");
+        properties.setProperty("key2", "value2");
+        final BufferedImage mixProps = getBufferedImage(properties);
+        validate(mixProps, 2);
+        if (!"value1".equals(mixProps.getProperty("key1"))
+            || !"value2".equals(mixProps.getProperty("key2"))) {
+            throw new RuntimeException("Wrong key-value pair");
+        }
+    }
+
+
+    private static BufferedImage getBufferedImage(final Properties properties) {
+        return new BufferedImage(defaultProps.getColorModel(),
+                                 defaultProps.getRaster(),
+                                 defaultProps.isAlphaPremultiplied(),
+                                 properties);
+    }
+
+    private static void validate(final BufferedImage bi, final int expected) {
+        final String[] names = bi.getPropertyNames();
+        if (names.length != expected) {
+            throw new RuntimeException("Wrong number of names");
+        }
+        for (final String name : names) {
+            final Object property = bi.getProperty(name);
+            if (property == Image.UndefinedProperty || property == null) {
+                throw new RuntimeException("Unexpected property");
+            }
+        }
+    }
+}
