auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static private Map<String, List<String>> parseAttributes(final String attributesString) throws UnsupportedEncodingException { final Map<String, List<String>> attributes = new LinkedHashMap<>(); final List<String> splitLine = ParsingUtils.split(attributesString,ATTRIBUTE_DELIMITER); for(String attribute : splitLine) { final List<String> key_value = ParsingUtils.split(attribute,KEY_VALUE_SEPARATOR); <START> if (key_value.size()<2) { <END> continue; } attributes.put(URLDecoder.decode(key_value.get(0).trim(), "UTF-8"), decodeAttributeValue(key_value.get(1).trim())); } return attributes; }</code><technical_language>I remember if talked this unnecessary, a check > 2</technical_language>

Target:
static private Map<String, List<String>> parseAttributes(final String attributesString) throws UnsupportedEncodingException { if (attributesString.equals(Gff3Constants.UNDEFINED_FIELD_VALUE)) { return Collections.emptyMap(); } final Map<String, List<String>> attributes = new LinkedHashMap<>(); final List<String> splitLine = ParsingUtils.split(attributesString,Gff3Constants.ATTRIBUTE_DELIMITER); for(String attribute : splitLine) { final List<String> key_value = ParsingUtils.split(attribute,Gff3Constants.KEY_VALUE_SEPARATOR); if (key_value.size() != 2) { throw new TribbleException("Attribute string " + attributesString + " is invalid"); } attributes.put(URLDecoder.decode(key_value.get(0).trim(), "UTF-8"), decodeAttributeValue(key_value.get(1).trim())); } return attributes; }
Source:
<code>public ModelNode execute(ModelNode modelNode) throws IOException { initialize(); try { AuthCache authCache = new BasicAuthCache(); authCache.put(target, getDigestScheme()); localContext.setAuthCache(authCache); CloseableHttpResponse response = httpClient.execute(target, buildRequest(modelNode), localContext); ModelNode m = ModelNode.fromJSONStream(response.getEntity().getContent()); response.close(); return m; } catch (MalformedChallengeException e) { <START> e.printStackTrace(); <END> } return null; }</code><technical_language>No</technical_language>

Target:
public ModelNode execute(ModelNode modelNode) throws IOException { ModelNode result; CloseableHttpResponse response = client.execute(buildRequest(modelNode)); try { result = parseResponse(response); } finally { response.close(); } return result; }
Source:
<code>public void setParams(Map<Object, Double> map) { if (map != null) { if (map.size() == 0) { throw new IllegalArgumentException( "no elements within map for categorical distribution"); } double sum = 0.0; <START> for (Object key : map.keySet()) { <END> double prob = map.get(key); if (prob < 0) { throw new IllegalArgumentException("Probability " + prob + " for key " + key.toString() + " is negative"); } sum += prob; } if (sum < 1e-9) { throw new IllegalArgumentException( "probabilities sum to approximately zero"); } this.map = new HashMap<Object, Double>(); this.logMap = new HashMap<Object, Double>(); this.objects = new Object[map.size()]; this.cdfObjects = new double[map.size()]; int count = 0; double cdf = 0.0; for (Object key : map.keySet()) { this.objects[count] = key; double prob = map.get(key) / sum; cdf += prob; this.cdfObjects[count] = cdf; this.map.put(key, prob); this.logMap.put(key, Math.log(prob)); count += 1; } this.hasMap = true; } }</code><technical_language>EntrySet faster</technical_language>

Target:
public void setParams(Map<Object, Double> map) { if (map != null) { if (map.size() == 0) { throw new IllegalArgumentException( "no elements within map for categorical distribution"); } double sum = 0.0; for (Map.Entry<Object, Double> entry : map.entrySet()) { double prob = entry.getValue(); if (prob < 0) { throw new IllegalArgumentException("Probability " + prob + " for key " + entry.getKey().toString() + " is negative"); } sum += prob; } if (sum < 1e-9) { throw new IllegalArgumentException( "probabilities sum to approximately zero"); } this.map = new HashMap<Object, Double>(); this.logMap = new HashMap<Object, Double>(); this.objects = new Object[map.size()]; this.cdfObjects = new double[map.size()]; int count = 0; double cdf = 0.0; for (Map.Entry<Object, Double> entry : map.entrySet()) { Object key = entry.getKey(); Double value = entry.getValue(); this.objects[count] = key; double prob = value / sum; cdf += prob; this.cdfObjects[count] = cdf; this.map.put(key, prob); this.logMap.put(key, Math.log(prob)); count += 1; } this.hasMap = true; } }
Source:
<code>public String getXRegistryConfigHeaderValue(@Nullable AuthConfigs paramAuthConfigs) { Map<String, AuthConfig> authConfigs = new HashMap<>(); authConfigs.putAll(initialAuthConfig.getAuthConfigs().getConfigs()); if (paramAuthConfigs != null && paramAuthConfigs.getConfigs() != null) { authConfigs.putAll(paramAuthConfigs.getConfigs()); } <START> authConfigs.putAll(dynamicAuthResolver.getDynamicXRegistryConfig()); <END> authConfigs = normalizeDockerHubRegistryUrl(authConfigs); return Base64.getEncoder().encodeToString(JsonHelper.toJson(authConfigs).getBytes()); }</code><technical_language>Resolver is declared dynamic, declare in method name</technical_language>

Target:
public String getXRegistryConfigHeaderValue(@Nullable AuthConfigs paramAuthConfigs) { Map<String, AuthConfig> authConfigs = new HashMap<>(); authConfigs.putAll(initialAuthConfig.getAuthConfigs().getConfigs()); if (paramAuthConfigs != null && paramAuthConfigs.getConfigs() != null) { authConfigs.putAll(paramAuthConfigs.getConfigs()); } authConfigs.putAll(dynamicAuthResolver.getXRegistryConfig()); authConfigs = normalizeDockerHubRegistryUrl(authConfigs); return Base64.getEncoder().encodeToString(JsonHelper.toJson(authConfigs).getBytes()); }
Source:
<code>@Test void testMergeJoinDeriveRight2() { final String sql = "select * from sales.bonus s join\n" + "(select ename, job, mgr, max(sal) from sales.emp group by ename, job, mgr) r\n" + "on r.job=s.job and r.ename=s.ename"; Query.create(sql) <START> .removeRules(NON_DETERMINISTIC_JOIN_ORDER_RULES) <END> .removeRules(NON_MERGE_JOIN_RULES) .removeRule(EnumerableRules.ENUMERABLE_AGGREGATE_RULE) .addRule(EnumerableRules.ENUMERABLE_SORTED_AGGREGATE_RULE) .check(); }</code><technical_language>I removed default</technical_language>

