auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setUp() { downloadBatches = new HashMap<>(); downloadBatches.put(DOWNLOAD_BATCH_ID, downloadBatch); downloadBatches.put(ADDITIONAL_DOWNLOAD_BATCH_ID, additionalDownloadBatch); downloadBatchCallbacks.add(downloadBatchCallback); downloadManager = new DownloadManager( lock, executorService, downloadBatches, downloadBatchCallbacks, fileOperations, downloadsBatchPersistence, downloadManagerDownloader ); final ArgumentCaptor<DownloadsBatchPersistence.LoadBatchesCallback> loadBatchesCallbackCaptor = ArgumentCaptor.forClass(DownloadsBatchPersistence.LoadBatchesCallback.class); <START> willAnswer(new Answer<Void>() { <END> @Override public Void answer(InvocationOnMock invocation) throws Throwable { loadBatchesCallbackCaptor.getValue().onLoaded(Arrays.asList(downloadBatch, additionalDownloadBatch)); return null; } }).given(downloadsBatchPersistence).loadAsync(any(FileOperations.class), loadBatchesCallbackCaptor.capture()); final ArgumentCaptor<List> argumentCaptor = ArgumentCaptor.forClass(List.class); willAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { downloadBatchStatuses = argumentCaptor.getValue(); return null; } }).given(allBatchStatusesCallback).onReceived(argumentCaptor.capture()); given(downloadBatch.status()).willReturn(BATCH_STATUS); given(additionalDownloadBatch.status()).willReturn(ADDITIONAL_BATCH_STATUS); }</code><technical_language>extract this a method clearer doing. lines: captureLoadBatchesCallbackInto(loadBatchesCallbackCaptor) Open naming choices</technical_language>

Target:
public void setUp() { downloadBatches = new HashMap<>(); downloadBatches.put(DOWNLOAD_BATCH_ID, downloadBatch); downloadBatches.put(ADDITIONAL_DOWNLOAD_BATCH_ID, additionalDownloadBatch); downloadBatchCallbacks.add(downloadBatchCallback); downloadManager = new DownloadManager( lock, executorService, downloadBatches, downloadBatchCallbacks, fileOperations, downloadsBatchPersistence, downloadManagerDownloader ); setupDownloadBatchesResponse(); setupDownloadBatchStatusesResponse(); given(downloadBatch.status()).willReturn(BATCH_STATUS); given(additionalDownloadBatch.status()).willReturn(ADDITIONAL_BATCH_STATUS); }
Source:
<code>public void setup() { ATTRIBUTE_DESCRIPTOR_LIST.clear(); <START> metacardList.clear(); <END> buildMetacardDataMap(); buildMetacardList(); }</code><technical_language>buildMetacardList() lines clears metacardList; this call is necessary</technical_language>

Target:
public void setup() { ATTRIBUTE_DESCRIPTOR_LIST.clear(); buildMetacardDataMap(); buildMetacardList(); }
Source:
<code>public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); FeedbackSession response = <START> new FeedbackSession(feedbackSession); <END> switch (intent) { case STUDENT_SUBMISSION: case INSTRUCTOR_SUBMISSION: response.setGracePeriod(null); response.setSessionVisibleSetting(null); response.setCustomSessionVisibleTimestamp(null); response.setResponseVisibleSetting(null); response.setCustomResponseVisibleTimestamp(null); response.setPublishStatus(null); response.setClosingEmailEnabled(null); response.setPublishedEmailEnabled(null); break; case FULL_DETAIL: break; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } return new JsonResult(response); }</code><technical_language>Similarly here; line</technical_language>

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); FeedbackSessionData response = new FeedbackSessionData(feedbackSession); switch (intent) { case STUDENT_SUBMISSION: case INSTRUCTOR_SUBMISSION: response.setGracePeriod(null); response.setSessionVisibleSetting(null); response.setCustomSessionVisibleTimestamp(null); response.setResponseVisibleSetting(null); response.setCustomResponseVisibleTimestamp(null); response.setPublishStatus(null); response.setClosingEmailEnabled(null); response.setPublishedEmailEnabled(null); break; case FULL_DETAIL: break; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } return new JsonResult(response); }
Source:
<code>public void createControl(Composite parent) { final ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL); scrolledComposite.setFont(parent.getFont()); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); initializeDialogUnits(parent); final Composite composite = new Composite(scrolledComposite, SWT.NULL); composite.setFont(parent.getFont()); scrolledComposite.setContent(composite); composite.setLayout(new GridLayout()); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); createToggleTestProject(composite); createTestProjectGroup(composite); createLocationGroup(composite); createTestTargetGroup(composite); createTargetGroup(composite); createPropertiesGroup(composite); enableLocationWidgets(); scrolledComposite.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { Rectangle r = scrolledComposite.getClientArea(); scrolledComposite.setMinSize(composite.computeSize(r.width, SWT.DEFAULT)); } }); setErrorMessage(null); setMessage(null); setControl(scrolledComposite); <START> Control workingSetControl = mWorkingSetGroup.createControl(composite);; <END> workingSetControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); validatePageComplete(); }</code><technical_language>typo: ; ;</technical_language>

Target:
public void createControl(Composite parent) { final ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL); scrolledComposite.setFont(parent.getFont()); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); initializeDialogUnits(parent); final Composite composite = new Composite(scrolledComposite, SWT.NULL); composite.setFont(parent.getFont()); scrolledComposite.setContent(composite); composite.setLayout(new GridLayout()); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); createToggleTestProject(composite); createTestProjectGroup(composite); createLocationGroup(composite); createTestTargetGroup(composite); createTargetGroup(composite); createPropertiesGroup(composite); enableLocationWidgets(); scrolledComposite.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { Rectangle r = scrolledComposite.getClientArea(); scrolledComposite.setMinSize(composite.computeSize(r.width, SWT.DEFAULT)); } }); setErrorMessage(null); setMessage(null); setControl(scrolledComposite); Control workingSetControl = mWorkingSetGroup.createControl(composite); workingSetControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); validatePageComplete(); }
Source:
<code>private Object convertObject(String fieldName, Map<String, Object> object) { String className = (String)object.get(fieldName); if (className == null) return null; JSON.Convertible convertible = toConvertible(className); if (convertible != null) { convertible.fromJSON(object); return convertible; } <START> JSON.Convertor convertor = factory.convertors.get(className); <END> if (convertor != null) return convertor.fromJSON(object); return null; }</code><technical_language>This NPE if convertor registered</technical_language>

