auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method jMethod = method.getMethod(); Class<?>[] types = jMethod.getParameterTypes(); if (types.length == 0) { throw new IllegalArgumentException( "Methods that consumes representations must receive just one argument"); } Gson gson = getGson(); Object[] params = new Object[types.length]; String[] parameterNames = paramNameProvider.parameterNamesFor(jMethod); try { String content = getContentOfStream(inputStream); if(content.trim().equals("")) { logger.debug("json with no content"); return params; } logger.debug("json retrieved: {}", content); JsonParser parser = new JsonParser(); JsonObject root = (JsonObject) parser.parse(content); for (int i = 0; i < types.length; i++) { String name = parameterNames[i]; JsonElement node = root.get(name); if (isWithoutRoot(types, node)) { params[i] = gson.fromJson(root, types[i]); logger.info("json without root deserialized"); } else if(node != null){ params[i] = gson.fromJson(node, types[i]); } logger.debug("json deserialized: {}", params[i]); } } catch (Exception e) { throw new ResultException("Unable to deserialize data", e); } return params; }

Target:
public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method jMethod = method.getMethod(); Class<?>[] types = jMethod.getParameterTypes(); if (types.length == 0) { throw new IllegalArgumentException( "Methods that consumes representations must receive just one argument"); } Gson gson = getGson(); Object[] params = new Object[types.length]; String[] parameterNames = paramNameProvider.parameterNamesFor(jMethod); try { String content = getContentOfStream(inputStream); if(Strings.isNullOrEmpty(content)) { logger.debug("json with no content"); return params; } logger.debug("json retrieved: {}", content); JsonParser parser = new JsonParser(); JsonObject root = (JsonObject) parser.parse(content); for (int i = 0; i < types.length; i++) { String name = parameterNames[i]; JsonElement node = root.get(name); if (isWithoutRoot(types, node)) { params[i] = gson.fromJson(root, types[i]); logger.info("json without root deserialized"); } else if(node != null){ params[i] = gson.fromJson(node, types[i]); } logger.debug("json deserialized: {}", params[i]); } } catch (Exception e) { throw new ResultException("Unable to deserialize data", e); } return params; }
Source:
private Properties buildExpectedProperties(String expectedDDLSerialization, HiveColumnHandle... expectedColumns) { final String expectedColumnsType = getTypes(expectedColumns); final String expectedColumnsName = getName(expectedColumns); Properties propExpected = new Properties(); propExpected.put(LIST_COLUMNS, expectedColumnsName); propExpected.put(SERIALIZATION_LIB, APACHE_HADOOP_HIVE); propExpected.put(SERIALIZATION_DDL, expectedDDLSerialization); propExpected.put(LIST_COLUMN_TYPES, expectedColumnsType); return propExpected; }

Target:
private Properties buildExpectedProperties(String expectedDDLSerialization, HiveColumnHandle... expectedColumns) { String expectedColumnsType = getTypes(expectedColumns); String expectedColumnsName = getName(expectedColumns); Properties propExpected = new Properties(); propExpected.put(LIST_COLUMNS, expectedColumnsName); propExpected.put(SERIALIZATION_LIB, LAZY_SERDE_CLASS_NAME); propExpected.put(SERIALIZATION_DDL, expectedDDLSerialization); propExpected.put(LIST_COLUMN_TYPES, expectedColumnsType); return propExpected; }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_scratch_converter); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setUpActionBar(); getSearchFragment().setDataFetcher(dataFetcher); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); final long clientID = settings.getLong(Constants.SCRATCH_CONVERTER_CLIENT_ID_SHARED_PREFERENCE_NAME, Client.INVALID_CLIENT_ID); if (client == null) { client = new WebSocketClient(clientID, new WebSocketMessageListener()); } conversionManager = new ScratchConversionManager(this, client, false); conversionManager.setCurrentActivity(this); conversionManager.addGlobalDownloadCallback(getSlidingUpFragment()); conversionManager.addBaseInfoViewListener(getSlidingUpFragment()); conversionManager.addGlobalJobViewListener(getSlidingUpFragment()); getSearchFragment().setConversionManager(conversionManager); slidingLayout = findViewById(R.id.sliding_layout); slidingLayout.addPanelSlideListener(this); hideSlideUpPanelBar(); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_scratch_converter); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); String scratchConverter = getString(R.string.main_menu_scratch_converter); SpannableString scratchConverterBeta = new SpannableString(scratchConverter + " " + getString(R.string.beta)); scratchConverterBeta.setSpan( new ForegroundColorSpan( getResources().getColor(R.color.beta_label_color)), scratchConverter.length(), scratchConverterBeta.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); getSupportActionBar().setTitle(scratchConverterBeta); getSearchFragment().setDataFetcher(dataFetcher); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); long clientID = settings.getLong(Constants.SCRATCH_CONVERTER_CLIENT_ID_SHARED_PREFERENCE_NAME, Client.INVALID_CLIENT_ID); client = new WebSocketClient(clientID, new WebSocketMessageListener()); conversionManager = new ScratchConversionManager(this, client, false); conversionManager.setCurrentActivity(this); conversionManager.addGlobalDownloadCallback(getSlidingUpFragment()); conversionManager.addBaseInfoViewListener(getSlidingUpFragment()); conversionManager.addGlobalJobViewListener(getSlidingUpFragment()); getSearchFragment().setConversionManager(conversionManager); slidingLayout = findViewById(R.id.sliding_layout); slidingLayout.addPanelSlideListener(this); hideSlideUpPanelBar(); }
Source:
public void testGetLocation() { setUp(); CtfLocationInfo location = fixture.getLocationInfo(); long result = location.getTimestamp(); assertEquals(1L, result); }

Target:
public void testGetLocation() { CtfLocationInfo location = fixture.getLocationInfo(); long result = location.getTimestamp(); assertEquals(1337L, result); }
Source:
public List<String> getEurekaServerServiceUrls(String myZone) { String serviceUrls = this.serviceUrl.get(myZone); if (serviceUrls == null || serviceUrls.isEmpty()) { serviceUrls = this.serviceUrl.get(DEFAULT_ZONE); } if (!StringUtils.isEmpty(serviceUrls)) { final String[] serviceUrlsSplit = serviceUrls.split(","); List<String> eurekaServiceUrls = new ArrayList<>(serviceUrlsSplit.length); for (String eurekaServiceUrl : serviceUrlsSplit) { if (!endsWithSlash(eurekaServiceUrl)) { eurekaServiceUrl += "/"; } eurekaServiceUrls.add(eurekaServiceUrl); } return eurekaServiceUrls; } return new ArrayList<>(); }

