auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>List<String> registerProvidedLocalResources() { checkNotNull(localResources); final ArrayList<String> classPaths = new ArrayList<>(); providedSharedLibs.forEach( (fileName, fileStatus) -> { final Path filePath = fileStatus.getPath(); LOG.debug("Using remote file to register local resource", filePath); final YarnLocalResourceDescriptor descriptor = YarnLocalResourceDescriptor .fromFileStatus(fileName, fileStatus, LocalResourceVisibility.PUBLIC); localResources.put(fileName, descriptor.toLocalResource()); remotePaths.add(filePath); envShipResourceList.add(descriptor); <START> if (!isFlinkDistJar(fileName) && !isPlugin(fileStatus.getPath())) { <END> classPaths.add(fileName); } else if (isFlinkDistJar(fileName)) { flinkDist = descriptor; } }); return classPaths; }</code><technical_language>I fileName check isFlinkDistJar is relative path, real file name(e.g. lib/flink-dist_2.11-1.11-SNAPSHOT.jar). i suggest key relative instead of fileName avoid confusing. fileStatus.getPath() replaced filePath</technical_language>

Target:
List<String> registerProvidedLocalResources() { checkNotNull(localResources); final ArrayList<String> classPaths = new ArrayList<>(); providedSharedLibs.forEach( (fileName, fileStatus) -> { final Path filePath = fileStatus.getPath(); LOG.debug("Using remote file to register local resource", filePath); final YarnLocalResourceDescriptor descriptor = YarnLocalResourceDescriptor .fromFileStatus(fileName, fileStatus, LocalResourceVisibility.PUBLIC); localResources.put(fileName, descriptor.toLocalResource()); remotePaths.add(filePath); envShipResourceList.add(descriptor); if (!isFlinkDistJar(filePath.getName()) && !isPlugin(filePath)) { classPaths.add(fileName); } else if (isFlinkDistJar(filePath.getName())) { flinkDist = descriptor; } }); return classPaths; }
Source:
<code>private Group addDomainToUserMembers(Group group, String userStoreDomain) throws CharonException { List<String> membersId = group.getMembers(); <START> if (StringUtils.isBlank(userStoreDomain) || membersId == null || membersId.isEmpty()) { <END> return group; } List<String> membersDisplayNamesWithoutDomain = group.getMembersWithDisplayName(); List<String> membersDisplayNamesWithDomain = new ArrayList<String>(); for (String memberId : membersId) { group.removeMember(memberId); } if (membersDisplayNamesWithoutDomain != null) { for (String memberDisplayNameWithoutDomain : membersDisplayNamesWithoutDomain) { membersDisplayNamesWithDomain .add(UserCoreUtil.addDomainToName(memberDisplayNameWithoutDomain, userStoreDomain)); } } for (int i = 0; i < membersId.size(); i++) { group.setMember(membersId.get(i), membersDisplayNamesWithDomain.get(i)); } return group; }</code><technical_language>do a null empty check check for memberIDs a single check in beginning</technical_language>

Target:
private Group addDomainToUserMembers(Group group, String userStoreDomain) throws CharonException { List<String> membersId = group.getMembers(); if (StringUtils.isBlank(userStoreDomain) || membersId == null || membersId.isEmpty()) { return group; } Map<String, String> userMembers = mergeSCIMIDsWithDisplayNames(group); for (String memberId : membersId) { group.removeMember(memberId); } for (Map.Entry<String, String> entry : userMembers.entrySet()) { group.setMember(entry.getKey(), UserCoreUtil.addDomainToName(entry.getValue(), userStoreDomain)); } return group; }
Source:
<code>private boolean isProjectInternalDependency(VirtualFile jar) { Path jarPath = Paths.get(jar.getPath()); Optional<Path> bloopJarsPath = bloopJarsPath(project); Optional<Path> sourcesJarPath = sourcesJarPath(project); <START> return jarPath.startsWith(bloopJarsPath.get()) || jarPath.startsWith(sourcesJarPath.get()); <END> }</code><technical_language>get calls safe</technical_language>

Target:
private boolean isProjectInternalDependency(VirtualFile jar) { Path jarPath = Paths.get(jar.getPath()); return isBloopJarPath(jarPath) || isSourcesJarPath(jarPath); }
Source:
<code>public ImmutableColumn(String name, ColumnType type, Table table, int columnNumber, Integer columnSize, String nativeType, Boolean nullable, String remarks, boolean indexed, String quote, boolean primaryKey) { <START> this.name = name; <END> this.type = type; this.table = table; this.columnNumber = columnNumber; this.columnSize = columnSize; this.decimalDigits = null; this.nativeType = nativeType; this.nullable = nullable; this.remarks = remarks; this.indexed = indexed; this.quote = quote; this.primaryKey = primaryKey; }</code><technical_language>is common practice constructor chaining multiple constructors for a java class, change this to: this(name, type, table, columnNumber, columnSize, null, nativeType, nullable, remarks, indexed, quote, primaryKey);</technical_language>

Target:
public ImmutableColumn(String name, ColumnType type, Table table, int columnNumber, Integer columnSize, String nativeType, Boolean nullable, String remarks, boolean indexed, String quote, boolean primaryKey) { this(name, type, table, columnNumber, columnSize, null, nativeType, nullable, remarks, indexed, quote, primaryKey); }
Source:
<code>public void appendCompacted(List<LogData> entries) { try { if (entries.isEmpty()) { <START> return; <END> } if (containsAny(entries, true)) { log.debug("appendCompacted: Overwritten exception, entries: {}", entries); throw new OverwriteException(OverwriteCause.SAME_DATA); } Map<Long, AddressMetaData> addressMetaData = writeRecords(entries); knownAddresses.putAll(addressMetaData); compactionMetaData.updateTotalPayloadSize(entries); log.trace("appendCompacted: Written entries to disk: {}", entries); } catch (IOException ioe) { log.error("appendCompacted: IOException when writing entries: {}", entries, ioe); throw new RuntimeException(ioe); } }</code><technical_language>inherent doc base class</technical_language>

