Index: portal-ejb/src/com/liferay/portlet/weather/WeatherPreferencesValidator.java =================================================================== --- portal-ejb/src/com/liferay/portlet/weather/WeatherPreferencesValidator.java (revision 4867) +++ portal-ejb/src/com/liferay/portlet/weather/WeatherPreferencesValidator.java (working copy) @@ -22,9 +22,6 @@ package com.liferay.portlet.weather; -import com.liferay.portlet.weather.model.Weather; -import com.liferay.portlet.weather.util.WeatherUtil; - import java.util.ArrayList; import java.util.List; @@ -32,11 +29,14 @@ import javax.portlet.PreferencesValidator; import javax.portlet.ValidatorException; +import com.liferay.portlet.weather.model.Weather; +import com.liferay.portlet.weather.util.WeatherUtil; + /** * View Source - * + * * @author Brian Wing Shun Chan - * + * */ public class WeatherPreferencesValidator implements PreferencesValidator { @@ -46,16 +46,19 @@ String[] zips = prefs.getValues("zips", new String[0]); for (int i = 0; i < zips.length; i++) { - Weather weather = WeatherUtil.getWeather(zips[i]); + String zip = zips[i]; + int index = zip.indexOf("|"); + if (index > -1) + zip = zip.substring(0, index); + Weather weather = WeatherUtil.getWeather(zip); if (weather == null) { - badZips.add(zips[i]); + badZips.add(zip); } } if (badZips.size() > 0) { - throw new ValidatorException( - "Failed to retrieve zips", badZips); + throw new ValidatorException("Failed to retrieve zips", badZips); } } Index: portal-web/docroot/html/portlet/weather/view.jsp =================================================================== --- portal-web/docroot/html/portlet/weather/view.jsp (revision 4867) +++ portal-web/docroot/html/portlet/weather/view.jsp (working copy) @@ -30,14 +30,23 @@ <% for (int i = 0; i < zips.length; i++) { - Weather weather = WeatherUtil.getWeather(zips[i]); + String zip = zips[i]; + String friendlyName = zip; + int index = zip.indexOf("|"); + if (index > -1) { + friendlyName = zip.substring(index + 1); + zip = zip.substring(0, index); + if (friendlyName.length() < 1) + friendlyName = zip; + } + Weather weather = WeatherUtil.getWeather(zip); if (weather != null) { %> - <%= weather.getZip() %> + <%= friendlyName %>