auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static boolean isEntityColumn(Method getter) { final boolean isAnnotated = getter.isAnnotationPresent(javax.persistence.Column.class); if (isAnnotated) { return true; } <START> <END> final Class<?> declaringClass = getter.getDeclaringClass(); final Iterable<Class<?>> ascendants = getSuperClassesAndInterfaces(declaringClass); for (Class<?> ascendant : ascendants) { final Optional<Method> optional = getMethod(getter, ascendant); if (optional.isPresent()) { final Method ascendantMethod = optional.get(); if (ascendantMethod.isAnnotationPresent(javax.persistence.Column.class)) { return true; } } } return false; }</code><technical_language>Please remove empty line</technical_language>

Target:
private static boolean isEntityColumn(Method getter) { final boolean isAnnotated = getter.isAnnotationPresent(javax.persistence.Column.class); if (isAnnotated) { return true; } final Class<?> declaringClass = getter.getDeclaringClass(); final Iterable<Class<?>> ascendants = getSuperClassesAndInterfaces(declaringClass); for (Class<?> ascendant : ascendants) { final Optional<Method> optional = getMethod(ascendant, getter); if (optional.isPresent()) { final Method ascendantMethod = optional.get(); if (ascendantMethod.isAnnotationPresent(javax.persistence.Column.class)) { return true; } } } return false; }
Source:
<code>public static boolean validateBinding( ComputedColumnHandle column, String columnName ) { if( column == null ) { return false; } if( columnName == null || columnName.isEmpty() ) { columnName = "[^\\]]+"; } else { <START> columnName = processSpecialCharacters( columnName ); <END> } ExpressionHandle expr = column .getExpressionProperty( ComputedColumn.EXPRESSION_MEMBER ); String expression = expr.getStringExpression( ); if( expression != null ) { if( ExpressionType.JAVASCRIPT.equalsIgnoreCase( expr.getType( ) ) ) { Pattern p = Pattern.compile( "\\[\\s*\\\"" + columnName + "\\\"\\s*\\]" ); return p.matcher( expression ).find( ); } else { Pattern p = Pattern.compile( "\\[\\s*" + columnName + "\\s*\\]" ); return p.matcher( expression ).find( ); } } return false; }</code><technical_language>Validation change column name, check invalid not</technical_language>

Target:
public static boolean validateBinding( ComputedColumnHandle column, String columnName ) { if( column == null ) { return false; } if( columnName == null || columnName.isEmpty() ) { columnName = "[^\\]]+"; } else { columnName = Pattern.quote( columnName ); } ExpressionHandle expr = column .getExpressionProperty( ComputedColumn.EXPRESSION_MEMBER ); String expression = expr.getStringExpression( ); if( expression != null ) { if( ExpressionType.JAVASCRIPT.equalsIgnoreCase( expr.getType( ) ) ) { Pattern p = Pattern.compile( "\\[\\s*\\\"" + columnName + "\\\"\\s*\\]" ); return p.matcher( expression ).find( ); } else { Pattern p = Pattern.compile( "\\[\\s*" + columnName + "\\s*\\]" ); return p.matcher( expression ).find( ); } } return false; }
Source:
<code>private DbPlatformType getJsonType(DbType type, boolean withScale) { DbPlatformType dbType = get(type); <START> if (JHelper.objectSameReference(dbType, JSON_CLOB_PLACEHOLDER)) { <END> return withScale ? get(DbType.VARCHAR) : get(DbType.CLOB); } if (JHelper.objectSameReference(dbType, JSON_BLOB_PLACEHOLDER)) { return get(DbType.BLOB); } if (JHelper.objectSameReference(dbType, JSON_VARCHAR_PLACEHOLDER)) { return get(DbType.VARCHAR); } return get(type); }</code><technical_language>DbType is enum, ==</technical_language>

Target:
private DbPlatformType getJsonType(DbType type, boolean withScale) { DbPlatformType dbType = get(type); if (dbType == JSON_CLOB_PLACEHOLDER) { return withScale ? get(DbType.VARCHAR) : get(DbType.CLOB); } if (dbType == JSON_BLOB_PLACEHOLDER) { return get(DbType.BLOB); } if (dbType == JSON_VARCHAR_PLACEHOLDER) { return get(DbType.VARCHAR); } return get(type); }
Source:
<code>public int getContainerCount() { <START> Optional<String> autoscalingContainerCountValue = Optional.ofNullable(get(JOB_AUTOSIZING_CONTAINER_COUNT)); <END> Optional<String> jobContainerCountValue = Optional.ofNullable(get(JOB_CONTAINER_COUNT)); if (getAutosizingEnabled() && autoscalingContainerCountValue.isPresent()) { return Integer.parseInt(autoscalingContainerCountValue.get()); } else if (jobContainerCountValue.isPresent()) { return Integer.parseInt(jobContainerCountValue.get()); } else { Optional<String> yarnContainerCountValue = Optional.ofNullable(get("yarn.container.count")); if (yarnContainerCountValue.isPresent()) { LOG.warn("Configuration 'yarn.container.count' is deprecated. Please use {}.", JOB_CONTAINER_COUNT); return Integer.parseInt(yarnContainerCountValue.get()); } else { return DEFAULT_JOB_CONTAINER_COUNT; } } }</code><technical_language>please autosizing instead of autoscaling terminology consistent</technical_language>

Target:
public int getContainerCount() { Optional<String> autosizingContainerCountValue = Optional.ofNullable(get(JOB_AUTOSIZING_CONTAINER_COUNT)); Optional<String> jobContainerCountValue = Optional.ofNullable(get(JOB_CONTAINER_COUNT)); if (getAutosizingEnabled() && autosizingContainerCountValue.isPresent()) { return Integer.parseInt(autosizingContainerCountValue.get()); } else if (jobContainerCountValue.isPresent()) { return Integer.parseInt(jobContainerCountValue.get()); } else { Optional<String> yarnContainerCountValue = Optional.ofNullable(get("yarn.container.count")); if (yarnContainerCountValue.isPresent()) { LOG.warn("Configuration 'yarn.container.count' is deprecated. Please use {}.", JOB_CONTAINER_COUNT); return Integer.parseInt(yarnContainerCountValue.get()); } else { return DEFAULT_JOB_CONTAINER_COUNT; } } }
Source:
<code>public void setLabel(String label) throws Exception { if(!PodTemplateUtils.validateLabel(label)) { <START> throw new Exception(String.format("Labels must follow required specs - <LINK_0> - %s", label)); <END> } this.label = label; }</code><technical_language>IllegalArgumentException</technical_language>

