auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setParentContext(final XQueryContext parentContext) { this.parentContext = parentContext; if (parentContext != null) { this.db = parentContext.db; this.baseURI = parentContext.baseURI; try { if (location.startsWith(XmldbURI.XMLDB_URI_PREFIX) || (location.indexOf(':') < 0 && parentContext.getModuleLoadPath().startsWith(XmldbURI.XMLDB_URI_PREFIX))) { final XmldbURI locationUri = XmldbURI.xmldbUriFor(FileUtils.dirname(location)); if (".".equals(parentContext.getModuleLoadPath())) { setModuleLoadPath(locationUri.toString()); } else { try { final XmldbURI parentLoadUri = XmldbURI.xmldbUriFor(parentContext.getModuleLoadPath()); final XmldbURI moduleLoadUri = parentLoadUri.resolveCollectionPath(locationUri); setModuleLoadPath(moduleLoadUri.toString()); } catch (final URISyntaxException e) { setModuleLoadPath(locationUri.toString()); } } } else { final String dir = FileUtils.dirname(location); if (dir.matches("^[a-z]+:.*")) { moduleLoadPath = dir; } else if (".".equals(parentContext.moduleLoadPath)) { if (!".".equals(dir)) { if (dir.startsWith("/")) { <START> setModuleLoadPath(dir); <END> } else { setModuleLoadPath("./" + dir); } } } else { if (dir.startsWith("/")) { setModuleLoadPath(dir); } else { setModuleLoadPath(FileUtils.addPaths(parentContext.getModuleLoadPath(), dir)); } } } } catch (final URISyntaxException e) { e.printStackTrace(); } } }</code><technical_language>LGTM, interesting version</technical_language>

Target:
private void setParentContext(final XQueryContext parentContext) { this.parentContext = parentContext; if (parentContext != null) { this.db = parentContext.db; this.baseURI = parentContext.baseURI; try { if (location.startsWith(XmldbURI.XMLDB_URI_PREFIX) || (location.indexOf(':') < 0 && parentContext.getModuleLoadPath().startsWith(XmldbURI.XMLDB_URI_PREFIX))) { final XmldbURI locationUri = XmldbURI.xmldbUriFor(FileUtils.dirname(location)); if (".".equals(parentContext.getModuleLoadPath())) { setModuleLoadPath(locationUri.toString()); } else { try { final XmldbURI parentLoadUri = XmldbURI.xmldbUriFor(parentContext.getModuleLoadPath()); final XmldbURI moduleLoadUri = parentLoadUri.resolveCollectionPath(locationUri); setModuleLoadPath(moduleLoadUri.toString()); } catch (final URISyntaxException e) { setModuleLoadPath(locationUri.toString()); } } } else { final String dir = FileUtils.dirname(location); if (dir.matches("^[A-Za-z]+:.*")) { setModuleLoadPath(dir); } else if (".".equals(parentContext.moduleLoadPath)) { if (!".".equals(dir)) { if (dir.matches("(?:\\/.*)|(?:[a-zA-Z]:\\\\.*)")) { setModuleLoadPath(dir); } else { setModuleLoadPath("./" + dir); } } } else { if (dir.startsWith("/")) { setModuleLoadPath(dir); } else { setModuleLoadPath(FileUtils.addPaths(parentContext.getModuleLoadPath(), dir)); } } } } catch (final URISyntaxException e) { e.printStackTrace(); } } }
Source:
<code>public CompletableFuture<Void> putAsync(K key, V value) { Preconditions.checkNotNull(key); if (value == null) { return deleteAsync(key); } writeMetrics.numPuts.inc(); return asyncHelper.execute(key, value, writeFn::putAsync, writeMetrics.putNs) .exceptionally(e -> { <START> throw new SamzaException(String.format("Failed to put a record, key=%s, value=%s", key, value), e); <END> }); }</code><technical_language>big, log</technical_language>

Target:
public CompletableFuture<Void> putAsync(K key, V value) { Preconditions.checkNotNull(key); if (value == null) { return deleteAsync(key); } writeMetrics.numPuts.inc(); return execute(writeRateLimiter, key, value, writeFn::putAsync, writeMetrics.putNs) .exceptionally(e -> { throw new SamzaException("Failed to put a record with key=" + key, (Throwable) e); }); }
Source:
<code>public void detachView() { super.detachView(); <START> if (mSubscriptions != null) mSubscriptions.unsubscribe(); <END> }</code><technical_language>mSubscriptions.clear() instead if (mSubscriptions != null) mSubscriptions.unsubscribe();</technical_language>

Target:
public void detachView() { super.detachView(); mSubscriptions.clear(); }
Source:
<code>public void setNull_changePrimaryKeyThrows() { final String[] primaryKeyClasses = {PrimaryKeyAsBoxedByte.CLASS_NAME, PrimaryKeyAsBoxedShort.CLASS_NAME, PrimaryKeyAsBoxedInteger.CLASS_NAME, PrimaryKeyAsBoxedLong.CLASS_NAME, PrimaryKeyAsString.CLASS_NAME}; for (String pkClass : primaryKeyClasses) { dynamicRealm.beginTransaction(); DynamicRealmObject object; try { if (pkClass.equals(PrimaryKeyAsString.CLASS_NAME)) { object = dynamicRealm.createObject(pkClass, ""); object.setNull(PrimaryKeyAsString.FIELD_PRIMARY_KEY); } else { object = dynamicRealm.createObject(pkClass, 0); object.setNull("id"); } fail(); <START> } catch (IllegalArgumentException ignored) { <END> } dynamicRealm.cancelTransaction(); } }</code><technical_language>I try -catch include dynamicRealm.createObject()</technical_language>

