/**************************************************************************
 Exchange Web Services Java API
 Copyright (c) Microsoft Corporation
 All rights reserved.
 MIT License
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 **************************************************************************/

package microsoft.exchange.webservices.data;

/**
 * Represents a dictionary of phone numbers.
 * 
 */
@EditorBrowsable(state = EditorBrowsableState.Never)
public final class PhoneNumberDictionary extends
		DictionaryProperty<PhoneNumberKey, PhoneNumberEntry> {

	/**
	 * Gets the field URI.
	 * 
	 * @return Field URI.
	 */
	@Override
	protected String getFieldURI() {
		return "contacts:PhoneNumber";
	}

	/**
	 * Creates instance of dictionary entry.
	 * 
	 * @return New instance.
	 */
	@Override
	protected PhoneNumberEntry createEntryInstance() {
		return new PhoneNumberEntry();
	}

	/**
	 * Gets  the phone number at the specified key.
	 * 
	 * @param key
	 *            the key
	 * @return The phone number at the specified key.
	 */
	public String getPhoneNumber(PhoneNumberKey key) {
		return this.getEntries().get(key).getPhoneNumber();
	}

	/**
	 * Sets the phone number.
	 * 
	 * @param key
	 *            the key
	 * @param value
	 *            the value
	 */
	public void setPhoneNumber(PhoneNumberKey key, String value) {
		if (value == null) {
			this.internalRemove(key);
		} else {
			PhoneNumberEntry entry;

			if (this.getEntries().containsKey(key)) {
				entry = this.getEntries().get(key);
				entry.setPhoneNumber(value);
				complexPropertyChanged( entry );
				this.changed();
			} else {
				entry = new PhoneNumberEntry(key, value);
				this.internalAdd(entry);
			}
		}
	}

	/**
	 * Tries to get the phone number associated with the specified key.
	 * 
	 * @param key
	 *            the key
	 * @param outparam
	 *            the outparam
	 * @return true if the Dictionary contains a phone number associated with
	 *         the specified key; otherwise, false.
	 */
	public boolean tryGetValue(PhoneNumberKey key, OutParam<String> outparam) {
		PhoneNumberEntry entry = null;

		if (this.getEntries().containsKey(key)) {
			entry = this.getEntries().get(key);
			outparam.setParam(entry.getPhoneNumber());
			return true;
		} else {
			outparam = null;
			return false;
		}
	}
}

@@ -1940,39 +1940,38 @@
 aram key
-%0A%09 *            the
+ The phone number
  key
+.
 %0A%09 * @re
@@ -2008,24 +2008,49 @@
 pecified key
+ if found; otherwise null
 .%0A%09 */%0A%09publ
@@ -2102,41 +2102,152 @@
 %7B%0A%09%09
-return this.getEntries().get(key)
+PhoneNumberEntry phoneNumberEntry = this.getEntries().get(key);%0A%09%09if (phoneNumberEntry == null) %7B%0A%09%09%09return null;%0A%09%09%7D%0A%0A%09%09return phoneNumberEntry
 .get
@@ -3186,25 +3186,32 @@
 tparam) %7B%0A%09%09
-P
+String p
 honeNumberEn
@@ -3212,113 +3212,88 @@
 mber
-Entry entry = null;%0A%0A%09%09if (this.getEntries().containsKey(key)) %7B%0A%09%09%09entry = this.getEntries().get(key);%0A%09
+ = this.getPhoneNumber(key);%0A%09%09if (phoneNumber == null) %7B%0A%09%09%09return false;%0A%09%09%7D%0A%0A
 %09%09ou
@@ -3312,18 +3312,9 @@
 ram(
-entry.getP
+p
 hone
@@ -3323,16 +3323,13 @@
 mber
-()
 );%0A%09%09
-%09
 retu
@@ -3341,60 +3341,8 @@
 ue;%0A
-%09%09%7D else %7B%0A%09%09%09outparam = null;%0A%09%09%09return false;%0A%09%09%7D%0A
 %09%7D%0A%7D

Fix #85: PhoneNumberDictionary.getPhoneNumber throws NullPointerException