auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void refreshSupplementaryFolder(IProgressMonitor monitor) { IFolder supplFolder = createSupplementaryFolder(monitor); try { supplFolder.refreshLocal(IResource.DEPTH_INFINITE, <START> monitor); <END> } catch (CoreException e) { Activator.getDefault().logError("Error refreshing supplementary folder " + supplFolder, e); } }</code><technical_language>submonitor</technical_language>

Target:
public void refreshSupplementaryFolder(IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, 2); IFolder supplFolder = createSupplementaryFolder(subMonitor.split(1)); try { supplFolder.refreshLocal(IResource.DEPTH_INFINITE, subMonitor.split(1)); } catch (CoreException e) { Activator.getDefault().logError("Error refreshing supplementary folder " + supplFolder, e); } }
Source:
<code>public void getNettyServerTest() { Properties properties = new Properties(); VerifiableProperties verifiableProperties = new VerifiableProperties(properties); RestRequestHandler restRequestHandler = new MockRestRequestResponseHandler(); <START> NettyServerFactory nioServerFactory = <END> new NettyServerFactory(verifiableProperties, new MetricRegistry(), restRequestHandler); NioServer nioServer = nioServerFactory.getNioServer(); assertNotNull("No NioServer returned", nioServer); assertEquals("Did not receive a NettyServer instance", NettyServer.class.getCanonicalName(), nioServer.getClass().getCanonicalName()); }</code><technical_language>variable name: nettyServerFactory</technical_language>

Target:
public void getNettyServerTest() { Properties properties = new Properties(); VerifiableProperties verifiableProperties = new VerifiableProperties(properties); RestRequestHandler restRequestHandler = new MockRestRequestResponseHandler(); NettyServerFactory nettyServerFactory = new NettyServerFactory(verifiableProperties, new MetricRegistry(), restRequestHandler); NioServer nioServer = nettyServerFactory.getNioServer(); assertNotNull("No NioServer returned", nioServer); assertEquals("Did not receive a NettyServer instance", NettyServer.class.getCanonicalName(), nioServer.getClass().getCanonicalName()); }
Source:
<code>protected int doWork() { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); log.info("Checking to see if input file has been downsampled with this program before."); checkProgramRecords(); opticalDuplicateFinder = new PhysicalLocation(); log.info("Starting first pass. Examining read distribution in tiles."); fillTileMinMaxCoord(); log.info("First pass done."); log.info("Starting second pass. Outputting reads."); outputSamRecords(); log.info("Second pass done."); final double finalP = kept / (double) total; <START> if (Math.abs(finalP - PROBABILITY) / (Math.min(finalP, PROBABILITY) + 1e-10) > .2) { <END> log.warn(String.format("You've requested PROBABILITY=%g, the resulting downsampling resulted in a rate of %f.", PROBABILITY, finalP)); } log.info(String.format("Finished! Kept %d out of %d reads (P=%g).", kept, total, finalP)); return 0; }</code><technical_language>significance of .2 magic number? this a symbolic constant</technical_language>

Target:
protected int doWork() { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); log.info("Checking to see if input file has been downsampled with this program before."); checkProgramRecords(); opticalDuplicateFinder = new PhysicalLocation(); log.info("Starting first pass. Examining read distribution in tiles."); fillTileMinMaxCoord(); log.info("First pass done."); log.info("Starting second pass. Outputting reads."); outputSamRecords(); log.info("Second pass done."); final double finalP = kept / (double) total; if (Math.abs(finalP - FRACTION) / (Math.min(finalP, FRACTION) + 1e-10) > ACCEPTABLE_FUDGE_FACTOR) { log.warn(String.format("You've requested FRACTION=%g, the resulting downsampling resulted in a rate of %f.", FRACTION, finalP)); } log.info(String.format("Finished! Kept %d out of %d reads (P=%g).", kept, total, finalP)); return 0; }
Source:
<code>public void beforeTestExecution(ExtensionContext extensionContext) { String displayName = extensionContext.getDisplayName(); getStore(extensionContext).put(extensionContext.getRequiredTestMethod(), System.currentTimeMillis()); String testName = ""; String fullyQualifiedTestName = ""; if (extensionContext.getTestMethod().isPresent()) { Method method = extensionContext.getTestMethod().get(); testName = method.getName(); fullyQualifiedTestName = method.getDeclaringClass().getName() + "." + testName; } if (!Objects.equals(displayName, testName)) { <START> System.out.printf("Starting test %s (%s), ", fullyQualifiedTestName, displayName); <END> } else { System.out.printf("Starting test %s, ", fullyQualifiedTestName); } }</code><technical_language>Do need a %n for too</technical_language>

Target:
public void beforeTestExecution(ExtensionContext extensionContext) { String displayName = extensionContext.getDisplayName(); String testName = ""; String fullyQualifiedTestName = ""; if (extensionContext.getTestMethod().isPresent()) { Method method = extensionContext.getTestMethod().get(); testName = method.getName(); fullyQualifiedTestName = method.getDeclaringClass().getName() + "." + testName; } StringBuilder logPrefixBuilder = new StringBuilder("Starting test ") .append(fullyQualifiedTestName); if (!Objects.equals(displayName, testName)) { logPrefixBuilder.append("(") .append(displayName) .append(")"); } logPrefixBuilder.append(","); getStore(extensionContext).put(extensionContext.getRequiredTestMethod(), new TestInformation(logPrefixBuilder.toString(), System.currentTimeMillis())); }
Source:
<code><START> public Map getMap() { <END> return map; }</code><technical_language>avoid raw types, please</technical_language>

Target:
public Map<String, Object> getMap() { return map; }
Source:
<code>public static String getMvnVersion() { Properties prop = new Properties(); String version = null; try { prop.load(new FileInputStream("src/main/resources/config.properties")); <START> version = prop.getProperty("mvnVersion"); <END> } catch (IOException e) { } return version; }</code><technical_language>Please a instance-variable for version, this configure for service instance separately. extend service-descritor support version-field (and add a default-value)</technical_language>

