auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void bindToConfiguration() { this.projectDirText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { File projectDir = FileUtils.getAbsoluteFile(GradleProjectWizardPage.this.projectDirText.getText()).orNull(); getConfiguration().setProjectDir(projectDir); if (NONE == getMessageType()) { if (WorkspaceUtils.isInWorkspaceFolder(projectDir)) { <START> setMessage("It is recommended to locate your Gradle projects outside the workspace location", <END> WARNING); } } } }); this.workingSetConfigurationWidget.addWorkingSetChangeListener(new WorkingSetChangedListener() { @Override public void workingSetsChanged(List<IWorkingSet> workingSets) { List<String> workingSetNames = WorkingSetUtils.toWorkingSetNames(workingSets); getConfiguration().setWorkingSets(workingSetNames); } }); this.workingSetConfigurationWidget.getWorkingSetsEnabledButton().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean selected = GradleProjectWizardPage.this.workingSetConfigurationWidget.getWorkingSetsEnabledButton().getSelection(); getConfiguration().setApplyWorkingSets(selected); } }); }</code><technical_language>state for configurations root project folder renamed</technical_language>

Target:
private void bindToConfiguration() { this.projectDirText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { File projectDir = FileUtils.getAbsoluteFile(GradleProjectWizardPage.this.projectDirText.getText()).orNull(); getConfiguration().setProjectDir(projectDir); if (NONE == getMessageType()) { if (WorkspaceUtils.isInWorkspaceFolder(projectDir)) { setMessage(ProjectWizardMessages.GradleProjectWizardPage_project_workspace_location_warning, WARNING); } } } }); this.workingSetConfigurationWidget.addWorkingSetChangeListener(new WorkingSetChangedListener() { @Override public void workingSetsChanged(List<IWorkingSet> workingSets) { List<String> workingSetNames = WorkingSetUtils.toWorkingSetNames(workingSets); getConfiguration().setWorkingSets(workingSetNames); } }); this.workingSetConfigurationWidget.getWorkingSetsEnabledButton().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean selected = GradleProjectWizardPage.this.workingSetConfigurationWidget.getWorkingSetsEnabledButton().getSelection(); getConfiguration().setApplyWorkingSets(selected); } }); }
Source:
<code>private static Map<String, String> getHostSystemProperties() { final Map<String, String> hostSystemProperties = new HashMap<String, String>(); try { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); for (String arg : runtime.getInputArguments()) { if (arg != null && arg.length() > 2 && arg.startsWith("-D")) { arg = arg.substring(2); int doubleEqualIndex = arg.indexOf("=="); <START> if (doubleEqualIndex > 0) { <END> hostSystemProperties.put(arg.substring(0, doubleEqualIndex), arg.substring(doubleEqualIndex + 1)); continue; } int equalIndex = arg.indexOf("="); if (equalIndex >= 0) { hostSystemProperties.put(arg.substring(0, equalIndex), arg.substring(equalIndex + 1)); } else { hostSystemProperties.put(arg, null); } } } } catch (Exception e) { STDERR.println(HostControllerLogger.ROOT_LOGGER.cannotAccessJvmInputArgument(e)); } return hostSystemProperties; }</code><technical_language>This check dropped</technical_language>

Target:
private static Map<String, String> getHostSystemProperties() { final Map<String, String> hostSystemProperties = new HashMap<String, String>(); try { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String propertyName, propertyValue; for (String arg : runtime.getInputArguments()) { if (arg != null && arg.length() > 2 && arg.startsWith("-D")) { arg = arg.substring(2); int equalIndex = arg.indexOf("="); if (equalIndex >= 0) { propertyName = arg.substring(0, equalIndex); propertyValue = arg.substring(equalIndex + 1); } else { propertyName = arg; propertyValue = null; } if (!hostSystemProperties.containsKey(propertyName)) { hostSystemProperties.put(propertyName, propertyValue); } } } } catch (Exception e) { STDERR.println(HostControllerLogger.ROOT_LOGGER.cannotAccessJvmInputArgument(e)); } return hostSystemProperties; }
Source:
<code>@Override public boolean test(Map<Object, Object> map) throws Exception { final int n = nextRandom(args.range()); final String key = "key"+n; final String otherKey = "other_"+key; final IgniteCache<String, Integer> cache = cacheForOperation(); final Lock lock = cache.lock(key); <START> lock.lock(); <END> try { cache.put(otherKey, cache.get(otherKey)+1); } finally { lock.unlock(); } return true; }</code><technical_language>newline</technical_language>

Target:
@Override public boolean test(Map<Object, Object> map) throws Exception { lock.lock(); lock.unlock(); return true; }
Source:
<code>public void testEquals_other() { <START> setUp(); <END> try (CtfIterator obj = (CtfIterator) trace.createIterator();) { assertNotNull(obj); CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0)); obj.setLocation(ctfLocation1); obj.increaseRank(); boolean result = iterator.equals(obj); assertTrue(result); } }</code><technical_language>calling setUp()? Is a avoid this</technical_language>

Target:
public void testEquals_other() { CtfIterator obj = iterator; assertNotNull(obj); CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0)); obj.setLocation(ctfLocation1); obj.increaseRank(); boolean result = iterator.equals(obj); assertTrue(result); }
Source:
<code>public void testRedactImage() throws IOException { RedactImageFile.redactImageFile(PROJECT_ID, "src/test/resources/test.png"); String output = bout.toString(); assertThat(output, containsString("Redacted image written")); <START> Path outputFile = Paths.get("redacted.png"); <END> Files.delete(outputFile); }</code><technical_language>This in a separate cleanup function tag, runs of test fails</technical_language>

