auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static VdcParameter deserialize(String key) { Map<String, String> map = new HashMap<String, String>(); for (String token : key.split(";")) { String[] keyVal = token.split("="); map.put(keyVal[0], keyVal[1]); } switch (Integer.parseInt(map.get(VERSION_KEY))) { case 0: <START> synchronized (parametersMap) { <END> Guid guid = new Guid(map.get(GUID_KEY)); if (!parametersMap.containsKey(guid)) { throw new InvalidParameterKeyException("VdcParameter with guid not found "+ guid.toString()); } return parametersMap.get(guid); } default: throw new InvalidParameterKeyException("Error deserializing VdcParameter from key " + key); } }</code><technical_language>if synchronize get, wrap this in ConcurrentHashMap Collections.synchronizedMap</technical_language>

Target:
public static VdcParameter deserialize(String key) { Map<String, String> map = new HashMap<String, String>(); for (String token : key.split(";")) { String[] keyVal = token.split("="); map.put(keyVal[0], keyVal[1]); } switch (Integer.parseInt(map.get(VERSION_KEY))) { case 0: synchronized (parametersMap) { UUID uuid = UUID.fromString(map.get(UUID_KEY)); VdcParameter param = parametersMap.get(uuid); if (param == null) { throw new InvalidParameterKeyException("VdcParameter with uuid not found "+ uuid.toString()); } return param; } default: throw new InvalidParameterKeyException("Error deserializing VdcParameter from key " + key); } }
Source:
<code>public static <T> Predicate<T> filterByTypeAndName( Function<? super T, ?> generateKey) { <START> Map<Object, Boolean> insertedPropertiesMap = new ConcurrentHashMap<>(); <END> return t -> insertedPropertiesMap.putIfAbsent(generateKey.apply(t), Boolean.TRUE) == null; }</code><technical_language>ConcurrentHashMap here</technical_language>

Target:
public static <T> Predicate<T> filterByTypeAndName( Function<? super T, ?> generateKey) { Map<Object, Boolean> insertedPropertiesMap = new HashMap<>(); return t -> insertedPropertiesMap.putIfAbsent(generateKey.apply(t), Boolean.TRUE) == null; }
Source:
<code>public void visitNewClass(NewClassTree tree) { <START> if (tree.is(Tree.Kind.NEW_CLASS)) { <END> checkMethodInvocationArgument(tree.arguments(), tree.constructorSymbol()); } super.visitNewClass(tree); }</code><technical_language>tree is necessarily a NewClassTree here, of good kind. drop if</technical_language>

Target:
public void visitNewClass(NewClassTree tree) { checkMethodInvocationArgument(tree.arguments(), tree.constructorSymbol()); super.visitNewClass(tree); }
Source:
<code>public CompletableFuture<Versioned<BookieServiceInfo>> getBookieServiceInfo(String bookieId) { String pathAsWritable = bookieRegistrationPath + "/" + bookieId; String pathAsReadonly = bookieReadonlyRegistrationPath + "/" + bookieId; CompletableFuture<Versioned<BookieServiceInfo>> promise = new CompletableFuture<>(); zk.getData(pathAsWritable, false, (int rc, String path, Object o, byte[] bytes, Stat stat) -> { if (KeeperException.Code.OK.intValue() == rc) { try { BookieServiceInfo bookieServiceInfo = deserializeBookieService(bookieId, bytes); promise.complete(new Versioned<>(bookieServiceInfo, new LongVersion(stat.getCversion()))); } catch (IOException ex) { promise.completeExceptionally(KeeperException.create(KeeperException.Code.get(rc), path)); return; } } else if (KeeperException.Code.NONODE.intValue() == rc) { zk.getData(pathAsReadonly, false, (int rc2, String path2, Object o2, byte[] bytes2, Stat stat2) -> { if (KeeperException.Code.OK.intValue() == rc2) { try { BookieServiceInfo bookieServiceInfo = deserializeBookieService(bookieId, bytes2); promise.complete(new Versioned<>(bookieServiceInfo, new LongVersion(stat2.getCversion()))); } catch (IOException ex) { promise.completeExceptionally(KeeperException.create(KeeperException.Code.get(rc2), path2)); return; } } else { <START> promise.completeExceptionally(KeeperException.create(KeeperException.Code.get(rc2), path2)); <END> } }, null); } else { promise.completeExceptionally(KeeperException.create(KeeperException.Code.get(rc), path)); } }, null); return promise; }</code><technical_language>BKBookieNotAvailableException</technical_language>

Target:
public CompletableFuture<Versioned<BookieServiceInfo>> getBookieServiceInfo(String bookieId) { String pathAsWritable = bookieRegistrationPath + "/" + bookieId; String pathAsReadonly = bookieReadonlyRegistrationPath + "/" + bookieId; CompletableFuture<Versioned<BookieServiceInfo>> promise = new CompletableFuture<>(); zk.getData(pathAsWritable, false, (int rc, String path, Object o, byte[] bytes, Stat stat) -> { if (KeeperException.Code.OK.intValue() == rc) { try { BookieServiceInfo bookieServiceInfo = deserializeBookieServiceInfo(bookieId, bytes); promise.complete(new Versioned<>(bookieServiceInfo, new LongVersion(stat.getCversion()))); } catch (IOException ex) { promise.completeExceptionally(KeeperException.create(KeeperException.Code.get(rc), path)); return; } } else if (KeeperException.Code.NONODE.intValue() == rc) { zk.getData(pathAsReadonly, false, (int rc2, String path2, Object o2, byte[] bytes2, Stat stat2) -> { if (KeeperException.Code.OK.intValue() == rc2) { try { BookieServiceInfo bookieServiceInfo = deserializeBookieServiceInfo(bookieId, bytes2); promise.complete(new Versioned<>(bookieServiceInfo, new LongVersion(stat2.getCversion()))); } catch (IOException ex) { promise.completeExceptionally(KeeperException.create(KeeperException.Code.get(rc2), path2)); return; } } else { promise.completeExceptionally(BKException.create(BKException.Code.NoBookieAvailableException)); } }, null); } else { promise.completeExceptionally(KeeperException.create(KeeperException.Code.get(rc), path)); } }, null); return promise; }
Source:
<code>private void checkMigrationEffect(DAnalysis analysis) { <START> UnmodifiableIterator<EObject> <END> noteAttachmentWithoutSourceOrTarget = null; for (DView dView : analysis.getOwnedViews()) { for (DDiagram dDiagram : Iterables.filter(dView.getOwnedRepresentations(), DDiagram.class)) { DiagramCreationUtil diagramCreationUtil = new DiagramCreationUtil(dDiagram); if (diagramCreationUtil.findAssociatedGMFDiagram()) { Diagram gmfDiagram = diagramCreationUtil.getAssociatedGMFDiagram(); noteAttachmentWithoutSourceOrTarget = Iterators.filter(gmfDiagram.eAllContents(), Predicates.and(Predicates.instanceOf(Connector.class), new Predicate<EObject>() { @Override public boolean apply(EObject input) { Connector connector = (Connector) input; if (ViewType.NOTEATTACHMENT.equals(connector.getType())) { return connector.getSource() == null || connector.getTarget() == null; } return false; } })); } } } assertTrue("It should not have NoteAttachment without source or target in this representations file.", noteAttachmentWithoutSourceOrTarget == null || !noteAttachmentWithoutSourceOrTarget.hasNext()); }</code><technical_language>declarative typre Iterator need UnmodifiableIterator specificity in code</technical_language>