Target:
public void appendCompacted(List<LogData> entries) { try { if (entries.isEmpty()) { return; } Map<Long, AddressMetaData> addressMetaData = writeRecords(entries); knownAddresses.putAll(addressMetaData); compactionMetaData.updateTotalPayloadSize(entries); log.trace("appendCompacted: Written entries to disk: {}", entries); } catch (IOException ioe) { log.error("appendCompacted: IOException when writing entries: {}", entries, ioe); throw new RuntimeException(ioe); } }
Source:
<code>public void destroy() { super.destroy(); <START> this.subscribers.forEach(Subscriber::onComplete); <END> this.disposables.values().forEach(Disposable::dispose); }</code><technical_language>suggestion this.flux.onComplete();</technical_language>

Target:
public void destroy() { this.subscribedSignal.onNext(false); this.processor.onComplete(); super.destroy(); }
Source:
<code>public Order discontinueOrder(Order orderToDiscontinue, String reasonNonCoded, Date discontinueDate) { discontinueOrder(orderToDiscontinue, discontinueDate); Order newOrder = orderToDiscontinue.cloneForDiscontinuing(); newOrder.setDiscontinuedReasonNonCoded(reasonNonCoded); <START> return saveOrder(newOrder); <END> }</code><technical_language>returning discontinuation order, i return discontinued order, @djazayeri</technical_language>

Target:
public Order discontinueOrder(Order orderToDiscontinue, String reasonNonCoded, Date discontinueDate) { discontinue(orderToDiscontinue, discontinueDate); Order newOrder = orderToDiscontinue.cloneForDiscontinuing(); newOrder.setDiscontinuedReasonNonCoded(reasonNonCoded); return saveOrder(newOrder); }
Source:
<code>protected SleepTask createRunnable(HttpAction action) { String interval = action.request.getParameter("interval"); int sleepMilli = 5000; if ( interval != null ) { try { sleepMilli = Integer.parseInt(interval); } catch (NumberFormatException ex) { <START> ServletOps.errorBadRequest("Bad format for 'interval': integer required"); <END> return null; } } if ( sleepMilli < 0 ) { ServletOps.errorBadRequest("Negative sleep interval"); return null; } if ( sleepMilli > MaxSleepMillis ) { ServletOps.errorBadRequest("Sleep internal greater than maximum allowed"); return null; } return new SleepTask(action, sleepMilli, AsyncPool.get()); }</code><technical_language>prefix for errors? "Bad format for 'interval': integer required" "Bad format for 'interval': negative sleep interval" "Bad format for 'interval': sleep internal greater maximum allowed"</technical_language>

Target:
protected SleepTask createRunnable(HttpAction action) { String interval = action.request.getParameter("interval"); int sleepMilli = 5000; if ( interval != null ) { try { sleepMilli = Integer.parseInt(interval); } catch (NumberFormatException ex) { ServletOps.errorBadRequest("Bad value for 'interval': integer required"); return null; } } if ( sleepMilli < 0 ) { ServletOps.errorBadRequest("Bad value for 'interval': negative sleep interval"); return null; } if ( sleepMilli > MaxSleepMillis ) { ServletOps.errorBadRequest("Bad value for 'interval': sleep internal greater than maximum allowed"); return null; } return new SleepTask(action, sleepMilli, AsyncPool.get()); }
Source:
<code>public void shouldBeAbleToDeserializeADogWithoutRootAndParameterNameEqualsJsonProperty() throws Exception { InputStream stream = asStream("{'name':'Brutus','age':7}"); <START> when(deserializeeInstance.get()).thenReturn(new Deserializee()); <END> when(container.instanceFor(WithoutRoot.class)).thenReturn(new WithoutRoot()); Object[] deserialized = deserializer.deserialize(stream, dogParameterNameEqualsJsonPropertyWithoutRoot); assertThat(deserialized.length, is(1)); assertThat(deserialized[0], is(instanceOf(Dog.class))); Dog dog = (Dog) deserialized[0]; assertThat(dog.name, is("Brutus")); assertThat(dog.age, is(7)); }</code><technical_language>this line is repeated tests. move setup</technical_language>

Target:
public void shouldBeAbleToDeserializeADogWithoutRootAndParameterNameEqualsJsonProperty() throws Exception { InputStream stream = asStream("{'name':'Brutus','age':7}"); Object[] deserialized = deserializer.deserialize(stream, dogParameterNameEqualsJsonPropertyWithoutRoot); assertThat(deserialized.length, is(1)); assertThat(deserialized[0], is(instanceOf(Dog.class))); Dog dog = (Dog) deserialized[0]; assertThat(dog.name, is("Brutus")); assertThat(dog.age, is(7)); }
Source:
<code>public void testImport() { mode = LanguageMode.ECMASCRIPT6; parse("import 'someModule'"); parse("import d from './someModule'"); parse("import from './someModule'"); parse("import {x, y} from './someModule'"); parse("import {x as x1, y as y1} from './someModule'"); parse("import {x as x1, y as y1, } from './someModule'"); parse("import {default as d} from './someModule'"); parse("import d, {x as x1, y as y1} from './someModule'"); parse("import * as sm from './someModule'"); parseError("import class from './someModule'", "cannot use keyword 'class' here."); parseError("import * as class from './someModule'", "'identifier' expected"); <START> parseError("import {a as class} from './someModule'", <END> "'identifier' expected"); parseError("import {class} from './someModule'", "'as' expected"); }</code><technical_language>If I understand correctly {a class} is invalid (makes sense put a var called 'class' module scope) {class a} is valid. I tests of this valid case ({someKeyword nonKeyword}) for default</technical_language>