Target:
public List<String> getEurekaServerServiceUrls(String myZone) { String serviceUrls = this.serviceUrl.get(myZone); if (serviceUrls == null || serviceUrls.isEmpty()) { serviceUrls = this.serviceUrl.get(DEFAULT_ZONE); } if (!StringUtils.isEmpty(serviceUrls)) { final String[] serviceUrlsSplit = StringUtils.commaDelimitedListToStringArray(serviceUrls); List<String> eurekaServiceUrls = new ArrayList<>(serviceUrlsSplit.length); for (String eurekaServiceUrl : serviceUrlsSplit) { if (!endsWithSlash(eurekaServiceUrl)) { eurekaServiceUrl += "/"; } eurekaServiceUrls.add(eurekaServiceUrl); } return eurekaServiceUrls; } return new ArrayList<>(); }
Source:
public FileStructureView(NodeFactory nodeFactory) { this.nodeFactory = nodeFactory; NodeStorage storage = new NodeStorage( new NodeUniqueKeyProvider() { @Override public String getKey(@NotNull Node item) { return String.valueOf(item.hashCode()); } }); NodeLoader loader = new NodeLoader(Collections.<NodeInterceptor>emptySet()); tree = new FileStructureTree(storage, loader); UI_BINDER.createAndBindUi(this); tree.setAutoExpand(false); tree.getSelectionModel().setSelectionMode(SINGLE); }

Target:
public FileStructureView(NodeFactory nodeFactory) { this.nodeFactory = nodeFactory; NodeStorage storage = new NodeStorage(item->String.valueOf(item.hashCode())); NodeLoader loader = new NodeLoader(Collections.<NodeInterceptor>emptySet()); tree = new FileStructureTree(storage, loader); UI_BINDER.createAndBindUi(this); tree.setAutoExpand(false); tree.getSelectionModel().setSelectionMode(SINGLE); }
Source:
private static int getGeometryType( long firstBlock ) { return (int) ((firstBlock & 0x00000000F0000000L) >> 28); }

Target:
private static int getGeometryType( long firstBlock ) { return (int) ((firstBlock & GEOMETRY_TYPE_MASK) >> 28); }
Source:
public Set<DataSegment> perform(Task task, TaskActionToolbox toolbox) throws IOException { if(!toolbox.taskLockCoversSegments(task, segments, false)) { throw new ISE("Segments not covered by locks for task[%s]: %s", task.getId(), segments); } final Set<DataSegment> retVal = toolbox.getMergerDBCoordinator().announceHistoricalSegments(segments); final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder() .setUser2(task.getDataSource()) .setUser4(task.getType()); for (DataSegment segment : segments) { metricBuilder.setUser5(segment.getInterval().toString()); toolbox.getEmitter().emit(metricBuilder.build("indexer/segment/bytes", segment.getSize())); } return retVal; }

Target:
public Set<DataSegment> perform(Task task, TaskActionToolbox toolbox) throws IOException { if(!toolbox.taskLockCoversSegments(task, segments, allowOlderVersions)) { throw new ISE("Segments not covered by locks for task[%s]: %s", task.getId(), segments); } final Set<DataSegment> retVal = toolbox.getMergerDBCoordinator().announceHistoricalSegments(segments); final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder() .setUser2(task.getDataSource()) .setUser4(task.getType()); for (DataSegment segment : segments) { metricBuilder.setUser5(segment.getInterval().toString()); toolbox.getEmitter().emit(metricBuilder.build("indexer/segment/bytes", segment.getSize())); } return retVal; }
Source:
public void getConfigFormWithTimeout() throws XMPPException, InterruptedException { ThreadedDummyConnection con = new ThreadedDummyConnection(); PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE); DiscoverInfoBuilder info = DiscoverInfo.builder("disco-result"); Identity ident = new Identity("pubsub", null, "leaf"); info.addIdentity(ident); DiscoverInfo discoverInfo = info.build(); con.addIQReply(discoverInfo); assertThrows(Exception.class, () -> { Node node = mgr.getNode("princely_musings"); SmackConfiguration.setDefaultReplyTimeout(100); con.setTimeout(); node.getNodeConfiguration(); }); }

Target:
public void getConfigFormWithTimeout() throws XMPPException, InterruptedException { ThreadedDummyConnection con = new ThreadedDummyConnection(); PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE); DiscoverInfoBuilder info = DiscoverInfo.builder("disco-result"); Identity ident = new Identity("pubsub", null, "leaf"); info.addIdentity(ident); DiscoverInfo discoverInfo = info.build(); con.addIQReply(discoverInfo); assertThrows(SmackException.class, () -> { Node node = mgr.getNode("princely_musings"); SmackConfiguration.setDefaultReplyTimeout(100); con.setTimeout(); node.getNodeConfiguration(); }); }
Source:
protected Stream<ScheduledJob> allJobsWithOnAnnotation() { return Arrays.stream(this.jobs) .filter(job -> job.getClass().isAnnotationPresent(On.class)) .map(job -> { Class<? extends Job> clazz = job.getClass(); On onAnnotation = clazz.getAnnotation(On.class); String cron = onAnnotation.value(); if (cron.isEmpty() || cron.matches("\\$\\{.*\\}")) { cron = readDurationFromConfig(onAnnotation, clazz, configuration); log.info(clazz + " is configured in the config file to run every " + cron); } int priority = onAnnotation.priority(); On.MisfirePolicy misfirePolicy = onAnnotation.misfirePolicy(); boolean requestRecovery = onAnnotation.requestRecovery(); boolean storeDurably = onAnnotation.storeDurably(); CronScheduleBuilder scheduleBuilder = createCronScheduleBuilder(cron); String timeZoneStr = onAnnotation.timeZone(); if (StringUtils.isNotBlank(timeZoneStr)) { TimeZone timeZone = TimeZone.getTimeZone(ZoneId.of(timeZoneStr)); scheduleBuilder = scheduleBuilder.inTimeZone(timeZone); } if (misfirePolicy == On.MisfirePolicy.IGNORE_MISFIRES) scheduleBuilder.withMisfireHandlingInstructionIgnoreMisfires(); else if (misfirePolicy == On.MisfirePolicy.DO_NOTHING) scheduleBuilder.withMisfireHandlingInstructionDoNothing(); else if (misfirePolicy == On.MisfirePolicy.FIRE_AND_PROCEED) scheduleBuilder.withMisfireHandlingInstructionFireAndProceed(); Trigger trigger = TriggerBuilder.newTrigger().withSchedule(scheduleBuilder).withPriority(priority).build(); JobKey jobKey = createJobKey(onAnnotation.jobName(), job); String message = String.format(" %-21s %s", cron, jobKey.toString()); ScheduledJob scheduledJob = new ScheduledJob(jobKey, clazz, trigger, requestRecovery, storeDurably, message); return scheduledJob; }); }