Target:
private void checkMigrationEffect(DAnalysis analysis) { Iterator<EObject> noteAttachmentWithoutSourceOrTarget = null; for (DView dView : analysis.getOwnedViews()) { for (DDiagram dDiagram : Iterables.filter(dView.getOwnedRepresentations(), DDiagram.class)) { DiagramCreationUtil diagramCreationUtil = new DiagramCreationUtil(dDiagram); if (diagramCreationUtil.findAssociatedGMFDiagram()) { Diagram gmfDiagram = diagramCreationUtil.getAssociatedGMFDiagram(); noteAttachmentWithoutSourceOrTarget = Iterators.filter(gmfDiagram.eAllContents(), Predicates.and(Predicates.instanceOf(Connector.class), new Predicate<EObject>() { @Override public boolean apply(EObject input) { Connector connector = (Connector) input; if (ViewType.NOTEATTACHMENT.equals(connector.getType())) { return connector.getSource() == null || connector.getTarget() == null; } return false; } })); } } } assertTrue("It should not have NoteAttachment without source or target in this representations file.", noteAttachmentWithoutSourceOrTarget == null || !noteAttachmentWithoutSourceOrTarget.hasNext()); }
Source:
<code>public void setTitle(final String title) { <START> mToolbarTitle = (title.equals("")) ? "WordPress" : title; <END> if (mToolbar != null) { mToolbar.setTitle(title); } }</code><technical_language>TextUtils.isEmpty instead of checking for empty string. need localize string. I suggest adding a new string resource, wordpress_as_site_title clear give information translators</technical_language>

Target:
public void setTitle(final String title) { mToolbarTitle = title.isEmpty() ? getString(R.string.wordpress_as_site_title) : title; if (mToolbar != null) { mToolbar.setTitle(mToolbarTitle); } }
Source:
<code>private List<IndexName> getIndexNameObjectList(Set<String> versionedIndexPaths) { Set<String> allIndexNameVersions = getIndexVersionNames(versionedIndexPaths); List<IndexName> indexNameObjectList = getVersionedIndexNameObjects(allIndexNameVersions); <START> return indexNameObjectList; <END> }</code><technical_language>nit: remove unnecessary local variable indexNameObjectList</technical_language>

Target:
private List<IndexName> getIndexNameObjectList(Set<String> versionedIndexPaths) { List<IndexName> indexNameObjectList = new ArrayList<>(); for (String indexNameString : versionedIndexPaths) { indexNameObjectList.add(IndexName.parse(indexNameString)); } return indexNameObjectList; }
Source:
<code>public boolean isEnabled() { if (config == null) { <START> return true; <END> } Boolean enabled = (Boolean) config.get("enabled"); return enabled == null || enabled.booleanValue(); }</code><technical_language>if config, this return false</technical_language>

Target:
public boolean isEnabled() { if (config == null) { return false; } Boolean enabled = (Boolean) config.get("enabled"); return enabled == null || enabled.booleanValue(); }
Source:
<code>public void testIsAttached() { UI ui = new UI(); Assert.assertTrue(ui.isAttached()); TestComponentContainer parent = new TestComponentContainer(); TestComponentContainer child = new TestComponentContainer(); TestComponent grandChild = new TestComponent(); child.track(); grandChild.addAttachListener( event -> Assert.assertTrue(grandChild.isAttached())); grandChild.addDetachListener( event -> grandChild.getDetachEvents().incrementAndGet()); parent.add(child); child.add(grandChild); Assert.assertFalse(parent.isAttached()); Assert.assertFalse(child.isAttached()); Assert.assertFalse(grandChild.isAttached()); ui.add(parent); Assert.assertTrue(parent.isAttached()); Assert.assertTrue(child.isAttached()); Assert.assertTrue(grandChild.isAttached()); ui.remove(parent); Assert.assertFalse(parent.isAttached()); Assert.assertFalse(child.isAttached()); Assert.assertFalse(grandChild.isAttached()); ui.add(parent); Assert.assertTrue(parent.isAttached()); Assert.assertTrue(child.isAttached()); Assert.assertTrue(grandChild.isAttached()); ui.close(); <START> Assert.assertTrue(parent.isAttached()); <END> Assert.assertTrue(child.isAttached()); Assert.assertTrue(grandChild.isAttached()); }</code><technical_language>more logical component attached anymore UI is closed / removed</technical_language>