Target:
public void testImport() { mode = LanguageMode.ECMASCRIPT6; parse("import 'someModule'"); parse("import d from './someModule'"); parse("import from './someModule'"); parse("import {x, y} from './someModule'"); parse("import {x as x1, y as y1} from './someModule'"); parse("import {x as x1, y as y1, } from './someModule'"); parse("import {default as d, class as c} from './someModule'"); parse("import d, {x as x1, y as y1} from './someModule'"); parse("import * as sm from './someModule'"); parseError("import class from './someModule'", "cannot use keyword 'class' here."); parseError("import * as class from './someModule'", "'identifier' expected"); parseError("import {a as class} from './someModule'", "'identifier' expected"); parseError("import {class} from './someModule'", "'as' expected"); }
Source:
<code>public void post_generated_events_to_event_bus() { final Command cmd = Given.Command.startProject(); handler.handle(cmd); <START> final int postedEventCount = 2; <END> final ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class); verify(eventBus, times(postedEventCount)).post(eventCaptor.capture()); final List<Event> events = eventCaptor.getAllValues(); assertEquals(postedEventCount, events.size()); assertEquals(ProjectStarted.class, Events.getMessage(events.get(0)) .getClass()); assertEquals(StringValue.class, Events.getMessage(events.get(1)) .getClass()); }</code><technical_language>do is 2</technical_language>

Target:
public void post_generated_events_to_event_bus() { final Command cmd = Given.Command.startProject(); handler.handle(cmd); final ImmutableList<Message> expectedMessages = handler.getEventsOnStartProjectCmd(); final List<Event> actualEvents = verifyPostedEvents(expectedMessages.size()); for (int i = 0; i < expectedMessages.size(); i++) { final Message expected = expectedMessages.get(i); final Message actual = Events.getMessage(actualEvents.get(i)); assertEquals(expected, actual); } }
Source:
<code>public ExecutionResult execute(Item item) { ProcessType processType = getProcessType(item); if (getProject().getLanguage() != ECodeLanguage.JAVA || processType == null) { return ExecutionResult.NOTHING_TO_DO; } try { <START> String componentsName = new String("tFTPFileExist"); END> IComponentFilter filter = new NameComponentFilter(componentsName); IComponentConversion addOption = new IComponentConversion() { @Override public void transform(NodeType node) { if (ComponentUtilities.getNodeProperty(node, PROPERTY_NAME) == null) { ComponentUtilities.addNodeProperty(node, PROPERTY_NAME, PROPERTY_TYPE); } ComponentUtilities.setNodeValue(node, PROPERTY_NAME, "false"); } }; ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion> asList(addOption)); return ExecutionResult.SUCCESS_NO_ALERT; } catch (Exception e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } }</code><technical_language>Please move "tFTPFileExist" constant COMPONENT_NAME</technical_language>

Target:
public ExecutionResult execute(Item item) { ProcessType processType = getProcessType(item); if (getProject().getLanguage() != ECodeLanguage.JAVA || processType == null) { return ExecutionResult.NOTHING_TO_DO; } String componentsName = new String(COMPONENT_NAME); IComponentFilter filter = new NameComponentFilter(componentsName); IComponentConversion addOption = new IComponentConversion() { @Override public void transform(NodeType node) { if (ComponentUtilities.getNodeProperty(node, PROPERTY_NAME) == null) { ComponentUtilities.addNodeProperty(node, PROPERTY_NAME, PROPERTY_TYPE); } ComponentUtilities.setNodeValue(node, PROPERTY_NAME, "false"); } }; try { ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion> asList(addOption)); return ExecutionResult.SUCCESS_NO_ALERT; } catch (PersistenceException e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } }
Source:
<code>public SegmentEvent transform(org.atlasapi.media.entity.simple.SegmentEvent simple, PublisherDetails publisher) { <START> checkArgument(Strings.isNullOrEmpty(simple.getUri()), "You must specify a URI on the item"); <END> checkArgument(simple.getSegment() != null, "You must specify a Segment on the SegmentEvent"); SegmentEvent complex = new SegmentEvent(); complex.setCanonicalUri(simple.getUri()); complex.setDescription(Description.description() .withSynopsis(simple.getDescription()) .withTitle(simple.getTitle()) .build()); complex.setPosition(simple.getPosition()); if (simple.getOffset() != null) { complex.setOffset(Duration.standardMinutes(simple.getOffset())); } complex.setIsChapter(simple.getIsChapter()); if (Strings.isNullOrEmpty(simple.getSegment().getId())) { complex.setSegment(writeSegment(simple.getSegment(), publisher)); } else { complex.setSegment(new SegmentRef(codec.decode(simple.getSegment().getId()).longValue())); } return complex; }</code><technical_language>inverse</technical_language>

Target:
public SegmentEvent transform(org.atlasapi.media.entity.simple.SegmentEvent simple, PublisherDetails publisher) { checkNotNull(simple.getSegment() != null, "You must specify a Segment on the SegmentEvent"); SegmentEvent complex = new SegmentEvent(); complex.setCanonicalUri(simple.getUri()); complex.setDescription(Description.description() .withSynopsis(simple.getDescription()) .withTitle(simple.getTitle()) .build()); complex.setPosition(simple.getPosition()); if (simple.getOffset() != null) { complex.setOffset(Duration.standardMinutes(simple.getOffset())); } complex.setIsChapter(simple.getIsChapter()); if (Strings.isNullOrEmpty(simple.getSegment().getId())) { complex.setSegment(writeSegment(simple.getSegment(), publisher)); } else { complex.setSegment(new SegmentRef(codec.decode(simple.getSegment().getId()).longValue())); } return complex; }
Source:
<code>public Single<Integer> getUploadCount(String userName) { HttpUrl.Builder urlBuilder = wikiMediaToolforgeUrl.newBuilder(); urlBuilder .addPathSegments("uploadsbyuser.py") .addQueryParameter("user", userName); if (ConfigUtils.isBetaFlavour()) { urlBuilder.addQueryParameter("labs", "commonswiki"); } Request request = new Request.Builder() .url(urlBuilder.build()) .build(); return Single.fromCallable(() -> { Response response = okHttpClient.newCall(request).execute(); if (response != null && response.isSuccessful()) { ResponseBody responseBody = response.body(); if(null!=responseBody) { String responseBodyString = responseBody.toString(); if (!TextUtils.isEmpty(responseBodyString.trim())) { <START> return Integer.parseInt(responseBodyString.trim()); <END> } } } return 0; }); }</code><technical_language>Note this throw a NumberFormatException if response body is a number. allow this throw, if crashing is undesired a try/catch return 0 in catch</technical_language>

