Bug 152543 [DataBinding] ValueBinding NPE when update target from model is false
When a ValueBinding is constructed and instructed not to update the target from the model via the BindSpec a NPE is thrown when it tries to access the modelToTargetConverter. Exception in thread "main" java.lang.NullPointerException at org.eclipse.jface.internal.databinding.internal.ValueBinding.doUpdateTargetFromModel(ValueBinding.java:268) at org.eclipse.jface.internal.databinding.internal.ValueBinding.updateTargetFromModel(ValueBinding.java:250) at org.eclipse.jface.internal.databinding.internal.ValueBinding.<init>(ValueBinding.java:112) at Snippet.main(Snippet.java:32) Attaching patch...
bundles/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/internal/ValueBinding.java
package org.eclipse.jface.internal.databinding.internal;
import org.eclipse.jface.databinding.BindSpec;
import org.eclipse.jface.databinding.BindingEvent;
import org.eclipse.jface.databinding.BindingException;
import org.eclipse.jface.databinding.DataBindingContext;
import org.eclipse.jface.databinding.observable.Diffs;
import org.eclipse.jface.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.observable.value.IValueChangeListener;
import org.eclipse.jface.databinding.observable.value.IValueChangingListener;
import org.eclipse.jface.databinding.observable.value.IVetoableValue;
import org.eclipse.jface.databinding.observable.value.ValueDiff;
import org.eclipse.jface.databinding.observable.value.WritableValue;
import org.eclipse.jface.internal.databinding.provisional.conversion.IConverter;
import org.eclipse.jface.internal.databinding.provisional.validation.IDomainValidator;
import org.eclipse.jface.internal.databinding.provisional.validation.IValidator;
import org.eclipse.jface.internal.databinding.provisional.validation.ValidationError;
/**
 * @since 1.0
 * 
 * implementation note: this class extends a deprecated class for backwards compatibility
 */
public class ValueBinding extends org.eclipse.jface.internal.databinding.provisional.Binding {
	private final IObservableValue target;
	private final IObservableValue model;
	private IValidator targetValidator;
	private IConverter targetToModelConverter;
	private IConverter modelToTargetConverter;
	private IDomainValidator domainValidator;
	private boolean updating = false;
	private WritableValue partialValidationErrorObservable = new WritableValue(