Target:
@Test void testMergeJoinDeriveRight2() { final String sql = "select * from sales.bonus s join\n" + "(select ename, job, mgr, max(sal) from sales.emp group by ename, job, mgr) r\n" + "on r.job=s.job and r.ename=s.ename"; Query.create(sql) .removeRule(EnumerableRules.ENUMERABLE_JOIN_RULE) .check(); }
Source:
<code>public IndexSettings build() { boolean empty = true; IndexSettings settings = new IndexSettings(); if ( !analyzers.isEmpty() ) { empty = false; getAnalysis( settings ).setAnalyzers( analyzers ); } if ( !tokenizers.isEmpty() ) { empty = false; getAnalysis( settings ).setTokenizers( tokenizers ); } if ( !tokenFilters.isEmpty() ) { empty = false; getAnalysis( settings ).setTokenFilters( tokenFilters ); } if ( !charFilters.isEmpty() ) { empty = false; getAnalysis( settings ).setCharFilters( charFilters ); } if ( empty ) { return null; } else { <START> return settings; <END> } }</code><technical_language>return empty IndexSettings in case a definition? feel more natural. Especially if imagine add other settings</technical_language>

Target:
public IndexSettings build() { IndexSettings settings = new IndexSettings(); if ( !analyzers.isEmpty() ) { getAnalysis( settings ).setAnalyzers( analyzers ); } if ( !tokenizers.isEmpty() ) { getAnalysis( settings ).setTokenizers( tokenizers ); } if ( !tokenFilters.isEmpty() ) { getAnalysis( settings ).setTokenFilters( tokenFilters ); } if ( !charFilters.isEmpty() ) { getAnalysis( settings ).setCharFilters( charFilters ); } return settings; }
Source:
<code>private void writeWebContextVar( PrintWriter writer, String variable, String value, boolean deprecated, boolean escapeValue ) { if ( escapeValue ) { value = escapeEnvironmentVar( value ); } if ( deprecated ) { writer.write( "\n " ); } writer.write( "\nvar " + variable + " = " + value + ";\n" ); if ( variable.equals( "SESSION_LOCALE" ) ) { writer.write( "\nif (pen != null && pen.define) {" ); <START> writer.write( "\n pen.define('Locale', { locale: " + value + " });" ); <END> writer.write( "\n}\n" ); } }</code><technical_language>Please move this out of writeWebContextVar</technical_language>

Target:
private void writeWebContextVar( PrintWriter writer, String variable, String value, boolean deprecated, boolean escapeValue ) { if ( escapeValue ) { value = escapeEnvironmentVar( value ); } if ( deprecated ) { writer.write( "\n " ); } writer.write( "\nvar " + variable + " = " + value + ";\n" ); }
Source:
<code>CookiePage(byte[] page) throws IOException { if (page == null || page.length == 0) { <START> throw new IllegalArgumentException("Invalid value for page passes to CookiePage constructor"); END> } pageBuffer = ByteBuffer.wrap(page); if (pageBuffer.getInt() != PAGE_HEADER_VALUE) { pageBuffer = null; throw new IOException("Invalid file format, bad page head value found"); } pageBuffer.order(ByteOrder.LITTLE_ENDIAN); int count = pageBuffer.getInt(); cookieOffSets = new int[count]; for (int cnt = 0; cnt < count; cnt++) { cookieOffSets[cnt] = pageBuffer.getInt(); } pageBuffer.getInt(); }</code><technical_language>"passed" "passes." more helpful for debugging "null zero length array passed page argument."</technical_language>

Target:
CookiePage(byte[] page) throws IOException { if (page == null || page.length == 0) { throw new IllegalArgumentException("Invalid value for page passed to CookiePage constructor"); } pageBuffer = ByteBuffer.wrap(page); if (pageBuffer.getInt() != PAGE_HEADER_VALUE) { pageBuffer = null; throw new IOException("Invalid file format, bad page head value found"); } pageBuffer.order(ByteOrder.LITTLE_ENDIAN); int count = pageBuffer.getInt(); cookieOffSets = new int[count]; for (int cnt = 0; cnt < count; cnt++) { cookieOffSets[cnt] = pageBuffer.getInt(); } pageBuffer.getInt(); }
Source:
<code>public void allWithOneTask() throws Exception{ final Repo repo = new MkRepo(); final Region region = DyTasksTest.region(repo.name(),10L); DyTasks tasks = new DyTasks(region, repo); Iterator<Task> iteTask = tasks.all().iterator(); <START> MatcherAssert.assertThat(iteTask.hasNext(),Matchers.equalTo(true)); <END> iteTask.next(); MatcherAssert.assertThat(iteTask.hasNext(),Matchers.equalTo(false)); }</code><technical_language>Matchers.iterableWithSize(...)</technical_language>

Target:
public void allWithOneTask() throws Exception { final Repo repo = new MkRepo(); final DyTasks tasks = new DyTasks( DyTasksTest.region(repo.name(), 10L), repo ); MatcherAssert.assertThat( tasks.all(), Matchers.<Task>iterableWithSize(1) ); }
Source:
<code><START> public AutoRegisterModules(String <END> pluginName, PluginGuiceEnvironment env, JarFile jarFile, ClassLoader classLoader) { this.pluginName = pluginName; this.env = env; this.jarFile = jarFile; this.classLoader = classLoader; this.sshGen = env.hasSshModule() ? env.newSshModuleGenerator() : null; this.httpGen = env.hasHttpModule() ? env.newHttpModuleGenerator() : null; }</code><technical_language>needed in this change</technical_language>