Target:
public void setLabel(String label) { this.label = label; }
Source:
<code>static public void reportException(String name, Logger logger, PrintStream stderr, Throwable e) { final String errorMsg = String.format("Unexpected exception occurred while performing %s command.", name); stderr.println(); <START> stderr.println("ERROR: "+errorMsg); <END> logger.log(Level.WARNING,errorMsg,e); Functions.printStackTrace(e,stderr); }</code><technical_language>suggestion stderr.println("ERROR: " + errorMsg);</technical_language>

Target:
static public void reportException(String name, Logger logger, PrintStream stderr, Throwable e) { final String errorMsg = String.format("Unexpected exception occurred while performing %s command.", name); logAndPrintError(e, errorMsg, errorMsg, Level.WARNING); Functions.printStackTrace(e, stderr); }
Source:
<code>private static void printHistory(CommandSender sender, FName[] oldNames) { if (oldNames.length == 1) { sender.sendMessage(ChatColor.GREEN + oldNames[0].getName() + ChatColor.GOLD + " has never changed their name."); } else { sender.sendMessage(ChatColor.GOLD + "Original name: " + ChatColor.GREEN + oldNames[0].getName()); for (int i = 1; i < oldNames.length; i++) { <START> DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); <END> Date date = new Date(oldNames[i].changedToAt); String formattedDate = df.format(date); sender.sendMessage(ChatColor.BLUE + formattedDate + ChatColor.GOLD + " changed to " + ChatColor.GREEN + oldNames[i].getName()); } } }</code><technical_language>a field, static final</technical_language>

Target:
private static void printHistory(CommandSender sender, FName[] oldNames) { if (oldNames.length == 1) { FSync.playerMsg(sender, ChatColor.GREEN + oldNames[0].getName() + ChatColor.GOLD + " has never changed their name."); return; } FSync.playerMsg(sender, ChatColor.GOLD + "Original name: " + ChatColor.GREEN + oldNames[0].getName()); for (int i = 1; i < oldNames.length; i++) { Date date = new Date(oldNames[i].getChangedToAt()); String formattedDate = df.format(date); FSync.playerMsg(sender, ChatColor.BLUE + formattedDate + ChatColor.GOLD + " changed to " + ChatColor.GREEN + oldNames[i].getName()); } }
Source:
<code>public void removeAll() throws TckRepositoryException { final EntityManager manager = managerProvider.get(); <START> manager.createQuery("SELECT stack FROM Stack stack", StackImpl.class).getResultList().forEach(manager::remove); <END> manager.createQuery("DELETE FROM \"User\"").executeUpdate(); }</code><technical_language>named "Stack.getAll" query here</technical_language>

Target:
public void removeAll() throws TckRepositoryException { final EntityManager manager = managerProvider.get(); manager.createNamedQuery("Stack.getAll", StackImpl.class).getResultList().forEach(manager::remove); manager.createQuery("DELETE FROM \"User\"").executeUpdate(); }
Source:
<code>public void doOnTerminateComplete() { final AtomicBoolean atomicBoolean = new AtomicBoolean(); Maybe.empty().doOnTerminate(new Action() { @Override public void run() { atomicBoolean.set(true); } }) <START> .subscribe(); <END> assertTrue(atomicBoolean.get()); }</code><technical_language>test().assertResult(1); instead</technical_language>

Target:
public void doOnTerminateComplete() { final AtomicBoolean atomicBoolean = new AtomicBoolean(); Maybe.empty().doOnTerminate(new Action() { @Override public void run() { atomicBoolean.set(true); } }) .test() .assertResult(); assertTrue(atomicBoolean.get()); }
Source:
<code>private Mono<Void> sendInternal(Flux<EventData> events, SendOptions options) { final String partitionKey = options.partitionKey(); verifyPartitionKey(partitionKey); return sendLinkMono.flatMap(link -> { final AtomicReference<Context> sendSpanContext = new AtomicReference<>(Context.NONE); return link.getLinkSize() .flatMap(size -> { final int batchSize = size > 0 ? size : MAX_MESSAGE_LENGTH_BYTES; final BatchOptions batchOptions = new BatchOptions() .partitionKey(partitionKey) .maximumSizeInBytes(batchSize); return events.map(eventData -> { Context parentContext = eventData.context(); Context entityContext = parentContext.addData(entityPath, link.getEntityPath()); <START> sendSpanContext.set(TraceUtil.start("send", entityContext.addData(hostName, link.getHostname()))); <END> return setSpanContext(eventData, parentContext); }).collect(new EventDataCollector(batchOptions, 1, () -> link.getErrorContext())); }) .flatMap(list -> sendInternal(Flux.fromIterable(list))) .doOnEach(signal -> TraceUtil.endTracingSpan(sendSpanContext.get(), signal)); }); }</code><technical_language>static method start hard unit test</technical_language>

Target:
private Mono<Void> sendInternal(Flux<EventData> events, SendOptions options) { final String partitionKey = options.partitionKey(); verifyPartitionKey(partitionKey); if (tracerProvider.isEnabled()) { return sendInternalTracingEnabled(events, partitionKey); } else { return sendInternalTracingDisabled(events, partitionKey); } }
Source:
<code>public void testBadInputs() { try { parseArgs("-p prefix -s start -e end"); Assert.fail(); } catch (IllegalArgumentException e) { } try { <START> parseArgs("-r exactRow -s start"); <END> Assert.fail(); } catch (IllegalArgumentException e) { } try { parseArgs("-p prefix -e end"); Assert.fail(); } catch (IllegalArgumentException e) { } try { parseArgs("-r exactRow -e end -s start"); Assert.fail(); } catch (IllegalArgumentException e) { } try { parseArgs("-p prefix -r exactRow"); Assert.fail(); } catch (IllegalArgumentException e) { } try { parseArgs("-c col1,cf:cq:oops"); Assert.fail(); } catch (IllegalArgumentException e) { } }</code><technical_language>a loop for -r opt, -p,-e,-s, -s -e. a loop for -p opt. This try combos, I current test misses some combos</technical_language>