Target:
public String getMvnVersion() { return mvnVersion; }
Source:
<code>public TestkitResponse process( TestkitState testkitState ) { <START> return Optional.ofNullable( testkitState.getTransactions().getOrDefault( data.txId, null ) ) <END> .map( tx -> { tx.commit(); return transaction( data.txId ); } ) .orElseThrow( () -> new RuntimeException( "Could not find transaction" ) ); }</code><technical_language>Unnecessary. If key is in map, map return null anyway</technical_language>

Target:
public TestkitResponse process( TestkitState testkitState ) { return Optional.ofNullable( testkitState.getTransactions().get( data.txId ) ) .map( tx -> { tx.commit(); return transaction( data.txId ); } ) .orElseThrow( () -> new RuntimeException( "Could not find transaction" ) ); }
Source:
<code>public BoundedSSPIterator(SystemConsumer systemConsumer, SystemStreamPartition systemStreamPartition, String endOffset, SystemAdmin admin) { this.systemConsumer = systemConsumer; this.endOffset = endOffset; this.admin = admin; this.fetchSet = new HashSet<>(); <START> this.fetchSet.add(systemStreamPartition); <END> this.peeks = new ArrayDeque<>(); }</code><technical_language>allows feeding SSP. do need a set</technical_language>

Target:
public BoundedSSPIterator(SystemConsumer systemConsumer, SystemStreamPartition systemStreamPartition, String endOffset, SystemAdmin admin) { this.systemConsumer = systemConsumer; this.endOffset = endOffset; this.admin = admin; this.fetchSet = ImmutableSet.of(systemStreamPartition); this.peeks = new ArrayDeque<>(); }
Source:
<code>public void registerListener(Listener listener) { Method[] methods = listener.getClass().getMethods(); for (Method method : methods) { if (method.isAnnotationPresent(EventHandler.class)) { EventHandler handler = method.getAnnotation(EventHandler.class); Importance importance = handler.importance(); Class<?>[] params = method.getParameterTypes(); if (params.length == 1) { Class<?> clazz = params[0]; Class<?> c = clazz; boolean b = true; while (b) { if (!c.getSuperclass().equals(Object.class)) { c = c.getSuperclass(); } else { b = false; } } if (c.equals(Event.class)) { Class<? extends Event> eventType = clazz.asSubclass(Event.class); ManagerList listeners = ManagerList.getManagers().get(eventType); if (listeners == null) { listeners = new ManagerList(); ManagerList.getManagers().put(eventType, listeners); } RegisteredListener rl = new RegisteredListener(listener, importance, method); listeners.register(rl); } } else { <START> throw new PluginLoadException("Listener " + method.getName() + " has " + (params.length == 0 ? "no parameters!" : "more than one parameter") + "!"); <END> } } } }</code><technical_language>this count a PluginLoadException? Listeners registered plugin loading process. this stops of listener methods registered, terminates method</technical_language>

Target:
public void registerListener(Listener listener) { Method[] methods = listener.getClass().getMethods(); for (Method method : methods) { if (method.isAnnotationPresent(EventHandler.class)) { EventHandler handler = method.getAnnotation(EventHandler.class); Importance importance = handler.importance(); Class<?>[] params = method.getParameterTypes(); if (params.length == 1) { Class<?> clazz = params[0]; Class<?> c = clazz; boolean b = true; while (b) { if (!c.getSuperclass().equals(Object.class)) { c = c.getSuperclass(); } else { b = false; } } if (c.equals(Event.class)) { Class<? extends Event> eventType = clazz.asSubclass(Event.class); ManagerList listeners = ManagerList.getManagers().get(eventType); if (listeners == null) { listeners = new ManagerList(); ManagerList.getManagers().put(eventType, listeners); } RegisteredListener rl = new RegisteredListener(listener, importance, method); listeners.register(rl); } } else { TridentLogger.getGlobal().warning("Listener " + method.getName() + " has " + (params.length == 0 ? "no parameters!" : "more than one parameter") + "!"); } } } }
Source:
<code>public static Type toType(byte code) { for (Type type: Type.values()) { if(type.getCode() == code) { return type; } } <START> throw new UnsupportedOperationException("Invalid message type code: " + code); <END> }</code><technical_language>a IllegalArgumentException</technical_language>

Target:
public static Type toType(byte code) { for (Type type: Type.values()) { if(type.getCode() == code) { return type; } } throw new IllegalArgumentException("Invalid message type code: " + code); }
Source:
<code>private ValidationResult validateForMacsInUse(List<VmNetworkInterface> vnics, MacPool macPool) { final List<String> macsInUse = vnics .stream() .map(VmNetworkInterface::getMacAddress) .filter(Objects::nonNull) .filter(macPool::isMacInUse) .collect(Collectors.toList()); final EngineMessage msg = <START> EngineMessage.NETWORK_MAC_ADDRESS_IN_USE; <END> return ValidationResult .failWith(msg, ReplacementUtils.getListVariableAssignmentString(msg, macsInUse)) .unless(macsInUse.isEmpty()); }</code><technical_language>for suggesting incomplete examples, need update this message. This message parameter. this constuct here, need ideally create new engine message, lets NETWORK_MAC_ADDRESSES_IN_USE, replacement NETWORK_MAC_ADDRESSES_IN_USE_LIST if agree, add NETWORK_MAC_ADDRESSES_IN_USE=These MAC Addresses in use: ${NETWORK_MAC_ADDRESSES_IN_USE_LIST}. into: /home/mmucha/projects/ovirt-engine/frontend/webadmin/modules/frontend/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties update #113 in this file</technical_language>