Target:
AutoRegisterModules(String pluginName, PluginGuiceEnvironment env, JarFile jarFile, ClassLoader classLoader) { this.pluginName = pluginName; this.env = env; this.jarFile = jarFile; this.classLoader = classLoader; this.sshGen = env.hasSshModule() ? env.newSshModuleGenerator() : null; this.httpGen = env.hasHttpModule() ? env.newHttpModuleGenerator() : null; }
Source:
<code>private Session performOpenSession(IProgressMonitor monitor) { Session session = null; try { SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.OpenRepresentationsFileJob_loadRepresentationsTask, 16); if (SiriusUtil.SESSION_RESOURCE_EXTENSION.equals(representationsFileURI.fileExtension())) { subMonitor.worked(1); subMonitor.subTask(MessageFormat.format(Messages.OpenRepresentationsFileJob_loadReferencedModelsTask, representationsFileURI.lastSegment())); session = <START> SessionUIManager.INSTANCE.openSession(representationsFileURI, <END> subMonitor.newChild(14)); if (session != null) { IEditingSession editingSession = SessionUIManager.INSTANCE.getOrCreateUISession(session); if (!editingSession.isOpen()) { editingSession.open(); } } subMonitor.worked(1); } } finally { monitor.done(); } return session; }</code><technical_language>SessionUIManager</technical_language>

Target:
private Session performOpenSession(IProgressMonitor monitor) { Session session = null; try { SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.OpenRepresentationsFileJob_loadRepresentationsTask, 16); if (SiriusUtil.SESSION_RESOURCE_EXTENSION.equals(representationsFileURI.fileExtension())) { subMonitor.worked(1); subMonitor.subTask(MessageFormat.format(Messages.OpenRepresentationsFileJob_loadReferencedModelsTask, representationsFileURI.lastSegment())); session = SessionManager.INSTANCE.openSession(representationsFileURI, subMonitor.newChild(14), SiriusEditPlugin.getPlugin().getUiCallback()); if (session != null) { IEditingSession editingSession = SessionUIManager.INSTANCE.getOrCreateUISession(session); if (!editingSession.isOpen()) { editingSession.open(); } } subMonitor.worked(1); } } finally { monitor.done(); } return session; }
Source:
<code>private String formatError(String errorMessage) { String result = errorMessage; if (errorMessage != null && !errorMessage.isEmpty()) { <START> if (errorMessage.startsWith( "<" )) { <END> result = errorMessage.replaceAll( "\\\\n", "<br/>" ); } else { StringBuilder sb = new StringBuilder(); int id = ++labelCnt; String[] s = errorMessage.split( "\\n" ); sb.append( "<input class=\"collapse\" id=\"_"+ id +"\" type=\"checkbox\"><label for=\"_" + id + "\">" ); sb.append( s[0] ); sb.append( "</label><div>" ); for ( int i = 1; i < s.length; i++) { if ( i > 1 ) { sb.append( "<br/>" ); } sb.append( s[i] ); } sb.append( "</div>" ); result = sb.toString(); } } return result; }</code><technical_language>Change if (StringUtils.isNotEmpty(errorMessage)) apache common imported</technical_language>

Target:
private String formatError(String errorMessage) { String result = errorMessage; if (errorMessage != null && !errorMessage.isEmpty()) { if (errorMessage.startsWith( "<" )) { result = errorMessage.replaceAll( "\\\\n", "<br/>" ); } else { int id = ++labelCount; String[] headLineAndTrace = StringUtils.split( errorMessage , "\n", 2 ); result = String.format( "<input class=\"collapse\" id=\"_%d\" type=\"checkbox\"><label for=\"_%d\">%s</label><div>%s</div>", id, id, headLineAndTrace[0], headLineAndTrace[1].replaceAll( "\n", "<br/>" ) ); } } return result; }
Source:
<code>protected boolean canDoAction() { if (!checkRemoveEditValidations()) { return false; } if (SchedulingManager.getInstance().getClustersByClusterPolicyId(getParameters().getClusterPolicyId()).size() > 0) { StringBuffer attachedClustersStringBf = new StringBuffer(""); List<VDSGroup> attachedClustersList = SchedulingManager.getInstance().getClustersByClusterPolicyId(getParameters().getClusterPolicyId()); <START> boolean isFirstCluster = true; for (VDSGroup vdsGroup : attachedClustersList) { if (isFirstCluster == false) attachedClustersStringBf.append(','); attachedClustersStringBf.append('\'').append(vdsGroup.getName()).append('\''); isFirstCluster = false; } <END> return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_POLICY_INUSE, String.format("$clusters %1$s", attachedClustersStringBf.toString())); } return true; }</code><technical_language>replace Entities.collectionToString</technical_language>

Target:
protected boolean canDoAction() { if (!checkRemoveEditValidations()) { return false; } if (SchedulingManager.getInstance().getClustersByClusterPolicyId(getParameters().getClusterPolicyId()).size() > 0) { StringBuilder attachedClustersStringBf = new StringBuilder(""); List<VDSGroup> attachedClustersList = SchedulingManager.getInstance().getClustersByClusterPolicyId(getParameters().getClusterPolicyId()); boolean isFirstCluster = true; for (VDSGroup vdsGroup : attachedClustersList) { if (isFirstCluster == false) attachedClustersStringBf.append(','); attachedClustersStringBf.append('\'').append(vdsGroup.getName()).append('\''); isFirstCluster = false; } return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_POLICY_INUSE, String.format("$clusters %1$s", attachedClustersStringBf.toString())); } return true; }
Source:
<code>public void setVirtSpecifier(ICPPASTClassVirtSpecifier virtSpecifier) { assertNotFrozen(); if (virtSpecifier != null) { <START> this.virtSpecifier = virtSpecifier; <END> virtSpecifier.setParent(this); virtSpecifier.setPropertyInParent(CLASS_VIRT_SPECIFIER); } }</code><technical_language>this line of 'if' statement</technical_language>

Target:
public void setVirtSpecifier(ICPPASTClassVirtSpecifier virtSpecifier) { assertNotFrozen(); this.virtSpecifier = virtSpecifier; if (virtSpecifier != null) { virtSpecifier.setParent(this); virtSpecifier.setPropertyInParent(CLASS_VIRT_SPECIFIER); } }
Source:
<code>static void checkArrayRange(boolean[] array, int offset, int length) { <START> if (array == null) { <END> return; } if (offset < 0 || length < 0 || offset + length > array.length) { throw new IndexOutOfBoundsException(format("Invalid offset %s and length %s in array with %s elements", offset, length, array.length)); } }</code><technical_language>other checkArrayRange method L38 allow null input; is reason allow nulls here? move null check caller this method throw null input one</technical_language>