Target:
protected Stream<ScheduledJob> allJobsWithOnAnnotation() { return Arrays.stream(this.jobs) .filter(job -> job.getClass().isAnnotationPresent(On.class)) .map(job -> { Class<? extends Job> clazz = job.getClass(); On onAnnotation = clazz.getAnnotation(On.class); String cron = onAnnotation.value(); if (cron.isEmpty() || cron.matches("\\$\\{.*\\}")) { cron = readDurationFromConfig(onAnnotation, clazz, configuration); log.info(clazz + " is configured in the config file to run every " + cron); } boolean requestRecovery = onAnnotation.requestRecovery(); boolean storeDurably = onAnnotation.storeDurably(); CronScheduleBuilder scheduleBuilder = createCronScheduleBuilder(cron); String timeZoneStr = onAnnotation.timeZone(); applyTimezone(timeZoneStr, scheduleBuilder); On.MisfirePolicy misfirePolicy = onAnnotation.misfirePolicy(); applyMisfirePolicy(misfirePolicy, scheduleBuilder); int priority = onAnnotation.priority(); Trigger trigger = TriggerBuilder.newTrigger() .withSchedule(scheduleBuilder) .withPriority(priority) .build(); JobKey jobKey = createJobKey(onAnnotation.jobName(), job); String message = String.format(" %-21s %s", cron, jobKey.toString()); return new ScheduledJob(jobKey, clazz, trigger, requestRecovery, storeDurably, message); }); }
Source:
public LabeledText(ReferencedComposite referencedComposite, String label) { super(referencedComposite, 0, new WithLabelMatcher(new RegexMatcher(label + "\\s*\\**"))); }

Target:
public LabeledText(ReferencedComposite referencedComposite, String label) { super(referencedComposite, 0, new WithLabelMatcher(label)); }
Source:
protected void onPostExecute(final ArrayList<Theme> result) { runOnUiThread(new Runnable() { @Override public void run() { mFetchingThemes = false; if (mThemeBrowserFragment.isVisible()) { mThemeBrowserFragment.mEmptyView.setText("No themes"); mThemeBrowserFragment.setRefreshing(false); } else if (mThemeSearchFragment.isVisible()) { mThemeSearchFragment.mEmptyView.setText("No themes"); mThemeSearchFragment.setRefreshing(false); } } }); }

Target:
protected void onPostExecute(final ArrayList<Theme> result) { runOnUiThread(new Runnable() { @Override public void run() { mFetchingThemes = false; if (mThemeBrowserFragment != null && mThemeBrowserFragment.isVisible()) { mThemeBrowserFragment.mEmptyView.setText(R.string.no_themes); mThemeBrowserFragment.setRefreshing(false); } else if (mThemeSearchFragment != null && mThemeSearchFragment.isVisible()) { mThemeSearchFragment.mEmptyView.setText(R.string.no_themes); mThemeSearchFragment.setRefreshing(false); } } }); }
Source:
private void doSaveElementState(TreePath parentPath, ModelDelta delta, VirtualItem item, Collection<VirtualItem> set, int flagsToSave) { Object element = item.getData(); if (element != null) { boolean expanded = item.getExpanded(); boolean selected = set.contains(item); int flags = IModelDelta.NO_CHANGE; if (expanded && (flagsToSave & IModelDelta.EXPAND) != 0) { flags = flags | IModelDelta.EXPAND; } if (!expanded && (flagsToSave & IModelDelta.COLLAPSE) != 0 && item.hasItems()){ flags = flags | IModelDelta.COLLAPSE; } if (selected && (flagsToSave & IModelDelta.SELECT) != 0) { flags = flags | IModelDelta.SELECT; } if (expanded || flags != IModelDelta.NO_CHANGE) { int modelIndex = ((TreeModelContentProvider)getContentProvider()).viewToModelIndex(parentPath, item.getIndex().intValue()); TreePath elementPath = parentPath.createChildPath(element); int numChildren = ((TreeModelContentProvider)getContentProvider()).viewToModelCount(elementPath, item.getItemCount()); ModelDelta childDelta = delta.addNode(element, modelIndex, flags, numChildren); if (expanded) { for (VirtualItem item2 : item.getItems()) { doSaveElementState(elementPath, childDelta, item2, set, flagsToSave); } } } } }

