Author: desruisseaux
Date: Wed Jun 25 20:42:45 2014
New Revision: 1605595
URL: http://svn.apache.org/r1605595
Log:
Merge bug fix from JDK7 branch.
Modified:
sis/branches/JDK6/ (props changed)
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/LegacyProperties.java
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
Merged /sis/branches/JDK8:r1605537-1605593
Merged /sis/branches/JDK7:r1605538-1605594
Modified:
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/LegacyProperties.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/LegacyProperties.java?rev=1605595&r1=1605594&r2=1605595&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/LegacyProperties.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/LegacyProperties.java
[UTF-8] Wed Jun 25 20:42:45 2014
@@ -67,7 +67,17 @@ public abstract class LegacyProperties<L
protected abstract L unwrap(final N value);
/**
- * Count the number of non-null elements.
+ * Returns {@code true} if this collection is empty.
+ *
+ * @return {@code true} if this collection is empty.
+ */
+ @Override
+ public final boolean isEmpty() {
+ return !iterator().hasNext();
+ }
+
+ /**
+ * Counts the number of non-null elements.
*
* @return Number of non-null elements.
*/
@@ -89,7 +99,7 @@ public abstract class LegacyProperties<L
* @return {@code true} if the element has been added.
*/
@Override
- public boolean add(final L element) {
+ public final boolean add(final L element) {
ArgumentChecks.ensureNonNull("element", element);
return elements.add(wrap(element));
}
@@ -100,7 +110,7 @@ public abstract class LegacyProperties<L
* @return Iterator over the legacy elements.
*/
@Override
- public Iterator<L> iterator() {
+ public final Iterator<L> iterator() {
final Iterator<N> it = elements.iterator();
return new Iterator<L>() {
/** The next value to return, or {@code null} if not yet verified.
*/
@@ -108,7 +118,7 @@ public abstract class LegacyProperties<L
/** Returns {@code true} if there is more elements to iterator. */
@Override
- public boolean hasNext() {
+ public final boolean hasNext() {
if (next != null) {
return true;
}
@@ -123,7 +133,7 @@ public abstract class LegacyProperties<L
/** Returns the next element. */
@Override
- public L next() {
+ public final L next() {
L n = next;
if (n == null) {
if (!hasNext()) {
@@ -137,7 +147,7 @@ public abstract class LegacyProperties<L
/** Removes the last element returned by {@link #next()}. */
@Override
- public void remove() {
+ public final void remove() {
it.remove();
}
};
Modified:
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java?rev=1605595&r1=1605594&r2=1605595&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
[UTF-8] Wed Jun 25 20:42:45 2014
@@ -37,6 +37,8 @@ import org.apache.sis.metadata.iso.ISOMe
import org.apache.sis.metadata.iso.quality.DefaultScope;
import org.apache.sis.metadata.iso.citation.DefaultCitationDate;
import org.apache.sis.internal.metadata.LegacyProperties;
+import org.apache.sis.internal.metadata.MetadataUtilities;
+import org.apache.sis.util.resources.Messages;
/**
@@ -244,6 +246,14 @@ public class DefaultMaintenanceInformati
@Deprecated
public void setDateOfNextUpdate(final Date newValue) {
if (newValue != null) {
+ if (maintenanceDates != null) {
+ for (final CitationDate date : maintenanceDates) {
+ if (date instanceof DefaultCitationDate &&
DateType.NEXT_UPDATE.equals(date.getDateType())) {
+ ((DefaultCitationDate) date).setDate(newValue);
+ return;
+ }
+ }
+ }
getMaintenanceDates().add(new DefaultCitationDate(newValue,
DateType.NEXT_UPDATE));
}
}
@@ -310,6 +320,7 @@ public class DefaultMaintenanceInformati
@Override protected Scope wrap(final ScopeCode code) {
return new DefaultScope(code);
}
+
@Override protected ScopeCode unwrap(final Scope scope) {
return scope.getLevel();
}
@@ -358,14 +369,26 @@ public class DefaultMaintenanceInformati
@XmlElement(name = "updateScopeDescription")
public Collection<ScopeDescription> getUpdateScopeDescriptions() {
return new
LegacyProperties<ScopeDescription,Scope>(getMaintenanceScopes()) {
+ private boolean warningOccurred;
+
@Override protected Scope wrap(final ScopeDescription code) {
final DefaultScope scope = new DefaultScope();
scope.setLevelDescription(Collections.singleton(code));
return scope;
}
+
@Override protected ScopeDescription unwrap(final Scope scope) {
- final Iterator<? extends ScopeDescription> i =
scope.getLevelDescription().iterator();
- return (i.hasNext()) ? i.next() : null;
+ final Iterator<? extends ScopeDescription> it =
scope.getLevelDescription().iterator();
+ if (!it.hasNext()) {
+ return null;
+ }
+ final ScopeDescription description = it.next();
+ if (!warningOccurred && it.hasNext()) {
+ warningOccurred = true;
+
MetadataUtilities.warning(DefaultMaintenanceInformation.class,
"getUpdateScopeDescriptions",
+ Messages.Keys.IgnoredPropertiesAfterFirst_1,
ScopeDescription.class);
+ }
+ return description;
}
};
}
Modified:
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java?rev=1605595&r1=1605594&r2=1605595&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
[UTF-8] Wed Jun 25 20:42:45 2014
@@ -71,6 +71,11 @@ public final class Messages extends Inde
public static final short DiscardedExclusiveProperty_2 = 2;
/**
+ * Ignored properties after the first occurrence of ‘{0}’.
+ */
+ public static final short IgnoredPropertiesAfterFirst_1 = 6;
+
+ /**
* Text were discarded for some locales.
*/
public static final short LocalesDiscarded = 3;
@@ -81,7 +86,7 @@ public final class Messages extends Inde
public static final short PropertyHiddenBy_2 = 4;
/**
- * Can not parse “{1}” as an instance of {0}. The value is stored as
plain text instead, but
+ * Can not parse “{1}” as an instance of ‘{0}’. The value is stored as
plain text instead, but
* will be ignored by some processing.
*/
public static final short UnparsableValueStoredAsText_2 = 5;
Modified:
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties?rev=1605595&r1=1605594&r2=1605595&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
[ISO-8859-1] (original)
+++
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
[ISO-8859-1] Wed Jun 25 20:42:45 2014
@@ -17,6 +17,7 @@
AlreadyRegistered_2 = {0} \u201c{1}\u201d is already registered.
The second instance will be ignored.
ChangedContainerCapacity_2 = Changed the container capacity from {0} to
{1} elements.
DiscardedExclusiveProperty_2 = Property \u201c{0}\u201d has been discarded
in favor of \u201c{1}\u201d, because those two properties are mutually
exclusive.
+IgnoredPropertiesAfterFirst_1 = Ignored properties after the first
occurrence of \u2018{0}\u2019.
PropertyHiddenBy_2 = Property \u201c{0}\u201d is hidden by
\u201c{1}\u201d.
LocalesDiscarded = Text were discarded for some locales.
-UnparsableValueStoredAsText_2 = Can not parse \u201c{1}\u201d as an instance
of {0}. The value is stored as plain text instead, but will be ignored by some
processing.
+UnparsableValueStoredAsText_2 = Can not parse \u201c{1}\u201d as an instance
of \u2018{0}\u2019. The value is stored as plain text instead, but will be
ignored by some processing.
Modified:
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties?rev=1605595&r1=1605594&r2=1605595&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
[ISO-8859-1] (original)
+++
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
[ISO-8859-1] Wed Jun 25 20:42:45 2014
@@ -17,6 +17,7 @@
AlreadyRegistered_2 = Le {0} \u00ab\u202f{1}\u202f\u00bb est
d\u00e9j\u00e0 inscrit dans le registre. La seconde instance sera ignor\u00e9e.
ChangedContainerCapacity_2 = Changement de la capacit\u00e9 du conteneur
de {0} vers {1} \u00e9l\u00e9ments.
DiscardedExclusiveProperty_2 = La propri\u00e9t\u00e9
\u00ab\u202f{0}\u202f\u00bb a \u00e9t\u00e9 \u00e9cart\u00e9e en faveur de
\u00ab\u202f{1}\u202f\u00bb, parce que ces deux propri\u00e9t\u00e9s sont
mutuellement exclusives.
+IgnoredPropertiesAfterFirst_1 = Des propri\u00e9t\u00e9s ont \u00e9t\u00e9
ignor\u00e9es apr\u00e8s la premi\u00e8re occurrence de \u2018{0}\u2019.
PropertyHiddenBy_2 = La propri\u00e9t\u00e9
\u00ab\u202f{0}\u202f\u00bb est masqu\u00e9e par \u00ab\u202f{1}\u202f\u00bb.
LocalesDiscarded = Des textes ont \u00e9t\u00e9 ignor\u00e9s
pour certaines langues.
-UnparsableValueStoredAsText_2 = La valeur \u00ab\u202f{1}\u202f\u00bb ne
peut pas \u00eatre interpr\u00e9t\u00e9e comme une instance de {0}. Elle est
donc m\u00e9moris\u00e9e sous sa forme textuelle, mais sera ignor\u00e9e par
certains traitements.
+UnparsableValueStoredAsText_2 = La valeur \u00ab\u202f{1}\u202f\u00bb ne
peut pas \u00eatre interpr\u00e9t\u00e9e comme une instance de \u2018{0}\u2019.
Elle est donc m\u00e9moris\u00e9e sous sa forme textuelle, mais sera
ignor\u00e9e par certains traitements.