mirror of https://github.com/apache/nifi.git
NIFI-225: Set Locale to EN-US for all instances of Collator
This commit is contained in:
parent
93309901ba
commit
4748cbd185
|
@ -23,6 +23,7 @@ import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -41,7 +42,6 @@ import org.apache.nifi.user.NiFiUser;
|
||||||
import org.apache.nifi.web.api.dto.ProcessorConfigDTO;
|
import org.apache.nifi.web.api.dto.ProcessorConfigDTO;
|
||||||
import org.apache.nifi.web.api.dto.ProcessorDTO;
|
import org.apache.nifi.web.api.dto.ProcessorDTO;
|
||||||
import org.apache.nifi.web.dao.ProcessorDAO;
|
import org.apache.nifi.web.dao.ProcessorDAO;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.Around;
|
import org.aspectj.lang.annotation.Around;
|
||||||
|
@ -357,7 +357,7 @@ public class ProcessorAuditor extends NiFiAuditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort them and include in the configuration
|
// sort them and include in the configuration
|
||||||
Collections.sort(autoTerminatedRelationshipNames, Collator.getInstance());
|
Collections.sort(autoTerminatedRelationshipNames, Collator.getInstance(Locale.US));
|
||||||
values.put(AUTO_TERMINATED_RELATIONSHIPS, StringUtils.join(autoTerminatedRelationshipNames, ", "));
|
values.put(AUTO_TERMINATED_RELATIONSHIPS, StringUtils.join(autoTerminatedRelationshipNames, ", "));
|
||||||
}
|
}
|
||||||
if (newConfig.getProperties() != null) {
|
if (newConfig.getProperties() != null) {
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
@ -133,7 +134,7 @@ public final class DtoFactory {
|
||||||
private final static Comparator<Class> CLASS_NAME_COMPARATOR = new Comparator<Class>() {
|
private final static Comparator<Class> CLASS_NAME_COMPARATOR = new Comparator<Class>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Class class1, Class class2) {
|
public int compare(Class class1, Class class2) {
|
||||||
return Collator.getInstance().compare(class1.getSimpleName(), class2.getSimpleName());
|
return Collator.getInstance(Locale.US).compare(class1.getSimpleName(), class2.getSimpleName());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -330,7 +331,7 @@ public final class DtoFactory {
|
||||||
for (final Relationship selectedRelationship : connection.getRelationships()) {
|
for (final Relationship selectedRelationship : connection.getRelationships()) {
|
||||||
if (!Relationship.ANONYMOUS.equals(selectedRelationship)) {
|
if (!Relationship.ANONYMOUS.equals(selectedRelationship)) {
|
||||||
if (dto.getSelectedRelationships() == null) {
|
if (dto.getSelectedRelationships() == null) {
|
||||||
dto.setSelectedRelationships(new TreeSet<String>(Collator.getInstance()));
|
dto.setSelectedRelationships(new TreeSet<String>(Collator.getInstance(Locale.US)));
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.getSelectedRelationships().add(selectedRelationship.getName());
|
dto.getSelectedRelationships().add(selectedRelationship.getName());
|
||||||
|
@ -341,7 +342,7 @@ public final class DtoFactory {
|
||||||
for (final Relationship availableRelationship : connection.getSource().getRelationships()) {
|
for (final Relationship availableRelationship : connection.getSource().getRelationships()) {
|
||||||
if (!Relationship.ANONYMOUS.equals(availableRelationship)) {
|
if (!Relationship.ANONYMOUS.equals(availableRelationship)) {
|
||||||
if (dto.getAvailableRelationships() == null) {
|
if (dto.getAvailableRelationships() == null) {
|
||||||
dto.setAvailableRelationships(new TreeSet<String>(Collator.getInstance()));
|
dto.setAvailableRelationships(new TreeSet<String>(Collator.getInstance(Locale.US)));
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.getAvailableRelationships().add(availableRelationship.getName());
|
dto.getAvailableRelationships().add(availableRelationship.getName());
|
||||||
|
@ -1163,7 +1164,7 @@ public final class DtoFactory {
|
||||||
Collections.sort(relationships, new Comparator<RelationshipDTO>() {
|
Collections.sort(relationships, new Comparator<RelationshipDTO>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(RelationshipDTO r1, RelationshipDTO r2) {
|
public int compare(RelationshipDTO r1, RelationshipDTO r2) {
|
||||||
return Collator.getInstance().compare(r1.getName(), r2.getName());
|
return Collator.getInstance(Locale.US).compare(r1.getName(), r2.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1492,7 +1493,7 @@ public final class DtoFactory {
|
||||||
final Map<PropertyDescriptor, String> sortedProperties = new TreeMap<>(new Comparator<PropertyDescriptor>() {
|
final Map<PropertyDescriptor, String> sortedProperties = new TreeMap<>(new Comparator<PropertyDescriptor>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(PropertyDescriptor o1, PropertyDescriptor o2) {
|
public int compare(PropertyDescriptor o1, PropertyDescriptor o2) {
|
||||||
return Collator.getInstance().compare(o1.getName(), o2.getName());
|
return Collator.getInstance(Locale.US).compare(o1.getName(), o2.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sortedProperties.putAll(procNode.getProperties());
|
sortedProperties.putAll(procNode.getProperties());
|
||||||
|
@ -1989,7 +1990,7 @@ public final class DtoFactory {
|
||||||
} else if (name1 == null) {
|
} else if (name1 == null) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
int compareResult = Collator.getInstance().compare(name2, name2);
|
int compareResult = Collator.getInstance(Locale.US).compare(name2, name2);
|
||||||
|
|
||||||
// if the names are same, use the id
|
// if the names are same, use the id
|
||||||
if (compareResult == 0) {
|
if (compareResult == 0) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
@ -108,7 +109,6 @@ import org.apache.nifi.web.api.dto.status.ControllerStatusDTO;
|
||||||
import org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO;
|
import org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO;
|
||||||
import org.apache.nifi.web.api.dto.status.StatusHistoryDTO;
|
import org.apache.nifi.web.api.dto.status.StatusHistoryDTO;
|
||||||
import org.apache.nifi.web.util.DownloadableContent;
|
import org.apache.nifi.web.util.DownloadableContent;
|
||||||
|
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.nifi.admin.service.UserService;
|
import org.apache.nifi.admin.service.UserService;
|
||||||
|
@ -893,7 +893,7 @@ public class ControllerFacade implements ControllerServiceProvider {
|
||||||
final Comparator<AttributeDTO> attributeComparator = new Comparator<AttributeDTO>() {
|
final Comparator<AttributeDTO> attributeComparator = new Comparator<AttributeDTO>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(AttributeDTO a1, AttributeDTO a2) {
|
public int compare(AttributeDTO a1, AttributeDTO a2) {
|
||||||
return Collator.getInstance().compare(a1.getName(), a2.getName());
|
return Collator.getInstance(Locale.US).compare(a1.getName(), a2.getName());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -987,12 +987,12 @@ public class ControllerFacade implements ControllerServiceProvider {
|
||||||
|
|
||||||
// parent uuids
|
// parent uuids
|
||||||
final List<String> parentUuids = new ArrayList<>(event.getParentUuids());
|
final List<String> parentUuids = new ArrayList<>(event.getParentUuids());
|
||||||
Collections.sort(parentUuids, Collator.getInstance());
|
Collections.sort(parentUuids, Collator.getInstance(Locale.US));
|
||||||
dto.setParentUuids(parentUuids);
|
dto.setParentUuids(parentUuids);
|
||||||
|
|
||||||
// child uuids
|
// child uuids
|
||||||
final List<String> childUuids = new ArrayList<>(event.getChildUuids());
|
final List<String> childUuids = new ArrayList<>(event.getChildUuids());
|
||||||
Collections.sort(childUuids, Collator.getInstance());
|
Collections.sort(childUuids, Collator.getInstance(Locale.US));
|
||||||
dto.setChildUuids(childUuids);
|
dto.setChildUuids(childUuids);
|
||||||
|
|
||||||
return dto;
|
return dto;
|
||||||
|
|
|
@ -18,8 +18,10 @@ package org.apache.nifi.web.docs;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import javax.servlet.ServletConfig;
|
import javax.servlet.ServletConfig;
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
@ -27,6 +29,7 @@ import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.nifi.nar.ExtensionMapping;
|
import org.apache.nifi.nar.ExtensionMapping;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
@ -55,7 +58,7 @@ public class DocumentationController extends HttpServlet {
|
||||||
@Override
|
@Override
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
final ExtensionMapping extensionMappings = (ExtensionMapping) servletContext.getAttribute("nifi-extension-mapping");
|
final ExtensionMapping extensionMappings = (ExtensionMapping) servletContext.getAttribute("nifi-extension-mapping");
|
||||||
final Collator collator = Collator.getInstance();
|
final Collator collator = Collator.getInstance(Locale.US);
|
||||||
|
|
||||||
// create the processors lookup
|
// create the processors lookup
|
||||||
final Map<String, String> processors = new TreeMap<>(collator);
|
final Map<String, String> processors = new TreeMap<>(collator);
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -63,10 +64,10 @@ import org.apache.nifi.web.NiFiWebContext;
|
||||||
import org.apache.nifi.web.NiFiWebContextConfig;
|
import org.apache.nifi.web.NiFiWebContextConfig;
|
||||||
import org.apache.nifi.web.ProcessorInfo;
|
import org.apache.nifi.web.ProcessorInfo;
|
||||||
import org.apache.nifi.web.Revision;
|
import org.apache.nifi.web.Revision;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.sun.jersey.api.NotFoundException;
|
import com.sun.jersey.api.NotFoundException;
|
||||||
|
|
||||||
import org.apache.nifi.update.attributes.FlowFilePolicy;
|
import org.apache.nifi.update.attributes.FlowFilePolicy;
|
||||||
import org.apache.nifi.update.attributes.entity.EvaluationContextEntity;
|
import org.apache.nifi.update.attributes.entity.EvaluationContextEntity;
|
||||||
|
|
||||||
|
@ -443,7 +444,7 @@ public class RuleResource {
|
||||||
Collections.sort(ruleDtos, new Comparator<RuleDTO>() {
|
Collections.sort(ruleDtos, new Comparator<RuleDTO>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(RuleDTO r1, RuleDTO r2) {
|
public int compare(RuleDTO r1, RuleDTO r2) {
|
||||||
final Collator collator = Collator.getInstance();
|
final Collator collator = Collator.getInstance(Locale.US);
|
||||||
return collator.compare(r1.getName(), r2.getName());
|
return collator.compare(r1.getName(), r2.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
package org.apache.nifi.update.attributes.dto;
|
package org.apache.nifi.update.attributes.dto;
|
||||||
|
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,7 +60,7 @@ public class ActionDTO implements Comparable<ActionDTO> {
|
||||||
// including the id in the comparison so that the TreeSet that this
|
// including the id in the comparison so that the TreeSet that this
|
||||||
// is stored in does not discard any entries just because their attributes
|
// is stored in does not discard any entries just because their attributes
|
||||||
// or values are equal
|
// or values are equal
|
||||||
final Collator collator = Collator.getInstance();
|
final Collator collator = Collator.getInstance(Locale.US);
|
||||||
final String thisCmpStr = getAttribute() + "_" + getValue() + "_" + getId();
|
final String thisCmpStr = getAttribute() + "_" + getValue() + "_" + getId();
|
||||||
final String thatCmpStr = that.getAttribute() + "_" + that.getValue() + "_" + that.getId();
|
final String thatCmpStr = that.getAttribute() + "_" + that.getValue() + "_" + that.getId();
|
||||||
return collator.compare(thisCmpStr, thatCmpStr);
|
return collator.compare(thisCmpStr, thatCmpStr);
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
package org.apache.nifi.update.attributes.dto;
|
package org.apache.nifi.update.attributes.dto;
|
||||||
|
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +51,7 @@ public class ConditionDTO implements Comparable<ConditionDTO> {
|
||||||
// including the id in the comparison so that the TreeSet that this
|
// including the id in the comparison so that the TreeSet that this
|
||||||
// is stored in does not discard any entries just because their expressions
|
// is stored in does not discard any entries just because their expressions
|
||||||
// are equal
|
// are equal
|
||||||
final Collator collator = Collator.getInstance();
|
final Collator collator = Collator.getInstance(Locale.US);
|
||||||
final String thisCmpStr = getExpression() + "_" + getId();
|
final String thisCmpStr = getExpression() + "_" + getId();
|
||||||
final String thatCmpStr = that.getExpression() + "_" + that.getId();
|
final String thatCmpStr = that.getExpression() + "_" + that.getId();
|
||||||
return collator.compare(thisCmpStr, thatCmpStr);
|
return collator.compare(thisCmpStr, thatCmpStr);
|
||||||
|
|
Loading…
Reference in New Issue