Target:
private ValidationResult validateForMacsInUse(List<VmNetworkInterface> vnics, MacPool macPool) { final List<String> macsInUse = vnics .stream() .map(VmNetworkInterface::getMacAddress) .filter(Objects::nonNull) .filter(macPool::isMacInUse) .collect(Collectors.toList()); final EngineMessage msg = EngineMessage.NETWORK_MAC_ADDRESS_IN_USE_DETAILED; return ValidationResult .failWith(msg, ReplacementUtils.getListVariableAssignmentString(msg, macsInUse)) .unless(macsInUse.isEmpty()); }
Source:
<code>private String buildClosedLaborAccountsForDateRangeSQL(Map<String, Date> dateRange) { SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy", Locale.US); StringBuilder sqlBuilder = new StringBuilder("SELECT A.FIN_COA_CD AS ACCT_FIN_COA_CD, A.ACCOUNT_NBR AS ACCT_ACCOUNT_NBR, "); sqlBuilder.append("S.SUB_ACCT_NBR AS SUB_SUB_ACCT_NBR, A.ACCT_CLOSED_IND AS ACCT_ACCT_CLOSED_IND, X.ACCT_CLOSED_DT AS ACCTX_ACCT_CLOSED_DT "); sqlBuilder.append("FROM KFS.CA_ACCOUNT_T A "); sqlBuilder.append("LEFT JOIN KFS.CA_ACCOUNT_TX X ON A.FIN_COA_CD = X.FIN_COA_CD AND A.ACCOUNT_NBR = X.ACCOUNT_NBR "); sqlBuilder.append("LEFT JOIN KFS.CA_SUB_ACCT_T S ON A.FIN_COA_CD = S.FIN_COA_CD AND A.ACCOUNT_NBR = S.ACCOUNT_NBR "); <START> sqlBuilder.append("WHERE A.FIN_COA_CD = X.FIN_COA_CD AND A.ACCOUNT_NBR = X.ACCOUNT_NBR AND A.FIN_COA_CD = 'IT' AND A.ACCT_CLOSED_IND = 'Y' "); <END> sqlBuilder.append("AND X.ACCT_CLOSED_DT >= '").append(formatter.format(dateRange.get(CuCoaBatchConstants.ClosedLaborAccountsFileCreationConstants.FROM_DATE))).append("' "); sqlBuilder.append("AND X.ACCT_CLOSED_DT < '").append(formatter.format(dateRange.get(CuCoaBatchConstants.ClosedLaborAccountsFileCreationConstants.TO_DATE))).append("' "); LOG.info("buildClosedLaborAccountsForDateRangeSQL: SQL to be executed = " + sqlBuilder.toString()); return sqlBuilder.toString(); }</code><technical_language>move chart a parameter? need submit accounts other charts</technical_language>

Target:
private String buildClosedLaborAccountsForDateRangeSQL(Map<String, Date> dateRange) { SimpleDateFormat formatter = new SimpleDateFormat(CUKFSConstants.DATE_FORMAT_dd_MMM_yy, Locale.US); StringBuilder sqlBuilder = new StringBuilder("SELECT A.FIN_COA_CD AS ACCT_FIN_COA_CD, A.ACCOUNT_NBR AS ACCT_ACCOUNT_NBR, "); sqlBuilder.append("S.SUB_ACCT_NBR AS SUB_SUB_ACCT_NBR, A.ACCT_CLOSED_IND AS ACCT_ACCT_CLOSED_IND, X.ACCT_CLOSED_DT AS ACCTX_ACCT_CLOSED_DT "); sqlBuilder.append("FROM KFS.CA_ACCOUNT_T A "); sqlBuilder.append("LEFT JOIN KFS.CA_ACCOUNT_TX X ON A.FIN_COA_CD = X.FIN_COA_CD AND A.ACCOUNT_NBR = X.ACCOUNT_NBR "); sqlBuilder.append("LEFT JOIN KFS.CA_SUB_ACCT_T S ON A.FIN_COA_CD = S.FIN_COA_CD AND A.ACCOUNT_NBR = S.ACCOUNT_NBR "); sqlBuilder.append("WHERE A.FIN_COA_CD = X.FIN_COA_CD AND A.ACCOUNT_NBR = X.ACCOUNT_NBR AND A.FIN_COA_CD = 'IT' AND A.ACCT_CLOSED_IND = 'Y' "); sqlBuilder.append("AND X.ACCT_CLOSED_DT >= '").append(formatter.format(dateRange.get(CuCoaBatchConstants.ClosedLaborAccountsFileCreationConstants.FROM_DATE))).append("' "); sqlBuilder.append("AND X.ACCT_CLOSED_DT < '").append(formatter.format(dateRange.get(CuCoaBatchConstants.ClosedLaborAccountsFileCreationConstants.TO_DATE))).append("' "); LOG.info("buildClosedLaborAccountsForDateRangeSQL: SQL to be executed = " + sqlBuilder.toString()); return sqlBuilder.toString(); }
Source:
<code>public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { cause.printStackTrace(); <START> ctx.channel().close(); <END> }</code><technical_language>ctx.close()</technical_language>

Target:
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { cause.printStackTrace(); ctx.close(); }
Source:
<code>public CounterChartViewer(Composite parent, String title, String xLabel, String yLabel) { super(parent, title, xLabel, yLabel); Chart chart = getSwtChart(); chart.getTitle().setVisible(true); getSwtChart().getAxisSet().getXAxes()[0].getTitle().setVisible(true); <START> chart.setBackground(new Color(Display.getDefault(), 250, 250, 250)); <END> chart.getLegend().setPosition(SWT.RIGHT); chart.getLegend().setVisible(true); TmfSignalManager.register(this); }</code><technical_language>If create a new Color store dispose later, a system color</technical_language>

Target:
public CounterChartViewer(Composite parent, String title, String xLabel, String yLabel) { super(parent, title, xLabel, yLabel); Chart chart = getSwtChart(); chart.getTitle().setVisible(true); getSwtChart().getAxisSet().getXAxes()[0].getTitle().setVisible(true); chart.getLegend().setPosition(SWT.RIGHT); chart.getLegend().setVisible(true); Color backgroundColor = new Color(Display.getDefault(), 250, 250, 250); chart.setBackground(backgroundColor); backgroundColor.dispose(); }
Source:
<code>public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_SUBSCRIPTION_KEY")) .endpoint(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT")) .buildClient(); String text = "The hotel was dark and unclean."; final TextSentimentResult sentimentResult = client.analyzeSentiment(text); final TextSentiment documentSentiment = sentimentResult.getDocumentSentiment(); System.out.printf( <START> "Recognized TextSentiment: %s, Positive Score: %s, Neutral Score: %s, Negative Score: %s.", <END> documentSentiment.getTextSentimentClass(), documentSentiment.getPositiveScore(), documentSentiment.getNeutralScore(), documentSentiment.getNegativeScore()); final List<TextSentiment> sentiments = sentimentResult.getSentenceSentiments(); sentiments.forEach(textSentiment -> System.out.printf( "Recognized Sentence TextSentiment: %s, Positive Score: %s, Neutral Score: %s, Negative Score: %s.", textSentiment.getTextSentimentClass(), textSentiment.getPositiveScore(), textSentiment.getNeutralScore(), textSentiment.getNegativeScore())); }</code><technical_language>add %n</technical_language>

