Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package jcommon for openSUSE:Factory checked in at 2022-01-03 10:49:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/jcommon (Old) and /work/SRC/openSUSE:Factory/.jcommon.new.1896 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "jcommon" Mon Jan 3 10:49:34 2022 rev:16 rq:943359 version:1.0.24 Changes: -------- --- /work/SRC/openSUSE:Factory/jcommon/jcommon.changes 2019-10-08 19:57:47.128223516 +0200 +++ /work/SRC/openSUSE:Factory/.jcommon.new.1896/jcommon.changes 2022-01-03 10:50:08.735597132 +0100 @@ -1,0 +2,8 @@ +Tue Dec 28 12:55:00 UTC 2021 - David Anes <[email protected]> + +- Update to upstream version 1.0.24: + * Fix for `RectangleAnchor` class, add handling for gradient + paint in `PaintUtilities`, fix for bug in `drawRotatedString()` + method. + +------------------------------------------------------------------- @@ -4 +12 @@ -- Update to upstrem verion 1.0.23 +- Update to upstrem version 1.0.23 Old: ---- jcommon-1.0.23.tar.xz New: ---- jcommon-1.0.24.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ jcommon.spec ++++++ --- /var/tmp/diff_new_pack.txKUnQ/_old 2022-01-03 10:50:09.315597353 +0100 +++ /var/tmp/diff_new_pack.txKUnQ/_new 2022-01-03 10:50:09.319597355 +0100 @@ -1,7 +1,7 @@ # # spec file for package jcommon # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,11 +18,12 @@ %define section free Name: jcommon -Version: 1.0.23 +Version: 1.0.24 Release: 0 Summary: Common library License: LGPL-2.1-only -URL: http://www.jfree.org/jcommon/index.php +URL: https://www.jfree.org/jcommon/ +# see _service file for Source0 Source0: jcommon-%{version}.tar.xz BuildRequires: ant >= 1.6.5 BuildRequires: fdupes @@ -51,8 +52,6 @@ # remove all binary libs find . -name "*.jar" -exec rm -f {} \; -%{pom_remove_parent} - %build export CLASSPATH=%(build-classpath junit) ant \ ++++++ _service ++++++ --- /var/tmp/diff_new_pack.txKUnQ/_old 2022-01-03 10:50:09.347597366 +0100 +++ /var/tmp/diff_new_pack.txKUnQ/_new 2022-01-03 10:50:09.351597367 +0100 @@ -2,8 +2,8 @@ <service name="tar_scm" mode="disabled"> <param name="scm">git</param> <param name="url">git://github.com/jfree/jcommon.git</param> - <param name="revision">1ea10aa82e30e0d60f57e1c562281a3ac7dd5cdd</param> - <param name="versionformat">1.0.23</param> + <param name="revision">449bbd3b5fbdffe2a41bfe51efcd6d513030a615</param> + <param name="versionformat">1.0.24</param> </service> <service name="recompress" mode="disabled"> <param name="file">*.tar</param> ++++++ jcommon-1.0.23.tar.xz -> jcommon-1.0.24.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jcommon-1.0.23/.gitignore new/jcommon-1.0.24/.gitignore --- old/jcommon-1.0.23/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/jcommon-1.0.24/.gitignore 2017-02-18 16:35:40.000000000 +0100 @@ -0,0 +1,14 @@ +*.class + +# Package Files # +*.jar +*.war +*.ear + +# Eclipse files # +/.classpath +/.project +/.settings + +# Build directory # +/target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jcommon-1.0.23/README.md new/jcommon-1.0.24/README.md --- old/jcommon-1.0.23/README.md 2014-07-24 17:34:23.000000000 +0200 +++ new/jcommon-1.0.24/README.md 2017-02-18 16:35:40.000000000 +0100 @@ -1,9 +1,9 @@ -THE JCOMMON CLASS LIBRARY: Version 1.0.23 +THE JCOMMON CLASS LIBRARY: Version 1.0.24 ========================================= -24 July 2014 +18 February 2017 -(C)opyright, 2000-2014, by Object Refinery Limited and Contributors. +(C)opyright, 2000-2017, by Object Refinery Limited and Contributors. ----------------- 1. INTRODUCTION @@ -43,47 +43,51 @@ --------------- Changes in each version are listed here: +1.0.24: (17-Feb-2017) Fix for `RectangleAnchor` class, add handling for gradient + paint in `PaintUtilities`, fix for bug in + `drawRotatedString()` method. + 1.0.23: (24-Jul-2014) Reorganised directories to align to Maven standard. Updated pom file. Fixed Javadoc warnings for JDK 8. -1.0.22: (28-Feb-2014) Fix for endless loop in TextUtilities.createTextBlock(). +1.0.22: (28-Feb-2014) Fix for endless loop in `TextUtilities.createTextBlock()`. -1.0.21: (24-Oct-2013) Modified drawRotatedString() to call drawAlignedString() +1.0.21: (24-Oct-2013) Modified `drawRotatedString()` to call `drawAlignedString()` when the rotation angle is 0.0. This provides benefits downstream for JFreeChart, JFreeSVG and OrsonPDF. -1.0.20: (01-Sep-2013) Fixed TextFragment.draw() to respect TextAnchor argument. +1.0.20: (01-Sep-2013) Fixed `TextFragment.draw()` to respect `TextAnchor` argument. 1.0.19: (30-Aug-2013) Updated Licences.java so that complete licence text is loaded on demand only (bug #1118). -1.0.18: (23-Sep-2012) Fixed PaintList.equals() bug, fixed line break issue in - TextUtilities; +1.0.18: (23-Sep-2012) Fixed `PaintList.equals()` bug, fixed line break issue in + `TextUtilities`; -1.0.17: (17-Oct-2011) Updated SerialUtilities to support serialisation of - Composite instances; +1.0.17: (17-Oct-2011) Updated `SerialUtilities` to support serialisation of + `Composite` instances; 1.0.16: (17-Apr-2009) New release in conjunction with JFreeChart 1.0.13; -1.0.15: (19-Dec-2008) New ResourceBundleWrapper class to enable applets to +1.0.15: (19-Dec-2008) New `ResourceBundleWrapper` class to enable applets to bypass codeBase lookup. Updated Maven specs. -1.0.14: (10-Sep-2008) Workaround added to PngEncoder, bug fix in ShapeList. +1.0.14: (10-Sep-2008) Workaround added to `PngEncoder`, bug fix in `ShapeList`. -1.0.13: (05-Jun-2008) Bug fixes for TextBox and ShapeUtilities. +1.0.13: (05-Jun-2008) Bug fixes for `TextBox` and `ShapeUtilities`. 1.0.12: (02-Nov-2007) Made the resource-loading and classloader selection more robust in cases where the jars were distributed over several classloaders. -1.0.11: (19-Oct-2007) BugFix in the KeyedComboBoxModel causing +1.0.11: (19-Oct-2007) BugFix in the `KeyedComboBoxModel` causing NullPointerExceptions on MacOS-X; Make sure that all resource-streams that get opened also get safely closed in case of errors. -1.0.10: (21-May-2007) BugFix in the PackageSorter, Window positioning is now +1.0.10: (21-May-2007) BugFix in the `PackageSorter`, Window positioning is now multi-screen aware. -1.0.9 : (23-Mar-2007) Serialization fix in TextFragment. +1.0.9 : (23-Mar-2007) Serialization fix in `TextFragment`. 1.0.8 : (11-Dec-2006) Minor bugfixes in the synchronization of the Booting code and the FastStack. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jcommon-1.0.23/ant/build.properties new/jcommon-1.0.24/ant/build.properties --- old/jcommon-1.0.23/ant/build.properties 2014-07-24 17:34:23.000000000 +0200 +++ new/jcommon-1.0.24/ant/build.properties 2017-02-18 16:35:40.000000000 +0100 @@ -2,7 +2,7 @@ # # Global settings ... jcommon.name=jcommon -jcommon.version=1.0.23 +jcommon.version=1.0.24 # # This defines the compiler settings. Optimizing would remove diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jcommon-1.0.23/ant/build.xml new/jcommon-1.0.24/ant/build.xml --- old/jcommon-1.0.23/ant/build.xml 2014-07-24 17:34:23.000000000 +0200 +++ new/jcommon-1.0.24/ant/build.xml 2017-02-18 16:35:40.000000000 +0100 @@ -11,10 +11,6 @@ <!-- A "../javadoc" directory will be created for the Javadoc --> <!-- HTML pages. --> -<!-- The script should work for the distribution and also the CVS --> -<!-- repository (which is shared with the JFreeChart project in a --> -<!-- slightly messy way). --> - <project name="jcommon" default="all" basedir=".."> <!-- Initialisation. --> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jcommon-1.0.23/pom.xml new/jcommon-1.0.24/pom.xml --- old/jcommon-1.0.23/pom.xml 2014-07-24 17:34:23.000000000 +0200 +++ new/jcommon-1.0.24/pom.xml 2017-02-18 16:35:40.000000000 +0100 @@ -10,16 +10,9 @@ <artifactId>jcommon</artifactId> <groupId>org.jfree</groupId> - <version>1.0.23</version> + <version>1.0.24</version> <packaging>jar</packaging> - <!-- this is required to host it on Sonatype's OSSRH --> - <parent> - <groupId>org.sonatype.oss</groupId> - <artifactId>oss-parent</artifactId> - <version>9</version> - </parent> - <organization> <name>JFree.org</name> <url>http://www.jfree.org/</url> @@ -34,33 +27,21 @@ <url>http://www.jfree.org/jcommon/</url> <issueManagement> - <url>http://sourceforge.net/tracker/?group_id=15494</url> + <url>https://github.com/jfree/jcommon/issues</url> + <system>GitHub Issues</system> </issueManagement> <scm> - <connection>scm:cvs:pserver:[email protected]:/cvsroot/jfreechart:jcommon</connection> - <url>http://cvs.sourceforge.net/viewcvs.py/jfreechart/jcommon</url> + <connection>scm:git:git:https://github.com/jfree/jcommon.git</connection> + <url>https://github.com/jfree/jcommon</url> </scm> - <mailingLists> - <mailingList> - <name>JFreeChart Developer List</name> - <subscribe> - [email protected]?subject=subscribe - </subscribe> - <unsubscribe> - [email protected]?subject=unsubscribe - </unsubscribe> - <archive> - http://sourceforge.net/mailarchive/forum.php?forum=jfreechart-dev - </archive> - </mailingList> - </mailingLists> - <developers> - <!-- - For an up to date list of developers and contributors have a look at - the project info implementations. - --> + <developer> + <name>David Gilbert</name> + <email>[email protected]</email> + <organization>Object Refinery Limited</organization> + <organizationUrl>http://www.object-refinery.com</organizationUrl> + </developer> </developers> <licenses> <license> @@ -157,7 +138,7 @@ <plugin> <groupId>org.sonatype.plugins</groupId> <artifactId>nexus-staging-maven-plugin</artifactId> - <version>1.6.2</version> + <version>1.6.7</version> <extensions>true</extensions> <configuration> <serverId>ossrh</serverId> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jcommon-1.0.23/src/main/java/org/jfree/text/TextUtilities.java new/jcommon-1.0.24/src/main/java/org/jfree/text/TextUtilities.java --- old/jcommon-1.0.23/src/main/java/org/jfree/text/TextUtilities.java 2014-07-24 17:34:23.000000000 +0200 +++ new/jcommon-1.0.24/src/main/java/org/jfree/text/TextUtilities.java 2017-02-18 16:35:40.000000000 +0100 @@ -501,7 +501,7 @@ return; } if (angle == 0.0) { - drawAlignedString(text, g2, textY, textY, TextAnchor.BASELINE_LEFT); + drawAlignedString(text, g2, textX, textY, TextAnchor.BASELINE_LEFT); return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jcommon-1.0.23/src/main/java/org/jfree/ui/RectangleAnchor.java new/jcommon-1.0.24/src/main/java/org/jfree/ui/RectangleAnchor.java --- old/jcommon-1.0.23/src/main/java/org/jfree/ui/RectangleAnchor.java 2014-07-24 17:34:23.000000000 +0200 +++ new/jcommon-1.0.24/src/main/java/org/jfree/ui/RectangleAnchor.java 2017-02-18 16:35:40.000000000 +0100 @@ -2,7 +2,7 @@ * JCommon : a free general purpose class library for the Java(tm) platform * ======================================================================== * - * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2015, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jcommon/index.html * @@ -27,20 +27,19 @@ * -------------------- * RectangleAnchor.java * -------------------- - * (C) Copyright 2003-2005, by Object Refinery Limited. + * (C) Copyright 2003-2015, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; * - * $Id: RectangleAnchor.java,v 1.6 2005/10/18 13:18:34 mungady Exp $ - * * Changes: * -------- * 31-Oct-2003 (DG); * 01-Apr-2004 : Changed java.awt.geom.Dimension2D to org.jfree.ui.Size2D * because of JDK bug 4976448 which persists on JDK 1.3.1 (DG); * 21-Jan-2005 : Changed return type of coordinates() method (DG); - * + * 17-Feb-2015 : Fixes for createRectangle() (DG); + * */ package org.jfree.ui; @@ -52,8 +51,6 @@ /** * Used to indicate an anchor point for a rectangle. - * - * @author David Gilbert */ public final class RectangleAnchor implements Serializable { @@ -104,7 +101,7 @@ * * @param name the name. */ - private RectangleAnchor(final String name) { + private RectangleAnchor(String name) { this.name = name; } @@ -194,66 +191,41 @@ /** * Creates a new rectangle with the specified dimensions that is aligned to - * the given anchor point <code>(anchorX, anchorY)</code>. + * the given anchor point {@code (anchorX, anchorY)}. * - * @param dimensions the dimensions (<code>null</code> not permitted). + * @param dimensions the dimensions ({@code null} not permitted). * @param anchorX the x-anchor. * @param anchorY the y-anchor. - * @param anchor the anchor (<code>null</code> not permitted). + * @param anchor the anchor ({@code null} not permitted). * * @return A rectangle. */ - public static Rectangle2D createRectangle(final Size2D dimensions, - final double anchorX, - final double anchorY, - final RectangleAnchor anchor) { + public static Rectangle2D createRectangle(Size2D dimensions, + double anchorX, double anchorY, RectangleAnchor anchor) { Rectangle2D result = null; final double w = dimensions.getWidth(); final double h = dimensions.getHeight(); if (anchor == RectangleAnchor.CENTER) { - result = new Rectangle2D.Double( - anchorX - w / 2.0, anchorY - h / 2.0, w, h - ); - } - else if (anchor == RectangleAnchor.TOP) { - result = new Rectangle2D.Double( - anchorX - w / 2.0, anchorY - h / 2.0, w, h - ); - } - else if (anchor == RectangleAnchor.BOTTOM) { - result = new Rectangle2D.Double( - anchorX - w / 2.0, anchorY - h / 2.0, w, h - ); - } - else if (anchor == RectangleAnchor.LEFT) { - result = new Rectangle2D.Double( - anchorX, anchorY - h / 2.0, w, h - ); - } - else if (anchor == RectangleAnchor.RIGHT) { - result = new Rectangle2D.Double( - anchorX - w, anchorY - h / 2.0, w, h - ); - } - else if (anchor == RectangleAnchor.TOP_LEFT) { - result = new Rectangle2D.Double( - anchorX - w / 2.0, anchorY - h / 2.0, w, h - ); - } - else if (anchor == RectangleAnchor.TOP_RIGHT) { - result = new Rectangle2D.Double( - anchorX - w / 2.0, anchorY - h / 2.0, w, h - ); - } - else if (anchor == RectangleAnchor.BOTTOM_LEFT) { - result = new Rectangle2D.Double( - anchorX - w / 2.0, anchorY - h / 2.0, w, h - ); - } - else if (anchor == RectangleAnchor.BOTTOM_RIGHT) { - result = new Rectangle2D.Double( - anchorX - w / 2.0, anchorY - h / 2.0, w, h - ); + result = new Rectangle2D.Double(anchorX - w / 2.0, + anchorY - h / 2.0, w, h); + } else if (anchor == RectangleAnchor.TOP) { + result = new Rectangle2D.Double(anchorX - w / 2.0, anchorY, w, h); + } else if (anchor == RectangleAnchor.BOTTOM) { + result = new Rectangle2D.Double(anchorX - w / 2.0, anchorY - h, + w, h); + } else if (anchor == RectangleAnchor.LEFT) { + result = new Rectangle2D.Double(anchorX, anchorY - h / 2.0, w, h); + } else if (anchor == RectangleAnchor.RIGHT) { + result = new Rectangle2D.Double(anchorX - w, anchorY - h / 2.0, + w, h); + } else if (anchor == RectangleAnchor.TOP_LEFT) { + result = new Rectangle2D.Double(anchorX, anchorY, w, h); + } else if (anchor == RectangleAnchor.TOP_RIGHT) { + result = new Rectangle2D.Double(anchorX - w, anchorY, w, h); + } else if (anchor == RectangleAnchor.BOTTOM_LEFT) { + result = new Rectangle2D.Double(anchorX, anchorY - h, w, h); + } else if (anchor == RectangleAnchor.BOTTOM_RIGHT) { + result = new Rectangle2D.Double(anchorX - w, anchorY - h, w, h); } return result; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jcommon-1.0.23/src/main/java/org/jfree/util/PaintUtilities.java new/jcommon-1.0.24/src/main/java/org/jfree/util/PaintUtilities.java --- old/jcommon-1.0.23/src/main/java/org/jfree/util/PaintUtilities.java 2014-07-24 17:34:23.000000000 +0200 +++ new/jcommon-1.0.24/src/main/java/org/jfree/util/PaintUtilities.java 2017-02-18 16:35:40.000000000 +0100 @@ -2,7 +2,7 @@ * JCommon : a free general purpose class library for the Java(tm) platform * ======================================================================== * - * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2017, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jcommon/index.html * @@ -27,18 +27,17 @@ * ------------------- * PaintUtilities.java * ------------------- - * (C) Copyright 2003-2005, by Object Refinery Limited. + * (C) Copyright 2003-2016, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; * - * $Id: PaintUtilities.java,v 1.10 2007/11/02 17:50:37 taqua Exp $ - * * Changes * ------- * 13-Nov-2003 : Version 1 (DG); * 04-Oct-2004 : Renamed PaintUtils --> PaintUtilities (DG); * 23-Feb-2005 : Rewrote equal() method with less indenting required (DG); + * 16-Jan-2016 : Update equal() test (DG); * */ @@ -46,14 +45,15 @@ import java.awt.Color; import java.awt.GradientPaint; +import java.awt.LinearGradientPaint; import java.awt.Paint; +import java.awt.RadialGradientPaint; import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import java.util.Arrays; /** - * Utility code that relates to <code>Paint</code> objects. - * - * @author David Gilbert + * Utility code that relates to {@code Paint} objects. */ public class PaintUtilities { @@ -64,17 +64,22 @@ } /** - * Returns <code>true</code> if the two <code>Paint</code> objects are equal - * OR both <code>null</code>. This method handles - * <code>GradientPaint</code> as a special case. + * Returns {@code true} if the two {@code Paint} objects are equal + * OR both {@code null}. This method handles + * {@code GradientPaint}, {@code LinearGradientPaint} and + * {@code RadialGradientPaint} as a special cases, since those classes do + * not override the {@code equals()} method. * - * @param p1 paint 1 (<code>null</code> permitted). - * @param p2 paint 2 (<code>null</code> permitted). + * @param p1 paint 1 ({@code null} permitted). + * @param p2 paint 2 ({@code null} permitted). * * @return A boolean. */ - public static boolean equal(final Paint p1, final Paint p2) { - + public static boolean equal(Paint p1, Paint p2) { + if (p1 == p2) { + return true; + } + // handle cases where either or both arguments are null if (p1 == null) { return (p2 == null); @@ -82,24 +87,43 @@ if (p2 == null) { return false; } - - boolean result = false; + // handle GradientPaint as a special case... if (p1 instanceof GradientPaint && p2 instanceof GradientPaint) { - final GradientPaint gp1 = (GradientPaint) p1; - final GradientPaint gp2 = (GradientPaint) p2; - result = gp1.getColor1().equals(gp2.getColor1()) - && gp1.getColor2().equals(gp2.getColor2()) - && gp1.getPoint1().equals(gp2.getPoint1()) - && gp1.getPoint2().equals(gp2.getPoint2()) - && gp1.isCyclic() == gp2.isCyclic() - && gp1.getTransparency() == gp1.getTransparency(); - } - else { - result = p1.equals(p2); + GradientPaint gp1 = (GradientPaint) p1; + GradientPaint gp2 = (GradientPaint) p2; + return gp1.getColor1().equals(gp2.getColor1()) + && gp1.getColor2().equals(gp2.getColor2()) + && gp1.getPoint1().equals(gp2.getPoint1()) + && gp1.getPoint2().equals(gp2.getPoint2()) + && gp1.isCyclic() == gp2.isCyclic() + && gp1.getTransparency() == gp1.getTransparency(); + } else if (p1 instanceof LinearGradientPaint + && p2 instanceof LinearGradientPaint) { + LinearGradientPaint lgp1 = (LinearGradientPaint) p1; + LinearGradientPaint lgp2 = (LinearGradientPaint) p2; + return lgp1.getStartPoint().equals(lgp2.getStartPoint()) + && lgp1.getEndPoint().equals(lgp2.getEndPoint()) + && Arrays.equals(lgp1.getFractions(), lgp2.getFractions()) + && Arrays.equals(lgp1.getColors(), lgp2.getColors()) + && lgp1.getCycleMethod() == lgp2.getCycleMethod() + && lgp1.getColorSpace() == lgp2.getColorSpace() + && lgp1.getTransform().equals(lgp2.getTransform()); + } else if (p1 instanceof RadialGradientPaint + && p2 instanceof RadialGradientPaint) { + RadialGradientPaint rgp1 = (RadialGradientPaint) p1; + RadialGradientPaint rgp2 = (RadialGradientPaint) p2; + return rgp1.getCenterPoint().equals(rgp2.getCenterPoint()) + && rgp1.getRadius() == rgp2.getRadius() + && rgp1.getFocusPoint().equals(rgp2.getFocusPoint()) + && Arrays.equals(rgp1.getFractions(), rgp2.getFractions()) + && Arrays.equals(rgp1.getColors(), rgp2.getColors()) + && rgp1.getCycleMethod() == rgp2.getCycleMethod() + && rgp1.getColorSpace() == rgp2.getColorSpace() + && rgp1.getTransform().equals(rgp2.getTransform()); + } else { + return p1.equals(p2); } - return result; - } /** @@ -110,41 +134,39 @@ * @param c the color. * @return the string for this color. */ - public static String colorToString (final Color c) - { - try { - final Field[] fields = Color.class.getFields(); - for (int i = 0; i < fields.length; i++) { - final Field f = fields[i]; - if (Modifier.isPublic(f.getModifiers()) - && Modifier.isFinal(f.getModifiers()) - && Modifier.isStatic(f.getModifiers())) { - final String name = f.getName(); - final Object oColor = f.get(null); - if (oColor instanceof Color) { - if (c.equals(oColor)) { - return name; - } - } - } - } - } - catch (Exception e) { - // - } - - // no defined constant color, so this must be a user defined color - final String color = Integer.toHexString(c.getRGB() & 0x00ffffff); - final StringBuffer retval = new StringBuffer(7); - retval.append("#"); - - final int fillUp = 6 - color.length(); - for (int i = 0; i < fillUp; i++) { - retval.append("0"); - } + public static String colorToString (final Color c) { + try { + final Field[] fields = Color.class.getFields(); + for (int i = 0; i < fields.length; i++) { + final Field f = fields[i]; + if (Modifier.isPublic(f.getModifiers()) + && Modifier.isFinal(f.getModifiers()) + && Modifier.isStatic(f.getModifiers())) { + final String name = f.getName(); + final Object oColor = f.get(null); + if (oColor instanceof Color) { + if (c.equals(oColor)) { + return name; + } + } + } + } + } catch (Exception e) { + // + } + + // no defined constant color, so this must be a user defined color + final String color = Integer.toHexString(c.getRGB() & 0x00ffffff); + final StringBuffer retval = new StringBuffer(7); + retval.append("#"); + + final int fillUp = 6 - color.length(); + for (int i = 0; i < fillUp; i++) { + retval.append("0"); + } - retval.append(color); - return retval.toString(); + retval.append(color); + return retval.toString(); } /** @@ -153,28 +175,24 @@ * @param value the string, either a name or a hex-string. * @return the color. */ - public static Color stringToColor (final String value) - { - if (value == null) { - return Color.black; - } - try { - // get color by hex or octal value - return Color.decode(value); - } - catch (NumberFormatException nfe) { - // if we can't decode lets try to get it by name - try { - // try to get a color by name using reflection - final Field f = Color.class.getField(value); - - return (Color) f.get(null); - } - catch (Exception ce) { - Log.info("No such Color : " + value); - // if we can't get any color return black - return Color.black; - } - } + public static Color stringToColor(String value) { + if (value == null) { + return Color.black; + } + try { + // get color by hex or octal value + return Color.decode(value); + } catch (NumberFormatException nfe) { + // if we can't decode lets try to get it by name + try { + // try to get a color by name using reflection + final Field f = Color.class.getField(value); + return (Color) f.get(null); + } catch (Exception ce) { + Log.info("No such Color : " + value); + // if we can't get any color return black + return Color.black; + } + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jcommon-1.0.23/src/test/java/org/jfree/ui/RectangleAnchorTest.java new/jcommon-1.0.24/src/test/java/org/jfree/ui/RectangleAnchorTest.java --- old/jcommon-1.0.23/src/test/java/org/jfree/ui/RectangleAnchorTest.java 2014-07-24 17:34:23.000000000 +0200 +++ new/jcommon-1.0.24/src/test/java/org/jfree/ui/RectangleAnchorTest.java 2017-02-18 16:35:40.000000000 +0100 @@ -2,7 +2,7 @@ * JCommon : a free general purpose class library for the Java(tm) platform * ======================================================================== * - * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2015, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jcommon/index.html * @@ -27,21 +27,21 @@ * ------------------------ * RectangleAnchorTest.java * ------------------------ - * (C) Copyright 2004-2014, by Object Refinery Limited and Contributors. + * (C) Copyright 2004-2015, by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; * - * $Id: RectangleAnchorTest.java,v 1.3 2007/11/02 17:50:37 taqua Exp $ - * * Changes * ------- * 08-Jan-2004 : Version 1 (DG); + * 17-Feb-2015 : Add tests (DG); * */ package org.jfree.ui; +import java.awt.geom.Rectangle2D; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInput; @@ -72,11 +72,36 @@ * * @param name the name of the tests. */ - public RectangleAnchorTest(final String name) { + public RectangleAnchorTest(String name) { super(name); } /** + * Tests for the createRectangle() method. + */ + public void testCreateRectangle() { + Size2D s = new Size2D(3.0, 8.0); + assertEquals(new Rectangle2D.Double(-0.5, -2.0, 3.0, 8.0), + RectangleAnchor.createRectangle(s, 1.0, 2.0, RectangleAnchor.CENTER)); + assertEquals(new Rectangle2D.Double(1.0, -2.0, 3.0, 8.0), + RectangleAnchor.createRectangle(s, 1.0, 2.0, RectangleAnchor.LEFT)); + assertEquals(new Rectangle2D.Double(-2.0, -2.0, 3.0, 8.0), + RectangleAnchor.createRectangle(s, 1.0, 2.0, RectangleAnchor.RIGHT)); + assertEquals(new Rectangle2D.Double(-0.5, 2.0, 3.0, 8.0), + RectangleAnchor.createRectangle(s, 1.0, 2.0, RectangleAnchor.TOP)); + assertEquals(new Rectangle2D.Double(1.0, 2.0, 3.0, 8.0), + RectangleAnchor.createRectangle(s, 1.0, 2.0, RectangleAnchor.TOP_LEFT)); + assertEquals(new Rectangle2D.Double(-2.0, 2.0, 3.0, 8.0), + RectangleAnchor.createRectangle(s, 1.0, 2.0, RectangleAnchor.TOP_RIGHT)); + assertEquals(new Rectangle2D.Double(-0.5, -6.0, 3.0, 8.0), + RectangleAnchor.createRectangle(s, 1.0, 2.0, RectangleAnchor.BOTTOM)); + assertEquals(new Rectangle2D.Double(1.0, -6.0, 3.0, 8.0), + RectangleAnchor.createRectangle(s, 1.0, 2.0, RectangleAnchor.BOTTOM_LEFT)); + assertEquals(new Rectangle2D.Double(-2.0, -6.0, 3.0, 8.0), + RectangleAnchor.createRectangle(s, 1.0, 2.0, RectangleAnchor.BOTTOM_RIGHT)); + } + + /** * Tests the equals() method. */ public void testEquals() { @@ -87,25 +112,22 @@ * Serialize an instance, restore it, and check for identity. */ public void testSerialization() { - - final RectangleAnchor a1 = RectangleAnchor.RIGHT; + RectangleAnchor a1 = RectangleAnchor.RIGHT; RectangleAnchor a2 = null; - try { - final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - final ObjectOutput out = new ObjectOutputStream(buffer); + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(a1); out.close(); - final ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); + ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); a2 = (RectangleAnchor) in.readObject(); in.close(); } catch (Exception e) { - System.out.println(e.toString()); + System.err.println(e.toString()); } assertTrue(a1 == a2); - } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jcommon-1.0.23/src/test/java/org/jfree/util/PaintUtilitiesTest.java new/jcommon-1.0.24/src/test/java/org/jfree/util/PaintUtilitiesTest.java --- old/jcommon-1.0.23/src/test/java/org/jfree/util/PaintUtilitiesTest.java 2014-07-24 17:34:23.000000000 +0200 +++ new/jcommon-1.0.24/src/test/java/org/jfree/util/PaintUtilitiesTest.java 2017-02-18 16:35:40.000000000 +0100 @@ -2,7 +2,7 @@ * JCommon : a free general purpose class library for the Java(tm) platform * ======================================================================== * - * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2016, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jcommon/index.html * @@ -27,7 +27,7 @@ * ------------------------ * PaintUtilitiesTest.java * ------------------------ - * (C) Copyright 2005-2014, by Object Refinery Limited. + * (C) Copyright 2005-2016, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; @@ -37,6 +37,7 @@ * Changes * ------- * 23-Feb-2005 : Version 1 (DG); + * 16-Jan-2016 : Backport updates to equals() method (DG); * */ @@ -44,7 +45,12 @@ import java.awt.Color; import java.awt.GradientPaint; +import java.awt.LinearGradientPaint; +import java.awt.MultipleGradientPaint; import java.awt.Paint; +import java.awt.RadialGradientPaint; +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; import junit.framework.Test; import junit.framework.TestCase; @@ -81,15 +87,12 @@ Paint p2 = Color.blue; Paint p3 = new Color(1, 2, 3, 4); Paint p4 = new Color(1, 2, 3, 4); - Paint p5 = new GradientPaint( - 1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow - ); - Paint p6 = new GradientPaint( - 1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow - ); - Paint p7 = new GradientPaint( - 1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue - ); + Paint p5 = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, + Color.yellow); + Paint p6 = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, + Color.yellow); + Paint p7 = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, + Color.blue); assertTrue(PaintUtilities.equal(null, null)); assertFalse(PaintUtilities.equal(p1, null)); assertFalse(PaintUtilities.equal(null, p1)); @@ -99,5 +102,174 @@ assertTrue(PaintUtilities.equal(p5, p6)); assertFalse(PaintUtilities.equal(p5, p7)); } + + public void testLinearGradientPaint() { + Point2D start1 = new Point2D.Float(0, 0); + Point2D end1 = new Point2D.Float(50, 50); + float[] dist1 = {0.0f, 0.2f, 1.0f}; + Color[] colors1 = {Color.RED, Color.WHITE, Color.BLUE}; + LinearGradientPaint p1 = new LinearGradientPaint(start1, end1, dist1, + colors1); + + Point2D start2 = new Point2D.Float(0, 0); + Point2D end2 = new Point2D.Float(50, 50); + float[] dist2 = {0.0f, 0.2f, 1.0f}; + Color[] colors2 = {Color.RED, Color.WHITE, Color.BLUE}; + LinearGradientPaint p2 = new LinearGradientPaint(start2, end2, dist2, + colors2); + assertTrue(PaintUtilities.equal(p1, p2)); + assertFalse(PaintUtilities.equal(p1, Color.RED)); + assertFalse(PaintUtilities.equal(p1, null)); + assertFalse(PaintUtilities.equal(null, p1)); + + // check ColorSpaceType + p1 = new LinearGradientPaint(start1, end1, dist1, colors1, + MultipleGradientPaint.CycleMethod.NO_CYCLE, + MultipleGradientPaint.ColorSpaceType.LINEAR_RGB, + new AffineTransform()); + p2 = new LinearGradientPaint(start1, end1, dist1, colors1, + MultipleGradientPaint.CycleMethod.NO_CYCLE, + MultipleGradientPaint.ColorSpaceType.SRGB, + new AffineTransform()); + assertFalse(PaintUtilities.equal(p1, p2)); + p2 = new LinearGradientPaint(start1, end1, dist1, colors1, + MultipleGradientPaint.CycleMethod.NO_CYCLE, + MultipleGradientPaint.ColorSpaceType.LINEAR_RGB, + new AffineTransform()); + assertTrue(PaintUtilities.equal(p1, p2)); + + // check transform + p1 = new LinearGradientPaint(start1, end1, dist1, colors1, + MultipleGradientPaint.CycleMethod.NO_CYCLE, + MultipleGradientPaint.ColorSpaceType.LINEAR_RGB, + AffineTransform.getTranslateInstance(1.0, 2.0)); + assertFalse(PaintUtilities.equal(p1, p2)); + p2 = new LinearGradientPaint(start1, end1, dist1, colors1, + MultipleGradientPaint.CycleMethod.NO_CYCLE, + MultipleGradientPaint.ColorSpaceType.LINEAR_RGB, + AffineTransform.getTranslateInstance(1.0, 2.0)); + assertTrue(PaintUtilities.equal(p1, p2)); + } + + public void testRadialGradientPaint() { + RadialGradientPaint p1 = new RadialGradientPaint(1.0f, 2.0f, 3.0f, + new float[] {0.0f, 0.4f, 1.0f}, + new Color[] {Color.RED, Color.GREEN, Color.BLUE}); + RadialGradientPaint p2 = new RadialGradientPaint(1.0f, 2.0f, 3.0f, + new float[] {0.0f, 0.4f, 1.0f}, + new Color[] {Color.RED, Color.GREEN, Color.BLUE}); + assertTrue(PaintUtilities.equal(p1, p2)); + assertFalse(PaintUtilities.equal(p1, Color.RED)); + assertFalse(PaintUtilities.equal(p1, null)); + assertFalse(PaintUtilities.equal(null, p1)); + + p1 = new RadialGradientPaint(1.1f, 2.0f, 3.0f, + new float[] {0.0f, 0.4f, 1.0f}, + new Color[] {Color.RED, Color.GREEN, Color.BLUE}); + assertFalse(PaintUtilities.equal(p1, p2)); + p2 = new RadialGradientPaint(1.1f, 2.0f, 3.0f, + new float[] {0.0f, 0.4f, 1.0f}, + new Color[] {Color.RED, Color.GREEN, Color.BLUE}); + assertTrue(PaintUtilities.equal(p1, p2)); + + p1 = new RadialGradientPaint(1.1f, 2.2f, 3.0f, + new float[] {0.0f, 0.4f, 1.0f}, + new Color[] {Color.RED, Color.GREEN, Color.BLUE}); + assertFalse(PaintUtilities.equal(p1, p2)); + p2 = new RadialGradientPaint(1.1f, 2.2f, 3.0f, + new float[] {0.0f, 0.4f, 1.0f}, + new Color[] {Color.RED, Color.GREEN, Color.BLUE}); + assertTrue(PaintUtilities.equal(p1, p2)); + + p1 = new RadialGradientPaint(1.1f, 2.2f, 3.3f, + new float[] {0.0f, 0.4f, 1.0f}, + new Color[] {Color.RED, Color.GREEN, Color.BLUE}); + assertFalse(PaintUtilities.equal(p1, p2)); + p2 = new RadialGradientPaint(1.1f, 2.2f, 3.3f, + new float[] {0.0f, 0.4f, 1.0f}, + new Color[] {Color.RED, Color.GREEN, Color.BLUE}); + assertTrue(PaintUtilities.equal(p1, p2)); + + p1 = new RadialGradientPaint(1.1f, 2.2f, 3.3f, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.GREEN, Color.BLUE}); + assertFalse(PaintUtilities.equal(p1, p2)); + p2 = new RadialGradientPaint(1.1f, 2.2f, 3.3f, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.GREEN, Color.BLUE}); + assertTrue(PaintUtilities.equal(p1, p2)); + + p1 = new RadialGradientPaint(1.1f, 2.2f, 3.3f, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.YELLOW, Color.BLUE}); + assertFalse(PaintUtilities.equal(p1, p2)); + p2 = new RadialGradientPaint(1.1f, 2.2f, 3.3f, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.YELLOW, Color.BLUE}); + assertTrue(PaintUtilities.equal(p1, p2)); + + p1 = new RadialGradientPaint(1.1f, 2.2f, 3.3f, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.YELLOW, Color.BLUE}, + MultipleGradientPaint.CycleMethod.REPEAT); + assertFalse(PaintUtilities.equal(p1, p2)); + p2 = new RadialGradientPaint(1.1f, 2.2f, 3.3f, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.YELLOW, Color.BLUE}, + MultipleGradientPaint.CycleMethod.REPEAT); + assertTrue(PaintUtilities.equal(p1, p2)); + + p1 = new RadialGradientPaint(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.YELLOW, Color.BLUE}, + MultipleGradientPaint.CycleMethod.REPEAT); + assertFalse(PaintUtilities.equal(p1, p2)); + p2 = new RadialGradientPaint(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.YELLOW, Color.BLUE}, + MultipleGradientPaint.CycleMethod.REPEAT); + assertTrue(PaintUtilities.equal(p1, p2)); + + // check ColorSpaceType + Point2D center = new Point2D.Float(1.1f, 2.2f); + float radius = 3.3f; + Point2D focus = new Point2D.Float(4.4f, 5.5f); + p1 = new RadialGradientPaint(center, radius, focus, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.YELLOW, Color.BLUE}, + MultipleGradientPaint.CycleMethod.REPEAT, + MultipleGradientPaint.ColorSpaceType.SRGB, + new AffineTransform()); + p2 = new RadialGradientPaint(center, radius, focus, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.YELLOW, Color.BLUE}, + MultipleGradientPaint.CycleMethod.REPEAT, + MultipleGradientPaint.ColorSpaceType.LINEAR_RGB, + new AffineTransform()); + assertFalse(PaintUtilities.equal(p1, p2)); + p2 = new RadialGradientPaint(center, radius, focus, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.YELLOW, Color.BLUE}, + MultipleGradientPaint.CycleMethod.REPEAT, + MultipleGradientPaint.ColorSpaceType.SRGB, + new AffineTransform()); + assertTrue(PaintUtilities.equal(p1, p2)); + + // check transform + p1 = new RadialGradientPaint(center, radius, focus, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.YELLOW, Color.BLUE}, + MultipleGradientPaint.CycleMethod.REPEAT, + MultipleGradientPaint.ColorSpaceType.SRGB, + AffineTransform.getTranslateInstance(1.0, 2.0)); + assertFalse(PaintUtilities.equal(p1, p2)); + p2 = new RadialGradientPaint(center, radius, focus, + new float[] {0.0f, 0.6f, 1.0f}, + new Color[] {Color.RED, Color.YELLOW, Color.BLUE}, + MultipleGradientPaint.CycleMethod.REPEAT, + MultipleGradientPaint.ColorSpaceType.SRGB, + AffineTransform.getTranslateInstance(1.0, 2.0)); + assertTrue(PaintUtilities.equal(p1, p2)); + } }
