auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static DistributedQueryRunner createRaptorQueryRunner( Map<String, String> extraProperties, boolean loadTpch, boolean bucketed, Map<String, String> extraRaptorProperties) throws Exception { DistributedQueryRunner queryRunner = new DistributedQueryRunner(createSession("tpch"), 2, extraProperties); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); queryRunner.installPlugin(new RaptorPlugin()); File baseDir = queryRunner.getCoordinator().getBaseDataDir().toFile(); Map<String, String> raptorProperties = ImmutableMap.<String, String>builder() .putAll(extraRaptorProperties) .put("metadata.db.type", "h2") .put("metadata.db.connections.max", "100") .put("metadata.db.filename", new File(baseDir, "db").getAbsolutePath()) .put("storage.data-directory", new File(baseDir, "data").getAbsolutePath()) .put("storage.max-shard-rows", "2000") <START> .put("storage.max-files-created", "200") <END> .put("backup.provider", "file") .put("backup.directory", new File(baseDir, "backup").getAbsolutePath()) .build(); queryRunner.createCatalog("raptor", "raptor", raptorProperties); if (loadTpch) { copyTables(queryRunner, "tpch", createSession(), bucketed); } return queryRunner; }</code><technical_language>this</technical_language>

Target:
public static DistributedQueryRunner createRaptorQueryRunner( Map<String, String> extraProperties, boolean loadTpch, boolean bucketed, Map<String, String> extraRaptorProperties) throws Exception { DistributedQueryRunner queryRunner = new DistributedQueryRunner(createSession("tpch"), 2, extraProperties); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); queryRunner.installPlugin(new RaptorPlugin()); File baseDir = queryRunner.getCoordinator().getBaseDataDir().toFile(); Map<String, String> raptorProperties = ImmutableMap.<String, String>builder() .putAll(extraRaptorProperties) .put("metadata.db.type", "h2") .put("metadata.db.connections.max", "100") .put("metadata.db.filename", new File(baseDir, "db").getAbsolutePath()) .put("storage.data-directory", new File(baseDir, "data").getAbsolutePath()) .put("storage.max-shard-rows", "2000") .put("backup.provider", "file") .put("backup.directory", new File(baseDir, "backup").getAbsolutePath()) .build(); queryRunner.createCatalog("raptor", "raptor", raptorProperties); if (loadTpch) { copyTables(queryRunner, "tpch", createSession(), bucketed); } return queryRunner; }
Source:
<code>protected void onInit() throws Exception { super.onInit(); ResultFactory generatedResultFactory = XmlNamespaceUtils.configureResultFactory(resultType, resultFactoryName,this.getBeanFactory()); <START> if(generatedResultFactory != null){ <END> resultFactory=generatedResultFactory; } boolean resultFactorySpecified = StringUtils.hasText(resultFactoryName) || StringUtils.hasText(resultType); if(resultFactorySpecified){ alwaysUseResultFactory=true; } this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); if (this.templates == null) { TransformerFactory transformerFactory; if (this.transformerFactoryClassName != null) { transformerFactory = TransformerFactory.newInstance(this.transformerFactoryClassName, this.classLoader); } else { transformerFactory = TransformerFactory.newInstance(); } this.templates = transformerFactory.newTemplates(createStreamSourceOnResource(this.xslResource)); } }</code><technical_language>Again: bad code format</technical_language>

Target:
protected void onInit() throws Exception { super.onInit(); boolean resultFactorySpecified = StringUtils.hasText(this.getResultFactoryName()) || StringUtils.hasText(this.getResultType()); if(resultFactorySpecified){ alwaysUseResultFactory=true; } this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); if (this.templates == null) { TransformerFactory transformerFactory; if (this.transformerFactoryClassName != null) { transformerFactory = TransformerFactory.newInstance(this.transformerFactoryClassName, this.classLoader); } else { transformerFactory = TransformerFactory.newInstance(); } this.templates = transformerFactory.newTemplates(createStreamSourceOnResource(this.xslResource)); } }
Source:
<code>public <E> void save( E configuration, File configurationFile, ConfigurationWriter<E> writer) throws IOException { Writer fw = null; try { configurationFile.getParentFile().mkdirs(); File tempFile = new File(configurationFile.getParentFile(), configurationFile.getName() + ".tmp"); fw = new BufferedWriter( new FileWriter( tempFile ) ); writer.write( fw, configuration ); fw.flush(); <START> Files.move( tempFile, configurationFile ); <END> } finally { IOUtils.closeQuietly( fw ); } }</code><technical_language>Moving file while writer is open.... this work Windows</technical_language>

Target:
public <E> void save( E configuration, File configurationFile, ConfigurationWriter<E> writer) throws IOException { Writer fw = null; try { configurationFile.getParentFile().mkdirs(); File tempFile = new File(configurationFile.getParentFile(), configurationFile.getName() + ".tmp"); fw = new BufferedWriter( new FileWriter( tempFile ) ); writer.write( fw, configuration ); fw.flush(); fw.close(); Files.move( tempFile, configurationFile ); } finally { IOUtils.closeQuietly( fw ); } }
Source:
<code>default Optional<MethodUsage> solveMethodAsUsage(String name, List<ResolvedType> argumentsTypes) { SymbolReference<ResolvedMethodDeclaration> methodSolved = solveMethod(name, argumentsTypes, false); if (methodSolved.isSolved()) { ResolvedMethodDeclaration methodDeclaration = methodSolved.getCorrespondingDeclaration(); MethodUsage methodUsage; if (methodDeclaration instanceof TypeVariableResolutionCapability) { methodUsage = ((TypeVariableResolutionCapability) methodDeclaration) .resolveTypeVariables(this, argumentsTypes); } else { <START> return Optional.empty(); <END> } return Optional.of(methodUsage); } else { return Optional.empty(); } }</code><technical_language>mmm, a method declaration TypeVariableResolutionCapability? Is this ok</technical_language>