Target:
static void checkArrayRange(boolean[] array, int offset, int length) { requireNonNull(array, "array is null"); if (offset < 0 || length < 0 || offset + length > array.length) { throw new IndexOutOfBoundsException(format("Invalid offset %s and length %s in array with %s elements", offset, length, array.length)); } }
Source:
<code>public Hooks list() { VdcQueryReturnValue result = runQuery(VdcQueryType.GetVdsHooksById2, new GetVdsHooksByIdParameters(asGuid(hostId))); HashMap<String, HashMap<String, HashMap<String, String>>> dictionary = (HashMap<String, HashMap<String, HashMap<String, String>>>) result.getReturnValue(); Hooks hooks = new Hooks(); for (Map.Entry<String, HashMap<String, HashMap<String, String>>> keyValuePair : dictionary.entrySet()) { for (Map.Entry<String, HashMap<String, String>> keyValuePair1 : keyValuePair.getValue() .entrySet()) { <START> Hook hook = createHook(keyValuePair, keyValuePair1); <END> hooks.getHooks().add(hook); } } return hooks; }</code><technical_language>this code ^ is in Mapper</technical_language>

Target:
public Hooks list() { VdcQueryReturnValue result = runQuery(VdcQueryType.GetVdsHooksById2, new GetVdsHooksByIdParameters(asGuid(hostId))); HashMap<String, HashMap<String, HashMap<String, String>>> hooksMap = (HashMap<String, HashMap<String, HashMap<String, String>>>) result.getReturnValue(); Hooks hooks = mappingLocator.getMapper(HashMap.class, Hooks.class).map(hooksMap, null); return hooks; }
Source:
<code>public static void main(String[] args) throws EdisonException, AnnotatorException { gazetteersInstance.ignoreGazetteer("Weapons.gz"); gazetteersInstance.ignoreGazetteer("Weapons.Missile.gz"); List<String[]> sentences = Arrays.asList("I live in Chicago , Illinois .".split("\\s+"), "I met George Bush .".split("\\s+")); TextAnnotation ta = BasicTextAnnotationBuilder.createTextAnnotationFromTokens(sentences); ta.addView(gazetteersInstance); <START> logger.info(ta.toString()); <END> logger.info(ta.getView(gazetteersInstance.getViewName()).toString()); }</code><technical_language>main(), STDOUT</technical_language>

Target:
public static void main(String[] args) throws EdisonException, AnnotatorException { gazetteersInstance.ignoreGazetteer("Weapons.gz"); gazetteersInstance.ignoreGazetteer("Weapons.Missile.gz"); List<String[]> sentences = Arrays.asList("I live in Chicago , Illinois .".split("\\s+"), "I met George Bush .".split("\\s+")); TextAnnotation ta = BasicTextAnnotationBuilder.createTextAnnotationFromTokens(sentences); ta.addView(gazetteersInstance); System.out.println(ta.toString()); System.out.println(ta.getView(gazetteersInstance.getViewName()).toString()); }
Source:
<code>public Mutation toMutation(K key) { <START> return new Mutations.ReadWriteWithValue<>(value, f); <END> }</code><technical_language>Mutations need encoder classes, too</technical_language>

Target:
public Mutation toMutation(K key) { V valueFromStorage = (V) cacheEncoders.valueFromStorage(value); return new Mutations.ReadWriteWithValue<>(valueFromStorage, f); }
Source:
<code>void closeAllWithoutFlushing() throws IOException { <START> try { <END> fileInfos.forEach((key, fileInfo) -> { try { fileInfo.close(false); } catch (IOException e) { throw new UncheckedExecutionException(e); } }); } catch (UncheckedExecutionException uee) { if (uee.getCause() instanceof IOException) { throw (IOException) uee.getCause(); } else { throw new IOException("Unknown exception is thrown on closing all file infos", uee.getCause()); } } }</code><technical_language>I point of this change. pretty a foreach loop in place avoid this</technical_language>

Target:
void closeAllWithoutFlushing() throws IOException { try { fileInfos.forEach((key, fileInfo) -> { try { fileInfo.close(false); } catch (IOException e) { throw new UncheckedIOException(e); } }); } catch (UncheckedIOException uioe) { throw uioe.getCause(); } }
Source:
<code>public void apply(EntityLocal entity) { super.apply(entity); <START> Maybe<T> v = Tasks.resolving(value).as((Class<T>)sensor.getType()).timeout(Duration.millis(200)).getMaybe(); <END> if (v.isPresent()) { log.debug(this+" setting sensor "+sensor+" to "+v.get()); entity.setAttribute(sensor, v.get()); } else { log.debug(this+" not setting sensor "+sensor+"; cannot resolve "+value); } }</code><technical_language>set raw resolve & coerce read time? resolve timeouts arbitrarily chosen - 50ms other places. a global constant instead</technical_language>

Target:
public void apply(EntityLocal entity) { super.apply(entity); Maybe<T> v = Tasks.resolving(value).as((Class<T>)sensor.getType()).timeout(ValueResolver.PRETTY_QUICK_WAIT).getMaybe(); if (v.isPresent()) { log.debug(this+" setting sensor "+sensor+" to "+v.get()); entity.setAttribute(sensor, v.get()); } else { log.debug(this+" not setting sensor "+sensor+"; cannot resolve "+value); } }
Source:
<code>public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { if (env.getIteratorScope() == IteratorScope.scan) { throw new IllegalArgumentException(); } this.source = source; isFullMajc = env.getIteratorScope() == IteratorScope.majc && env.isFullMajorCompaction(); String oats = options.get(OLDEST_ACTIVE_TS_OPT); if (oats != null) { oldestActiveTs = Long.valueOf(oats); } else { String zookeepers = options.get(ZOOKEEPER_CONNECT_OPT); if (zookeepers == null) { throw new IllegalArgumentException("A configuration item for GC iterator was not set"); } <START> oldestActiveTs = ZookeeperUtil.getGcTimestamp(zookeepers); <END> } }</code><technical_language>changing this variable name gcTimestamp this code more clear? I guess gcTimestamp is technically oldest active timestamp a confusing</technical_language>