Target:
private Object convertObject(String fieldName, Map<String, Object> object) { String className = (String)object.get(fieldName); if (className == null) return null; Convertible convertible = toConvertible(className); if (convertible != null) { convertible.fromJSON(object); return convertible; } Convertor convertor = factory.getConvertor(className); if (convertor != null) return convertor.fromJSON(object); return null; }
Source:
<code>public BlockPos getNearestStructurePos(World worldIn, String structureName, BlockPos position, boolean p_180513_4_) { <START> if (this.baseGenerator instanceof SpongeGenerationPopulator) { <END> return ((SpongeGenerationPopulator) this.baseGenerator).getHandle(this.world).getNearestStructurePos(worldIn, structureName, position, p_180513_4_); } Class<? extends MapGenStructure> target = null; if("Stronghold".equals(structureName)) { target = MapGenStronghold.class; } else if("Mansion".equals(structureName)) { target = WoodlandMansion.class; } else if("Monument".equals(structureName)) { target = StructureOceanMonument.class; } else if("Village".equals(structureName)) { target = MapGenVillage.class; } else if("Mineshaft".equals(structureName)) { target = MapGenMineshaft.class; } else if("Temple".equals(structureName)) { target = MapGenScatteredFeature.class; } else if ("Fortress".equals(structureName)) { target = MapGenNetherBridge.class; } else if ("EndCity".equals(structureName)) { target = MapGenEndCity.class; } if (target == null) { return null; } for (GenerationPopulator gen : this.genpop) { if (target.isInstance(gen)) { return ((MapGenStructure) gen).getNearestStructurePos(worldIn, position, p_180513_4_); } } return null; }</code><technical_language>I purpose of changing ordering here. prevents sponge plugins modifying behaviour of modded worlds checking for modded overrime. this change behaviour in absence of a world generation plugin if wrapping a modded world generation populator list empty</technical_language>

Target:
public BlockPos getNearestStructurePos(World worldIn, String structureName, BlockPos position, boolean p_180513_4_) { Class<? extends MapGenStructure> target = null; if("Stronghold".equals(structureName)) { target = MapGenStronghold.class; } else if("Mansion".equals(structureName)) { target = WoodlandMansion.class; } else if("Monument".equals(structureName)) { target = StructureOceanMonument.class; } else if("Village".equals(structureName)) { target = MapGenVillage.class; } else if("Mineshaft".equals(structureName)) { target = MapGenMineshaft.class; } else if("Temple".equals(structureName)) { target = MapGenScatteredFeature.class; } else if ("Fortress".equals(structureName)) { target = MapGenNetherBridge.class; } else if ("EndCity".equals(structureName)) { target = MapGenEndCity.class; } if (target != null) { for (GenerationPopulator gen : this.genpop) { if (target.isInstance(gen)) { return ((MapGenStructure) gen).getNearestStructurePos(worldIn, position, p_180513_4_); } } } if (this.baseGenerator instanceof SpongeGenerationPopulator) { return ((SpongeGenerationPopulator) this.baseGenerator).getHandle(this.world).getNearestStructurePos(worldIn, structureName, position, p_180513_4_); } return null; }
Source:
<code><START> private String namespace() { <END> return Stream.of(config().namespace(), config().timelock().flatMap(TimeLockClientConfig::client), config().keyValueService().namespace()) .filter(Optional::isPresent) .map(Optional::get) .findFirst() .orElse("UNKNOWN"); }</code><technical_language>nit: this Value.Derived, and/or service name a Suppliers.memoize(() -> namespace())? worried a bunch of unnecessary stream reads time namespace</technical_language>

Target:
String namespace() { return Stream.of(config().namespace(), config().timelock().flatMap(TimeLockClientConfig::client), config().keyValueService().namespace()) .filter(Optional::isPresent) .map(Optional::get) .findFirst() .orElse("UNKNOWN"); }
Source:
<code>public void setSchedulingPolicy(SchedulingPolicy policy) { synchronized (root) { if (policy == schedulingPolicy) { return; <START> } <END> if (parent.isPresent() && parent.get().schedulingPolicy == QUERY_PRIORITY) { checkArgument(policy == QUERY_PRIORITY, "Parent of %s uses query priority scheduling, so %s must also", id, id); } schedulingPolicy = policy; if (policy == QUERY_PRIORITY) { for (InternalResourceGroup group : subGroups.values()) { group.setSchedulingPolicy(QUERY_PRIORITY); } } getAndRepopulateSubGroups(); getAndRepopulateQueuedQueries(); } }</code><technical_language>this refactor code accepted? Please revert, put in a separate commit if want</technical_language>

Target:
public void setSchedulingPolicy(SchedulingPolicy policy) { synchronized (root) { if (policy == schedulingPolicy) { return; } if (parent.isPresent() && parent.get().schedulingPolicy == QUERY_PRIORITY) { checkArgument(policy == QUERY_PRIORITY, "Parent of %s uses query priority scheduling, so %s must also", id, id); } UpdateablePriorityQueue<InternalResourceGroup> queue; UpdateablePriorityQueue<QueryExecution> queryQueue; switch (policy) { case FAIR: queue = new FifoQueue<>(); queryQueue = new FifoQueue<>(); break; case WEIGHTED: queue = new StochasticPriorityQueue<>(); queryQueue = new StochasticPriorityQueue<>(); break; case QUERY_PRIORITY: for (InternalResourceGroup group : subGroups.values()) { group.setSchedulingPolicy(QUERY_PRIORITY); } queue = new IndexedPriorityQueue<>(); queryQueue = new IndexedPriorityQueue<>(); break; default: throw new UnsupportedOperationException("Unsupported scheduling policy: " + policy); } while (!eligibleSubGroups.isEmpty()) { InternalResourceGroup group = eligibleSubGroups.poll(); queue.addOrUpdate(group, getSubGroupSchedulingPriority(policy, group)); } eligibleSubGroups = queue; while (!queuedQueries.isEmpty()) { QueryExecution query = queuedQueries.poll(); queryQueue.addOrUpdate(query, getQueryPriority(query.getSession())); } queuedQueries = queryQueue; schedulingPolicy = policy; } }
Source:
<code>public DefaultSurfaceMetadataBuilder xValueType(ValueType xValueType) { ArgChecker.notNull(xValueType, "xValueType"); <START> this.xValueType = xValueType; <END> return this; }</code><technical_language>2 lines combined this.xValueType = ArgChecker.notNull(xValueType, "xValueType"); pattern elsewhere</technical_language>