Target:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("subscription-key") .endpoint("<LINK_0>") .buildClient(); String text = "The hotel was dark and unclean."; final AnalyzeSentimentResult sentimentResult = client.analyzeSentiment(text); final TextSentiment documentSentiment = sentimentResult.getDocumentSentiment(); System.out.printf( "Recognized TextSentiment: %s, Positive Score: %s, Neutral Score: %s, Negative Score: %s.%n", documentSentiment.getTextSentimentClass(), documentSentiment.getPositiveScore(), documentSentiment.getNeutralScore(), documentSentiment.getNegativeScore()); final List<TextSentiment> sentiments = sentimentResult.getSentenceSentiments(); for (TextSentiment textSentiment : sentiments) { System.out.printf( "Recognized Sentence TextSentiment: %s, Positive Score: %s, Neutral Score: %s, Negative Score: %s.%n", textSentiment.getTextSentimentClass(), textSentiment.getPositiveScore(), textSentiment.getNeutralScore(), textSentiment.getNegativeScore()); } }
Source:
<code>public <T extends Entity> EntitySpec<T> resolveSpec(Class<T> type, Class<? extends T> optionalImpl) { if (alreadyBuilt.getAndSet(true)) throw new IllegalStateException("Spec can only be used once: "+this); EntitySpec<T> spec; if (optionalImpl != null) { spec = EntitySpec.create(type).impl(optionalImpl); } else if (type.isInterface()) { spec = EntitySpec.create(type); } else { Class interfaceclazz = (Application.class.isAssignableFrom(type)) ? Application.class : Entity.class; <START> Class<?>[] additionalInterfaceClazzes = type.getInterfaces(); <END> spec = EntitySpec.create(interfaceclazz).impl(type).additionalInterfaces(additionalInterfaceClazzes); } String name, templateId=null, planId=null; if (template.isPresent()) { name = template.get().getName(); templateId = template.get().getId(); } else { name = (String)attrs.getStringKey("name"); } planId = (String)attrs.getStringKey("id"); if (planId==null) planId = (String) attrs.getStringKey(BrooklynCampConstants.PLAN_ID_FLAG); if (!Strings.isBlank(name)) spec.displayName(name); if (templateId != null) spec.configure(BrooklynCampConstants.TEMPLATE_ID, templateId); if (planId != null) spec.configure(BrooklynCampConstants.PLAN_ID, planId); List<Location> childLocations = new BrooklynYamlLocationResolver(mgmt).resolveLocations(attrs.getAllConfig(), true); if (childLocations != null) spec.locations(childLocations); decorateSpec(spec); return spec; }</code><technical_language>Reflections.getAllInterfaces(Class) get interfaces superclass forth. Returns a List<Class<?>> instead of array, OK</technical_language>

Target:
public <T extends Entity> EntitySpec<T> resolveSpec(Class<T> type, Class<? extends T> optionalImpl) { if (alreadyBuilt.getAndSet(true)) throw new IllegalStateException("Spec can only be used once: "+this); EntitySpec<T> spec; if (optionalImpl != null) { spec = EntitySpec.create(type).impl(optionalImpl); } else if (type.isInterface()) { spec = EntitySpec.create(type); } else { Class interfaceclazz = (Application.class.isAssignableFrom(type)) ? Application.class : Entity.class; List<Class<?>> additionalInterfaceClazzes = Reflections.getAllInterfaces(type); spec = EntitySpec.create(interfaceclazz).impl(type).additionalInterfaces(additionalInterfaceClazzes); } String name, templateId=null, planId=null; if (template.isPresent()) { name = template.get().getName(); templateId = template.get().getId(); } else { name = (String)attrs.getStringKey("name"); } planId = (String)attrs.getStringKey("id"); if (planId==null) planId = (String) attrs.getStringKey(BrooklynCampConstants.PLAN_ID_FLAG); if (!Strings.isBlank(name)) spec.displayName(name); if (templateId != null) spec.configure(BrooklynCampConstants.TEMPLATE_ID, templateId); if (planId != null) spec.configure(BrooklynCampConstants.PLAN_ID, planId); List<Location> childLocations = new BrooklynYamlLocationResolver(mgmt).resolveLocations(attrs.getAllConfig(), true); if (childLocations != null) spec.locations(childLocations); decorateSpec(spec); return spec; }
Source:
<code>protected int indexOfChild(String localName) { AbstractDataTreeNode[] nodes = this.children; NoDataDeltaNode localNameNode = new NoDataDeltaNode(localName); <START> return Arrays.binarySearch(nodes, localNameNode, (n1, n2) -> n1.name.compareTo(n2.name)); <END> }</code><technical_language>things: * Arrays.binarySearch() returns a negative if found, necessarily -1 original code. line 453 fail. check other callers. * IIRC this operation is called *very* frequently. I absolutely want avoid allocating a dummy object here; put additional pressure GC</technical_language>

Target:
protected int indexOfChild(String localName) { AbstractDataTreeNode[] nodes = this.children; if (nodes.length == 0) { return -1; } else if (nodes.length == 1) { return nodes[0].name.equals(localName) ? 0 : -1; } NoDataDeltaNode localNameNode = new NoDataDeltaNode(localName); return Arrays.binarySearch(nodes, localNameNode, (n1, n2) -> n1.name.compareTo(n2.name)); }
Source:
<code>public PreparedOperationWithReactiveStream<List<T>> prepare() { <START> Checks.checkNotNull(mapFunc, "Please specify map function"); <END> Checks.checkNotNull(query, "Please specify query"); if (getResolver == null) { getResolver = DefaultGetResolver.INSTANCE; } return new PreparedGetListOfObjects<>( storIOContentProvider, getResolver, mapFunc, query ); }</code><technical_language>Static import</technical_language>