Target:
public void testRedactImage() { RedactImageFile.redactImageFile(PROJECT_ID, "src/test/resources/test.png"); String output = bout.toString(); assertThat(output, containsString("Redacted image written")); }
Source:
<code>public CustomConversions(StoreConversions storeConversions, List<?> converters) { Assert.notNull(converters, "List of converters must not be null!"); this.readingPairs = new LinkedHashSet<>(); this.writingPairs = new LinkedHashSet<>(); this.customSimpleTypes = new HashSet<>(); this.customReadTargetTypes = new ConcurrentHashMap<>(); this.customWriteTargetTypes = new ConcurrentHashMap<>(); this.rawWriteTargetTypes = new ConcurrentHashMap<>(); List<Object> toRegister = new ArrayList<Object>(); toRegister.addAll(converters); <START> toRegister.addAll(JodaTimeConverters.getConvertersToRegister()); <END> toRegister.addAll(Jsr310Converters.getConvertersToRegister()); toRegister.addAll(ThreeTenBackPortConverters.getConvertersToRegister()); toRegister.addAll(storeConversions.getStoreConverters()); toRegister.stream() .flatMap(it -> storeConversions.getRegistrationsFor(it).stream()) .forEach(this::register); Collections.reverse(toRegister); this.converters = Collections.unmodifiableList(toRegister); this.simpleTypeHolder = new SimpleTypeHolder(customSimpleTypes, storeConversions.getStoreTypeHolder()); }</code><technical_language>holding default converters in a static held List? added in order time constructor is called</technical_language>

Target:
public CustomConversions(StoreConversions storeConversions, List<?> converters) { Assert.notNull(converters, "List of converters must not be null!"); this.readingPairs = new LinkedHashSet<>(); this.writingPairs = new LinkedHashSet<>(); this.customSimpleTypes = new HashSet<>(); this.customReadTargetTypes = new ConcurrentHashMap<>(); this.customWriteTargetTypes = new ConcurrentHashMap<>(); this.rawWriteTargetTypes = new ConcurrentHashMap<>(); List<Object> toRegister = new ArrayList<Object>(); toRegister.addAll(converters); toRegister.addAll(storeConversions.getStoreConverters()); toRegister.addAll(DEFAULT_CONVERTERS); toRegister.stream() .flatMap(it -> storeConversions.getRegistrationsFor(it).stream()) .forEach(this::register); Collections.reverse(toRegister); this.converters = Collections.unmodifiableList(toRegister); this.simpleTypeHolder = new SimpleTypeHolder(customSimpleTypes, storeConversions.getStoreTypeHolder()); }
Source:
<code>public void shutdown() throws Exception { stopThread = true; <START> synchronized (close) { <END> thread.interrupt(); } thread.join(); thread = null; }</code><technical_language>synchronized block include stopThread = true close.notify() thread.interrupt</technical_language>

Target:
public void shutdown() throws Exception { stopThread = true; synchronized (close) { stopThread = true; close.notify(); thread.interrupt(); } thread.join(); thread = null; }
Source:
<code>public void add(ConstraintVariable2 variable) { for (ConstraintVariable2 <START> fVariable : <END> fVariables) { if (fVariable == variable) { return; } } int length= fVariables.length; ConstraintVariable2[] newElements= new ConstraintVariable2[length + 1]; System.arraycopy(fVariables, 0, newElements, 0, length); newElements[length]= variable; fVariables= newElements; }</code><technical_language>rename constraintVariable</technical_language>

Target:
public void add(ConstraintVariable2 variable) { for (ConstraintVariable2 constraintVariable : fVariables) { if (constraintVariable == variable) { return; } } int length= fVariables.length; ConstraintVariable2[] newElements= new ConstraintVariable2[length + 1]; System.arraycopy(fVariables, 0, newElements, 0, length); newElements[length]= variable; fVariables= newElements; }
Source:
<code>protected void initSynchronizer(final DiagramDescription description, final String diagramName) { sync = new DDiagramSynchronizer(interpreter, description, accessor); sync.initDiagram(semanticModel, new NullProgressMonitor()); boolean syncOnCreation = Platform.getPreferencesService().getBoolean(DiagramPlugin.ID, SiriusDiagramInternalPreferencesKeys.PREF_SYNCHRONIZE_DIAGRAM_ON_CREATION.name(), false, null); sync.getDiagram().setSynchronized(syncOnCreation); <START> if (sync.getDiagram() != null) { <END> RepresentationsHelper.createDRepresentationDescriptor(sync.getDiagram(), (DAnalysisSessionImpl) session, sync.getDiagram().eResource(), diagramName); } }</code><technical_language>null diagram is created in sync.initDiagram method</technical_language>

Target:
protected void initSynchronizer(final DiagramDescription description, final String diagramName) { sync = new DDiagramSynchronizer(interpreter, description, accessor); sync.initDiagram(semanticModel, new NullProgressMonitor()); boolean syncOnCreation = Platform.getPreferencesService().getBoolean(DiagramPlugin.ID, SiriusDiagramInternalPreferencesKeys.PREF_SYNCHRONIZE_DIAGRAM_ON_CREATION.name(), false, null); sync.getDiagram().setSynchronized(syncOnCreation); DRepresentationDescriptorInternalHelper.createDRepresentationDescriptor(sync.getDiagram(), (DAnalysisSessionImpl) session, sync.getDiagram().eResource(), diagramName); }
Source:
<code>public void onAddGroupsToGroup(Id me, Collection<AccountGroupById> added) { List<AccountGroupByIdAud> includesAudit = new ArrayList<>(); for (AccountGroupById groupInclude : added) { AccountGroupByIdAud audit = new AccountGroupByIdAud(groupInclude, me, TimeUtil.nowTs()); includesAudit.add(audit); } try { db.get().accountGroupByIdAud().insert(includesAudit); } catch (OrmException e) { for (AccountGroupById m : added) { String pattern = "Cannot log add groups to group event: " + "group {0} added to group {1} by user {2}"; String message = MessageFormat.format(pattern, m.getKey().getIncludeUUID(), m .getKey().getGroupId(), me); <START> log.error(message); <END> } } }</code><technical_language>missing stack trace of e... logged logged N times</technical_language>