Target:
public DefaultSurfaceMetadataBuilder xValueType(ValueType xValueType) { this.xValueType = ArgChecker.notNull(xValueType, "xValueType"); return this; }
Source:
<code>@NonNull List<PageTitle> langLinks() { <START> ArrayList<PageTitle> <END> result = new ArrayList<>(); if (pages == null) { return result; } Iterator<Map.Entry<String, MwApiResponsePage>> i = pages.entrySet().iterator(); MwApiResponsePage page = i.next().getValue(); if (page.langLinks() == null) { return result; } for (MwApiResponsePage.LangLink langLink : page.langLinks()) { result.add(new PageTitle(langLink.localizedTitle(), WikiSite.forLanguageCode(langLink.lang()))); } return result; }</code><technical_language>reason hold a List instead</technical_language>

Target:
@NonNull List<PageTitle> langLinks() { List<PageTitle> result = new ArrayList<>(); if (pages == null) { return result; } Iterator<Map.Entry<String, MwApiResponsePage>> i = pages.entrySet().iterator(); MwApiResponsePage page = i.next().getValue(); if (page.langLinks() == null) { return result; } for (MwApiResponsePage.LangLink langLink : page.langLinks()) { result.add(new PageTitle(langLink.localizedTitle(), WikiSite.forLanguageCode(langLink.lang()))); } return result; }
Source:
<code>private FunctionCheckedException<Cassandra.Client, Object, RuntimeException> noOp() { return new FunctionCheckedException<Cassandra.Client, Object, RuntimeException>() { @Override public Object apply(Cassandra.Client input) throws RuntimeException { <START> return null; <END> } @Override public String toString() { return "no-op"; } }; }</code><technical_language>nit: this return Void: private FunctionCheckedException<Cassandra.Client, Void, RuntimeException> noOp() { return new FunctionCheckedException<Cassandra.Client, Void, RuntimeException>() { @Override public Void apply(Cassandra.Client input) throws RuntimeException { return null; } @Override public String toString() { return "no-op"; } }; }</technical_language>

Target:
private FunctionCheckedException<Cassandra.Client, Void, RuntimeException> noOp() { return new FunctionCheckedException<Cassandra.Client, Void, RuntimeException>() { @Override public Void apply(Cassandra.Client input) throws RuntimeException { return null; } @Override public String toString() { return "no-op"; } }; }
Source:
<code>void empty_tag_predicate_matches_pickle_with_any_tags() { Pickle pickle = createPickleWithTags("@FOO"); <START> TagPredicate predicate = new TagPredicate(TagExpressionParser.parse("")); <END> assertTrue(predicate.test(pickle)); }</code><technical_language>good extract a helper method takes a vararg of strings returns a lsit of tag expressions. Avoids some repetition</technical_language>

Target:
void empty_tag_predicate_matches_pickle_with_any_tags() { Pickle pickle = createPickleWithTags("@FOO"); TagPredicate predicate = createPredicate(""); assertTrue(predicate.test(pickle)); }
Source:
<code>private void addMethod( JavaClassSource javaClassSource, org.kie.workbench.common.services.datamodeller.core.Method method, ClassTypeResolver classTypeResolver ) throws ClassNotFoundException { MethodSource<JavaClassSource> methodSource = javaClassSource.addMethod(); methodSource.setName( method.getName() ); methodSource.setReturnType( buildMethodReturnTypeString( method.getReturnType(), classTypeResolver ) ); methodSource.setParameters( buildMethodParameterString( method.getParameters(), classTypeResolver ) ); methodSource.setBody( method.getBody() ); <START> methodSource.setVisibility( org.jboss.forge.roaster.model.Visibility.PUBLIC ); <END> for ( Annotation annotation : method.getAnnotations() ) { addAnnotation( methodSource, annotation ); } }</code><technical_language>Method implement HasVisibility</technical_language>

Target:
private void addMethod( JavaClassSource javaClassSource, org.kie.workbench.common.services.datamodeller.core.Method method, ClassTypeResolver classTypeResolver ) throws ClassNotFoundException { MethodSource<JavaClassSource> methodSource = javaClassSource.addMethod(); methodSource.setName( method.getName() ); methodSource.setReturnType( buildMethodReturnTypeString( method.getReturnType(), classTypeResolver ) ); methodSource.setParameters( buildMethodParameterString( method.getParameters(), classTypeResolver ) ); methodSource.setBody( method.getBody() ); methodSource.setVisibility( buildVisibility( method.getVisibilty() ) ); for ( Annotation annotation : method.getAnnotations() ) { addAnnotation( methodSource, annotation ); } }
Source:
<code>protected CommandStatus executeTransfer(final String destination) { transferStatus = command.execute(); boolean check = false; try { check = exists(destination); } catch (IOException e) { <START> e.printStackTrace(); <END> } if (check) return CommandStatus.SUCCESS; else return CommandStatus.FAILED; }</code><technical_language>If action is here, exception passed caller</technical_language>