Target:
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { if (env.getIteratorScope() == IteratorScope.scan) { throw new IllegalArgumentException(); } this.source = source; isFullMajc = env.getIteratorScope() == IteratorScope.majc && env.isFullMajorCompaction(); String oats = options.get(GC_TIMESTAMP_OPT); if (oats != null) { gcTimestamp = Long.valueOf(oats); } else { String zookeepers = options.get(ZOOKEEPER_CONNECT_OPT); if (zookeepers == null) { throw new IllegalArgumentException("A configuration item for GC iterator was not set"); } gcTimestamp = ZookeeperUtil.getGcTimestamp(zookeepers); } }
Source:
<code>public static synchronized SparkSession getSessionUnsafe() { SparkSession sessionToUse = sessions.get(); boolean isOlapWorker = Thread.currentThread().getName().startsWith("olap-worker-"); boolean needsReinitialization = !isOlapWorker && (sessionToUse == null || sessionToUse.sparkContext().isStopped()) && (session != null && !session.sparkContext().isStopped()); if (!initialized) { sessionToUse = session = initializeSparkSession(); ctx = new JavaSparkContext(session.sparkContext()); initialized = true; } else if (!needsReinitialization && session.sparkContext().isStopped()) { LOG.warn("SparkContext is stopped, reinitializing..."); try { if (UserGroupInformation.isSecurityEnabled() && UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.getLoginUser().checkTGTAndReloginFromKeytab(); } } catch (IOException e) { throw new RuntimeException(e); } if (isOlapWorker) System.exit(0); sessionToUse = session = initializeSparkSession(); ctx = new JavaSparkContext(session.sparkContext()); } else { if (sessionToUse == null || needsReinitialization) { String allowMultipleContextsString = null; try { <START> allowMultipleContextsString = session.conf().get("spark.driver.allowMultipleContexts"); <END> } catch (NoSuchElementException e) { } boolean allowMultipleContexts = allowMultipleContextsString != null && allowMultipleContextsString.equals("true"); if (session != null && !allowMultipleContexts) sessionToUse = session.newSession(); else sessionToUse = initializeSparkSession(); } } sessions.set(sessionToUse); return sessionToUse; }</code><technical_language>get rid of spark.driver.allowMultipleContexts in tests remove this special case</technical_language>

Target:
public static synchronized SparkSession getSessionUnsafe() { SparkSession sessionToUse = sessions.get(); boolean isOlapWorker = Thread.currentThread().getName().startsWith("olap-worker-"); boolean needsReinitialization = !isOlapWorker && (sessionToUse == null || sessionToUse.sparkContext().isStopped()) && (session != null && !session.sparkContext().isStopped()); if (!initialized) { sessionToUse = session = initializeSparkSession(); ctx = new JavaSparkContext(session.sparkContext()); initialized = true; } else if (!needsReinitialization && session.sparkContext().isStopped()) { LOG.warn("SparkContext is stopped, reinitializing..."); try { if (UserGroupInformation.isSecurityEnabled() && UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.getLoginUser().checkTGTAndReloginFromKeytab(); } } catch (IOException e) { throw new RuntimeException(e); } if (isOlapWorker) { LOG.error("Olap server's connected to Spark is stopped, shutting down OLAP worker task."); System.exit(0); } sessionToUse = session = initializeSparkSession(); ctx = new JavaSparkContext(session.sparkContext()); } else { if (sessionToUse == null || needsReinitialization) { if (session != null) sessionToUse = session.newSession(); else sessionToUse = initializeSparkSession(); } } sessions.set(sessionToUse); return sessionToUse; }
Source:
<code>public void forceDispatchBlocking() { Thread dispatchThread = null; synchronized (mThreadControl) { mForcedBlocking = true; <START> if (mRunning) { <END> dispatchThread = mDispatchThread; mRetryCounter = 0; mSleepToken.release(); } } if (dispatchThread != null) { try { dispatchThread.join(); } catch (InterruptedException e) { Timber.tag(TAG).i("Interrupted while waiting for dispatch thread to complete"); } } if (!mEventCache.isEmpty()) { synchronized (mThreadControl) { mRunning = true; mSleepToken.release(); } mLoop.run(); } synchronized (mThreadControl) { mForcedBlocking = false; } }</code><technical_language>reduce duplicate code calling forceDispatch() here</technical_language>

Target:
public void forceDispatchBlocking() { synchronized (mThreadControl) { mForcedBlocking = true; } if (forceDispatch()) { mSleepToken.release(); } Thread dispatchThread = mDispatchThread; if (dispatchThread != null) { try { dispatchThread.join(); } catch (InterruptedException e) { Timber.tag(TAG).d("Interrupted while waiting for dispatch thread to complete"); } } synchronized (mThreadControl) { mForcedBlocking = false; } }
Source:
<code>public CompletableFuture<byte[]> checkpointCoordinator(long checkpointId) throws Exception { ensureStarted(); return CompletableFuture.supplyAsync(() -> { try { LOG.debug("Taking a state snapshot for checkpoint {}", checkpointId); return toBytes(checkpointId); } catch (Exception e) { <START> throw new FlinkRuntimeException("Failed to checkpoint coordinator due to ", e); <END> } }, coordinatorExecutor); }</code><technical_language>nice avoid exception wrapping possible. checked exceptions work Futures, I is wrap in a CompletionException automatically unwrapped accessing original exception</technical_language>