Target:
public void onAddGroupsToGroup(Id me, Collection<AccountGroupById> added) { List<AccountGroupByIdAud> includesAudit = new ArrayList<>(); for (AccountGroupById groupInclude : added) { AccountGroupByIdAud audit = new AccountGroupByIdAud(groupInclude, me, TimeUtil.nowTs()); includesAudit.add(audit); } try { db.get().accountGroupByIdAud().insert(includesAudit); } catch (OrmException e) { StringBuilder message = new StringBuilder( "Cannot log add groups to group event performed by user "); message.append(me); message.append(": "); message.append(Joiner.on("; ").join(added)); log.error(message.toString(), e); } }
Source:
<code>public String getRestMethodName() { if (scrollId.length() > MAX_SCROLL_ID_LENGTH) { <START> return "POST"; <END> } return "GET"; }</code><technical_language>Single exit point (single return a local variable) nicer imho</technical_language>

Target:
public String getRestMethodName() { return scrollId.length() > MAX_SCROLL_ID_LENGTH ? "POST" : "GET"; }
Source:
<code><START> public static Slice succinctDuration(@SqlType(StandardTypes.DOUBLE) double value, @SqlType(StandardTypes.VARCHAR) Slice unit) <END> { try { Duration duration = Duration.succinctDuration(value, valueOfTimeUnit(unit.toStringUtf8())); return utf8Slice(duration.toString()); } catch (IllegalArgumentException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e); } }</code><technical_language>good practice wrap relevant code throw try/catch: Duration duration; try { duration = Duration.succinctDuration(value, valueOfTimeUnit(unit.toStringUtf8())); } catch (IllegalArgumentException e) { // is negative, NaN, etc. throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e); } return utf8Slice(duration.toString());</technical_language>

Target:
public static Slice succinctDuration(@SqlType(StandardTypes.DOUBLE) double value, @SqlType(StandardTypes.VARCHAR) Slice unit) { Duration duration; try { duration = Duration.succinctDuration(value, valueOfTimeUnit(unit.toStringUtf8())); } catch (IllegalArgumentException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e); } return utf8Slice(duration.toString()); }
Source:
<code>public Deployment getNode(final String id) { final Deployment deployment = api.getDeploymentApiForService(id).get(id); <START> if (deployment != null && !deployment.roleInstanceList().isEmpty()) { <END> return FluentIterable.from(deployment.roleInstanceList()).allMatch( new Predicate<RoleInstance>() { @Override public boolean apply(final RoleInstance input) { return input != null && !input.instanceStatus().isTransient(); } }) ? deployment : null; } return FluentIterable.from(api.getCloudServiceApi().list()). transform(new Function<CloudService, Deployment>() { @Override public Deployment apply(final CloudService input) { final Deployment deployment = api.getDeploymentApiForService(input.name()).get(id); return deployment == null || deployment.roleInstanceList().isEmpty() ? null : FluentIterable.from(deployment.roleInstanceList()).allMatch( new Predicate<RoleInstance>() { @Override public boolean apply(final RoleInstance input) { return input != null && !input.instanceStatus().isTransient(); } }) ? deployment : null; } }). firstMatch(notNull()). orNull(); }</code><technical_language>This conditional is below. Refactor this a bit reuse code</technical_language>

Target:
public Deployment getNode(final String id) { final Deployment deployment = api.getDeploymentApiForService(id).get(id); if (deployment != null) { return isSettled(deployment); } return FluentIterable.from(api.getCloudServiceApi().list()). transform(new Function<CloudService, Deployment>() { @Override public Deployment apply(final CloudService input) { final Deployment deployment = api.getDeploymentApiForService(input.name()).get(id); return isSettled(deployment); } }). firstMatch(notNull()). orNull(); }
Source:
<code><START> @Override public void onDestroyView() { <END> super.onDestroyView(); if (disposable != null) { disposable.dispose(); } }</code><technical_language>Please move annotation line</technical_language>

Target:
public void onDestroyView() { super.onDestroyView(); if (disposable != null) { disposable.dispose(); } }
Source:
<code>public GridFsResource[] getResources(String locationPattern) { Pattern pattern = Pattern.compile(locationPattern); return StreamSupport .stream(find(query(whereFilename().regex(pattern))).spliterator(), false) <START> .map(GridFsResource::new) <END> .toArray(GridFsResource[]::new); }</code><technical_language>This invocation result in constructor invocation. getGridFs(). call is missing. Is this issue</technical_language>

Target:
public GridFsResource[] getResources(String locationPattern) { if (!StringUtils.hasText(locationPattern)) { return new GridFsResource[0]; } AntPath path = new AntPath(locationPattern); if (!path.isPattern()) { return new GridFsResource[0]; } return StreamSupport .stream(find(query(whereFilename().regex(path.toRegex()))).spliterator(), false) .map(this::getResource) .toArray(GridFsResource[]::new); }
Source:
<code><START> public AbstractVariant(String chromosome, long start, long end, String reference, String alternate) { <END> if (start > end && !(reference.equals("-"))) { throw new IllegalArgumentException("End position must be greater than the start position"); } this.chromosome = (chromosome != null) ? chromosome : ""; this.start = start; this.end = end; this.reference = (reference != null) ? reference : ""; this.alternate = (alternate != null) ? alternate : ""; this.ids = new HashSet<>(); this.hgvs = new HashMap<>(); if (getType() == VariantType.SNV) { Set<String> hgvsCodes = new HashSet<>(); hgvsCodes.add(chromosome + ":g." + start + reference + ">" + alternate); this.hgvs.put("genomic", hgvsCodes); } }</code><technical_language>assigning empty string chromosome, I throw exception if chromosome argument is null. Reference alternate null -> empty string, is represent indels</technical_language>