Target:
protected CommandStatus executeTransfer(final String destination) throws IOException { transferStatus = command.get().execute(); if (!exists(destination)) return CommandStatus.FAILED; logger.info("File transfer successful!"); return CommandStatus.SUCCESS; }
Source:
<code>public static boolean isNonCoveringIndex(Optimizable innerTable) { try { AccessPath path = innerTable.getCurrentAccessPath(); if (path != null) { ConglomerateDescriptor cd = path.getConglomerateDescriptor(); if (cd != null && cd.isIndex() && !innerTable.isCoveringIndex(cd)) { <START> return true; <END> } } } catch (Exception e) { throw new IllegalStateException("could not determine if index is covering", e); } return false; }</code><technical_language>Combine if return if is true is return value</technical_language>

Target:
public static boolean isNonCoveringIndex(Optimizable innerTable) { try { AccessPath path = innerTable.getCurrentAccessPath(); if (path != null) { ConglomerateDescriptor cd = path.getConglomerateDescriptor(); return (cd != null && cd.isIndex() && !innerTable.isCoveringIndex(cd)); } } catch (Exception e) { throw new IllegalStateException("could not determine if index is covering", e); } return false; }
Source:
<code>public Map<String, Integer> maxLengths() throws IOException { <START> return DbUtils.getColumnSizes(interfaceTemplate, "Pool"); <END> }</code><technical_language>guessing merge/rebase error. RequestManager method correct source for this. Controllers require database knowledge (jdbc/table names)</technical_language>

Target:
public Map<String, Integer> maxLengths() throws IOException { return requestManager.getPoolColumnSizes(); }
Source:
<code>public static Set<String> getReductionKeys(final OnmsApplication application) { Objects.requireNonNull(application); Set<String> reductionKeys = new HashSet<>(); <START> for(OnmsMonitoredService monitoredService : application.getMonitoredServices()) { <END> reductionKeys.add(getNodeLostServiceReductionKey(monitoredService)); reductionKeys.add(getInterfaceDownReductionKey(monitoredService)); reductionKeys.add(getNodeDownReductionKey(monitoredService)); } return reductionKeys; }</code><technical_language>duplicate next 3 lines of code? getReductionKeys(OnmsMonitoredService) method instead</technical_language>

Target:
public static Set<String> getReductionKeys(final OnmsApplication application) { Objects.requireNonNull(application); Set<String> reductionKeys = new HashSet<>(); for (OnmsMonitoredService monitoredService : application.getMonitoredServices()) { reductionKeys.addAll(getReductionKeys(monitoredService)); } return reductionKeys; }
Source:
<code>public void receiveHeader(PacketLineIn pckIn, boolean stateless) throws IOException { try { String version = parseNextLine(pckIn, VERSION); if (!version.equals("0.1")) { throw new IOException(MessageFormat.format( JGitText.get().errorInvalidPushCert, "version not supported")); } pusher = parseNextLine(pckIn, PUSHER); pushee = parseNextLine(pckIn, PUSHEE); receivedNonce = parseNextLine(pckIn, NONCE); if (pckIn.readString() != "") { throw new IOException(MessageFormat.format( JGitText.get().errorInvalidPushCert, "expected empty line after header")); } } catch (EOFException eof) { throw new IOException(MessageFormat.format( JGitText.get().errorInvalidPushCert, "broken push certificate <START> Header")); <END> } nonceStatus = nonceGenerator.verify(receivedNonce, sentNonce, seed, db, stateless, nonceSlopLimit); }</code><technical_language>nit: lowercase header</technical_language>

Target:
public void receiveHeader(PacketLineIn pckIn, boolean stateless) throws IOException { try { String version = parseNextLine(pckIn, VERSION); if (!version.equals("0.1")) { throw new IOException(MessageFormat.format( JGitText.get().errorInvalidPushCert, "version not supported")); } pusher = parseNextLine(pckIn, PUSHER); pushee = parseNextLine(pckIn, PUSHEE); receivedNonce = parseNextLine(pckIn, NONCE); if (pckIn.readString() != "") { throw new IOException(MessageFormat.format( JGitText.get().errorInvalidPushCert, "expected empty line after header")); } } catch (EOFException eof) { throw new IOException(MessageFormat.format( JGitText.get().errorInvalidPushCert, "broken push certificate header")); } nonceStatus = nonceGenerator.verify(receivedNonce, sentNonce, db, stateless, nonceSlopLimit); }
Source:
<code>void read(Tokeniser t, CharacterReader r) { char c = r.consume(); switch (c) { case '\t': case '\n': case '\r': case '\f': case ' ': break; case '/': t.transition(SelfClosingStartTag); break; case '<': r.unconsume(); <START> t.error(this); <END> case '>': t.emitTagPending(); t.transition(Data); break; case nullChar: t.error(this); t.tagPending.newAttribute(); r.unconsume(); t.transition(AttributeName); break; case eof: t.eofError(this); t.transition(Data); break; case '"': case '\'': case '=': t.error(this); t.tagPending.newAttribute(); t.tagPending.appendAttributeName(c); t.transition(AttributeName); break; default: t.tagPending.newAttribute(); r.unconsume(); t.transition(AttributeName); } }</code><technical_language>this changed in nullChar case 6 lines this line</technical_language>

Target:
void read(Tokeniser t, CharacterReader r) { switch (r.current()) { case '&': t.advanceTransition(CharacterReferenceInData); break; case '<': t.advanceTransition(TagOpen); break; case nullChar: t.error(this); t.emit(r.consume()); break; case eof: t.emit(new Token.EOF()); break; default: String data = r.consumeData(); t.emit(data); break; } }
Source:
<code>public void transitionsWithNoTrigger(Transition trans) { if (trans.getSource() instanceof Entry || trans.getSource() instanceof Choice || trans.getSource() instanceof Synchronization || (trans.getTarget() instanceof Synchronization && (trans.getTarget().getIncomingTransitions().size() > 1))) { return; } if (trans.getSource() instanceof org.yakindu.sct.model.sgraph.State) { org.yakindu.sct.model.sgraph.State state = (org.yakindu.sct.model.sgraph.State) trans.getSource(); if (!state.isComposite()) { <START> return; <END> } for (Region r : state.getRegions()) { for (Vertex v : r.getVertices()) { if (v instanceof Exit) { return; } } } } if (!STextValidationModelUtils.getExitPointSpecs(trans.getProperties()).isEmpty()) { return; } if (trans.getTrigger() == null) { warning(ISSUE_TRANSITION_WITHOUT_TRIGGER, trans, null, -1); } }</code><technical_language>..why</technical_language>