Target:
public void setNull_changePrimaryKeyThrows() { final String[] primaryKeyClasses = {PrimaryKeyAsBoxedByte.CLASS_NAME, PrimaryKeyAsBoxedShort.CLASS_NAME, PrimaryKeyAsBoxedInteger.CLASS_NAME, PrimaryKeyAsBoxedLong.CLASS_NAME, PrimaryKeyAsString.CLASS_NAME}; for (String pkClass : primaryKeyClasses) { dynamicRealm.beginTransaction(); DynamicRealmObject object; boolean isStringPK = pkClass.equals(PrimaryKeyAsString.CLASS_NAME); if (isStringPK) { object = dynamicRealm.createObject(pkClass, ""); } else { object = dynamicRealm.createObject(pkClass, 0); } try { object.setNull(isStringPK ? PrimaryKeyAsString.FIELD_PRIMARY_KEY : "id"); fail(); } catch (IllegalArgumentException ignored) { } dynamicRealm.cancelTransaction(); } }
Source:
<code>private static String canonicalizeForPath(String input, boolean alreadyEncoded) { int codePoint; for (int i = 0, limit = input.length(); i < limit; i += Character.charCount(codePoint)) { codePoint = input.codePointAt(i); if (codePoint < 0x20 || codePoint >= 0x7f || (!alreadyEncoded <START> && (PATH_SEGMENT_ENCODE_SET.indexOf(codePoint) != -1 || codePoint == '%'))) { <END> Buffer out = new Buffer(); out.writeUtf8(input, 0, i); canonicalizeForPath(out, input, i, limit, alreadyEncoded); return out.readUtf8(); } } return input; }</code><technical_language>I this return unexpected for ? #</technical_language>

Target:
private static String canonicalizeForPath(String input, boolean alreadyEncoded) { int codePoint; for (int i = 0, limit = input.length(); i < limit; i += Character.charCount(codePoint)) { codePoint = input.codePointAt(i); if (codePoint < 0x20 || codePoint >= 0x7f || PATH_SEGMENT_ALWAYS_ENCODE_SET.indexOf(codePoint) != -1 || (!alreadyEncoded && (codePoint == '/' || codePoint == '%'))) { Buffer out = new Buffer(); out.writeUtf8(input, 0, i); canonicalizeForPath(out, input, i, limit, alreadyEncoded); return out.readUtf8(); } } return input; }
Source:
<code>public static SharedResourceManager create() { return create(() -> Executors.newSingleThreadScheduledExecutor( <START> ExecutorUtils.getThreadFactory("zstream-shared-destroyer-%d", true))); <END> }</code><technical_language>bkstream</technical_language>

Target:
public static SharedResourceManager create() { return create(() -> Executors.newSingleThreadScheduledExecutor( ExecutorUtils.getThreadFactory("bookkeeper-shared-destroyer-%d", true))); }
Source:
<code>public static TimelockService create(TimelockService timelockService, MetricsManager metricsManager) { metricsManager.addMetricFilter( MetricName.builder().safeName(AtlasDbMetricNames.TIMELOCK_SUCCESSFUL_REQUEST).build(), () -> false); metricsManager.addMetricFilter( MetricName.builder().safeName(AtlasDbMetricNames.TIMELOCK_FAILED_REQUEST).build(), <START> () -> false); <END> return new InstrumentedTimelockService(timelockService, metricsManager); }</code><technical_language>extract out blocking filter; more readable</technical_language>

Target:
public static TimelockService create(TimelockService timelockService, MetricsManager metricsManager) { metricsManager.doNotPublish(SUCCESSFUL_REQUEST_METRIC_NAME); metricsManager.doNotPublish(FAILED_REQUEST_METRIC_NAME); return new InstrumentedTimelockService(timelockService, metricsManager); }
Source:
<code>static double calculateDoubleGaussian(final double val, final double credibleMode, final double credibleLow, final double credibleHigh) { <START> double hiDist = credibleHigh - credibleMode; <END> if (credibleMode >= credibleHigh) { hiDist = MIN_DIST_FROM_MODE; } double loDist = credibleMode - credibleLow; if (credibleMode <= credibleLow) { loDist = MIN_DIST_FROM_MODE; } if (val >= credibleMode) { return new NormalDistribution(credibleMode, hiDist / 1.96).density(val); } else { return new NormalDistribution(credibleMode, loDist / 1.96).density(val); } }</code><technical_language>final double hiDist = Math.max(credibleHigh - credibleMode, MIN_DIST_FROM_MODE)</technical_language>

Target:
static double calculateDoubleGaussian(final double val, final double credibleMode, final double credibleLow, final double credibleHigh) { final double hiDist = Math.max(credibleHigh - credibleMode, MIN_DIST_FROM_MODE); final double loDist = Math.max(credibleMode - credibleLow, MIN_DIST_FROM_MODE); return new NormalDistribution(null, credibleMode, ( val >= credibleMode ? hiDist : loDist)/NUM_STD_95_CONF_INTERVAL_GAUSSIAN).density(val); }
Source:
<code>public Context startSpan(Context context, ProcessKind processKind) { <START> Context local = context; <END> String spanName = "Azure.eventhubs." + processKind.getProcessKind(); for (Tracer tracer : tracers) { local = tracer.start(spanName, local, processKind); } return local; }</code><technical_language>add null checks Objects.requireNotNull in public methods. If a null context is passed in, get a nice error message NPE method invoke a method it. Similar public methods below</technical_language>

Target:
public Context startSpan(Context context, ProcessKind processKind) { Context local = Objects.requireNonNull(context, "'context' cannot be null"); Objects.requireNonNull(processKind, "'processKind' cannot be null"); String spanName = getSpanName(processKind); for (Tracer tracer : tracers) { local = tracer.start(spanName, local, processKind); } return local; }
Source:
<code>public SystemCheck(String name, double timeout, SendableBase... systems) { <START> super(name, timeout, Arrays.asList(systems).stream().map(system -> system.getName()).collect(Collectors.toList()) <END> .toArray(String[]::new)); this.systems = systems; }</code><technical_language>more yuck</technical_language>

Target:
public SystemCheck(String name, double timeout, SendableBase... systems) { super(name, timeout, Arrays.asList(systems).stream().map(system -> system.getName()).collect(Collectors.toList()) .toArray(String[]::new)); }
Source:
<code>private void setJoinToSearchingState(){ joinView.setEnabled(false); joinView.findViewById(R.id.searching).setVisibility(View.VISIBLE); joinView.setBackgroundColor(getResources().getColor(R.color.gray)); <START> } <END></code><technical_language>reduce methods code below. java private void setJoinToDefaultState(){ modifyJoinView(true, View.INVISIBLE, R.color.abs__background_holo_light)); } private void setJoinToSearchingState(){ modifyJoinView(false, View.VISIBLE, R.color.gray) } /** * @param enabled * @param visibility {@link View.VISIBLE} {@link View.INVISIBLE} * @param color R.color */ private void modifyJoinView(Boolean enabled, int visibility, int color) { joinView.setEnabled(enabled); joinView.findViewById(R.id.searching).setVisibility(visibility); joinView.setBackgroundColor(getResources().getColor(color)); }</technical_language>

