Source:
public AdvancedTabViewModel(DialogService dialogService, JabRefPreferences preferences) { this.dialogService = dialogService; this.preferences = preferences; this.remotePreferences = preferences.getRemotePreferences(); this.proxyPreferences = preferences.getProxyPreferences(); setValues(); remotePortValidator = new FunctionBasedValidator<>( remotePortProperty, input -> { try { int portNumber = Integer.parseInt(remotePortProperty().getValue()); if (RemoteUtil.isUserPort(portNumber)) { return true; } return false; } catch (NumberFormatException ex) { return false; } }, ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Advanced"), Localization.lang("Remote operation"), Localization.lang("You must enter an integer value in the interval 1025-65535")))); proxyHostnameValidator = new FunctionBasedValidator<>( proxyHostnameProperty, input -> input != null && !input.trim().isEmpty(), ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Advanced"), Localization.lang("Network"), Localization.lang("Please specify a hostname")))); proxyPortValidator = new FunctionBasedValidator<>( proxyPortProperty, input -> getPortAsInt(input).isPresent(), ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Advanced"), Localization.lang("Network"), Localization.lang("Please specify a port")))); proxyUsernameValidator = new FunctionBasedValidator<>( proxyUsernameProperty, input -> input != null && !input.trim().isEmpty(), ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Advanced"), Localization.lang("Network"), Localization.lang("Please specify a username")))); proxyPasswordValidator = new FunctionBasedValidator<>( proxyPasswordProperty, input -> input.length() > 0, ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Advanced"), Localization.lang("Network"), Localization.lang("Please specify a password")))); }

Target:
public AdvancedTabViewModel(DialogService dialogService, JabRefPreferences preferences) { this.dialogService = dialogService; this.preferences = preferences; this.remotePreferences = preferences.getRemotePreferences(); this.proxyPreferences = preferences.getProxyPreferences(); setValues(); remotePortValidator = new FunctionBasedValidator<>( remotePortProperty, input -> { try { int portNumber = Integer.parseInt(remotePortProperty().getValue()); return RemoteUtil.isUserPort(portNumber); } catch (NumberFormatException ex) { return false; } }, ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Advanced"), Localization.lang("Remote operation"), Localization.lang("You must enter an integer value in the interval 1025-65535")))); proxyHostnameValidator = new FunctionBasedValidator<>( proxyHostnameProperty, input -> !StringUtil.isNullOrEmpty(input), ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Advanced"), Localization.lang("Network"), Localization.lang("Please specify a hostname")))); proxyPortValidator = new FunctionBasedValidator<>( proxyPortProperty, input -> getPortAsInt(input).isPresent(), ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Advanced"), Localization.lang("Network"), Localization.lang("Please specify a port")))); proxyUsernameValidator = new FunctionBasedValidator<>( proxyUsernameProperty, input -> !StringUtil.isNullOrEmpty(input), ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Advanced"), Localization.lang("Network"), Localization.lang("Please specify a username")))); proxyPasswordValidator = new FunctionBasedValidator<>( proxyPasswordProperty, input -> input.length() > 0, ValidationMessage.error(String.format("%s > %s %n %n %s", Localization.lang("Advanced"), Localization.lang("Network"), Localization.lang("Please specify a password")))); }