Date: Fri, 16 May 2014 00:01:02 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r354183 - in head/java/icedtea-web: . files Message-ID: <201405160001.s4G012NC083109@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Fri May 16 00:01:02 2014 New Revision: 354183 URL: http://svnweb.freebsd.org/changeset/ports/354183 QAT: https://qat.redports.org/buildarchive/r354183/ Log: Add upstream patches to support java/openjdk8. Note OpenJDK8 is not officially supported by the upstream and the next major release will drop support for OpenJDK6. Added: head/java/icedtea-web/files/extrapatch-jdk8 (contents, props changed) Modified: head/java/icedtea-web/Makefile Modified: head/java/icedtea-web/Makefile ============================================================================== --- head/java/icedtea-web/Makefile Thu May 15 23:53:56 2014 (r354182) +++ head/java/icedtea-web/Makefile Fri May 16 00:01:02 2014 (r354183) @@ -19,7 +19,6 @@ GNU_CONFIGURE= yes USE_JAVA= yes JAVA_OS= native JAVA_VENDOR= openjdk -JAVA_VERSION= 1.6 1.7 USE_PERL5= build USE_XORG= x11 USES= desktop-file-utils gmake perl5 pkgconfig shebangfix @@ -79,7 +78,9 @@ WEBPLUGIN_FILES=IcedTeaPlugin.so .include <bsd.port.pre.mk> -.if ${JAVA_PORT_VERSION} == "1.6.0" +.if ${JAVA_PORT_VERSION} == "1.8.0" +EXTRA_PATCHES= ${PATCHDIR}/extrapatch-jdk8 +.elif ${JAVA_PORT_VERSION} == "1.6.0" pre-extract: @${ECHO_MSG} @${ECHO_MSG} "IMPORTANT: To build IcedTea-Web ${PORTVERSION}, you have to turn on 'ICEDTEA' option" Added: head/java/icedtea-web/files/extrapatch-jdk8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/java/icedtea-web/files/extrapatch-jdk8 Fri May 16 00:01:02 2014 (r354183) @@ -0,0 +1,1542 @@ +--- Makefile.in 2014-04-02 06:21:18.672343000 -0400 ++++ Makefile.in 2014-05-15 18:30:56.000000000 -0400 +@@ -769,8 +769,8 @@ + # Flags + export IT_CFLAGS=$(CFLAGS) $(ARCHFLAG) + export IT_JAVAC_SETTINGS=-g -encoding utf-8 $(JAVACFLAGS) $(MEMORY_LIMIT) $(PREFER_SOURCE) +-export IT_LANGUAGE_SOURCE_VERSION=6 +-export IT_CLASS_TARGET_VERSION=6 ++export IT_LANGUAGE_SOURCE_VERSION=7 ++export IT_CLASS_TARGET_VERSION=7 + export IT_JAVACFLAGS=$(IT_JAVAC_SETTINGS) -source $(IT_LANGUAGE_SOURCE_VERSION) -target $(IT_CLASS_TARGET_VERSION) + + # +@@ -2189,6 +2189,14 @@ + ln -sf ./$(JRE_ARCH_DIR) \ + $(BOOT_DIR)/jre/lib/$(INSTALL_ARCH_DIR); \ + fi; ++ mkdir -p $(BOOT_DIR)/lib && \ ++ ln -sf $(SYSTEM_JDK_DIR)/lib/$(JRE_ARCH_DIR) \ ++ $(BOOT_DIR)/lib/ && \ ++ if ! test -d $(BOOT_DIR)/lib/$(INSTALL_ARCH_DIR); \ ++ then \ ++ ln -sf ./$(JRE_ARCH_DIR) \ ++ $(BOOT_DIR)/lib/$(INSTALL_ARCH_DIR); \ ++ fi; + mkdir -p $(BOOT_DIR)/include && \ + for i in $(SYSTEM_JDK_DIR)/include/*; do \ + test -r $$i | continue; \ +--- configure 2014-04-02 06:21:18.000335000 -0400 ++++ configure 2014-05-15 17:04:42.000000000 -0400 +@@ -626,6 +626,8 @@ + VERSION_DEFS + HAVE_JAVA7_FALSE + HAVE_JAVA7_TRUE ++HAVE_JAVA8_FALSE ++HAVE_JAVA8_TRUE + JAVA + SYSTEM_JRE_DIR + X11_LIBS +@@ -7226,8 +7228,9 @@ + + JAVA_VERSION=`$JAVA -version 2>&1 | sed -n '1s/[^"]*"\(.*\)"$/\1/p'` + HAVE_JAVA7=`echo $JAVA_VERSION | awk '{if ($(0) >= 1.7) print "yes"}'` +- if ! test -z "$HAVE_JAVA7" ; then +- VERSION_DEFS='-DHAVE_JAVA7' ++ HAVE_JAVA8=`echo $JAVA_VERSION | awk '{if ($(0) >= 1.8) print "yes"}'` ++ if ! test -z "$HAVE_JAVA8" ; then ++ VERSION_DEFS='-DHAVE_JAVA8' + fi + + if test x"${HAVE_JAVA7}" = "xyes" ; then +@@ -7237,6 +7240,13 @@ + HAVE_JAVA7_TRUE='#' + HAVE_JAVA7_FALSE= + fi ++if test x"${HAVE_JAVA8}" = "xyes" ; then ++ HAVE_JAVA8_TRUE= ++ HAVE_JAVA8_FALSE='#' ++else ++ HAVE_JAVA8_TRUE='#' ++ HAVE_JAVA8_FALSE= ++fi + + + +@@ -10444,6 +10454,10 @@ + as_fn_error $? "conditional \"HAVE_JAVA7\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 + fi ++if test -z "${HAVE_JAVA8_TRUE}" && test -z "${HAVE_JAVA8_FALSE}"; then ++ as_fn_error $? "conditional \"HAVE_JAVA8\" was never defined. ++Usually this means the macro was only invoked conditionally." "$LINENO" 5 ++fi + if test -z "${WITH_XSLTPROC_TRUE}" && test -z "${WITH_XSLTPROC_FALSE}"; then + as_fn_error $? "conditional \"WITH_XSLTPROC\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 +--- netx/net/sourceforge/jnlp/JNLPFile.java 2014-04-02 06:20:59.682125000 -0400 ++++ netx/net/sourceforge/jnlp/JNLPFile.java 2014-05-15 16:57:19.000000000 -0400 +@@ -267,7 +267,6 @@ + /** + * Create a JNLPFile from an input stream. + * +- * @throws IOException if an IO exception occurred + * @throws ParseException if the JNLP file was invalid + */ + public JNLPFile(InputStream input, ParserSettings settings) throws ParseException { +@@ -281,7 +280,6 @@ + * @param input input stream of JNLP file. + * @param codebase codebase to use if not specified in JNLP file.. + * @param settings the {@link ParserSettings} to use when parsing +- * @throws IOException if an IO exception occurred + * @throws ParseException if the JNLP file was invalid + */ + public JNLPFile(InputStream input, URL codebase, ParserSettings settings) throws ParseException { +--- netx/net/sourceforge/jnlp/SecurityDesc.java 2014-04-02 06:20:59.680124000 -0400 ++++ netx/net/sourceforge/jnlp/SecurityDesc.java 2014-05-15 16:57:19.000000000 -0400 +@@ -90,7 +90,7 @@ + * The HTML permission level corresponding to the given String. If null is given, null comes + * back. If there is no permission level that can be granted in HTML matching the given String, + * null is also returned. +- * @param jnlpString the JNLP permission String ++ * @param htmlString the JNLP permission String + * @return the matching RequestedPermissionLevel + */ + public RequestedPermissionLevel fromHtmlString(final String htmlString) { +--- netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java 2014-04-02 06:20:59.683125000 -0400 ++++ netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java 2014-05-15 16:57:19.000000000 -0400 +@@ -292,12 +292,13 @@ + settingsPanel.add(p, panel.toString()); + } + +- final JList settingsList = new JList(panels); ++ final JList<SettingsPanel> settingsList = new JList<>(panels); + settingsList.addListSelectionListener(new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent e) { +- JList list = (JList) e.getSource(); +- SettingsPanel panel = (SettingsPanel) list.getSelectedValue(); ++ @SuppressWarnings("unchecked") ++ JList<SettingsPanel> list = (JList<SettingsPanel>) e.getSource(); ++ SettingsPanel panel = list.getSelectedValue(); + CardLayout cl = (CardLayout) settingsPanel.getLayout(); + cl.show(settingsPanel, panel.toString()); + } +--- netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java 2014-04-02 06:20:59.683125000 -0400 ++++ netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java 2014-05-15 16:57:19.000000000 -0400 +@@ -27,6 +27,7 @@ + import java.awt.event.ActionListener; + import java.awt.event.ItemEvent; + import java.awt.event.ItemListener; ++ + import javax.swing.Box; + import javax.swing.JButton; + import javax.swing.JCheckBox; +@@ -36,6 +37,7 @@ + import javax.swing.JTextField; + import javax.swing.event.DocumentEvent; + import javax.swing.event.DocumentListener; ++ + import net.sourceforge.jnlp.config.Defaults; + import net.sourceforge.jnlp.config.DeploymentConfiguration; + import net.sourceforge.jnlp.runtime.Translator; +@@ -139,7 +141,7 @@ + new ComboItem(Translator.R("DPShowJavawsOnly"), DeploymentConfiguration.CONSOLE_SHOW_JAVAWS) }; + + JLabel consoleLabel = new JLabel(Translator.R("DPJavaConsole")); +- JComboBox consoleComboBox = new JComboBox(); ++ JComboBox<ComboItem> consoleComboBox = new JComboBox<>(); + consoleComboBox.setActionCommand(DeploymentConfiguration.KEY_CONSOLE_STARTUP_MODE); // The property this comboBox affects. + + JPanel consolePanel = new JPanel(); +@@ -201,7 +203,6 @@ + } + + @Override +- @SuppressWarnings("unchecked") + public void itemStateChanged(ItemEvent e) { + + Object o = e.getSource(); +@@ -210,7 +211,8 @@ + JCheckBox jcb = (JCheckBox) o; + config.setProperty(jcb.getActionCommand(), String.valueOf(jcb.isSelected())); + } else if (o instanceof JComboBox) { +- JComboBox jcb = (JComboBox) o; ++ @SuppressWarnings("unchecked") ++ JComboBox<ComboItem> jcb = (JComboBox<ComboItem>) o; + ComboItem c = (ComboItem) e.getItem(); + config.setProperty(jcb.getActionCommand(), c.getValue()); + } +--- netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java 2014-04-02 06:20:59.683125000 -0400 ++++ netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java 2014-05-15 16:57:19.000000000 -0400 +@@ -62,7 +62,7 @@ + private void addComponents() { + GridBagConstraints c = new GridBagConstraints(); + JLabel description = new JLabel("<html>" + Translator.R("CPDesktopIntegrationDescription") + "<hr /></html>"); +- JComboBox shortcutComboOptions = new JComboBox(); ++ JComboBox<ComboItem> shortcutComboOptions = new JComboBox<>(); + ComboItem[] items = { new ComboItem(Translator.R("DSPNeverCreate"), "NEVER"), + new ComboItem(Translator.R("DSPAlwaysAllow"), "ALWAYS"), + new ComboItem(Translator.R("DSPAskUser"), "ASK_USER"), +@@ -94,8 +94,9 @@ + add(filler, c); + } + ++ @SuppressWarnings("unchecked") + public void itemStateChanged(ItemEvent e) { + ComboItem c = (ComboItem) e.getItem(); +- config.setProperty(((JComboBox) e.getSource()).getActionCommand(), c.getValue()); ++ config.setProperty(((JComboBox<ComboItem>) e.getSource()).getActionCommand(), c.getValue()); + } + } +--- netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java 2014-04-02 06:20:59.683125000 -0400 ++++ netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java 2014-05-15 16:57:19.000000000 -0400 +@@ -163,7 +163,7 @@ + new ComboItem("7", "7"), + new ComboItem("8", "8"), + new ComboItem(Translator.R("TIFPMax"), "9"), }; +- JComboBox cbCompression = new JComboBox(compressionOptions); ++ JComboBox<ComboItem> cbCompression = new JComboBox<>(compressionOptions); + cbCompression.setSelectedIndex(Integer.parseInt(this.config.getProperty(properties[3]))); + cbCompression.addItemListener(new ItemListener() { + @Override +--- netx/net/sourceforge/jnlp/controlpanel/UnsignedAppletsTrustingListPanel.java 2014-04-02 06:20:59.683125000 -0400 ++++ netx/net/sourceforge/jnlp/controlpanel/UnsignedAppletsTrustingListPanel.java 2014-05-15 16:57:19.000000000 -0400 +@@ -51,6 +51,7 @@ + import java.util.Date; + import java.util.List; + import java.util.regex.Pattern; ++ + import javax.swing.DefaultCellEditor; + import javax.swing.JComboBox; + import javax.swing.JDialog; +@@ -72,6 +73,7 @@ + import javax.swing.table.TableCellRenderer; + import javax.swing.table.TableModel; + import javax.swing.table.TableRowSorter; ++ + import net.sourceforge.jnlp.config.DeploymentConfiguration; + import net.sourceforge.jnlp.runtime.Translator; + import net.sourceforge.jnlp.security.appletextendedsecurity.AppletSecurityLevel; +@@ -95,9 +97,9 @@ + private javax.swing.JButton moveRowDownButton; + private javax.swing.JCheckBox askBeforeActionCheckBox; + private javax.swing.JCheckBox filterRegexesCheckBox; +- private javax.swing.JComboBox mainPolicyComboBox; +- private javax.swing.JComboBox deleteTypeComboBox; +- private javax.swing.JComboBox viewFilter; ++ private javax.swing.JComboBox<AppletSecurityLevel> mainPolicyComboBox; ++ private javax.swing.JComboBox<String> deleteTypeComboBox; ++ private javax.swing.JComboBox<String> viewFilter; + private javax.swing.JLabel globalBehaviourLabel; + private javax.swing.JLabel securityLevelLabel; + private javax.swing.JScrollPane userTableScrollPane; +@@ -175,7 +177,7 @@ + setButtons((!currentModel.back.isReadOnly())); + } + +- public String appletItemsToCaption(List<UnsignedAppletActionEntry> ii, String caption) { ++ public static String appletItemsToCaption(List<UnsignedAppletActionEntry> ii, String caption) { + StringBuilder sb = new StringBuilder(); + for (UnsignedAppletActionEntry i : ii) { + sb.append(appletItemToCaption(i, caption)).append("\n"); +@@ -197,7 +199,7 @@ + + public static void removeSelectedFromTable(JTable table, boolean ask, UnsignedAppletActionTableModel data, Component forDialog) { + int[] originalIndexes = table.getSelectedRows(); +- List<Integer> newIndexes = new ArrayList<Integer>(originalIndexes.length); ++ List<Integer> newIndexes = new ArrayList<>(originalIndexes.length); + for (int i = 0; i < originalIndexes.length; i++) { + //we need to remap values first + int modelRow = table.convertRowIndexToModel(originalIndexes[i]); +@@ -249,7 +251,7 @@ + userTable = createTbale(customModel); + globalTable = createTbale(globalModel); + helpButton = new javax.swing.JButton(); +- mainPolicyComboBox = new JComboBox(new AppletSecurityLevel[]{ ++ mainPolicyComboBox = new JComboBox<>(new AppletSecurityLevel[] { + AppletSecurityLevel.DENY_ALL, + AppletSecurityLevel.DENY_UNSIGNED, + AppletSecurityLevel.ASK_UNSIGNED, +@@ -258,8 +260,8 @@ + mainPolicyComboBox.setSelectedItem(AppletSecurityLevel.getDefault()); + securityLevelLabel = new javax.swing.JLabel(); + globalBehaviourLabel = new javax.swing.JLabel(); +- deleteTypeComboBox = new javax.swing.JComboBox(); +- viewFilter = new javax.swing.JComboBox(); ++ deleteTypeComboBox = new javax.swing.JComboBox<>(); ++ viewFilter = new javax.swing.JComboBox<>(); + deleteButton = new javax.swing.JButton(); + testUrlButton = new javax.swing.JButton(); + addRowButton = new javax.swing.JButton(); +@@ -335,7 +337,7 @@ + + globalBehaviourLabel.setText(Translator.R("APPEXTSECguiPanelGlobalBehaviourCaption")); + +- deleteTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[]{ ++ deleteTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { + Translator.R("APPEXTSECguiPanelDeleteMenuSelected"), + Translator.R("APPEXTSECguiPanelDeleteMenuAllA"), + Translator.R("APPEXTSECguiPanelDeleteMenuAllN"), +@@ -343,7 +345,7 @@ + Translator.R("APPEXTSECguiPanelDeleteMenuAlln"), + Translator.R("APPEXTSECguiPanelDeleteMenuAllAll")})); + +- viewFilter.setModel(new javax.swing.DefaultComboBoxModel(new String[]{ ++ viewFilter.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { + Translator.R("APPEXTSECguiPanelShowOnlyPermanent"), + Translator.R("APPEXTSECguiPanelShowOnlyTemporal"), + Translator.R("APPEXTSECguiPanelShowAll"), +@@ -681,7 +683,7 @@ + } + } + +- private void helpButtonActionPerformed(java.awt.event.ActionEvent evt) { ++ private static void helpButtonActionPerformed(java.awt.event.ActionEvent evt) { + JDialog d = new ExtendedAppletSecurityHelp(null, false); + ScreenFinder.centerWindowsToCurrentScreen(d); + d.setVisible(true); +@@ -701,7 +703,11 @@ + public TableCellEditor getCellEditor(int row, int column) { + int columnx = convertColumnIndexToModel(column); + if (columnx == 0) { +- return new DefaultCellEditor(new JComboBox(new ExecuteAppletAction[]{ExecuteAppletAction.ALWAYS, ExecuteAppletAction.NEVER, ExecuteAppletAction.YES, ExecuteAppletAction.NO})); ++ return new DefaultCellEditor(new JComboBox<>(new ExecuteAppletAction[] { ++ ExecuteAppletAction.ALWAYS, ++ ExecuteAppletAction.NEVER, ++ ExecuteAppletAction.YES, ++ ExecuteAppletAction.NO })); + } + if (columnx == 2) { + column = convertColumnIndexToModel(column); +@@ -761,7 +767,7 @@ + private void removeByBehaviour(ExecuteAppletAction unsignedAppletAction) { + UnsignedAppletActionEntry[] items = currentModel.back.toArray(); + if (askBeforeActionCheckBox.isSelected()) { +- List<UnsignedAppletActionEntry> toBeDeleted = new ArrayList<UnsignedAppletActionEntry>(); ++ List<UnsignedAppletActionEntry> toBeDeleted = new ArrayList<>(); + for (int i = 0; i < items.length; i++) { + UnsignedAppletActionEntry unsignedAppletActionEntry = items[i]; + if (unsignedAppletActionEntry.getUnsignedAppletAction() == unsignedAppletAction) { +--- netx/net/sourceforge/jnlp/security/VariableX509TrustManagerJDK6.java 2014-04-02 06:20:59.679124000 -0400 ++++ netx/net/sourceforge/jnlp/security/VariableX509TrustManagerJDK6.java 2014-05-15 16:57:19.000000000 -0400 +@@ -1,75 +0,0 @@ +-/* VariableX509TrustManagerJDK6.java +- Copyright (C) 2012 Red Hat, Inc. +- +-This file is part of IcedTea. +- +-IcedTea is free software; you can redistribute it and/or +-modify it under the terms of the GNU General Public License as published by +-the Free Software Foundation, version 2. +- +-IcedTea 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 for more details. +- +-You should have received a copy of the GNU General Public License +-along with IcedTea; see the file COPYING. If not, write to +-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +-02110-1301 USA. +- +-Linking this library statically or dynamically with other modules is +-making a combined work based on this library. Thus, the terms and +-conditions of the GNU General Public License cover the whole +-combination. +- +-As a special exception, the copyright holders of this library give you +-permission to link this library with independent modules to produce an +-executable, regardless of the license terms of these independent +-modules, and to copy and distribute the resulting executable under +-terms of your choice, provided that you also meet, for each linked +-independent module, the terms and conditions of the license of that +-module. An independent module is a module which is not derived from +-or based on this library. If you modify this library, you may extend +-this exception to your version of the library, but you are not +-obligated to do so. If you do not wish to do so, delete this +-exception statement from your version. +-*/ +- +-package net.sourceforge.jnlp.security; +- +-import java.security.cert.CertificateException; +-import java.security.cert.X509Certificate; +- +-import com.sun.net.ssl.internal.ssl.X509ExtendedTrustManager; +- +-public class VariableX509TrustManagerJDK6 extends X509ExtendedTrustManager { +- +- private VariableX509TrustManager vX509TM = VariableX509TrustManager.getInstance(); +- +- @Override +- public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { +- checkClientTrusted(chain, authType, null, null); +- } +- +- @Override +- public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { +- vX509TM.checkTrustServer(chain, authType, null /* hostname*/, null /* socket */, null /* engine */); +- } +- +- @Override +- public X509Certificate[] getAcceptedIssuers() { +- return vX509TM.getAcceptedIssuers(); +- } +- +- @Override +- public void checkClientTrusted(X509Certificate[] chain, String authType, String hostname, String algorithm) throws CertificateException { +- vX509TM.checkTrustClient(chain, authType, hostname); // We don't need algorithm, we will always use this for TLS only +- } +- +- @Override +- public void checkServerTrusted(X509Certificate[] chain, String authType, String hostname, String algorithm) throws CertificateException { +- // We don't need to pass algorithm, we will always use this for TLS only +- vX509TM.checkTrustServer(chain, authType, hostname, null /* socket */, null /* engine */); +- } +- +-} +--- netx/net/sourceforge/jnlp/security/policyeditor/CustomPolicyViewer.java 2014-04-02 06:20:59.679124000 -0400 ++++ netx/net/sourceforge/jnlp/security/policyeditor/CustomPolicyViewer.java 2014-05-15 16:57:20.000000000 -0400 +@@ -66,14 +66,14 @@ + */ + public class CustomPolicyViewer extends JFrame { + +- private final Collection<CustomPermission> customPermissions = new TreeSet<CustomPermission>(); ++ private final Collection<CustomPermission> customPermissions = new TreeSet<>(); + private final JScrollPane scrollPane = new JScrollPane(); +- private final DefaultListModel listModel = new DefaultListModel(); +- private final JList list = new JList(listModel); ++ private final DefaultListModel<CustomPermission> listModel = new DefaultListModel<>(); ++ private final JList<CustomPermission> list = new JList<>(listModel); + private final JButton addButton = new JButton(), removeButton = new JButton(), closeButton = new JButton(); + private final JLabel listLabel = new JLabel(); + private final ActionListener addButtonAction, removeButtonAction, closeButtonAction; +- private final WeakReference<CustomPolicyViewer> weakThis = new WeakReference<CustomPolicyViewer>(this); ++ private final WeakReference<CustomPolicyViewer> weakThis = new WeakReference<>(this); + + /** + * @param parent the parent PolicyEditor which created this CustomPolicyViewer +--- netx/net/sourceforge/jnlp/security/policyeditor/PermissionActions.java 2014-04-02 06:20:59.679124000 -0400 ++++ netx/net/sourceforge/jnlp/security/policyeditor/PermissionActions.java 2014-05-15 16:57:20.000000000 -0400 +@@ -88,7 +88,7 @@ + } + + private static Set<String> setFromString(final String string) { +- final Set<String> set = new HashSet<String>(); ++ final Set<String> set = new HashSet<>(); + Collections.addAll(set, string.split(",")); + return set; + } +--- netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java 2014-04-02 06:20:59.679124000 -0400 ++++ netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java 2014-05-15 16:57:20.000000000 -0400 +@@ -165,18 +165,18 @@ + private File file; + private boolean changesMade = false; + private boolean closed = false; +- private final Map<String, Map<PolicyEditorPermissions, Boolean>> codebasePermissionsMap = new HashMap<String, Map<PolicyEditorPermissions, Boolean>>(); +- private final Map<String, Set<CustomPermission>> customPermissionsMap = new HashMap<String, Set<CustomPermission>>(); +- private final Map<PolicyEditorPermissions, JCheckBox> checkboxMap = new TreeMap<PolicyEditorPermissions, JCheckBox>(); +- private final List<JCheckBoxWithGroup> groupBoxList = new ArrayList<JCheckBoxWithGroup>(Group.values().length); ++ private final Map<String, Map<PolicyEditorPermissions, Boolean>> codebasePermissionsMap = new HashMap<>(); ++ private final Map<String, Set<CustomPermission>> customPermissionsMap = new HashMap<>(); ++ private final Map<PolicyEditorPermissions, JCheckBox> checkboxMap = new TreeMap<>(); ++ private final List<JCheckBoxWithGroup> groupBoxList = new ArrayList<>(Group.values().length); + private final JScrollPane scrollPane = new JScrollPane(); +- private final DefaultListModel listModel = new DefaultListModel(); +- private final JList list = new JList(listModel); ++ private final DefaultListModel<String> listModel = new DefaultListModel<>(); ++ private final JList<String> list = new JList<>(listModel); + private final JButton okButton = new JButton(), closeButton = new JButton(), + addCodebaseButton = new JButton(), removeCodebaseButton = new JButton(); + private final JFileChooser fileChooser; + private CustomPolicyViewer cpViewer = null; +- private final WeakReference<PolicyEditor> weakThis = new WeakReference<PolicyEditor>(this); ++ private final WeakReference<PolicyEditor> weakThis = new WeakReference<>(this); + private MD5SumWatcher fileWatcher; + + private final ActionListener okButtonAction, addCodebaseButtonAction, +@@ -196,13 +196,13 @@ + return group; + } + +- private void setState(Map<PolicyEditorPermissions, Boolean> map) { +- List<ActionListener> backup = new LinkedList<ActionListener>(); ++ private void setState(final Map<PolicyEditorPermissions, Boolean> map) { ++ final List<ActionListener> backup = new LinkedList<>(); + for (final ActionListener l : this.getActionListeners()) { + backup.add(l); + this.removeActionListener(l); + } +- int i = group.getState(map); ++ final int i = group.getState(map); + this.setBackground(getParent().getBackground()); + if (i > 0) { + this.setSelected(true); +@@ -215,7 +215,7 @@ + this.setSelected(false); + } + +- for (ActionListener al : backup) { ++ for (final ActionListener al : backup) { + this.addActionListener(al); + } + } +@@ -273,7 +273,7 @@ + removeCodebaseButtonAction = new ActionListener() { + @Override + public void actionPerformed(final ActionEvent e) { +- removeCodebase((String) list.getSelectedValue()); ++ removeCodebase(getSelectedCodebase()); + } + }; + removeCodebaseButton.setText(R("PERemoveCodebase")); +@@ -324,7 +324,7 @@ + @Override + public void run() { + String codebase = getSelectedCodebase(); +- if (codebase == null){ ++ if (codebase == null) { + return; + } + if (cpViewer == null) { +@@ -343,9 +343,9 @@ + + setupLayout(); + } +- ++ + private String getSelectedCodebase() { +- String codebase = (String) list.getSelectedValue(); ++ final String codebase = list.getSelectedValue(); + if (codebase == null || codebase.isEmpty()) { + return null; + } +@@ -355,7 +355,7 @@ + return codebase; + } + +- private static void preparePolicyEditorWindow(final PolicyEditorWindow w, PolicyEditor e) { ++ private static void preparePolicyEditorWindow(final PolicyEditorWindow w, final PolicyEditor e) { + w.setModalityType(ModalityType.MODELESS); //at least some default + w.setPolicyEditor(e); + w.setTitle(R("PETitle")); +@@ -386,7 +386,6 @@ + editor.closeButton.setText(R("ButClose")); + editor.closeButton.addActionListener(editor.closeButtonAction); + +- + final Action saveAct = new AbstractAction() { + @Override + public void actionPerformed(final ActionEvent e) { +@@ -437,7 +436,7 @@ + + private PolicyEditorFrame(final PolicyEditor editor) { + super(); +- preparePolicyEditorWindow((PolicyEditorWindow)this, editor); ++ preparePolicyEditorWindow((PolicyEditorWindow) this, editor); + } + + @Override +@@ -451,17 +450,17 @@ + } + + @Override +- public final void setPolicyEditor(PolicyEditor e) { ++ public final void setPolicyEditor(final PolicyEditor e) { + editor = e; + } + + @Override +- public final void setDefaultCloseOperation(int operation) { ++ public final void setDefaultCloseOperation(final int operation) { + super.setDefaultCloseOperation(operation); + } + + @Override +- public final void setJMenuBar(JMenuBar menu) { ++ public final void setJMenuBar(final JMenuBar menu) { + super.setJMenuBar(menu); + } + +@@ -471,7 +470,7 @@ + } + + @Override +- public void setModalityType(ModalityType type) { ++ public void setModalityType(final ModalityType type) { + //no op for frame + } + +@@ -502,11 +501,11 @@ + + private PolicyEditorDialog(final PolicyEditor editor) { + super(); +- preparePolicyEditorWindow((PolicyEditorWindow)this, editor); ++ preparePolicyEditorWindow((PolicyEditorWindow) this, editor); + } + + @Override +- public final void setTitle(String title) { ++ public final void setTitle(final String title) { + super.setTitle(title); + } + +@@ -516,17 +515,17 @@ + } + + @Override +- public final void setPolicyEditor(PolicyEditor e) { ++ public final void setPolicyEditor(final PolicyEditor e) { + editor = e; + } + + @Override +- public final void setDefaultCloseOperation(int operation) { ++ public final void setDefaultCloseOperation(final int operation) { + super.setDefaultCloseOperation(operation); + } + + @Override +- public final void setJMenuBar(JMenuBar menu) { ++ public final void setJMenuBar(final JMenuBar menu) { + super.setJMenuBar(menu); + } + +@@ -536,7 +535,7 @@ + } + + @Override +- public void setModalityType(ModalityType type) { ++ public void setModalityType(final ModalityType type) { + super.setModalityType(type); + } + +@@ -641,7 +640,7 @@ + final Action act = new AbstractAction() { + @Override + public void actionPerformed(final ActionEvent e) { +- removeCodebase((String) list.getSelectedValue()); ++ removeCodebase(getSelectedCodebase()); + } + }; + setAccelerator(R("PERemoveCodebaseMnemonic"), ActionEvent.ALT_MASK, act, "RemoveCodebaseAccelerator"); +@@ -726,6 +725,7 @@ + stopAsking = true; + } + } catch (final MalformedURLException mfue) { ++ // ignore - loop/ask again + } + } + addNewCodebase(codebase); +@@ -773,7 +773,7 @@ + if (permissions != null) { + return new HashMap<PolicyEditorPermissions, Boolean>(permissions); + } else { +- final Map<PolicyEditorPermissions, Boolean> blank = new HashMap<PolicyEditorPermissions, Boolean>(); ++ final Map<PolicyEditorPermissions, Boolean> blank = new HashMap<>(); + for (final PolicyEditorPermissions perm : PolicyEditorPermissions.values()) { + blank.put(perm, false); + } +@@ -800,10 +800,10 @@ + */ + private void updateCheckboxes(final String codebase) { + try { +- if (SwingUtilities.isEventDispatchThread()){ +- updateCheckboxesImpl(codebase); ++ if (SwingUtilities.isEventDispatchThread()) { ++ updateCheckboxesImpl(codebase); + } else { +- updateCheckboxesInvokeAndWait(codebase); ++ updateCheckboxesInvokeAndWait(codebase); + } + } catch (InterruptedException ex) { + OutputController.getLogger().log(ex); +@@ -811,52 +811,52 @@ + OutputController.getLogger().log(ex); + } + } +- ++ + private void updateCheckboxesInvokeAndWait(final String codebase) throws InterruptedException, InvocationTargetException { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { +- updateCheckboxesImpl(codebase); ++ updateCheckboxesImpl(codebase); + } + }); + + } +- +- private void updateCheckboxesImpl(String codebase) { +- for (final PolicyEditorPermissions perm : PolicyEditorPermissions.values()) { +- final JCheckBox box = checkboxMap.get(perm); +- for (final ActionListener l : box.getActionListeners()) { +- box.removeActionListener(l); +- } +- initializeMapForCodebase(codebase); +- final Map<PolicyEditorPermissions, Boolean> map = codebasePermissionsMap.get(codebase); +- final boolean state; +- if (map != null) { +- final Boolean s = map.get(perm); +- if (s != null) { +- state = s; +- } else { +- state = false; +- } +- } else { +- state = false; +- } ++ ++ private void updateCheckboxesImpl(final String codebase) { ++ for (final PolicyEditorPermissions perm : PolicyEditorPermissions.values()) { ++ final JCheckBox box = checkboxMap.get(perm); ++ for (final ActionListener l : box.getActionListeners()) { ++ box.removeActionListener(l); ++ } ++ initializeMapForCodebase(codebase); ++ final Map<PolicyEditorPermissions, Boolean> map = codebasePermissionsMap.get(codebase); ++ final boolean state; ++ if (map != null) { ++ final Boolean s = map.get(perm); ++ if (s != null) { ++ state = s; ++ } else { ++ state = false; ++ } ++ } else { ++ state = false; ++ } ++ for (final JCheckBoxWithGroup jg : groupBoxList) { ++ jg.setState(map); ++ } ++ box.setSelected(state); ++ box.addActionListener(new ActionListener() { ++ @Override ++ public void actionPerformed(final ActionEvent e) { ++ changesMade = true; ++ map.put(perm, box.isSelected()); + for (JCheckBoxWithGroup jg : groupBoxList) { + jg.setState(map); + } +- box.setSelected(state); +- box.addActionListener(new ActionListener() { +- @Override +- public void actionPerformed(final ActionEvent e) { +- changesMade = true; +- map.put(perm, box.isSelected()); +- for (JCheckBoxWithGroup jg : groupBoxList) { +- jg.setState(map); +- } +- } +- }); + } +- } ++ }); ++ } ++ } + + /** + * Set a mnemonic key for a menu item or button +@@ -947,8 +947,8 @@ + checkboxConstraints.gridy = 1; + + for (final JCheckBox box : checkboxMap.values()) { +- if (PolicyEditorPermissions.Group.anyContains(box, checkboxMap)){ +- //do not show boxes in any group ++ if (PolicyEditorPermissions.Group.anyContains(box, checkboxMap)) { ++ //do not show boxes in any group + continue; + } + add(box, checkboxConstraints); +@@ -960,7 +960,7 @@ + } + } + //add groups +- for (PolicyEditorPermissions.Group g : PolicyEditorPermissions.Group.values()) { ++ for (final PolicyEditorPermissions.Group g : PolicyEditorPermissions.Group.values()) { + //no metter what, put group title on new line + checkboxConstraints.gridy++; + //all groups are in second column +@@ -977,14 +977,14 @@ + groupPanel.setVisible(!groupPanel.isVisible()); + PolicyEditor.this.validate(); + Container c = PolicyEditor.this.getParent(); +- //find the window and repack it ++ // find the window and repack it + while (!(c instanceof Window)) { + if (c == null) { + return; + } + c = c.getParent(); + } +- Window w = (Window) c; ++ final Window w = (Window) c; + w.pack(); + + } +@@ -993,34 +993,34 @@ + groupCh.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { +- String codebase = getSelectedCodebase(); ++ final String codebase = getSelectedCodebase(); + if (codebase == null) { + return; + } +- List<ActionListener> backup = new LinkedList<ActionListener>(); ++ List<ActionListener> backup = new LinkedList<>(); + for (final ActionListener l : groupCh.getActionListeners()) { + backup.add(l); + groupCh.removeActionListener(l); + } + final Map<PolicyEditorPermissions, Boolean> map = codebasePermissionsMap.get(codebase); +- for (PolicyEditorPermissions p : groupCh.getGroup().getPermissions()) { ++ for (final PolicyEditorPermissions p : groupCh.getGroup().getPermissions()) { + map.put(p, groupCh.isSelected()); + } + changesMade = true; + updateCheckboxes(codebase); +- for (ActionListener al : backup) { ++ for (final ActionListener al : backup) { + groupCh.addActionListener(al); + } + + } + }); + add(groupCh, checkboxConstraints); +- //place panel with mebers below the title ++ // place panel with members below the title + checkboxConstraints.gridy++; + checkboxConstraints.gridx = 2; +- //spread group's panel over two columns ++ // spread group's panel over two columns + checkboxConstraints.gridwidth = 2; +- checkboxConstraints.fill = checkboxConstraints.BOTH; ++ checkboxConstraints.fill = GridBagConstraints.BOTH; + add(groupPanel, checkboxConstraints); + final GridBagConstraints groupCheckboxLabelConstraints = new GridBagConstraints(); + groupCheckboxLabelConstraints.anchor = GridBagConstraints.LINE_START; +@@ -1028,7 +1028,7 @@ + groupCheckboxLabelConstraints.weighty = 0; + groupCheckboxLabelConstraints.gridx = 1; + groupCheckboxLabelConstraints.gridy = 1; +- for (PolicyEditorPermissions p : g.getPermissions()) { ++ for (final PolicyEditorPermissions p : g.getPermissions()) { + groupPanel.add(checkboxMap.get(p), groupCheckboxLabelConstraints); + // Two columns of checkboxes + groupCheckboxLabelConstraints.gridx++; +@@ -1042,7 +1042,6 @@ + checkboxConstraints.gridwidth = 1; + } + +- + final JLabel codebaseListLabel = new JLabel(R("PECodebaseLabel")); + codebaseListLabel.setBorder(new EmptyBorder(2, 2, 2, 2)); + final GridBagConstraints listLabelConstraints = new GridBagConstraints(); +@@ -1152,7 +1151,7 @@ + // If this fails we'll end up handling it a few lines down anyway. + } + } +- OpenFileResult ofr = FileUtils.testFilePermissions(file); ++ final OpenFileResult ofr = FileUtils.testFilePermissions(file); + if (ofr == OpenFileResult.FAILURE || ofr == OpenFileResult.NOT_FILE) { + FileUtils.showCouldNotOpenFilepathDialog(weakThis.get(), file.getPath()); + return; +@@ -1258,7 +1257,7 @@ + } + + if (codebasePermissionsMap.get(codebase) == null) { +- final Map<PolicyEditorPermissions, Boolean> map = new HashMap<PolicyEditorPermissions, Boolean>(); ++ final Map<PolicyEditorPermissions, Boolean> map = new HashMap<>(); + for (final PolicyEditorPermissions perm : PolicyEditorPermissions.values()) { + map.put(perm, false); + } +@@ -1266,7 +1265,7 @@ + } + + if (customPermissionsMap.get(codebase) == null) { +- final Set<CustomPermission> set = new HashSet<CustomPermission>(); ++ final Set<CustomPermission> set = new HashSet<>(); + customPermissionsMap.put(codebase, set); + } + +@@ -1307,8 +1306,10 @@ + } + final StringBuilder sb = new StringBuilder(); + sb.append(AUTOGENERATED_NOTICE); +- sb.append("\n/* Generated by PolicyEditor at ").append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") +- .format(Calendar.getInstance().getTime())).append(" */").append(System.getProperty("line.separator")); ++ sb.append("\n/* Generated by PolicyEditor at ") ++ .append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime())) ++ .append(" */") ++ .append(System.getProperty("line.separator")); + final Set<PolicyEditorPermissions> enabledPermissions = new HashSet<PolicyEditorPermissions>(); + FileLock fileLock; + try { +@@ -1456,7 +1457,7 @@ + */ + static Map<String, String> argsToMap(final String[] args) { + final List<String> argsList = Arrays.<String> asList(args); +- final Map<String, String> map = new HashMap<String, String>(); ++ final Map<String, String> map = new HashMap<>(); + + if (argsList.contains(HELP_FLAG)) { + map.put(HELP_FLAG, null); +--- netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditorPermissions.java 2014-04-02 06:20:59.679124000 -0400 ++++ netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditorPermissions.java 2014-05-15 16:57:20.000000000 -0400 +@@ -123,13 +123,14 @@ + + private final PolicyEditorPermissions[] permissions; + private final String title; +- private Group(String title, PolicyEditorPermissions... permissions) { ++ ++ private Group(final String title, final PolicyEditorPermissions... permissions) { + this.title = title; + this.permissions = permissions; + + } + +- public static boolean anyContains(PolicyEditorPermissions permission) { ++ public static boolean anyContains(final PolicyEditorPermissions permission) { + for (Group g : Group.values()) { + if (g.contains(permission)) { + return true; +@@ -138,10 +139,10 @@ + return false; + } + +- public static boolean anyContains(JCheckBox view, Map<PolicyEditorPermissions, JCheckBox> checkboxMap) { +- for (Map.Entry<PolicyEditorPermissions, JCheckBox> pairs : checkboxMap.entrySet()){ ++ public static boolean anyContains(final JCheckBox view, final Map<PolicyEditorPermissions, JCheckBox> checkboxMap) { ++ for (final Map.Entry<PolicyEditorPermissions, JCheckBox> pairs : checkboxMap.entrySet()) { + if (pairs.getValue() == view) { +- for (Group g : Group.values()) { ++ for (final Group g : Group.values()) { + if (g.contains(pairs.getKey())) { + return true; + } +@@ -157,10 +158,10 @@ + * - none is selected + */ + public int getState (final Map<PolicyEditorPermissions, Boolean> map) { +- boolean allTrue=true; +- boolean allFalse=true; +- for (PolicyEditorPermissions pp: getPermissions()){ +- Boolean b = map.get(pp); ++ boolean allTrue = true; ++ boolean allFalse = true; ++ for (final PolicyEditorPermissions pp : getPermissions()) { ++ final Boolean b = map.get(pp); + if (b == null){ + return 0; + } +@@ -170,23 +171,22 @@ + allTrue = false; + } + } +- if (allFalse){ ++ if (allFalse) { + return -1; + } +- if (allTrue){ ++ if (allTrue) { + return 1; + } + return 0; + } + +- public boolean contains(PolicyEditorPermissions permission) { +- for (PolicyEditorPermissions policyEditorPermissions : permissions) { ++ public boolean contains(final PolicyEditorPermissions permission) { ++ for (final PolicyEditorPermissions policyEditorPermissions : permissions) { + if (policyEditorPermissions == permission) { + return true; + } + } + return false; +- + } + + public String getTitle() { +@@ -199,7 +199,7 @@ + + } + +- ++ + private final String name, description; + private final PermissionType type; + private final PermissionTarget target; +--- netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java 2014-04-02 06:20:59.679124000 -0400 ++++ netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java 2014-05-15 16:57:20.000000000 -0400 +@@ -51,8 +51,8 @@ + public class PolicyEntry { + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405160001.s4G012NC083109>