Target:
private void setJoinToSearchingState(){ setJoinState(false, View.VISIBLE, R.color.gray); }
Source:
<code>public static void processProcessChildren(Process mainProcess, LinkedList<TempProcess> childProcesses, Template template, RulesetManagementInterface managementInterface, String acquisitionStage, List<Locale.LanguageRange> priorityList) throws DataException, InvalidMetadataValueException, NoSuchMetadataFieldException, ProcessGenerationException { for (int i = 0; i < childProcesses.size(); i++) { <START> TempProcess tempProcess = childProcesses.get(i); <END> if (Objects.isNull(tempProcess) || Objects.isNull(tempProcess.getProcess())) { logger.error("Child process " + i + " is null => Skip!"); continue; } processTempProcess(tempProcess, template, managementInterface, acquisitionStage, priorityList); Process childProcess = tempProcess.getProcess(); ServiceManager.getProcessService().save(childProcess); ProcessService.setParentRelations(mainProcess, childProcess); } }</code><technical_language>a ForEach loop</technical_language>

Target:
public static void processProcessChildren(Process mainProcess, LinkedList<TempProcess> childProcesses, Template template, RulesetManagementInterface managementInterface, String acquisitionStage, List<Locale.LanguageRange> priorityList) throws DataException, InvalidMetadataValueException, NoSuchMetadataFieldException, ProcessGenerationException { for (TempProcess tempProcess : childProcesses) { if (Objects.isNull(tempProcess) || Objects.isNull(tempProcess.getProcess())) { logger.error("Child process " + (childProcesses.indexOf(tempProcess) + 1) + " is null => Skip!"); continue; } processTempProcess(tempProcess, template, managementInterface, acquisitionStage, priorityList); Process childProcess = tempProcess.getProcess(); ServiceManager.getProcessService().save(childProcess); ProcessService.setParentRelations(mainProcess, childProcess); } }
Source:
<code>public static List<LocatedFileStatus> toListThroughNextCallsAlone( RemoteIterator<LocatedFileStatus> iterator) throws IOException { ArrayList<LocatedFileStatus> list = new ArrayList<>(); try { while (true) { list.add(iterator.next()); } <START> } catch (NoSuchElementException | IllegalStateException expected) { <END> } return list; }</code><technical_language>discussed: fix DirListingIterator match RemoteIterator API; consider failure a bug</technical_language>

Target:
public static List<LocatedFileStatus> toListThroughNextCallsAlone( RemoteIterator<LocatedFileStatus> iterator) throws IOException { ArrayList<LocatedFileStatus> list = new ArrayList<>(); try { while (true) { list.add(iterator.next()); } } catch (NoSuchElementException expected) { } return list; }
Source:
<code>public void testCsvParserApp() throws IOException, Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); lma.prepareDAG(new FileToJdbcCsvParser(), conf); LocalMode.Controller lc = lma.getController(); <START> lc.run(50000); END> } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }</code><technical_language>This test needs check content in DB; other examples for do that</technical_language>

Target:
public void testCsvParserApp() throws IOException, Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(new File("src/test/resources/test.xml").toURI().toURL()); lma.prepareDAG(new FileToJdbcCsvParser(), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); Thread.sleep(5000); Assert.assertEquals("Events in store", 10, getNumOfEventsInStore()); cleanTable(); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }
Source:
<code>public RealmEventStreamTaskImpl(final String name, final Executor<T> executor) { <START> Util.checkNull(executor, "executor"); <END> Util.checkNull(executor, "documentClass"); Util.checkNull(executor, "codecRegistry"); this.lock = new ReentrantLock(); this.executor = executor; this.name = name; }</code><technical_language>Check this copy-paste</technical_language>

Target:
public RealmEventStreamTaskImpl(final String name, final Executor<T> executor) { Util.checkNull(executor, "name"); Util.checkNull(executor, "executor"); this.lock = new ReentrantLock(); this.executor = executor; this.name = name; }
Source:
<code>public void testNotificationActionBuilder_copiesIcon() { NotificationCompat.Action a = new NotificationCompat.Action.Builder( R.drawable.notification_action_background, "title", null).build(); NotificationCompat.Action aCopy = new NotificationCompat.Action.Builder(a).build(); <START> assertEquals(a.getIconCompat().getResId(), aCopy.getIconCompat().getResId()); <END> }</code><technical_language>clearer R.drawable.notification_action_background (it guards bugs getResId returning 0)</technical_language>

Target:
public void testNotificationActionBuilder_copiesIcon() { NotificationCompat.Action a = new NotificationCompat.Action.Builder( R.drawable.notification_action_background, "title", null).build(); assertEquals(R.drawable.notification_action_background, a.getIconCompat().getResId()); NotificationCompat.Action aCopy = new NotificationCompat.Action.Builder(a).build(); assertEquals(R.drawable.notification_action_background, aCopy.getIconCompat().getResId()); }
Source:
<code>private void updateIteration() { if <START> (refreshIteration.equals(NUMBER_HOST_REFRESHES_BEFORE_SAVE)) { <END> refreshIteration.set(1); } else { refreshIteration.incrementAndGet(); } }</code><technical_language>call isTimeToRefreshStatistics here</technical_language>

Target:
private void updateIteration() { if (isTimeToRefreshStatistics()) { refreshIteration.set(1); } else { refreshIteration.incrementAndGet(); } }
Source:
<code>private static SSLContext buildContext(final ConfigContext config) { if (config.tlsInsecure()) { try { LOG.warn("Configuration: tlsInsecure is true. ALL TLS VERIFICATION IS DISABLED!"); return SSLContextBuilder.create() .loadTrustMaterial(new TrustAllStrategy()) .build(); } catch (KeyManagementException | KeyStoreException | NoSuchAlgorithmException e) { LOG.error("error while disabling TLS security", e); <START> throw new RuntimeException(e); <END> } } else { return SSLContexts.createDefault(); } }</code><technical_language>please change exception type is inheriting MantaException</technical_language>