Target:
public AbstractVariant(String chromosome, long start, long end, String reference, String alternate) { if (end < start) { throw new IllegalArgumentException("End position must be equal or greater than the start position"); } if (chromosome == null || chromosome.trim().equals("")) { throw new IllegalArgumentException("Chromosome name cannot be empty"); } this.chromosome = chromosome; this.start = start; this.end = end; this.reference = (reference != null) ? reference : ""; this.alternate = (alternate != null) ? alternate : ""; this.ids = new HashSet<>(); this.hgvs = new HashMap<>(); if (getType() == VariantType.SNV) { Set<String> hgvsCodes = new HashSet<>(); hgvsCodes.add(chromosome + ":g." + start + reference + ">" + alternate); this.hgvs.put("genomic", hgvsCodes); } }
Source:
<code>void flushallAsync() throws InterruptedException { writeKeysToTwoNodes(); assertThat(sync.flushallAsync()).isEqualTo("OK"); <START> Thread.sleep(1000); <END> Long dbsize = sync.dbsize(); assertThat(dbsize).isEqualTo(0); }</code><technical_language>switch this test issue GET commands keys written in writeKeysToTwoNodes. GET longer introduce a dependency timing tests run in a shorter time</technical_language>

Target:
void flushallAsync() throws InterruptedException { writeKeysToTwoNodes(); assertThat(sync.flushallAsync()).isEqualTo("OK"); boolean bothKeysCleared = false; final Instant deadline = Instant.now().plusSeconds(1); while (!bothKeysCleared && Instant.now().isBefore(deadline)) { bothKeysCleared = sync.get(KEY_ON_NODE_1) == null && sync.get(KEY_ON_NODE_2) == null; } assertThat(bothKeysCleared).isTrue(); }
Source:
<code>public RestClient(RestClientConnectionConfig config, HttpClientConnectionManager connectionManager) { this.config = config; <START> this.baseUrl = config.isSsl() ? HTTPS_PROTOCOL : HTTP_PROTOCOL + PROTOCOL_POSTFIX + config.getHost() + <END> COLON + config.getPort() + FORWARD_SLASH + config.getVersion() + FORWARD_SLASH; this.httpClient = HttpClients.custom().setConnectionManager(connectionManager).build(); }</code><technical_language>String.format instead. code more readable. E.g. java String.format("%s://%s:%d/%s", protocol, host, port, path);</technical_language>

Target:
public RestClient(RestClientConnectionConfig config, HttpClientConnectionManager connectionManager) { this.config = config; this.baseUrl = URI.create(String.format("%s://%s:%d", config.isSSL() ? HTTPS_PROTOCOL : HTTP_PROTOCOL, config.getHost(), config.getPort())); this.version = config.getVersion(); this.httpClient = HttpClients.custom().setConnectionManager(connectionManager).build(); }
Source:
<code>public void setUp() throws Exception { organization = db.organizations().insert(); <START> publicProject = db.components().insertProject(organization, PUBLIC_PROJECT_UUID); <END> privateProject = db.components().insertProject(organization, dto -> dto.setUuid(PRIVATE_PROJECT_UUID).setProjectUuid(PRIVATE_PROJECT_UUID).setPrivate(true)); db.components().insertComponent(ComponentTesting.newFileDto(publicProject, null, FILE_UUID).setKey(FILE_KEY)); user = db.users().insertUser(LOGIN); groupOfUser = db.users().insertGroup(organization); }</code><technical_language>(minor) add explicit .setPrivate(false)</technical_language>

Target:
public void setUp() throws Exception { organization = db.organizations().insert(); publicProject = db.components().insertPublicProject(organization, PUBLIC_PROJECT_UUID); privateProject = db.components().insertPrivateProject(organization, dto -> dto.setUuid(PRIVATE_PROJECT_UUID).setProjectUuid(PRIVATE_PROJECT_UUID).setPrivate(true)); db.components().insertComponent(ComponentTesting.newFileDto(publicProject, null, FILE_UUID).setKey(FILE_KEY)); user = db.users().insertUser(LOGIN); groupOfUser = db.users().insertGroup(organization); }
Source:
<code>public String getDisplayProperty() { <START> return ""; <END> }</code><technical_language>This blank, name of underlying concept this order frequency points</technical_language>

Target:
public String getDisplayProperty() { return "1/day x 7 days/week"; }
Source:
<code>private static Map<RowKey, Map<String, Object>> loadRowKeysByQuery(InfinispanRemoteDatastoreProvider provider, AssociationKey key) { final String cacheName = cacheName( key ); ProtostreamAssociationMappingAdapter mapper = provider.getCollectionsDataMapper( cacheName ); return mapper.withinCacheEncodingContext( c -> { QueryBuilder qb = Search.getQueryFactory( c ) <START> .from( provider.getProtobufPackageName() + "." + c.getName() ); <END> final String[] columnNames = key.getColumnNames(); FilterConditionContext bqEnd = null; boolean firstIteration = true; for ( int i = 0; i < columnNames.length; i++ ) { String fieldName = mapper.convertColumnNameToFieldName( columnNames[i] ); if ( firstIteration ) { bqEnd = qb.having( fieldName ).eq( key.getColumnValues()[i] ); firstIteration = false; } else { bqEnd = bqEnd.and().having( fieldName ).eq( key.getColumnValues()[i] ); } } Query query = bqEnd.toBuilder().build(); Map<RowKey,Map<String, Object>> resultsCollector = new HashMap<>(); try ( CloseableIterator<Entry<Object,Object>> iterator = c.retrieveEntriesByQuery( query, null, 100 ) ) { while ( iterator.hasNext() ) { Entry<Object,Object> e = iterator.next(); ProtostreamPayload value = ( (ProtostreamPayload) e.getValue() ); Map<String, Object> entryObject = value.toMap(); RowKey entryKey = value.asRowKey( key ); resultsCollector.put( entryKey, entryObject ); } } return resultsCollector; } ); }</code><technical_language>This provider.getProtobufPackageName() + "." + c.getName() in a utility method in TestHelper</technical_language>