Target:
public Single<Integer> getUploadCount(String userName) { HttpUrl.Builder urlBuilder = wikiMediaToolforgeUrl.newBuilder(); urlBuilder .addPathSegments("uploadsbyuser.py") .addQueryParameter("user", userName); if (ConfigUtils.isBetaFlavour()) { urlBuilder.addQueryParameter("labs", "commonswiki"); } Request request = new Request.Builder() .url(urlBuilder.build()) .build(); return Single.fromCallable(() -> { Response response = okHttpClient.newCall(request).execute(); if (response != null && response.isSuccessful()) { ResponseBody responseBody = response.body(); if (null != responseBody) { String responseBodyString = responseBody.string().trim(); if (!TextUtils.isEmpty(responseBodyString)) { try { return Integer.parseInt(responseBodyString); } catch (NumberFormatException e) { Timber.e(e); } } } } return 0; }); }
Source:
<code>protected void testExecute() { InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); loginAsAdmin(); ______TS("Not enough parameters"); verifyHttpParameterFailure(); ______TS("Typical case"); String[] params = { Const.ParamsNames.INSTRUCTOR_ID, instructor1ofCourse1.getGoogleId(), }; DowngradeAccountAction a = getAction(params); JsonResult r = getJsonResult(a); MessageOutput response = (MessageOutput) r.getOutput(); assertEquals(HttpStatus.SC_OK, r.getStatusCode()); <START> assertEquals("Instructor account is successfully downgraded to student.", response.getMessage()); <END> ______TS("Failure: Downgrades an invalid account"); String[] invalidParams = { Const.ParamsNames.INSTRUCTOR_ID, "invalid-google-id", }; assertThrows(EntityNotFoundException.class, () -> getJsonResult(getAction(invalidParams))); }</code><technical_language>need verify change logic.getAccount()</technical_language>

Target:
protected void testExecute() { InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); StudentAttributes student1InCourse1 = typicalBundle.students.get("student1InCourse1"); loginAsAdmin(); ______TS("Not enough parameters"); verifyHttpParameterFailure(); ______TS("Typical case"); String[] params = { Const.ParamsNames.INSTRUCTOR_ID, instructor1ofCourse1.getGoogleId(), }; DowngradeAccountAction a = getAction(params); JsonResult r = getJsonResult(a); MessageOutput response = (MessageOutput) r.getOutput(); assertEquals(HttpStatus.SC_OK, r.getStatusCode()); assertEquals("Instructor account is successfully downgraded to student.", response.getMessage()); assertFalse(logic.getAccount(instructor1ofCourse1.getGoogleId()).isInstructor); ______TS("Failure: Downgrades an invalid account"); String[] invalidParams = { Const.ParamsNames.INSTRUCTOR_ID, "invalid-google-id", }; assertThrows(EntityNotFoundException.class, () -> getJsonResult(getAction(invalidParams))); ______TS("Failure: Tries to downgrade a student account"); String[] paramsStudent = { Const.ParamsNames.INSTRUCTOR_ID, student1InCourse1.getId(), }; assertThrows(EntityNotFoundException.class, () -> getJsonResult(getAction(paramsStudent))); }
Source:
<code>private IReadOnlyListener createReadOnlyListener() { return new IReadOnlyListener() { @Override public void readOnlyStateChanged(ReadOnlyEvent event) { switch (event.getEventType()) { case ReadOnlyEvent.RESOURCE_READ_ONLY_STATE_CHANGED: scheduleRefresh(); break; case ReadOnlyEvent.OBJECT_READ_ONLY_STATE_CHANGED: CommonViewer viewer = getCommonViewer(); if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) { viewer.refresh(event.getObject()); } break; default: <START> Activator.log.warn(Messages.ModelExplorerView_WarningReadOnlyEvent + <END> event.getEventType()); break; } } }; }</code><technical_language>Exception Message logs internationalize // NLS...</technical_language>

Target:
private IReadOnlyListener createReadOnlyListener() { return new IReadOnlyListener() { @Override public void readOnlyStateChanged(ReadOnlyEvent event) { switch (event.getEventType()) { case ReadOnlyEvent.RESOURCE_READ_ONLY_STATE_CHANGED: scheduleRefresh(); break; case ReadOnlyEvent.OBJECT_READ_ONLY_STATE_CHANGED: CommonViewer viewer = getCommonViewer(); if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) { viewer.refresh(event.getObject()); } break; default: Activator.log.warn("Unsupported read-only event type: " + event.getEventType()); break; } } }; }
Source:
<code><START> public void shouldComputeMaxOfOneValue() { assertThat(Iterator.of(5).max()).isEqualTo(Option.some(5)); } <END></code><technical_language>Please change Iterator.of(...) of(...). AbstractTraversableTest a protected method [of(T)](<LINK_0> is implemented Test classes, [especially IteratorTest](<LINK_1> Thank you</technical_language>

Target:
public void shouldComputeMaxOfOneValue() { assertThat(of(5).max()).isEqualTo(Option.some(5)); }
Source:
<code>public void batchAutomaticRouting() { EventHubProducerAsyncClient producer = new EventHubClientBuilder() .connectionString( "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", "event-hub-name") .buildAsyncProducerClient(); producer.createBatch().flatMap(batch -> { batch.tryAdd(new EventData("test-event-1")); batch.tryAdd(new EventData("test-event-2")); return producer.send(batch); <START> }).block(); <END> END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch producer.close(); }</code><technical_language>samples block() subscribe() for async clients</technical_language>

Target:
public void batchAutomaticRouting() { EventHubProducerAsyncClient producer = new EventHubClientBuilder() .connectionString( "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", "event-hub-name") .buildAsyncProducerClient(); producer.createBatch().flatMap(batch -> { batch.tryAdd(new EventData("test-event-1")); batch.tryAdd(new EventData("test-event-2")); return producer.send(batch); }).subscribe(unused -> { }, error -> System.err.println("Error occurred while sending batch:" + error), () -> System.out.println("Send complete.")); END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch producer.close(); }
Source:
<code>public void testPingFailOn500() throws Exception { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(500))); try { PoppyApi poppyApi = api(server.getUrl("/").toString(), "openstack-poppy", overrides); <START> boolean online = poppyApi.ping(); <END> assertThat(server.getRequestCount()).isEqualTo(2); assertAuthentication(server); assertRequest(server.takeRequest(), "GET", BASE_URI + "/ping"); assertThat(online).isTrue(); } finally { server.shutdown(); } }</code><technical_language>This is hanging then</technical_language>