Target:
public CompletableFuture<byte[]> checkpointCoordinator(long checkpointId) throws Exception { ensureStarted(); return CompletableFuture.supplyAsync(() -> { try { LOG.debug("Taking a state snapshot on operator for checkpoint {}", operatorName, checkpointId); return toBytes(checkpointId); } catch (Exception e) { throw new CompletionException( String.format("Failed to checkpoint coordinator for source %s due to ", operatorName), e); } }, coordinatorExecutor); }
Source:
<code>private GatewaySenderException getInitializeConnectionExceptionToThrow( ServerConnectivityException e) { GatewaySenderException gse = null; if (e.getCause() instanceof GemFireSecurityException) { gse = new GatewaySenderException(e.getCause()); } else { List<ServerLocation> servers = this.sender.getProxy().getCurrentServers(); String ioMsg; if (servers.size() == 0) { ioMsg = "There are no active servers."; } else { final StringBuilder buffer = new StringBuilder(); for (ServerLocation server : servers) { String endpointName = String.valueOf(server); if (buffer.length() > 0) { buffer.append(", "); } buffer.append(endpointName); } ioMsg = String.format( "No available connection was found, but the following active servers exist: %s", buffer.toString()); } if (this.sender.getEnforceThreadsConnectSameReceiver()) { <START> if (Pattern.compile("Cannot get connection to .* after .* attempts.") <END> .matcher(e.getMessage()).find()) { ioMsg += " " + e.getMessage(); } } IOException ex = new IOException(ioMsg); gse = new GatewaySenderException( String.format("%s : Could not connect due to: %s", new Object[] {this.processor.getSender().getId(), ex.getMessage()}), ex); } return gse; }</code><technical_language>This matching fail if exception message generated in retryInitializeConnection() is changed. Is a prevent future changes code breaking this check</technical_language>

Target:
private GatewaySenderException getInitializeConnectionExceptionToThrow( ServerConnectivityException e) { GatewaySenderException gse = null; if (e.getCause() instanceof GemFireSecurityException) { gse = new GatewaySenderException(e.getCause()); } else { List<ServerLocationAndMemberId> servers = this.sender.getProxy().getCurrentServers(); String ioMsg; if (servers.size() == 0) { ioMsg = "There are no active servers."; } else { final StringBuilder buffer = new StringBuilder(); for (ServerLocationAndMemberId server : servers) { String endpointName = String.valueOf(server); if (buffer.length() > 0) { buffer.append(", "); } buffer.append(endpointName); } ioMsg = String.format( "No available connection was found, but the following active servers exist: %s", buffer.toString()); } if (this.sender.getEnforceThreadsConnectSameReceiver() && e.getMessage() != null) { if (Pattern.compile(maxAttemptsReachedConnectingServerIdExceptionMessage + ".*") .matcher(e.getMessage()).find()) { ioMsg += " " + e.getMessage(); } } IOException ex = new IOException(ioMsg); gse = new GatewaySenderException( String.format("%s : Could not connect due to: %s", new Object[] {this.processor.getSender().getId(), ex.getMessage()}), ex); } return gse; }
Source:
<code>public TmfTrace() { <START> super(); <END> TmfSignalManager.deregister(this); TmfSignalManager.registerVIP(this); }</code><technical_language>Another option create TmfComponent constructors (boolean vip) parameter. call super(true) here</technical_language>

Target:
public TmfTrace() { super(); registerAsVip(); }
Source:
<code><START> public final String handleOnNextValueRendering(Object item) { <END> try { return render(item); } catch (Throwable t) { return item.getClass().getName() + ERROR_IN_RENDERING_SUFFIX; } }</code><technical_language>add @Experimental for right 1.0.x release cycle</technical_language>

Target:
public final String handleOnNextValueRendering(Object item) { try { return render(item); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Throwable t) { Exceptions.throwIfFatal(t); } return item.getClass().getName() + ERROR_IN_RENDERING_SUFFIX; }
Source:
<code>public final int run(IoExecutionContext context) { int handled = 0; try { int strategy = selectStrategy.calculateStrategy(selectNowSupplier, context.isTaskReady()); switch (strategy) { case SelectStrategy.CONTINUE: return 0 ; case SelectStrategy.BUSY_WAIT: strategy = epollBusyWait(); break; case SelectStrategy.SELECT: strategy = epollWait(context, WAKEN_UP_UPDATER.getAndSet(this, 0) == 1); if (wakenUp == 1) { Native.eventFdWrite(eventFd.intValue(), 1L); } default: } if (strategy > 0) { handled = strategy; processReady(events, strategy); } if (allowGrowing && strategy == events.length()) { events.increase(); <START> } <END> } catch (Throwable t) { handleLoopException(t); } try { if (context.isShuttingDown()) { closeAll(); } } catch (Throwable t) { handleLoopException(t); } return handled; }</code><technical_language>Nit: want rename handleLoopException()</technical_language>

Target:
public final int run(IoExecutionContext context) { int handled = 0; try { int strategy = selectStrategy.calculateStrategy(selectNowSupplier, !context.canBlock()); switch (strategy) { case SelectStrategy.CONTINUE: return 0 ; case SelectStrategy.BUSY_WAIT: strategy = epollBusyWait(); break; case SelectStrategy.SELECT: strategy = epollWait(context, WAKEN_UP_UPDATER.getAndSet(this, 0) == 1); if (wakenUp == 1) { Native.eventFdWrite(eventFd.intValue(), 1L); } default: } if (strategy > 0) { handled = strategy; processReady(events, strategy); } if (allowGrowing && strategy == events.length()) { events.increase(); } } catch (Throwable t) { handleLoopException(t); } return handled; }
Source:
<code>static Lookup noLookup() { return node -> { verify(!(node instanceof GroupReference), "Unexpected GroupReference"); <START> return ImmutableList.of(node).stream(); <END> }; }</code><technical_language>Stream.of(node)</technical_language>

Target:
static Lookup noLookup() { return node -> { verify(!(node instanceof GroupReference), "Unexpected GroupReference"); return Stream.of(node); }; }
Source:
<code>public TableMetaDataView getTableMetaDataView(RegionMapping regionMapping) { DataSource dataSource = getDataSource(regionMapping.getDataSourceName()); if (dataSource == null) { throw new JdbcConnectorException("No datasource \"" + regionMapping.getDataSourceName() <START> + "\" found when getting table meta data \"" + regionMapping.getRegionName() + "\""); <END> } return getTableMetaDataView(regionMapping, dataSource); }</code><technical_language>data source do table metadata region name. I recommend removing this line of error message</technical_language>

Target:
public TableMetaDataView getTableMetaDataView(RegionMapping regionMapping) { DataSource dataSource = getDataSource(regionMapping.getDataSourceName()); if (dataSource == null) { throw new JdbcConnectorException("No datasource \"" + regionMapping.getDataSourceName() + "\" found when getting table meta data \"" + regionMapping.getTableName() + "\""); } return getTableMetaDataView(regionMapping, dataSource); }
Source:
<code>protected boolean canModify(ItemStack tool, ItemStack[] input) { NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); if (tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key)) <START> return false; END> if (Arrays.asList(((ToolCore) tool.getItem()).getTraits()).contains("ammo")) return false; return true; }</code><technical_language>Santa is whiney excluding brackets in one-statement if-constructers</technical_language>

