URN_Parser.java (geotools-24.0-project) | : | URN_Parser.java (geotools-24.1-project) | ||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
* version 2.1 of the License. | * version 2.1 of the License. | |||
* | * | |||
* This library is distributed in the hope that it will be useful, | * This library is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | * Lesser General Public License for more details. | |||
*/ | */ | |||
package org.geotools.referencing.factory; | package org.geotools.referencing.factory; | |||
import org.apache.commons.lang3.StringUtils; | ||||
import org.geotools.metadata.i18n.ErrorKeys; | import org.geotools.metadata.i18n.ErrorKeys; | |||
import org.geotools.metadata.i18n.Errors; | import org.geotools.metadata.i18n.Errors; | |||
import org.geotools.util.Version; | import org.geotools.util.Version; | |||
import org.opengis.referencing.NoSuchAuthorityCodeException; | import org.opengis.referencing.NoSuchAuthorityCodeException; | |||
/** | /** | |||
* Split a URN into its {@link #type} and {@link #version} parts for {@link URN_ AuthorityFactory}. | * Split a URN into its {@link #type} and {@link #version} parts for {@link URN_ AuthorityFactory}. | |||
* This class must be immutable in order to avoid the need for synchronization i n the authority | * This class must be immutable in order to avoid the need for synchronization i n the authority | |||
* factory. | * factory. | |||
* | * | |||
skipping to change at line 105 | skipping to change at line 106 | |||
urnCode = code.substring(versionEnd + 1).trim(); | urnCode = code.substring(versionEnd + 1).trim(); | |||
urnCode = urnCode.replaceAll(String.valueOf(URN_ SEPARATOR), ","); | urnCode = urnCode.replaceAll(String.valueOf(URN_ SEPARATOR), ","); | |||
} else { | } else { | |||
urnVersion = | urnVersion = | |||
(lastEnd <= nameEnd) | (lastEnd <= nameEnd) | |||
? null | ? null | |||
: new Version(code.substring(nam eEnd + 1, lastEnd)); | : new Version(code.substring(nam eEnd + 1, lastEnd)); | |||
urnAuthority = code.substring(typeEnd + 1, nameE nd).trim(); | urnAuthority = code.substring(typeEnd + 1, nameE nd).trim(); | |||
urnCode = code.substring(lastEnd + 1).trim(); | urnCode = code.substring(lastEnd + 1).trim(); | |||
} | } | |||
// handle empty version | ||||
urnVersion = (StringUtils.isEmpty(urnVersion)) ? nul | ||||
l : urnVersion; | ||||
if (urnCode.contains("CRS")) { | if (urnCode.contains("CRS")) { | |||
urnAuthority = "CRS"; | urnAuthority = "CRS"; | |||
urnCode = urnCode.substring(3); | urnCode = urnCode.substring(3); | |||
} else if (urnCode.contains("AUTO")) { | } else if (urnCode.contains("AUTO")) { | |||
urnAuthority = "AUTO"; | urnAuthority = "AUTO"; | |||
urnCode = urnCode.substring(4); | urnCode = urnCode.substring(4); | |||
} | } | |||
URI_Type urnType = candidate; | URI_Type urnType = candidate; | |||
return new URN_Parser(urn, urnType, urnAuthority, ur nVersion, urnCode); | return new URN_Parser(urn, urnType, urnAuthority, ur nVersion, urnCode); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 4 lines changed or added |