Target:
default Optional<MethodUsage> solveMethodAsUsage(String name, List<ResolvedType> argumentsTypes) { SymbolReference<ResolvedMethodDeclaration> methodSolved = solveMethod(name, argumentsTypes, false); if (methodSolved.isSolved()) { ResolvedMethodDeclaration methodDeclaration = methodSolved.getCorrespondingDeclaration(); MethodUsage methodUsage; if (methodDeclaration instanceof TypeVariableResolutionCapability) { methodUsage = ((TypeVariableResolutionCapability) methodDeclaration) .resolveTypeVariables(this, argumentsTypes); } else { throw new UnsupportedOperationException("Resolved method declarations should have the " + TypeVariableResolutionCapability.class.getName() + "."); } return Optional.of(methodUsage); } else { return Optional.empty(); } }
Source:
<code>public final Observable<T> distinctUntilChanged(Func2<? super T, ? super T, Boolean> comparator) { return lift(new OperatorDistinctUntilChanged<>(new Func1<T, Object>() { <START> T previousValue; <END> @Override public Object call(T t) { if (previousValue != null) { if (comparator.call(previousValue, t)) { return previousValue; } else { previousValue = t; return t; } } else { previousValue = t; return previousValue; } } })); }</code><technical_language>This shared subscribers of chain get proper results multiple subscribers run chain concurrently</technical_language>

Target:
public final Observable<T> distinctUntilChanged(Func2<? super T, ? super T, Boolean> comparator) { return lift(new OperatorDistinctUntilChanged<T, Void>(comparator)); }
Source:
<code>protected void onCheckBoxClick(int position) { if (selectionMode == SINGLE) { boolean currentState = selectionManager.isPositionSelected(position); for (int i : selectionManager.getSelectedPositions()) { selectionManager.setSelectionTo(false, i); notifyItemChanged(i); } selectionManager.setSelectionTo(!currentState, position); notifyItemChanged(position); } else if (selectionMode == PAIRS) { <START> if (selectionManager.getSelectedPositions().size() < numberMergeSelections) { <END> selectionManager.toggleSelection(position); } else { selectionManager.setSelectionTo(false, position); notifyItemChanged(position); } } else { selectionManager.toggleSelection(position); } selectionListener.onSelectionChanged(selectionManager.getSelectedPositions().size()); }</code><technical_language>remove numberMergeSelections, a pair is 2, put 2 here</technical_language>

Target:
protected void onCheckBoxClick(int position) { if (selectionMode == SINGLE) { boolean currentState = selectionManager.isPositionSelected(position); for (int i : selectionManager.getSelectedPositions()) { selectionManager.setSelectionTo(false, i); notifyItemChanged(i); } selectionManager.setSelectionTo(!currentState, position); notifyItemChanged(position); } else if (selectionMode == PAIRS) { if (selectionManager.getSelectedPositions().size() < 2) { selectionManager.toggleSelection(position); } else { selectionManager.setSelectionTo(false, position); notifyItemChanged(position); } } else { selectionManager.toggleSelection(position); } selectionListener.onSelectionChanged(selectionManager.getSelectedPositions().size()); }
Source:
<code>public PeriodicSchedule createSchedule() { List<LocalDate> unadj = createUnadjustedDates(); List<LocalDate> adj = applyBusinessDayAdjustment(unadj); RollConvention rollConv = getEffectiveRollConvention(); List<SchedulePeriod> periods = new ArrayList<>(); <START> for (int i = 0; i < unadj.size() - 1; i++) { <END> SchedulePeriodType type = SchedulePeriodType.of(i, unadj.size()); periods.add( SchedulePeriod.of(type, adj.get(i), adj.get(i + 1), unadj.get(i), unadj.get(i + 1), frequency, rollConv)); } return PeriodicSchedule.of(periods); }</code><technical_language>unadj.stream() ..</technical_language>

Target:
public PeriodicSchedule createSchedule() { List<LocalDate> unadj = createUnadjustedDates(); List<LocalDate> adj = applyBusinessDayAdjustment(unadj); RollConvention rollConv = getEffectiveRollConvention(); List<SchedulePeriod> periods = new ArrayList<>(); for (int i = 0; i < unadj.size() - 1; i++) { periods.add( SchedulePeriod.builder() .type(SchedulePeriodType.of(i, unadj.size())) .startDate(adj.get(i)) .endDate(adj.get(i + 1)) .unadjustedStartDate(unadj.get(i)) .unadjustedEndDate(unadj.get(i + 1)) .frequency(frequency) .rollConvention(rollConv) .build()); } return PeriodicSchedule.of(periods); }
Source:
<code>protected String processACHBatchDetail(PayeeACHAccountExtractDetail achDetail) { LOG.info("processACHBatchDetail: Starting processACHBatchDetail for: " + achDetail.getLogData()); Person payee = personService.getPersonByPrincipalName(achDetail.getNetID()); String processingError; <START> processingError = validateACHBatchDetail(achDetail, payee); <END> if (StringUtils.isNotBlank(processingError)) { return processingError; } processingError = addOrUpdateACHAccountIfNecessary(payee, achDetail, PayeeIdTypeCodes.ENTITY, payee.getEntityId()); if (StringUtils.isNotBlank(processingError)) { return processingError; } processingError = addOrUpdateACHAccountIfNecessary(payee, achDetail, PayeeIdTypeCodes.EMPLOYEE, payee.getEmployeeId()); return processingError; }</code><technical_language>default assignment local variable removed declaration. Is a reason this method call line instead</technical_language>

Target:
protected String processACHBatchDetail(PayeeACHAccountExtractDetail achDetail) { LOG.info("processACHBatchDetail: Starting processACHBatchDetail for: " + achDetail.getLogData()); Person payee = personService.getPersonByPrincipalName(achDetail.getNetID()); String processingError = validateACHBatchDetail(achDetail, payee); if (StringUtils.isNotBlank(processingError)) { return processingError; } processingError = addOrUpdateACHAccountIfNecessary(payee, achDetail, PayeeIdTypeCodes.ENTITY, payee.getEntityId()); if (StringUtils.isNotBlank(processingError)) { return processingError; } processingError = addOrUpdateACHAccountIfNecessary(payee, achDetail, PayeeIdTypeCodes.EMPLOYEE, payee.getEmployeeId()); return processingError; }
Source:
<code><START> Set<String> getSupportedRecipes() { <END> return runtimes.getSupportedRecipes(); }</code><technical_language>explain this method package private public</technical_language>