Target:
public void testBadInputs() { for (String extraArg : new String[]{"-r exactRow", "-s start", "-e end", "-s start -e end"}) { try { parseArgs("-p prefix "+extraArg); Assert.fail(); } catch (IllegalArgumentException e) { } } for (String extraArg : new String[]{"-p prefix", "-s start", "-e end", "-s start -e end"}) { try { parseArgs("-r exactRow "+extraArg); Assert.fail(); } catch (IllegalArgumentException e) { } } try { parseArgs("-c col1,cf:cq:oops"); Assert.fail(); } catch (IllegalArgumentException e) { } }
Source:
<code>private void testInviteInstructorAction() { ______TS("success: invite an uregistered instructor"); <START> courseEditPage.clickInviteInstructorLink(4); <END> courseEditPage.verifyStatus(Const.StatusMessages.COURSE_REMINDER_SENT_TO + "InsCrsEdit.newInstr@gmail.tmt"); }</code><technical_language>super clear, instead of 4, int unregisteredInstructorId = 4 for 1</technical_language>

Target:
private void testInviteInstructorAction() { ______TS("success: invite an uregistered instructor"); int unregisteredInsturctorIndex = 4; courseEditPage.clickInviteInstructorLink(unregisteredInsturctorIndex); courseEditPage.verifyStatus(Const.StatusMessages.COURSE_REMINDER_SENT_TO + "InsCrsEdit.newInstr@gmail.tmt"); }
Source:
<code>public void testCorrectBehaviourOfGetTokenId() { final String id = "EOF"; <START> assertEquals(1, TokenUtils.getTokenId(id)); <END> }</code><technical_language>Replace 1 TokenTypes.EOF</technical_language>

Target:
public void testCorrectBehaviourOfGetTokenId() { final String id = "EOF"; assertEquals(TokenTypes.EOF, TokenUtils.getTokenId(id)); }
Source:
<code>public static String[] decodeFieldsFromUniqueId(final String id) { final String[] parts = checkNotNull(id, "id").split("/"); <START> return parts; <END> }</code><technical_language>return checkNotNull(id, "id").split("/");</technical_language>

Target:
public static String[] decodeFieldsFromUniqueId(final String id) { return checkNotNull(id, "id").split("/"); }
Source:
<code>public Object unmarshal(final Exchange exchange, final InputStream inputStream) throws Exception { <START> if (supportEmptyDirectory) { <END> exchange.getIn().setHeader("unzipEmptyDirectorySupported", true); } else { exchange.getIn().setHeader("unzipEmptyDirectorySupported", false); } if (usingIterator) { return new ZipIterator(exchange.getIn()); } else { ZipInputStream zis = new ZipInputStream(inputStream); OutputStreamBuilder osb = OutputStreamBuilder.withExchange(exchange); try { ZipEntry entry = zis.getNextEntry(); if (entry != null) { exchange.getOut().setHeader(FILE_NAME, entry.getName()); IOHelper.copy(zis, osb); } entry = zis.getNextEntry(); if (entry != null) { throw new IllegalStateException("Zip file has more than 1 entry."); } return osb.build(); } finally { IOHelper.close(zis, osb); } } }</code><technical_language>a single line more beautiful :) exchange.getIn().setHeader("unzipEmptyDirectorySupported", isSupportEmptyDirectory());</technical_language>

Target:
public Object unmarshal(final Exchange exchange, final InputStream inputStream) throws Exception { if (usingIterator) { ZipIterator zipIterator = new ZipIterator(exchange.getIn()); zipIterator.setAllowEmptyDirectory(allowEmptyDirectory); return zipIterator; } else { ZipInputStream zis = new ZipInputStream(inputStream); OutputStreamBuilder osb = OutputStreamBuilder.withExchange(exchange); try { ZipEntry entry = zis.getNextEntry(); if (entry != null) { exchange.getOut().setHeader(FILE_NAME, entry.getName()); IOHelper.copy(zis, osb); } entry = zis.getNextEntry(); if (entry != null) { throw new IllegalStateException("Zip file has more than 1 entry."); } return osb.build(); } finally { IOHelper.close(zis, osb); } } }
Source:
<code>private void flipCard() { currentCard = isCradFront() ? cradBack : cradFront; <START> langCode = isCradFront() ? <END> Settings.selectedLanguageCode : Settings.nativeTongue; loadWordAndShow(serverIDs[currentIndex]); AnimationFactory.flipTransition(viewAnimator, FlipDirection.LEFT_RIGHT); }</code><technical_language>I a trick here. switch langCode user flips card. So, target data is downloaded server. shown card's language is downloaded. produce a minor issue user flip another language, disconnect internet press previous word. He/she error dialog continue downloaded card. download selectedLanguage nativeTongue time in future. file this a follow-up bug</technical_language>

Target:
private void flipCard() { currentCard = isCradFront() ? cardBack : cardFront; langCode = isCradFront() ? Settings.selectedLanguageCode : Settings.nativeTongue; loadWordAndShow(serverIDs[currentIndex]); AnimationFactory.flipTransition(viewAnimator, FlipDirection.LEFT_RIGHT, 250); }
Source:
<code>public String getAttribute(Attribute attribute) { if (attribute == null) { return null; } <START> ViaAPI api = Via.getAPI(); <END> if (attribute.startsWith("viaversion")) { return new ElementTag(api.getPlayerVersion(player.getOfflinePlayer().getUniqueId())) .getAttribute(attribute.fulfill(1)); } return null; }</code><technical_language>This attribute if block, outside</technical_language>