Target:
private void doSaveElementState(TreePath parentPath, ModelDelta delta, VirtualItem item, Collection<VirtualItem> set, int flagsToSave) { Object element = item.getData(); if (element != null) { boolean expanded = item.getExpanded(); boolean selected = set.contains(item); int flags = IModelDelta.NO_CHANGE; if (expanded && (flagsToSave & IModelDelta.EXPAND) != 0) { flags = flags | IModelDelta.EXPAND; } if (!expanded && (flagsToSave & IModelDelta.COLLAPSE) != 0 && item.hasItems()){ flags = flags | IModelDelta.COLLAPSE; } if (selected && (flagsToSave & IModelDelta.SELECT) != 0) { flags = flags | IModelDelta.SELECT; } if (expanded || flags != IModelDelta.NO_CHANGE) { int modelIndex = ((TreeModelContentProvider)getContentProvider()).viewToModelIndex(parentPath, item.getIndex().intValue()); TreePath elementPath = parentPath.createChildPath(element); int numChildren = ((TreeModelContentProvider)getContentProvider()).viewToModelCount(elementPath, item.getItemCount()); ModelDelta childDelta = delta.addNode(element, modelIndex, flags, numChildren); if (expanded) { for (VirtualItem childItem : item.getItems()) { doSaveElementState(elementPath, childDelta, childItem, set, flagsToSave); } } } } }
Source:
private static int getZoneNumber(final double lat, final double lon) { int zoneNumber = (int) ((lon + 180) / 6) + 1; if (lon == 180) { zoneNumber = 60; } if (lat >= 56.0f && lat < 64.0f && lon >= 3.0f && lon < 12.0f) { zoneNumber = 32; } if (lat >= 72.0f && lat < 84.0f) { if (lon >= 0.0f && lon < 9.0f) { zoneNumber = 31; } else if (lon >= 9.0f && lon < 21.0f) { zoneNumber = 33; } else if (lon >= 21.0f && lon < 33.0f) { zoneNumber = 35; } else if (lon >= 33.0f && lon < 42.0f) { zoneNumber = 37; } } return zoneNumber; }

Target:
private static int getZoneNumber(final double lat, final double lon) { if (lon == 180) { return 60; } if (lat >= 56.0f && lat < 64.0f && lon >= 3.0f && lon < 12.0f) { return 32; } if (lat >= 72.0f && lat < 84.0f) { if (lon >= 0.0f && lon < 9.0f) { return 31; } else if (lon >= 9.0f && lon < 21.0f) { return 33; } else if (lon >= 21.0f && lon < 33.0f) { return 35; } else if (lon >= 33.0f && lon < 42.0f) { return 37; } } return (int) ((lon + 180) / 6) + 1; }
Source:
public boolean isSameAsTlv(Tlv tlv){ return oui.equals(tlv.getOui()) && subType.equals(tlv.getSubtype()); }

Target:
public boolean isSameAsTlv(Tlv tlv){ if (type < 127) { return type == tlv.getType(); } else if (type == 127) { return oui.equals(tlv.getOui()) && subType.equals(tlv.getSubtype()); } return false; }
Source:
private void validateTestEnvId(TestEnvironmentEntity testEnv) { String envId = testEnv.getEnvironmentId(); Pattern envIdPattern = Pattern.compile("^[a-zA-Z0-9\\._\\-]{1,249}$"); Matcher matcher = envIdPattern.matcher(envId); if (!matcher.matches()) throw new TestEnvironmentInvalidIdException(envId, envIdPattern); }

Target:
private void validateTestEnvId(TestEnvironmentEntity testEnv) { String envId = testEnv.getEnvironmentId(); Pattern envIdPattern = Pattern.compile(ENV_ID_PATTERN); Matcher matcher = envIdPattern.matcher(envId); if (!matcher.matches()) throw new TestEnvironmentInvalidIdException(envId, envIdPattern); }
Source:
public static KafkaSemantic getSinkSemantic(String semantic){ switch (semantic){ case SINK_SEMANTIC_VALUE_EXACTLY_ONCE: return EXACTLY_ONCE; case SINK_SEMANTIC_VALUE_AT_LEAST_ONCE: return AT_LEAST_ONCE; case SINK_SEMANTIC_VALUE_NONE: return NONE; default: throw new TableException("Validator should have checked that"); } }

Target:
public static KafkaSinkSemantic getSinkSemantic(String semantic){ switch (semantic){ case SINK_SEMANTIC_VALUE_EXACTLY_ONCE: return EXACTLY_ONCE; case SINK_SEMANTIC_VALUE_AT_LEAST_ONCE: return AT_LEAST_ONCE; case SINK_SEMANTIC_VALUE_NONE: return NONE; default: throw new TableException("Validator should have checked that"); } }
Source:
public SingleResultView findByPrimaryKey(@PathParam("primaryKey") String key, @PathParam("primaryKeyValue") String value) { String registerPrimaryKey = requestContext.getRegisterPrimaryKey(); if (key.equals(registerPrimaryKey)) { Optional<DbRecord> record = queryDAO.findByKeyValue(key, value); if (record.isPresent()) { setResponseHeader(key, value); return viewFactory.getSingleResultView(record.get()); } } throw new NotFoundException(); }

Target:
public SingleResultView findByPrimaryKey(@PathParam("primaryKey") String key, @PathParam("primaryKeyValue") String value) { String registerPrimaryKey = requestContext.getRegisterPrimaryKey(); if (key.equals(registerPrimaryKey)) { Optional<DbRecord> record = queryDAO.findByKeyValue(key, value); if (record.isPresent()) { setVersionHistoryLinkHeader(key, value); return viewFactory.getSingleResultView(record.get()); } } throw new NotFoundException(); }
Source:
private boolean validateReceivedSuspectedMembers(MemberImpl sender, Collection<MemberInfo> suspectedMemberInfos) { if (!partialDisconnectionDetectionEnabled) { return false; } else if (!clusterService.isMaster()) { if (suspectedMemberInfos.size() > 0) { logger.severe("This not is not master but received suspected members: " + suspectedMemberInfos + " from " + sender); } return false; } else if (getLocalMember().equals(sender)) { logger.severe("Received suspected members: " + suspectedMemberInfos + " from itself."); return false; } else if (suspectedMemberInfos.contains(new MemberInfo(getLocalMember()))) { logger.severe("Received suspected members: " + suspectedMemberInfos + " from " + sender + " contains this member!"); return false; } else if (clusterService.getClusterJoinManager().isMastershipClaimInProgress()) { if (suspectedMemberInfos.size() > 0 && logger.isFineEnabled()) { logger.warning("Ignoring received suspected members: " + suspectedMemberInfos + " from " + sender + " because mastership claim is in progress..."); } return false; } return true; }