Target:
public Set<String> getSupportedRecipes() { return runtimes.getSupportedRecipes(); }
Source:
<code>public String index(Request request, Response response) throws IOException { List<String> resourceList = goConfigService.getResourceList(); <START> return GSON.toJson(resourceList); <END> }</code><technical_language>Please jackson for JSON serialization: java return JsonOutputWriter.OBJECT_MAPPER.writeValueAsString(resourceList);</technical_language>

Target:
public String index(Request request, Response response) throws IOException { List<String> resourceList = goConfigService.getResourceList(); return JsonOutputWriter.OBJECT_MAPPER.writeValueAsString(resourceList); }
Source:
<code>private void setTags(ProgData progData, Content content) { Set<String> tagsFromGenres = paTagMap.map(content.getGenres()); <START> if (!tagsFromGenres.isEmpty()) { <END> content.setTags(tagsFromGenres); } }</code><technical_language>do need this guard</technical_language>

Target:
private void setTags(ProgData progData, Content content) { Set<String> tagsFromGenres = paTagMap.map(content.getGenres()); content.setTags(tagsFromGenres); }
Source:
<code>default ConnectionDetails getConnectionDetails() { ConnectionDetails connectionDetails = getSource().getConnectionDetails(); if (connectionDetails == null) { throw new IllegalStateException("ConnectionDetails undefined for: " + getSource().getName()); } <START> return getSource().getConnectionDetails(); <END> }</code><technical_language>return connectionDetails here</technical_language>

Target:
default ConnectionDetails getConnectionDetails() { ConnectionDetails connectionDetails = getSource().getConnectionDetails(); if (connectionDetails == null) { throw new IllegalStateException("ConnectionDetails undefined for: " + getSource().getName()); } return connectionDetails; }
Source:
<code>@Test void testArrowSchema() { Source source = Sources.of(ArrowTest.class.getResource("/files")); ArrowSchema arrowSchema = new ArrowSchema(source.file().getAbsoluteFile()); <START> Map<String, Table> tableMap = arrowSchema.getTableMap(); <END> }</code><technical_language>able new new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT) for testing purposes</technical_language>

Target:
@Test void testArrowSchema() { Source source = Sources.of(ArrowTest.class.getResource("/arrow")); ArrowSchema arrowSchema = new ArrowSchema(source.file().getAbsoluteFile()); Map<String, Table> tableMap = arrowSchema.getTableMap(); RelDataType relDataType = tableMap.get("TEST").getRowType(new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT)); Assertions.assertEquals(relDataType.getFieldNames().get(0), "fieldOne"); Assertions.assertEquals(relDataType.getFieldNames().get(1), "fieldTwo"); Assertions.assertEquals(relDataType.getFieldNames().get(2), "fieldThree"); }
Source:
<code>protected void startScan() { logger.debug("Starting Astro discovery scan"); String result = null; try { result = HttpUtil.executeUrl("GET", "<LINK_1>,lon", 5000); } catch (IOException e) { logger.warn("Can't get latitude and longitude for the current location: {}", e); } if (result != null) { String lat = StringUtils.trim(StringUtils.substringBetween(result, "\"lat\":", ",")); String lon = StringUtils.trim(StringUtils.substringBetween(result, "\"lon\":", "}")); try { double latitude = Double.parseDouble(lat); double longitude = Double.parseDouble(lon); logger.info("Evaluated Astro geolocation: latitude: {}, longitude: {}", latitude, longitude); ThingTypeUID sunType = new ThingTypeUID(BINDING_ID, SUN); ThingTypeUID moonType = new ThingTypeUID(BINDING_ID, MOON); ThingUID sunThing = new ThingUID(sunType, LOCAL); ThingUID moonThing = new ThingUID(moonType, LOCAL); String propGeolocation = String.format("%s,%s", latitude, longitude); thingDiscovered(DiscoveryResultBuilder.create(sunThing).withLabel("Local Sun") .withProperty("geolocation", propGeolocation).build()); thingDiscovered(DiscoveryResultBuilder.create(moonThing).withLabel("Local Moon") .withProperty("geolocation", propGeolocation).build()); } catch (Exception ex) { <START> logger.warn("Can't discover Astro geolocation", ex); <END> } } }</code><technical_language>a warning. Do want log complete exception stacktrace for a warning? Check <LINK_0></technical_language>

