[ini4j] 02/04: Fixed the Java 8 compatibility patch (Closes: #772010)
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Thu Dec 4 13:00:35 UTC 2014
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to branch master
in repository ini4j.
commit d8a3a23470af8a338f62f5824d044d7218c9ab4f
Author: Emmanuel Bourg <ebourg at apache.org>
Date: Thu Dec 4 13:50:33 2014 +0100
Fixed the Java 8 compatibility patch (Closes: #772010)
---
debian/changelog | 1 +
debian/patches/01-java8-compatibility.patch | 32 +++++++++++++++++++++++++----
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 071e551..8595ee5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
ini4j (0.5.2-SNAPSHOT-5) UNRELEASED; urgency=medium
* Team upload.
+ * Fixed the Java 8 compatibility patch (Closes: #772010)
* Enabled the unit tests
-- Emmanuel Bourg <ebourg at apache.org> Thu, 04 Dec 2014 12:14:07 +0100
diff --git a/debian/patches/01-java8-compatibility.patch b/debian/patches/01-java8-compatibility.patch
index 2970faf..334c20f 100644
--- a/debian/patches/01-java8-compatibility.patch
+++ b/debian/patches/01-java8-compatibility.patch
@@ -1,7 +1,7 @@
Description: Changes the return type of the org.ini4j.Profile.remove(Object, Object) method
to fix a conflict with the method Map.remove(Object, Object) added in Java 8.
Author: Emmanuel Bourg <ebourg at apache.org>
-Forwarded: no
+Bug: http://sourceforge.net/p/ini4j/bugs/47/
--- a/src/main/java/org/ini4j/Profile.java
+++ b/src/main/java/org/ini4j/Profile.java
@@ -43,7 +43,7 @@
@@ -15,7 +15,7 @@ Forwarded: no
{
--- a/src/main/java/org/ini4j/BasicProfile.java
+++ b/src/main/java/org/ini4j/BasicProfile.java
-@@ -139,11 +139,11 @@
+@@ -139,11 +139,18 @@
return remove((Object) section.getName());
}
@@ -23,9 +23,33 @@ Forwarded: no
+ @Override public boolean remove(Object sectionName, Object optionName)
{
Section sec = get(sectionName);
-
+-
- return (sec == null) ? null : sec.remove(optionName);
-+ return (sec == null) ? false : true;
++ if (sec == null || !sec.containsKey(optionName))
++ {
++ return false;
++ }
++ else
++ {
++ sec.remove(optionName);
++ return true;
++ }
}
boolean isTreeMode()
+--- a/src/test/java/org/ini4j/BasicProfileTest.java
++++ b/src/test/java/org/ini4j/BasicProfileTest.java
+@@ -86,10 +86,10 @@
+ prof.add(SECTION, Dwarf.PROP_FORTUNE_NUMBER, DwarfsData.sneezy.fortuneNumber[2]);
+ prof.add(SECTION, Dwarf.PROP_FORTUNE_NUMBER, DwarfsData.sneezy.fortuneNumber[3]);
+ Helper.assertEquals(DwarfsData.sneezy, prof.get(SECTION).as(Dwarf.class));
+- assertNotNull(prof.remove(SECTION, Dwarf.PROP_FORTUNE_NUMBER));
++ assertTrue(prof.remove(SECTION, Dwarf.PROP_FORTUNE_NUMBER));
+ assertEquals(0, prof.get(SECTION).length(Dwarf.PROP_FORTUNE_NUMBER));
+ assertNotNull(prof.remove(SECTION));
+- assertNull(prof.remove(SECTION, Dwarf.PROP_FORTUNE_NUMBER));
++ assertFalse(prof.remove(SECTION, Dwarf.PROP_FORTUNE_NUMBER));
+ }
+
+ @Test public void testFirstUpper()
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/ini4j.git
More information about the pkg-java-commits
mailing list