Target:
public void transitionsWithNoTrigger(Transition trans) { if (trans.getSource() instanceof Entry || trans.getSource() instanceof Choice || trans.getSource() instanceof Synchronization || (trans.getTarget() instanceof Synchronization && (trans.getTarget().getIncomingTransitions().size() > 1))) { return; } if (trans.getSource() instanceof org.yakindu.sct.model.sgraph.State) { org.yakindu.sct.model.sgraph.State state = (org.yakindu.sct.model.sgraph.State) trans.getSource(); if (state.isComposite()) { for (Region r : state.getRegions()) { for (Vertex v : r.getVertices()) { if (v instanceof Exit) { return; } } } } } if (!STextValidationModelUtils.getExitPointSpecs(trans.getProperties()).isEmpty()) { return; } if (trans.getTrigger() == null) { warning(ISSUE_TRANSITION_WITHOUT_TRIGGER, trans, null, -1); } }
Source:
<code>private static void insertConcurrent(CqlSession session) throws InterruptedException, ExecutionException { PreparedStatement pst = session.prepare( insertInto("examples", "tbl_sample_kv") .value("id", bindMarker("id")) .value("value", bindMarker("value")) .build()); List<CompletableFuture<?>> pending = new ArrayList<>(); <START> <END> for (int i = 0; i < TOTAL_NUMBER_OF_INSERTS; i++) { pending.add( session .executeAsync( pst.bind() .set("id", UUID.randomUUID(), UUID.class) .set("value", String.format("Value for: %s", i), String.class)) .toCompletableFuture()); } CompletableFuture.allOf(pending.toArray(new CompletableFuture[0])).get(); System.out.println( String.format( "Finished executing %s queries with a concurrency level of 32.", pending.size())); }</code><technical_language>Nit: line wrapping is ideal</technical_language>

Target:
private static void insertConcurrent(CqlSession session) throws InterruptedException, ExecutionException { PreparedStatement pst = session.prepare( insertInto("examples", "tbl_sample_kv") .value("id", bindMarker("id")) .value("value", bindMarker("value")) .build()); List<CompletableFuture<?>> pending = new ArrayList<>(); for (int i = 0; i < TOTAL_NUMBER_OF_INSERTS; i++) { pending.add( session .executeAsync(pst.bind().setUuid("id", UUID.randomUUID()).setInt("value", i)) .toCompletableFuture()); } CompletableFuture.allOf(pending.toArray(new CompletableFuture[0])).get(); System.out.println( String.format( "Finished executing %s queries with a concurrency level of %s.", pending.size(), session .getContext() .getConfig() .getDefaultProfile() .getInt(DefaultDriverOption.REQUEST_THROTTLER_MAX_CONCURRENT_REQUESTS))); }
Source:
<code>public LinkDomainToLdapResponse linkDomainToLdap(Long domainId, String type, String name, short accountType) { <START> Validate.notNull(type, "type cannot be null. It should either be GROUP or OU"); <END> Validate.notNull(domainId, "domainId cannot be null."); Validate.notEmpty(name, "GROUP or OU name cannot be empty"); Validate.isTrue(accountType>=0 && accountType<=5, "accountype should be a number from 0-5"); LinkType linkType = LdapManager.LinkType.valueOf(type.toUpperCase()); LdapTrustMapVO vo = _ldapTrustMapDao.persist(new LdapTrustMapVO(domainId, linkType, name, accountType)); LinkDomainToLdapResponse response = new LinkDomainToLdapResponse(vo.getDomainId(), vo.getType().toString(), vo.getName(), vo.getAccountType()); return response; }</code><technical_language>if type is empty other "GROUP" "OU"</technical_language>

Target:
public LinkDomainToLdapResponse linkDomainToLdap(Long domainId, String type, String name, short accountType) { Validate.notNull(type, "type cannot be null. It should either be GROUP or OU"); Validate.notNull(domainId, "domainId cannot be null."); Validate.notEmpty(name, "GROUP or OU name cannot be empty"); Validate.isTrue(accountType==0 || accountType==2, "accountype should be either 0(normal user) or 2(domain admin)"); LinkType linkType = LdapManager.LinkType.valueOf(type.toUpperCase()); LdapTrustMapVO vo = _ldapTrustMapDao.persist(new LdapTrustMapVO(domainId, linkType, name, accountType)); LinkDomainToLdapResponse response = new LinkDomainToLdapResponse(vo.getDomainId(), vo.getType().toString(), vo.getName(), vo.getAccountType()); return response; }
Source:
<code>DataBuffer readChunk() throws IOException; <START> DataBuffer readChunkNoWait() throws IOException; <END> long pos(); interface Factory extends Closeable { DataReader create(long offset, long len) throws IOException; boolean isShortCircuit(); }</code><technical_language>suggestion @Nullable DataBuffer readChunkNoWait() throws IOException;</technical_language>

Target:
DataBuffer readChunk() throws IOException; @Nullable DataBuffer readChunkIfReady() throws IOException; long pos(); interface Factory extends Closeable { DataReader create(long offset, long len) throws IOException; boolean isShortCircuit(); }
Source:
<code>private static void runListener(Runnable listener) { requireNonNull(listener, "listener is null"); try { listener.run(); } catch (RuntimeException e) { <START> log.error("Exception while running the listener: " + e.getMessage()); <END> } }</code><technical_language>This fail query internal error</technical_language>