Target:
public void testPingFailOn500() throws Exception { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(500))); server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(500))); try { PoppyApi poppyApi = api(server.getUrl("/").toString(), "openstack-poppy", overrides); boolean online = poppyApi.ping(); assertThat(server.getRequestCount()).isEqualTo(3); assertAuthentication(server); assertRequest(server.takeRequest(), "GET", BASE_URI + "/ping"); assertThat(online).isFalse(); } finally { server.shutdown(); } }
Source:
<code>private void populateRepositoryFactoryInformation(ListableBeanFactory factory) { Set<Map.Entry<String, RepositoryFactoryInformation>> repositoryFactoryBeans = BeanFactoryUtils .beansOfTypeIncludingAncestors(factory, RepositoryFactoryInformation.class).entrySet(); for (Map.Entry<String, RepositoryFactoryInformation> entry : repositoryFactoryBeans) { String beanName = entry.getKey(); <START> if (BeanFactoryUtils.isFactoryDereference(beanName)) { <END> RepositoryFactoryInformation repositoryFactoryInformation = entry.getValue(); Class<?> userDomainType = ClassUtils.getUserClass(repositoryFactoryInformation.getRepositoryInformation() .getDomainType()); this.repositoryFactoryInfos.put(userDomainType, repositoryFactoryInformation); this.repositoryBeanNames.put(userDomainType, BeanFactoryUtils.transformedBeanName(beanName)); } } }</code><technical_language>Do need this guard? RFI implemented FactoryBeans anyway. if is not, .transformedbeanName( ) handle this case transparently</technical_language>

Target:
private void populateRepositoryFactoryInformation(ListableBeanFactory factory) { Set<Map.Entry<String, RepositoryFactoryInformation>> repositoryFactoryBeans = BeanFactoryUtils .beansOfTypeIncludingAncestors(factory, RepositoryFactoryInformation.class).entrySet(); for (Map.Entry<String, RepositoryFactoryInformation> entry : repositoryFactoryBeans) { String beanName = entry.getKey(); RepositoryFactoryInformation repositoryFactoryInformation = entry.getValue(); Class<?> userDomainType = ClassUtils.getUserClass(repositoryFactoryInformation.getRepositoryInformation() .getDomainType()); this.repositoryFactoryInfos.put(userDomainType, repositoryFactoryInformation); this.repositoryBeanNames.put(userDomainType, BeanFactoryUtils.transformedBeanName(beanName)); } }
Source:
<code>public void shouldUpgradeFromClean1_9To1_10() throws IOException, SQLException { <START> upgradeTestUtil.upgrade(); <END> }</code><technical_language>This assertions</technical_language>

Target:
public void shouldUpgradeFromClean1_9To1_10() throws IOException, SQLException { upgradeTestUtil.upgrade(); List<Map<String, String>> orderFrequencySelect = upgradeTestUtil.select("order_frequency", "order_frequency_id"); Assert.assertThat(orderFrequencySelect.size(), Matchers.is(0)); List<Map<String, String>> drugOrderSelect = upgradeTestUtil.select("drug_order", "order_id"); Assert.assertThat(drugOrderSelect.size(), Matchers.is(0)); }
Source:
<code><START> public PushOperatorBuilder atPosition(int position) { <END> if (position < 0) { throw new IllegalArgumentException("Position must be greater or equal to zero."); } this.modifiers.addModifier(new PositionModifier(position)); return this; }</code><technical_language>"atPosition" "toPosition"? atPosition sounds more "reading" toPosition sounds more "writing"</technical_language>

Target:
public PushOperatorBuilder atPosition(int position) { if (position < 0) { throw new IllegalArgumentException("Position must be greater than or equal to zero."); } this.modifiers.addModifier(new PositionModifier(position)); return this; }
Source:
<code>public Object execute(ExecutionEvent event) throws <START> ExecutionException { <END> rebuildJob.cancel(); rebuildJob.schedule(); return null; }</code><technical_language>ExecutionException is unnecessary ok</technical_language>

Target:
public Object execute(ExecutionEvent event) { rebuildJob.cancel(); rebuildJob.schedule(); return null; }
Source:
<code>protected WappalyzerPassiveScanner createScanner() { <START> Logger.getLogger(WappalyzerPassiveScanner.class).setLevel(Level.DEBUG); <END> getDefaultHolder().resetApplicationsToSite(); return new WappalyzerPassiveScanner(getDefaultHolder()); }</code><technical_language>This is necessary default</technical_language>

Target:
protected WappalyzerPassiveScanner createScanner() { getDefaultHolder().resetApplicationsToSite(); return new WappalyzerPassiveScanner(getDefaultHolder()); }
Source:
<code><START> public void testSimpleEnvironmentNothingTodo() throws IOException, InterruptedException, FormException { <END> TestableDockerContainerWatchdog subject = new TestableDockerContainerWatchdog(); final String nodeName = "unittest-12345"; final String containerId = UUID.randomUUID().toString(); List<DockerCloud> listOfCloud = new LinkedList<DockerCloud>(); Map<String, String> labelMap = new HashMap<>(); labelMap.put(DockerContainerLabelKeys.NODE_NAME, nodeName); labelMap.put(DockerContainerLabelKeys.REMOVE_VOLUMES, "false"); List<Container> containerList = new LinkedList<Container>(); Container c = TestableDockerContainerWatchdog.createMockedContainer(containerId, "Running", 0L, labelMap); containerList.add(c); DockerAPI dockerApi = TestableDockerContainerWatchdog.createMockedDockerAPI(containerList); DockerCloud cloud = new DockerCloud("unittestcloud", dockerApi, new LinkedList<DockerTemplate>()); listOfCloud.add(cloud); subject.setAllClouds(listOfCloud); LinkedList<Node> allNodes = new LinkedList<Node>(); DockerTransientNode node = TestableDockerContainerWatchdog.createMockedDockerTransientNode(containerId, nodeName, cloud, false); allNodes.add(node); subject.setAllNodes(allNodes); subject.runExecute(); Assert.assertEquals(0, subject.getAllRemovedNodes().size()); }</code><technical_language>IDE tells in this method throws FormException. applies other times declared test methods - remove import of declaration of methods</technical_language>

