public void applyPropertyChange(PropertyChangeEvent evt, JLayer extends V> l) {
}
- /**
- * Returns the preferred size of the viewport for a view component.
- *
- * @param l the {@code JLayer} component where this UI delegate is being installed
- * @return the preferred size of the viewport for a view component
- * @see Scrollable#getPreferredScrollableViewportSize()
- */
- public Dimension getPreferredScrollableViewportSize(JLayer extends V> l) {
- if (l.getView() instanceof Scrollable) {
- return ((Scrollable)l.getView()).getPreferredScrollableViewportSize();
- }
- return l.getPreferredSize();
- }
-
- /**
- * Returns a scroll increment, which is required for components
- * that display logical rows or columns in order to completely expose
- * one block of rows or columns, depending on the value of orientation.
- *
- * @param l the {@code JLayer} component where this UI delegate is being installed
- * @param visibleRect The view area visible within the viewport
- * @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
- * @param direction Less than zero to scroll up/left, greater than zero for down/right.
- * @return the "block" increment for scrolling in the specified direction
- * @see Scrollable#getScrollableBlockIncrement(Rectangle, int, int)
- */
- public int getScrollableBlockIncrement(JLayer extends V> l,
- Rectangle visibleRect,
- int orientation, int direction) {
- if (l.getView() instanceof Scrollable) {
- return ((Scrollable)l.getView()).getScrollableBlockIncrement(
- visibleRect,orientation, direction);
- }
- return (orientation == SwingConstants.VERTICAL) ? visibleRect.height :
- visibleRect.width;
- }
-
- /**
- * Returns {@code false} to indicate that the height of the viewport does not
- * determine the height of the layer, unless the preferred height
- * of the layer is smaller than the height of the viewport.
- *
- * @param l the {@code JLayer} component where this UI delegate is being installed
- * @return whether the layer should track the height of the viewport
- * @see Scrollable#getScrollableTracksViewportHeight()
- */
- public boolean getScrollableTracksViewportHeight(JLayer extends V> l) {
- if (l.getView() instanceof Scrollable) {
- return ((Scrollable)l.getView()).getScrollableTracksViewportHeight();
- }
- return false;
- }
-
- /**
- * Returns {@code false} to indicate that the width of the viewport does not
- * determine the width of the layer, unless the preferred width
- * of the layer is smaller than the width of the viewport.
- *
- * @param l the {@code JLayer} component where this UI delegate is being installed
- * @return whether the layer should track the width of the viewport
- * @see Scrollable
- * @see LayerUI#getScrollableTracksViewportWidth(JLayer)
- */
- public boolean getScrollableTracksViewportWidth(JLayer extends V> l) {
- if (l.getView() instanceof Scrollable) {
- return ((Scrollable)l.getView()).getScrollableTracksViewportWidth();
- }
- return false;
- }
-
- /**
- * Returns a scroll increment, which is required for components
- * that display logical rows or columns in order to completely expose
- * one new row or column, depending on the value of orientation.
- * Ideally, components should handle a partially exposed row or column
- * by returning the distance required to completely expose the item.
- *
- * Scrolling containers, like JScrollPane, will use this method
- * each time the user requests a unit scroll.
- *
- * @param l the {@code JLayer} component where this UI delegate is being installed
- * @param visibleRect The view area visible within the viewport
- * @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
- * @param direction Less than zero to scroll up/left, greater than zero for down/right.
- * @return The "unit" increment for scrolling in the specified direction.
- * This value should always be positive.
- * @see Scrollable#getScrollableUnitIncrement(Rectangle, int, int)
- */
- public int getScrollableUnitIncrement(JLayer extends V> l,
- Rectangle visibleRect,
- int orientation, int direction) {
- if (l.getView() instanceof Scrollable) {
- return ((Scrollable)l.getView()).getScrollableUnitIncrement(
- visibleRect, orientation, direction);
- }
- return 1;
- }
-
/**
* If the {@code JLayer}'s view component is not {@code null},
* this calls the view's {@code getBaseline()} method.
@@ -718,7 +620,7 @@ public class LayerUI
/**
* If the {@code JLayer}'s view component is not {@code null},
- * this calls the view's {@code getBaselineResizeBehavior()} method.
+ * this returns the result of the view's {@code getBaselineResizeBehavior()} method.
* Otherwise, the default implementation is called.
*
* @param c {@code JLayer} to return baseline resize behavior for
@@ -732,4 +634,90 @@ public class LayerUI
}
return super.getBaselineResizeBehavior(c);
}
+
+ /**
+ * Causes the passed instance of {@code JLayer} to lay out its components.
+ *
+ * @param l the {@code JLayer} component where this UI delegate is being installed
+ */
+ public void doLayout(JLayer extends V> l) {
+ Component view = l.getView();
+ if (view != null) {
+ view.setBounds(0, 0, l.getWidth(), l.getHeight());
+ }
+ Component glassPane = l.getGlassPane();
+ if (glassPane != null) {
+ glassPane.setBounds(0, 0, l.getWidth(), l.getHeight());
+ }
+ }
+
+ /**
+ * If the {@code JLayer}'s view component is not {@code null},
+ * this returns the result of the view's {@code getPreferredSize()} method.
+ * Otherwise, the default implementation is used.
+ *
+ * @param c {@code JLayer} to return preferred size for
+ * @return preferred size for the passed {@code JLayer}
+ */
+ public Dimension getPreferredSize(JComponent c) {
+ JLayer l = (JLayer) c;
+ Component view = l.getView();
+ if (view != null) {
+ return view.getPreferredSize();
+ }
+ return super.getPreferredSize(c);
+ }
+
+ /**
+ * If the {@code JLayer}'s view component is not {@code null},
+ * this returns the result of the view's {@code getMinimalSize()} method.
+ * Otherwise, the default implementation is used.
+ *
+ * @param c {@code JLayer} to return preferred size for
+ * @return minimal size for the passed {@code JLayer}
+ */
+ public Dimension getMinimumSize(JComponent c) {
+ JLayer l = (JLayer) c;
+ Component view = l.getView();
+ if (view != null) {
+ return view.getMinimumSize();
+ }
+ return super.getMinimumSize(c);
+ }
+
+ /**
+ * If the {@code JLayer}'s view component is not {@code null},
+ * this returns the result of the view's {@code getMaximumSize()} method.
+ * Otherwise, the default implementation is used.
+ *
+ * @param c {@code JLayer} to return preferred size for
+ * @return maximun size for the passed {@code JLayer}
+ */
+ public Dimension getMaximumSize(JComponent c) {
+ JLayer l = (JLayer) c;
+ Component view = l.getView();
+ if (view != null) {
+ return view.getMaximumSize();
+ }
+ return super.getMaximumSize(c);
+ }
+
+ /**
+ * Adds the specified region to the dirty region list if the component
+ * is showing. The component will be repainted after all of the
+ * currently pending events have been dispatched.
+ *
+ * This method is to be overridden when the dirty region needs to be changed.
+ *
+ * @param tm this parameter is not used
+ * @param x the x value of the dirty region
+ * @param y the y value of the dirty region
+ * @param width the width of the dirty region
+ * @param height the height of the dirty region
+ * @see java.awt.Component#isShowing
+ * @see RepaintManager#addDirtyRegion
+ */
+ public void repaint(long tm, int x, int y, int width, int height, JLayer extends V> l) {
+ RepaintManager.currentManager(l).addDirtyRegion(l, x, y, width, height);
+ }
}
From f00f0ea36ce4af5642a944474f5f9ec655439c12 Mon Sep 17 00:00:00 2001
From: Alexander Potochkin
Date: Fri, 17 Sep 2010 23:00:34 +0400
Subject: [PATCH 06/63] 6606019: NPE and IAE are interchanged in specification
for GroupLayout.Group class
Reviewed-by: rupashka
---
jdk/src/share/classes/javax/swing/GroupLayout.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/jdk/src/share/classes/javax/swing/GroupLayout.java b/jdk/src/share/classes/javax/swing/GroupLayout.java
index a343b7bc8a1..7628076a994 100644
--- a/jdk/src/share/classes/javax/swing/GroupLayout.java
+++ b/jdk/src/share/classes/javax/swing/GroupLayout.java
@@ -1464,8 +1464,8 @@ public class GroupLayout implements LayoutManager2 {
* <= {@code pref} <= {@code max}.
*
* Similarly any methods that take a {@code Component} throw a
- * {@code NullPointerException} if passed {@code null} and any methods
- * that take a {@code Group} throw an {@code IllegalArgumentException} if
+ * {@code IllegalArgumentException} if passed {@code null} and any methods
+ * that take a {@code Group} throw an {@code NullPointerException} if
* passed {@code null}.
*
* @see #createSequentialGroup
From 80129bc0045db209122907e1d86783c5d42fb337 Mon Sep 17 00:00:00 2001
From: Alexander Potochkin
Date: Fri, 17 Sep 2010 23:09:29 +0400
Subject: [PATCH 07/63] 6632953: MetalComboBoxUI.getBaseline(JComponent, int,
int) throws IAE for valid width/height
Reviewed-by: rupashka
---
.../swing/plaf/metal/MetalComboBoxUI.java | 2 +-
.../swing/JComboBox/6632953/bug6632953.java | 44 +++++++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)
create mode 100644 jdk/test/javax/swing/JComboBox/6632953/bug6632953.java
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java
index 77742db410f..e7c811b0c22 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java
@@ -144,7 +144,7 @@ public class MetalComboBoxUI extends BasicComboBoxUI {
*/
public int getBaseline(JComponent c, int width, int height) {
int baseline;
- if (MetalLookAndFeel.usingOcean()) {
+ if (MetalLookAndFeel.usingOcean() && height >= 4) {
height -= 4;
baseline = super.getBaseline(c, width, height);
if (baseline >= 0) {
diff --git a/jdk/test/javax/swing/JComboBox/6632953/bug6632953.java b/jdk/test/javax/swing/JComboBox/6632953/bug6632953.java
new file mode 100644
index 00000000000..90352765eb7
--- /dev/null
+++ b/jdk/test/javax/swing/JComboBox/6632953/bug6632953.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2010, 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 6632953
+ * @summary MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
+ * @author Alexander Potochkin
+ */
+
+import javax.swing.JComboBox;
+import javax.swing.plaf.metal.MetalComboBoxUI;
+
+public class bug6632953 {
+
+ public static void main(String... args) throws Exception {
+ MetalComboBoxUI ui = new MetalComboBoxUI();
+ ui.installUI(new JComboBox());
+ ui.getBaseline(new JComboBox(), 0, 0);
+ ui.getBaseline(new JComboBox(), 1, 1);
+ ui.getBaseline(new JComboBox(), 2, 2);
+ ui.getBaseline(new JComboBox(), 3, 3);
+ ui.getBaseline(new JComboBox(), 4, 4);
+ }
+}
From 76501ba258a6ad5e9e05781b13373277ed9347b0 Mon Sep 17 00:00:00 2001
From: Alexander Potochkin
Date: Fri, 17 Sep 2010 23:16:19 +0400
Subject: [PATCH 08/63] 6576054: NullPointerException when closing tooltip by
pressing esc
Reviewed-by: rupashka
---
jdk/src/share/classes/javax/swing/ToolTipManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/share/classes/javax/swing/ToolTipManager.java b/jdk/src/share/classes/javax/swing/ToolTipManager.java
index 17bda0fdcff..ff4aa2c2ac9 100644
--- a/jdk/src/share/classes/javax/swing/ToolTipManager.java
+++ b/jdk/src/share/classes/javax/swing/ToolTipManager.java
@@ -459,7 +459,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
if (insideComponent == null) {
// Drag exit
}
- if (window != null && event.getSource() == window) {
+ if (window != null && event.getSource() == window && insideComponent != null) {
// if we get an exit and have a heavy window
// we need to check if it if overlapping the inside component
Container insideComponentWindow = insideComponent.getTopLevelAncestor();
From 1c45f6db9e682fba8d8fe1cbb786a1fd070168da Mon Sep 17 00:00:00 2001
From: Alexander Potochkin
Date: Fri, 17 Sep 2010 23:21:51 +0400
Subject: [PATCH 09/63] 4330950: Lost newly entered data in the cell when
resizing column width
Reviewed-by: peterz
---
jdk/src/share/classes/javax/swing/JTable.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/jdk/src/share/classes/javax/swing/JTable.java b/jdk/src/share/classes/javax/swing/JTable.java
index bcf00a37547..7842410e772 100644
--- a/jdk/src/share/classes/javax/swing/JTable.java
+++ b/jdk/src/share/classes/javax/swing/JTable.java
@@ -4574,9 +4574,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* @see TableColumnModelListener
*/
public void columnMoved(TableColumnModelEvent e) {
- // If I'm currently editing, then I should stop editing
- if (isEditing()) {
- removeEditor();
+ if (isEditing() && !getCellEditor().stopCellEditing()) {
+ getCellEditor().cancelCellEditing();
}
repaint();
}
@@ -4593,8 +4592,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* @see TableColumnModelListener
*/
public void columnMarginChanged(ChangeEvent e) {
- if (isEditing()) {
- removeEditor();
+ if (isEditing() && !getCellEditor().stopCellEditing()) {
+ getCellEditor().cancelCellEditing();
}
TableColumn resizingColumn = getResizingColumn();
// Need to do this here, before the parent's
From db3fbf81801bd1b2ae810fd0fc9d9565a9fb438c Mon Sep 17 00:00:00 2001
From: Alexander Potochkin
Date: Fri, 17 Sep 2010 23:34:53 +0400
Subject: [PATCH 10/63] 6542335: different behavior on knob of scroll bar
between 1.4.2 and 5.0
Reviewed-by: peterz
---
.../swing/plaf/basic/BasicScrollBarUI.java | 1 +
.../swing/JScrollBar/6542335/bug6542335.java | 92 +++++++++++++++++++
2 files changed, 93 insertions(+)
create mode 100644 jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
index deba91beff3..52204916ce5 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
@@ -1603,6 +1603,7 @@ public class BasicScrollBarUI
BoundedRangeModel newModel = (BoundedRangeModel)e.getNewValue();
oldModel.removeChangeListener(modelListener);
newModel.addChangeListener(modelListener);
+ scrollBarValue = scrollbar.getValue();
scrollbar.repaint();
scrollbar.revalidate();
} else if ("orientation" == propertyName) {
diff --git a/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java b/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java
new file mode 100644
index 00000000000..33e95d8ecac
--- /dev/null
+++ b/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2010, 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 6542335
+ @summary different behavior on knob of scroll bar between 1.4.2 and 5.0
+ @author Alexander Potochkin
+ @run main bug6542335
+*/
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import javax.swing.plaf.basic.BasicScrollBarUI;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+public class bug6542335 {
+ private static JScrollBar sb;
+ private static MyScrollBarUI ui;
+
+ public static void main(String[] args) throws Exception {
+ Robot robot = new Robot();
+ robot.setAutoDelay(10);
+
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final JFrame frame = new JFrame("bug6542335");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ sb = new JScrollBar(0, 0, 1, 0, 1);
+
+ ui = new MyScrollBarUI();
+ sb.setUI(ui);
+
+ sb.setPreferredSize(new Dimension(200, 17));
+ DefaultBoundedRangeModel rangeModel = new DefaultBoundedRangeModel();
+ rangeModel.setMaximum(100);
+ rangeModel.setMinimum(0);
+ rangeModel.setExtent(50);
+ rangeModel.setValue(50);
+
+ sb.setModel(rangeModel);
+ frame.add(sb);
+
+ frame.setSize(200, 100);
+ frame.setVisible(true);
+ }
+ });
+
+ Rectangle thumbBounds = new Rectangle(ui.getThumbBounds());
+
+ toolkit.realSync();
+ Point l = sb.getLocationOnScreen();
+ robot.mouseMove(l.x + (int) (0.75 * sb.getWidth()), l.y + sb.getHeight()/2);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ toolkit.realSync();
+
+ if (!thumbBounds.equals(ui.getThumbBounds())) {
+ throw new RuntimeException("Test failed");
+ }
+ }
+
+ static class MyScrollBarUI extends BasicScrollBarUI {
+ public Rectangle getThumbBounds() {
+ return super.getThumbBounds();
+ }
+ }
+}
From d9989f8e0e5d3664d7b7362d2b11763b2495a034 Mon Sep 17 00:00:00 2001
From: Mandy Chung
Date: Fri, 17 Sep 2010 14:16:14 -0700
Subject: [PATCH 11/63] 6888546: restore System.initializeSystemClasses
Restore System.initializeSystemClasses prior to fix for 6797688
Reviewed-by: alanb
---
jdk/src/share/classes/java/lang/System.java | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/jdk/src/share/classes/java/lang/System.java b/jdk/src/share/classes/java/lang/System.java
index 39c6a5888d1..42431865f25 100644
--- a/jdk/src/share/classes/java/lang/System.java
+++ b/jdk/src/share/classes/java/lang/System.java
@@ -1101,22 +1101,12 @@ public final class System {
lineSeparator = props.getProperty("line.separator");
sun.misc.Version.init();
- // Workaround until DownloadManager initialization is revisited.
- // Make JavaLangAccess available early enough for internal
- // Shutdown hooks to be registered
- setJavaLangAccess();
-
// Gets and removes system properties that configure the Integer
// cache used to support the object identity semantics of autoboxing.
// At this time, the size of the cache may be controlled by the
// vm option -XX:AutoBoxCacheMax=.
Integer.getAndRemoveCacheProperties();
- // Load the zip library now in order to keep java.util.zip.ZipFile
- // from trying to use itself to load this library later.
- loadLibrary("zip");
-
-
FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
@@ -1124,6 +1114,10 @@ public final class System {
setOut0(new PrintStream(new BufferedOutputStream(fdOut, 128), true));
setErr0(new PrintStream(new BufferedOutputStream(fdErr, 128), true));
+ // Load the zip library now in order to keep java.util.zip.ZipFile
+ // from trying to use itself to load this library later.
+ loadLibrary("zip");
+
// Setup Java signal handlers for HUP, TERM, and INT (where available).
Terminator.setup();
@@ -1153,6 +1147,9 @@ public final class System {
// way as other threads; we must do it ourselves here.
Thread current = Thread.currentThread();
current.getThreadGroup().add(current);
+
+ // register shared secrets
+ setJavaLangAccess();
}
private static void setJavaLangAccess() {
From 11cc8fa5e609bcf9abfc28661372f1d5e8b3731e Mon Sep 17 00:00:00 2001
From: Martin Buchholz
Date: Fri, 17 Sep 2010 14:35:00 -0700
Subject: [PATCH 12/63] 6981138: (process) Process.waitFor() may hang if
subprocess has live descendants (lnx)
Do exit status handling before trying to close streams
Reviewed-by: alanb, dholmes
---
.../classes/java/lang/UNIXProcess.java.linux | 12 ++--
jdk/test/java/lang/ProcessBuilder/Basic.java | 58 +++++++++++++++++++
2 files changed, 65 insertions(+), 5 deletions(-)
diff --git a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux
index 29477f93bbc..b277c2184b5 100644
--- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux
+++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux
@@ -176,7 +176,13 @@ final class UNIXProcess extends Process {
}});
}
- synchronized void processExited(int exitcode) {
+ void processExited(int exitcode) {
+ synchronized (this) {
+ this.exitcode = exitcode;
+ hasExited = true;
+ notifyAll();
+ }
+
if (stdout instanceof ProcessPipeInputStream)
((ProcessPipeInputStream) stdout).processExited();
@@ -185,10 +191,6 @@ final class UNIXProcess extends Process {
if (stdin instanceof ProcessPipeOutputStream)
((ProcessPipeOutputStream) stdin).processExited();
-
- this.exitcode = exitcode;
- hasExited = true;
- notifyAll();
}
public OutputStream getOutputStream() {
diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java
index f4e3c26d9ee..d0bbc1b4a3b 100644
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java
@@ -1824,6 +1824,64 @@ public class Basic {
}
} catch (Throwable t) { unexpected(t); }
+ //----------------------------------------------------------------
+ // Check that subprocesses which create subprocesses of their
+ // own do not cause parent to hang waiting for file
+ // descriptors to be closed.
+ //----------------------------------------------------------------
+ try {
+ if (Unix.is()
+ && new File("/bin/bash").exists()
+ && new File("/bin/sleep").exists()) {
+ final String[] cmd = { "/bin/bash", "-c", "(/bin/sleep 6666)" };
+ final ProcessBuilder pb = new ProcessBuilder(cmd);
+ final Process p = pb.start();
+ final InputStream stdout = p.getInputStream();
+ final InputStream stderr = p.getErrorStream();
+ final OutputStream stdin = p.getOutputStream();
+ final Thread reader = new Thread() {
+ public void run() {
+ try { stdout.read(); }
+ catch (IOException e) {
+ // e.printStackTrace();
+ if (EnglishUnix.is() &&
+ ! (e.getMessage().matches(".*Bad file descriptor.*")))
+ unexpected(e);
+ }
+ catch (Throwable t) { unexpected(t); }}};
+ reader.setDaemon(true);
+ reader.start();
+ Thread.sleep(100);
+ p.destroy();
+ // Subprocess is now dead, but file descriptors remain open.
+ check(p.waitFor() != 0);
+ check(p.exitValue() != 0);
+ stdout.close();
+ stderr.close();
+ stdin.close();
+ //----------------------------------------------------------
+ // There remain unsolved issues with asynchronous close.
+ // Here's a highly non-portable experiment to demonstrate:
+ //----------------------------------------------------------
+ if (Boolean.getBoolean("wakeupJeff!")) {
+ System.out.println("wakeupJeff!");
+ // Initialize signal handler for INTERRUPT_SIGNAL.
+ new FileInputStream("/bin/sleep").getChannel().close();
+ // Send INTERRUPT_SIGNAL to every thread in this java.
+ String[] wakeupJeff = {
+ "/bin/bash", "-c",
+ "/bin/ps --noheaders -Lfp $PPID | " +
+ "/usr/bin/perl -nale 'print $F[3]' | " +
+ // INTERRUPT_SIGNAL == 62 on my machine du jour.
+ "/usr/bin/xargs kill -62"
+ };
+ new ProcessBuilder(wakeupJeff).start().waitFor();
+ // If wakeupJeff worked, reader probably got EBADF.
+ reader.join();
+ }
+ }
+ } catch (Throwable t) { unexpected(t); }
+
//----------------------------------------------------------------
// Attempt to start process with insufficient permissions fails.
//----------------------------------------------------------------
From 07ebbaac23f132e8cfd2cd78730f5da03dfddb78 Mon Sep 17 00:00:00 2001
From: Martin Buchholz
Date: Fri, 17 Sep 2010 14:40:38 -0700
Subject: [PATCH 13/63] 6981157: Improve UnknownHostException with EAI error
details and other cleanups
Generify; remove compiler warnings, typos, casts; return status information via gai_strerror when getaddrinfo fails; show full stack of native failures
Reviewed-by: michaelm, alanb
---
.../share/classes/java/net/InetAddress.java | 155 +++++++++---------
.../native/java/net/Inet6AddressImpl.c | 19 +--
jdk/src/solaris/native/java/net/net_util_md.c | 32 +++-
jdk/src/solaris/native/java/net/net_util_md.h | 10 +-
4 files changed, 121 insertions(+), 95 deletions(-)
diff --git a/jdk/src/share/classes/java/net/InetAddress.java b/jdk/src/share/classes/java/net/InetAddress.java
index 96a17482d8f..c4ace57995f 100644
--- a/jdk/src/share/classes/java/net/InetAddress.java
+++ b/jdk/src/share/classes/java/net/InetAddress.java
@@ -677,19 +677,20 @@ class InetAddress implements java.io.Serializable {
static InetAddressImpl impl;
- private static HashMap lookupTable = new HashMap();
+ private static HashMap lookupTable
+ = new HashMap();
/**
* Represents a cache entry
*/
static final class CacheEntry {
- CacheEntry(Object address, long expiration) {
- this.address = address;
+ CacheEntry(InetAddress[] addresses, long expiration) {
+ this.addresses = addresses;
this.expiration = expiration;
}
- Object address;
+ InetAddress[] addresses;
long expiration;
}
@@ -698,7 +699,7 @@ class InetAddress implements java.io.Serializable {
* at creation time.
*/
static final class Cache {
- private LinkedHashMap cache;
+ private LinkedHashMap cache;
private Type type;
enum Type {Positive, Negative};
@@ -708,7 +709,7 @@ class InetAddress implements java.io.Serializable {
*/
public Cache(Type type) {
this.type = type;
- cache = new LinkedHashMap();
+ cache = new LinkedHashMap();
}
private int getPolicy() {
@@ -724,7 +725,7 @@ class InetAddress implements java.io.Serializable {
* entry then for this host then the entry will be
* replaced.
*/
- public Cache put(String host, Object address) {
+ public Cache put(String host, InetAddress[] addresses) {
int policy = getPolicy();
if (policy == InetAddressCachePolicy.NEVER) {
return this;
@@ -736,12 +737,10 @@ class InetAddress implements java.io.Serializable {
// As we iterate in insertion order we can
// terminate when a non-expired entry is found.
- LinkedList expired = new LinkedList();
- Iterator i = cache.keySet().iterator();
+ LinkedList expired = new LinkedList();
long now = System.currentTimeMillis();
- while (i.hasNext()) {
- String key = (String)i.next();
- CacheEntry entry = (CacheEntry)cache.get(key);
+ for (String key : cache.keySet()) {
+ CacheEntry entry = cache.get(key);
if (entry.expiration >= 0 && entry.expiration < now) {
expired.add(key);
@@ -750,9 +749,8 @@ class InetAddress implements java.io.Serializable {
}
}
- i = expired.iterator();
- while (i.hasNext()) {
- cache.remove(i.next());
+ for (String key : expired) {
+ cache.remove(key);
}
}
@@ -766,7 +764,7 @@ class InetAddress implements java.io.Serializable {
} else {
expiration = System.currentTimeMillis() + (policy * 1000);
}
- CacheEntry entry = new CacheEntry(address, expiration);
+ CacheEntry entry = new CacheEntry(addresses, expiration);
cache.put(host, entry);
return this;
}
@@ -780,7 +778,7 @@ class InetAddress implements java.io.Serializable {
if (policy == InetAddressCachePolicy.NEVER) {
return null;
}
- CacheEntry entry = (CacheEntry)cache.get(host);
+ CacheEntry entry = cache.get(host);
// check if entry has expired
if (entry != null && policy != InetAddressCachePolicy.FOREVER) {
@@ -814,42 +812,41 @@ class InetAddress implements java.io.Serializable {
}
/*
- * Cache the given hostname and address.
+ * Cache the given hostname and addresses.
*/
- private static void cacheAddress(String hostname, Object address,
- boolean success) {
+ private static void cacheAddresses(String hostname,
+ InetAddress[] addresses,
+ boolean success) {
hostname = hostname.toLowerCase();
synchronized (addressCache) {
cacheInitIfNeeded();
if (success) {
- addressCache.put(hostname, address);
+ addressCache.put(hostname, addresses);
} else {
- negativeCache.put(hostname, address);
+ negativeCache.put(hostname, addresses);
}
}
}
/*
* Lookup hostname in cache (positive & negative cache). If
- * found return address, null if not found.
+ * found return addresses, null if not found.
*/
- private static Object getCachedAddress(String hostname) {
+ private static InetAddress[] getCachedAddresses(String hostname) {
hostname = hostname.toLowerCase();
// search both positive & negative caches
synchronized (addressCache) {
- CacheEntry entry;
-
cacheInitIfNeeded();
- entry = addressCache.get(hostname);
+ CacheEntry entry = addressCache.get(hostname);
if (entry == null) {
entry = negativeCache.get(hostname);
}
if (entry != null) {
- return entry.address;
+ return entry.addresses;
}
}
@@ -911,7 +908,7 @@ class InetAddress implements java.io.Serializable {
static {
// create the impl
- impl = (new InetAddressImplFactory()).create();
+ impl = InetAddressImplFactory.create();
// get name service if provided and requested
String provider = null;;
@@ -931,7 +928,7 @@ class InetAddress implements java.io.Serializable {
}
// if not designate any name services provider,
- // creat a default one
+ // create a default one
if (nameServices.size() == 0) {
NameService ns = createNSProvider("default");
nameServices.add(ns);
@@ -939,7 +936,7 @@ class InetAddress implements java.io.Serializable {
}
/**
- * Create an InetAddress based on the provided host name and IP address
+ * Creates an InetAddress based on the provided host name and IP address.
* No name service is checked for the validity of the address.
*
* The host name can either be a machine name, such as
@@ -1067,13 +1064,13 @@ class InetAddress implements java.io.Serializable {
boolean ipv6Expected = false;
if (host.charAt(0) == '[') {
- // This is supposed to be an IPv6 litteral
+ // This is supposed to be an IPv6 literal
if (host.length() > 2 && host.charAt(host.length()-1) == ']') {
host = host.substring(1, host.length() -1);
ipv6Expected = true;
} else {
// This was supposed to be a IPv6 address, but it's not!
- throw new UnknownHostException(host);
+ throw new UnknownHostException(host + ": invalid IPv6 address");
}
}
@@ -1180,8 +1177,6 @@ class InetAddress implements java.io.Serializable {
throws UnknownHostException {
/* If it gets here it is presumed to be a hostname */
/* Cache.get can return: null, unknownAddress, or InetAddress[] */
- Object obj = null;
- Object objcopy = null;
/* make sure the connection to the host is allowed, before we
* give out a hostname
@@ -1193,26 +1188,23 @@ class InetAddress implements java.io.Serializable {
}
}
- obj = getCachedAddress(host);
+ InetAddress[] addresses = getCachedAddresses(host);
/* If no entry in cache, then do the host lookup */
- if (obj == null) {
- obj = getAddressFromNameService(host);
+ if (addresses == null) {
+ addresses = getAddressesFromNameService(host);
}
- if (obj == unknown_array)
+ if (addresses == unknown_array)
throw new UnknownHostException(host);
- /* Make a copy of the InetAddress array */
- objcopy = ((InetAddress [])obj).clone();
-
- return (InetAddress [])objcopy;
+ return addresses.clone();
}
- private static Object getAddressFromNameService(String host)
+ private static InetAddress[] getAddressesFromNameService(String host)
throws UnknownHostException
{
- Object obj = null;
+ InetAddress[] addresses = null;
boolean success = false;
UnknownHostException ex = null;
@@ -1226,16 +1218,16 @@ class InetAddress implements java.io.Serializable {
// would be blocked until the host is removed
// from the lookupTable. Then this thread
// should try to look up the addressCache.
- // i) if it found the address in the
+ // i) if it found the addresses in the
// addressCache, checkLookupTable() would
- // return the address.
- // ii) if it didn't find the address in the
+ // return the addresses.
+ // ii) if it didn't find the addresses in the
// addressCache for any reason,
// it should add the host in the
// lookupTable and return null so the
// following code would do a lookup itself.
- if ((obj = checkLookupTable(host)) == null) {
- // This is the first thread which looks up the address
+ if ((addresses = checkLookupTable(host)) == null) {
+ // This is the first thread which looks up the addresses
// this host or the cache entry for this host has been
// expired so this thread should do the lookup.
for (NameService nameService : nameServices) {
@@ -1246,26 +1238,26 @@ class InetAddress implements java.io.Serializable {
* allocating space when the lookup fails.
*/
- obj = nameService.lookupAllHostAddr(host);
+ addresses = nameService.lookupAllHostAddr(host);
success = true;
break;
} catch (UnknownHostException uhe) {
if (host.equalsIgnoreCase("localhost")) {
InetAddress[] local = new InetAddress[] { impl.loopbackAddress() };
- obj = local;
+ addresses = local;
success = true;
break;
}
else {
- obj = unknown_array;
+ addresses = unknown_array;
success = false;
ex = uhe;
}
}
}
- // Cache the address.
- cacheAddress(host, obj, success);
+ // Cache the addresses.
+ cacheAddresses(host, addresses, success);
// Delete the host from the lookupTable, and
// notify all threads waiting for the monitor
// for lookupTable.
@@ -1274,13 +1266,13 @@ class InetAddress implements java.io.Serializable {
throw ex;
}
- return obj;
+ return addresses;
}
- private static Object checkLookupTable(String host) {
- // make sure obj is null.
- Object obj = null;
+ private static InetAddress[] checkLookupTable(String host) {
+ // make sure addresses is null.
+ InetAddress[] addresses = null;
synchronized (lookupTable) {
// If the host isn't in the lookupTable, add it in the
@@ -1288,11 +1280,11 @@ class InetAddress implements java.io.Serializable {
// the lookup.
if (lookupTable.containsKey(host) == false) {
lookupTable.put(host, null);
- return obj;
+ return addresses;
}
// If the host is in the lookupTable, it means that another
- // thread is trying to look up the address of this host.
+ // thread is trying to look up the addresses of this host.
// This thread should wait.
while (lookupTable.containsKey(host)) {
try {
@@ -1302,18 +1294,18 @@ class InetAddress implements java.io.Serializable {
}
}
- // The other thread has finished looking up the address of
- // the host. This thread should retry to get the address
- // from the addressCache. If it doesn't get the address from
- // the cache, it will try to look up the address itself.
- obj = getCachedAddress(host);
- if (obj == null) {
+ // The other thread has finished looking up the addresses of
+ // the host. This thread should retry to get the addresses
+ // from the addressCache. If it doesn't get the addresses from
+ // the cache, it will try to look up the addresses itself.
+ addresses = getCachedAddresses(host);
+ if (addresses == null) {
synchronized (lookupTable) {
lookupTable.put(host, null);
}
}
- return obj;
+ return addresses;
}
private static void updateLookupTable(String host) {
@@ -1396,15 +1388,20 @@ class InetAddress implements java.io.Serializable {
cachedLocalHost = null;
}
- // we are calling getAddressFromNameService directly
+ // we are calling getAddressesFromNameService directly
// to avoid getting localHost from cache
if (ret == null) {
InetAddress[] localAddrs;
try {
localAddrs =
- (InetAddress[]) InetAddress.getAddressFromNameService(local);
+ InetAddress.getAddressesFromNameService(local);
} catch (UnknownHostException uhe) {
- throw new UnknownHostException(local + ": " + uhe.getMessage());
+ // Rethrow with a more informative error message.
+ UnknownHostException uhe2 =
+ new UnknownHostException(local + ": " +
+ uhe.getMessage());
+ uhe2.initCause(uhe);
+ throw uhe2;
}
cachedLocalHost = localAddrs[0];
cacheTime = now;
@@ -1434,8 +1431,8 @@ class InetAddress implements java.io.Serializable {
/*
* Load and instantiate an underlying impl class
*/
- static Object loadImpl(String implName) {
- Object impl;
+ static InetAddressImpl loadImpl(String implName) {
+ Object impl = null;
/*
* Property "impl.prefix" will be prepended to the classname
@@ -1446,7 +1443,6 @@ class InetAddress implements java.io.Serializable {
*/
String prefix = AccessController.doPrivileged(
new GetPropertyAction("impl.prefix", ""));
- impl = null;
try {
impl = Class.forName("java.net." + prefix + implName).newInstance();
} catch (ClassNotFoundException e) {
@@ -1471,7 +1467,7 @@ class InetAddress implements java.io.Serializable {
}
}
- return impl;
+ return (InetAddressImpl) impl;
}
private void readObjectNoData (ObjectInputStream s) throws
@@ -1498,13 +1494,8 @@ class InetAddress implements java.io.Serializable {
class InetAddressImplFactory {
static InetAddressImpl create() {
- Object o;
- if (isIPv6Supported()) {
- o = InetAddress.loadImpl("Inet6AddressImpl");
- } else {
- o = InetAddress.loadImpl("Inet4AddressImpl");
- }
- return (InetAddressImpl)o;
+ return InetAddress.loadImpl(isIPv6Supported() ?
+ "Inet6AddressImpl" : "Inet4AddressImpl");
}
static native boolean isIPv6Supported();
diff --git a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
index 58926062eff..4c5e928c560 100644
--- a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
+++ b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
@@ -124,7 +124,7 @@ static jfieldID ni_ia6ipaddressID;
static int initialized = 0;
/*
- * Find an internet address for a given hostname. Not this this
+ * Find an internet address for a given hostname. Note that this
* code only works for addresses of type INET. The translation
* of %d.%d.%d.%d to an address (int) occurs in java now, so the
* String "host" shouldn't *ever* be a %d.%d.%d.%d string
@@ -200,7 +200,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
*/
if (isspace((unsigned char)hostname[0])) {
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
- (char *)hostname);
+ hostname);
JNU_ReleaseStringPlatformChars(env, host, hostname);
return NULL;
}
@@ -210,8 +210,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
if (error) {
/* report error */
- JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
- (char *)hostname);
+ ThrowUnknownHostExceptionWithGaiError(env, hostname, error);
JNU_ReleaseStringPlatformChars(env, host, hostname);
return NULL;
} else {
@@ -407,7 +406,7 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
addr |= ((caddr[1] <<16) & 0xff0000);
addr |= ((caddr[2] <<8) & 0xff00);
addr |= (caddr[3] & 0xff);
- memset((char *) &him4, 0, sizeof(him4));
+ memset((void *) &him4, 0, sizeof(him4));
him4.sin_addr.s_addr = (uint32_t) htonl(addr);
him4.sin_family = AF_INET;
sa = (struct sockaddr *) &him4;
@@ -417,7 +416,7 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
* For IPv6 address construct a sockaddr_in6 structure.
*/
(*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
- memset((char *) &him6, 0, sizeof(him6));
+ memset((void *) &him6, 0, sizeof(him6));
memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) );
him6.sin6_family = AF_INET6;
sa = (struct sockaddr *) &him6 ;
@@ -579,8 +578,8 @@ Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
ifArray, ttl);
}
- memset((char *) caddr, 0, 16);
- memset((char *) &him6, 0, sizeof(him6));
+ memset((void *) caddr, 0, 16);
+ memset((void *) &him6, 0, sizeof(him6));
(*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) );
him6.sin6_family = AF_INET6;
@@ -600,8 +599,8 @@ Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
* for it.
*/
if (!(IS_NULL(ifArray))) {
- memset((char *) caddr, 0, 16);
- memset((char *) &inf6, 0, sizeof(inf6));
+ memset((void *) caddr, 0, 16);
+ memset((void *) &inf6, 0, sizeof(inf6));
(*env)->GetByteArrayRegion(env, ifArray, 0, 16, caddr);
memcpy((void *)&(inf6.sin6_addr), caddr, sizeof(struct in6_addr) );
inf6.sin6_family = AF_INET6;
diff --git a/jdk/src/solaris/native/java/net/net_util_md.c b/jdk/src/solaris/native/java/net/net_util_md.c
index 1a5283cfb3b..8a414e60141 100644
--- a/jdk/src/solaris/native/java/net/net_util_md.c
+++ b/jdk/src/solaris/native/java/net/net_util_md.c
@@ -61,6 +61,7 @@
getaddrinfo_f getaddrinfo_ptr = NULL;
freeaddrinfo_f freeaddrinfo_ptr = NULL;
+gai_strerror_f gai_strerror_ptr = NULL;
getnameinfo_f getnameinfo_ptr = NULL;
/*
@@ -342,11 +343,14 @@ jint IPv6_supported()
freeaddrinfo_ptr = (freeaddrinfo_f)
JVM_FindLibraryEntry(RTLD_DEFAULT, "freeaddrinfo");
+ gai_strerror_ptr = (gai_strerror_f)
+ JVM_FindLibraryEntry(RTLD_DEFAULT, "gai_strerror");
+
getnameinfo_ptr = (getnameinfo_f)
JVM_FindLibraryEntry(RTLD_DEFAULT, "getnameinfo");
if (freeaddrinfo_ptr == NULL || getnameinfo_ptr == NULL) {
- /* Wee need all 3 of them */
+ /* We need all 3 of them */
getaddrinfo_ptr = NULL;
}
@@ -355,6 +359,32 @@ jint IPv6_supported()
#endif /* AF_INET6 */
}
+void ThrowUnknownHostExceptionWithGaiError(JNIEnv *env,
+ const char* hostname,
+ int gai_error)
+{
+ const char *format = "%s: %s";
+ const char *error_string =
+ (gai_strerror_ptr == NULL) ? NULL : (*gai_strerror_ptr)(gai_error);
+ if (error_string == NULL)
+ error_string = "unknown error";
+
+ int size = strlen(format) + strlen(hostname) + strlen(error_string) + 2;
+ char *buf = (char *) malloc(size);
+ if (buf) {
+ sprintf(buf, format, hostname, error_string);
+ jstring s = JNU_NewStringPlatform(env, buf);
+ if (s != NULL) {
+ jobject x = JNU_NewObjectByName(env,
+ "java/net/UnknownHostException",
+ "(Ljava/lang/String;)V", s);
+ if (x != NULL)
+ (*env)->Throw(env, x);
+ }
+ free(buf);
+ }
+}
+
void
NET_AllocSockaddr(struct sockaddr **him, int *len) {
#ifdef AF_INET6
diff --git a/jdk/src/solaris/native/java/net/net_util_md.h b/jdk/src/solaris/native/java/net/net_util_md.h
index 13101dce13b..97f2ffa30b0 100644
--- a/jdk/src/solaris/native/java/net/net_util_md.h
+++ b/jdk/src/solaris/native/java/net/net_util_md.h
@@ -84,11 +84,13 @@ int getDefaultIPv6Interface(struct in6_addr *target_addr);
/* needed from libsocket on Solaris 8 */
-typedef int (*getaddrinfo_f)(const char *nodename, const char *servname,
- const struct addrinfo *hints, struct addrinfo **res);
+typedef int (*getaddrinfo_f)(const char *nodename, const char *servname,
+ const struct addrinfo *hints, struct addrinfo **res);
typedef void (*freeaddrinfo_f)(struct addrinfo *);
+typedef const char * (*gai_strerror_f)(int ecode);
+
typedef int (*getnameinfo_f)(const struct sockaddr *, size_t,
char *, size_t, char *, size_t, int);
@@ -96,6 +98,10 @@ extern getaddrinfo_f getaddrinfo_ptr;
extern freeaddrinfo_f freeaddrinfo_ptr;
extern getnameinfo_f getnameinfo_ptr;
+void ThrowUnknownHostExceptionWithGaiError(JNIEnv *env,
+ const char* hostname,
+ int gai_error);
+
/* do we have address translation support */
extern jboolean NET_addrtransAvailable();
From 11bbc5d5bc12d2104c66d92f96184ead11d36a89 Mon Sep 17 00:00:00 2001
From: Lance Andersen
Date: Sat, 18 Sep 2010 06:09:48 -0400
Subject: [PATCH 14/63] 6984044: RowSet source needs to rebrand vendor
references
Reviewed-by: darcy, ohair
---
.../com/sun/rowset/internal/WebRowSetXmlWriter.java | 2 +-
.../com/sun/rowset/providers/RIOptimisticProvider.java | 8 ++++----
.../classes/com/sun/rowset/providers/RIXMLProvider.java | 4 ++--
jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java | 3 +--
jdk/src/share/classes/javax/sql/rowset/WebRowSet.java | 6 +++---
jdk/src/share/classes/javax/sql/rowset/rowset.properties | 4 ++--
.../share/classes/javax/sql/rowset/spi/SyncFactory.java | 6 +++---
.../share/classes/javax/sql/rowset/spi/SyncProvider.java | 4 ++--
jdk/src/share/classes/javax/sql/rowset/spi/package.html | 4 ++--
9 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java b/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java
index f0d59647a7f..7dea5d97c77 100644
--- a/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java
+++ b/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java
@@ -248,7 +248,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
String strProvider = strProviderInstance.substring(0, (caller.getSyncProvider()).toString().indexOf("@"));
propString("sync-provider-name", strProvider);
- propString("sync-provider-vendor", "Sun Microsystems Inc.");
+ propString("sync-provider-vendor", "Oracle Corporation");
propString("sync-provider-version", "1.0");
propInteger("sync-provider-grade", caller.getSyncProvider().getProviderGrade());
propInteger("data-source-lock", caller.getSyncProvider().getDataSourceLock());
diff --git a/jdk/src/share/classes/com/sun/rowset/providers/RIOptimisticProvider.java b/jdk/src/share/classes/com/sun/rowset/providers/RIOptimisticProvider.java
index 5fb04167366..0d8dff3232f 100644
--- a/jdk/src/share/classes/com/sun/rowset/providers/RIOptimisticProvider.java
+++ b/jdk/src/share/classes/com/sun/rowset/providers/RIOptimisticProvider.java
@@ -93,14 +93,14 @@ public final class RIOptimisticProvider extends SyncProvider implements Serializ
private CachedRowSetWriter writer;
/**
- * The unique provider indentifier.
+ * The unique provider identifier.
*/
private String providerID = "com.sun.rowset.providers.RIOptimisticProvider";
/**
* The vendor name of this SyncProvider implementation
*/
- private String vendorName = "Sun Microsystems Inc.";
+ private String vendorName = "Oracle Corporation";
/**
* The version number of this SyncProvider implementation
@@ -236,8 +236,8 @@ public final class RIOptimisticProvider extends SyncProvider implements Serializ
}
/**
- * Returns the vendor name of the Reference Implemntation Optimistic
- * Syncchronication Provider
+ * Returns the vendor name of the Reference Implementation Optimistic
+ * Synchronization Provider
*
* @return the String
detailing the vendor name of this
* SyncProvider
diff --git a/jdk/src/share/classes/com/sun/rowset/providers/RIXMLProvider.java b/jdk/src/share/classes/com/sun/rowset/providers/RIXMLProvider.java
index bbe2bdc5436..3736001cca2 100644
--- a/jdk/src/share/classes/com/sun/rowset/providers/RIXMLProvider.java
+++ b/jdk/src/share/classes/com/sun/rowset/providers/RIXMLProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
@@ -85,7 +85,7 @@ public final class RIXMLProvider extends SyncProvider {
/**
* The vendor name of this SyncProvider implementation.
*/
- private String vendorName = "Sun Microsystems Inc.";
+ private String vendorName = "Oracle Corporation";
/**
* The version number of this SyncProvider implementation.
diff --git a/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java b/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java
index 2a60bb3b7e7..7861223911b 100644
--- a/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java
+++ b/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java
@@ -39,7 +39,7 @@ import javax.sql.rowset.spi.*;
* CachedRowSet
must implement.
*
* The reference implementation of the CachedRowSet
interface provided
- * by Sun Microsystems is a standard implementation. Developers may use this implementation
+ * by Oracle Corporation is a standard implementation. Developers may use this implementation
* just as it is, they may extend it, or they may choose to write their own implementations
* of this interface.
*
@@ -1623,4 +1623,3 @@ public interface CachedRowSet extends RowSet, Joinable {
public boolean previousPage() throws SQLException;
}
-
diff --git a/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java b/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java
index c354c5fe7bb..abef62f1271 100644
--- a/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java
+++ b/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
@@ -115,7 +115,7 @@ import org.xml.sax.*;
* <url>jdbc:thin:oracle</url>
* <sync-provider>
* <sync-provider-name>.com.rowset.provider.RIOptimisticProvider</sync-provider-name>
- * <sync-provider-vendor>Sun Microsystems</sync-provider-vendor>
+ * <sync-provider-vendor>Oracle Corporation</sync-provider-vendor>
* <sync-provider-version>1.0</sync-provider-name>
* <sync-provider-grade>LOW</sync-provider-grade>
* <data-source-lock>NONE</data-source-lock>
@@ -489,7 +489,7 @@ public interface WebRowSet extends CachedRowSet {
* tags and their valid values for a WebRowSet
implementation.
*/
public static String PUBLIC_XML_SCHEMA =
- "--//Sun Microsystems, Inc.//XSD Schema//EN";
+ "--//Oracle Corporation//XSD Schema//EN";
/**
* The URL for the XML Schema definition file that defines the XML tags and
diff --git a/jdk/src/share/classes/javax/sql/rowset/rowset.properties b/jdk/src/share/classes/javax/sql/rowset/rowset.properties
index 4fb38bd5242..68dd95b0fb7 100644
--- a/jdk/src/share/classes/javax/sql/rowset/rowset.properties
+++ b/jdk/src/share/classes/javax/sql/rowset/rowset.properties
@@ -3,10 +3,10 @@
# Optimistic synchonriztaion provider
rowset.provider.classname.0=com.sun.rowset.providers.RIOptimisticProvider
-rowset.provider.vendor.0=Sun Microsystems Inc
+rowset.provider.vendor.0=Oracle Corporation
rowset.provider.version.0=1.0
# XML Provider using standard XML schema
rowset.provider.classname.1=com.sun.rowset.providers.RIXMLProvider
-rowset.provider.vendor.1=Sun Microsystems Inc.
+rowset.provider.vendor.1=Oracle Corporation
rowset.provider.version.1=1.0
diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java
index 4aec879a059..3369f466b41 100644
--- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java
@@ -125,12 +125,12 @@ import javax.naming.*;
*
* # Optimistic synchronization provider
* rowset.provider.classname.0=com.sun.rowset.providers.RIOptimisticProvider
- * rowset.provider.vendor.0=Sun Microsystems Inc
+ * rowset.provider.vendor.0=Oracle Corporation
* rowset.provider.version.0=1.0
*
* # XML Provider using standard XML schema
* rowset.provider.classname.1=com.sun.rowset.providers.RIXMLProvider
- * rowset.provider.vendor.1=Sun Microsystems Inc.
+ * rowset.provider.vendor.1=Oracle Corporation
* rowset.provider.version.1=1.0
*
* The SyncFactory
checks this file and registers the
@@ -369,7 +369,7 @@ public class SyncFactory {
try {
// check if user is supplying his Synchronisation Provider
- // Implementation if not use Sun's implementation.
+ // Implementation if not using Oracle's implementation.
// properties.load(new FileInputStream(ROWSET_PROPERTIES));
// The rowset.properties needs to be in jdk/jre/lib when
diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/SyncProvider.java b/jdk/src/share/classes/javax/sql/rowset/spi/SyncProvider.java
index 86a4bcd28e3..81425998889 100644
--- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncProvider.java
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncProvider.java
@@ -91,8 +91,8 @@ import javax.sql.*;
*
*
* A vendor can register a SyncProvider
implementation class name
- * with Sun Microsystems, Inc. by sending email to jdbc@sun.com.
- * Sun will maintain a database listing the
+ * with Oracle Corporation by sending email to jdbc@sun.com.
+ * Oracle will maintain a database listing the
* available SyncProvider
implementations for use with compliant
* RowSet
implementations. This database will be similar to the
* one already maintained to list available JDBC drivers.
diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/package.html b/jdk/src/share/classes/javax/sql/rowset/spi/package.html
index 89a84a39715..a5732719108 100644
--- a/jdk/src/share/classes/javax/sql/rowset/spi/package.html
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/package.html
@@ -8,7 +8,7 @@