Target:
public PreparedOperationWithReactiveStream<List<T>> prepare() { checkNotNull(mapFunc, "Please specify map function"); checkNotNull(query, "Please specify query"); if (getResolver == null) { getResolver = DefaultGetResolver.INSTANCE; } return new PreparedGetListOfObjects<>( storIOContentProvider, getResolver, mapFunc, query ); }
Source:
<code>public Configuration(SkipFilter dependencyFilter, SkipFilter pluginFilter, boolean verifyPomFiles, boolean verifyPlugins, boolean verifyPluginDependencies, boolean verifyAtypical) { this.dependencyFilter = requireNonNull(dependencyFilter); this.pluginFilter = requireNonNull(pluginFilter); this.verifyPomFiles = verifyPomFiles; if (!verifyPlugins && verifyPluginDependencies) { <START> LOG.warn("Enabling configuration parameter 'verifyPlugins' as 'verifyPluginDependencies' is enabled."); <END> } this.verifyPlugins = verifyPlugins || verifyPluginDependencies; this.verifyPluginDependencies = verifyPluginDependencies; this.verifyAtypical = verifyAtypical; }</code><technical_language>Warning is needed here. idea allow minimize number of options for user configuration</technical_language>

Target:
public Configuration(SkipFilter dependencyFilter, SkipFilter pluginFilter, boolean verifyPomFiles, boolean verifyPlugins, boolean verifyPluginDependencies, boolean verifyAtypical) { this.dependencyFilter = requireNonNull(dependencyFilter); this.pluginFilter = requireNonNull(pluginFilter); this.verifyPomFiles = verifyPomFiles; this.verifyPlugins = verifyPlugins || verifyPluginDependencies; this.verifyPluginDependencies = verifyPluginDependencies; this.verifyAtypical = verifyAtypical; }
Source:
<code>public List<Instance> start(String workspaceId, Environment env, boolean recover, MessageConsumer<MachineLogMessage> messageConsumer) throws ServerException, ConflictException { List<MachineConfigImpl> startConfigs = env.getMachineConfigs() .stream() .map(MachineConfigImpl::new) .collect(Collectors.toList()); final MachineConfigImpl devCfg = removeFirstMatching(startConfigs, MachineConfig::isDev); startConfigs.add(0, devCfg); EnvironmentHolder environmentHolder = new EnvironmentHolder(new ArrayDeque<>(startConfigs), new CopyOnWriteArrayList<>(), messageConsumer, EnvStatus.STARTING, env.getName()); EnvironmentHolder returnedEnv; try (StripedLocks.WriteLock lock = stripedLocks.acquireWriteLock(workspaceId)) { returnedEnv = environments.putIfAbsent(workspaceId, environmentHolder); } if (returnedEnv != null) { throw new ConflictException(format("Environment of workspace '%s' already exists", workspaceId)); } startQueue(workspaceId, env.getName(), recover, messageConsumer); <START> List<Instance> machines; <END> try (StripedLocks.WriteLock lock = stripedLocks.acquireWriteLock(workspaceId)) { environmentHolder = environments.get(workspaceId); if (environmentHolder == null) { throw new ServerException("Environment start was interrupted by environment stopping"); } machines = environmentHolder.machines; environmentHolder.status = EnvStatus.RUNNING; } return new ArrayList<>(machines); }</code><technical_language>Wdyt removing this variable returning machines try/catch</technical_language>

Target:
public List<Instance> start(String workspaceId, Environment env, boolean recover, MessageConsumer<MachineLogMessage> messageConsumer) throws ServerException, ConflictException { List<MachineConfigImpl> startConfigs = env.getMachineConfigs() .stream() .map(MachineConfigImpl::new) .collect(Collectors.toList()); final MachineConfigImpl devCfg = removeFirstMatching(startConfigs, MachineConfig::isDev); startConfigs.add(0, devCfg); EnvironmentHolder environmentHolder = new EnvironmentHolder(new ArrayDeque<>(startConfigs), new CopyOnWriteArrayList<>(), messageConsumer, EnvStatus.STARTING, env.getName()); try (StripedLocks.WriteLock lock = stripedLocks.acquireWriteLock(workspaceId)) { if (environments.putIfAbsent(workspaceId, environmentHolder) != null) { throw new ConflictException(format("Environment of workspace '%s' already exists", workspaceId)); } } startQueue(workspaceId, env.getName(), recover, messageConsumer); try (StripedLocks.WriteLock lock = stripedLocks.acquireWriteLock(workspaceId)) { environmentHolder = environments.get(workspaceId); if (environmentHolder == null) { throw new ServerException("Environment start was interrupted by environment stopping"); } environmentHolder.status = EnvStatus.RUNNING; return new ArrayList<>(environmentHolder.machines); } }
Source:
<code>private void checkCodeAssistant() { <START> String textFromWholeCodeAssistantScope = <END> "AbortController\nAbortSignal\nabstract\nActiveXObject\naddEventListener\nalert"; String textFromGreeterObject = "greet\ngreeting\ntestPrint"; editor.goToPosition(28, 36); editor.launchAutocomplete(); editor.waitTextIntoAutocompleteContainer(textFromWholeCodeAssistantScope); editor.closeAutocomplete(); editor.typeTextIntoEditor(ENTER.toString()); editor.typeTextIntoEditor("greeter."); editor.launchAutocomplete(); editor.waitTextIntoAutocompleteContainer(textFromGreeterObject); editor.selectItemIntoAutocompleteAndPerformDoubleClick("greet"); editor.waitAllMarkersInvisibility(ERROR); }</code><technical_language>readability point divide verification given/when/then sections</technical_language>