Target:
private static SSLContext buildContext(final ConfigContext config) { if (config.tlsInsecure()) { try { LOG.warn("Configuration: tlsInsecure is true. ALL TLS VERIFICATION IS DISABLED!"); return SSLContextBuilder.create() .loadTrustMaterial(new TrustAllStrategy()) .build(); } catch (KeyManagementException | KeyStoreException | NoSuchAlgorithmException e) { final String msg = "error while disabling TLS security"; LOG.error(msg, e); throw new MantaException(msg, e); } } else { return SSLContexts.createDefault(); } }
Source:
<code>protected void doStop() { <START> if (watchRoutine != null && !watchRoutine.isCancelled()) { <END> watchRoutine.cancel(); } if (filesWatcher != null) { try { filesWatcher.close(); } catch (IOException ignored) { } } }</code><technical_language>null GCd</technical_language>

Target:
protected void doStop() { if (watchRoutine != null && !watchRoutine.isCancelled()) { watchRoutine.cancel(); watchRoutine = null; } IOUtils.closeWhileHandlingException(filesWatcher); }
Source:
<code>protected List<String> getInitialRepositories() { List<String> configuredRepos = util.getConfiguredRepositories(); return configuredRepos.stream().map(name -> { File gitDir = new File(name); if (gitDir.exists()) { try { Repository repo = cache.lookupRepository(gitDir); <START> if (repo == null) { return null; } <END> if (ResourcePropertyTester.hasGerritConfiguration(repo)) { return name; } } catch (IOException e) { Activator.logError(e.getMessage(), e); return null; } } return null; }).filter(Objects::nonNull).collect(Collectors.toList()); }</code><technical_language>do if (repo != null && ResourcePropertyTester.hasGerritConfiguration(repo)) { return name; } fall out of try-catch, return null anyway</technical_language>

Target:
protected List<String> getInitialRepositories() { List<String> configuredRepos = util.getConfiguredRepositories(); return configuredRepos.stream().map(name -> { File gitDir = new File(name); if (gitDir.exists()) { try { Repository repo = cache.lookupRepository(gitDir); if (repo != null && ResourcePropertyTester.hasGerritConfiguration(repo)) { return name; } } catch (IOException e) { Activator.logWarning(e.getLocalizedMessage(), e); } } return null; }).filter(Objects::nonNull).collect(Collectors.toList()); }
Source:
<code>private static Map<String, Number> processInnodbMutex(ResultSet rs, String category) throws SQLException { String mutex; Number value; Map<String, Number> mutexes = new HashMap<String,Number>(); while (rs.next()) { mutex = buildString(category, SEPARATOR, rs.getString(2).replaceAll(INNODB_MUTEX_REGEX, EMPTY_STRING).replaceAll(ARROW, UNDERSCORE)); value = translateStringToNumber(rs.getString(3).substring(rs.getString(3).indexOf(EQUALS) +1)); if (mutexes.containsKey(mutex)) { Context.log(Level.FINE, "appending ", value); value = value.intValue() + mutexes.get(mutex).intValue(); } mutexes.put(mutex, value); } <START> Context.log(Level.FINE, mutexes); <END> return mutexes; }</code><technical_language>Consider adding a static string (like 'Mutexes: ') this more sense logs</technical_language>

Target:
private static Map<String, Number> processInnodbMutex(ResultSet rs, String category) throws SQLException { String mutex; Number value; Map<String, Number> mutexes = new HashMap<String,Number>(); while (rs.next()) { mutex = buildString(category, SEPARATOR, rs.getString(2).replaceAll(INNODB_MUTEX_REGEX, EMPTY_STRING).replaceAll(ARROW, UNDERSCORE)); value = translateStringToNumber(rs.getString(3).substring(rs.getString(3).indexOf(EQUALS) +1)); if (mutexes.containsKey(mutex)) { Context.log(Level.FINE, "appending ", value); value = value.intValue() + mutexes.get(mutex).intValue(); } mutexes.put(mutex, value); } Context.log(Level.FINE, "Mutexes: ", mutexes); return mutexes; }
Source:
<code>private Class<? extends SecureStore> getSecureStoreImpl() { if (Strings.isNullOrEmpty(secureStoreClassName)) { return DefaultSecureStore.class; } <START> else { <END> try { return (Class<? extends SecureStore>) Class.forName(secureStoreClassName); } catch (Throwable e) { String msg = String.format("Cannot load secure store class: %s", secureStoreClassName); log.error(msg, e); throw new RuntimeException(msg, e); } } }</code><technical_language>else is needed. Remove dedent block below</technical_language>

Target:
private Class<? extends SecureStore> getSecureStoreImpl() { if (Strings.isNullOrEmpty(secureStoreClassName)) { return DefaultSecureStore.class; } try { return (Class<? extends SecureStore>) Class.forName(secureStoreClassName); } catch (Throwable e) { String msg = String.format("Cannot load secure store class: %s", secureStoreClassName); log.error(msg, e); throw new RuntimeException(msg, e); } }
Source:
<code>public void testDmnFromWBNoEdges() throws Exception { <START> when(textAnnotationNode.getInEdges()).thenReturn(new ArrayList<Edge<View<Association>, ?>>()); <END> when(textAnnotationNode.getOutEdges()).thenReturn(new ArrayList<Edge<View<Association>, ?>>()); List<org.kie.dmn.model.v1_1.Association> associations = AssociationConverter.dmnFromWB(textAnnotationNode); assertEquals(0, associations.size()); }</code><technical_language>Personal preference... of Collections.emptyList()</technical_language>

Target:
public void testDmnFromWBNoEdges() throws Exception { when(textAnnotationNode.getInEdges()).thenReturn(Collections.emptyList()); when(textAnnotationNode.getOutEdges()).thenReturn(Collections.emptyList()); List<org.kie.dmn.model.v1_1.Association> associations = AssociationConverter.dmnFromWB(textAnnotationNode); assertEquals(0, associations.size()); }
Source:
<code>public Collection<Geofence> get( @QueryParam("all") boolean all, @QueryParam("userId") long userId, @QueryParam("groupId") long groupId, @QueryParam("deviceId") long deviceId, @QueryParam("refresh") boolean refresh) throws SQLException { GeofenceManager geofenceManager = Context.getGeofenceManager(); if (refresh) { geofenceManager.refreshGeofences(); } Set<Long> result; if (all) { if (Context.getPermissionsManager().isAdmin(getUserId())) { <START> result = new HashSet<>(geofenceManager.getAllGeofencesIds()); <END> } else { Context.getPermissionsManager().checkManager(getUserId()); result = new HashSet<>(geofenceManager.getManagedGeofencesIds(getUserId())); } } else { if (userId == 0) { userId = getUserId(); } Context.getPermissionsManager().checkUser(getUserId(), userId); result = new HashSet<>(geofenceManager.getUserGeofencesIds(userId)); } if (groupId != 0) { Context.getPermissionsManager().checkGroup(getUserId(), groupId); result.retainAll(geofenceManager.getGroupGeofencesIds(groupId)); } if (deviceId != 0) { Context.getPermissionsManager().checkDevice(getUserId(), deviceId); result.retainAll(geofenceManager.getDeviceGeofencesIds(deviceId)); } return geofenceManager.getGeofences(result); }</code><technical_language>thinking create HashSet once, call addAll</technical_language>