Target:
public String getAttribute(Attribute attribute) { if (attribute == null) { return null; } if (attribute.startsWith("viaversion")) { ViaAPI api = Via.getAPI(); return new ElementTag(api.getPlayerVersion(player.getOfflinePlayer().getUniqueId())) .getAttribute(attribute.fulfill(1)); } return null; }
Source:
<code>public FNatsServer build() { if (executorService == null) { this.executorService = new ThreadPoolExecutor( <START> workerCount, workerCount, 30, TimeUnit.SECONDS, <END> new ArrayBlockingQueue<>(queueLength), new BlockingRejectedExecutionHandler()); } return new FNatsServer(conn, processor, protoFactory, subjects, queue, highWatermark, executorService); }</code><technical_language>Update [doc](<LINK_0></technical_language>

Target:
public FNatsServer build() { if (executorService == null) { this.executorService = new ThreadPoolExecutor( workerCount, workerCount, 0, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(queueLength), new BlockingRejectedExecutionHandler()); } return new FNatsServer(conn, processor, protoFactory, subjects, queue, highWatermark, executorService); }
Source:
<code>public Operation exec(Prolog engine) throws PrologException { engine.setB0(); Term a1 = arg1.dereference(); Term a2 = arg2.dereference(); Term a3 = arg3.dereference(); PrologEnvironment env = (PrologEnvironment) engine.control; final PatchSet.Id id = StoredValues.PATCH_SET_ID.get(engine); PatchSetInfoFactory psiFactory = env.getInjector().getInstance(PatchSetInfoFactory.class); Term idTerm; Term nameTerm = Prolog.Nil; Term emailTerm = Prolog.Nil; try { <START> UserIdentity committer = psiFactory.get(id).getCommitter(); <END> Account.Id committerId = committer.getAccount(); if (committerId == null) { idTerm = SymbolTerm.intern("anonymous"); } else { idTerm = new IntegerTerm(committerId.get()); } String name = committer.getName(); if (name != null && !name.equals("")) { nameTerm = SymbolTerm.intern(name); } String email = committer.getEmail(); if (email != null && !email.equals("")) { emailTerm = SymbolTerm.intern(email); } } catch (PatchSetInfoNotAvailableException err) { throw new JavaException(this, 1, err); } if (!a1.unify(new StructureTerm(user, idTerm), engine.trail)) { return engine.fail(); } if (!a2.unify(nameTerm, engine.trail)) { return engine.fail(); } if (!a3.unify(emailTerm, engine.trail)) { return engine.fail(); } return cont; }</code><technical_language>this code is similar PRED_commit_author_3, define a common base class: AbstractCommitUserIdentityPredicate of work. subclass implement a method return base class correct identity PatchSetInfo</technical_language>

Target:
public Operation exec(Prolog engine) throws PrologException { engine.setB0(); PatchSetInfo psInfo = StoredValues.PATCH_SET_INFO.get(engine); UserIdentity committer = psInfo.getCommitter(); return exec(engine, committer); }
Source:
<code>public void testValidDoubleQuotedQuerySpecificChars() { String query = "repository: \"releases#1\""; AqlQueryParser aqlParser = new AqlQueryParser(query); Map<Pair<Integer, Integer>, String> errorMap = null; try { aqlParser.parseQuery(); } catch (QueryParserException e) { <START> errorMap = aqlParser.getErrors(); <END> } logger.info(String.format("Query [%s] parse tree:\n[%s]", query, aqlParser)); assertFalse(aqlParser.hasErrors()); assertNull(errorMap); }</code><technical_language>expect exceptions here, need catch</technical_language>

Target:
public void testValidDoubleQuotedQuerySpecificChars() { String query = "repository: \"releases#1\""; AqlQueryParser aqlParser = new AqlQueryParser(query); aqlParser.parseQuery(); logger.info(String.format("Query [%s] parse tree:\n[%s]", query, aqlParser)); assertFalse(aqlParser.hasErrors()); }
Source:
<code>private void build() { if (slotToBuild != null) { int destX = (int)Math.floor(destination.x); int destY = (int)Math.floor(destination.y); int destZ = (int)Math.floor(destination.z); Block block = context.world().getBlock(destX, destY, destZ); <START> int meta = context.world().getBlockMetadata(destX, destY, destZ); <END> context.world().playAuxSFXAtEntity(null, 2001, destX, destY, destZ, Block.getIdFromBlock(block) + (meta << 12)); if (BlockUtil.isToughBlock(context.world(), destX, destY, destZ)) { BlockUtil.breakBlock(context.world(), destX, destY, destZ, BuildCraftBuilders.fillerLifespanTough); } else { BlockUtil.breakBlock(context.world(), destX, destY, destZ, BuildCraftBuilders.fillerLifespanNormal); } slotToBuild.writeToWorld(context); } }</code><technical_language>Boy, a stupid assumption java conversion float int. pretty other places too. Thanks for fix here</technical_language>

Target:
private void build() { if (slotToBuild != null) { int destX = (int)Math.floor(destination.x); int destY = (int)Math.floor(destination.y); int destZ = (int)Math.floor(destination.z); Block block = context.world().getBlock(destX, destY, destZ); int meta = context.world().getBlockMetadata(destX, destY, destZ); context.world().playAuxSFXAtEntity(null, 2001, destX, destY, destZ, Block.getIdFromBlock(block) + (meta << 12)); slotToBuild.writeToWorld(context); } }
Source:
<code>public String getPackageName() { GoFileStub stub = getStub(); if (stub != null) return stub.getPackageName(); GoPackageClause packageClause = getPackage(); if (packageClause != null) { PsiElement packageIdentifier = packageClause.getIdentifier(); if (packageIdentifier != null) { String name = packageIdentifier.getText().trim(); <START> if (GoTestFinder.isTestFile(this)) { <END> name = StringUtil.trimEnd(name, GoConstants.TEST_SUFFIX); } return name; } } return null; }</code><technical_language>1. rewritten ternary operator (not required) 2. case isTestFile(file)=false package name ends _test is covered test 3. case isTestFile(file)=true package name end _test is covered test</technical_language>

Target:
public String getPackageName() { GoFileStub stub = getStub(); if (stub != null) return stub.getPackageName(); GoPackageClause packageClause = getPackage(); if (packageClause != null) { PsiElement packageIdentifier = packageClause.getIdentifier(); if (packageIdentifier != null) { String name = packageIdentifier.getText().trim(); return GoTestFinder.isTestFile(this) ? StringUtil.trimEnd(name, GoConstants.TEST_SUFFIX) : name; } } return null; }
Source:
<code>public static String getTokenServerEncodedUrl() { <START> return getMetadataServerUrl() + "/computeMetadata/v1/instance/service-accounts/default/token"; <END> }</code><technical_language>this rely getMetadataServerUrl(DefaultCredentialsProvider)? This implementation changed original call order OAuth2Utils.java slightly getMetadataServerUrl() relied calling getMetadataServerUrl(DefaultCredentialsProvider provider) there</technical_language>

Target:
public static String getTokenServerEncodedUrl() { return getTokenServerEncodedUrl(DefaultCredentialsProvider.DEFAULT); }
Source:
<code>public MishrasGroundbreaker(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}"); <START> Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new MishrasGroundbreakerToken(), false, true, Duration.EndOfGame), new TapSourceCost()); <END> ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetLandPermanent()); this.addAbility(ability); }</code><technical_language>Custom instead of EndOfGame, add unnecessary text</technical_language>

Target:
public MishrasGroundbreaker(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new MishrasGroundbreakerToken(), false, true, Duration.Custom), new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetLandPermanent()); this.addAbility(ability); }
Source:
<code>public ProjectImports load(final Path path) { try { final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); if (!ioService.exists(nioPath)) { saveProjectImports(path); } final String content = ioService.readAllString(Paths.convert(path)); final ProjectImports projectImports = projectConfigurationContentHandler.toModel(content); final Import javaLangNumber = new Import(java.lang.Number.class.getName()); <START> if (projectImports.getImports().getImports().stream().filter(anImport -> anImport != null).noneMatch(anImport -> anImport.equals(javaLangNumber))) { <END> projectImports.getImports().addImport(javaLangNumber); } return projectImports; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } }</code><technical_language>If Objects.equals(), able get rid of filter()</technical_language>