Target:
private static Map<RowKey, Map<String, Object>> loadRowKeysByQuery(InfinispanRemoteDatastoreProvider provider, AssociationKey key) { final String cacheName = cacheName( key ); ProtostreamAssociationMappingAdapter mapper = provider.getCollectionsDataMapper( cacheName ); return mapper.withinCacheEncodingContext( c -> { QueryBuilder qb = Search.getQueryFactory( c ).from( provider.getEntityType( c ) ); final String[] columnNames = key.getColumnNames(); FilterConditionContext bqEnd = null; boolean firstIteration = true; for ( int i = 0; i < columnNames.length; i++ ) { String fieldName = mapper.convertColumnNameToFieldName( columnNames[i] ); if ( firstIteration ) { bqEnd = qb.having( fieldName ).eq( key.getColumnValues()[i] ); firstIteration = false; } else { bqEnd = bqEnd.and().having( fieldName ).eq( key.getColumnValues()[i] ); } } Query query = bqEnd.toBuilder().build(); Map<RowKey,Map<String, Object>> resultsCollector = new HashMap<>(); try ( CloseableIterator<Entry<Object,Object>> iterator = c.retrieveEntriesByQuery( query, null, 100 ) ) { while ( iterator.hasNext() ) { Entry<Object,Object> e = iterator.next(); ProtostreamPayload value = ( (ProtostreamPayload) e.getValue() ); Map<String, Object> entryObject = value.toMap(); RowKey entryKey = value.asRowKey( key ); resultsCollector.put( entryKey, entryObject ); } } return resultsCollector; } ); }
Source:
<code><START> protected DynamicRouteDescriptor() <END> { }</code><technical_language>package private? @SuppressWarnings("WeakerAccess") /* synthetic access */</technical_language>

Target:
DynamicRouteDescriptor() { }
Source:
<code>public void testEqualsIgnoreValueOrder_exactlyEqual() { MultivaluedHashMap map = new MultivaluedHashMap(); MultivaluedHashMap equalMap = new MultivaluedHashMap(); <START> map.put(1, Arrays.asList(new Integer[]{1, 2, 3})); <END> equalMap.put(1, Arrays.asList(new Integer[]{1, 2, 3})); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.put(2, Arrays.asList(new Integer[]{4, 5, 6})); equalMap.put(2, Arrays.asList(new Integer[]{4, 5, 6})); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.put("c", Arrays.asList(new String[]{"x", "y", "z"})); equalMap.put("c", Arrays.asList(new String[]{"x", "y", "z"})); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); }</code><technical_language>For Arrays.asList(...) statements, enumerate values creating arrays : > Arrays.asList(1, 2, 3); > Arrays.asList("x", "y", "z");</technical_language>

Target:
public void testEqualsIgnoreValueOrder_exactlyEqual() { MultivaluedHashMap<Integer, Integer> map = new MultivaluedHashMap<>(); MultivaluedHashMap<Integer, Integer> equalMap = new MultivaluedHashMap<>(); map.put(1, Arrays.asList(1, 2, 3)); equalMap.put(1, Arrays.asList(1, 2, 3)); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.put(2, Arrays.asList(4, 5, 6)); equalMap.put(2, Arrays.asList(4, 5, 6)); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); map.put(3, Arrays.asList(7, 8, 9)); equalMap.put(3, Arrays.asList(7, 8, 9)); equalsIgnoreValueOrder_shouldReturnTrueForEqualMaps(map, equalMap); }
Source:
<code>private String genUnique() { long timePart = (System.currentTimeMillis() << 5) | (msCounter++ & 31); long ipPart = 0; try { for (byte <START> addres : <END> InetAddress.getLocalHost().getAddress()) ipPart = ((ipPart << 8) | (addres & 0xff)); } catch (UnknownHostException e) { } int port = 0; try { socket = new ServerSocket(0, 1, InetAddress.getByName("127.0.0.1")); port = socket.getLocalPort(); } catch (IOException e) { try { if (socket != null) socket.close(); } catch (IOException e1) { } port = new Random().nextInt() & 0xffff; } long aPart = (ipPart << 16) | (port & 0xffff); return Long.toHexString(timePart) + "_" + Long.toHexString(aPart); }</code><technical_language>rename b addressPart</technical_language>

Target:
private String genUnique() { long timePart = (System.currentTimeMillis() << 5) | (msCounter++ & 31); long ipPart = 0; try { for (byte addressPart : InetAddress.getLocalHost().getAddress()) { ipPart = ((ipPart << 8) | (addressPart & 0xff)); } } catch (UnknownHostException e) { } int port = 0; try { socket = new ServerSocket(0, 1, InetAddress.getByName("127.0.0.1")); port = socket.getLocalPort(); } catch (IOException e) { try { if (socket != null) socket.close(); } catch (IOException e1) { } port = new Random().nextInt() & 0xffff; } long aPart = (ipPart << 16) | (port & 0xffff); return Long.toHexString(timePart) + "_" + Long.toHexString(aPart); }
Source:
<code>public void run() { if (WatchDogGlobals.isActive) { long executionDate = System.currentTimeMillis(); long delta = executionDate - previousExecutionDate; boolean deltaIsWithinReasonableBoundaries = delta >= UPDATE_RATE && delta <= UPDATE_RATE * 1.16; if (!deltaIsWithinReasonableBoundaries) { WatchDogLogger.getInstance().logInfo( "System suspend detected!"); intervalManager.closeAllIntervals(new Date( previousExecutionDate + UPDATE_RATE)); intervalManager.generateAndSetSessionSeed(); WatchDogEventType.START_IDE.process(this); <START> WatchDogEventType.editorSpecificImplementation.updatePerspectiveInterval(); <END> } } startTimeCheckerOnce(); previousExecutionDate = System.currentTimeMillis(); }</code><technical_language>This call is ugly</technical_language>