Target:
public void testIsAttached() { UI ui = new UI(); Assert.assertTrue(ui.isAttached()); TestComponentContainer parent = new TestComponentContainer(); TestComponentContainer child = new TestComponentContainer(); TestComponent grandChild = new TestComponent(); child.track(); grandChild.addAttachListener( event -> Assert.assertTrue(grandChild.isAttached())); grandChild.addDetachListener( event -> grandChild.getDetachEvents().incrementAndGet()); parent.add(child); child.add(grandChild); Assert.assertFalse(parent.isAttached()); Assert.assertFalse(child.isAttached()); Assert.assertFalse(grandChild.isAttached()); ui.add(parent); Assert.assertTrue(parent.isAttached()); Assert.assertTrue(child.isAttached()); Assert.assertTrue(grandChild.isAttached()); ui.remove(parent); Assert.assertFalse(parent.isAttached()); Assert.assertFalse(child.isAttached()); Assert.assertFalse(grandChild.isAttached()); ui.add(parent); Assert.assertTrue(parent.isAttached()); Assert.assertTrue(child.isAttached()); Assert.assertTrue(grandChild.isAttached()); ui.getInternals().setSession(Mockito.mock(VaadinSession.class)); ui.close(); ui.getInternals().setSession(null); Assert.assertFalse(parent.isAttached()); Assert.assertFalse(child.isAttached()); Assert.assertFalse(grandChild.isAttached()); Assert.assertFalse(ui.isAttached()); }
Source:
<code>public static void initialize(final Initializer initializer) { <START> ActivityTracker.get().beginTrackingIfPossible( <END> (Application)initializer.mContext.getApplicationContext()); Thread listener = new Thread(LISTENER_THREAD_NAME) { @Override public void run() { LocalSocketHttpServer server = new LocalSocketHttpServer(initializer); try { server.run(); } catch (IOException e) { LogUtil.e(e, "Could not start Stetho"); } } }; listener.start(); }</code><technical_language>LogUtil.i .w if this returns false</technical_language>

Target:
public static void initialize(final Initializer initializer) { boolean isTrackingActivities = ActivityTracker.get().beginTrackingIfPossible( (Application)initializer.mContext.getApplicationContext()); if (!isTrackingActivities) { LogUtil.w("Automatic activity tracking not available on this API level, caller must invoke " + "ActivityTracker methods manually!"); } Thread listener = new Thread(LISTENER_THREAD_NAME) { @Override public void run() { LocalSocketHttpServer server = new LocalSocketHttpServer(initializer); try { server.run(); } catch (IOException e) { LogUtil.e(e, "Could not start Stetho"); } } }; listener.start(); }
Source:
<code>public String[] getCompletion(String wordPart) { if (wordPart == null || wordPart.isEmpty()) { return EMPTY_COMPLETION_LIST; } List<String> list = new ArrayList<String>(); for (String osName : OsRepositoryImpl.INSTANCE.getOsNames().values()) { if (osName.startsWith(wordPart)) { list.add(osName); } } <START> return list.toArray(new String[]{}); <END> }</code><technical_language>well, I prefer list.toArray(new String[list.size()]) - save instance :)</technical_language>

Target:
public String[] getCompletion(String wordPart) { if (wordPart == null || wordPart.isEmpty()) { return EMPTY_COMPLETION_LIST; } List<String> list = new ArrayList<String>(); for (String osName : map.values()) { if (osName.startsWith(wordPart)) { list.add(osName); } } return list.toArray(new String[]{}); }
Source:
<code>public AtsDsl getContents(String uri, String xTextData) throws Exception { AtsDslStandaloneSetup setup = new AtsDslStandaloneSetup(); Injector injector = setup.createInjectorAndDoEMFRegistration(); XtextResourceSet set = injector.getInstance(XtextResourceSet.class); set.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE); resource = set.createResource(URI.createURI(uri)); resource.load(new ByteArrayInputStream(xTextData.getBytes("UTF-8")), set.getLoadOptions()); EList<EObject> contents = resource.getContents(); if <START> (contents.size() == 1) { <END> return (AtsDsl) contents.get(0); } else { return AtsDslFactoryImpl.init().createAtsDsl(); } }</code><technical_language>if size > 1, do want do else condition</technical_language>

Target:
public AtsDsl getContents(String uri, String xTextData) throws Exception { AtsDslStandaloneSetup setup = new AtsDslStandaloneSetup(); Injector injector = setup.createInjectorAndDoEMFRegistration(); XtextResourceSet set = injector.getInstance(XtextResourceSet.class); set.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE); resource = set.createResource(URI.createURI(uri)); resource.load(new ByteArrayInputStream(xTextData.getBytes("UTF-8")), set.getLoadOptions()); EList<EObject> contents = resource.getContents(); if (contents.size() == 1) { return (AtsDsl) contents.get(0); } else if (contents.isEmpty()) { return AtsDslFactoryImpl.init().createAtsDsl(); } else { throw new OseeArgumentException("Unexpected contents size > 1 in AtsDslResourceProvicer", contents.toString()); } }
Source:
<code>public ReactorSession(Session session, SessionHandler sessionHandler, String sessionName, ReactorProvider provider, <START> ReactorHandlerProvider handlerProvider, Mono<ClaimsBasedSecurityNode> cbsNodeSupplier, <END> TokenManagerProvider tokenManagerProvider, MessageSerializer messageSerializer, Duration openTimeout, AmqpRetryPolicy retryPolicy) { this(session, sessionHandler, sessionName, provider, handlerProvider, cbsNodeSupplier, tokenManagerProvider, messageSerializer, openTimeout); this.retryPolicy = retryPolicy; }</code><technical_language>do need this constructor overload if add a retry existing ctor</technical_language>