Target:
private static void runListener(Runnable listener) { requireNonNull(listener, "listener is null"); try { listener.run(); } catch (RuntimeException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Exception while running the listener", e); } }
Source:
<code>public void report(IssueType type, String code, String... args) { String message; try { message = this.resources.getString(code); message = message == null ? code : message; message = MessageFormat.format(message, args); } catch (MissingResourceException ex) { logger.error("Can't find resource for " + code + " defaulting to code"); message = code; } <START> if (type == IssueType.ERROR || type == IssueType.VALIDATION) <END> logger.error(message); if (type == IssueType.PROBLEM) logger.warn(message); if (type == IssueType.COLLISION) logger.info(message); if (type == IssueType.NOTE || type == IssueType.COUNT) logger.debug(message); Document doc = new Document(); doc.add(new StringField("type", ALATerm.TaxonomicIssue.qualifiedName(), Field.Store.YES)); doc.add(new StringField("id", UUID.randomUUID().toString(), Field.Store.YES)); doc.add(new StringField(this.fieldName(DcTerm.type), type.name(), Field.Store.YES)); doc.add(new StringField(this.fieldName(DcTerm.subject), code, Field.Store.YES)); doc.add(new StringField(this.fieldName(DcTerm.description), message, Field.Store.YES)); doc.add(new StringField(this.fieldName(DcTerm.date), ISO8601.format(new Date()), Field.Store.YES)); try { synchronized (this) { this.indexWriter.addDocument(doc); this.indexWriter.commit(); this.searcherManager.maybeRefresh(); } } catch (IOException ex) { logger.error("Unable to write report to index", ex); } }</code><technical_language>switch is able enum's</technical_language>

Target:
public void report(IssueType type, String code, String... args) { String message; try { message = this.resources.getString(code); message = message == null ? code : message; message = MessageFormat.format(message, args); } catch (MissingResourceException ex) { logger.error("Can't find resource for " + code + " defaulting to code"); message = code; } switch (type) { case ERROR: case VALIDATION: logger.error(message); break; case PROBLEM: logger.warn(message); break; case COLLISION: logger.info(message); break; case NOTE: case COUNT: logger.debug(message); break; default: logger.warn("Unknown message type " + type + ": " + message); } Document doc = new Document(); doc.add(new StringField("type", ALATerm.TaxonomicIssue.qualifiedName(), Field.Store.YES)); doc.add(new StringField("id", UUID.randomUUID().toString(), Field.Store.YES)); doc.add(new StringField(this.fieldName(DcTerm.type), type.name(), Field.Store.YES)); doc.add(new StringField(this.fieldName(DcTerm.subject), code, Field.Store.YES)); doc.add(new StringField(this.fieldName(DcTerm.description), message, Field.Store.YES)); doc.add(new StringField(this.fieldName(DcTerm.date), ISO8601.format(OffsetDateTime.now()), Field.Store.YES)); try { synchronized (this) { this.indexWriter.addDocument(doc); this.indexWriter.commit(); this.searcherManager.maybeRefresh(); } } catch (IOException ex) { logger.error("Unable to write report to index", ex); } }
Source:
<code>public void cleanupTraces() { TmfTestTrace.A_TEST_10K.dispose(); <START> CtfTmfTestTrace.KERNEL.dispose(); <END> }</code><technical_language>For symmetry's sake, load (the .getTrace()) in a @Before method</technical_language>

Target:
public void cleanupTraces() { TmfTestTrace.A_TEST_10K.dispose(); }
Source:
<code>public static PermitType map(ActionGroup entity, PermitType template) { try { return PermitType.valueOf(entity); } catch (IllegalArgumentException e) { log.error("Missing mapping '{}' --> '{}': {}", entity, PermitType.class.getName(), e.getMessage()); <START> log.debug("Exception", e); <END> return null; } }</code><technical_language>stack trace level message</technical_language>

Target:
public static PermitType map(ActionGroup entity, PermitType template) { try { return PermitType.valueOf(entity); } catch (IllegalArgumentException e) { log.error("Missing mapping '{}' --> '{}': {}", entity, PermitType.class.getName(), e.getMessage()); log.error("Exception", e); return null; } }
Source:
<code>private Set<WrappedByteArray> drainKeys() { <START> Set<WrappedByteArray> trackedKeys = new HashSet<>(); <END> for (int i = 0; i < keysPerSegment.length(); i++) { Set<WrappedByteArray> keys = keysPerSegment.get(i); if (keys != null) trackedKeys.addAll(keys); keysPerSegment.set(i, null); } return trackedKeys; }</code><technical_language>I add keys ReplKeyTracker. creating a new HashSet instantiate ReplKeyTracker</technical_language>

Target:
private void drainKeys() { for (int i = 0; i < keysPerSegment.length(); i++) { Set<WrappedByteArray> keys = keysPerSegment.get(i); if (keys != null) keyOnlyTracker.addAll(keys); keysPerSegment.set(i, null); } }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { return null; } mStudyOptionsView = inflater.inflate(R.layout.studyoptions_fragment, container, false); <START> assert mStudyOptionsView != null; <END> mFragmented = getActivity().getClass() != StudyOptionsActivity.class; initAllContentViews(mStudyOptionsView); mToolbar = (Toolbar) mStudyOptionsView.findViewById(R.id.studyOptionsToolbar); mToolbar.inflateMenu(R.menu.study_options_fragment); if (mToolbar != null) { configureToolbar(); } refreshInterface(true); return mStudyOptionsView; }</code><technical_language>assert work in android JVM this is in AnkiDroid I Android Studio 4.x toolchain (including gradle plugins) start making assert work extra de-sugaring implementing in alpha way, if want assert behavior Timber.e throw RuntimeException, effectively</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { return null; } View studyOptionsView = inflater.inflate(R.layout.studyoptions_fragment, container, false); mStudyOptionsView = studyOptionsView; mFragmented = getActivity().getClass() != StudyOptionsActivity.class; initAllContentViews(studyOptionsView); mToolbar = (Toolbar) studyOptionsView.findViewById(R.id.studyOptionsToolbar); mToolbar.inflateMenu(R.menu.study_options_fragment); if (mToolbar != null) { configureToolbar(); } refreshInterface(true); return studyOptionsView; }
Source:
<code><START> private String assertLabelGroupsMatchingAndReplace(String labelTemplate, String[][] expectedGroups) throws Exception { <END> assertLabelGroupsMatching(labelTemplate, expectedGroups); return PipelineLabel.replaceRevisionsInLabel(labelTemplate, MATERIAL_REVISIONS); }</code><technical_language>bottom for reason mentioned above</technical_language>