Target:
protected boolean canModify(ItemStack tool, ItemStack[] input) { NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); if (tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key)) { return false; } if (Arrays.asList(((ToolCore) tool.getItem()).getTraits()).contains("ammo")) { return false; } return true; }
Source:
<code>public void disconnect(KieServerInfo serverInfo) { if (this.client.isActive()) { this.client.close(); } else { KieServerState currentState = context.getStateRepository().load(KieServerEnvironment.getServerId()); Set<String> controllers = currentState.getControllers(); KieServerConfig config = currentState.getConfiguration(); if (controllers != null && !controllers.isEmpty()) { for (String controllerUrl : controllers) { <START> if (controllerUrl != null && !controllerUrl.isEmpty() && !controllerUrl.toLowerCase().startsWith("ws") || !controllerUrl.toLowerCase().startsWith("wss")) { <END> logger.info("Kie Server points to non websocket controller '{}', using default REST mechanism", controllerUrl); boolean disconnected = restController.disconnectFromSingleController(serverInfo, config, controllerUrl); if (disconnected) { break; } } } } } }</code><technical_language>This condition bugy: && binds stronger || structure is if ((_ && _ && _) || !controllerUrl.toLowerCase().startsWith("wss")) throw NPE controllerURL is null. connect this && put parenthesis startsWith pieces</technical_language>

Target:
public void disconnect(KieServerInfo serverInfo) { if (this.client.isActive()) { this.client.close(); } else { KieServerState currentState = context.getStateRepository().load(KieServerEnvironment.getServerId()); Set<String> controllers = currentState.getControllers(); KieServerConfig config = currentState.getConfiguration(); if (controllers != null && !controllers.isEmpty()) { for (String controllerUrl : controllers) { if (controllerUrl != null && !controllerUrl.isEmpty() && !controllerUrl.toLowerCase().startsWith("ws")) { logger.info("Kie Server points to non websocket controller '{}', using default REST mechanism", controllerUrl); boolean disconnected = restController.disconnectFromSingleController(serverInfo, config, controllerUrl); if (disconnected) { break; } } } } } }
Source:
<code>public final void draw(GC gc, ITimeGraphPresentationProvider provider) { Rectangle bounds = getBounds(); if (bounds.width <= 0) { return; } RGBA rgba = getBackgroundColor(); if (rgba != null) { int prevAlpha = gc.getAlpha(); Color prevBgColor = gc.getBackground(); Color prevFgColor = gc.getForeground(); int prevLineWidth = gc.getLineWidth(); gc.setAlpha(rgba.alpha); Color bgColor = TimeGraphControl.getColor(RGBAUtil.fromRGBA(rgba)); gc.setBackground(bgColor); RGBA foregroundColor = getForegroundColor(); if (foregroundColor != null) { Color fgColor = TimeGraphControl.getColor(RGBAUtil.fromRGBA(foregroundColor)); gc.setForeground(fgColor); } if (fLineWidth >= 0) { gc.setLineWidth(fLineWidth); <START> } <END> innerDraw(gc); if (foregroundColor != null) { drawBorder(gc); } gc.setBackground(prevBgColor); gc.setAlpha(prevAlpha); postDraw(provider, gc); gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); } }</code><technical_language>innerDraw need lineWidth foreground? care of business assumptions base class? I draw operation set needed color leave GC is (e.g. a red paintbrush in hand pants down). worst restore end of drawing items</technical_language>