Target:
public ProjectImports load(final Path path) { try { final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); if (!ioService.exists(nioPath)) { saveProjectImports(path); } final String content = ioService.readAllString(Paths.convert(path)); final ProjectImports projectImports = projectConfigurationContentHandler.toModel(content); final Import javaLangNumber = new Import(Number.class); if (projectImports.getImports().getImports().stream().noneMatch(anImport -> Objects.equals(anImport, javaLangNumber))) { projectImports.getImports().addImport(javaLangNumber); } return projectImports; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } }
Source:
<code>public IndexedInts getBitmapIndex(String dimension, int dictId) { if (dictId >= 0) { final Indexed<String> dimValues = getDimValueLookup(dimension); <START> String value = Strings.nullToEmpty(dimValues.get(dictId)); <END> return getBitmapIndex(dimension, value); } else { return new EmptyIndexedInts(); } }</code><technical_language>is a reason call nullToEmpty here? this artifact of wrapping DimDim NullValueConverterDimDim, getBitmapIndex relies actual values stored in DimDim, values returned wrapper, correct</technical_language>

Target:
public IndexedInts getBitmapIndex(String dimension, int dictId) { if (dictId >= 0) { final Indexed<String> dimValues = getDimValueLookup(dimension); String value = Strings.nullToEmpty(dimValues.get(dictId)); return getBitmapIndex(dimension, value); } else { return EmptyIndexedInts.EMPTY_INDEXED_INTS; } }
Source:
<code>public static Properties loadProperties(Properties properties, File file) throws IOException { <START> return loadProperties(properties, new FileInputStream(file)); <END> }</code><technical_language>closing input stream</technical_language>

Target:
public static Properties loadProperties(Properties properties, File file) throws IOException { try (InputStream propertiesStream = new FileInputStream(file)) { return loadProperties(properties, propertiesStream); } }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, Intent resultData) { <START> if (requestCode == REQUEST_CODE_RESTORE && resultCode == RESULT_OK && resultData != null) { <END> Uri uri = resultData.getData(); restoreFrom(uri); } else if (requestCode == REQUEST_CODE_BACKUP_DOCUMENT && resultCode == RESULT_OK && resultData != null) { Uri uri = resultData.getData(); backupToDocument(uri); } }</code><technical_language>guard clause? if(resultCode != RESULT_OK || resultData == null) return; Uri uri = ... if(requestCode == ..</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, Intent resultData) { if (resultCode != RESULT_OK || resultData == null) { return; } Uri uri = resultData.getData(); if (requestCode == REQUEST_CODE_RESTORE) { restoreFrom(uri); } else if (requestCode == REQUEST_CODE_BACKUP_DOCUMENT) { backupToDocument(uri); } }
Source:
<code>private String getSanitizedDefaultGroupId(final String proposedGroupId) { <START> return proposedGroupId != null ? proposedGroupId.replaceAll("[^A-Za-z0-9_\\-.]", <END> "") : proposedGroupId; }</code><technical_language>keeping REGEX in a constant... a personal preference, a suggestion</technical_language>

Target:
private String getSanitizedDefaultGroupId(final String proposedGroupId) { return proposedGroupId != null ? proposedGroupId.replaceAll(PROPOSED_GROUP_ID_REGEX, "") : proposedGroupId; }
Source:
<code><START> static ISideEffectFactory createFactory() { <END> ICompositeSideEffect compositeSideEffect = ICompositeSideEffect.create(); return new SideEffectFactory(compositeSideEffect::add); }</code><technical_language>Oh, I thinking 0-argument version create ICompositeSideEffect all. 0-arg obtain ISideEffectFactory static methods ISideEffect. suggest calling default constructor SideEffectFactory here</technical_language>

Target:
static ISideEffectFactory createFactory() { return new SideEffectFactory(); }
Source:
<code><START> public void validate(JobParameters parameters) throws JobParametersInvalidException { <END> ParametersValidatorUtil.checkDirectory(parameters.getString(JobParametersNames.APP_VEP_CACHE_PATH), JobParametersNames.APP_VEP_CACHE_PATH); }</code><technical_language>directory readable</technical_language>