Target:
public void run() { if (WatchDogGlobals.isActive) { long executionDate = System.currentTimeMillis(); long delta = executionDate - previousExecutionDate; boolean deltaIsWithinReasonableBoundaries = delta >= UPDATE_RATE && delta <= UPDATE_RATE * 1.16; if (!deltaIsWithinReasonableBoundaries) { WatchDogLogger.getInstance().logInfo( "System suspend detected!"); intervalManager.closeAllIntervals(new Date( previousExecutionDate + UPDATE_RATE)); intervalManager.generateAndSetSessionSeed(); WatchDogEventType.START_IDE.process(this); WatchDogEventType.editorSpecificImplementation.processPerspectiveInterval(); } } startTimeCheckerOnce(); previousExecutionDate = System.currentTimeMillis(); }
Source:
<code>private boolean prepare() { try { if (log.isDebugEnabled()) { log.debug("Executing prepare: " + prepareSql); } jdbcTemplate.execute(prepareSql); } catch (DataAccessException e) { <START> lastException = e; <END> return false; } return true; }</code><technical_language>log this error</technical_language>

Target:
private boolean prepare() { try { if (log.isDebugEnabled()) { log.debug("Executing prepare: " + prepareSql); } jdbcTemplate.execute(prepareSql); } catch (DataAccessException e) { log.error("Error during prepare sql", e); lastException = e; return false; } return true; }
Source:
<code>public Set<K> keySet() { return new AbstractSet<K>() { @Override public Iterator<K> iterator() { purgeKeys(); final Iterator<WeakReference<K>> iterator = map.keySet().iterator(); <START> final AtomicReference<K> ref = new AtomicReference<K>(); <END> advance(iterator, ref); return new Iterator<K>() { @Override public boolean hasNext() { return ref.get() != null; } @Override public K next() { K k = ref.get(); advance(iterator, ref); return k; } @Override public void remove() { ConcurrentWeakIdentityHashMap.this.remove(ref.get()); advance(iterator, ref); } }; } private void advance(Iterator<WeakReference<K>> iterator, AtomicReference<K> ref) { while (iterator.hasNext()) { K next = iterator.next().get(); if (next != null) { ref.set(next); return; } } ref.set(null); } @Override public boolean contains(Object o) { return ConcurrentWeakIdentityHashMap.this.containsKey(o); } @Override public int size() { return map.size(); } }; }</code><technical_language>AtomicReference</technical_language>

Target:
public Set<K> keySet() { return new AbstractSet<K>() { @Override public Iterator<K> iterator() { purgeKeys(); return new WeakSafeIterator<K, WeakReference<K>>(map.keySet().iterator()) { @Override protected K extract(WeakReference<K> u) { return u.get(); } }; } @Override public boolean contains(Object o) { return ConcurrentWeakIdentityHashMap.this.containsKey(o); } @Override public int size() { return map.size(); } }; }
Source:
<code>public void basicWithAnonymous() { given(this.authenticationManager.authenticate(any())).willReturn(Mono.just(new TestingAuthenticationToken("rob", "rob", "ROLE_USER", "ROLE_ADMIN"))); this.http.securityContextRepository(new WebSessionServerSecurityContextRepository()); this.http.httpBasic().and().anonymous(); this.http.authenticationManager(this.authenticationManager); ServerHttpSecurity.AuthorizeExchangeSpec authorize = this.http.authorizeExchange(); authorize.anyExchange().hasAuthority("ROLE_ADMIN"); WebTestClient client = buildClient(); EntityExchangeResult<String> result = client.get() .uri("/") .headers(headers -> headers.setBasicAuth("rob", "rob")) .exchange() .expectStatus().isOk() .expectHeader().valueMatches(HttpHeaders.CACHE_CONTROL, ".+") .expectBody(String.class).consumeWith(b -> assertThat(b.getResponseBody()).isEqualTo("ok")) .returnResult(); <START> assertThat(result.getResponseCookies().getFirst("SESSION")).isNotNull(); <END> }</code><technical_language>Instead of changing this, recommend changing test override security context repository</technical_language>

