Backport patch for ebz#486069, NPE in SWT when running on Wayland

- Eliminate more test failures due to missing resources
This commit is contained in:
Mat Booth 2016-03-29 21:12:16 +01:00
parent 230ce848b8
commit 3cd2ce87f5
3 changed files with 159 additions and 1 deletions

37
eclipse-bug-486069.patch Normal file
View File

@ -0,0 +1,37 @@
From 1a375bfbb7dca92b102db09891a18eeb80d671f2 Mon Sep 17 00:00:00 2001
From: Eric Williams
Date: Tue, 19 Jan 2016 15:16:57 -0500
Subject: Bug 486069: [Wayland] NullPointerException in TabFolder when running
ControlExample
This patch adds a missing logic check to prevent a GtkNotebook from
switching to a page that doesn't exist. Wayland seems to trigger an
early page switch, causing gtk_notebook_get_current_page() to return -1.
This will cause a NullPointerException in TabFolder.gtk_switch_page().
Tested on GTK3.19.6, and 3.18. AllNonBrowser JUnit tests pass on
GTK3.19.6 (with the exception of an unrelated previously failing test
case).
Change-Id: I720a7b08c0b49bebce15951f5d5deb00a2304839
Signed-off-by: Eric Williams <ericwill@redhat.com>---
.../Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
index 7344bf7..00e157c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
@@ -565,6 +565,8 @@ long /*int*/ gtk_switch_page (long /*int*/ widget, long /*int*/ page, long /*int
if (control != null && !control.isDisposed ()) {
control.setVisible (false);
}
+ } else {
+ return 0;
}
TabItem item = items [(int)/*64*/page_num];
Control control = item.getControl ();
--
cgit v0.11.2-4-g4a35

View File

@ -125,3 +125,118 @@ index bc8963d..fbe4da3 100644
output.lib/antUITestsSupport.jar = test_support_bin/
+output.testbuildfiles/antUITestsSupport.jar = test_support_bin/
output.anttestsui.jar = bin/
--- eclipse.jdt.ui/org.eclipse.jdt.ui.tests/build.properties.orig 2016-03-25 15:09:40.557786910 +0000
+++ eclipse.jdt.ui/org.eclipse.jdt.ui.tests/build.properties 2016-03-25 15:12:08.476059326 +0000
@@ -22,3 +22,5 @@
leaks/,\
performance/
javacWarnings..=-raw,-unchecked
+source.testresources/nls.jar = nls/
+jars.compile.order = .,testresources/nls.jar
--- /dev/null 1970-01-01 01:00:00.000000000 +0100
+++ eclipse.jdt.ui/org.eclipse.jdt.ui.tests/nls/pkg/Client.java 2004-11-12 14:37:36.000000000 +0000
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package pkg;
+
+public class Client {
+
+ public String s;
+
+ {
+ s= Messages.getString("test");
+ s= Messages.getString("test_undefined");
+ s= Messages.getString("duplicate");
+ s= Messages.getString("test.long.key");
+ s= Messages.getString("SearchResultView.removed_resource");
+ }
+
+}
--- /dev/null 1970-01-01 01:00:00.000000000 +0100
+++ eclipse.jdt.ui/org.eclipse.jdt.ui.tests/nls/pkg/Messages.java 2004-11-12 14:37:28.000000000 +0000
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package pkg;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages extends Object {
+ private static final String RESOURCE_BUNDLE = Messages.class.getName();
+ private static ResourceBundle fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
+
+ private Messages() {}
+
+ /**
+ * Gets a string from the resource bundle and formats it with the argument
+ *
+ * @param key the string used to get the bundle value, must not be null
+ */
+ public static String getFormattedString(String key, Object arg) {
+ String format = null;
+
+ try {
+ format = fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!"; //$NON-NLS-2$ //$NON-NLS-1$
+ }
+
+ if (arg == null) {
+ arg = ""; //$NON-NLS-1$
+ }
+
+ return MessageFormat.format(format, new Object[] { arg });
+ }
+
+ /**
+ * Gets a string from the resource bundle and formats it with arguments
+ */
+ public static String getFormattedString(String key, String[] args) {
+ return MessageFormat.format(fgResourceBundle.getString(key), args);
+ }
+
+ public static String getString(String key) {
+ try {
+ return fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!"; //$NON-NLS-2$ //$NON-NLS-1$
+ }
+ }
+}
--- /dev/null 1970-01-01 01:00:00.000000000 +0100
+++ eclipse.jdt.ui/org.eclipse.jdt.ui.tests/nls/pkg/Messages.properties 2004-11-12 14:38:06.000000000 +0000
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2000, 2004 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Common Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/cpl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+test= Hello World
+duplicate= Duplicate 1
+test.long.key= Hello World Long
+duplicate= Duplicate 2
+SearchResultView.removed_resource= <removed resource>

View File

@ -49,7 +49,7 @@ Epoch: 1
Summary: An open, extensible IDE
Name: eclipse
Version: %{eclipse_version}
Release: 7%{?dist}
Release: 8%{?dist}
License: EPL
URL: http://www.eclipse.org/
@ -149,6 +149,7 @@ Patch35: eclipse-bug-477487.patch
Patch36: eclipse-bug-487712.patch
Patch37: eclipse-bug-488226.patch
Patch38: eclipse-bug-489953.patch
Patch39: eclipse-bug-486069.patch
BuildRequires: rsync
BuildRequires: make, gcc
@ -406,6 +407,7 @@ popd
pushd eclipse.platform.swt
%patch37 -p1
%patch38 -p1
%patch39 -p1
popd
# Resolving the target platform requires too many changes, so don't use it
@ -1137,6 +1139,10 @@ fi
%{_libdir}/%{pkg_name}/plugins/org.eclipse.osgi.compatibility.state_*
%changelog
* Tue Mar 29 2016 Mat Booth <mat.booth@redhat.com> - 1:4.5.2-8
- Backport patch for ebz#486069, NPE in SWT when running on Wayland
- Eliminate more test failures due to missing resources
* Fri Mar 25 2016 Mat Booth <mat.booth@redhat.com> - 1:4.5.2-7
- Update e-b snapshot for updated ant dependency