Target:
public ReactorSession(Session session, SessionHandler sessionHandler, String sessionName, ReactorProvider provider, ReactorHandlerProvider handlerProvider, Mono<ClaimsBasedSecurityNode> cbsNodeSupplier, TokenManagerProvider tokenManagerProvider, MessageSerializer messageSerializer, Duration openTimeout, AmqpRetryPolicy retryPolicy) { this.session = session; this.sessionHandler = sessionHandler; this.handlerProvider = handlerProvider; this.sessionName = sessionName; this.provider = provider; this.cbsNodeSupplier = cbsNodeSupplier; this.tokenManagerProvider = tokenManagerProvider; this.messageSerializer = messageSerializer; this.openTimeout = openTimeout; this.retryPolicy = retryPolicy; this.subscriptions = Disposables.composite( this.sessionHandler.getEndpointStates().subscribe( state -> { logger.verbose("Connection state: {}", state); endpointStateSink.next(AmqpEndpointStateUtil.getConnectionState(state)); }, error -> { logger.error("[{}] Error occurred in session endpoint handler.", sessionName, error); endpointStateSink.error(error); dispose(); }, () -> { endpointStateSink.next(AmqpEndpointState.CLOSED); endpointStateSink.complete(); dispose(); }), this.sessionHandler.getErrors().subscribe(error -> { logger.error("[{}] Error occurred in session error handler.", sessionName, error); endpointStateSink.error(error); dispose(); })); session.open(); }
Source:
<code>public void get_NullSafe() { <START> assertThat(new ReportFeatureMergerFactory().get(null)).isInstanceOf(ReportFeatureAppendableMerger.class); <END> }</code><technical_language>prefer // // // sections</technical_language>

Target:
public void get_NullSafe() { ReportFeatureMerger merger = new ReportFeatureMergerFactory().get(null); assertThat(merger).isInstanceOf(ReportFeatureAppendableMerger.class); }
Source:
<code>private TableOperatorWrapper<?> visit(Transformation<?> transform) { if (!(transform instanceof UnionTransformation)) { calcParallelismAndResource(transform); } final TableOperatorWrapper<?> wrapper; <START> if (visitedTransforms.containsKey(transform)) { wrapper = visitedTransforms.get(transform); } else { wrapper = visitTransformation(transform); visitedTransforms.put(transform, wrapper); } <END> return wrapper; }</code><technical_language>wrapper = visitedTransforms.computeIfAbsent(transform, t -> visitTransformation(t))</technical_language>

Target:
private TableOperatorWrapper<?> visit(Transformation<?> transform) { if (!(transform instanceof UnionTransformation)) { calcParallelismAndResource(transform); } return visitedTransforms.computeIfAbsent(transform, this::visitTransformation); }
Source:
<code>@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) { if (!env.processingOver()) { for (Element e : env.getElementsAnnotatedWith(Module.class)) { if (!(e instanceof TypeElement)) { error("@Module applies to a type, " + e.getSimpleName() + " is a " + e.getKind(), e); continue; } delayedModuleNames.add(((TypeElement) e).getQualifiedName().toString()); } return true; } Set<Element> modules = new LinkedHashSet<Element>(); for (String moduleName : delayedModuleNames) { modules.add(processingEnv.getElementUtils().getTypeElement(moduleName)); } for (Element element : modules) { Map<String, Object> annotation = CodeGen.getAnnotation(Module.class, element); if (!annotation.get("complete").equals(Boolean.TRUE)) { continue; } TypeElement moduleType = (TypeElement) element; Map<String, Binding<?>> bindings = processCompleteModule(moduleType); try { new ProblemDetector().detectProblems(bindings.values()); } catch (IllegalStateException e) { error("Graph validation failed: " + e.getMessage(), moduleType); } try { <START> writeDotFile(moduleType, bindings); <END> } catch (IOException e) { error("Graph visualization failed: " + e, moduleType); } } return true; }</code><technical_language>skip writing dot file if graph a cycle? fail</technical_language>

Target:
@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) { if (!env.processingOver()) { for (Element e : env.getElementsAnnotatedWith(Module.class)) { if (!(e instanceof TypeElement)) { error("@Module applies to a type, " + e.getSimpleName() + " is a " + e.getKind(), e); continue; } delayedModuleNames.add(((TypeElement) e).getQualifiedName().toString()); } return true; } Set<Element> modules = new LinkedHashSet<Element>(); for (String moduleName : delayedModuleNames) { modules.add(processingEnv.getElementUtils().getTypeElement(moduleName)); } for (Element element : modules) { Map<String, Object> annotation = CodeGen.getAnnotation(Module.class, element); if (!annotation.get("complete").equals(Boolean.TRUE)) { continue; } TypeElement moduleType = (TypeElement) element; Map<String, Binding<?>> bindings = processCompleteModule(moduleType); try { new ProblemDetector().detectProblems(bindings.values()); } catch (IllegalStateException e) { error("Graph validation failed: " + e.getMessage(), moduleType); continue; } try { writeDotFile(moduleType, bindings); } catch (IOException e) { error("Graph visualization failed: " + e, moduleType); } } return true; }
Source:
<code>private Promise<Optional<Resource>> findResource(final Path absolutePath, boolean quiet) { String[] segments = absolutePath.segments(); Promise<Optional<Resource>> chain = promises.resolve(null); for (int i = 0; i <= segments.length; i++) { Path pathToRetrieve = absolutePath.removeLastSegments(segments.length - i); <START> chain = chain.thenPromise(__ -> doFindResource(pathToRetrieve)); <END> } return chain; }</code><technical_language>Try find more informative name "__"</technical_language>