Target:
private boolean validateReceivedSuspectedMembers(MemberImpl sender, Collection<MemberInfo> suspectedMemberInfos) { if (!partialDisconnectionDetectionEnabled) { return false; } else if (!clusterService.isMaster()) { if (suspectedMemberInfos.size() > 0) { logger.warning("This not is not master but received suspected members: " + suspectedMemberInfos + " from " + sender); } return false; } else if (getLocalMember().equals(sender)) { logger.warning("Received suspected members: " + suspectedMemberInfos + " from itself."); return false; } else if (suspectedMemberInfos.contains(new MemberInfo(getLocalMember()))) { logger.warning("Received suspected members: " + suspectedMemberInfos + " from " + sender + " contains this member!"); return false; } else if (clusterService.getClusterJoinManager().isMastershipClaimInProgress()) { if (suspectedMemberInfos.size() > 0 && logger.isFineEnabled()) { logger.warning("Ignoring received suspected members: " + suspectedMemberInfos + " from " + sender + " because mastership claim is in progress..."); } return false; } return true; }
Source:
public void init() throws XPathExpressionException, RemoteException, UserAdminUserAdminException { super.init(TestUserMode.SUPER_TENANT_USER); AndesClientUtils.sleepForInterval(15000); defaultAndesAckWaitTimeOut = System.getProperty("AndesAckWaitTimeOut"); System.setProperty("AndesAckWaitTimeOut", "0"); }

Target:
public void init() throws XPathExpressionException, RemoteException, UserAdminUserAdminException { super.init(TestUserMode.SUPER_TENANT_USER); AndesClientUtils.sleepForInterval(15000); defaultAndesAckWaitTimeOut = System.getProperty(AndesClientConstants. ANDES_ACK_WAIT_TIMEOUT_PROPERTY); System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, "0"); }
Source:
public void getSubItems(Item item, CreativeTabs tab, List list) { super.getSubItems(item, tab, list); for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) { if (fluid != null) list.add( getFilledItemStack(new FluidStack(fluid, getCapacity()))); } }

Target:
public void getSubItems(Item item, CreativeTabs tab, List list) { super.getSubItems(item, tab, list); for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) if (fluid != null) list.add(getFilledItemStack(new FluidStack(fluid, getCapacity()))); }
Source:
public void setup() { mockitoSession = Mockito.mockitoSession().initMocks(this).strictness(Strictness.STRICT_STUBS).startMocking(); EventLogManager eventLogManager = new EventLogManagerImpl(); PersistentUUIDManager persistentUUIDManager = new PersistentUUIDManagerImpl(); EmbeddedCacheManager cacheManager = mock(EmbeddedCacheManager.class); topologyManager = mock(ClusterTopologyManager.class); transport = mock(Transport.class); PreferAvailabilityStrategy availabilityStrategy = new PreferAvailabilityStrategy(eventLogManager, persistentUUIDManager, ClusterTopologyManagerImpl::distLostDataCheck); status = new ClusterCacheStatus(cacheManager, CACHE_NAME, availabilityStrategy, RebalanceType.FOUR_PHASE, topologyManager, transport, Optional.empty(), persistentUUIDManager, false); }

Target:
public void setup() { mockitoSession = Mockito.mockitoSession().strictness(Strictness.STRICT_STUBS).startMocking(); EventLogManager eventLogManager = new EventLogManagerImpl(); PersistentUUIDManager persistentUUIDManager = new PersistentUUIDManagerImpl(); EmbeddedCacheManager cacheManager = mock(EmbeddedCacheManager.class); topologyManager = mock(ClusterTopologyManager.class); transport = mock(Transport.class); PreferAvailabilityStrategy availabilityStrategy = new PreferAvailabilityStrategy(eventLogManager, persistentUUIDManager, ClusterTopologyManagerImpl::distLostDataCheck); status = new ClusterCacheStatus(cacheManager, CACHE_NAME, availabilityStrategy, RebalanceType.FOUR_PHASE, topologyManager, transport, Optional.empty(), persistentUUIDManager, false); }
Source:
public void validate(Object obj, Errors errors) { Obs obs = (Obs) obj; if (obs == null) { throw new APIException("Obs can't be null"); } else if (obs.getVoided()) { return; } List<Obs> ancestors = new ArrayList<>(); validateHelper(obs, errors, ancestors, true); ValidateUtil.validateFieldLengths(errors, obj.getClass(), "accessionNumber", "valueModifier", "valueComplex", "comment", "voidReason"); try { Encounter encounter = obs.getEncounter(); Patient patient = encounter.getPatient(); if(obs.getPerson() != patient){ throw new ValidationException("Obs.error.patient.id.mismatch"); } }catch (Exception e){ } }

Target:
public void validate(Object obj, Errors errors) { Obs obs = (Obs) obj; if (obs == null) { throw new APIException("Obs can't be null"); } else if (obs.getVoided()) { return; } List<Obs> ancestors = new ArrayList<>(); validateHelper(obs, errors, ancestors, true); ValidateUtil.validateFieldLengths(errors, obj.getClass(), "accessionNumber", "valueModifier", "valueComplex", "comment", "voidReason"); try { Encounter encounter = obs.getEncounter(); Patient patient = encounter.getPatient(); if (obs.getPerson() != patient){ throw new ValidationException("Obs.error.patient.id.mismatch"); } }catch (Exception ex){ log.error("Data contains null values",ex); } }
Source:
public DocumentMetadataAvroTruncator build() { DocumentMetadataAvroTruncator instance = new DocumentMetadataAvroTruncator(); if (Objects.nonNull(maxAbstractLength)) { instance.abstractTruncator = new AbstractTruncator(maxAbstractLength); } if (Objects.nonNull(maxTitleLength)) { instance.titleTruncator = new TitleTruncator(maxTitleLength); } if (Objects.nonNull(maxAuthorsSize) && Objects.nonNull(maxAuthorFullnameLength)) { instance.authorsTruncator = new AuthorsTruncator(maxAuthorsSize, maxAuthorFullnameLength); } if (Objects.nonNull(maxKeywordsSize) && Objects.nonNull(maxKeywordLength)) { instance.keywordsTruncator = new KeywordsTruncator(maxKeywordsSize, maxKeywordLength); } return instance; }

Target:
public DocumentMetadataAvroTruncator build() { return new DocumentMetadataAvroTruncator( maxAbstractLength, maxTitleLength, maxAuthorsSize, maxAuthorFullnameLength, maxKeywordsSize, maxKeywordLength ); }
Source:
public void addImportMenuItem(ZapMenuItem menuItem) { addImportMenuItemImpl(menuItem); }