Target:
protected void startScan() { logger.debug("Starting Astro discovery scan"); String result = null; try { result = HttpUtil.executeUrl("GET", "<LINK_1>,lon", 5000); } catch (IOException e) { logger.warn("Can't get latitude and longitude for the current location: {}", e); } if (result != null) { String lat = StringUtils.trim(StringUtils.substringBetween(result, "\"lat\":", ",")); String lon = StringUtils.trim(StringUtils.substringBetween(result, "\"lon\":", "}")); try { double latitude = Double.parseDouble(lat); double longitude = Double.parseDouble(lon); logger.info("Evaluated Astro geolocation: latitude: {}, longitude: {}", latitude, longitude); ThingTypeUID sunType = new ThingTypeUID(BINDING_ID, SUN); ThingTypeUID moonType = new ThingTypeUID(BINDING_ID, MOON); ThingUID sunThing = new ThingUID(sunType, LOCAL); ThingUID moonThing = new ThingUID(moonType, LOCAL); String propGeolocation = String.format("%s,%s", latitude, longitude); thingDiscovered(DiscoveryResultBuilder.create(sunThing).withLabel("Local Sun") .withProperty("geolocation", propGeolocation).build()); thingDiscovered(DiscoveryResultBuilder.create(moonThing).withLabel("Local Moon") .withProperty("geolocation", propGeolocation).build()); } catch (Exception ex) { logger.warn("Can't discover Astro geolocation"); } } }
Source:
<code>private static String buildFormattedDescription(final FailureCause originalCause, final List<FoundIndication> foundIndications, final String description) { String formattedCandidate = description; if (!foundIndications.isEmpty()) { final FoundIndication firstFoundIndication = foundIndications.get(0); try { if (originalCause != null) { final List<Indication> originalCauseIndications = originalCause.getIndications(); int expressionIndex = 0; boolean found = false; <START> for (final int size = originalCauseIndications.size(); expressionIndex < size; ++expressionIndex) { <END> if (originalCauseIndications.get(expressionIndex).getPattern().pattern().equals( firstFoundIndication.getPattern())) { found = true; break; } } if (found) { final int expressionNumber = expressionIndex + 1; formattedCandidate = convertFormat(formattedCandidate, expressionNumber); final Pattern contentPattern = Pattern.compile(firstFoundIndication.getPattern()); final Matcher contentMatcher = contentPattern.matcher(firstFoundIndication.getMatchingString()); formattedCandidate = contentMatcher.replaceAll(formattedCandidate); } } } catch (final Exception exception) { logger.log(Level.SEVERE, null, exception); } } return formattedCandidate; }</code><technical_language>if this correctly reevaluating pattern needed. Some regexps expensive run. Is some approach other end, evaluate expand indications in description? do this if description ${</technical_language>

Target:
private static String buildFormattedDescription(final FailureCause originalCause, final List<FoundIndication> foundIndications, final String description) { String formattedDescription = description; if (!foundIndications.isEmpty()) { final FoundIndication firstFoundIndication = foundIndications.get(0); try { if (originalCause != null) { final List<Indication> originalCauseIndications = originalCause.getIndications(); int expressionIndex = 0; boolean foundExpressionIndex = false; for (final int size = originalCauseIndications.size(); expressionIndex < size; ++expressionIndex) { if (originalCauseIndications.get(expressionIndex).getPattern().pattern().equals( firstFoundIndication.getPattern())) { foundExpressionIndex = true; break; } } if (foundExpressionIndex) { final int expressionNumber = expressionIndex + 1; formattedDescription = convertFormat(formattedDescription, expressionNumber); final Pattern contentPattern = Pattern.compile(firstFoundIndication.getPattern()); final Matcher contentMatcher = contentPattern.matcher(firstFoundIndication.getMatchingString()); formattedDescription = contentMatcher.replaceAll(formattedDescription); } } } catch (final Exception exception) { logger.log(Level.SEVERE, null, exception); } } return formattedDescription; }
Source:
<code>public static void main(String[] args) throws InterruptedException { ClientConfig clientConfig = new ClientConfig(); ClientUserCodeDeploymentConfig clientUserCodeDeploymentConfig = new ClientUserCodeDeploymentConfig(); clientUserCodeDeploymentConfig.addClass("IncrementingEntryProcessor"); <START> clientConfig.setUserCodeDeploymentConfig(clientUserCodeDeploymentConfig.setEnabled(true)); <END> HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig); IncrementingEntryProcessor incrementingEntryProcessor = new IncrementingEntryProcessor(); int keyCount = 10; IMap<Integer, Integer> map = client.getMap("sample map"); for (int i = 0; i < keyCount; i++) { map.put(i, 0); } map.executeOnEntries(incrementingEntryProcessor); for (int i = 0; i < keyCount; i++) { System.out.println(map.get(i)); } }</code><technical_language>put setEnabled a separate line more obvious for user this is a sample code</technical_language>