Target:
private String assertLabelGroupsMatchingAndReplace(String labelTemplate, String[][] expectedGroups) throws Exception { assertLabelGroupsMatching(labelTemplate, expectedGroups); PipelineLabel label = new PipelineLabel(labelTemplate); label.updateLabel(MATERIAL_REVISIONS); return label.toString(); }
Source:
<code>public <V> DataSet<V> readParquetFile(StructType tableSchema, int[] baseColumnMap, int[] partitionColumnMap, String location, OperationContext context, Qualifier[][] qualifiers, DataValueDescriptor probeValue, ExecRow execRow, boolean useSample, double sampleFraction) throws StandardException { try { Dataset<Row> table = null; ExternalTableUtils.preSortColumns(tableSchema.fields(), partitionColumnMap); <START> try { table = SpliceSpark.getSession() <END> .read() .schema(tableSchema) .parquet(location); } catch (Exception e) { return handleExceptionSparkRead(e, location, false); } ExternalTableUtils.sortColumns(table.schema().fields(), partitionColumnMap); table = processExternalDataset(execRow, table, baseColumnMap, qualifiers, probeValue); if (useSample) { return new NativeSparkDataSet(table .sample(false, sampleFraction), context); } else { return new NativeSparkDataSet(table, context); } } catch (Exception e) { throw StandardException.newException( SQLState.EXTERNAL_TABLES_READ_FAILURE, e, e.getMessage()); } }</code><technical_language>if I understand correctly, removed redundant check for directory existence move exception handling logic actual read, right</technical_language>

Target:
public <V> DataSet<V> readParquetFile(StructType tableSchema, int[] baseColumnMap, int[] partitionColumnMap, String location, OperationContext context, Qualifier[][] qualifiers, DataValueDescriptor probeValue, ExecRow execRow, boolean useSample, double sampleFraction) throws StandardException { try { Dataset<Row> table = null; ExternalTableUtils.preSortColumns(tableSchema.fields(), partitionColumnMap); try { table = SpliceSpark.getSession() .read() .schema(tableSchema) .parquet(location); } catch (Exception e) { return handleExceptionSparkRead(e, location, false); } ExternalTableUtils.sortColumns(table.schema().fields(), partitionColumnMap); return externalTablesPostProcess(baseColumnMap, context, qualifiers, probeValue, execRow, useSample, sampleFraction, table); } catch (Exception e) { throw StandardException.newException( SQLState.EXTERNAL_TABLES_READ_FAILURE, e, e.getMessage()); } }
Source:
<code>public List<CoopResult> getCoopLeaderboard(String missionId, int numberOfPlayers) { <START> return getMany("/data/coopResult", 1000, ImmutableMap.of( <END> "filter", rsql(qBuilder().intNum("playerCount").eq(numberOfPlayers)), "sort", "-duration" )); }</code><technical_language>all? getAll</technical_language>

Target:
public List<CoopResult> getCoopLeaderboard(String missionId, int numberOfPlayers) { return getAll("/data/coopResult", ImmutableMap.of( "filter", rsql(qBuilder().intNum("playerCount").eq(numberOfPlayers)), "sort", "-duration" )); }
Source:
<code>private KeyInformation(String originalKey, String prefix, Long objectId, String key, List<String> manipulations) { this.originalKey = originalKey; this.prefix = prefix; this.objectId = objectId; this.key = key; this.manipulations = manipulations; <START> } <END></code><technical_language>refer existing constructor</technical_language>

Target:
private KeyInformation(String originalKey, String prefix, Long objectId, String key, List<String> manipulations) { this(originalKey, prefix, null, null, objectId, key, manipulations); }
Source:
<code>public Target onboard( @NonNull String vendorThingID, @NonNull String thingPassword, @Nullable OnboardWithVendorThingIDOptions options) throws ThingIFException { <START> return thingIfApi.onboard(vendorThingID, thingPassword, options); <END> }</code><technical_language>Adding this a field is good manner</technical_language>

Target:
public Target onboard( @NonNull String vendorThingID, @NonNull String thingPassword, @Nullable OnboardWithVendorThingIDOptions options) throws ThingIFException { return this.thingIfApi.onboard(vendorThingID, thingPassword, options); }
Source:
<code>public void setup() { super.setup(); networkApi = api.getNetworkApi(); for (Datacenter dc : api.getDatacenterApi().listDatacenters()) { <START> if (dc.getName().equals("dal13")) { <END> datacenter = dc; } } assertNotNull(datacenter, "Datacenter must not be null"); }</code><technical_language>dal013? is datacenter supports this network feature far? consider making a constant</technical_language>

Target:
public void setup() { super.setup(); networkApi = api.getNetworkApi(); datacenter = Iterables.get(api.getDatacenterApi().listDatacenters(), 0); assertNotNull(datacenter, "Datacenter must not be null"); }
Source:
<code>void onChangeRevision(@SuppressWarnings("unused") ChangeEvent e) { int idx = diffBase.getSelectedIndex(); <START> if (0 <= idx && fileTableMode == FileTable.Mode.REVIEW) { <END> String n = diffBase.getValue(idx); loadConfigInfo(changeInfo, !n.isEmpty() ? n : null); } }</code><technical_language>I understand ignoring UI event Diff base popup selects another field in edit mode fixes linked issue. A more descriptive commit message help. Is diffBase widget supposed disabled invisible in edit mode</technical_language>