Target:
public void testSimpleEnvironmentNothingTodo() throws IOException, InterruptedException { TestableDockerContainerWatchdog subject = new TestableDockerContainerWatchdog(); final String nodeName = "unittest-12345"; final String containerId = UUID.randomUUID().toString(); List<DockerCloud> listOfCloud = new LinkedList<DockerCloud>(); Map<String, String> labelMap = new HashMap<>(); labelMap.put(DockerContainerLabelKeys.NODE_NAME, nodeName); labelMap.put(DockerContainerLabelKeys.REMOVE_VOLUMES, "false"); List<Container> containerList = new LinkedList<Container>(); Container c = TestableDockerContainerWatchdog.createMockedContainer(containerId, "Running", 0L, labelMap); containerList.add(c); DockerAPI dockerApi = TestableDockerContainerWatchdog.createMockedDockerAPI(containerList); DockerCloud cloud = new DockerCloud("unittestcloud", dockerApi, new LinkedList<DockerTemplate>()); listOfCloud.add(cloud); subject.setAllClouds(listOfCloud); LinkedList<Node> allNodes = new LinkedList<Node>(); DockerTransientNode node = TestableDockerContainerWatchdog.createMockedDockerTransientNode(containerId, nodeName, cloud, false); allNodes.add(node); subject.setAllNodes(allNodes); subject.runExecute(); Assert.assertEquals(0, subject.getAllRemovedNodes().size()); }
Source:
<code>private Map<String, Object> computeKeyValues(List<String> fieldNames, List<String> values) { Map<String, Object> retVal = new LinkedHashMap<>(); <START> Iterator<String> keysIter = fieldNames.iterator(); <END> Iterator<String> valsIter = values.iterator(); while (keysIter.hasNext()) { final String key = keysIter.next(); if (valsIter.hasNext()) { Object splitedValue = spliteValue(key, valsIter.next()); retVal.put(key, splitedValue); } else { break; } } return retVal; }</code><technical_language>simpler for-each loop keys</technical_language>

Target:
private Map<String, Object> computeKeyValues(List<String> fieldNames, List<String> values) { Map<String, Object> retVal = new LinkedHashMap<>(); Iterator<String> valsIter = values.iterator(); for (String key : fieldNames) { if (valsIter.hasNext()) { Object splitedValue = spliteValue(key, valsIter.next()); retVal.put(key, splitedValue); } else { break; } } return retVal; }
Source:
<code>public KmlMarshaller() { try { this.jaxbContext = JAXBContext.newInstance(Kml.class); this.unmarshaller = jaxbContext.createUnmarshaller(); } catch (JAXBException e) { <START> LOGGER.info("Unable to create JAXB Context. Setting to null."); <END> this.jaxbContext = null; } }</code><technical_language>This more debug</technical_language>

Target:
public KmlMarshaller() { try { this.jaxbContext = JAXBContext.newInstance(Kml.class); this.unmarshaller = jaxbContext.createUnmarshaller(); } catch (JAXBException e) { LOGGER.debug("Unable to create JAXB Context. Setting to null."); this.jaxbContext = null; } }
Source:
<code>private void buildVmGraphicsDevicesFromDb(Map<String, Object> extraSpecParams) { <START> String spiceDeviceName = "spice"; <END> Comparator<VmDevice> spiceLastDeviceComparator = Comparator.comparing( VmDevice::getDevice, ComparatorUtils.sortLast(spiceDeviceName, ComparatorUtils.noOrdering())); buildVmDevicesFromDb(VmDeviceGeneralType.GRAPHICS, false, extraSpecParams, spiceLastDeviceComparator); String legacyDisplay = deriveDisplayTypeLegacy(); if (legacyDisplay != null) { createInfo.put(VdsProperties.display, legacyDisplay); } }</code><technical_language>please VmDeviceType#SPICE.getName instead</technical_language>

Target:
private void buildVmGraphicsDevicesFromDb(Map<String, Object> extraSpecParams) { Comparator<VmDevice> spiceLastDeviceComparator = Comparator.comparing( VmDevice::getDevice, ComparatorUtils.sortLast(VmDeviceType.SPICE.getName())); buildVmDevicesFromDb(VmDeviceGeneralType.GRAPHICS, false, extraSpecParams, spiceLastDeviceComparator); String legacyDisplay = deriveDisplayTypeLegacy(); if (legacyDisplay != null) { createInfo.put(VdsProperties.display, legacyDisplay); } }
Source:
<code>public static byte[] newByteArray(byte[] data, int finalSize) { <START> byte[] filledArray = new byte[finalSize]; <END> int diff = finalSize - data.length; if (diff >= 0) { for (int i = 0; i < diff; i++) filledArray[i] = '0'; System.arraycopy(data, 0, filledArray, diff, data.length); } else System.arraycopy(data, 0, filledArray, 0, finalSize); return filledArray; }</code><technical_language>Check if data is null</technical_language>

