Source:
<code>OSMTurnRelation createTurnRelation(ReaderRelation relation) { <START> String tagRestriction = null; <END> String vehicleTypeRestricted = null; List<String> vehicleTypesExcept = null; if (relation.hasTag("restriction")) { tagRestriction = relation.getTag("restriction"); } else if (relation.hasTagStartsWith("restriction:")) { vehicleTypeRestricted = relation.getKeyStartsWith("restriction:"); if (!Helper.isEmpty(vehicleTypeRestricted)) { tagRestriction = relation.getTag(vehicleTypeRestricted); vehicleTypeRestricted = vehicleTypeRestricted.replace("restriction:", ""); } } if (relation.hasTag("except")) { String tagExcept = relation.getTag("except"); if (!Helper.isEmpty(tagExcept)) { vehicleTypesExcept = new ArrayList<>(Arrays.asList(tagExcept.split(";"))); } } OSMTurnRelation.Type type = OSMTurnRelation.Type.getRestrictionType(tagRestriction); if (type != OSMTurnRelation.Type.UNSUPPORTED) { long fromWayID = -1; long viaNodeID = -1; long toWayID = -1; for (ReaderRelation.Member member : relation.getMembers()) { if (ReaderElement.WAY == member.getType()) { if ("from".equals(member.getRole())) { fromWayID = member.getRef(); } else if ("to".equals(member.getRole())) { toWayID = member.getRef(); } } else if (ReaderElement.NODE == member.getType() && "via".equals(member.getRole())) { viaNodeID = member.getRef(); } } if (fromWayID >= 0 && toWayID >= 0 && viaNodeID >= 0) { return new OSMTurnRelation(fromWayID, viaNodeID, toWayID, type, vehicleTypeRestricted, vehicleTypesExcept); } } return null; }</code><technical_language>start empty string empty list instead, need check for empty instead of null empty</technical_language>

Target:
OSMTurnRelation createTurnRelation(ReaderRelation relation) { String tagRestriction = ""; String vehicleTypeRestricted = ""; List<String> vehicleTypesExcept = new ArrayList<>(); if (relation.hasTag("restriction")) { tagRestriction = relation.getTag("restriction"); } else if (relation.hasTagStartsWith("restriction:")) { vehicleTypeRestricted = relation.getKeyStartsWith("restriction:"); tagRestriction = relation.getTag(vehicleTypeRestricted); vehicleTypeRestricted = vehicleTypeRestricted.replace("restriction:", "").trim(); } if (relation.hasTag("except")) { String tagExcept = relation.getTag("except"); if (!Helper.isEmpty(tagExcept)) { List<String> vehicleTypes = new ArrayList<>(Arrays.asList(tagExcept.split(";"))); for (String vehicleType : vehicleTypes) vehicleTypesExcept.add(vehicleType.trim()); } } OSMTurnRelation.Type type = OSMTurnRelation.Type.getRestrictionType(tagRestriction); if (type != OSMTurnRelation.Type.UNSUPPORTED) { long fromWayID = -1; long viaNodeID = -1; long toWayID = -1; for (ReaderRelation.Member member : relation.getMembers()) { if (ReaderElement.WAY == member.getType()) { if ("from".equals(member.getRole())) { fromWayID = member.getRef(); } else if ("to".equals(member.getRole())) { toWayID = member.getRef(); } } else if (ReaderElement.NODE == member.getType() && "via".equals(member.getRole())) { viaNodeID = member.getRef(); } } if (fromWayID >= 0 && toWayID >= 0 && viaNodeID >= 0) { OSMTurnRelation osmTurnRelation = new OSMTurnRelation(fromWayID, viaNodeID, toWayID, type); osmTurnRelation.setVehicleTypeRestricted(vehicleTypeRestricted); osmTurnRelation.addVehicleTypesExcept(vehicleTypesExcept); return osmTurnRelation; } } return null; }