Target:
public Collection<Geofence> get( @QueryParam("all") boolean all, @QueryParam("userId") long userId, @QueryParam("groupId") long groupId, @QueryParam("deviceId") long deviceId, @QueryParam("refresh") boolean refresh) throws SQLException { GeofenceManager geofenceManager = Context.getGeofenceManager(); if (refresh) { geofenceManager.refreshGeofences(); } Set<Long> result = new HashSet<>(); if (all) { if (Context.getPermissionsManager().isAdmin(getUserId())) { result.addAll(geofenceManager.getAllGeofencesIds()); } else { Context.getPermissionsManager().checkManager(getUserId()); result.addAll(geofenceManager.getManagedGeofencesIds(getUserId())); } } else { if (userId == 0) { userId = getUserId(); } Context.getPermissionsManager().checkUser(getUserId(), userId); result.addAll(geofenceManager.getUserGeofencesIds(userId)); } if (groupId != 0) { Context.getPermissionsManager().checkGroup(getUserId(), groupId); result.retainAll(geofenceManager.getGroupGeofencesIds(groupId)); } if (deviceId != 0) { Context.getPermissionsManager().checkDevice(getUserId(), deviceId); result.retainAll(geofenceManager.getDeviceGeofencesIds(deviceId)); } return geofenceManager.getGeofences(result); }
Source:
<code>public void testLoadWithNoInitCMandMissMatchedServerId() { assertNotNull(client.configMaps().withName(TEST_KIE_SERVER_ID).delete()); System.setProperty(KieServerConstants.KIE_SERVER_ID, TEST_KIE_SERVER_ID); assertEquals(TEST_KIE_SERVER_ID, repo.load(TEST_KIE_SERVER_ID) .getConfiguration().getConfigItemValue(KieServerConstants.KIE_SERVER_ID)); <START> <END> System.setProperty(KieServerConstants.KIE_SERVER_ID, "wrongId"); repo.load(TEST_KIE_SERVER_ID) .getConfiguration().getConfigItemValue(KieServerConstants.KIE_SERVER_ID); System.clearProperty(KieServerConstants.KIE_SERVER_ID); }</code><technical_language>Please add licence header</technical_language>

Target:
public void testLoadWithNoInitCMandMissMatchedServerId() { assertNotNull(client.configMaps().withName(TEST_KIE_SERVER_ID).delete()); System.setProperty(KieServerConstants.KIE_SERVER_ID, TEST_KIE_SERVER_ID); assertEquals(TEST_KIE_SERVER_ID, repo.load(TEST_KIE_SERVER_ID) .getConfiguration().getConfigItemValue(KieServerConstants.KIE_SERVER_ID)); System.setProperty(KieServerConstants.KIE_SERVER_ID, "wrongId"); repo.load(TEST_KIE_SERVER_ID) .getConfiguration().getConfigItemValue(KieServerConstants.KIE_SERVER_ID); }
Source:
<code>private void validate() throws IOException { Map<String, Object> alwaysMatch = getAlwaysMatch(); if (alwaysMatch == null) { alwaysMatch = ImmutableMap.of(); } Map<String, Object> always = alwaysMatch; Collection<Map<String, Object>> firsts = getFirstMatches(); if (firsts == null) { firsts = ImmutableList.of(ImmutableMap.of()); } if (firsts.isEmpty()) { throw new IllegalArgumentException("First match w3c capabilities is zero length"); } firsts.stream() .peek(map -> { Set<String> overlap = Sets.intersection(always.keySet(), map.keySet()); if (!overlap.isEmpty()) { throw new IllegalArgumentException( "Overlapping keys between w3c always and first match capabilities: " + overlap); } }) .map(first -> { Map<String, Object> toReturn = new HashMap<>(); toReturn.putAll(always); toReturn.putAll(first); return toReturn; }) .peek(map -> { ImmutableSortedSet<String> nullKeys = map.entrySet().stream() .filter(entry -> entry.getValue() == null) .map(Map.Entry::getKey) .collect(ImmutableSortedSet.toImmutableSortedSet(Ordering.natural())); if (!nullKeys.isEmpty()) { throw new IllegalArgumentException( "Null values found in w3c capabilities. Keys are: " + nullKeys); } }) .peek(map -> { ImmutableSortedSet<String> illegalKeys = map.entrySet().stream() .filter(entry -> !ACCEPTED_W3C_PATTERNS.test(entry.getKey())) .map(Map.Entry::getKey) .collect(ImmutableSortedSet.toImmutableSortedSet(Ordering.natural())); if (!illegalKeys.isEmpty()) { throw new IllegalArgumentException( "Illegal key values seen in w3c capabilities: " + illegalKeys); } }) <START> .forEach(map -> {}); <END> }</code><technical_language>is purpose of this operator</technical_language>