Target:
private void checkCodeAssistant() { String textFromWholeCodeAssistantScope = "AbortController\nAbortSignal\nabstract\nActiveXObject\naddEventListener\nalert"; String textFromGreeterObject = "greet\ngreeting\ntestPrint"; String nameOfGreeterClassRef = "greeter."; String methodToComplete = "greet"; editor.goToPosition(28, 36); editor.launchAutocomplete(); editor.waitTextIntoAutocompleteContainer(textFromWholeCodeAssistantScope); editor.closeAutocomplete(); editor.typeTextIntoEditor(ENTER.toString()); editor.typeTextIntoEditor(nameOfGreeterClassRef); editor.launchAutocomplete(); editor.waitTextIntoAutocompleteContainer(textFromGreeterObject); editor.selectItemIntoAutocompleteAndPerformDoubleClick(methodToComplete); editor.waitAllMarkersInvisibility(ERROR); }
Source:
<code>public Object[][] getLinearIndexFactoryTypes(){ return new Object[][] { <START> new Object[] { new File(TestUtils.DATA_DIR, "bed/Unigene.sample.bed") }, <END> new Object[] { new File(TestUtils.DATA_DIR, "bed/Unigene.sample.bed.gz") } }; }</code><technical_language>unnecessary new Object[], a space contents of array initializer, e.g. public Object[][] getLinearIndexFactoryTypes(){ return new Object[][] { {new File(TestUtils.DATA_DIR, "bed/Unigene.sample.bed")}, {new File(TestUtils.DATA_DIR, "bed/Unigene.sample.bed.gz")} }; }</technical_language>

Target:
public Object[][] getLinearIndexFactoryTypes() { return new Object[][] { { new File(TestUtils.DATA_DIR, "bed/Unigene.sample.bed") }, { new File(TestUtils.DATA_DIR, "bed/Unigene.sample.bed.gz") } }; }
Source:
<code>public void prepareRun(BatchSinkContext context) throws Exception { Job job = JobUtils.createInstance(); Configuration conf = job.getConfiguration(); <START> if (UserGroupInformation.isSecurityEnabled()) { <END> conf.unset("mapreduce.jobhistory.address"); conf.setBoolean(Job.JOB_AM_ACCESS_DISABLED, false); Credentials credentials = UserGroupInformation.getCurrentUser().getCredentials(); job.getCredentials().addAll(credentials); } HiveSinkOutputFormatProvider sinkOutputFormatProvider = new HiveSinkOutputFormatProvider(job, config); HCatSchema hiveSchema = sinkOutputFormatProvider.getHiveSchema(); HiveSchemaStore.storeHiveSchema(context, config.dbName, config.tableName, hiveSchema); context.addOutput(Output.of(config.referenceName, sinkOutputFormatProvider).alias(config.tableName)); }</code><technical_language>JobUtils.createInstance this logic</technical_language>

Target:
public void prepareRun(BatchSinkContext context) throws Exception { Job job = JobUtils.createInstance(); Configuration conf = job.getConfiguration(); HiveSinkOutputFormatProvider sinkOutputFormatProvider = new HiveSinkOutputFormatProvider(job, config); HCatSchema hiveSchema = sinkOutputFormatProvider.getHiveSchema(); HiveSchemaStore.storeHiveSchema(context, config.dbName, config.tableName, hiveSchema); context.addOutput(Output.of(config.referenceName, sinkOutputFormatProvider).alias(config.tableName)); }
Source:
<code>public void <START> testCorrectMarkerTimestamp() <END> { long startTime = fTrace.getStartTime().toNanos(); long endTime = fTrace.getEndTime().toNanos(); assertTrue(fTraceMarkerScriptingModule.addTraceMarker(startTime, endTime - 1, "", "", "")); assertTrue(fTraceMarkerScriptingModule.addTraceMarker(startTime + 1, endTime, "", "", "")); assertTrue(fTraceMarkerScriptingModule.addTraceMarker(startTime, endTime, "", "", "")); assertTrue(fTraceMarkerScriptingModule.addTraceMarker(startTime + 1, endTime - 1, "", "", "")); }</code><technical_language>problem this test is trace is set active trace yet. do this is TraceScriptingUI module, in openTrace method: A simple loop of a tries: Integer tryCounter = 0; final Integer numberOfTry = 20; /* * Need wait job openTraceFromElement is done * trace is open. a race condition. */ while (trace == null && tryCounter < numberOfTry) { try { Thread.sleep(100); } catch (InterruptedException e) { break; } trace = projectElement.getTrace(); tryCounter++; } if (trace != null) { return trace; } trace in code TmfTraceManager.getInstance().getActiveTrace(). run this code in setUpEnvironment method</technical_language>

Target:
public void testCorrectMarkerTimestamp() throws Exception { long startTime = 1; long endTime = 1; fTraceMarkerScriptingModule.addTraceMarker(startTime, endTime, null, null, null); }
Source:
<code>private void sendContinuations(final int packetSize, final long messageBodySize, final byte[] body, final boolean continues) throws Exception { synchronized (largeMessageLock) { if (currentLargeMessage == null) { throw ActiveMQMessageBundle.BUNDLE.largeMessageNotInitialised(); } currentLargeMessage.addBytes(body); if (!continues) { <START> currentLargeMessage.sync(); <END> currentLargeMessage.releaseResources(); if (messageBodySize >= 0) { currentLargeMessage.putLongProperty(Message.HDR_LARGE_BODY_SIZE, messageBodySize); } LargeServerMessage message = currentLargeMessage; currentLargeMessage = null; session.doSend(session.getCurrentTransaction(), message, null, false, false); } } }</code><technical_language>releaseResources a sync file is closed</technical_language>

Target:
private void sendContinuations(final int packetSize, final long messageBodySize, final byte[] body, final boolean continues) throws Exception { synchronized (largeMessageLock) { if (currentLargeMessage == null) { throw ActiveMQMessageBundle.BUNDLE.largeMessageNotInitialised(); } currentLargeMessage.addBytes(body); if (!continues) { currentLargeMessage.releaseResources(); if (messageBodySize >= 0) { currentLargeMessage.putLongProperty(Message.HDR_LARGE_BODY_SIZE, messageBodySize); } LargeServerMessage message = currentLargeMessage; currentLargeMessage = null; session.doSend(session.getCurrentTransaction(), message, null, false, false); } } }
Source:
<code>private void validateClientAttached(ClientDescriptor clientDescriptor) throws ClusterException { <START> ClientState clientState = this.clientStateMap.get(clientDescriptor); <END> if (clientState == null) { throw new LifecycleException("Client " + clientDescriptor + " is not connected to the Clustered Tier Manager"); } if (!clientState.isAttached()) { throw new LifecycleException("Client " + clientDescriptor + " is not attached to the Clustered Tier Manager"); } }</code><technical_language>I another internal method in lines 398 400 in 406 407 takes ClientState instead of - racy indeed</technical_language>