Target:
public static byte[] newByteArray(byte[] data, int finalSize) { if (data == null) throw new NullPointerException("Data cannot be null."); byte[] filledArray = new byte[finalSize]; int diff = finalSize - data.length; if (diff >= 0) { for (int i = 0; i < diff; i++) filledArray[i] = '0'; System.arraycopy(data, 0, filledArray, diff, data.length); } else System.arraycopy(data, 0, filledArray, 0, finalSize); return filledArray; }
Source:
<code>public void testPolicyDelete(String path) throws Exception { URL fileURL = Thread.currentThread().getContextClassLoader().getResource(path); Path policyDir = Paths.get(fileURL.toURI()).getParent(); assertTrue(RoleRegistry.get().getRegisteredRoles().isEmpty()); deployer.deployPolicy(policyDir); ArgumentCaptor<AuthorizationPolicy> policyCaptor = ArgumentCaptor.forClass(AuthorizationPolicy.class); ArgumentCaptor<Group> groupCaptor = ArgumentCaptor.forClass(Group.class); verify(storage).loadPolicy(); verify(storage).savePolicy(policyCaptor.capture()); Group group = new GroupImpl("group1"); storage.deletePolicyByGroup(group, policyCaptor.getValue()); verify(storage).deletePolicyByGroup(groupCaptor.capture(), policyCaptor.capture()); verify(event).fire(any()); AuthorizationPolicy policy = policyCaptor.getValue(); verify(permissionManager).setAuthorizationPolicy(policy); Set<Group> roles = policyCaptor.getValue().getGroups(); assertEquals(1, roles.size()); PermissionCollection permissions = policy.getPermissions(group); Permission permission = permissions.get("perspective.read"); assertNotNull(permission); assertEquals(AuthorizationResult.ACCESS_GRANTED, permission.getResult()); <START> ; <END> }</code><technical_language>unnecessary semicolon</technical_language>

Target:
public void testPolicyDelete(String path) throws Exception { URL fileURL = Thread.currentThread().getContextClassLoader().getResource(path); Path policyDir = Paths.get(fileURL.toURI()).getParent(); assertTrue(RoleRegistry.get().getRegisteredRoles().isEmpty()); deployer.deployPolicy(policyDir); ArgumentCaptor<AuthorizationPolicy> policyCaptor = ArgumentCaptor.forClass(AuthorizationPolicy.class); verify(storage).loadPolicy(); verify(storage).savePolicy(policyCaptor.capture()); vfsstorage.savePolicy(policyCaptor.getValue()); AuthorizationPolicy policy = vfsstorage.loadPolicyFromVfs(); Set<Group> groups = policy.getGroups(); assertEquals(1, groups.size()); Group group = new GroupImpl("group1"); PermissionCollection permissions = policy.getPermissions(group); Permission permission = permissions.get("perspective.read"); assertNotNull(permission); assertEquals(AuthorizationResult.ACCESS_GRANTED, permission.getResult()); vfsstorage.deletePolicyByGroup(group, policyCaptor.getValue()); verify(event).fire(any()); policy = vfsstorage.loadPolicyFromVfs(); groups = policy.getGroups(); assertEquals(0, groups.size()); }
Source:
<code>public static Job create(String name, final ICoreRunnable runnable) { return new Job(name) { @Override protected IStatus run(IProgressMonitor monitor) { try { runnable.run(monitor); } catch (CoreException e) { return toStatusPreservingCause(e); } finally { monitor.done(); } return Status.OK_STATUS; } <START> private IStatus toStatusPreservingCause(CoreException e) { <END> IStatus status = e.getStatus(); if (status.getException() != null) return status; return new Status(status.getSeverity(), status.getPlugin(), status.getCode(), status.getMessage(), e); } }; }</code><technical_language>This logic (converting a CoreException IStatus losing stack trace) needs in more places here. In fact, callers of CoreException#getStatus(), callers this logic instead. suggest this moved a static helper method in equinox common -- a new final method right CoreException. Also, this logic assumes if CoreException contains a more specific stack trace for CoreException is uninteresting. I this is case in situations, occurs in situations discarding wrapper unconditionally</technical_language>