Target:
private Promise<Optional<Resource>> findResource(final Path absolutePath, boolean quiet) { String[] segments = absolutePath.segments(); Promise<Optional<Resource>> chain = promises.resolve(null); for (int i = 0; i <= segments.length; i++) { Path pathToRetrieve = absolutePath.removeLastSegments(segments.length - i); chain = chain.thenPromise(ignored -> doFindResource(pathToRetrieve)); } return chain; }
Source:
<code>public void onEvent(SetInstanceHeaderEvent event) { <START> if (context.getModel().getSelectedColumn() == null) { <END> return; } if (context.getModel().isSameInstanceType(event.getClassName())) { return; } context.getStatus().setFullPackage(event.getFullPackage()); context.getStatus().setClassName(event.getClassName()); if (((ScenarioGridColumn) context.getModel().getSelectedColumn()).isInstanceAssigned()) { org.uberfire.mvp.Command okPreserveCommand = () -> commonExecution(context, new SetInstanceHeaderCommand(), true); deletePopupPresenter.show(ScenarioSimulationEditorConstants.INSTANCE.changeTypeMainTitle(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeMainQuestion(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeText1(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeTextQuestion(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeTextDanger(), ScenarioSimulationEditorConstants.INSTANCE.changeType(), okPreserveCommand); } else { commonExecution(context, new SetInstanceHeaderCommand(), true); } }</code><technical_language>This check is duplicated in public boolean isSameInstanceType(String className) is invoked immediately below</technical_language>

Target:
public void onEvent(SetInstanceHeaderEvent event) { if (context.getModel().isSameInstanceType(event.getClassName())) { return; } context.getStatus().setFullPackage(event.getFullPackage()); context.getStatus().setClassName(event.getClassName()); if (((ScenarioGridColumn) context.getModel().getSelectedColumn()).isInstanceAssigned()) { org.uberfire.mvp.Command okPreserveCommand = () -> commonExecution(context, new SetInstanceHeaderCommand(), true); deletePopupPresenter.show(ScenarioSimulationEditorConstants.INSTANCE.changeTypeMainTitle(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeMainQuestion(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeText1(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeTextQuestion(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeTextDanger(), ScenarioSimulationEditorConstants.INSTANCE.changeType(), okPreserveCommand); } else { commonExecution(context, new SetInstanceHeaderCommand(), true); } }
Source:
<code>public void process(Element elm, JID actor, IQ reqIQ, Element rsm) throws InterruptedException, NodeStoreException { element = elm; request = reqIQ; response = IQ.createResultIQ(request); node = element.attributeValue("node"); this.actor = actor; <START> if (null == this.actor) <END> this.actor = request.getFrom(); if (!channelManager.isLocalNode(node)) { makeRemoteRequest(); return; } try { if (!validNodeProvided() || !nodeExists() || !itemIdProvided() || !itemExists() || !validPayload() || !canDelete()) { outQueue.put(response); return; } deleteItem(); outQueue.put(response); deleteReplies(); sendNotifications(node, itemId); return; } catch (NodeStoreException e) { logger.error(e); setErrorCondition(PacketError.Type.wait, PacketError.Condition.internal_server_error); } catch (NullPointerException e) { logger.error(e); setErrorCondition(PacketError.Type.modify, PacketError.Condition.bad_request); } catch (IllegalArgumentException e) { logger.error(e); setErrorCondition(PacketError.Type.modify, PacketError.Condition.bad_request); } outQueue.put(response); }</code><technical_language>Braces</technical_language>

Target:
public void process(Element elm, JID actor, IQ reqIQ, Element rsm) throws InterruptedException, NodeStoreException { element = elm; request = reqIQ; response = IQ.createResultIQ(request); node = element.attributeValue("node"); this.actor = actor; if (null == this.actor) { this.actor = request.getFrom(); } if (!channelManager.isLocalNode(node)) { makeRemoteRequest(); return; } try { if (!validNodeProvided() || !nodeExists() || !itemIdProvided() || !itemExists() || !validPayload() || !canDelete()) { outQueue.put(response); return; } deleteItem(); outQueue.put(response); deleteReplies(); sendNotifications(node, itemId); return; } catch (NodeStoreException e) { logger.error(e); setErrorCondition(PacketError.Type.wait, PacketError.Condition.internal_server_error); } catch (NullPointerException e) { logger.error(e); setErrorCondition(PacketError.Type.modify, PacketError.Condition.bad_request); } catch (IllegalArgumentException e) { logger.error(e); setErrorCondition(PacketError.Type.modify, PacketError.Condition.bad_request); } outQueue.put(response); }
Source:
<code>public BillTrade withPrice(double price) { <START> return BillTrade.builder().info(info).product(product).quantity(quantity).price(price).build(); <END> }</code><technical_language>return new BillTrade(...)</technical_language>

Target:
public BillTrade withPrice(double price) { return new BillTrade(info, product, quantity, price); }
Source:
<code>protected Listcell renderOwner(final SummaryType summaryType) { Boolean isMakePublic = summaryType.isMakePublic(); <START> String owner; <END> if (isMakePublic != null && isMakePublic == true) { owner = "public"; } else { owner = summaryType.getOwner(); } Label label = new Label(owner); label.setClientAttribute("title", owner); return wrapIntoListCell(label); }</code><technical_language>this owner = summaryType.getOwner(); 1 if statement</technical_language>

Target:
protected Listcell renderOwner(final SummaryType summaryType) { Boolean isMakePublic = summaryType.isMakePublic(); String owner = summaryType.getOwnerName(); Label label = new Label(owner); label.setClientAttribute("title", owner); return wrapIntoListCell(label); }
Source:
<code>public void testCompareBasic() throws Exception { for (AvailableGitTestRepo testRepo : AvailableGitTestRepo.values()) { if (testRepo == AvailableGitTestRepo.GIT_COMMIT_ID) { continue; <START> } <END> mavenSandbox.withParentProject("my-basic-project", "jar").withNoChildProject().withGitRepoInParent(testRepo).create(); MavenProject targetProject = mavenSandbox.getParentProject(); verifyNativeAndJGit(testRepo, targetProject, DEFAULT_FORMAT_STRING); } }</code><technical_language>please rewrite continue, harder track code</technical_language>

Target:
public void testCompareBasic() throws Exception { for (AvailableGitTestRepo testRepo : AvailableGitTestRepo.values()) { if (testRepo != AvailableGitTestRepo.GIT_COMMIT_ID) { mavenSandbox.withParentProject("my-basic-project", "jar").withNoChildProject().withGitRepoInParent(testRepo).create(); MavenProject targetProject = mavenSandbox.getParentProject(); verifyNativeAndJGit(testRepo, targetProject, DEFAULT_FORMAT_STRING); } } }
Source:
<code>protected void ensureValuesCapacity() { if (!outputChannelSet) { return; } int capacity = numValues + inputQualifyingSet.getPositionCount(); if (values == null) { <START> values = new long[capacity]; <END> } else if (values.length < capacity) { values = Arrays.copyOf(values, capacity); } }</code><technical_language>new utility method</technical_language>

Target:
protected void ensureValuesCapacity() { if (!outputChannelSet) { return; } int capacity = numValues + inputQualifyingSet.getPositionCount(); if (values == null || values.length < capacity) { values = resize(values, capacity); } }
Source:
<code>public void createTest() throws Exception { context.turnOffAuthorisationSystem(); ObjectMapper mapper = new ObjectMapper(); EPersonRest data = new EPersonRest(); MetadataRest metadataRest = new MetadataRest(); data.setEmail("createtest@fake-email.com"); data.setCanLogIn(true); MetadataValueRest surname = new MetadataValueRest(); surname.setValue("Doe"); metadataRest.put("eperson.lastname", surname); MetadataValueRest firstname = new MetadataValueRest(); firstname.setValue("John"); metadataRest.put("eperson.firstname", firstname); data.setMetadata(metadataRest); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform(post("/api/eperson/epersons") .content(mapper.writeValueAsBytes(data)) .contentType(contentType)) .andExpect(status().isCreated()) <START> .andExpect(jsonPath("$", Matchers.allOf( <END> hasJsonPath("$.uuid", not(empty())), hasJsonPath("$.email", is("createtest@fake-email.com")), hasJsonPath("$.type", is("eperson")), hasJsonPath("$.canLogIn", is(true)), hasJsonPath("$.requireCertificate", is(false)), hasJsonPath("$._links.self.href", not(empty())), hasJsonPath("$.metadata", Matchers.allOf( matchMetadata("eperson.firstname", "John"), matchMetadata("eperson.lastname", "Doe") ))))); }</code><technical_language>this request return correct content type anymore</technical_language>

Target:
public void createTest() throws Exception { context.turnOffAuthorisationSystem(); ObjectMapper mapper = new ObjectMapper(); EPersonRest data = new EPersonRest(); MetadataRest metadataRest = new MetadataRest(); data.setEmail("createtest@fake-email.com"); data.setCanLogIn(true); MetadataValueRest surname = new MetadataValueRest(); surname.setValue("Doe"); metadataRest.put("eperson.lastname", surname); MetadataValueRest firstname = new MetadataValueRest(); firstname.setValue("John"); metadataRest.put("eperson.firstname", firstname); data.setMetadata(metadataRest); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform(post("/api/eperson/epersons") .content(mapper.writeValueAsBytes(data)) .contentType(contentType)) .andExpect(status().isCreated()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$", Matchers.allOf( hasJsonPath("$.uuid", not(empty())), hasJsonPath("$.email", is("createtest@fake-email.com")), hasJsonPath("$.type", is("eperson")), hasJsonPath("$.canLogIn", is(true)), hasJsonPath("$.requireCertificate", is(false)), hasJsonPath("$._links.self.href", not(empty())), hasJsonPath("$.metadata", Matchers.allOf( matchMetadata("eperson.firstname", "John"), matchMetadata("eperson.lastname", "Doe") ))))); }
Source:
<code>private String getPushErrors() { StringBuilder messages = new StringBuilder(); for (URIish uri : result.getURIs()) { String errorMessage = result.getErrorMessage(uri); if (errorMessage != null && errorMessage.length() > 0) { <START> if (messages.length() > 0) <END> messages.append(System.lineSeparator()); messages.append(errorMessage); } } return messages.toString(); }</code><technical_language>nit: add braces modified line block follow formatting rules</technical_language>

Target:
private String getPushErrors() { StringBuilder messages = new StringBuilder(); for (URIish uri : result.getURIs()) { String errorMessage = result.getErrorMessage(uri); if (errorMessage != null && errorMessage.length() > 0) { if (messages.length() > 0) { messages.append(System.lineSeparator()); } messages.append(errorMessage); } } return messages.toString(); }
Source:
<code>public void testKeyEncryption() throws InvalidParametersException { String msg = "Test decryption"; String decrptedMsg; decrptedMsg = StringHelper.decrypt(StringHelper.encrypt(msg)); assertEquals(msg, decrptedMsg); try { StringHelper.decrypt("ABC"); signalFailureToDetectException("Decryption of invalid ciphertext should throw"); } catch (InvalidParametersException e) { ignoreExpectedException(); <START> } <END> }</code><technical_language>ExpectedException technique here? <LINK_0></technical_language>

Target:
public void testKeyEncryption() throws InvalidParametersException { String msg = "Test decryption"; String decrptedMsg; decrptedMsg = StringHelper.decrypt(StringHelper.encrypt(msg)); assertEquals(msg, decrptedMsg); }
Source:
<code>public void defaultAuthenticationFailureEventIsPublished() { publisher = new DefaultAuthenticationEventPublisher(); <START> Properties p = new Properties(); <END> p.put(MockAuthenticationException.class.getName(), AuthenticationFailureDisabledEvent.class.getName()); publisher.setAdditionalExceptionMappings(p); publisher.setDefaultAuthenticationFailureEvent(AuthenticationFailureBadCredentialsEvent.class); ApplicationEventPublisher appPublisher = mock(ApplicationEventPublisher.class); publisher.setApplicationEventPublisher(appPublisher); publisher.publishAuthenticationFailure(new AuthenticationException("") { }, mock(Authentication.class)); verify(appPublisher).publishEvent(isA(AuthenticationFailureBadCredentialsEvent.class)); }</code><technical_language>lines necessary set additional exception mappings? thinking lines 149 152 removed</technical_language>

Target:
public void defaultAuthenticationFailureEventIsPublished() { publisher = new DefaultAuthenticationEventPublisher(); publisher.setDefaultAuthenticationFailureEvent(AuthenticationFailureBadCredentialsEvent.class); ApplicationEventPublisher appPublisher = mock(ApplicationEventPublisher.class); publisher.setApplicationEventPublisher(appPublisher); publisher.publishAuthenticationFailure(new AuthenticationException("") { }, mock(Authentication.class)); verify(appPublisher).publishEvent(isA(AuthenticationFailureBadCredentialsEvent.class)); }
Source:
<code>private boolean downloadImages(Process process, URI userHome, URI destinationDirectory) { try { if (this.exportWithImages) { imageDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); fulltextDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); } else if (this.exportFullText) { fulltextDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); } directoryDownload(process, destinationDirectory); return true; } catch (Exception e) { if (exportDmsTask != null) { exportDmsTask.setException(e); } else { <START> logger.error(e.getMessage(), e); <END> Helper.setFehlerMeldung("Export canceled, Process: " + process.getTitle(), e); } return false; } }</code><technical_language>is method (setErrorMessage), takes logger error. in place is setErrorMessage instead of adding additional line logger</technical_language>

Target:
private boolean downloadImages(Process process, URI userHome, URI destinationDirectory) { try { if (this.exportWithImages) { imageDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); fulltextDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); } else if (this.exportFullText) { fulltextDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); } directoryDownload(process, destinationDirectory); return true; } catch (IOException | InterruptedException | RuntimeException e) { if (exportDmsTask != null) { exportDmsTask.setException(e); } else { Helper.setErrorMessage("Export canceled, Process: " + process.getTitle(), logger, e); } return false; } }
Source:
<code><START> public boolean visitSchemaRuleCommand( SchemaRuleCommand command ) throws IOException <END> { closeCountsUpdaterIfOpen(); return false; }</code><technical_language>talk, nice guarding assertion fail in case this assumption brake</technical_language>

Target:
public boolean visitSchemaRuleCommand( SchemaRuleCommand command ) throws IOException { assert !haveUpdates : "Assumed that a schema transaction wouldn't also contain data commands affecting " + "counts store, but was proven wrong with this transaction"; closeCountsUpdaterIfOpen(); return false; }
Source:
<code>public void moveUnpluggedDiskVmUp() { command.getParameters().setParametersList(createMoveDisksParameters()); initDiskImage(diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageId, false); command.updateParameters(); <START> assertTrue(command.getMoveDiskParametersList().size() == 1); <END> }</code><technical_language>assertEquals</technical_language>

Target:
public void moveUnpluggedDiskVmUp() { command.getParameters().setParametersList(createMoveDisksParameters()); initDiskImage(diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageId, false); command.updateParameters(); assertEquals(command.getMoveDiskParametersList().size(), 1); }
Source:
<code>public void impl(@Nonnull CorfuRuntime runtime) throws Exception { <START> runtime.invalidateLayout(); <END> Layout layout = runtime.getLayoutView().getLayout(); if (layout.getUnresponsiveServers().contains(currentNode)) { throw new IllegalStateException("The node is in the unresponsive list."); } LogUnitClient logUnitClient = runtime.getLayoutView().getRuntimeLayout(layout).getLogUnitClient(currentNode); ProtocolBatchProcessor protocolBatchProcessor = ProtocolBatchProcessor .builder() .addressSpaceView(runtime.getAddressSpaceView()) .logUnitClient(logUnitClient) .build(); BasicTransferProcessor basicTransferProcessor = new BasicTransferProcessor(protocolBatchProcessor); CommittedBatchProcessor committedBatchProcessor = CommittedBatchProcessor .builder() .currentNode(currentNode) .runtimeLayout(runtime.getLayoutView().getRuntimeLayout(layout)) .build(); ParallelTransferProcessor parallelTransferProcessor = new ParallelTransferProcessor (committedProcessorNumConsumers, committedBatchProcessor); StateTransferManager transferManager = StateTransferManager .builder() .logUnitClient(logUnitClient) .batchSize(runtime.getParameters().getBulkReadSize()) .basicTransferProcessor(basicTransferProcessor) .parallelTransferProcessor(parallelTransferProcessor) .build(); while (RedundancyCalculator.canRestoreRedundancyOrMergeSegments(layout, currentNode)) { layout = restore(runtime, transferManager); } log.info("State transfer on {}: Restored.", currentNode); }</code><technical_language>This removed, caller invalidateLayout() do retry</technical_language>

Target:
public void impl(@Nonnull CorfuRuntime runtime) throws Exception { Layout layout = runtime.getLayoutView().getLayout(); if (layout.getUnresponsiveServers().contains(currentNode)) { throw new IllegalStateException("The node is in the unresponsive list."); } LogUnitClient logUnitClient = runtime.getLayoutView().getRuntimeLayout(layout).getLogUnitClient(currentNode); ProtocolBatchProcessor protocolBatchProcessor = ProtocolBatchProcessor .builder() .addressSpaceView(runtime.getAddressSpaceView()) .logUnitClient(logUnitClient) .build(); BasicTransferProcessor basicTransferProcessor = new BasicTransferProcessor(protocolBatchProcessor); CommittedBatchProcessor committedBatchProcessor = CommittedBatchProcessor .builder() .currentNode(currentNode) .runtimeLayout(runtime.getLayoutView().getRuntimeLayout(layout)) .build(); ParallelTransferProcessor parallelTransferProcessor = new ParallelTransferProcessor(committedBatchProcessor); StateTransferManager transferManager = StateTransferManager .builder() .logUnitClient(logUnitClient) .batchSize(runtime.getParameters().getBulkReadSize()) .basicTransferProcessor(basicTransferProcessor) .parallelTransferProcessor(parallelTransferProcessor) .build(); while (RedundancyCalculator.canRestoreRedundancyOrMergeSegments(layout, currentNode)) { layout = restore(runtime, transferManager); } log.info("State transfer on {}: Restored.", currentNode); }
Source:
<code>public void setUp() throws Exception { TheFlintstones d = docker.get(); ActiveDirectoryDomain activeDirectoryDomain = new ActiveDirectoryDomain(AD_DOMAIN, d.ipBound(3268)+ ":" + d.port(3268) , null, AD_MANAGER_DN, AD_MANAGER_DN_PASSWORD); List<ActiveDirectoryDomain> domains = new ArrayList<ActiveDirectoryDomain>(1); domains.add(activeDirectoryDomain); ActiveDirectorySecurityRealm activeDirectorySecurityRealm = new ActiveDirectorySecurityRealm(null, domains, null, null, null, null, GroupLookupStrategy.RECURSIVE, false, true, null, false, null, null); j.getInstance().setSecurityRealm(activeDirectorySecurityRealm); while(!FileUtils.readFileToString(d.getLogfile()).contains("custom (exit status 0; expected)")) { Thread.sleep(1000); } UserDetails userDetails = null; int i = 0; while (i < MAX_RETRIES && userDetails == null) { try { userDetails = j.jenkins.getSecurityRealm().loadUserByUsername("Fred"); } catch (AuthenticationServiceException e) { Thread.sleep(1000); } i ++; } DOCKER_IP = d.ipBound(3268); <START> DOCKER_PORT = d.port(3268); <END> }</code><technical_language>move lines top of method variables in ActiveDirectoryDomain constructor</technical_language>

Target:
public void setUp() throws Exception { TheFlintstones d = docker.get(); dockerIp = d.ipBound(3268); dockerPort = d.port(3268); ActiveDirectoryDomain activeDirectoryDomain = new ActiveDirectoryDomain(AD_DOMAIN, dockerIp + ":" + dockerPort , null, AD_MANAGER_DN, AD_MANAGER_DN_PASSWORD); List<ActiveDirectoryDomain> domains = new ArrayList<ActiveDirectoryDomain>(1); domains.add(activeDirectoryDomain); ActiveDirectorySecurityRealm activeDirectorySecurityRealm = new ActiveDirectorySecurityRealm(null, domains, null, null, null, null, GroupLookupStrategy.RECURSIVE, false, true, null, false, null, null); j.getInstance().setSecurityRealm(activeDirectorySecurityRealm); while(!FileUtils.readFileToString(d.getLogfile()).contains("custom (exit status 0; expected)")) { Thread.sleep(1000); } UserDetails userDetails = null; int i = 0; while (i < MAX_RETRIES && userDetails == null) { try { userDetails = j.jenkins.getSecurityRealm().loadUserByUsername("Fred"); } catch (AuthenticationServiceException e) { Thread.sleep(1000); } i ++; } }
Source:
<code>private void requestReadMoreItems(final LayoutInflater layoutInflater, final HistoryEntry entry) { if (entry == null || TextUtils.isEmpty(entry.getTitle().getPrefixedText())) { hideReadMore(); layoutContent(); return; } final long timeMillis = System.currentTimeMillis(); new FullTextSearchClient().request(entry.getTitle().getWikiSite(), entry.getTitle().getPrefixedText(), null, null, Constants.MAX_SUGGESTION_RESULTS * 2, new FullTextSearchClient.Callback() { @Override public void success(@NonNull Call<MwQueryResponse<MwQueryResponse.Pages>> call, @NonNull SearchResults results) { Collections.sort(results.getResults(), new Comparator<SearchResult>() { @Override public int compare(SearchResult result, SearchResult t1) { int ret = ((Integer)result.getPageTitle().getIndex()).compareTo(t1.getPageTitle().getIndex()); return ret; } }); <START> funnel.setLatency(System.currentTimeMillis() <END> - timeMillis); readMoreItems = SearchResults.filter(new SearchResults(results.getResults(), results.getContinuation(), null), entry.getTitle().getPrefixedText(), true); if (!readMoreItems.getResults().isEmpty()) { setUpReadMoreSection(layoutInflater, readMoreItems); showReadMore(); } else { hideReadMore(); } layoutContent(); } @Override public void failure(@NonNull Call<MwQueryResponse<MwQueryResponse.Pages>> call, @NonNull Throwable caught) { Log.w(TAG, "Error while fetching Read More titles.", caught); layoutContent(); } } ); }</code><technical_language>move funnel.setLatency call beginning of success() callback. <LINK_0> this is strictly measure network latency, want pollute time spent sorting results</technical_language>

Target:
private void requestReadMoreItems(final LayoutInflater layoutInflater, final HistoryEntry entry) { if (entry == null || TextUtils.isEmpty(entry.getTitle().getPrefixedText())) { hideReadMore(); layoutContent(); return; } final long timeMillis = System.currentTimeMillis(); new FullTextSearchClient().request(entry.getTitle().getWikiSite(), entry.getTitle().getPrefixedText(), null, null, Constants.MAX_SUGGESTION_RESULTS * 2, new FullTextSearchClient.Callback() { @Override public void success(@NonNull Call<MwQueryResponse<MwQueryResponse.Pages>> call, @NonNull SearchResults results) { funnel.setLatency(System.currentTimeMillis() - timeMillis); Collections.sort(results.getResults(), new Comparator<SearchResult>() { @Override public int compare(SearchResult result, SearchResult t1) { int ret = ((Integer)result.getPageTitle().getIndex()).compareTo(t1.getPageTitle().getIndex()); return ret; } }); readMoreItems = SearchResults.filter(new SearchResults(results.getResults(), results.getContinuation(), null), entry.getTitle().getPrefixedText(), true); if (!readMoreItems.getResults().isEmpty()) { setUpReadMoreSection(layoutInflater, readMoreItems); showReadMore(); } else { hideReadMore(); } layoutContent(); } @Override public void failure(@NonNull Call<MwQueryResponse<MwQueryResponse.Pages>> call, @NonNull Throwable caught) { Log.w(TAG, "Error while fetching Read More titles.", caught); layoutContent(); } } ); }
Source:
<code>private void checkComments(DetailAST token) { if (!allowMultipleEmptyLines) { if (Arrays.asList(TokenTypes.PACKAGE_DEF, TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT, <START> TokenTypes.STATIC_INIT) <END> .contains(token.getType())) { DetailAST previousNode = token.getPreviousSibling(); while (isCommentInBeginningOfLine(previousNode)) { if (hasEmptyLineBefore(previousNode) && isPrePreviousLineEmpty(previousNode)) { log(previousNode.getLineNo(), MSG_MULTIPLE_LINES, previousNode.getText()); } previousNode = previousNode.getPreviousSibling(); } } else { checkCommentsInsideToken(token); } } }</code><technical_language>Please move this static array a field constantly recreating for AST</technical_language>

Target:
private void checkComments(DetailAST token) { if (!allowMultipleEmptyLines) { if (TOKEN_TYPES_WITHOUT_COMMENTS_TO_CHECK_INSIDE.contains(token.getType())) { DetailAST previousNode = token.getPreviousSibling(); while (isCommentInBeginningOfLine(previousNode)) { if (hasEmptyLineBefore(previousNode) && isPrePreviousLineEmpty(previousNode)) { log(previousNode, MSG_MULTIPLE_LINES, previousNode.getText()); } previousNode = previousNode.getPreviousSibling(); } } else { checkCommentsInsideToken(token); } } }