Target:
public static void main(String[] args) throws InterruptedException { ClientConfig clientConfig = new ClientConfig(); ClientUserCodeDeploymentConfig clientUserCodeDeploymentConfig = new ClientUserCodeDeploymentConfig(); clientUserCodeDeploymentConfig.addClass("IncrementingEntryProcessor"); clientUserCodeDeploymentConfig.setEnabled(true); clientConfig.setUserCodeDeploymentConfig(clientUserCodeDeploymentConfig); HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig); IncrementingEntryProcessor incrementingEntryProcessor = new IncrementingEntryProcessor(); int keyCount = 10; IMap<Integer, Integer> map = client.getMap("sample map"); for (int i = 0; i < keyCount; i++) { map.put(i, 0); } map.executeOnEntries(incrementingEntryProcessor); for (int i = 0; i < keyCount; i++) { System.out.println(map.get(i)); } }
Source:
<code>public TargetRoll getAllMods(Person tech) { TargetRoll mods = new TargetRoll(getDifficulty(), "difficulty"); mods.append(oldUnit.getSiteMod()); if(oldUnit.getEntity().hasQuirk("easy_maintain")) { mods.addModifier(-1, "easy to maintain"); } else if(oldUnit.getEntity().hasQuirk("difficult_maintain")) { mods.addModifier(1, "difficult to maintain"); } if(customJob) { mods.addModifier(2, "custom job"); } <START> if(null != tech && tech.getOptions().booleanOption("tech_engineer")) { <END> mods.addModifier(-2, "engineer"); } return mods; }</code><technical_language>suggestion if ((null != tech) && tech.getOptions().booleanOption("tech_engineer")) {</technical_language>

Target:
public TargetRoll getAllMods(Person tech) { TargetRoll mods = new TargetRoll(getDifficulty(), "difficulty"); mods.append(oldUnit.getSiteMod()); if(oldUnit.getEntity().hasQuirk("easy_maintain")) { mods.addModifier(-1, "easy to maintain"); } else if(oldUnit.getEntity().hasQuirk("difficult_maintain")) { mods.addModifier(1, "difficult to maintain"); } if(customJob) { mods.addModifier(2, "custom job"); } if ((null != tech) && tech.getOptions().booleanOption("tech_engineer")) { mods.addModifier(-2, "engineer"); } return mods; }
Source:
<code>public void deleteBundleAndDependencies(final String bundleId, final User user) throws DotDataException { final Bundle bundle = this.getBundleById(bundleId); if (null != bundle) { this.internalDeleteBundleAndDependencies(bundleId, user); } else { <START> <END> throw new NotFoundInDbException("The bundle id: " + bundleId + " does not exists"); } }</code><technical_language>Please log bundle ID here</technical_language>

Target:
public void deleteBundleAndDependencies(final String bundleId, final User user) throws DotDataException { final Bundle bundle = this.getBundleById(bundleId); if (null != bundle) { this.internalDeleteBundleAndDependencies(bundleId, user); } else { Logger.error(this,"The bundle id: " + bundleId + " does not exists"); throw new NotFoundInDbException("The bundle id: " + bundleId + " does not exists"); } }
Source:
<code><START> public synchronized User createNewUser(Map<String, String> userData, boolean validate) <END> throws UserCreateException { try { DocumentReference userDocRef = getOrGenerateUserDocRef(userData.remove("xwikiname")); XWikiDocument userDoc = modelAccess.createDocument(userDocRef); if (areIdentifiersUnique(userData)) { createUserFromData(userDoc, userData); setRightsOnUser(userDoc, Arrays.asList(EAccessLevel.VIEW, EAccessLevel.EDIT, EAccessLevel.DELETE)); modelAccess.saveDocument(userDoc, webUtils.getAdminMessageTool().get( "core.comment.createdUser")); addUserToDefaultGroups(userDocRef); if (validate) { new PasswordRecoveryAndEmailValidationCommand().sendNewValidationToAccountEmail( userDocRef); } } return getUser(userDocRef); } catch (DocumentAccessException | QueryException | SendValidationFailedException | UserInstantiationException exc) { throw new UserCreateException(exc); } }</code><technical_language>synchronized</technical_language>

Target:
public User createNewUser(Map<String, String> userData, boolean validate) throws UserCreateException { try { DocumentReference userDocRef = getOrGenerateUserDocRef(userData.remove("xwikiname")); XWikiDocument userDoc = modelAccess.createDocument(userDocRef); if (areIdentifiersUnique(userData)) { createUserFromData(userDoc, userData); setRightsOnUser(userDoc, Arrays.asList(EAccessLevel.VIEW, EAccessLevel.EDIT, EAccessLevel.DELETE)); modelAccess.saveDocument(userDoc, webUtils.getAdminMessageTool().get( "core.comment.createdUser")); addUserToDefaultGroups(userDocRef); if (validate) { new PasswordRecoveryAndEmailValidationCommand().sendNewValidationToAccountEmail( userDocRef); } } return getUser(userDocRef); } catch (DocumentAccessException | QueryException | SendValidationFailedException | UserInstantiationException exc) { throw new UserCreateException(exc); } }
Source:
<code><START> @Override public void drive() throws VolcanoTimeoutException { <END> TaskDescriptor description = new TaskDescriptor(); tasks.push(new OptimizeGroup(planner.root, planner.infCost)); exploreMaterializationRoots(); try { while (!tasks.isEmpty()) { Task task = tasks.pop(); description.log(task); task.perform(); } } catch (VolcanoTimeoutException ex) { LOGGER.warn("Volcano planning times out, cancels the subsequent optimization."); } }</code><technical_language>is necessary</technical_language>

Target:
@Override public void drive() { TaskDescriptor description = new TaskDescriptor(); tasks.push(new OptimizeGroup(planner.root, planner.infCost)); exploreMaterializationRoots(); try { while (!tasks.isEmpty()) { Task task = tasks.pop(); description.log(task); task.perform(); } } catch (VolcanoTimeoutException ex) { LOGGER.warn("Volcano planning times out, cancels the subsequent optimization."); } }
Source:
<code>private void initializeNotifyOnAvaiableButton() { final String text = isDryers ? getString(R.string.notify_on_dryer_available) : getString(R.string.notify_on_washer_available); notifyButton.setText(text); notifyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Machine m = null; int mTime = Integer.MAX_VALUE; for (Machine mach : currentAdapter.getCurrentMachines()) { try { int machTime = Integer.parseInt(mach.getTime().substring(0, mach.getTime().indexOf(' '))); if (machTime < mTime) { m = mach; mTime = machTime; } } catch (NumberFormatException | StringIndexOutOfBoundsException e) { continue; } } if (m == null) { <START> postSnackbar("No machines to set a timer for!", Snackbar.LENGTH_LONG); <END> return; } if (m.getStatus().equals("Not online") || m.getStatus().equals("Out of order")) { postSnackbar("It looks like this location is offline. " + "Please go to the laundry room to check machines.", Snackbar.LENGTH_LONG); return; } currentAdapter.registerNotification(m); } }); }</code><technical_language>move this strings.xml? I with. Blame Pitlor</technical_language>

Target:
private void initializeNotifyOnAvaiableButton() { final String text = isDryers ? getString(R.string.notify_on_dryer_available) : getString(R.string.notify_on_washer_available); notifyButton.setText(text); notifyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Machine m = null; int mTime = Integer.MAX_VALUE; for (Machine machine : currentAdapter.getCurrentMachines()) { try { int machineTime = Integer.parseInt(machine.getTime().substring(0, machine.getTime().indexOf(' '))); if (machineTime < mTime) { m = machine; mTime = machineTime; } } catch (NumberFormatException | StringIndexOutOfBoundsException e) { continue; } } if (m == null) { postSnackbar(getString(R.string.fragment_no_machine), Snackbar.LENGTH_LONG); return; } if (m.getStatus().equals("Not online") || m.getStatus().equals("Out of order")) { postSnackbar(getString(R.string.fragment_offline_location), Snackbar.LENGTH_LONG); return; } currentAdapter.registerNotification(m); } }); }
Source:
<code>public boolean rollback(String pushId) { boolean matched = false; Node n; for (Iterator<Node> it = marked.iterator(); it.hasNext(); ) { n = it.next(); if (matched) <START> it.remove(); <END> else if (n.get().getPushId() == pushId) { current = n; matched = true; } } return matched; }</code><technical_language>node need closed</technical_language>