Target:
public void validate(JobParameters parameters) throws JobParametersInvalidException { ParametersValidatorUtil.checkDirectoryExists(parameters.getString(JobParametersNames.APP_VEP_CACHE_PATH), JobParametersNames.APP_VEP_CACHE_PATH); ParametersValidatorUtil.checkFileIsReadable(parameters.getString(JobParametersNames.APP_VEP_CACHE_PATH), JobParametersNames.APP_VEP_CACHE_PATH); }
Source:
<code>public void getSurveyAllVersionsIncludeDeleted() { <START> createSurvey(new SimpleSurvey("First Survey")); END> Survey versionedSurvey = createSurvey(new SimpleSurvey("Second Survey")); versionSurvey(versionedSurvey); versionSurvey(versionedSurvey); Survey finalVersion = versionSurvey(versionedSurvey); long lastCreatedOnTime = finalVersion.getCreatedOn(); List<Survey> surveyVersions = surveyDao.getSurveyAllVersions(TEST_STUDY, versionedSurvey.getGuid(), true); for (Survey survey : surveyVersions) { assertEquals("All surveys versions of one survey", versionedSurvey.getGuid(), survey.getGuid()); } assertEquals("First survey is the most recently versioned", lastCreatedOnTime, surveyVersions.get(0).getCreatedOn()); assertNotEquals("createdOn updated", lastCreatedOnTime, versionedSurvey.getCreatedOn()); }</code><technical_language>this test include deleted survey versions verify includeDeleted flag works</technical_language>

Target:
public void getSurveyAllVersionsIncludeDeleted() { createSurvey(new SimpleSurvey("First Survey")); Survey versionedSurvey = createSurvey(new SimpleSurvey("Second Survey")); versionSurvey(versionedSurvey); versionSurvey(versionedSurvey); Survey finalVersion = versionSurvey(versionedSurvey); surveyDao.deleteSurvey(versionedSurvey); long lastCreatedOnTime = finalVersion.getCreatedOn(); List<Survey> surveyVersions = surveyDao.getSurveyAllVersions(TEST_STUDY, versionedSurvey.getGuid(), true); assertTrue("One survey version is deleted", surveyVersions.stream().anyMatch(Survey::isDeleted)); assertTrue("All surveys versions of one survey", surveyVersions.stream().allMatch((survey) -> survey.getGuid().equals(versionedSurvey.getGuid()))); assertEquals("First survey is the most recently versioned", lastCreatedOnTime, surveyVersions.get(0).getCreatedOn()); assertNotEquals("createdOn updated", lastCreatedOnTime, versionedSurvey.getCreatedOn()); }
Source:
<code>public EurekaServerResolver build() { if (serviceSelector == null) { serviceSelector = ServiceSelector.selectBy() .serviceLabel(Names.DISCOVERY).protocolType(ProtocolType.IPv4).publicIp(true) .or() .serviceLabel(Names.DISCOVERY).protocolType(ProtocolType.IPv4); } if (loadBalancerBuilder == null) { loadBalancerBuilder = new DefaultLoadBalancerBuilder<>(null); } if (bootstrapResolver == null) { throw new IllegalStateException("BootstrapResolver property not set"); } if (transportConfig == null) { transportConfig = new BasicEurekaTransportConfig.Builder().build(); } if (clientMetricFactory == null) { clientMetricFactory = EurekaClientMetricFactory.clientMetrics(); } if (registryMetricFactory == null) { registryMetricFactory = EurekaRegistryMetricFactory.registryMetrics(); } EurekaClientBuilder eurekaClientBuilder = EurekaClientBuilder.newBuilder() .withMetricFactory(clientMetricFactory) .withMetricFactory(registryMetricFactory) <START> .withWriteServerResolver(ServerResolvers.just("localhost", 0)) END> .withReadServerResolver(bootstrapResolver) .withTransportConfig(transportConfig); return new EurekaServerResolver(eurekaClientBuilder, readServerInterest, serviceSelector, loadBalancerBuilder); }</code><technical_language>part of client reorganisation, final EurekaClient provided a wrapper of a RegistrationClient InterestClient. is available, a raw InterestClient here</technical_language>

Target:
public EurekaServerResolver build() { if (serviceSelector == null) { serviceSelector = ServiceSelector.selectBy() .serviceLabel(Names.DISCOVERY).protocolType(ProtocolType.IPv4).publicIp(true) .or() .serviceLabel(Names.DISCOVERY).protocolType(ProtocolType.IPv4); } if (loadBalancerBuilder == null) { loadBalancerBuilder = new DefaultLoadBalancerBuilder<>(null); } if (bootstrapResolver == null) { throw new IllegalStateException("BootstrapResolver property not set"); } if (transportConfig == null) { transportConfig = new BasicEurekaTransportConfig.Builder().build(); } if (clientMetricFactory == null) { clientMetricFactory = EurekaClientMetricFactory.clientMetrics(); } if (registryMetricFactory == null) { registryMetricFactory = EurekaRegistryMetricFactory.registryMetrics(); } EurekaClientBuilder eurekaClientBuilder = EurekaClientBuilder.newBuilder() .withClientMetricFactory(clientMetricFactory) .withRegistryMetricFactory(registryMetricFactory) .withWriteServerResolver(ServerResolvers.just("localhost", 0)) .withReadServerResolver(bootstrapResolver) .withTransportConfig(transportConfig); return new EurekaServerResolver(eurekaClientBuilder, readServerInterest, serviceSelector, loadBalancerBuilder); }
Source:
<code>private static boolean responseShouldBeProtected(Exchange exchange, Response response) throws OSException{ Request request = exchange.getCurrentRequest(); OptionSet options = request.getOptions(); <START> if(exchange.getCryptographicContextID() == null){ <END> if(response.getOptions().hasObserve() && request.getOptions().hasObserve()){ if (options.hasOption(OptionNumberRegistry.OSCORE)){ String uri = request.getURI(); OSCoreCtxDB db = HashMapCtxDB.getInstance(); OSCoreCtx ctx = null; try { ctx = db.getContext(uri); } catch (OSException e) { LOGGER.severe("Error when re-creating exchange at OSCORE level"); throw new OSException("Error when re-creating exchange at OSCORE level"); } exchange.setCryptographicContextID(ctx.getRecipientId()); } } } return exchange.getCryptographicContextID() != null; }</code><technical_language>whitespace</technical_language>