Target:
private void validate() throws IOException { Map<String, Object> alwaysMatch = getAlwaysMatch(); if (alwaysMatch == null) { alwaysMatch = of(); } Map<String, Object> always = alwaysMatch; Collection<Map<String, Object>> firsts = getFirstMatch(); if (firsts == null) { firsts = ImmutableList.of(of()); } if (firsts.isEmpty()) { throw new IllegalArgumentException("First match w3c capabilities is zero length"); } firsts.stream() .peek(map -> { Set<String> overlap = Sets.intersection(always.keySet(), map.keySet()); if (!overlap.isEmpty()) { throw new IllegalArgumentException( "Overlapping keys between w3c always and first match capabilities: " + overlap); } }) .map(first -> { Map<String, Object> toReturn = new HashMap<>(); toReturn.putAll(always); toReturn.putAll(first); return toReturn; }) .peek(map -> { ImmutableSortedSet<String> nullKeys = map.entrySet().stream() .filter(entry -> entry.getValue() == null) .map(Map.Entry::getKey) .collect(ImmutableSortedSet.toImmutableSortedSet(Ordering.natural())); if (!nullKeys.isEmpty()) { throw new IllegalArgumentException( "Null values found in w3c capabilities. Keys are: " + nullKeys); } }) .peek(map -> { ImmutableSortedSet<String> illegalKeys = map.entrySet().stream() .filter(entry -> !ACCEPTED_W3C_PATTERNS.test(entry.getKey())) .map(Map.Entry::getKey) .collect(ImmutableSortedSet.toImmutableSortedSet(Ordering.natural())); if (!illegalKeys.isEmpty()) { throw new IllegalArgumentException( "Illegal key values seen in w3c capabilities: " + illegalKeys); } }); }
Source:
<code>public long getUpdatedTime() { <START> return sentTime; <END> }</code><technical_language>slightly more order receive time: time is set sender, necessarily lead "newest first" behaviour (consider a friend disconnected for some time)</technical_language>

Target:
public long getUpdatedTime() { return receivedTime; }
Source:
<code>private void sendHeartbeats() { if (!heartbeatQueue.isEmpty()) { HeartbeatLockRequest heartbeatLockRequest = heartbeatQueue.getFirst(); int remainingHeartbeat = Math.max(heartbeatLockRequest.getRemainingHeartbeatCount().get(), 0); if (remainingHeartbeat == 0) { log.warn("***MAX HEARTBEAT REACHED***. No longer sending heartbeats to {}", heartbeatLockRequest.getLock()); heartbeatQueue.remove(heartbeatLockRequest); } else { try { HeartbeatResponse heartbeatResponse = heartbeat(heartbeatLockRequest.getLock()); switch (heartbeatResponse.getLockStatus()) { case EXPIRED: case ERROR: log.warn("Lock status for {}", heartbeatResponse.getLockStatus(), heartbeatResponse.getLock()); heartbeatQueue.remove(heartbeatLockRequest); break; default: <START> log.info("Remaining heartbeat count: {}. Refreshed lock {}", remainingHeartbeat, heartbeatResponse.getLock()); <END> heartbeatLockRequest.setLock(heartbeatResponse.getLock()); } } catch (Exception e) { log.error("Heartbeat for failed", heartbeatLockRequest, heartbeatLockRequest.getLock(), e); heartbeatQueue.remove(heartbeatLockRequest); } heartbeatLockRequest.decrementRemainingHeartbeat(); } } }</code><technical_language>More long lines; lt 120</technical_language>

Target:
private void sendHeartbeats() { if (heartbeatQueue.isEmpty()) { return; } HeartbeatLockRequest heartbeatLockRequest = heartbeatQueue.getFirst(); if (heartbeatLockRequest.timesUp()) { log.warn("***MAX HEARTBEAT REACHED***. No longer sending heartbeats to {}", heartbeatLockRequest.getLock()); heartbeatQueue.remove(heartbeatLockRequest); } else { try { HeartbeatResponse heartbeatResponse = heartbeat(heartbeatLockRequest.getLock()); switch (heartbeatResponse.getLockStatus()) { case EXPIRED: case ERROR: log.warn("Lock status for {}", heartbeatResponse.getLockStatus(), heartbeatResponse.getLock()); heartbeatQueue.remove(heartbeatLockRequest); break; default: log.debug("Remaining lock duration {}ms. Refreshed lock {}", heartbeatLockRequest.getRemainingLockDuration().toMillis(), heartbeatResponse.getLock()); heartbeatLockRequest.setLock(heartbeatResponse.getLock()); } } catch (Exception e) { log.error("Heartbeat for failed", heartbeatLockRequest, heartbeatLockRequest.getLock(), e); heartbeatQueue.remove(heartbeatLockRequest); } } }
Source:
<code>public void verifyTitleUrl(String expectedUrl) { String titleUrl = titleLink.getAttribute("href"); Assertion.assertEquals(expectedUrl, titleUrl); <START> } <END></code><technical_language>consider adding logging assert</technical_language>

Target:
public void verifyTitleUrl(String expectedUrl) { String titleUrl = titleLink.getAttribute("href"); Assertion.assertEquals(expectedUrl, titleUrl); PageObjectLogging.log("verifyTitleUrl", "Title URL is correct", true); }
Source:
<code>public Object evaluate(Map<String, Object> requestData) { final PMML4Result toReturn = getPMML4Result(targetField); final KiePMMLSessionUtils kiePMMLSessionUtils = KiePMMLSessionUtils.builder(packageDescr, toReturn) <START> .withAgendaEventListener(agendaEventListener) <END> .withObjectsInSession(requestData, fieldTypeMap) .withOutputFieldsMap(outputFieldsMap) .build(); kiePMMLSessionUtils.fireAllRules(); return toReturn; }</code><technical_language>please wrap this call if statement add if log level is debug</technical_language>

Target:
public Object evaluate(Map<String, Object> requestData) { final PMML4Result toReturn = getPMML4Result(targetField); KiePMMLSessionUtils.Builder builder = KiePMMLSessionUtils.builder(packageDescr, toReturn) .withObjectsInSession(requestData, fieldTypeMap) .withOutputFieldsMap(outputFieldsMap); if (logger.isDebugEnabled()) { builder = builder.withAgendaEventListener(agendaEventListener); } final KiePMMLSessionUtils kiePMMLSessionUtils = builder.build(); kiePMMLSessionUtils.fireAllRules(); return toReturn; }
Source:
<code>public void testCanReadInputStream() throws IOException { File rasterfile = TestData.file(GeoTiffReaderTest.class, "geo.tiff"); FileInputStream is = new FileInputStream(rasterfile); <START> GeoTiffReader reader = new GeoTiffReader(is); <END> GridCoverage2D gridCoverage = reader.read(null); assertTrue(gridCoverage != null && gridCoverage.getNumSampleDimensions() == 1); }</code><technical_language>remember dispose of reader in other tests, build issues in Windows (due file locking)</technical_language>