Target:
public void basicWithAnonymous() { given(this.authenticationManager.authenticate(any())).willReturn(Mono.just(new TestingAuthenticationToken("rob", "rob", "ROLE_USER", "ROLE_ADMIN"))); this.http.httpBasic().and().anonymous(); this.http.authenticationManager(this.authenticationManager); ServerHttpSecurity.AuthorizeExchangeSpec authorize = this.http.authorizeExchange(); authorize.anyExchange().hasAuthority("ROLE_ADMIN"); WebTestClient client = buildClient(); EntityExchangeResult<String> result = client.get() .uri("/") .headers(headers -> headers.setBasicAuth("rob", "rob")) .exchange() .expectStatus().isOk() .expectHeader().valueMatches(HttpHeaders.CACHE_CONTROL, ".+") .expectBody(String.class).consumeWith(b -> assertThat(b.getResponseBody()).isEqualTo("ok")) .returnResult(); assertThat(result.getResponseCookies().getFirst("SESSION")).isNull(); }
Source:
<code>private void show(final String graphUuid, final Element<? extends Definition<?>> element, final Command callback) { final String uuid = element.getUUID(); final Diagram<?, ?> diagram = formSessionHandler.getDiagram(); final Object definition = element.getContent().getDefinition(); final RenderMode renderMode = formSessionHandler.getSession() instanceof EditorSession ? RenderMode.EDIT_MODE : RenderMode.READ_ONLY_MODE; formsContainer.render(graphUuid, element.getUUID(), element.getContent().getDefinition(), diagram.getMetadata().getPath(), (fieldName, newValue) -> { try { formSessionHandler.executeUpdateProperty(element, fieldName, newValue); } catch (final Exception ex) { <START> log(Level.SEVERE, <END> "Something wrong happened refreshing the canvas for " + "field '" + fieldName + "': " + ex.getCause()); } finally { if (null != callback) { callback.execute(); } } }, renderMode); final String name = definitionUtils.getName(definition); propertiesOpenedEvent.fire(new FormPropertiesOpened(formSessionHandler.getSession(), uuid, name)); }</code><technical_language>This present changes I worth check touching it, mind a look? kie-wb-common-stunner-extensions/kie-wb-common-stunner-forms/kie-wb-common-stunner-forms-client/src/main/java/org/kie/workbench/common/stunner/forms/client/widgets/FormPropertiesWidget.java:155: error: NULL_DER$ object diagram assigned line 151 null is dereferenced line 155. 153. final RenderMode renderMode = formSessionHandler.getSession() instanceof EditorSession ? RenderMode.EDIT_MODE : RenderMode.READ_ONLY_MODE; 154. 155. > formsContainer.render(graphUuid, element.getUUID(), element.getContent().getDefinition(), diagram.getMetadata().getPath(), (fieldName, newValue) -> { 156. try { 157. formSessionHandler.executeUpdateProperty(element, fieldName, newValue);</technical_language>

Target:
private void show(final String graphUuid, final Element<? extends Definition<?>> element, final Command callback) { final String uuid = element.getUUID(); final Diagram<?, ?> diagram = formSessionHandler.getDiagram(); if (Objects.isNull(diagram)) { return; } final Metadata metadata = diagram.getMetadata(); if (Objects.isNull(metadata)) { return; } final Path diagramPath = metadata.getPath(); final Definition content = element.getContent(); if (Objects.isNull(content)) { return; } final Object definition = content.getDefinition(); final RenderMode renderMode = formSessionHandler.getSession() instanceof EditorSession ? RenderMode.EDIT_MODE : RenderMode.READ_ONLY_MODE; formsContainer.render(graphUuid, uuid, definition, diagramPath, (fieldName, newValue) -> { try { formSessionHandler.executeUpdateProperty(element, fieldName, newValue); } catch (final Exception ex) { log(Level.SEVERE, "Something wrong happened refreshing the canvas for " + "field '" + fieldName + "': " + ex.getCause()); } finally { if (null != callback) { callback.execute(); } } }, renderMode); final String name = definitionUtils.getName(definition); propertiesOpenedEvent.fire(new FormPropertiesOpened(formSessionHandler.getSession(), uuid, name)); }
Source:
<code>public void properties() throws Exception { assertThat(JavaScriptLegacyGrammar.CLASS_ELEMENT) .matches("property ;") .matches("1 ;") .matches("'prop_name' ;") .matches("[21 + 21] ;") .matches("property = 1 ;") .matches("property = foo() ;") .matches("static property ;") <START> .matches("static property = 1 ;") <END> .notMatches("property = 1") ; }</code><technical_language>@vilchik-elena Hoiw adding</technical_language>

Target:
public void properties() throws Exception { assertThat(JavaScriptLegacyGrammar.CLASS_ELEMENT) .matches("property ;") .matches("1 ;") .matches("'prop_name' ;") .matches("[21 + 21] ;") .matches("property = 1 ;") .matches("property = foo() ;") .matches("property = notProperty = 0 ;") .matches("property = () => ;") .matches("static property ;") .matches("static property = 1 ;") .matches("property = 1") .notMatches("property =;") .notMatches("static;") ; }
Source:
<code>public void transform(KeyValue<LongWritable, Text> input, Emitter<StructuredRecord> emitter) throws IOException { getOutputSchema(); StructuredRecord record = jsonTransform(input.getValue()); emitter.emit(record); <START> <END> }</code><technical_language>Extra newline</technical_language>

Target:
public void transform(KeyValue<LongWritable, Text> input, Emitter<StructuredRecord> emitter) throws IOException { StructuredRecord record = convertToStructuredRecord(input.getValue()); emitter.emit(record); }
Source:
<code>public void priorityWithDependencyAndFailures() { TestNG tng = create(SampleTest01.class, SampleTest02.class); tng.setParallel(XmlSuite.ParallelMode.CLASSES); tng.run(); List<String> sampleTest01Methods = Arrays.asList("test0010_createAction", "test0030_advancedSearch", "test0060_deleteAction"); <START> Assert.assertEquals(TestListener.methods.get(SampleTest01.class), sampleTest01Methods); <END> }</code><technical_language>Pls, InvokedMethodNameListener</technical_language>

Target:
public void priorityWithDependencyAndFailures() { TestNG tng = create(SampleTest01.class, SampleTest02.class); tng.setParallel(XmlSuite.ParallelMode.CLASSES); InvokedMethodNameListener listener = new InvokedMethodNameListener(); tng.addListener((ITestNGListener) listener); tng.run(); List<String> sampleTest01Methods = Arrays.asList("test0010_createAction", "test0030_advancedSearch", "test0060_deleteAction"); Assert.assertEquals(listener.getMethodsForTestClass(SampleTest01.class), sampleTest01Methods); }
Source:
<code>public Collection<RootOperatorImpl> getAll() { <START> return this.operatorGraph.values(); <END> }</code><technical_language>nit: nice this return set immutable</technical_language>

Target:
public Collection<RootOperatorImpl> getAll() { return Collections.unmodifiableCollection(this.operatorGraph.values()); }
Source:
<code>protected RepositorySelection getRepositorySelection() { try { return (new RepositorySelection(new URIish(currentSearchResult.getGitRepositoryInfo().getCloneUri()), null)); } catch (URISyntaxException e) { <START> Activator.error("URI can't be parsed", e); END> return null; } }</code><technical_language>externalize string</technical_language>

Target:
protected RepositorySelection getRepositorySelection() { try { return (new RepositorySelection(new URIish(currentSearchResult.getGitRepositoryInfo().getCloneUri()), null)); } catch (URISyntaxException e) { Activator.error(UIText.GitImportWizard_errorParsingURI, e); return null; } }
Source:
<code>public static void runJSTestSuite() throws InterruptedException { int timeout = Build.SUPPORTED_ABIS[0].contains("armeabi") ? 180 : 60; <START> JSTestCase.runJSTestSuite(JS_SUITE, data(), timeout); <END> }</code><technical_language>bump 180 board</technical_language>

Target:
public static void runJSTestSuite() throws InterruptedException { JSTestCase.runJSTestSuite(JS_SUITE, data(), 180); }
Source:
<code>public void initialize() { this.application.initializers(new ContextIdApplicationContextInitializer(this.toString())); ConfigurableEnvironment environment = new StandardEnvironment(); if (parent != null) { copyEnvironment(environment, parent.getEnvironment()); } for (PropertySource<?> source : propertySources) { environment.getPropertySources().addLast(source); } this.application.parent(parent); this.application.environment(environment); this.application.listeners(new ParentContextCloserApplicationListener() { @Override public void onApplicationEvent(ParentContextAvailableEvent event) { ConfigurableApplicationContext child = event.getApplicationContext(); if (child.getParent() instanceof ConfigurableApplicationContext) { ConfigurableApplicationContext parent = (ConfigurableApplicationContext) child .getParent(); parent.addApplicationListener(new ModuleContextCloserListener(child)); } } final class ModuleContextCloserListener extends ContextCloserListener implements Ordered { public ModuleContextCloserListener(ConfigurableApplicationContext moduleContext) { super(moduleContext); } @Override public int getOrder() { <START> if (getType() == ModuleType.sink) { <END> return HIGHEST_PRECEDENCE; } else if (getType() == ModuleType.processor) { return LOWEST_PRECEDENCE - 10; } else { return LOWEST_PRECEDENCE; } } } }); this.context = this.application.run(); if (logger.isInfoEnabled()) { logger.info("initialized module: " + this.toString()); } }</code><technical_language>close producers consumers. Otherwise, producers continue send Messages downstream consumers closed</technical_language>

Target:
public void initialize() { this.application.initializers(new ContextIdApplicationContextInitializer(this.toString())); ConfigurableEnvironment environment = new StandardEnvironment(); if (parent != null) { copyEnvironment(environment, parent.getEnvironment()); } for (PropertySource<?> source : propertySources) { environment.getPropertySources().addLast(source); } this.application.parent(parent); this.application.environment(environment); this.application.listeners(new ParentContextCloserApplicationListener() { @Override public void onApplicationEvent(ParentContextAvailableEvent event) { ConfigurableApplicationContext child = event.getApplicationContext(); if (child.getParent() instanceof ConfigurableApplicationContext) { ConfigurableApplicationContext parent = (ConfigurableApplicationContext) child .getParent(); parent.addApplicationListener(new ModuleContextCloserListener(child)); } } final class ModuleContextCloserListener extends ContextCloserListener implements Ordered { public ModuleContextCloserListener(ConfigurableApplicationContext moduleContext) { super(moduleContext); } @Override public int getOrder() { ModuleType moduleType = getType(); if (moduleType == ModuleType.source || moduleType == ModuleType.job) { return HIGHEST_PRECEDENCE; } else if (getType() == ModuleType.processor) { return LOWEST_PRECEDENCE - 10; } else { return LOWEST_PRECEDENCE; } } } }); this.context = this.application.run(); if (logger.isInfoEnabled()) { logger.info("initialized module: " + this.toString()); } }
Source:
<code>public static Hosts parse(String hostString, Integer explicitGlobalPort, Integer defaultPort) { List<String> hosts = new ArrayList<>(); List<Integer> ports = new ArrayList<>(); if ( hostString == null || hostString.trim().isEmpty() ) { return Hosts.NO_HOST; } String[] splits = hostString.split( "," ); for (String rawSplit : splits) { String split = rawSplit.trim(); Matcher matcher = HOST_AND_PORT_PATTERN.matcher( split ); <START> String host = null; <END> Integer port = null; if ( matcher.matches() ) { setCleanHost( matcher, hosts ); setPort( ports, matcher, explicitGlobalPort, splits, defaultPort ); } else { throw LOG.unableToParseHost( hostString ); } } return new Hosts(hosts, ports); }</code><technical_language>vars unused</technical_language>

Target:
public static Hosts parse(String hostString, Integer explicitGlobalPort, Integer defaultPort) { List<String> hosts = new ArrayList<>(); List<Integer> ports = new ArrayList<>(); if ( hostString == null || hostString.trim().isEmpty() ) { return Hosts.NO_HOST; } String[] splits = hostString.split( "," ); for (String rawSplit : splits) { String split = rawSplit.trim(); Matcher matcher = HOST_AND_PORT_PATTERN.matcher( split ); if ( matcher.matches() ) { setCleanHost( matcher, hosts ); setPort( ports, matcher, explicitGlobalPort, splits, defaultPort ); } else { throw LOG.unableToParseHost( hostString ); } } return new Hosts(hosts, ports); }
Source:
<code><START> default String[] getFormatFieldTypes() { <END> return Arrays.stream(getSchema().getFieldNames()) .filter(name -> !getPartitionKeys().contains(name)) .toArray(String[]::new); }</code><technical_language>getFormatFieldNames</technical_language>

Target:
default DataType[] getFormatFieldTypes() { return Arrays.stream(getSchema().getFieldNames()) .filter(name -> !getPartitionKeys().contains(name)) .map(name -> getSchema().getFieldDataType(name).get()) .toArray(DataType[]::new); }
Source:
<code>public void run() { while (listenerRunning) { try { <START> Socket s = ss.accept(); <END> BufferedInputStream is = new BufferedInputStream(s.getInputStream()); LearnerHandler lh = new LearnerHandler(s, is, this); lh.start(); } catch (Exception e) { if (listenerRunning) { LOG.debug("Ignoring accept exception (maybe shutting down)", e); } else { LOG.debug("Ignoring accept exception (maybe client closed)", e); } } } }</code><technical_language>more thing, added a change setSoTimeout initLimit * tickTime align leader is doing. add well</technical_language>

Target:
public void run() { while (listenerRunning) { try { Socket s = ss.accept(); s.setSoTimeout(self.tickTime * self.initLimit); BufferedInputStream is = new BufferedInputStream(s.getInputStream()); LearnerHandler lh = new LearnerHandler(s, is, this); lh.start(); } catch (Exception e) { if (listenerRunning) { LOG.debug("Ignoring accept exception (maybe shutting down)", e); } else { LOG.debug("Ignoring accept exception (maybe client closed)", e); } } } }