Target:
private static boolean responseShouldBeProtected(Exchange exchange, Response response) throws OSException { Request request = exchange.getCurrentRequest(); OptionSet options = request.getOptions(); if (exchange.getCryptographicContextID() == null) { if (response.getOptions().hasObserve() && request.getOptions().hasObserve()) { if (options.hasOscore()) { String uri = request.getURI(); OSCoreCtxDB db = HashMapCtxDB.getInstance(); OSCoreCtx ctx = null; try { ctx = db.getContext(uri); } catch (OSException e) { LOGGER.error("Error when re-creating exchange at OSCORE level"); throw new OSException("Error when re-creating exchange at OSCORE level"); } exchange.setCryptographicContextID(ctx.getRecipientId()); } } } return exchange.getCryptographicContextID() != null; }
Source:
<code><START> public ObjectPropertyTemplateModel call() throws Exception { <END> ObjectPropertyTemplateModel tm = ObjectPropertyTemplateModel.getObjectPropertyTemplateModel( op, subject, vreq, editing, populatedObjectPropertyList); if (!tm.isEmpty() || (editing && !tm.getAddUrl().isEmpty())) { List<Map<String, String>> l = tm.getStatementData(); } return tm; }</code><technical_language>Exception thrown, throws removed</technical_language>

Target:
public ObjectPropertyTemplateModel call() { ObjectPropertyTemplateModel tm = ObjectPropertyTemplateModel.getObjectPropertyTemplateModel(op, subject, vreq, editing, populatedObjectPropertyList); if (!tm.isEmpty() || (editing && !tm.getAddUrl().isEmpty())) { tm.getStatementData(); } return tm; }
Source:
<code>private static RefFormat computeRefFormat(String ref) { RefFormat result = RefFormat.INTERNAL; ref = mungedRef(ref); if (ref.startsWith("http:") || ref.startsWith("https:")) { result = RefFormat.URL; } else if (ref.startsWith("#/")) { result = RefFormat.INTERNAL; } else if (ref.startsWith(".") || ref.startsWith("/")) { result = RefFormat.RELATIVE; } <START> <END> return result; }</code><technical_language>need of new line</technical_language>

Target:
private static RefFormat computeRefFormat(String ref) { RefFormat result = RefFormat.INTERNAL; if (ref.startsWith("http:") || ref.startsWith("https:")) { result = RefFormat.URL; } else if (ref.startsWith("#/")) { result = RefFormat.INTERNAL; } else if (ref.startsWith(".") || ref.startsWith("/")) { result = RefFormat.RELATIVE; }else if (!ref.contains(":") && !ref.startsWith("#") && !ref.startsWith("/")&& ref.lastIndexOf(".") > 0) { result = RefFormat.RELATIVE; } return result; }
Source:
<code>protected EObject getEditedEObject() { int columnIndex = this.layerCell.getColumnIndex(); int rowIndex = this.layerCell.getRowIndex(); Object row = this.elementProvider.getRowElement(rowIndex); Object column = this.elementProvider.getColumnElement(columnIndex); row = AxisUtils.getRepresentedElement(row); column = AxisUtils.getRepresentedElement(column); Element editedElement = null; if (row instanceof Element && column instanceof EStructuralFeature) { <START> if (((EStructuralFeature) column).getEType() <END> .equals(UMLPackage.Literals.VALUE_SPECIFICATION)) { editedElement = (Element) row; } } return editedElement; }</code><technical_language>== operator constant element operand</technical_language>

Target:
protected EObject getEditedEObject() { int columnIndex = this.layerCell.getColumnIndex(); int rowIndex = this.layerCell.getRowIndex(); Object row = this.elementProvider.getRowElement(rowIndex); Object column = this.elementProvider.getColumnElement(columnIndex); row = AxisUtils.getRepresentedElement(row); column = AxisUtils.getRepresentedElement(column); Element editedElement = null; if (row instanceof Element && column instanceof EStructuralFeature) { if (UMLPackage.Literals.VALUE_SPECIFICATION == ((EStructuralFeature) column) .getEType()) { editedElement = (Element) row; } } return editedElement; }
Source:
<code>public static TrafficClass fromNameOrValue(String tcName) { int tcParsed = -1; try { tcParsed = Integer.parseInt(tcName); } catch (NumberFormatException e){ } <START> for(TrafficClass t : TrafficClass.values()) { <END> if(t.toString().equalsIgnoreCase(tcName) || t.value == tcParsed) { return t; } } return getDefault(); }</code><technical_language>Whitespace language constructs (if, for) opening parens, please</technical_language>

Target:
public static TrafficClass fromNameOrValue(String tcName) { int tcParsed = -1; try { tcParsed = Integer.parseInt(tcName); } catch (NumberFormatException e){ } for (TrafficClass t : TrafficClass.values()) { if (t.toString().equalsIgnoreCase(tcName) || t.value == tcParsed) { return t; } } throw new IllegalArgumentException(); }
Source:
<code>public static void refreshValidProjects(IProject[] projects, boolean delete, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, CoreText.ProjectUtil_refreshingProjects, projects.length); for (IProject p : projects) { if (subMonitor.isCanceled()) break; IPath projectLocation = p.getLocation(); if (projectLocation == null) continue; <START> String projectFilePath = projectLocation .append(IProjectDescription.DESCRIPTION_FILE_NAME) .toOSString(); File projectFile = new File(projectFilePath); <END> if (projectFile.exists()) p.refreshLocal(IResource.DEPTH_INFINITE, subMonitor.newChild(1)); else if (delete) p.delete(false, true, subMonitor.newChild(1)); else closeMissingProject(p, projectFile, subMonitor.newChild(1)); } }</code><technical_language>get done monitor changes. internal clean-up needed a bug report, it</technical_language>