Target:
public void testCanReadInputStream() throws IOException { File rasterfile = TestData.file(GeoTiffReaderTest.class, "geo.tiff"); GeoTiffReader reader = null; try(FileInputStream is = new FileInputStream(rasterfile)) { reader = new GeoTiffReader(is); GridCoverage2D gridCoverage = reader.read(null); assertTrue(gridCoverage != null && gridCoverage.getNumSampleDimensions() == 1); gridCoverage.dispose(true); } finally { if(reader != null) { reader.dispose(); } } }
Source:
<code>private void checkReleased() { <START> if (isReleased()) { <END> throw new IllegalStateException("Memory manager released"); } }</code><technical_language>here</technical_language>

Target:
private void checkReleased() { if (released) { throw new IllegalStateException("Memory manager released"); } }
Source:
<code>public boolean exists() { try { if (existsFlagSupplier == null) { <START> return false; <END> } return existsFlagSupplier.test(this); } catch (Exception e) { throw handleErrorInCallback(e, "existsFlagSupplier"); } }</code><technical_language>I inverting this if check improve readability/flow consistent other methods in this class</technical_language>

Target:
public boolean exists() { try { if (existsFlagSupplier != null) { return existsFlagSupplier.test(this); } return false; } catch (Exception e) { throw handleErrorInCallback(e, "existsFlagSupplier"); } }
Source:
<code>public void testIsHostedEngineStorage() { VmStatic vm = new VmStatic(); vm.setId(Guid.newGuid()); <START> vm.setOrigin(OriginType.HOSTED_ENGINE); <END> dbFacade.getVmStaticDao().save(vm); DiskImage disk = new DiskImage(); disk.setId(Guid.newGuid()); disk.setImageId(Guid.newGuid()); disk.setVolumeType(VolumeType.Preallocated); disk.setVolumeFormat(VolumeFormat.RAW); dbFacade.getImageDao().save(disk.getImage()); dbFacade.getBaseDiskDao().save(disk); ImageStorageDomainMap map = new ImageStorageDomainMap( disk.getImageId(), existingDomain.getId(), null, null); dbFacade.getImageStorageDomainMapDao().save(map); VmDevice device = new VmDevice( new VmDeviceId(disk.getId(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK.getName(), "", 0, null, true, false, false, "", null, null, null); dbFacade.getVmDeviceDao().save(device); DiskVmElement diskVmElement = new DiskVmElement(device.getId()); diskVmElement.setDiskInterface(DiskInterface.IDE); dbFacade.getDiskVmElementDao().save(diskVmElement); StorageDomain domain = dao.get(existingDomain.getId()); assertTrue(domain.isHostedEngineStorage()); }</code><technical_language>need test other hosted engine origin well</technical_language>

Target:
public void testIsHostedEngineStorage() { VmStatic vm = new VmStatic(); vm.setId(Guid.newGuid()); vm.setOrigin(OriginType.HOSTED_ENGINE); dbFacade.getVmStaticDao().save(vm); DiskImage disk = new DiskImage(); disk.setId(Guid.newGuid()); disk.setImageId(Guid.newGuid()); disk.setVolumeType(VolumeType.Preallocated); disk.setVolumeFormat(VolumeFormat.RAW); dbFacade.getImageDao().save(disk.getImage()); dbFacade.getBaseDiskDao().save(disk); ImageStorageDomainMap map = new ImageStorageDomainMap( disk.getImageId(), existingDomain.getId(), null, null); dbFacade.getImageStorageDomainMapDao().save(map); VmDevice device = new VmDevice( new VmDeviceId(disk.getId(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK.getName(), "", 0, null, true, false, false, "", null, null, null); dbFacade.getVmDeviceDao().save(device); DiskVmElement diskVmElement = new DiskVmElement(device.getId()); diskVmElement.setDiskInterface(DiskInterface.IDE); dbFacade.getDiskVmElementDao().save(diskVmElement); StorageDomain domain = dao.get(existingDomain.getId()); assertTrue(domain.isHostedEngineStorage()); vm.setOrigin(OriginType.MANAGED_HOSTED_ENGINE); dbFacade.getVmStaticDao().update(vm); domain = dao.get(existingDomain.getId()); assertTrue(domain.isHostedEngineStorage()); }
Source:
<code>public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { InetSocketAddress remoteAddress = (InetSocketAddress) ctx.channel().remoteAddress(); if (remoteAddress != null) { <START> logger.error("Exception: " + cause.getMessage() + ", from: " + remoteAddress.getHostString() + ":" + remoteAddress.getPort()); <END> } else { logger.error("Exception: " + cause.getMessage()); } messageListener.onException(ctx, cause); ctx.close(); }</code><technical_language>InetSocketAddress a reasonable toString for 'from' part >> java.net.InetSocketAddress.new("foo", 2345).toString => "foo:2345"</technical_language>

Target:
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { InetSocketAddress remoteAddress = (InetSocketAddress) ctx.channel().remoteAddress(); if (remoteAddress != null) { logger.info("Exception: " + cause.getMessage() + ", from: " + remoteAddress.toString()); } else { logger.info("Exception: " + cause.getMessage()); } messageListener.onException(ctx, cause); ctx.close(); }
Source:
<code><START> public FilterEntry(String eventName, boolean exclude, String transport, String name) { <END> this.eventName = eventName; this.exclude = exclude; recipient = new Recipient(transport, name); }</code><technical_language>I added constructor Recipient :)</technical_language>

Target:
public FilterEntry(String eventName, boolean exclude, String transport, String name) { this.eventName = eventName; this.exclude = exclude; if (transport != null){ recipient = new Recipient(transport, name); } else { recipient = null; } }
Source:
<code>private boolean getPreference() { IEclipsePreferences preferences = <START> preferences(); <END> boolean preferenceValue = preferences.getBoolean(PREFERENCE_NAME, false); return preferenceValue; }</code><technical_language>Writing INSTANCE scope is OK, read default (product/config) preferences, more scope</technical_language>

Target:
private boolean getPreference() { IPreferencesService preferencesService = Platform.getPreferencesService(); boolean preferenceValue = preferencesService.getBoolean(JDIDebugPlugin.getUniqueIdentifier(), JDIDebugModel.PREF_SHOW_STEP_RESULT, false, null); return preferenceValue; }
Source:
<code>protected boolean canSelectFormat( Format format, int trackBitrate, float playbackSpeed, long effectiveBitrate) { <START> boolean isNonIframeOnly = (format.roleFlags & C.ROLE_FLAG_TRICK_PLAY) == 0; <END> boolean canSelect = Math.round(trackBitrate * playbackSpeed) <= effectiveBitrate; return canSelect && isNonIframeOnly; }</code><technical_language>Nit: replace this variable is isTrickPlayTrack isIFrameOnlyTrack (would require negating comparison != 0). Otherwise, read a track I-frames, inaccurate. Right</technical_language>

Target:
protected boolean canSelectFormat( Format format, int trackBitrate, float playbackSpeed, long effectiveBitrate) { boolean isIframeOnlyFormat = (format.roleFlags & C.ROLE_FLAG_TRICK_PLAY) != 0; boolean canSelect = Math.round(trackBitrate * playbackSpeed) <= effectiveBitrate; return canSelect && !isIframeOnlyFormat; }
Source:
<code>public boolean apply(final Resource item) { <START> return "*".equals(role) || "*".equals(item.getRole()) || item.getRole().equals(role); <END> }</code><technical_language>I want absorb extra logic necessary able combine offers right point resources multiple roles. Please remove this for now, decide if want do multi-role support on</technical_language>

Target:
public boolean apply(final Resource item) { return item.getRole().equals(role); }
Source:
<code>public Statement apply( Statement base, Description description ) { Repeat repeat = description.getAnnotation( Repeat.class ); if ( repeat != null || defaultTimes > 1 ) { <START> return new RepeatStatement( max( repeat != null ? repeat.times() : 1, defaultTimes ), base, description ); <END> } return base; }</code><technical_language>I expect annotation overrule default, if is smaller</technical_language>

Target:
public Statement apply( Statement base, Description description ) { Repeat repeat = description.getAnnotation( Repeat.class ); if ( repeat != null ) { return new RepeatStatement( repeat.times(), base, description ); } if ( defaultTimes > 1 ) { return new RepeatStatement( defaultTimes, base, description ); } return base; }
Source:
<code>private void render(DiffInfo diff) { JsArray<Region> regions = diff.content(); Configuration insertOpt = Configuration.create() .set("className", diffTable.style.insert()) .set("readOnly", true); Configuration deleteOpt = Configuration.create() .set("className", diffTable.style.delete()) .set("readOnly", true); int lineA = 0, lineB = 0; for (int i = 0; i < regions.length(); i++) { Region current = regions.get(i); if (current.ab() != null) { lineA += current.ab().length(); lineB += current.ab().length(); } else if (current.a() == null && current.b() != null) { int delta = current.b().length(); for (int j = 0; j < delta; j++) { addPadding(cmA, lineA - 1); } for (int j = 0; j < delta; j++) { cmB.addLineClass(lineB, LineClassWhere.WRAP, diffTable.style.insert()); <START> cmB.markText( <END> LineCharacter.create(lineB, 0), LineCharacter.create(lineB, 0), insertOpt); lineB++; } } else if (current.a() != null && current.b() == null) { int delta = current.a().length(); for (int j = 0; j < delta; j++) { addPadding(cmB, lineB - 1); } for (int j = 0; j < delta; j++) { cmA.addLineClass(lineA, LineClassWhere.WRAP, diffTable.style.delete()); cmA.markText( LineCharacter.create(lineA, 0), LineCharacter.create(lineA, 0), deleteOpt); lineA++; } } else { lineA += current.a().length(); lineB += current.a().length(); } } }</code><technical_language>"from" (I wrong local), markText of loop delta (to tried)</technical_language>

Target:
private void render(DiffInfo diff) { JsArray<Region> regions = diff.content(); Configuration insertOpt = Configuration.create() .set("className", diffTable.style.insert()) .set("readOnly", true); Configuration deleteOpt = Configuration.create() .set("className", diffTable.style.delete()) .set("readOnly", true); int lineA = 0, lineB = 0; for (int i = 0; i < regions.length(); i++) { Region current = regions.get(i); if (current.ab() != null) { lineA += current.ab().length(); lineB += current.ab().length(); } else if (current.a() == null && current.b() != null) { int delta = current.b().length(); for (int j = 0; j < delta; j++) { addPadding(cmA, lineA - 1); } for (int j = 0; j < delta; j++) { cmB.addLineClass(lineB, LineClassWhere.WRAP, diffTable.style.insert()); LineCharacter from = LineCharacter.create(lineB, 0); cmB.markText(from, from, insertOpt); lineB++; } } else if (current.a() != null && current.b() == null) { int delta = current.a().length(); for (int j = 0; j < delta; j++) { addPadding(cmB, lineB - 1); } for (int j = 0; j < delta; j++) { cmA.addLineClass(lineA, LineClassWhere.WRAP, diffTable.style.delete()); LineCharacter from = LineCharacter.create(lineA, 0); cmA.markText(from, from, deleteOpt); lineA++; } } else { lineA += current.a().length(); lineB += current.a().length(); } } }
Source:
<code>protected DiscoveryEnabledServer createServer(final InstanceInfo instanceInfo, boolean useSecurePort, boolean useIpAddr) { DiscoveryEnabledServer server = new DiscoveryEnabledServer(instanceInfo, useSecurePort, useIpAddr); <START> server.setZone(DiscoveryClient.getZone(instanceInfo)); <END> return server; }</code><technical_language>improve API, for now, change deprecated DiscoveryClient.getZone following? First, get hold of EurekaClient (there is instance), EurekaClientConfig clientConfig = eurekaClient.getEurekaClientConfig(); String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion()); String instanceZone = InstanceInfo.getZone(availZones, myInstanceInfo); server.setZone(instanceZone);</technical_language>

Target:
protected DiscoveryEnabledServer createServer(final InstanceInfo instanceInfo, boolean useSecurePort, boolean useIpAddr) { DiscoveryEnabledServer server = new DiscoveryEnabledServer(instanceInfo, useSecurePort, useIpAddr); EurekaClientConfig clientConfig = eurekaClientProvider.get().getEurekaClientConfig(); String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion()); String instanceZone = InstanceInfo.getZone(availZones, instanceInfo); server.setZone(instanceZone); return server; }
Source:
<code>public void updateScore(Solution_ solution) { <START> getScore(solution); <END> }</code><technical_language>ok, getScore() extract it, calculates it? 2 methods do same, I guess updateScore() needs deprecated</technical_language>

Target:
public Score updateScore(Solution_ solution) { try (ScoreDirector<Solution_> scoreDirector = scoreDirectorFactory.buildScoreDirector()) { scoreDirector.setWorkingSolution(solution); return scoreDirector.calculateScore(); } }