Target:
private void validateClientAttached(ClientDescriptor clientDescriptor) throws ClusterException { ClientState clientState = this.clientStateMap.get(clientDescriptor); validateClientConnected(clientDescriptor, clientState); if (!clientState.isAttached()) { throw new LifecycleException("Client " + clientDescriptor + " is not attached to the Clustered Tier Manager"); } }
Source:
<code><START> protected Properties initJobParameters() { <END> Properties jobParameters = new Properties(); if (getBeanDefinitionRegistry().containsBeanDefinition(JOB_PARAMETERS_BEAN_DEFINITION_NAME)) { BeanDefinition beanDefintion = getBeanDefinitionRegistry().getBeanDefinition(JOB_PARAMETERS_BEAN_DEFINITION_NAME); Properties properties = (Properties) beanDefintion.getConstructorArgumentValues() .getGenericArgumentValue(Properties.class) .getValue(); if (properties == null) { return new Properties(); } jobParameters.putAll(properties); } return jobParameters; }</code><technical_language>Is this want people able override</technical_language>

Target:
private Properties initJobParameters() { Properties jobParameters = new Properties(); if (getBeanDefinitionRegistry().containsBeanDefinition(JOB_PARAMETERS_BEAN_DEFINITION_NAME)) { BeanDefinition beanDefintion = getBeanDefinitionRegistry().getBeanDefinition(JOB_PARAMETERS_BEAN_DEFINITION_NAME); Properties properties = (Properties) beanDefintion.getConstructorArgumentValues() .getGenericArgumentValue(Properties.class) .getValue(); if (properties == null) { return new Properties(); } jobParameters.putAll(properties); } return jobParameters; }
Source:
<code>public Object getNextValue() { double value = (double) getValue(); double stepSize = MAX_VALUE; while (stepSize >= MIN_VALUE) { if (value >= stepSize) { break; } else { stepSize = stepSize / 10; } } if( value >= MAX_VALUE) { <START> return 0; <END> } return value + stepSize; }</code><technical_language>This return MAX_VALUE, prevent cycling step size zero. return MIN_VALUE</technical_language>

Target:
public Object getNextValue() { double value = (double) getValue(); double stepSize = MAX_VALUE; while (stepSize >= MIN_VALUE) { if (value >= stepSize) { break; } else { stepSize = stepSize / 10; } } if( value >= MAX_VALUE) { return null; } return value + stepSize; }
Source:
<code>protected void appendDetail(StringBuffer buffer, String fieldName, Object value) { if (value == null) { appendNullText(buffer, fieldName); return; } if (value instanceof Number || value.getClass() == Boolean.class) { buffer.append(value); return; } <START> appendValueAsString(buffer, value.toString()); <END> }</code><technical_language>I this is correct for nested object structures. Suppose class structure: java public class Person { private String name; private Address address; } public class Address { private String city; private String zip; } Translating this JavaScript/JSON this if both, Person Address JsonToStringStyle for equals method: JavaScript { "name": "Peter", "address": { "city": "New York", "zip": "10026" } } If apply this fix, result this: JavaScript { "name": "Peter", "address": "{ "city": "New York", "zip": "10026" }" } Note additional double quotes address object</technical_language>

Target:
protected void appendDetail(StringBuffer buffer, String fieldName, Object value) { if (value == null) { appendNullText(buffer, fieldName); return; } if (value instanceof String || value instanceof Character) { appendValueAsString(buffer, value.toString()); return; } if (value instanceof Number || value instanceof Boolean) { buffer.append(value); return; } final String try_value_str = value.toString(); if (try_value_str.startsWith(getContentStart()) && try_value_str.endsWith(getContentEnd()) || try_value_str.startsWith(getArrayStart()) && try_value_str.startsWith(getArrayEnd()) ) { buffer.append(value); return; } appendDetail(buffer, fieldName, try_value_str); }
Source:
<code>private boolean policyUnitEnabled(VM vm) { <START> boolean usesNumaPinning = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()).stream() .anyMatch(node -> !node.getVdsNumaNodeList().isEmpty()); <END> return vm.getVmType() == VmType.HighPerformance || vm.isUsingCpuPassthrough() || StringUtils.isNotEmpty(vm.getCpuPinning()) || usesNumaPinning; }</code><technical_language>delaying query database if of usesNumaPinning is needed? (I expect VMs of type High-Performance CPU passthrough, I do expect of set CPU pinning)</technical_language>

Target:
private boolean policyUnitEnabled(VM vm) { if (vm.getVmType() == VmType.HighPerformance || vm.isUsingCpuPassthrough() || StringUtils.isNotEmpty(vm.getCpuPinning())) { return true; } return vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()).stream() .anyMatch(node -> !node.getVdsNumaNodeList().isEmpty()); }
Source:
<code><START> private static int parseMergeMinRegionSizeMb(final Configuration conf) { <END> final int parsedValue = conf.getInt(MERGE_MIN_REGION_SIZE_MB_KEY, DEFAULT_MERGE_MIN_REGION_SIZE_MB); final int settledValue = Math.max(0, parsedValue); if (parsedValue != settledValue) { warnInvalidValue(MERGE_MIN_REGION_SIZE_MB_KEY, parsedValue, settledValue); } return settledValue; }</code><technical_language>3 getters @VisibleForTesting</technical_language>

Target:
private static long parseMergeMinRegionSizeMb(final Configuration conf) { final long parsedValue = conf.getLong(MERGE_MIN_REGION_SIZE_MB_KEY, DEFAULT_MERGE_MIN_REGION_SIZE_MB); final long settledValue = Math.max(0, parsedValue); if (parsedValue != settledValue) { warnInvalidValue(MERGE_MIN_REGION_SIZE_MB_KEY, parsedValue, settledValue); } return settledValue; }
Source:
<code>private TableStatistics toTableStatistics(TableStatisticsData tableStatisticsData, TpchTableHandle tpchTableHandle, Map<String, ColumnHandle> columnHandles) { TableStatistics.Builder builder = TableStatistics.builder() <START> .setRowCount(new Estimate(tableStatisticsData.getRowCount())); <END> tableStatisticsData.getColumns().forEach((columnName, stats) -> { TpchColumnHandle columnHandle = (TpchColumnHandle) getColumnHandle(tpchTableHandle, columnHandles, columnName); builder.setColumnStatistics(columnHandle, toColumnStatistics(stats, columnHandle.getType())); }); return builder.build(); }</code><technical_language>column naming schemas in TPCH connector. work both</technical_language>