Target:
public static void refreshValidProjects(IProject[] projects, boolean delete, IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, CoreText.ProjectUtil_refreshingProjects, projects.length); for (IProject p : projects) { if (progress.isCanceled()) break; IPath projectLocation = p.getLocation(); if (projectLocation == null) { progress.worked(1); continue; } String projectFilePath = projectLocation .append(IProjectDescription.DESCRIPTION_FILE_NAME) .toOSString(); File projectFile = new File(projectFilePath); if (projectFile.exists()) p.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); else if (delete) p.delete(false, true, progress.newChild(1)); else closeMissingProject(p, projectFile, progress.newChild(1)); } }
Source:
<code><START> protected static void batchRemoveDocuments(CoreSession adminSession, IterableQueryResult results) { <END> String rootDocumentId = adminSession.getRootDocument().getId(); List<DocumentRef> ids = new ArrayList<>(); for (Map<String, Serializable> result : results) { String id = (String) result.get("ecm:uuid"); if (id.equals(rootDocumentId)) { continue; } ids.add(new IdRef(id)); if (ids.size() >= 100) { batchRemoveDocuments(adminSession, ids); ids.clear(); } } if (!ids.isEmpty()) { batchRemoveDocuments(adminSession, ids); } }</code><technical_language>static</technical_language>

Target:
protected void batchRemoveDocuments(CoreSession adminSession, IterableQueryResult results) { String rootDocumentId = adminSession.getRootDocument().getId(); List<DocumentRef> ids = new ArrayList<>(); for (Map<String, Serializable> result : results) { String id = (String) result.get("ecm:uuid"); if (id.equals(rootDocumentId)) { continue; } ids.add(new IdRef(id)); if (ids.size() >= 100) { batchRemoveDocuments(adminSession, ids); ids.clear(); } } if (!ids.isEmpty()) { batchRemoveDocuments(adminSession, ids); } }
Source:
<code>public void testLogicalSlotCancelsPhysicalSlotRequestAndRemovesSharedSlot() { testLogicalSlotRequestCancellation( true, (context, assignment) -> { context.getAllocator().cancel(assignment.getExecutionVertexId()); try { assignment.getLogicalSlotFuture().get(); <START> fail("THe logical future must finish with the cancellation exception"); <END> } catch (InterruptedException | ExecutionException e) { assertThat(e.getCause(), instanceOf(CancellationException.class)); } }); }</code><technical_language>typo: -></technical_language>

Target:
public void testLogicalSlotCancelsPhysicalSlotRequestAndRemovesSharedSlot() { testLogicalSlotRequestCancellation( true, (context, assignment) -> { context.getAllocator().cancel(assignment.getExecutionVertexId()); try { assignment.getLogicalSlotFuture().get(); fail("The logical future must finish with the cancellation exception"); } catch (InterruptedException | ExecutionException e) { assertThat(e.getCause(), instanceOf(CancellationException.class)); } }); }
Source:
<code>public boolean equals(Object o) { <START> return o == this || o instanceof PreparedEvent && equalTo((NotifiedEvent) o); <END> }</code><technical_language>o instanceof NotifiedEvent ?</technical_language>

Target:
public boolean equals(Object o) { return o == this || o instanceof NotifiedEvent && equalTo((NotifiedEvent) o); }
Source:
<code>public static boolean policyNeedsUpdate(IndexingPolicy existingPolicy, IndexingPolicy newPolicy) { <START> return new IndexPolicyCompareService().needsUpdate(existingPolicy, newPolicy); <END> }</code><technical_language>@Blackbaud-EricSlater - do need instance ? this is a stateless service, creating instance is redundant in opinion, thoughts ? unnecessary create multiple instances of IndexPolicyCompareService, in case of static method, needs is Class instance, pose a risk of memory leak</technical_language>

Target:
public static boolean policyNeedsUpdate(IndexingPolicy existingPolicy, IndexingPolicy newPolicy) { return !hasSameIncludedPaths(existingPolicy.getIncludedPaths(), newPolicy.getIncludedPaths()) || !hasSameExcludedPaths(existingPolicy.getExcludedPaths(), newPolicy.getExcludedPaths()) || !existingPolicy.getIndexingMode().equals(newPolicy.getIndexingMode()) || !existingPolicy.isAutomatic().equals(newPolicy.isAutomatic()); }
Source:
<code>public void addMembers(@PathVariable UUID uuid, HttpServletResponse response, HttpServletRequest request) throws SQLException, AuthorizeException { Context context = obtainContext(request); Group parentGroup = groupService.find(context, uuid); if (parentGroup == null) { throw new ResourceNotFoundException("parent group is not found for uuid: " + uuid); } checkAuthorization(context, parentGroup); List<String> memberLinks = utils.getStringListFromRequest(request); List<EPerson> members = new ArrayList<>(); for (String memberLink : memberLinks) { Optional<EPerson> member = findEPerson(context, memberLink); if (!member.isPresent()) { throw new UnprocessableEntityException("cannot add child group: " + memberLink); } members.add(member.get()); } for (EPerson member : members) { groupService.addMember(context, parentGroup, member); } <START> context.commit(); <END> response.setStatus(SC_NO_CONTENT); }</code><technical_language>Tiny thing, I context.complete() in methods in this class. individual requests allow for context reuse in other methods. (Looking in other Controllers, complete() well)</technical_language>

Target:
public void addMembers(@PathVariable UUID uuid, HttpServletResponse response, HttpServletRequest request) throws SQLException, AuthorizeException { Context context = obtainContext(request); Group parentGroup = groupService.find(context, uuid); if (parentGroup == null) { throw new ResourceNotFoundException("parent group is not found for uuid: " + uuid); } checkAuthorization(context, parentGroup); List<String> memberLinks = utils.getStringListFromRequest(request); List<EPerson> members = new ArrayList<>(); for (String memberLink : memberLinks) { Optional<EPerson> member = findEPerson(context, memberLink); if (!member.isPresent()) { throw new UnprocessableEntityException("cannot add child group: " + memberLink); } members.add(member.get()); } for (EPerson member : members) { groupService.addMember(context, parentGroup, member); } context.complete(); response.setStatus(SC_NO_CONTENT); }