private static Collator getCollationFromParams(String lang, String strength, String decomposition) throws XPathException { Collator collator = null; if(lang == null) { collator = Collator.getInstance(); } else { Locale locale = getLocale(lang); LOG.debug("Using locale: " + locale.toString()); collator = Collator.getInstance(locale); }  if(strength != null) { if("primary".equals(strength)) collator.setStrength(Collator.PRIMARY); else if("secondary".equals(strength)) collator.setStrength(Collator.SECONDARY); else if("tertiary".equals(strength)) collator.setStrength(Collator.TERTIARY); else if(strength.length() == 0 || "identical".equals(strength))  collator.setStrength(Collator.IDENTICAL); else throw new XPathException("Collation strength should be either 'primary', 'secondary', 'tertiary' or 'identical"); }  if(decomposition != null) { if("none".equals(decomposition)) collator.setDecomposition(Collator.NO_DECOMPOSITION); else if("full".equals(decomposition)) collator.setDecomposition(Collator.FULL_DECOMPOSITION); else if(decomposition.length() == 0 || "standard".equals(decomposition))  collator.setDecomposition(Collator.CANONICAL_DECOMPOSITION); else throw new XPathException("Collation decomposition should be either 'none', 'full' or 'standard"); }  return collator; }
private static Collator getCollationFromParams(String lang, String strength, String decomposition) throws XPathException { Collator collator = null; if (lang == null) { collator = Collator.getInstance(); } else if (lang.equals("sme-SE")) {      String Samisk = "< a,A< \u00E1,\u00C1< b,B< c,C" + "< \u010d,\u010c< d,D< \u0111,\u0110< e,E" + "< f,F< g,G< h,H< i,I< j,J< k,K< l,L< m,M" + "< n,N< \u014b,\u014a< o,O< p,P< r,R< s,S" + "< \u0161,\u0160< t,T< \u0167,\u0166< u,U" + "< v,V< z,Z< \u017e,\u017d"; try { collator = new RuleBasedCollator(Samisk); } catch (ParseException pe) { return null; } } else { Locale locale = getLocale(lang); LOG.debug("Using locale: " + locale.toString()); collator = Collator.getInstance(locale); }  if (strength != null) { if ("primary".equals(strength)) collator.setStrength(Collator.PRIMARY); else if ("secondary".equals(strength)) collator.setStrength(Collator.SECONDARY); else if ("tertiary".equals(strength)) collator.setStrength(Collator.TERTIARY); else if (strength.length() == 0 || "identical".equals(strength))  collator.setStrength(Collator.IDENTICAL); else throw new XPathException( "Collation strength should be either 'primary', 'secondary', 'tertiary' or 'identical"); }  if (decomposition != null) { if ("none".equals(decomposition)) collator.setDecomposition(Collator.NO_DECOMPOSITION); else if ("full".equals(decomposition)) collator.setDecomposition(Collator.FULL_DECOMPOSITION); else if (decomposition.length() == 0 || "standard".equals(decomposition))  collator.setDecomposition(Collator.CANONICAL_DECOMPOSITION); else throw new XPathException( "Collation decomposition should be either 'none', 'full' or 'standard"); }  return collator; }
	private static Collator getCollationFromParams(String lang, String strength, String decomposition) 	throws XPathException {		Collator collator = null;		if(lang == null) {			collator = Collator.getInstance();		} else {			Locale locale = getLocale(lang);			LOG.debug("Using locale: " + locale.toString());			collator = Collator.getInstance(locale);		}				if(strength != null) {			if("primary".equals(strength))				collator.setStrength(Collator.PRIMARY);			else if("secondary".equals(strength))				collator.setStrength(Collator.SECONDARY);			else if("tertiary".equals(strength))				collator.setStrength(Collator.TERTIARY);			else if(strength.length() == 0 || "identical".equals(strength))				// the default setting				collator.setStrength(Collator.IDENTICAL);			else				throw new XPathException("Collation strength should be either 'primary', 'secondary', 'tertiary' or 'identical");		}				if(decomposition != null) {			if("none".equals(decomposition))				collator.setDecomposition(Collator.NO_DECOMPOSITION);			else if("full".equals(decomposition))				collator.setDecomposition(Collator.FULL_DECOMPOSITION);			else if(decomposition.length() == 0 || "standard".equals(decomposition))				// the default setting				collator.setDecomposition(Collator.CANONICAL_DECOMPOSITION);			else				throw new XPathException("Collation decomposition should be either 'none', 'full' or 'standard");		}				return collator;	}