Target:
private TableStatistics toTableStatistics(TableStatisticsData tableStatisticsData, TpchTableHandle tpchTableHandle, Map<String, ColumnHandle> columnHandles) { TableStatistics.Builder builder = TableStatistics.builder() .setRowCount(new Estimate(tableStatisticsData.getRowCount())); tableStatisticsData.getColumns().forEach((columnName, stats) -> { TpchColumnHandle columnHandle = (TpchColumnHandle) getColumnHandle(tpchTableHandle, columnHandles, columnName); builder.setColumnStatistics(columnHandle, toColumnStatistics(stats, columnHandle.getType(), tableStatisticsData.getRowCount())); }); return builder.build(); }
Source:
<code>public void testAddRangeConstraints() { Assert.assertEquals("Should add equality constraints", URI.create("view:file:/datasets/test?color=[green,inf)"), new URIBuilder("dataset:file:/datasets/test") .constraints(empty.from("color", "green")) .build()); Assert.assertEquals("Should add equality constraints", URI.create("view:file:/datasets/test?color=(inf,green]"), new URIBuilder("dataset:file:/datasets/test") .constraints(empty.to("color", "green")) .build()); Assert.assertEquals("Should add equality constraints", URI.create("view:file:/datasets/test?timestamp=[0,1405720705333)&color=(green,red]"), new URIBuilder("dataset:file:/datasets/test") .constraints(empty <START> .from("timestamp", 0l).toBefore("timestamp", 1405720705333l) <END> .fromAfter("color", "green").to("color", "red")) .build()); }</code><technical_language>Please L instead of l easy misread</technical_language>

Target:
public void testAddRangeConstraints() { Assert.assertEquals("Should add equality constraints", URI.create("view:file:/datasets/test?color=[green,)"), new URIBuilder("dataset:file:/datasets/test") .constraints(empty.from("color", "green")) .build()); Assert.assertEquals("Should add equality constraints", URI.create("view:file:/datasets/test?color=(,green]"), new URIBuilder("dataset:file:/datasets/test") .constraints(empty.to("color", "green")) .build()); Assert.assertEquals("Should add equality constraints", URI.create("view:file:/datasets/test?timestamp=[0,1405720705333)&color=(green,red]"), new URIBuilder("dataset:file:/datasets/test") .constraints(empty .from("timestamp", 0l).toBefore("timestamp", 1405720705333L) .fromAfter("color", "green").to("color", "red")) .build()); }
Source:
<code>public Integer getSourcePort() { <START> return sourcePort == 0 ? null : this.sourcePort; <END> }</code><technical_language>a null check sourcePort is missing sourcePort is Integer null. If sourcePort is null comparison "== 0" problems debox sourcePort int. similar code crashed NPE: Integer sourcePort = null; int x = (sourcePort == 0 ? null : sourcePort);</technical_language>

Target:
public Integer getSourcePort() { return (this.sourcePort == null || this.sourcePort == 0) ? null : this.sourcePort; }
Source:
<code>private void checkFormUpdates() { for (DriveListItem item: driveList) { if (item.getType() == DriveListItem.FILE) { <START> if (isNewerFormVersionAvailable(item) || areNewerMediaFilesAvailable(item)) { <END> item.setNewerVersion(true); } } } }</code><technical_language>Please merge nested if statements. one</technical_language>

Target:
private void checkFormUpdates() { FormsDao formsDao = new FormsDao(); for (DriveListItem item: driveList) { if (item.getType() == DriveListItem.FILE) { try (Cursor cursor = formsDao.getFormsCursorForFormFilePath(storagePathProvider.getDirPath(StorageSubdirectory.FORMS) + File.separator + item.getName())) { if (cursor != null && cursor.moveToFirst() && (isNewerFormVersionAvailable(item) || areNewerMediaFilesAvailable(item))) { item.setNewerVersion(true); } } } } }
Source:
<code>public static AggregatorFactory[] mergeAggregators(List<AggregatorFactory[]> aggregatorsList) { if (aggregatorsList == null || aggregatorsList.isEmpty()) { return null; } Map<String, AggregatorFactory> mergedAggregators = new LinkedHashMap<>(); for (AggregatorFactory[] aggregators : aggregatorsList) { if (aggregators != null) { for (AggregatorFactory aggregator : aggregators) { String name = aggregator.getName(); if (mergedAggregators.containsKey(name)) { AggregatorFactory other = mergedAggregators.get(name); try { mergedAggregators.put(name, other.getMergingFactory(aggregator)); } catch (AggregatorFactoryNotMergeableException ex) { <START> LOG.warn(ex, "failed to merge aggregator factories"); <END> mergedAggregators = null; break; } } else { mergedAggregators.put(name, aggregator); } } } else { mergedAggregators = null; break; } } return mergedAggregators == null ? null : mergedAggregators.values().toArray(new AggregatorFactory[mergedAggregators.size()]); }</code><technical_language>lowercase log is more typical</technical_language>

Target:
public static AggregatorFactory[] mergeAggregators(List<AggregatorFactory[]> aggregatorsList) { if (aggregatorsList == null || aggregatorsList.isEmpty()) { return null; } Map<String, AggregatorFactory> mergedAggregators = new LinkedHashMap<>(); for (AggregatorFactory[] aggregators : aggregatorsList) { if (aggregators != null) { for (AggregatorFactory aggregator : aggregators) { String name = aggregator.getName(); if (mergedAggregators.containsKey(name)) { AggregatorFactory other = mergedAggregators.get(name); try { mergedAggregators.put(name, other.getMergingFactory(aggregator)); } catch (AggregatorFactoryNotMergeableException ex) { log.warn(ex, "failed to merge aggregator factories"); mergedAggregators = null; break; } } else { mergedAggregators.put(name, aggregator); } } } else { mergedAggregators = null; break; } } return mergedAggregators == null ? null : mergedAggregators.values().toArray(new AggregatorFactory[mergedAggregators.size()]); }