Target:
public boolean rollback(String pushId) throws PublisherException { boolean matched = false; Node n; for (Iterator<Node> it = marked.iterator(); it.hasNext(); ) { n = it.next(); if (matched) it.remove(); else if (n.get().getPushId() == pushId) { current = n; matched = true; } } return matched; }
Source:
<code>private void applyButtonStyles(ConversationStyle style) { Typeface typeface = getTypeface(style, SwrveConversationConstants.DEFAULT_BUTTON_TYPEFACE); style.setTypeface(typeface); <START> if(conversationVersion < 4) { <END> style.setTextSize(getResources().getDimensionPixelSize(R.dimen.swrve__conversation_control_default_text_size)); } }</code><technical_language>render before, change text size of button based text_size attribute if present</technical_language>

Target:
private void applyButtonStyles(ConversationStyle style) { Typeface typeface = getTypeface(style, SwrveConversationConstants.DEFAULT_BUTTON_TYPEFACE); style.setTypeface(typeface); if (style.getTextSize() == 0) { style.setTextSize(getResources().getDimensionPixelSize(R.dimen.swrve__conversation_control_default_text_size)); } }
Source:
<code>protected void onCollectionLoaded(Collection col) { super.onCollectionLoaded(col); mPrefWhiteboard = MetaDB.getWhiteboardState(this, getParentDid()); if (mPrefWhiteboard) { boolean whiteboardVisibility = MetaDB.getWhiteboardVisibility(this, getParentDid()); setWhiteboardEnabledState(true); setWhiteboardVisibility(whiteboardVisibility); } <START> if (!reset_done) { col.getSched().reset(); reset_done = false; <END> } DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ANSWER_CARD, mAnswerCardHandler, new DeckTask.TaskData(null, 0)); disableDrawerSwipeOnConflicts(); mSched.setContext(new WeakReference<Activity>(this)); if (mPrefFullscreenReview) { CompatHelper.getCompat().setFullScreen(this); } }</code><technical_language>suggestion if (!mSchedResetDone) { col.getSched().reset(); // Reset schedule in case card previously loaded mSchedReset = false; }</technical_language>

Target:
protected void onCollectionLoaded(Collection col) { super.onCollectionLoaded(col); mPrefWhiteboard = MetaDB.getWhiteboardState(this, getParentDid()); if (mPrefWhiteboard) { boolean whiteboardVisibility = MetaDB.getWhiteboardVisibility(this, getParentDid()); setWhiteboardEnabledState(true); setWhiteboardVisibility(whiteboardVisibility); } if (!mSchedResetDone) { col.getSched().reset(); mSchedResetDone = false; } DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ANSWER_CARD, mAnswerCardHandler, new DeckTask.TaskData(null, 0)); disableDrawerSwipeOnConflicts(); mSched.setContext(new WeakReference<Activity>(this)); if (mPrefFullscreenReview) { CompatHelper.getCompat().setFullScreen(this); } }
Source:
<code>public List<TaskSummary> getTasksAssignedAsPotentialOwner(String userId, QueryFilter filter) { Map<String, Object> params = new HashMap<String, Object>(); params.put("userId", userId); <START> params.put("groupIds", userGroupCallback.getGroupsForUser(userId)); <END> params.put("status", allActiveStatus); applyQueryContext(params, filter); applyQueryFilter(params, filter); return (List<TaskSummary>) commandService.execute(new QueryNameCommand<List<TaskSummary>>("NewTasksAssignedAsPotentialOwner",params)); }</code><technical_language>@tsurdilo a org.jbpm.kie.services.impl.CommonUtils.getAuthenticatedUserRoles(IdentityProvider) some additional logic in case roles empty list. is issue some dbs handling empty list part of in clause</technical_language>

Target:
public List<TaskSummary> getTasksAssignedAsPotentialOwner(String userId, QueryFilter filter) { Map<String, Object> params = new HashMap<String, Object>(); params.put("userId", userId); params.put("groupIds", getCallbackUserRoles(userGroupCallback, userId)); params.put("status", allActiveStatus); applyQueryContext(params, filter); applyQueryFilter(params, filter); return (List<TaskSummary>) commandService.execute(new QueryNameCommand<List<TaskSummary>>("NewTasksAssignedAsPotentialOwner",params)); }
Source:
<code>public boolean isResponseRelatedToRequest(EndpointContext requestContext, EndpointContext responseContext) { if (ignoreAddress) { return isToBeSent(requestContext, responseContext); <START> } else { <END> return super.isResponseRelatedToRequest(requestContext, responseContext); } }</code><technical_language>a detail : I internalMatch instead of isToBeSent. (and change internalMatch protected) This read internalMatch - I difficulty understand inhibitNewConnection - is availableContext == null</technical_language>

Target:
public boolean isResponseRelatedToRequest(EndpointContext requestContext, EndpointContext responseContext) { if (ignoreAddress) { return super.internalMatch(requestContext, responseContext); } else { return super.isResponseRelatedToRequest(requestContext, responseContext); } }
Source:
<code>public static void main(String[] args) throws Exception { if (args.length != 1) { log.error("Usage: Copy <dataConfigPath>"); System.exit(1); } String hadoopConfDir = System.getenv("HADOOP_CONF_DIR"); if (hadoopConfDir == null) { log.error("HADOOP_CONF_DIR must be set in environment!"); System.exit(1); } if (!(new File(hadoopConfDir).exists())) { log.error("Directory set by HADOOP_CONF_DIR={} does not exist", hadoopConfDir); System.exit(1); } DataConfig dataConfig = DataConfig.load(args[0]); SparkConf sparkConf = new SparkConf().setAppName("CC-Load"); JavaSparkContext ctx = new JavaSparkContext(sparkConf); JavaPairRDD<Text, ArchiveReader> archives = ctx.newAPIHadoopFile(dataConfig.getHdfsLoadDir(), WARCFileInputFormat.class, Text.class, ArchiveReader.class, new Configuration()); JavaRDD<Page> pages = IndexUtil.createPages(archives); pages.foreachPartition(iter -> { final FluoConfiguration fluoConfig = new FluoConfiguration(new File("fluo.properties")); try (FluoClient client = FluoFactory.newClient(fluoConfig)) { iter.forEachRemaining(page -> { if (page.getOutboundLinks().size() > 0) { <START> try (LoaderExecutor le = client.newLoaderExecutor()) { <END> log.info("Loading page with links", page.getUrl(), page.getOutboundLinks() .size()); le.execute(PageLoader.updatePage(page)); } } }); } }); ctx.stop(); }</code><technical_language>this is done, loader executor load thing. A shared loader executor run multiple threads loading stuff in parallel. This is fluo output format does. if desired, depends whats w/ spark threading</technical_language>