Target:
public void addImportMenuItem(ZapMenuItem menuItem) { if (importMenuItemList == null) { importMenuItemList = createList(); } importMenuItemList.add(menuItem); }
Source:
public GeneralActivityListener(final EventManager eventManager, final String projectName) { mouseActivityListener = new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if(!WatchDogUtils.getProjectName().equals(projectName)) { return; } eventManager.update(new WatchDogEvent(event, EventType.USER_ACTIVITY)); } }; Toolkit.getDefaultToolkit().addAWTEventListener(mouseActivityListener, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK); keyboardActivityListener = new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if(!WatchDogUtils.getProjectName().equals(projectName)) { return; } if (((KeyEvent) event).getKeyCode() == KeyEvent.VK_RIGHT || ((KeyEvent) event).getKeyCode() == KeyEvent.VK_UP || ((KeyEvent) event).getKeyCode() == KeyEvent.VK_DOWN || ((KeyEvent) event).getKeyCode() == KeyEvent.VK_LEFT || ((KeyEvent) event).getKeyCode() == KeyEvent.VK_PAGE_DOWN || ((KeyEvent) event).getKeyCode() == KeyEvent.VK_PAGE_UP ) { eventManager.update(new WatchDogEvent(event, EventType.USER_ACTIVITY)); } } }; Toolkit.getDefaultToolkit().addAWTEventListener(keyboardActivityListener, AWTEvent.KEY_EVENT_MASK); }

Target:
public GeneralActivityListener(final EventManager eventManager, final String projectName) { mouseActivityListener = new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if (!WatchDogUtils.getProjectName().equals(projectName)) { return; } eventManager.update(new WatchDogEvent(event, EventType.USER_ACTIVITY)); } }; Toolkit.getDefaultToolkit().addAWTEventListener(mouseActivityListener, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK); keyboardActivityListener = new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if (!WatchDogUtils.getProjectName().equals(projectName)) { return; } switch (((KeyEvent) event).getKeyCode()) { case KeyEvent.VK_RIGHT: case KeyEvent.VK_UP: case KeyEvent.VK_DOWN: case KeyEvent.VK_LEFT: case KeyEvent.VK_PAGE_DOWN: case KeyEvent.VK_PAGE_UP: eventManager.update(new WatchDogEvent(event, EventType.USER_ACTIVITY)); } } }; Toolkit.getDefaultToolkit().addAWTEventListener(keyboardActivityListener, AWTEvent.KEY_EVENT_MASK); }
Source:
@Override public boolean start() throws Exception { Run<?,?> run = getContext().get(Run.class); if (run == null) { throw new MissingContextVariableException(Run.class); } FilePath workspace = getContext().get(FilePath.class); Launcher launcher = getContext().get(Launcher.class); TaskListener listener = getContext().get(TaskListener.class); Map<String,String> overrides = new HashMap<String,String>(); List<MultiBinding.Unbinder> unbinders = new ArrayList<MultiBinding.Unbinder>(); for (MultiBinding<?> binding : step.bindings) { for (Class<?> requiredContext : binding.getDescriptor().getRequiredContext()) { Object v = getContext().get(requiredContext); if (v == null) { throw new MissingContextVariableException(requiredContext); } } MultiBinding.MultiEnvironment environment = binding.bind(run, workspace, launcher, listener); unbinders.add(environment.getUnbinder()); overrides.putAll(environment.getValues()); } getContext().newBodyInvoker(). withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new Overrider(overrides))). withContext(BodyInvoker.mergeConsoleLogFilters(getContext().get(ConsoleLogFilter.class), new Filter(overrides.values(), run.getCharset().name()))). withCallback(new Callback(unbinders)). start(); return false; }

Target:
@Override public boolean start() throws Exception { Run<?,?> run = getContext().get(Run.class); TaskListener listener = getContext().get(TaskListener.class); FilePath workspace = getContext().get(FilePath.class); Launcher launcher = getContext().get(Launcher.class); Map<String,String> overrides = new HashMap<String,String>(); List<MultiBinding.Unbinder> unbinders = new ArrayList<MultiBinding.Unbinder>(); for (MultiBinding<?> binding : step.bindings) { if (binding.getDescriptor().requiresWorkspace() && (workspace == null || launcher == null)) { throw new MissingContextVariableException(FilePath.class); } MultiBinding.MultiEnvironment environment = binding.bind(run, workspace, launcher, listener); unbinders.add(environment.getUnbinder()); overrides.putAll(environment.getValues()); } getContext().newBodyInvoker(). withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new Overrider(overrides))). withContext(BodyInvoker.mergeConsoleLogFilters(getContext().get(ConsoleLogFilter.class), new Filter(overrides.values(), run.getCharset().name()))). withCallback(new Callback(unbinders)). start(); return false; }
Source:
private SqlStatements(SqlStatements that) { this.attributes = new ConcurrentHashMap<>(that.attributes); this.templateEngine = that.templateEngine; this.sqlParser = that.sqlParser; this.sqlLogger = that.sqlLogger; this.queryTimeout = that.queryTimeout; this.allowUnusedBindings = that.allowUnusedBindings; this.customizers = that.customizers; }

Target:
private SqlStatements(SqlStatements that) { this.attributes = new ConcurrentHashMap<>(that.attributes); this.templateEngine = that.templateEngine; this.sqlParser = that.sqlParser; this.sqlLogger = that.sqlLogger; this.queryTimeout = that.queryTimeout; this.allowUnusedBindings = that.allowUnusedBindings; this.customizers.addAll(that.customizers); }
Source:
public Document xmlRead(String xmlString) { Document doc = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); doc = builder.parse(new InputSource(new StringReader(xmlString))); doc.getDocumentElement().normalize(); } catch (Exception e) { e.printStackTrace(); } return doc; }