Target:
public static Job create(String name, final ICoreRunnable runnable) { return new Job(name) { @Override protected IStatus run(IProgressMonitor monitor) { try { runnable.run(monitor); } catch (CoreException e) { IStatus st = e.getStatus(); return new Status(st.getSeverity(), st.getPlugin(), st.getCode(), st.getMessage(), e); } finally { monitor.done(); } return Status.OK_STATUS; } }; }
Source:
<code>public DataOutputStream getTempOutputStream() throws IOException { <START> File tempFile = File.createTempFile("test", ".dat"); <END> tempFilename = tempFile.getAbsolutePath(); Path path = new Path("file:/ Configuration conf = new Configuration(); FileSystem fs = path.getFileSystem(conf); return fs.create(path); }</code><technical_language>create files 'System.getProperty("test.build.data")/TestRawBytesStorage'</technical_language>

Target:
public DataOutputStream getTempOutputStream() throws IOException { tempPath = Files.createTempDir(); tempPath.mkdirs(); File tempFile = File.createTempFile("test", ".dat", tempPath); tempFilename = tempFile.getAbsolutePath(); Path path = new Path("file:/ Configuration conf = new Configuration(); FileSystem fs = path.getFileSystem(conf); return fs.create(path); }
Source:
<code>protected boolean canMutate(MutatableCode mutatableCode) { for (MInsn mInsn : mutatableCode.getInstructions()) { <START> return (mInsn.insn.info.opcode == Opcode.NEW_INSTANCE); <END> } Log.debug("No New Instance in method, skipping..."); return false; }</code><technical_language>uh, this is right? spot error</technical_language>

Target:
protected boolean canMutate(MutatableCode mutatableCode) { for (MInsn mInsn : mutatableCode.getInstructions()) { if (mInsn.insn.info.opcode == Opcode.NEW_INSTANCE) { return true; } } Log.debug("No New Instance in method, skipping..."); return false; }
Source:
<code>public void publish(Message message, Topic topic, MessageState messageState, RequestTimeoutLock requestTimeoutLock, BrokerListeners listeners, PublishingCallback callback) { if (requestTimeoutLock.tryLock()) { messageState.setState(SENDING_TO_KAFKA_PRODUCER_QUEUE); <START> brokerMessageProducer.send(message, topic, callback); <END> messageState.setState(SENDING_TO_KAFKA); } }</code><technical_language>if send() throws exception (for example fetch topic metadata) 65ms client receives 202 message send kafka, persisted in backup storage</technical_language>

Target:
public void publish(Message message, Topic topic, MessageState messageState, RequestTimeoutLock requestTimeoutLock, BrokerListeners listeners, PublishingCallback callback) { if (requestTimeoutLock.tryLock()) { messageState.setState(SENDING_TO_KAFKA_PRODUCER_QUEUE); brokerMessageProducer.send(message, topic, callback); messageState.setState(SENDING_TO_KAFKA); requestTimeoutLock.unlock(); } }
Source:
<code>public T editHosted(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Entry to modify.", required = true) @PathParam("entryId") Long entryId, @ApiParam(value = "Set of updated sourcefiles, add files by adding new files with unknown paths, delete files by including them with emptied content", required = true) Set<SourceFile> sourceFiles) { T entry = getEntryDAO().findById(entryId); checkEntry(entry); checkUser(user, entry); checkHosted(entry); U version = getVersion(entry); Set<SourceFile> versionSourceFiles = handleSourceFileMerger(entryId, sourceFiles, entry, version); boolean isValidVersion = checkValidVersion(versionSourceFiles, entry); if (!isValidVersion) { <START> throw new WebApplicationException("The reversion is not valid", HttpStatus.SC_BAD_REQUEST); <END> } version.setValid(isValidVersion); version.setVersionEditor(user); long l = getVersionDAO().create(version); entry.getVersions().add(getVersionDAO().findById(l)); userDAO.clearCache(); T newTool = getEntryDAO().findById(entryId); elasticManager.handleIndexUpdate(newTool, ElasticMode.UPDATE); return newTool; }</code><technical_language>I this GUI, more descriptive "Your edited files for invalid. new version created. Please check syntax try again."</technical_language>

Target:
public T editHosted(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Entry to modify.", required = true) @PathParam("entryId") Long entryId, @ApiParam(value = "Set of updated sourcefiles, add files by adding new files with unknown paths, delete files by including them with emptied content", required = true) Set<SourceFile> sourceFiles) { T entry = getEntryDAO().findById(entryId); checkEntry(entry); checkUser(user, entry); checkHosted(entry); U version = getVersion(entry); Set<SourceFile> versionSourceFiles = handleSourceFileMerger(entryId, sourceFiles, entry, version); boolean isValidVersion = checkValidVersion(versionSourceFiles, entry); if (!isValidVersion) { throw new WebApplicationException("Your edited files are invalid. No new version was created. Please check your syntax and try again.", HttpStatus.SC_BAD_REQUEST); } version.setValid(isValidVersion); version.setVersionEditor(user); long l = getVersionDAO().create(version); entry.getVersions().add(getVersionDAO().findById(l)); userDAO.clearCache(); T newTool = getEntryDAO().findById(entryId); elasticManager.handleIndexUpdate(newTool, ElasticMode.UPDATE); return newTool; }
Source:
<code>protected void executeQueryCommand() { <START> setReturnValue(getDbFacade().getVdsGroupDao().getClustersHavingHosts()); <END> }</code><technical_language>replaced injection</technical_language>

Target:
protected void executeQueryCommand() { setReturnValue(vdsGroupDao.getClustersHavingHosts()); }
Source:
<code>public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getNewSnapshotCommand())) { newSnapshot(); } else if (command.getName().equalsIgnoreCase("onCreateSnapshot")) { onCreateSnapshot(); <START> } else if (command.getName().equalsIgnoreCase("Cancel")) { END> setWindow(null); } else if (command.equals(getEditSnapshotScheduleCommand())) { editSnapshotSchedule(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) { onEditSnapshotSchedule(); } }</code><technical_language>case first</technical_language>

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getNewSnapshotCommand())) { newSnapshot(); } else if (command.getName().equalsIgnoreCase("onCreateSnapshot")) { onCreateSnapshot(); } else if (command.getName().equalsIgnoreCase("cancel")) { setWindow(null); } else if (command.equals(getEditSnapshotScheduleCommand())) { editSnapshotSchedule(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) { onEditSnapshotSchedule(); } }
Source:
<code>public int getRowCountEstimate() { int estimate = rowCountEstimate; if (estimate < 1) { <START> estimate = pageSize * 4; <END> } if (estimate <= requestedRange.getEnd()) { estimate = requestedRange.getEnd() + pageSize; } return estimate; }</code><technical_language>wondering, based choose 4 for default estimation? For reasonable, users data explore, apply filters find quicker scroll deeply, is testers feedback that</technical_language>

Target:
public int getRowCountEstimate() { if (rowCountEstimate < 1) { return pageSize * DEFAULT_PAGE_INCREASE_COUNT; } return rowCountEstimate; }
Source:
<code>public MergeOp create(Branch.NameKey branch) { final ProjectState pe = mergeArguments.projectCache.get(branch.getParentKey()); if (pe == null) { log.error("No such project: " + branch.getParentKey()); <START> return null; <END> } final Project destProject = pe.getProject(); mergeArguments.destBranch = branch; mergeArguments.destProject = destProject; switch (destProject.getSubmitType()) { case CHERRY_PICK: return new CherryPick(mergeArguments); case FAST_FORWARD_ONLY: return new FastForwardOnly(mergeArguments); case MERGE_ALWAYS: return new MergeAlways(mergeArguments); case MERGE_IF_NECESSARY: return new MergeIfNecessary(mergeArguments); default: return null; } }</code><technical_language>throw exception in this case</technical_language>

Target:
public MergeOp create(Branch.NameKey branch) throws MergeException { final ProjectState pe = mergeArguments.projectCache.get(branch.getParentKey()); if (pe == null) { final String errorMsg = "No such project: " + branch.getParentKey(); log.error(errorMsg); throw new MergeException(errorMsg); } final Project destProject = pe.getProject(); switch (destProject.getSubmitType()) { case CHERRY_PICK: return new CherryPick(mergeArguments, destProject, branch); case FAST_FORWARD_ONLY: return new FastForwardOnly(mergeArguments, destProject, branch); case MERGE_ALWAYS: return new MergeAlways(mergeArguments, destProject, branch); case MERGE_IF_NECESSARY: return new MergeIfNecessary(mergeArguments, destProject, branch); default: final String errorMsg = "No such submit type: " + destProject.getSubmitType(); log.error(errorMsg); throw new MergeException(errorMsg); } }