Target:
void onChangeRevision(@SuppressWarnings("unused") ChangeEvent e) { int idx = diffBase.getSelectedIndex(); if (0 <= idx) { String n = diffBase.getValue(idx); loadConfigInfo(changeInfo, !n.isEmpty() ? n : null); } }
Source:
<code>static String getShortNameToLog(final List<RegionInfo> ris) { <START> return ris.stream().map(ri -> ri.getShortNameToLog()).collect(Collectors.toList()).toString(); <END> }</code><technical_language>If like, ri -> ri.getShortNameToLog() replaced method reference RegionInfo::getShortNameToLog. other places. Good class type method I personally prefer that</technical_language>

Target:
static String getShortNameToLog(final List<RegionInfo> ris) { return ris.stream().map(RegionInfo::getEncodedName).collect(Collectors.toList()).toString(); }
Source:
<code>synchronized static void cleanCachedInAppMessages(final OneSignalDbHelper dbHelper) { new Thread(new Runnable() { @Override public void run() { Thread.currentThread().setPriority(Process.THREAD_PRIORITY_BACKGROUND); <START> new OSInAppMessageRepository(dbHelper).cleanCachedInAppMessages(); <END> } }, OS_DELETE_CACHED_REDISPLAYED_IAMS_THREAD).start(); }</code><technical_language>access throw OneSignal.java? add method params? a repository instance alive if more instance te synchronized work</technical_language>

Target:
synchronized static void cleanCachedInAppMessages(final OneSignalDbHelper dbHelper) { new Thread(new Runnable() { @Override public void run() { Thread.currentThread().setPriority(Process.THREAD_PRIORITY_BACKGROUND); OSInAppMessageRepository inAppMessageRepository = OSInAppMessageController .getController() .getInAppMessageRepository(dbHelper); inAppMessageRepository.cleanCachedInAppMessages(); } }, OS_DELETE_CACHED_REDISPLAYED_IAMS_THREAD).start(); }
Source:
<code>public Object execute(JobExecutionContext context) throws JobExecutionException { JobArguments args = context.getJobArguments(); String principalName = context.getPrincipalName(); String ownerKey = args.getAsString(OWNER_KEY); Owner owner = this.ownerCurator.lockAndLoadByKey(ownerKey); <START> log.info("GRABBED OWNER: {}", owner); <END> if (owner == null) { log.debug("Owner no longer exists: {}", ownerKey); return String.format("Nothing to do; owner no longer exists: %s", ownerKey); } String displayName = owner.getDisplayName(); ExporterMetadata metadata = this.exportCurator .getByTypeAndOwner(ExporterMetadata.TYPE_PER_USER, owner); if (metadata == null) { log.debug("No imports exist for owner {}", displayName); return String.format("Nothing to do; imports no longer exist for owner: %s", displayName); } log.info("Deleting all pools originating from manifests for owner/org: {}", displayName); List<Pool> pools = this.poolManager.listPoolsByOwner(owner).list(); for (Pool pool : pools) { if (this.poolManager.isManaged(pool)) { this.poolManager.deletePool(pool); } } UpstreamConsumer uc = owner.getUpstreamConsumer(); owner.setUpstreamConsumer(null); this.exportCurator.delete(metadata); this.recordManifestDeletion(owner, principalName, uc); return String.format("Imported pools removed for owner: %s", displayName); }</code><technical_language>Leftover temporary debug statement probably</technical_language>

Target:
public Object execute(JobExecutionContext context) throws JobExecutionException { JobArguments args = context.getJobArguments(); String principalName = context.getPrincipalName(); String ownerKey = args.getAsString(OWNER_KEY); Owner owner = this.ownerCurator.lockAndLoadByKey(ownerKey); if (owner == null) { log.debug("Owner no longer exists: {}", ownerKey); return String.format("Nothing to do; owner no longer exists: %s", ownerKey); } String displayName = owner.getDisplayName(); ExporterMetadata metadata = this.exportCurator .getByTypeAndOwner(ExporterMetadata.TYPE_PER_USER, owner); if (metadata == null) { log.debug("No imports exist for owner {}", displayName); return String.format("Nothing to do; imports no longer exist for owner: %s", displayName); } log.info("Deleting all pools originating from manifests for owner/org: {}", displayName); List<Pool> pools = this.poolManager.listPoolsByOwner(owner).list(); for (Pool pool : pools) { if (this.poolManager.isManaged(pool)) { this.poolManager.deletePool(pool); } } UpstreamConsumer uc = owner.getUpstreamConsumer(); owner.setUpstreamConsumer(null); this.exportCurator.delete(metadata); this.recordManifestDeletion(owner, principalName, uc); return String.format("Imported pools removed for owner: %s", displayName); }
Source:
<code><START> private boolean isOpenParenthesis(SyntaxToken token) { <END> return TokenUtils.isType(token, PHPPunctuator.LPARENTHESIS); }</code><technical_language>![MAJOR](<LINK_1> "isOpenParenthesis" a "static" method. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private static boolean isOpenParenthesis(SyntaxToken token) { return TokenUtils.isType(token, PHPPunctuator.LPARENTHESIS); }
Source:
<code>public ValidationResult isMacAssignableValidator() { <START> Boolean <END> allowDupMacs = macPool.isDuplicateMacAddressesAllowed(); boolean illegalDuplicateMacUsage = !allowDupMacs && macPool.isMacInUse(macAddress); EngineMessage failMessage = EngineMessage.NETWORK_MAC_ADDRESS_IN_USE; return ValidationResult .failWith(failMessage, ReplacementUtils.getVariableAssignmentString(failMessage, macAddress)) .when(illegalDuplicateMacUsage); }</code><technical_language>(feel free ignore this) This is scope of patch, please feel free ignore this, change: Boolean -> boolean</technical_language>

Target:
public ValidationResult isMacAssignableValidator() { boolean allowDupMacs = macPool.isDuplicateMacAddressesAllowed(); boolean illegalDuplicateMacUsage = !allowDupMacs && macPool.isMacInUse(macAddress); EngineMessage failMessage = EngineMessage.NETWORK_MAC_ADDRESS_IN_USE; return ValidationResult .failWith(failMessage, ReplacementUtils.getVariableAssignmentString(failMessage, macAddress)) .when(illegalDuplicateMacUsage); }