Target:
public Document xmlRead(String xmlString) { Document doc = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); doc = builder.parse(new InputSource(new StringReader(xmlString))); doc.getDocumentElement().normalize(); } catch (ParserConfigurationException e) { log.error("unable to parse content" + xmlString, e); } catch (SAXException e) { log.error("unable to parse content" + xmlString, e); } catch (IOException e) { log.error("unable to parse content" + xmlString, e); } return doc; }
Source:
private RelDataType inferTypeFromValidator( SqlCallBinding callBinding) { SqlCase caseCall = (SqlCase) callBinding.getCall(); SqlNodeList thenList = caseCall.getThenOperands(); ArrayList<SqlNode> nullList = new ArrayList<>(); List<RelDataType> argTypes = new ArrayList<>(); for (SqlNode node : thenList) { argTypes.add( callBinding.getValidator().deriveType( callBinding.getScope(), node)); if (SqlUtil.isNullLiteral(node, false)) { nullList.add(node); } } SqlNode elseOp = caseCall.getElseOperand(); argTypes.add( callBinding.getValidator().deriveType( callBinding.getScope(), caseCall.getElseOperand())); if (SqlUtil.isNullLiteral(elseOp, false)) { nullList.add(elseOp); } RelDataType ret = callBinding.getTypeFactory().leastRestrictive(argTypes); if (null == ret) { boolean changed = false; if (callBinding.getValidator().isEnableTypeCoercion()) { TypeCoercion typeCoercion = callBinding.getValidator().getTypeCoercion(); RelDataType commonType = typeCoercion.getWiderTypeFor(argTypes, true); if (null != commonType) { changed = typeCoercion.caseWhenCoercion(callBinding); if (changed) { ret = callBinding.getValidator() .deriveType(callBinding.getScope(), callBinding.getCall()); } } } if (!changed) { throw callBinding.newValidationError(RESOURCE.illegalMixingOfTypes()); } } final SqlValidatorImpl validator = (SqlValidatorImpl) callBinding.getValidator(); for (SqlNode node : nullList) { validator.setValidatedNodeType(node, ret); } return ret; }

Target:
private RelDataType inferTypeFromValidator( SqlCallBinding callBinding) { SqlCase caseCall = (SqlCase) callBinding.getCall(); SqlNodeList thenList = caseCall.getThenOperands(); ArrayList<SqlNode> nullList = new ArrayList<>(); List<RelDataType> argTypes = new ArrayList<>(); for (SqlNode node : thenList) { argTypes.add( callBinding.getValidator().deriveType( callBinding.getScope(), node)); if (SqlUtil.isNullLiteral(node, false)) { nullList.add(node); } } SqlNode elseOp = caseCall.getElseOperand(); argTypes.add( callBinding.getValidator().deriveType( callBinding.getScope(), caseCall.getElseOperand())); if (SqlUtil.isNullLiteral(elseOp, false)) { nullList.add(elseOp); } RelDataType ret = callBinding.getTypeFactory().leastRestrictive(argTypes); if (null == ret) { boolean coerced = false; if (callBinding.getValidator().isTypeCoercionEnabled()) { TypeCoercion typeCoercion = callBinding.getValidator().getTypeCoercion(); RelDataType commonType = typeCoercion.getWiderTypeFor(argTypes, true); if (null != commonType) { coerced = typeCoercion.caseWhenCoercion(callBinding); if (coerced) { ret = callBinding.getValidator() .deriveType(callBinding.getScope(), callBinding.getCall()); } } } if (!coerced) { throw callBinding.newValidationError(RESOURCE.illegalMixingOfTypes()); } } final SqlValidatorImpl validator = (SqlValidatorImpl) callBinding.getValidator(); for (SqlNode node : nullList) { validator.setValidatedNodeType(node, ret); } return ret; }
Source:
private void readJsonFromURL() { InputStream is = null; try { is = url.openStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); JsonReader jr = Json.createReader(rd); parseJson(jr.readObject()); } catch (IOException | NotFoundException e) { Utils.logException(LOG, "Unable to load url: " + url.toString(), e); } finally { try { is.close(); } catch (IOException e) { Utils.logException(LOG, e); } } streamsAreLoaded = true; }

Target:
private void readJsonFromURL() { try (InputStream is = url.openStream()) { BufferedReader rd = new BufferedReader(new InputStreamReader(is)); JsonReader jr = Json.createReader(rd); parseJson(jr.readObject()); } catch (IOException | NotFoundException e) { Utils.logException(LOG, "Unable to load url: " + url.toString(), e); } streamsAreLoaded = true; }
Source:
private static void addNetworkInterfaceProperties(XmlRpcStruct struct, VmNetworkInterface vmInterface, VmDevice vmDevice, String nicModel) { struct.add(VdsProperties.Type, vmDevice.getType()); struct.add(VdsProperties.Device, vmDevice.getDevice()); struct.add(VdsProperties.network, vmInterface.getNetworkName()); addAddress(vmDevice, struct); struct.add(VdsProperties.mac_addr, vmInterface.getMacAddress()); addBootOrder(vmDevice, struct); struct.add(VdsProperties.SpecParams, vmDevice.getSpecParams()); struct.add(VdsProperties.DeviceId, String.valueOf(vmDevice.getId().getDeviceId())); struct.add(VdsProperties.nic_type, nicModel); struct.add(VdsProperties.portMirroring, new Boolean(vmInterface.isPortMirroring()).toString()); }

Target:
private static void addNetworkInterfaceProperties(XmlRpcStruct struct, VmNetworkInterface vmInterface, VmDevice vmDevice, String nicModel) { struct.add(VdsProperties.Type, vmDevice.getType()); struct.add(VdsProperties.Device, vmDevice.getDevice()); struct.add(VdsProperties.network, vmInterface.getNetworkName()); addAddress(vmDevice, struct); struct.add(VdsProperties.mac_addr, vmInterface.getMacAddress()); addBootOrder(vmDevice, struct); struct.add(VdsProperties.SpecParams, vmDevice.getSpecParams()); struct.add(VdsProperties.DeviceId, String.valueOf(vmDevice.getId().getDeviceId())); struct.add(VdsProperties.nic_type, nicModel); struct.add(VdsProperties.portMirroring, Boolean.toString(vmInterface.isPortMirroring())); }
Source:
protected void loadListeners(ServiceLoader<LifecycleListener> loader) { Iterator<LifecycleListener> iterator = loader.iterator(); while (checkHasNextSafely(iterator)) { try { LifecycleListener listener = iterator.next(); listeners.add(listener); } catch (ServiceConfigurationError e) { logger.error("iterator.next() failed", e); } } }