Target:
public static void main(String[] args) throws Exception { if (args.length != 1) { log.error("Usage: Copy <dataConfigPath>"); System.exit(1); } String hadoopConfDir = System.getenv("HADOOP_CONF_DIR"); if (hadoopConfDir == null) { log.error("HADOOP_CONF_DIR must be set in environment!"); System.exit(1); } if (!(new File(hadoopConfDir).exists())) { log.error("Directory set by HADOOP_CONF_DIR={} does not exist", hadoopConfDir); System.exit(1); } DataConfig dataConfig = DataConfig.load(args[0]); SparkConf sparkConf = new SparkConf().setAppName("CC-Load"); JavaSparkContext ctx = new JavaSparkContext(sparkConf); JavaPairRDD<Text, ArchiveReader> archives = ctx.newAPIHadoopFile(dataConfig.getHdfsLoadDir(), WARCFileInputFormat.class, Text.class, ArchiveReader.class, new Configuration()); JavaRDD<Page> pages = IndexUtil.createPages(archives); pages.foreachPartition(iter -> { final FluoConfiguration fluoConfig = new FluoConfiguration(new File("fluo.properties")); try (FluoClient client = FluoFactory.newClient(fluoConfig)) { try (LoaderExecutor le = client.newLoaderExecutor()) { iter.forEachRemaining(page -> { if (page.getOutboundLinks().size() > 0) { log.info("Loading page with links", page.getUrl(), page.getOutboundLinks() .size()); le.execute(PageLoader.updatePage(page)); } }); } } }); ctx.stop(); }
Source:
<code>public static JButton createStopButton(final Task task, final MCMCWrapper model) { final JButton button = new JButton(Main.IMAGELOADER.getIcon(FileNames.ICON_TICK)); button.setText("Yes, finish"); button.setToolTipText("Finish the simulation"); <START> button.setEnabled(false); <END> button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(task.isStarted()) { ((MixedTreatmentComparison) getMTCModel(model.getModel())).setExtendSimulation(ExtendSimulation.FINISH); } } }); return button; }</code><technical_language>if simulation is in "decision phase" build panel</technical_language>

Target:
public static JButton createStopButton(final Task task, final MCMCWrapper model) { final JButton button = new JButton(Main.IMAGELOADER.getIcon(FileNames.ICON_TICK)); button.setText("Yes, finish"); button.setToolTipText("Finish the simulation"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(task.isStarted()) { ((MixedTreatmentComparison) ((MixedTreatmentComparison)model.getModel())).setExtendSimulation(ExtendSimulation.FINISH); } } }); return button; }
Source:
<code>protected void init() { <START> this.ctr = ReflectionHelper.findConstructor(this.cls, World.class); <END> }</code><technical_language>provide a change this builder (by providing a Function<World, E></technical_language>

Target:
protected void init() { this.factory = new EntityEntryBuilder.ConstructorFactory<Entity>(this.cls) { @Override protected String describeEntity() { return String.valueOf(EntityEntry.this.getRegistryName()); } }; }
Source:
<code>public void onMouseRelease(int guiLeft, int guiTop, int xSize, int ySize, int state, int mouseX, int mouseY) { if (getTabs().size() == 1 && container.getClass().equals(GuiInventory.class)) return; if (state == 0) { int x = mouseX - guiLeft; int y = mouseY - guiTop; int start = page * 12; int end = Math.min(getTabs().size(), (page + 1) * 12); for (GuiTab tab : getTabs()) { int index = tab.getTabIndex(); if (index >= start && index < end) { <START> if (tab != null && this.isMouseOverTab(tab, x, y, xSize, ySize)) <END> { tab.onTabClicked(Minecraft.getMinecraft().thePlayer); return; } } } } }</code><technical_language>tab null point</technical_language>

Target:
public void onMouseRelease(int guiLeft, int guiTop, int xSize, int ySize, int state, int mouseX, int mouseY) { if (getTabs().size() == 1 && guiContainer instanceof GuiInventory) return; if (state == 0) { int x = mouseX - guiLeft; int y = mouseY - guiTop; int start = page * maxTabsPerPage; int end = Math.min(getTabs().size(), (page + 1) * maxTabsPerPage); for (GuiTab tab : getTabs()) { int index = tab.getTabIndex(); if (index >= start && index < end && this.isMouseOverTab(tab, x, y, xSize, ySize)) { tab.onTabClicked(Minecraft.getMinecraft().thePlayer); return; } } } }
Source:
<code>public InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, KeyValueScanner memstoreScanner, InternalScanner s) throws IOException { TransactionSnapshot snapshot = cache.getLatestState(); if (snapshot == null) { if (LOG.isDebugEnabled()) { LOG.debug("Region " + c.getEnvironment().getRegion().getRegionNameAsString() + ", no current transaction state found, defaulting to normal flush scanner"); } return null; } Transaction dummyTx = TxUtils.createDummyTransaction(snapshot); LOG.info("Filtering flush with dummy tx " + dummyTx.toString()); Scan scan = new Scan(); scan.setMaxVersions(dummyTx.excludesSize() + 1); FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ONE); filterList.addFilter(getTransactionFilter(dummyTx)); filterList.addFilter(new IncludeInProgressFilter(dummyTx.getVisibilityUpperBound(), snapshot.getInvalid())); scan.setFilter(filterList); <START> return new StoreScanner(store, store.getScanInfo(), scan, <END> Collections.singletonList(memstoreScanner), ScanType.MINOR_COMPACT, c.getEnvironment().getRegion().getSmallestReadPoint(), HConstants.OLDEST_TIMESTAMP); }</code><technical_language>is this preCompactScannerOpen(e, store, Collections.singletonList(memstoreScanner), ScanType.MINOR_COMPACT, HConstants.OLDEST_TIMESTAMP)? duplicated code</technical_language>