Target:
public final void draw(GC gc, ITimeGraphPresentationProvider provider) { Rectangle bounds = getBounds(); if (bounds.width <= 0) { return; } RGBAColor backgroundRgba = getBackgroundColor(); if (backgroundRgba != null) { int prevAlpha = gc.getAlpha(); Color prevBgColor = gc.getBackground(); Color prevFgColor = gc.getForeground(); int prevLineWidth = gc.getLineWidth(); setContext(gc); innerDraw(gc); RGBAColor foregroundRgb = getForegroundColor(); if (foregroundRgb != null) { setContext(gc); drawBorder(gc); } gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); postDraw(provider, gc); gc.setLineWidth(prevLineWidth); gc.setBackground(prevBgColor); gc.setForeground(prevFgColor); gc.setAlpha(prevAlpha); } }
Source:
<code><START> @Override public Object merge( Object parent ) { <END> if (parent == null) { return this; } if (parent instanceof MockHttpServletRequestBuilder) { this.mergeable = (Mergeable) parent; return this.mergeable; } else { throw new IllegalArgumentException("Cannot merge with [" + parent.getClass().getName() + "]"); } }</code><technical_language>please put @Override line remove extra space consistent Spring Security code conventions? suggestion @Override public Object merge(Object parent ) {</technical_language>

Target:
public Object merge(Object parent) { if (parent == null) { return this; } if (parent instanceof Mergeable) { this.parent = (Mergeable) parent; return this; } else { throw new IllegalArgumentException("Cannot merge with [" + parent.getClass().getName() + "]"); } }
Source:
<code>public DatasourceInputSplit(@NotNull List<WindowedDataSegment> segments, String[] locations) { Preconditions.checkArgument(segments != null && segments.size() > 0, "no segments"); this.segments = segments; <START> this.locations = locations == null ? new String[0] : locations; <END> }</code><technical_language>store "new String[0]" in static final variable reuse</technical_language>

Target:
public DatasourceInputSplit(@NotNull List<WindowedDataSegment> segments, String[] locations) { Preconditions.checkArgument(segments != null && segments.size() > 0, "no segments"); this.segments = segments; this.locations = locations == null ? EMPTY_STR_ARRAY : locations; }
Source:
<code>public void acquire(GrillSessionHandle sessionHandle) { <START> LOG.info("Acquiring grill session:" + sessionHandle.getPublicId()); <END> getSession(sessionHandle).acquire(); }</code><technical_language>instead of INFO move this DEBUG. This method is called in places log statements</technical_language>

Target:
public void acquire(GrillSessionHandle sessionHandle) { LOG.debug("Acquiring grill session:" + sessionHandle.getPublicId()); getSession(sessionHandle).acquire(); }
Source:
<code>public String convert(Object tuple) { try { return writer.writeValueAsString(tuple); } catch (JsonGenerationException | JsonMappingException e) { <START> logger.error("Error while converting tuple ", tuple + " " + e.getMessage()); <END> } catch (IOException e) { DTThrowable.rethrow(e); } return null; }</code><technical_language>need + operator (Error while converting tuple {}", tuple, e.getMessage()) change a level debug, error tuples emitted a port, user check error tuple if required</technical_language>

Target:
public String convert(Object tuple) { try { return writer.writeValueAsString(tuple); } catch (JsonGenerationException | JsonMappingException e) { logger.debug("Error while converting tuple {}",tuple,e.getMessage()); } catch (IOException e) { DTThrowable.rethrow(e); } return null; }
Source:
<code>public void writeTuple(Object obj, String port) { if (windowIdRanges.isEmpty()) { throw new RuntimeException("Data tuples received from tuple recorder before any BEGIN_WINDOW"); } try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Slice f = streamCodec.toByteArray(obj); PortInfo pi = portMap.get(port); String str = "T:" + System.currentTimeMillis() + ":" + pi.id + ":" + f.length + ":"; bos.write(str.getBytes()); bos.write(f.buffer, f.offset, f.length); bos.write("\n".getBytes()); PortCount pc = portCountMap.get(port); pc.count++; portCountMap.put(port, pc); storage.writeDataItem(bos.toByteArray(), true); if (numSubscribers > 0) { publishTupleData(pi.id, obj); } <START> ++totalTupleCount; <END> } catch (Exception ex) { if (shouldLog()) { logger.warn("Error writing tuple {}", obj, ex); } } }</code><technical_language>Subject int overflow? is necessary move increment of totalTupleCount here. incremented time writeTuple is called count number of attempts counts successful attempts</technical_language>

Target:
public void writeTuple(Object obj, String port) { ++totalTupleCount; if (windowIdRanges.isEmpty()) { throw new RuntimeException("Data tuples received from tuple recorder before any BEGIN_WINDOW"); } ByteArrayOutputStream bos = new ByteArrayOutputStream(); Slice f = null; try { f = streamCodec.toByteArray(obj); } catch (RuntimeException ex) { checkLogTuple(ex, "save", obj); return; } try { PortInfo pi = portMap.get(port); String str = "T:" + System.currentTimeMillis() + ":" + pi.id + ":" + f.length + ":"; bos.write(str.getBytes()); bos.write(f.buffer, f.offset, f.length); bos.write("\n".getBytes()); PortCount pc = portCountMap.get(port); pc.count++; portCountMap.put(port, pc); storage.writeDataItem(bos.toByteArray(), true); if (numSubscribers > 0) { publishTupleData(pi.id, obj); } } catch (Exception ex) { logger.warn("Error saving tuple", ex); } }
Source:
<code>protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() <START> .antMatchers("/*").authenticated() <END> .and() .httpBasic(); }</code><technical_language>security for /rest/* landing page require authentication, wdyt</technical_language>

Target:
protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .antMatchers("/rest/*").authenticated() .and() .httpBasic(); }
Source:
<code>public AsyncAdminBuilder getAdminBuilder() { return new AsyncAdminBuilder() { @Override public AsyncAdminBuilder setStartLogErrorsCnt(int arg0) { throw new UnsupportedOperationException("setStartLogErrorsCnt"); } @Override public AsyncAdminBuilder setRpcTimeout(long arg0, TimeUnit arg1) { <START> throw new UnsupportedOperationException("setStartLogErrorsCnt"); <END> } @Override public AsyncAdminBuilder setRetryPause(long arg0, TimeUnit arg1) { throw new UnsupportedOperationException("setStartLogErrorsCnt"); } @Override public AsyncAdminBuilder setOperationTimeout(long arg0, TimeUnit arg1) { throw new UnsupportedOperationException("setStartLogErrorsCnt"); } @Override public AsyncAdminBuilder setMaxAttempts(int arg0) { throw new UnsupportedOperationException("setStartLogErrorsCnt"); } @Override public AsyncAdmin build() { try { return new BigtableAsyncAdmin(BigtableAsyncConnection.this); } catch (IOException e) { LOG.error("failed to build BigtableAsyncAdmin", e); throw new UncheckedIOException("failed to build BigtableAsyncAdmin", e); } } }; }</code><technical_language>please right string for exception</technical_language>

Target:
public AsyncAdminBuilder getAdminBuilder() { return new AsyncAdminBuilder() { @Override public AsyncAdminBuilder setStartLogErrorsCnt(int arg0) { throw new UnsupportedOperationException("setStartLogErrorsCnt"); } @Override public AsyncAdminBuilder setRpcTimeout(long arg0, TimeUnit arg1) { throw new UnsupportedOperationException("setRpcTimeout"); } @Override public AsyncAdminBuilder setRetryPause(long arg0, TimeUnit arg1) { throw new UnsupportedOperationException("setRetryPause"); } @Override public AsyncAdminBuilder setOperationTimeout(long arg0, TimeUnit arg1) { throw new UnsupportedOperationException("setOperationTimeout"); } @Override public AsyncAdminBuilder setMaxAttempts(int arg0) { throw new UnsupportedOperationException("setMaxAttempts"); } @Override public AsyncAdmin build() { try { return new BigtableAsyncAdmin(BigtableAsyncConnection.this); } catch (IOException e) { LOG.error("failed to build BigtableAsyncAdmin", e); throw new UncheckedIOException("failed to build BigtableAsyncAdmin", e); } } }; }
Source:
<code>private Set<Artifact> getAllArtifacts(Collection<Artifact> artifacts, Set<Artifact> allArtifacts) { allArtifacts.addAll(artifacts); <START> for (Artifact art : artifacts) { <END> getAllArtifacts(art.getChildren(), allArtifacts); } return allArtifacts; }</code><technical_language>skip artifacts common branch</technical_language>

Target:
private Set<Artifact> getAllArtifacts(Collection<Artifact> artifacts, Set<Artifact> allArtifacts) { for (Artifact art : artifacts) { if (art.isOnBranch(AtsUtilCore.getAtsBranch())) { allArtifacts.addAll(art.getDescendants()); } } return allArtifacts; }