Target:
protected void loadListeners(ServiceLoader<LifecycleListener> loader) { Iterator<LifecycleListener> iterator = loader.iterator(); while (hasNextSafely(iterator)) { try { LifecycleListener listener = iterator.next(); listeners.add(listener); logger.info(String.format("Found %s: %s", LifecycleListener.class, listener.getClass())); } catch (ServiceConfigurationError e) { logger.error("iterator.next() failed", e); } } }
Source:
protected Transaction startTransaction() { ImmutableMap<TableReference, ConflictHandler> tablesToWriteWrite = ImmutableMap.of( TEST_TABLE, ConflictHandler.SERIALIZABLE, TransactionConstants.TRANSACTION_TABLE, ConflictHandler.IGNORE_ALL); return new SerializableTransaction( MetricsManagers.createForTests(), keyValueService, new LegacyTimelockService(timestampService, lockService, lockClient), transactionService, NoOpCleaner.INSTANCE, Suppliers.ofInstance(timestampService.getFreshTimestamp()), TestConflictDetectionManagers.createWithStaticConflictDetection(tablesToWriteWrite), SweepStrategyManagers.createDefault(keyValueService), 0L, Optional.empty(), PreCommitConditions.NO_OP, AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING, null, TransactionReadSentinelBehavior.THROW_EXCEPTION, true, timestampCache, AtlasDbConstants.DEFAULT_TRANSACTION_LOCK_ACQUIRE_TIMEOUT_MS, AbstractTransactionTest.GET_RANGES_EXECUTOR, AbstractTransactionTest.DEFAULT_GET_RANGES_CONCURRENCY, getSweepQueueWriterInitialized(), MoreExecutors.newDirectExecutorService(), () -> false) { @Override protected Map<Cell, byte[]> transformGetsForTesting(Map<Cell, byte[]> map) { return Maps.transformValues(map, input -> input.clone()); } }; }

Target:
protected Transaction startTransaction() { ImmutableMap<TableReference, ConflictHandler> tablesToWriteWrite = ImmutableMap.of( TEST_TABLE, ConflictHandler.SERIALIZABLE, TransactionConstants.TRANSACTION_TABLE, ConflictHandler.IGNORE_ALL); return new SerializableTransaction( MetricsManagers.createForTests(), keyValueService, new LegacyTimelockService(timestampService, lockService, lockClient), transactionService, NoOpCleaner.INSTANCE, Suppliers.ofInstance(timestampService.getFreshTimestamp()), TestConflictDetectionManagers.createWithStaticConflictDetection(tablesToWriteWrite), SweepStrategyManagers.createDefault(keyValueService), 0L, Optional.empty(), PreCommitConditions.NO_OP, AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING, null, TransactionReadSentinelBehavior.THROW_EXCEPTION, true, timestampCache, AtlasDbConstants.DEFAULT_TRANSACTION_LOCK_ACQUIRE_TIMEOUT_MS, AbstractTransactionTest.GET_RANGES_EXECUTOR, AbstractTransactionTest.DEFAULT_GET_RANGES_CONCURRENCY, getSweepQueueWriterInitialized(), MoreExecutors.newDirectExecutorService(), CommitProfileProcessor.createNonLogging(metricsManager)) { @Override protected Map<Cell, byte[]> transformGetsForTesting(Map<Cell, byte[]> map) { return Maps.transformValues(map, input -> input.clone()); } }; }
Source:
protected void createMainControl(Composite parent, IEEFFormContainer formContainer) { EEFWidgetFactory widgetFactory = formContainer.getWidgetFactory(); this.comboViewer = new ComboViewer(parent, SWT.READ_ONLY); this.combo = comboViewer.getCombo(); this.comboViewer.setContentProvider(ArrayContentProvider.getInstance()); this.comboViewer.setLabelProvider(new EEFSelectLabelProvider()); this.comboViewer.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); widgetFactory.paintBordersFor(parent); FormData comboFormData = new FormData(); comboFormData.left = new FormAttachment(0, LABEL_WIDTH); comboFormData.right = new FormAttachment(100, 0); this.combo.setLayoutData(comboFormData); if (!isEnabled()) { this.combo.setEnabled(false); } this.controller = new EEFControllersFactory().createSelectController(this.description, this.variableManager, this.interpreter, this.editingDomain); }

Target:
protected void createMainControl(Composite parent, IEEFFormContainer formContainer) { EEFWidgetFactory widgetFactory = formContainer.getWidgetFactory(); this.comboViewer = new ComboViewer(parent, SWT.READ_ONLY); this.combo = comboViewer.getCombo(); this.comboViewer.setContentProvider(ArrayContentProvider.getInstance()); this.comboViewer.setLabelProvider(new EEFSelectLabelProvider()); this.comboViewer.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); widgetFactory.paintBordersFor(parent); FormData comboFormData = new FormData(); comboFormData.left = new FormAttachment(0, LABEL_WIDTH); comboFormData.right = new FormAttachment(100, 0); this.combo.setLayoutData(comboFormData); this.controller = new EEFControllersFactory().createSelectController(this.description, this.variableManager, this.interpreter, this.editingDomain); }
Source:
protected Segment resolvePrevious(@Nullable Id id, Publisher source, Set<Alias> aliases) { Segment previous = null; if (id != null) { previous = Iterables.getOnlyElement(resolveSegments(ImmutableList.of(id)), null); if (previous != null) { return previous; } } try { Set<Long> aliasIds = aliasIndex.readAliases(source, aliases); Long aliasId = Iterables.getFirst(aliasIds, null); if (aliasId != null) { return Iterables.getOnlyElement(resolveSegments(ImmutableList.of(Id.valueOf(aliasId))), null); } } catch (ConnectionException e) { throw Throwables.propagate(e); } return null; }

Target:
protected Optional<Segment> resolvePrevious(@Nullable Id id, Publisher source, Set<Alias> aliases) { Segment previous = null; if (id != null) { previous = Iterables.getOnlyElement(resolveSegments(ImmutableList.of(id)), null); if (previous != null) { return Optional.of(previous); } } return Optional.fromNullable(resolveByAlias(source, aliases)); }