Target:
public InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, KeyValueScanner memstoreScanner, InternalScanner s) throws IOException { return createStoreScanner(c.getEnvironment(), "flush", cache.getLatestState(), store, Collections.singletonList(memstoreScanner), ScanType.MINOR_COMPACT, HConstants.OLDEST_TIMESTAMP); }
Source:
<code>public synchronized final long position() throws IOException { <START> return 0; <END> }</code><technical_language>"return position;" maybe</technical_language>

Target:
public synchronized final long position() throws IOException { return position; }
Source:
<code>private String getFileName(File file) { <START> return file != null ? file.getAbsolutePath() : "null"; <END> }</code><technical_language>if do this, put N/A :)</technical_language>

Target:
private String getFileName(File file) { return file != null ? file.getAbsolutePath() : "N/A"; }
Source:
<code>public Optional<CommandMapping> register(Object plugin, CommandCallable<Boolean> callable, List<String> aliases, Function<List<String>, List<String>> callback) { checkNotNull(plugin); Optional<PluginContainer> containerOptional = pluginManager.fromInstance(plugin); if (!containerOptional.isPresent()) { throw new IllegalArgumentException("The provided plugin object does not have an associated plugin container " + "(in other words, is 'plugin' actually your plugin object?"); } <START> PluginContainer container = containerOptional.get(); <END> synchronized (lock) { List<String> aliasesWithPrefix = new ArrayList<String>(aliases.size() * 2); for (String alias : aliases) { aliasesWithPrefix.add(alias); aliasesWithPrefix.add(container.getId() + ":" + alias); } Optional<CommandMapping> mapping = dispatcher.register(callable, aliasesWithPrefix, callback); if (mapping.isPresent()) { owners.put(container, mapping.get()); } return mapping; } }</code><technical_language>remove this. field/method accesses. In fact, guidelines enforce of this. everywhere, need enforce it. (There's ways do in IDE)</technical_language>

Target:
public Optional<CommandMapping> register(Object plugin, CommandCallable<Boolean> callable, List<String> aliases, Function<List<String>, List<String>> callback) { checkNotNull(plugin); Optional<PluginContainer> containerOptional = this.pluginManager.fromInstance(plugin); if (!containerOptional.isPresent()) { throw new IllegalArgumentException("The provided plugin object does not have an associated plugin container " + "(in other words, is 'plugin' actually your plugin object?"); } PluginContainer container = containerOptional.get(); synchronized (this.lock) { List<String> aliasesWithPrefix = new ArrayList<String>(aliases.size() * 2); for (String alias : aliases) { aliasesWithPrefix.add(alias); aliasesWithPrefix.add(container.getId() + ":" + alias); } Optional<CommandMapping> mapping = this.dispatcher.register(callable, aliasesWithPrefix, callback); if (mapping.isPresent()) { this.owners.put(container, mapping.get()); } return mapping; } }
Source:
<code>public LanguageServerWrapper(@Nullable IProject project, @NonNull LanguageServerDefinition serverDefinition) { this.initialProject = project; this.allWatchedProjects = new HashSet<>(); this.serverDefinition = serverDefinition; this.lspStreamProvider = serverDefinition.createConnectionProvider(); <START> if (this.lspStreamProvider == null) { <END> throw new IllegalStateException(Messages.LanguageServerWrapper_initializationException); } this.connectedDocuments = new HashMap<>(); }</code><technical_language>This final set start method. LanguageServiceAccessor store Wrapper cached for usage, usages of LS attempt retry works</technical_language>

Target:
public LanguageServerWrapper(@Nullable IProject project, @NonNull LanguageServerDefinition serverDefinition) { this.initialProject = project; this.allWatchedProjects = new HashSet<>(); this.serverDefinition = serverDefinition; this.connectedDocuments = new HashMap<>(); }
Source:
<code>RealmObjectSchema getSchemaForClass(Class<? extends RealmModel> clazz) { RealmObjectSchema classSchema = classToSchema.get(clazz); if (classSchema == null) { Class<? extends RealmModel> originalClass = Util.getOriginalModelClass(clazz); if (originalClass != clazz) { classSchema = classToSchema.get(originalClass); } if (classSchema == null) { Table table = getTable(clazz); classSchema = new RealmObjectSchema(realm, table, columnIndices.getColumnInfo(originalClass).getIndicesMap()); classToSchema.put(originalClass, classSchema); } <START> if (originalClass != clazz) { <END> classToSchema.put(clazz, classSchema); } } return classSchema; }</code><technical_language>i think</technical_language>

Target:
RealmObjectSchema getSchemaForClass(Class<? extends RealmModel> clazz) { RealmObjectSchema classSchema = classToSchema.get(clazz); if (classSchema == null) { Class<? extends RealmModel> originalClass = Util.getOriginalModelClass(clazz); if (isProxyClass(originalClass, clazz)) { classSchema = classToSchema.get(originalClass); } if (classSchema == null) { Table table = getTable(clazz); classSchema = new RealmObjectSchema(realm, table, columnIndices.getColumnInfo(originalClass).getIndicesMap()); classToSchema.put(originalClass, classSchema); } if (isProxyClass(originalClass, clazz)) { classToSchema.put(clazz, classSchema); } } return classSchema; }