From 7c8e8699ef103ed5f0c0e079772cff7ffeb2a336 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Fri, 28 Jan 2022 11:25:07 -0700 Subject: [PATCH 01/10] intermediate commit so I can catch up to unstable --- swing/src/net/sf/openrocket/gui/dialogs/AboutDialog.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/dialogs/AboutDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/AboutDialog.java index e62419684..8fcdd4767 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/AboutDialog.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/AboutDialog.java @@ -60,7 +60,10 @@ public class AboutDialog extends JDialog { "JOGL (http://jogamp.org/jogl/www/)
" + "Guava (https://github.com/google/guava)
" + "Opencsv (http://opencsv.sourceforge.net/)
" + - "Simple Logging Facade for Java (http://www.slf4j.org/)"; + "Simple Logging Facade for Java (http://www.slf4j.org/)

" + + "OpenRocket gratefully acknowledges our use of the following databases:

" + + "Rocket Motor Data (https://www.thrustcurve.org/)
" + + "Enhanced components database for OpenRocket (https://github.com/dbcook/openrocket-database/"; public AboutDialog(JFrame parent) { super(parent, true); From 4734ea5e85e5c317fc79c44dd7e0027910546c12 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Fri, 4 Feb 2022 10:14:09 -0700 Subject: [PATCH 02/10] Modify DescriptionArea to make hyperlinks live. Hyperlinks other than jar resources just get sent off to the browser; jar resources get extracted into temporary files, and those files' URLs get sent off to the browser. I don't really like the handling of exceptions here, but I don't see a better way around it. Trying to just declare hyperlinkUpdate() as throwing exceptions fails because I'm overriding an abstract method that doesn't throw exceptions. So, I need to throw a runtime exception when an exception happens; the stack trace in the bug report shows that as the location of the exception so I didn't want to just wrap all the code in the method in one big try/catch as that reduces the information about where things broke. So, bunch of try/catch blocks around related operations. --- .../gui/components/DescriptionArea.java | 80 ++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java b/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java index 2c68b129c..324c186f2 100644 --- a/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java +++ b/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java @@ -1,16 +1,30 @@ package net.sf.openrocket.gui.components; import java.awt.Color; +import java.awt.Desktop; import java.awt.Dimension; import java.awt.Font; import java.awt.Rectangle; +import java.net.URI; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; import javax.swing.JEditorPane; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; import javax.swing.SwingUtilities; +import net.sf.openrocket.util.BugException; + @SuppressWarnings("serial") public class DescriptionArea extends JScrollPane { @@ -65,7 +79,71 @@ public class DescriptionArea extends JScrollPane { Font font = editorPane.getFont(); editorPane.setFont(font.deriveFont(font.getSize2D() + size)); editorPane.setEditable(false); - + editorPane.addHyperlinkListener(new HyperlinkListener() { + public void hyperlinkUpdate(HyperlinkEvent e) { + if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + URI uri = null; + try { + uri = e.getURL().toURI(); + } + catch (Exception ex) { + throw new RuntimeException(ex); + } + + // If the uri scheme indicates this is a resource in a jar file, + // extract and write to a temporary file + if (uri.getScheme().equals("jar")) { + + // get the resource + String uriString = uri.toString(); + String resourceName = uriString.substring(uriString.indexOf("!") + 1); + final BufferedInputStream is = new BufferedInputStream(getClass().getResourceAsStream(resourceName)); + + // construct filename from resource name + String prefix = resourceName.substring(1); + String suffix = null; + final int dotIndex = prefix.lastIndexOf("."); + if (dotIndex > 0) { + prefix = resourceName.substring(0, dotIndex); + suffix = resourceName.substring(dotIndex+1); + } + + // create temporary file and copy resource to it + File of = null; + BufferedOutputStream os = null; + try { + of = File.createTempFile(prefix, suffix); + os = new BufferedOutputStream(new FileOutputStream(of)); + } + catch (Exception ex) { + throw new RuntimeException(ex); + } + of.deleteOnExit(); + uri = of.toURI(); + + try { + int avail = is.available(); + while (avail > 0) { + byte buffer[] = new byte[avail]; + int bytesread = is.read(buffer, 0, avail); + os.write(buffer, 0, bytesread); + avail = is.available(); + } + } + catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + try { + Desktop.getDesktop().browse(uri); + } + catch (Exception ex) { + throw new RuntimeException(ex); + } + } + } + }); if (!opaque) { Color bg = new JPanel().getBackground(); editorPane.setBackground(new Color(bg.getRed(), bg.getGreen(), bg.getBlue())); From 1ae6a845d5d93bcfb2747b5e419d057d6e1c0ae3 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Fri, 4 Feb 2022 10:50:49 -0700 Subject: [PATCH 03/10] Add CommonMark library, and components and thrustcurve databases, to About dialog Convert all URLs in About dialog to hyperlinks --- .../openrocket/gui/dialogs/AboutDialog.java | 89 +++++++++++-------- 1 file changed, 51 insertions(+), 38 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/dialogs/AboutDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/AboutDialog.java index 8fcdd4767..eec03049b 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/AboutDialog.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/AboutDialog.java @@ -25,45 +25,58 @@ import net.sf.openrocket.gui.widgets.SelectColorButton; @SuppressWarnings("serial") public class AboutDialog extends JDialog { - public static final String OPENROCKET_URL = "http://openrocket.info/"; - private static final Translator trans = Application.getTranslator(); + public final String OPENROCKET_URL = "http://openrocket.info/"; + + private final Translator trans = Application.getTranslator(); - private static final String CREDITS = "
" + - "OpenRocket has been developed by:

" + - "Sampo Niskanen (main developer)
" + - "Doug Pedrick (RockSim file format, printing)
" + - "Kevin Ruland (Android version)
" + - "Bill Kuker (3D visualization)
" + - "Boris du Reau (internationalization, translation lead)
" + - "Richard Graham (geodetic computations)
" + - "Jason Blood (finset import)
" + - "Daniel Williams (pod support, maintainer)
" + - "Joe Pfeiffer (maintainer)
" + - "Billy Olsen (maintainer)
" + - "Neil Weinstock (tester, icons, forum support)
" + - "H. Craig Miller (tester)

" + - "Translations by:

" + - "Tripoli France (French)
" + - "Stefan Lobas / ERIG e.V. (German)
" + - "Tripoli Spain (Spanish)
" + - "Sky Dart Team (Russian)
" + - "Mauro Biasutti (Italian)
" + - "Vladimir Beran (Czech)
" + - "Polish Rocketry Society / \u0141ukasz & Alex Kazanski (Polish)
" + - "Sibo Van Gool (Dutch)

" + - "See all contributors at
https://github.com/openrocket/openrocket/graphs/contributors

" + - "OpenRocket utilizes the following libraries:

" + - "MiG Layout (http://www.miglayout.com/)
" + - "JFreeChart (http://www.jfree.org/jfreechart/)
" + - "iText (http://www.itextpdf.com/)
" + - "exp4j (http://projects.congrace.de/exp4j/index.html)
" + - "JOGL (http://jogamp.org/jogl/www/)
" + - "Guava (https://github.com/google/guava)
" + - "Opencsv (http://opencsv.sourceforge.net/)
" + - "Simple Logging Facade for Java (http://www.slf4j.org/)

" + - "OpenRocket gratefully acknowledges our use of the following databases:

" + - "Rocket Motor Data (https://www.thrustcurve.org/)
" + - "Enhanced components database for OpenRocket (https://github.com/dbcook/openrocket-database/"; + private final String CREDITS = "
" + + "OpenRocket has been developed by:
" + + "
" + + "Sampo Niskanen (main developer)
" + + "Doug Pedrick (RockSim file format, printing)
" + + "Kevin Ruland (Android version)
" + + "Bill Kuker (3D visualization)
" + + "Boris du Reau (internationalization, translation lead)
" + + "Richard Graham (geodetic computations)
" + + "Jason Blood (finset import)
" + + "Daniel Williams (pod support, maintainer)
" + + "Joe Pfeiffer (maintainer)
" + + "Billy Olsen (maintainer)
" + + "Neil Weinstock (tester, icons, forum support)
" + + "H. Craig Miller (tester)

" + + "Translations by:

" + + "Tripoli France (French)
" + + "Stefan Lobas / ERIG e.V. (German)
" + + "Tripoli Spain (Spanish)
" + + "Sky Dart Team (Russian)
" + + "Mauro Biasutti (Italian)
" + + "Vladimir Beran (Czech)
" + + "Polish Rocketry Society / \u0141ukasz & Alex Kazanski (Polish)
" + + "Sibo Van Gool (Dutch)
" + + "
" + + "See all contributors at
" + + href("https://github.com/openrocket/openrocket/graphs/contributors") + "
" + + "
" + + "OpenRocket utilizes the following libraries:
" + + "
" + + "MiG Layout (" + href("http://www.miglayout.com/") + ")
" + + "JFreeChart (" + href("http://www.jfree.org/jfreechart/") + ")
" + + "iText (" + href("http://www.itextpdf.com/") + ")
" + + "exp4j (" + href("http://projects.congrace.de/exp4j/index.html") + ")
" + + "JOGL (" + href("http://jogamp.org/jogl/www/") + ")
" + + "Guava (" + href("https://github.com/google/guava") + ")
" + + "Opencsv (" + href("http://opencsv.sourceforge.net/") + ")
" + + "Simple Logging Facade for Java (" + href("http://www.slf4j.org/") + ")
" + + "Java library for parsing and rendering CommonMark (" + href("https://github.com/commonmark/commonmark-java") + ")
" + + "
" + + "OpenRocket gratefully acknowledges our use of the following databases:
" + + "
" + + "Rocket Motor Data (" + href("https://www.thrustcurve.org/") + ")
" + + "Enhanced components database for OpenRocket" + href("https://github.com/dbcook/openrocket-database/") + ")
"; + + private String href(String url) { + return "" + url + ""; + } public AboutDialog(JFrame parent) { super(parent, true); From 326399fe85b38b511e978182fd22a3105b0fd9c1 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Fri, 4 Feb 2022 15:19:51 -0700 Subject: [PATCH 04/10] Copy LICENSE from new database into presets directory when building --- swing/build.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/swing/build.xml b/swing/build.xml index c6a0678b1..18fd76bc3 100644 --- a/swing/build.xml +++ b/swing/build.xml @@ -200,6 +200,10 @@ the .jar file + + From e442d4605e93923cb9858c0fa2d3e96d69a06802 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Mon, 7 Feb 2022 15:03:37 -0700 Subject: [PATCH 05/10] Update license dialog Quit quoting entire GPL in dialog; insert hrefs pointing to it. Add other licenses: Apache license, for Dave's components library DejaVu font license. I wasn't able to find an "authoritative" source for this license to point people at. BSD 2-Clause license for commonmark-java library. This license is so short I left it in the dialog. To my surprise, I also didn't find an "authoritative" source for this license to point people at --- .../gui/components/DescriptionArea.java | 14 +- .../openrocket/gui/dialogs/LicenseDialog.java | 172 ++++++++++++++---- 2 files changed, 144 insertions(+), 42 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java b/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java index 324c186f2..6c17891ed 100644 --- a/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java +++ b/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java @@ -107,7 +107,8 @@ public class DescriptionArea extends JScrollPane { prefix = resourceName.substring(0, dotIndex); suffix = resourceName.substring(dotIndex+1); } - + + // create temporary file and copy resource to it File of = null; BufferedOutputStream os = null; @@ -122,13 +123,9 @@ public class DescriptionArea extends JScrollPane { uri = of.toURI(); try { - int avail = is.available(); - while (avail > 0) { - byte buffer[] = new byte[avail]; - int bytesread = is.read(buffer, 0, avail); - os.write(buffer, 0, bytesread); - avail = is.available(); - } + byte buffer[] = is.readAllBytes(); + os.write(buffer); + os.close(); } catch (Exception ex) { throw new RuntimeException(ex); @@ -162,7 +159,6 @@ public class DescriptionArea extends JScrollPane { Dimension dim = editorPane.getPreferredSize(); dim.height = lineheight * rows + extraheight + 2; - this.setPreferredSize(dim); this.setViewportView(editorPane); this.setText(text); diff --git a/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java index 7ac41ce05..535bab300 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java @@ -3,66 +3,172 @@ package net.sf.openrocket.gui.dialogs; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.net.URL; import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; +import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import net.miginfocom.swing.MigLayout; +import net.sf.openrocket.gui.components.DescriptionArea; import net.sf.openrocket.gui.components.StyledLabel; import net.sf.openrocket.gui.util.GUIUtil; import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.startup.Application; +import net.sf.openrocket.gui.util.Icons; import net.sf.openrocket.gui.widgets.SelectColorButton; +import net.sf.openrocket.util.BuildProperties; +import net.sf.openrocket.util.Chars; public class LicenseDialog extends JDialog { - private static final String LICENSE_FILENAME = "LICENSE.TXT"; private static final Translator trans = Application.getTranslator(); - private static final String DEFAULT_LICENSE_TEXT = - "\n" + - "Error: Unable to load " + LICENSE_FILENAME + "!\n" + - "\n" + - "OpenRocket is licensed under the GNU GPL version 3, with additional permissions.\n" + - "See http://openrocket.sourceforge.net/ for details."; - public LicenseDialog(JFrame parent) { super(parent, true); JPanel panel = new JPanel(new MigLayout("fill")); - panel.add(new StyledLabel("OpenRocket license", 10), "ax 50%, wrap para"); - - String licenseText; - try { - - BufferedReader reader = new BufferedReader( - new InputStreamReader(ClassLoader.getSystemResourceAsStream(LICENSE_FILENAME))); - StringBuffer sb = new StringBuffer(); - for (String s = reader.readLine(); s != null; s = reader.readLine()) { - sb.append(s); - sb.append('\n'); - } - licenseText = sb.toString(); - - } catch (IOException e) { - - licenseText = DEFAULT_LICENSE_TEXT; - - } + // OpenRocket logo + panel.add(new JLabel(Icons.loadImageIcon("pix/icon/icon-about.png", "OpenRocket")), "top"); - JTextArea text = new JTextArea(licenseText); - text.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); - text.setRows(20); - text.setColumns(80); - text.setEditable(false); - panel.add(new JScrollPane(text),"grow, wrap para"); + panel.add(new StyledLabel("Software Licenses", 10), "ax 50%, wrap para"); + + final String jarUrl = "jar:" + getClass().getProtectionDomain().getCodeSource().getLocation().toString(); + final String copyrightYear = BuildProperties.getCopyrightYear(); + + /*****************************************************************************************************************************/ + /* */ + /* LICENSE TEXT: each of the licenses we're using is described here. At the end, they are all concatenated for insertion */ + /* in the description window */ + /* */ + /*****************************************************************************************************************************/ + + /*****************************************************************************************************************************/ + /* GPL: overall project */ + /*****************************************************************************************************************************/ + final String gplInternalHref = "here"; + final String orLicense = "GNU GENERAL PUBLIC LICENSE" + "
" + + "
" + + "OpenRocket - A model rocket simulator
" + + "Copyright " + Chars.COPY + " 2007-" + copyrightYear + "Sampo Niskanen and others
" + + "Project page: https://openrocket.info/
" + + "
" + + "This program 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, either " + + "version 3 of the License, or any later version.
" + + "
" + + "This program 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 " + gplInternalHref + " for more details.
" + + "
" + + "A copy of the GNU General Public License may be viewed " + gplInternalHref + ". " + + "You may also obtain a copy of the License at:
" + + "
" + + "https://www.gnu.org/licenses/gpl-3.0.html
" + + "
" + + "OpenRocket developers may be contacted electronically at:
" + + "
" + + "mailto:openrocket-devel@lists.sourceforge.net
" + + "https://github.com/openrocket
" + + "
"; + + /*****************************************************************************************************************************/ + /* APACHE: components library */ + /*****************************************************************************************************************************/ + final String apacheInternalHref = "here"; + final String componentsLicense = + "APACHE LICENSE
" + + "
" + + "Enhanced components database for OpenRocket
" + + "Copyright " + Chars.COPY + " 2015-" + copyrightYear + " David B. Cook
" + + "Project page: https://github.com/dbcook/openrocket-database
" + + "
" + + "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this work except in compliance with the License. " + + " A copy of the Apache License may be viewed " + apacheInternalHref + ". You may also obtain a copy of the License at:
" + + "
" + + "http://www.apache.org/licenses/LICENSE-2.0

" + + + "Unless required by applicable law or agreed to in writing, software distributed under the License is distributed " + + "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License " + + apacheInternalHref + " for the specific language governing permissions and limitations under the License.
" + + "
"; + + + /*****************************************************************************************************************************/ + /* BITSTREAM VERA: Deja Vu font */ + /*****************************************************************************************************************************/ + final String dejaLicenseUrl = jarUrl + "!/dejavu-font/LICENSE"; + final String fontLicense = + "Bitstream Vera Font License
" + + "
" + + "DejaVu Serif Font
" + + "Fonts are Copyright " + Chars.COPY + " 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.
" + + "DejaVu changes are in the public domain
" + + "Glyphs imported from Arev Fonts Copyright " + Chars.COPY + " 2006 by Tavmjong Bah. All Rights Reserved.
" + + "
" + + "Licensed according to the Bitstream Vera Font License which may be found here." + + "
" + + "THE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS " + + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY " + + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, " + + "TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME " + + "FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING " + + "ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, " + + "WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF " + + "THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE " + + "FONT SOFTWARE.
" + + "
" + + "See the License for the specific language" + + "governing permissions and limitations under the License.
" + + "
"; + + + /*****************************************************************************************************************************/ + /* BSD 2-Clause: commonmark-java library */ + /*****************************************************************************************************************************/ + final String commonmarkLicense = + "BSD 2-Clause License
" + + "
" + + "Commonmark-Java Library
" + + "Copyright " + Chars.COPY + " 2015-2016 Atlassian Pty Ltd
" + + "All rights reserved.
" + + "
" + + "Redistribution and use in source and binary forms, with or without" + + "modification, are permitted provided that the following conditions are met:
" + + "
    " + + "
  • Redistributions of source code must retain the above copyright notice, this " + + "list of conditions and the following disclaimer.
  • " + + "
  • Redistributions in binary form must reproduce the above copyright notice, " + + "this list of conditions and the following disclaimer in the documentation " + + "and/or other materials provided with the distribution.
" + + "
" + + "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" " + + "AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED " + + "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. " + + "IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, " + + "INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, " + + "BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, " + + "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF " + + "LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE " + + "OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED " + + "OF THE POSSIBILITY OF SUCH DAMAGE.
" + + "
"; + + /*****************************************************************************************************************************/ + /* End of license text */ + /*****************************************************************************************************************************/ + + DescriptionArea info = new DescriptionArea(20); + info.setText(orLicense + componentsLicense + fontLicense + commonmarkLicense); + panel.add(info, "newline, width 600lp, height 150lp, grow, spanx, wrap para"); //Close button JButton close = new SelectColorButton(trans.get("dlg.but.close")); From d3f1144ef18f95f9f03d1daf32eba17251760e03 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Mon, 7 Feb 2022 15:18:32 -0700 Subject: [PATCH 06/10] update copyright year --- core/LICENSE.TXT | 2 +- core/resources/build.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/LICENSE.TXT b/core/LICENSE.TXT index a06056587..05af4172b 100644 --- a/core/LICENSE.TXT +++ b/core/LICENSE.TXT @@ -1,6 +1,6 @@ OpenRocket - A model rocket simulator -Copyright (C) 2007-2020 Sampo Niskanen and others +Copyright (C) 2007-2022 Sampo Niskanen and others This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/core/resources/build.properties b/core/resources/build.properties index 98a12aa25..46fea8eae 100644 --- a/core/resources/build.properties +++ b/core/resources/build.properties @@ -4,7 +4,7 @@ build.version=20.11.alpha.16 # The copyright year for the build. Displayed in the about dialog. # Will show as Copyright 2013-${build.copyright} -build.copyright=2021 +build.copyright=2022 # The source of the package. When building a package for a specific # distribution (Debian, Fedora etc.), this should be changed appropriately! From 78a66c24e88bb2e96ffb1211d02466c33b32e44b Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Mon, 7 Feb 2022 19:14:19 -0700 Subject: [PATCH 07/10] Revised license text in accordance with more licenses found by H. Craig Miller --- .../openrocket/gui/dialogs/LicenseDialog.java | 91 ++++++++----------- 1 file changed, 36 insertions(+), 55 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java index 535bab300..5ce88cc1b 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java @@ -54,23 +54,23 @@ public class LicenseDialog extends JDialog { /*****************************************************************************************************************************/ /* GPL: overall project */ /*****************************************************************************************************************************/ - final String gplInternalHref = "here"; final String orLicense = "GNU GENERAL PUBLIC LICENSE" + "
" + "
" + "OpenRocket - A model rocket simulator
" + "Copyright " + Chars.COPY + " 2007-" + copyrightYear + "Sampo Niskanen and others
" + "Project page: https://openrocket.info/
" + "
" + - "This program 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, either " + - "version 3 of the License, or any later version.
" + - "
" + + "This program 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, either version 3 " + + "of the License, or any later version.
" + + "The license may be viewed " + + "here.
" + + "
" + "This program 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 " + gplInternalHref + " for more details.
" + - "
" + - "A copy of the GNU General Public License may be viewed " + gplInternalHref + ". " + - "You may also obtain a copy of the License at:
" + + "See the GNU General Public License for more details.
" + + "
" + + "You should have received a copy of the GNU Public License along with this program. If not, see
" + "
" + "https://www.gnu.org/licenses/gpl-3.0.html
" + "
" + @@ -83,83 +83,64 @@ public class LicenseDialog extends JDialog { /*****************************************************************************************************************************/ /* APACHE: components library */ /*****************************************************************************************************************************/ - final String apacheInternalHref = "here"; final String componentsLicense = "APACHE LICENSE
" + "
" + - "Enhanced components database for OpenRocket
" + + "OpenRocket features the enhanced components database created by David B. Cook
" + "Copyright " + Chars.COPY + " 2015-" + copyrightYear + " David B. Cook
" + "Project page: https://github.com/dbcook/openrocket-database
" + "
" + "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this work except in compliance with the License. " + - " A copy of the Apache License may be viewed " + apacheInternalHref + ". You may also obtain a copy of the License at:
" + + " A copy of the Apache License may be viewed " + + "here.
" + + "You may also obtain a copy of the License at:
" + "
" + "http://www.apache.org/licenses/LICENSE-2.0

" + - - "Unless required by applicable law or agreed to in writing, software distributed under the License is distributed " + - "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License " + - apacheInternalHref + " for the specific language governing permissions and limitations under the License.
" + + "
" + + "OpenRocket uses the Work or Derivative Works of Ant, a product which includes software developed by the Apache " + + "Software Foundation
" + + "
" + + "Ant product also includes software developed by:
" + + "
" + + "The names \"Ant\" and \"Apache Software Foundation\" must not be used to endorse or " + + "promote products derived from this software without prior written permission. For written permission, "+ + "please contact apache@apache.org.
" + "
"; - /*****************************************************************************************************************************/ /* BITSTREAM VERA: Deja Vu font */ /*****************************************************************************************************************************/ - final String dejaLicenseUrl = jarUrl + "!/dejavu-font/LICENSE"; final String fontLicense = "Bitstream Vera Font License
" + "
" + - "DejaVu Serif Font
" + - "Fonts are Copyright " + Chars.COPY + " 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.
" + + "OpenRocket makes use of the DejaVu Serif Font
" + + "Fonts are Copyright " + Chars.COPY + " 2003 by Bitstream, Inc. All Rights Reserved. " + + "Bitstream Vera is a trademark of Bitstream, Inc.
" + "DejaVu changes are in the public domain
" + "Glyphs imported from Arev Fonts Copyright " + Chars.COPY + " 2006 by Tavmjong Bah. All Rights Reserved.
" + "
" + - "Licensed according to the Bitstream Vera Font License which may be found here." + + "Licensed according to the Bitstream Vera Font License which may be found " + + "here." + "
" + - "THE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS " + - "OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY " + - "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, " + - "TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME " + - "FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING " + - "ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, " + - "WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF " + - "THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE " + - "FONT SOFTWARE.
" + - "
" + - "See the License for the specific language" + - "governing permissions and limitations under the License.
" + + "The license is also available at " + + "https://github.com/dejavu-fonts/dejavu-fonts/blob/master/LICENSE
" + "
"; - - + /*****************************************************************************************************************************/ /* BSD 2-Clause: commonmark-java library */ /*****************************************************************************************************************************/ final String commonmarkLicense = "BSD 2-Clause License
" + "
" + - "Commonmark-Java Library
" + + "OpenRocket makes use of the Commonmark-Java Library
" + "Copyright " + Chars.COPY + " 2015-2016 Atlassian Pty Ltd
" + "All rights reserved.
" + "
" + - "Redistribution and use in source and binary forms, with or without" + - "modification, are permitted provided that the following conditions are met:
" + - "
    " + - "
  • Redistributions of source code must retain the above copyright notice, this " + - "list of conditions and the following disclaimer.
  • " + - "
  • Redistributions in binary form must reproduce the above copyright notice, " + - "this list of conditions and the following disclaimer in the documentation " + - "and/or other materials provided with the distribution.
" + - "
" + - "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" " + - "AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED " + - "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. " + - "IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, " + - "INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, " + - "BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, " + - "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF " + - "LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE " + - "OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED " + - "OF THE POSSIBILITY OF SUCH DAMAGE.
" + + "See https://github.com/commonmark/commonmark-java/blob/main/LICENSE.txt " + + "for full terms of use" + "
"; /*****************************************************************************************************************************/ From f8997d83f1541deac8de3a6c7253137f7afe656e Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Tue, 8 Feb 2022 10:04:32 -0700 Subject: [PATCH 08/10] Cleanup license display --- .../openrocket/gui/dialogs/LicenseDialog.java | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java index 5ce88cc1b..edfde1bda 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/LicenseDialog.java @@ -57,12 +57,12 @@ public class LicenseDialog extends JDialog { final String orLicense = "GNU GENERAL PUBLIC LICENSE" + "
" + "
" + "OpenRocket - A model rocket simulator
" + - "Copyright " + Chars.COPY + " 2007-" + copyrightYear + "Sampo Niskanen and others
" + + "Copyright " + Chars.COPY + " 2007-" + copyrightYear + " Sampo Niskanen and others
" + "Project page: https://openrocket.info/
" + "
" + "This program 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, either version 3 " + - "of the License, or any later version.
" + + "of the License, or any later version. " + "The license may be viewed " + "here.
" + "
" + @@ -70,13 +70,12 @@ public class LicenseDialog extends JDialog { "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 Public License along with this program. If not, see
" + - "
" + + "You should have received a copy of the GNU Public License along with this program. If not, you may obtain a copy at " + "https://www.gnu.org/licenses/gpl-3.0.html
" + "
" + "OpenRocket developers may be contacted electronically at:
" + - "
" + - "mailto:openrocket-devel@lists.sourceforge.net
" + + "mailto:openrocket-devel@lists.sourceforge.net
" + + "https://openrocket.slack.com
" + "https://github.com/openrocket
" + "
"; @@ -91,20 +90,19 @@ public class LicenseDialog extends JDialog { "Project page: https://github.com/dbcook/openrocket-database
" + "
" + "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this work except in compliance with the License. " + - " A copy of the Apache License may be viewed " + + "You may view the License " + "here.
" + - "You may also obtain a copy of the License at:
" + - "
" + - "http://www.apache.org/licenses/LICENSE-2.0

" + + "You may also obtain a copy of the License at " + + "http://www.apache.org/licenses/LICENSE-2.0
" + "
" + "OpenRocket uses the Work or Derivative Works of Ant, a product which includes software developed by the Apache " + "Software Foundation
" + "
" + - "Ant product also includes software developed by:
" + - "" + "The names \"Ant\" and \"Apache Software Foundation\" must not be used to endorse or " + "promote products derived from this software without prior written permission. For written permission, "+ "please contact apache@apache.org.
" + @@ -114,18 +112,19 @@ public class LicenseDialog extends JDialog { /* BITSTREAM VERA: Deja Vu font */ /*****************************************************************************************************************************/ final String fontLicense = - "Bitstream Vera Font License
" + + "BITSTREAM VERA FONT LICENSE
" + "
" + "OpenRocket makes use of the DejaVu Serif Font
" + "Fonts are Copyright " + Chars.COPY + " 2003 by Bitstream, Inc. All Rights Reserved. " + "Bitstream Vera is a trademark of Bitstream, Inc.
" + "DejaVu changes are in the public domain
" + "Glyphs imported from Arev Fonts Copyright " + Chars.COPY + " 2006 by Tavmjong Bah. All Rights Reserved.
" + + "Project page: https://github.com/dejavu-fonts/dejavu-fonts/
" + "
" + "Licensed according to the Bitstream Vera Font License which may be found " + "
here." + "
" + - "The license is also available at " + + "You may also obtain a copy of the License at " + "https://github.com/dejavu-fonts/dejavu-fonts/blob/master/LICENSE
" + "
"; @@ -134,13 +133,12 @@ public class LicenseDialog extends JDialog { /*****************************************************************************************************************************/ final String commonmarkLicense = "BSD 2-Clause License
" + - "
" + + "
" + "OpenRocket makes use of the Commonmark-Java Library
" + - "Copyright " + Chars.COPY + " 2015-2016 Atlassian Pty Ltd
" + - "All rights reserved.
" + + "Copyright " + Chars.COPY + " 2015-2016 Atlassian Pty Ltd. All rights reserved.
" + + "Project page: https://github.com/commonmark/commonmark-java/
" + "
" + - "See
https://github.com/commonmark/commonmark-java/blob/main/LICENSE.txt " + - "for full terms of use" + + "You may obtain a copy of the License at https://github.com/commonmark/commonmark-java/blob/main/LICENSE.txt." + "
"; /*****************************************************************************************************************************/ From 44271711a642ac873183cf50cefbd3b0f9bfc56d Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Tue, 8 Feb 2022 18:05:24 -0700 Subject: [PATCH 09/10] When constructing a file name based on the name of a resource in a .jar file, if it has no extension give it an extension of .txt --- .../sf/openrocket/gui/components/DescriptionArea.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java b/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java index 6c17891ed..9c373e261 100644 --- a/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java +++ b/swing/src/net/sf/openrocket/gui/components/DescriptionArea.java @@ -95,17 +95,20 @@ public class DescriptionArea extends JScrollPane { if (uri.getScheme().equals("jar")) { // get the resource - String uriString = uri.toString(); - String resourceName = uriString.substring(uriString.indexOf("!") + 1); + final String uriString = uri.toString(); + final String resourceName = uriString.substring(uriString.indexOf("!") + 1); final BufferedInputStream is = new BufferedInputStream(getClass().getResourceAsStream(resourceName)); // construct filename from resource name String prefix = resourceName.substring(1); - String suffix = null; + String suffix; final int dotIndex = prefix.lastIndexOf("."); if (dotIndex > 0) { prefix = resourceName.substring(0, dotIndex); suffix = resourceName.substring(dotIndex+1); + } else { + // if there is no suffix, assume it's a raw text file. + suffix = ".txt"; } From 768e7380ebc4079437491a1b9005815e4590832f Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Thu, 10 Feb 2022 08:59:59 -0700 Subject: [PATCH 10/10] Move some meta-files from the .../core subdirectory to the root directory. --- core/LICENSE.TXT => LICENSE.TXT | 0 core/ReleaseNotes.md => ReleaseNotes.md | 0 core/build.xml | 2 +- core/fileformat.txt => fileformat.txt | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename core/LICENSE.TXT => LICENSE.TXT (100%) rename core/ReleaseNotes.md => ReleaseNotes.md (100%) rename core/fileformat.txt => fileformat.txt (100%) diff --git a/core/LICENSE.TXT b/LICENSE.TXT similarity index 100% rename from core/LICENSE.TXT rename to LICENSE.TXT diff --git a/core/ReleaseNotes.md b/ReleaseNotes.md similarity index 100% rename from core/ReleaseNotes.md rename to ReleaseNotes.md diff --git a/core/build.xml b/core/build.xml index 27a1b4ecc..cab35e15b 100644 --- a/core/build.xml +++ b/core/build.xml @@ -69,7 +69,7 @@ - + diff --git a/core/fileformat.txt b/fileformat.txt similarity index 100% rename from core/fileformat.txt rename to fileformat.txt