aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Jacob <mjacob@union06.de>2013-11-07 06:14:42 +0100
committerMarco Jacob <mjacob@union06.de>2013-11-07 06:14:42 +0100
commit01f6c1185d8d24760a802e40e6a2c5a5b7705df8 (patch)
treeff112984bbde386a3ff3e183316604e1fcdf7389
parenta170e86615c7f49a74c7ed9226eed8b1a9dd0c54 (diff)
downloadcgeo-01f6c1185d8d24760a802e40e6a2c5a5b7705df8.zip
cgeo-01f6c1185d8d24760a802e40e6a2c5a5b7705df8.tar.gz
cgeo-01f6c1185d8d24760a802e40e6a2c5a5b7705df8.tar.bz2
fixes #3370 #2960 #1320 - also keep empty and null values for hint, short description and attributes
-rw-r--r--main/src/cgeo/geocaching/Geocache.java6
-rw-r--r--tests/src/cgeo/geocaching/GeocacheTest.java8
2 files changed, 11 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index 35d6c17..7c3a2d6 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -253,7 +253,7 @@ public class Geocache implements ICache, IWaypoint {
if (hidden == null) {
hidden = other.hidden;
}
- if (StringUtils.isBlank(getHint())) {
+ if (!detailed && StringUtils.isBlank(getHint())) {
hint = other.getHint();
}
if (size == null || CacheSize.UNKNOWN == size) {
@@ -284,7 +284,7 @@ public class Geocache implements ICache, IWaypoint {
final PersonalNote mergedNote = myNote.mergeWith(otherNote);
personalNote = mergedNote.toString();
}
- if (StringUtils.isBlank(getShortDescription())) {
+ if (!detailed && StringUtils.isBlank(getShortDescription())) {
shortdesc = other.getShortDescription();
}
if (StringUtils.isBlank(getDescription())) {
@@ -304,7 +304,7 @@ public class Geocache implements ICache, IWaypoint {
if (myVote == 0) {
myVote = other.myVote;
}
- if (attributes.isEmpty()) {
+ if (!detailed && attributes.isEmpty()) {
attributes.clear();
if (other.attributes != null) {
attributes.addAll(other.attributes);
diff --git a/tests/src/cgeo/geocaching/GeocacheTest.java b/tests/src/cgeo/geocaching/GeocacheTest.java
index f7e4e84..5d9a31c 100644
--- a/tests/src/cgeo/geocaching/GeocacheTest.java
+++ b/tests/src/cgeo/geocaching/GeocacheTest.java
@@ -100,6 +100,11 @@ public class GeocacheTest extends CGeoTestCase {
stored.setType(CacheType.TRADITIONAL);
stored.setCoords(new Geopoint(40.0, 8.0));
stored.setDescription("Test1");
+ ArrayList<String> attributes = new ArrayList<String>(1);
+ attributes.add("TestAttribute");
+ stored.setAttributes(attributes);
+ stored.setShortDescription("Short");
+ stored.setHint("Hint");
Geocache download = new Geocache();
download.setGeocode("GC12345");
@@ -117,6 +122,9 @@ public class GeocacheTest extends CGeoTestCase {
assertEquals("Longitude not merged correctly", 9.0, download.getCoords().getLongitude(), 0.1);
assertEquals("Latitude not merged correctly", 41.0, download.getCoords().getLatitude(), 0.1);
assertEquals("Description not merged correctly", "Test2", download.getDescription());
+ assertEquals("ShortDescription not merged correctly", "", download.getShortDescription());
+ assertEquals("Attributes not merged correctly", new ArrayList<String>(0), download.getAttributes());
+ assertEquals("Hint not merged correctly", "", download.getHint());
}
public static void testMergeLivemapStored() {