auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void handleError(ClientHttpResponse response) throws IOException { <START> HttpStatus status = response.getStatusCode(); <END> switch (status) { case FORBIDDEN: log.warn("FORBIDDEN response code received. If you are trying to connect to the AWS S3 Repository, you need to be running ths ICGC client on an EC2 VM instance."); throw new NotRetryableException(new IOException( "Amazon S3 error: Access refused by object store. Confirm request host is on permitted list" + IOUtils.toString(response.getBody()))); case REQUEST_TIMEOUT: log.warn("Unable to connect to repository endpoint. You need to be running on a compute node within the repository cloud. Or else your network connection is hinky."); throw new NotRetryableException(new IOException( "Cloud error: Access refused by object store. Confirm request host is on permitted list" + IOUtils.toString(response.getBody()))); default: log.warn("Non-Retryable exception: {}", response.getStatusText()); throw new NotRetryableException(new IOException("Unable to verify connectivity to repository: " + IOUtils.toString(response.getBody()))); } }</code><technical_language>val baby</technical_language>

Target:
public void handleError(ClientHttpResponse response) throws IOException { val status = response.getStatusCode(); switch (status) { case FORBIDDEN: log.warn("FORBIDDEN response code received. If you are trying to connect to the AWS S3 Repository, you need to be running ths ICGC client on an EC2 VM instance."); throw notRetryableException( "Amazon S3 error: Access refused by object store. Confirm request host is on permitted list", response); case REQUEST_TIMEOUT: log.warn("Unable to connect to repository endpoint. You need to be running on a compute node within the repository cloud. Or else your network connection is hinky."); throw notRetryableException( "Cloud error: Access refused by object store. Confirm request host is on permitted list", response); default: log.warn("Non-Retryable exception: {}", response.getStatusText()); throw notRetryableException("Unable to verify connectivity to repository: ", response); } }
Source:
<code>private String resolveUrl(URI uri, String link) { String url = cfg.getString("gerrit", null, "canonicalWebUrl"); if (Strings.isNullOrEmpty(url)) { url = uri.toString(); } if (!url.endsWith("/")) { url += "/"; } <START> if (Strings.isNullOrEmpty(link)) { <END> url += "#" + link; } return url; }</code><technical_language>this if (!Strings.isNullOrEmpty(link)) {</technical_language>

Target:
private String resolveUrl(URI uri, String link) { String url = cfg.getString("gerrit", null, "canonicalWebUrl"); if (Strings.isNullOrEmpty(url)) { url = uri.toString(); } if (!url.endsWith("/")) { url += "/"; } if (!Strings.isNullOrEmpty(link)) { url += "#" + link; } return url; }
Source:
<code>public Reader readRaw() throws IOException { FileInputStream fileInputStream = new FileInputStream(file); try { return new InputStreamReader(fileInputStream, sniffEncoding()); } catch(IOException ex) { <START> fileInputStream.close(); <END> throw ex; } }</code><technical_language>... more important one. Is reason is so? Usually, is important attached suppressed</technical_language>

Target:
public Reader readRaw() throws IOException { FileInputStream fileInputStream = new FileInputStream(file); try { return new InputStreamReader(fileInputStream, sniffEncoding()); } catch(IOException ex) { Util.closeAndLogFailures(fileInputStream, LOGGER, "FileInputStream", file.toString()); throw ex; } }
Source:
<code>private void populateColumns(JsonNode propertiesNode, List<String> arrays, List<ElasticsearchColumn> columns) throws IOException { TreeMap<String, Type> fieldsMap = new TreeMap<>(new Comparator<String>() { @Override public int compare(String key1, String key2) { int length1 = key1.split("\\.").length; int length2 = key2.split("\\.").length; if (length1 == length2) { return key1.compareTo(key2); } return length2 - length1; } }); for (String columnMetadata : getColumnsMetadata(null, propertiesNode)) { String[] items = columnMetadata.split(":"); if (items.length != 2) { log.debug("Invalid column path format: " + columnMetadata); continue; } if (!items[0].endsWith(".type")) { log.debug("Ignore column with no type info: " + columnMetadata); continue; } String propertyName = items[0].substring(0, items[0].lastIndexOf('.')); String nestedName = propertyName.replaceAll("properties\\.", ""); if (nestedName.contains(".")) { fieldsMap.put(nestedName, getPrestoType(items[1])); } else { <START> if (!columns.stream().anyMatch(column -> column.getName().equalsIgnoreCase(nestedName))) { <END> columns.add(new ElasticsearchColumn(nestedName, getPrestoType(items[1]), nestedName, items[1], arrays.contains(nestedName), -1)); } } } processNestedFields(fieldsMap, columns, arrays); }</code><technical_language>Instead of ! anyMatch noneMatch. - This more readable if extracted a variable for condition</technical_language>

Target:
private void populateColumns(JsonNode propertiesNode, List<String> arrays, List<ElasticsearchColumn> columns) throws IOException { Comparator<String> stringComparator = (key1, key2) -> { int length1 = key1.split("\\.").length; int length2 = key2.split("\\.").length; if (length1 == length2) { return key1.compareTo(key2); } return length2 - length1; }; TreeMap<String, Type> fieldsMap = new TreeMap<>(stringComparator); for (String columnMetadata : getColumnsMetadata(null, propertiesNode)) { int delimiterIndex = columnMetadata.lastIndexOf(":"); if (delimiterIndex == -1 || delimiterIndex == columnMetadata.length() - 1) { LOG.debug("Invalid column path format: " + columnMetadata); continue; } String fieldName = columnMetadata.substring(0, delimiterIndex); String typeName = columnMetadata.substring(delimiterIndex + 1); if (!fieldName.endsWith(".type")) { LOG.debug("Ignoring column with no type info: " + columnMetadata); continue; } String propertyName = fieldName.substring(0, fieldName.lastIndexOf('.')); String nestedName = propertyName.replaceAll("properties\\.", ""); if (nestedName.contains(".")) { fieldsMap.put(nestedName, getPrestoType(typeName)); } else { boolean newNestedColumn = columns.stream().noneMatch(column -> column.getName().equalsIgnoreCase(nestedName)); if (newNestedColumn) { columns.add(new ElasticsearchColumn(nestedName, getPrestoType(typeName), nestedName, typeName, arrays.contains(nestedName), -1)); } } } processNestedFields(fieldsMap, columns, arrays); }
Source:
<code>public void refresh() { <START> logger.info("Refresh"); <END> ServerInfo i = visibleList.getSelection(); visibleList.setSelection(null); extInfo.clear(); visibleList.setSelection(i); }</code><technical_language>remove this message expand a bit (i.e. "Refreshing info for server X")</technical_language>

Target:
public void refresh() { ServerInfo i = visibleList.getSelection(); visibleList.setSelection(null); extInfo.clear(); visibleList.setSelection(i); }
Source:
<code>String applyCSS(String html, String css, XWikiContext context) { LOGGER.debug("Applying the following CSS to HTML [{}]", css, html); try { Reader re = new StringReader(html); InputSource source = new InputSource(re); XHTMLDocumentFactory docFactory = XHTMLDocumentFactory.getInstance(); SAXReader reader = new SAXReader(docFactory); XMLReader xmlReader = Utils.getComponent(XMLReaderFactory.class).createXMLReader(); try { <START> xmlReader.setFeature("<LINK_0>", true); <END> } catch (SAXNotRecognizedException | SAXNotSupportedException e) { } reader.setXMLReader(xmlReader); reader.setEntityResolver(new DefaultEntityResolver()); XHTMLDocument document = (XHTMLDocument) reader.read(source); document.setBaseURL(new URL(context.getDoc().getExternalURL("view", context))); document.addStyleSheet(new io.sf.carte.doc.style.css.nsac.InputSource(new StringReader(css))); applyInlineStyle(document.getRootElement()); OutputFormat outputFormat = new OutputFormat("", false); if ((context == null) || (context.getWiki() == null)) { outputFormat.setEncoding("UTF-8"); } else { outputFormat.setEncoding(context.getWiki().getEncoding()); } StringWriter out = new StringWriter(); XMLWriter writer = new XMLWriter(out, outputFormat); writer.write(document); String result = out.toString(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("HTML with CSS applied [{}]", result); } return result; } catch (Exception e) { LOGGER.warn("Failed to apply CSS to HTML [{}]", css, html, e); return html; } }</code><technical_language>explain set this here</technical_language>

Target:
String applyCSS(String html, String css, XWikiContext context) { LOGGER.debug("Applying the following CSS to HTML [{}]", css, html); try { Reader re = new StringReader(html); InputSource source = new InputSource(re); XHTMLDocumentFactory docFactory = XHTMLDocumentFactory.getInstance(); SAXReader reader = new SAXReader(docFactory); XMLReader xmlReader = Utils.getComponent(XMLReaderFactory.class).createXMLReader(); reader.setXMLReader(xmlReader); reader.setEntityResolver(new DefaultEntityResolver()); XHTMLDocument document = (XHTMLDocument) reader.read(source); document.setBaseURL(new URL(context.getDoc().getExternalURL("view", context))); document.addStyleSheet(new io.sf.carte.doc.style.css.nsac.InputSource(new StringReader(css))); applyInlineStyle(document.getRootElement()); OutputFormat outputFormat = new OutputFormat("", false); if ((context == null) || (context.getWiki() == null)) { outputFormat.setEncoding("UTF-8"); } else { outputFormat.setEncoding(context.getWiki().getEncoding()); } StringWriter out = new StringWriter(); XMLWriter writer = new XMLWriter(out, outputFormat); writer.write(document); String result = out.toString(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("HTML with CSS applied [{}]", result); } return result; } catch (Exception e) { LOGGER.warn("Failed to apply CSS to HTML [{}]", css, html, e); return html; } }
Source:
<code>private void addCPESearchLevel() { Predicate<Release> isPossible = r -> r.isSetCpeid() && isCpe(r.getCpeid().toLowerCase()); searchLevels.add(r -> { if (isPossible.test(r)) { return singletonList(new NeedleWithMeta(cleanupCPE(r.getCpeid()), "CPE")); } <START> return ImmutableList.of(); <END> }); }</code><technical_language>do this is Collections.EMPTY_LIST? a necessary change</technical_language>

Target:
private void addCPESearchLevel() { Predicate<Release> isPossible = r -> r.isSetCpeid() && isCpe(r.getCpeid().toLowerCase()); searchLevels.add(r -> { if(isPossible.test(r)){ return singletonList(new NeedleWithMeta(cleanupCPE(r.getCpeid()), "CPE")); } return Collections.emptyList(); }); }
Source:
<code>public Set<Operand> getAllOperands() { List<Operand> allOperands = null; LinkedHashSet<Operand> allOrderedOperands = null; if (useCache) { if (allOperandsCache != null) { allOperands = Lists.newArrayList(allOperandsCache); } allOrderedOperands = allOrderedOperandsCache; } if (allOrderedOperands == null) { if (allOperands == null) { allOperands = Lists.newArrayList(); for (Node node : Iterables.filter(Iterables.filter(AllContents.of(getNotationDiagram()), Node.class), Operand.notationPredicate())) { Option<Operand> exec = ISequenceElementAccessor.getOperand(node); assert exec.some() : INTERNAL_ERROR; allOperands.add(exec.get()); } if (useCache) { allOperandsCache = <START> Lists.newArrayList(allOperands); <END> } } Collections.sort(allOperands, RangeHelper.lowerBoundOrdering().onResultOf(ISequenceEvent.VERTICAL_RANGE)); allOrderedOperands = Sets.newLinkedHashSet(allOperands); if (useCache) { allOrderedOperandsCache = allOrderedOperands; } } return allOrderedOperands; }</code><technical_language>getAllLifelines remarks</technical_language>

Target:
public Set<Operand> getAllOperands() { List<Operand> allOperands = null; LinkedHashSet<Operand> allOrderedOperands = null; if (useCache) { if (allOperandsCache != null) { allOperands = Lists.newArrayList(allOperandsCache); } allOrderedOperands = allOrderedOperandsCache; } if (allOrderedOperands == null) { if (allOperands == null) { allOperands = Lists.newArrayList(); for (Node node : Iterables.filter(Iterables.filter(AllContents.of(getNotationDiagram()), Node.class), Operand.notationPredicate())) { Option<Operand> exec = ISequenceElementAccessor.getOperand(node); assert exec.some() : INTERNAL_ERROR; allOperands.add(exec.get()); } if (useCache) { allOperandsCache = allOperands; } } Collections.sort(allOperands, RangeHelper.lowerBoundOrdering().onResultOf(ISequenceEvent.VERTICAL_RANGE)); allOrderedOperands = Sets.newLinkedHashSet(allOperands); if (useCache) { allOrderedOperandsCache = allOrderedOperands; } } return allOrderedOperands; }
Source:
<code>public ListenableFuture<PagesResponse> getResults(long token, DataSize maxResponseSize) { <START> URI uriBase = asyncPageTransportLocation.isPresent() ? asyncPageTransportLocation.get() : location; <END> URI uri = uriBuilderFrom(uriBase).appendPath(String.valueOf(token)).build(); return httpClient.executeAsync( prepareGet() .setHeader(PRESTO_MAX_SIZE, maxResponseSize.toString()) .setUri(uri).build(), new PageResponseHandler()); }</code><technical_language>asyncPageTransportLocation.orElse(location)</technical_language>

Target:
public ListenableFuture<PagesResponse> getResults(long token, DataSize maxResponseSize) { URI uriBase = asyncPageTransportLocation.orElse(location); URI uri = uriBuilderFrom(uriBase).appendPath(String.valueOf(token)).build(); return httpClient.executeAsync( prepareGet() .setHeader(PRESTO_MAX_SIZE, maxResponseSize.toString()) .setUri(uri).build(), new PageResponseHandler()); }
Source:
<code>public MapType(boolean useNewMapBlock, Type keyType, Type valueType, MethodHandle keyBlockNativeEquals, MethodHandle keyNativeHashCode, MethodHandle keyBlockHashCode) { super(new TypeSignature(StandardTypes.MAP, TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature())), Block.class); if (!keyType.isComparable()) { throw new IllegalArgumentException(format("key type must be comparable, got %s", keyType)); } this.useNewMapBlock = useNewMapBlock; this.keyType = keyType; this.valueType = valueType; if (useNewMapBlock) { requireNonNull(keyBlockNativeEquals, "keyBlockNativeEquals is null"); requireNonNull(keyNativeHashCode, "keyNativeHashCode is null"); <START> requireNonNull(keyBlockHashCode, "keyBlockHashCode is null"); <END> } this.keyBlockNativeEquals = keyBlockNativeEquals; this.keyNativeHashCode = keyNativeHashCode; this.keyBlockHashCode = keyBlockHashCode; }</code><technical_language>enforce null false</technical_language>

Target:
public MapType(boolean useNewMapBlock, Type keyType, Type valueType, MethodHandle keyBlockNativeEquals, MethodHandle keyNativeHashCode, MethodHandle keyBlockHashCode) { super(new TypeSignature(StandardTypes.MAP, TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature())), Block.class); if (!keyType.isComparable()) { throw new IllegalArgumentException(format("key type must be comparable, got %s", keyType)); } this.useNewMapBlock = useNewMapBlock; this.keyType = keyType; this.valueType = valueType; if (useNewMapBlock) { requireNonNull(keyBlockNativeEquals, "keyBlockNativeEquals is null"); requireNonNull(keyNativeHashCode, "keyNativeHashCode is null"); requireNonNull(keyBlockHashCode, "keyBlockHashCode is null"); } else { if (keyBlockNativeEquals != null) { throw new IllegalArgumentException("When useNewMapBlock is false, keyBlockNativeEquals should be null."); } if (keyNativeHashCode != null) { throw new IllegalArgumentException("When useNewMapBlock is false, keyNativeHashCode should be null."); } if (keyBlockHashCode != null) { throw new IllegalArgumentException("When useNewMapBlock is false, keyBlockHashCode should be null."); } } this.keyBlockNativeEquals = keyBlockNativeEquals; this.keyNativeHashCode = keyNativeHashCode; this.keyBlockHashCode = keyBlockHashCode; }
Source:
<code>public void login() throws Exception { <START> CommonUtil.openPerspective("WSO2 APIManager"); <END> apimUtils.login(userName, passWord); }</code><technical_language>String values constants</technical_language>

Target:
public void login() throws Exception { FunctionalUtil.openPerspective(APIMConstants.WSO2_API_MANAGER); apimUtils.login(userName, passWord, url, null); try{ APIMUtils.expandTree(userName, url); } catch(Exception e){ } }
Source:
<code>public void testUnexpectedTaskManagerTerminationFailsRunnerFatally() throws Exception { final CompletableFuture<Void> terminationFuture = new CompletableFuture<>(); final TestingTaskExecutorService taskExecutorService = TestingTaskExecutorService.newBuilder() .setTerminationFuture(terminationFuture) .build(); final TaskManagerRunner taskManagerRunner = createTaskManagerRunner( createConfiguration(), <START> (configuration, resourceID, rpcService, highAvailabilityServices, heartbeatServices, metricRegistry, blobCacheService, localCommunicationOnly, externalResourceInfoProvider, fatalErrorHandler) -> taskExecutorService); <END> terminationFuture.completeExceptionally(new FlinkException("Test exception.")); Integer statusCode = systemExitTrackingSecurityManager.getSystemExitFuture().get(); assertThat(statusCode, is(equalTo(TaskManagerRunner.RUNTIME_FAILURE_RETURN_CODE))); }</code><technical_language>introduce a utility method returns this factory; is easy miss list of arguments is part of factory, constructor</technical_language>

Target:
public void testUnexpectedTaskManagerTerminationFailsRunnerFatally() throws Exception { final CompletableFuture<Void> terminationFuture = new CompletableFuture<>(); final TestingTaskExecutorService taskExecutorService = TestingTaskExecutorService.newBuilder() .setTerminationFuture(terminationFuture) .build(); final TaskManagerRunner taskManagerRunner = createTaskManagerRunner( createConfiguration(), createTaskExecutorServiceFactory(taskExecutorService)); terminationFuture.completeExceptionally(new FlinkException("Test exception.")); Integer statusCode = systemExitTrackingSecurityManager.getSystemExitFuture().get(); assertThat(statusCode, is(equalTo(TaskManagerRunner.RUNTIME_FAILURE_RETURN_CODE))); }
Source:
<code>public List<AttributeRights> getAttributeRights(PerunSession sess, final int attributeId) throws InternalErrorException { List<AttributeRights> rights; try { rights = jdbc.query("SELECT " + attributeRightSelectQuery + " FROM attributes_authz JOIN roles ON " + "attributes_authz.role_id=roles.id JOIN action_types ON attributes_authz.action_type_id=action_types.id WHERE " + "attributes_authz.attr_id=?", new AttributeRightsExtractor(attributeId), attributeId); } catch (RuntimeException e) { throw new InternalErrorException(e); } <START> Utils.notNull(rights, "rights"); <END> boolean roleExists; List<Role> listOfRoles = new ArrayList<>(); listOfRoles.add(Role.FACILITYADMIN); listOfRoles.add(Role.GROUPADMIN); listOfRoles.add(Role.SELF); listOfRoles.add(Role.VOADMIN); for (Role roleToTry : listOfRoles) { roleExists = false; Iterator itr = rights.iterator(); while ((itr.hasNext()) && (!roleExists)) { AttributeRights right = (AttributeRights) itr.next(); if (right.getRole().equals(roleToTry)) { roleExists = true; } } if (!roleExists) { rights.add(new AttributeRights(attributeId, roleToTry, new ArrayList<>())); } } return rights; }</code><technical_language>is for jdbc.query return null</technical_language>

Target:
public List<AttributeRights> getAttributeRights(PerunSession sess, final int attributeId) throws InternalErrorException { List<AttributeRights> rights; try { rights = jdbc.query("SELECT " + attributeRightSelectQuery + " FROM attributes_authz JOIN roles ON " + "attributes_authz.role_id=roles.id JOIN action_types ON attributes_authz.action_type_id=action_types.id WHERE " + "attributes_authz.attr_id=?", new AttributeRightsExtractor(attributeId), attributeId); } catch (RuntimeException e) { throw new InternalErrorException(e); } if (rights == null) { throw new InternalErrorException("The attribute rights for the attribute with id " + attributeId + " were null."); } boolean roleExists; List<Role> listOfRoles = new ArrayList<>(); listOfRoles.add(Role.FACILITYADMIN); listOfRoles.add(Role.GROUPADMIN); listOfRoles.add(Role.SELF); listOfRoles.add(Role.VOADMIN); for (Role roleToTry : listOfRoles) { roleExists = false; Iterator itr = rights.iterator(); while ((itr.hasNext()) && (!roleExists)) { AttributeRights right = (AttributeRights) itr.next(); if (right.getRole().equals(roleToTry)) { roleExists = true; } } if (!roleExists) { rights.add(new AttributeRights(attributeId, roleToTry, new ArrayList<>())); } } return rights; }
Source:
<code><START> public void setUp() <END> { tester = new RuleTester(); }</code><technical_language>methods final accidentally overridden</technical_language>

Target:
public final void setUp() { tester = new RuleTester(); }
Source:
<code>public AbfsInputStream( final AbfsClient client, final Statistics statistics, final String path, final long contentLength, final AbfsInputStreamContext abfsInputStreamContext, final String eTag) { this.client = client; this.statistics = statistics; this.path = path; this.contentLength = contentLength; this.bufferSize = abfsInputStreamContext.getReadBufferSize(); this.readAheadQueueDepth = abfsInputStreamContext.getReadAheadQueueDepth(); this.tolerateOobAppends = abfsInputStreamContext.isTolerateOobAppends(); this.eTag = eTag; this.readAheadEnabled = true; this.cachedSasToken = new CachedSASToken( abfsInputStreamContext.getSasTokenRenewPeriodForStreamsInSeconds()); this.streamStatistics = abfsInputStreamContext.getStreamStatistics(); this.readSmallFilesCompletely = abfsInputStreamContext <START> .readSmallFilesCompletely(); <END> this.optimizeFooterRead = abfsInputStreamContext.optimizeFooterRead(); }</code><technical_language>passed in AbfsInputStreamContext. hold instance instead of creating member variables for of members of AbfsInputStreamContext</technical_language>

Target:
public AbfsInputStream( final AbfsClient client, final Statistics statistics, final String path, final long contentLength, final AbfsInputStreamContext abfsInputStreamContext, final String eTag) { this.client = client; this.statistics = statistics; this.path = path; this.contentLength = contentLength; this.bufferSize = abfsInputStreamContext.getReadBufferSize(); this.readAheadQueueDepth = abfsInputStreamContext.getReadAheadQueueDepth(); this.tolerateOobAppends = abfsInputStreamContext.isTolerateOobAppends(); this.eTag = eTag; this.readAheadEnabled = true; this.alwaysReadBufferSize = abfsInputStreamContext.shouldReadBufferSizeAlways(); this.cachedSasToken = new CachedSASToken( abfsInputStreamContext.getSasTokenRenewPeriodForStreamsInSeconds()); this.streamStatistics = abfsInputStreamContext.getStreamStatistics(); this.context = abfsInputStreamContext; readAheadBlockSize = abfsInputStreamContext.getReadAheadBlockSize(); ReadBufferManager.setReadBufferManagerConfigs(readAheadBlockSize); }
Source:
<code>protected void onResume() { super.onResume(); disposable = RxTextView.textChangeEvents(searchInputView) .debounce(200, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .toFlowable( BackpressureStrategy.BUFFER) <START> .flatMap(new Function<TextViewTextChangeEvent, Publisher<RealmResults<Person>>>() { <END> public Publisher<RealmResults<Person>> apply(TextViewTextChangeEvent textViewTextChangeEvent) throws Exception { return realm.where(Person.class) .beginsWith("name", textViewTextChangeEvent.text().toString()) .findAllSortedAsync("name") .asFlowable(); } }) .filter(new Predicate<RealmResults<Person>>() { @Override public boolean test(RealmResults<Person> people) throws Exception { return people.isLoaded(); } }) .subscribe(new Consumer<RealmResults<Person>>() { @Override public void accept(RealmResults<Person> people) throws Exception { searchResultsView.removeAllViews(); for (Person person : people) { TextView view = new TextView(ThrottleSearchActivity.this); view.setText(person.getName()); searchResultsView.addView(view); } } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { throwable.printStackTrace(); } }); }</code><technical_language>Hm, this switchMap()</technical_language>

Target:
protected void onResume() { super.onResume(); disposable = RxTextView.textChangeEvents(searchInputView) .debounce(200, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .toFlowable(BackpressureStrategy.BUFFER) .switchMap(textChangeEvent -> { return realm.where(Person.class) .beginsWith("name", textChangeEvent.text().toString()) .findAllSortedAsync("name") .asFlowable(); }) .filter(people -> people.isLoaded()) .subscribe(people -> { searchResultsView.removeAllViews(); for (Person person : people) { TextView view = new TextView(ThrottleSearchActivity.this); view.setText(person.getName()); searchResultsView.addView(view); } }, throwable -> throwable.printStackTrace()); }
Source:
<code>public ValueNode leftBind() throws StandardException { TypeId receiverType; TypeId resultType = TypeId.getBuiltInTypeId(Types.VARCHAR); if (receiver.requiresTypeFromContext()) { receiver.setType(getVarcharDescriptor()); receiver.setCollationUsingCompilationSchema(); } if (leftOperand.requiresTypeFromContext()) { leftOperand.setType(new DataTypeDescriptor(TypeId.INTEGER_ID, false)); } if ((rightOperand != null) && rightOperand.requiresTypeFromContext()) { rightOperand.setType(new DataTypeDescriptor(TypeId.getBuiltInTypeId(Types.VARCHAR), true)); } bindToBuiltIn(); if (!leftOperand.getTypeId().isIntegerNumericTypeId()) throw StandardException.newException(SQLState.LANG_DB2_FUNCTION_INCOMPATIBLE, "LEFT", "FUNCTION"); receiverType = receiver.getTypeId(); switch (receiverType.getJDBCTypeId()) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.CLOB: break; default: { throwBadType("LEFT", receiverType.getSQLTypeName()); } } if (rightOperand != null) { switch (rightOperand.getTypeId().getJDBCTypeId()) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.CLOB: break; default: { <START> StandardException.newException(SQLState.LANG_DB2_FUNCTION_INCOMPATIBLE, "LEFT", "FUNCTION"); <END> } } } if (receiverType.getTypeFormatId() == StoredFormatIds.CLOB_TYPE_ID) { resultType = receiverType; } int resultLen = receiver.getTypeServices().getMaximumWidth(); if (leftOperand != null && leftOperand instanceof ConstantNode) { if (((ConstantNode)leftOperand).getValue().getInt() > resultLen) resultLen = ((ConstantNode)leftOperand).getValue().getInt(); } setType(new DataTypeDescriptor( resultType, true, resultLen )); setCollationInfo(receiver.getTypeServices()); return this; }</code><technical_language>StandardException.newException while throwBadType("LEFT", receiverType.getSQLTypeName()); above</technical_language>

Target:
public ValueNode leftBind() throws StandardException { TypeId receiverType; TypeId resultType = TypeId.getBuiltInTypeId(Types.VARCHAR); if (receiver.requiresTypeFromContext()) { receiver.setType(getVarcharDescriptor()); receiver.setCollationUsingCompilationSchema(); } if (leftOperand.requiresTypeFromContext()) { leftOperand.setType(new DataTypeDescriptor(TypeId.INTEGER_ID, false)); } bindToBuiltIn(); if (!leftOperand.getTypeId().isIntegerNumericTypeId()) throwBadType("LEFT", leftOperand.getTypeId().getSQLTypeName()); receiverType = receiver.getTypeId(); switch (receiverType.getJDBCTypeId()) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.CLOB: break; default: { throwBadType("LEFT", receiverType.getSQLTypeName()); } } if (receiverType.getTypeFormatId() == StoredFormatIds.CLOB_TYPE_ID) { resultType = receiverType; } int resultLen = receiver.getTypeServices().getMaximumWidth(); if (leftOperand instanceof ConstantNode) { if (((ConstantNode)leftOperand).getValue().getInt() > resultLen) resultLen = ((ConstantNode)leftOperand).getValue().getInt(); } setType(new DataTypeDescriptor( resultType, true, resultLen )); setCollationInfo(receiver.getTypeServices()); return this; }
Source:
<code>public void configureFieldMetadata(String name, FieldMetadataBuilder builder) { <START> builder.field( "value", FieldType.OBJECT ); <END> }</code><technical_language>This a hardcoded constant ("value"), simply name. I this change in practice, in case people copy/paste this code</technical_language>

Target:
public void configureFieldMetadata(String name, FieldMetadataBuilder builder) { builder.field( name, FieldType.OBJECT ); }
Source:
<code>public final void visitNewClass(NewClassTree tree) { scan(tree.arguments()); SymbolicValue newValue = createSymbolicInstanceValue(); for (ExecutionState executionState : currentStates) { SymbolicValue[] arguments = new SymbolicValue[tree.arguments().size()]; <START> for (int i = arguments.length - 1; i >= 0; i -= 1) { <END> arguments[i] = executionState.pop(); } executionState.push(newValue); check.onExecutableElementInvocation(executionState, tree, Arrays.asList(arguments)); } }</code><technical_language>@merciesa matter of taste, i-- instead of i -= 1</technical_language>

Target:
public final void visitNewClass(NewClassTree tree) { scan(tree.arguments()); SymbolicValue newValue = createSymbolicInstanceValue(); for (ExecutionState executionState : currentStates) { SymbolicValue[] arguments = new SymbolicValue[tree.arguments().size()]; for (int i = arguments.length - 1; i >= 0; i--) { arguments[i] = executionState.pop(); } executionState.push(newValue); check.onExecutableElementInvocation(executionState, tree, Arrays.asList(arguments)); } }
Source:
<code>@Override public Set<T> get() { Set<T> result = new LinkedHashSet<T>(contributors.size()); for (Binding<?> contributor : contributors) { Object contribution = contributor.get(); <START> if (contribution instanceof Set) { <END> result.addAll((Set<T>) contribution); } else { result.add((T) contribution); } } return Collections.unmodifiableSet(result); }</code><technical_language>This declared return type, instance type. multibindings create a Set<Set<String>></technical_language>

Target:
@Override public Set<T> get() { Set<T> result = new LinkedHashSet<T>(contributors.size()); for (Binding<?> contributor : contributors) { Object contribution = contributor.get(); if (contributor.provideKey.equals(provideKey)) { result.addAll((Set<T>) contribution); } else { result.add((T) contribution); } } return Collections.unmodifiableSet(result); }
Source:
<code>private void wireChangeHandler(ServiceRegistry serviceRegistry) throws ConfigurationException { try { LeaseDuration leaseDuration = getService(serviceRegistry, new BasicServiceConfiguration<>(LeaseDuration.class)); ConfigChangeHandlerManager configChangeHandlerManager = serviceRegistry.getService(new BasicServiceConfiguration<>(ConfigChangeHandlerManager.class)); <START> if (configChangeHandlerManager != null) { <END> configChangeHandlerManager.compute(CLIENT_LEASE_DURATION, () -> new LeaseConfigChangeHandler(leaseDuration)); } } catch (ServiceException e) { throw new IllegalStateException("Failed to obtain Backup and Restore Service Instance. Ex: " + e); } }</code><technical_language>Is OK this return null done it</technical_language>

Target:
private void wireChangeHandler(ServiceRegistry serviceRegistry) throws ConfigurationException { try { LeaseConfiguration leaseConfiguration = serviceRegistry.getService(new BasicServiceConfiguration<>(LeaseConfiguration.class)); ConfigChangeHandlerManager configChangeHandlerManager = serviceRegistry.getService(new BasicServiceConfiguration<>(ConfigChangeHandlerManager.class)); if (configChangeHandlerManager != null) { configChangeHandlerManager.compute(CLIENT_LEASE_DURATION, () -> new LeaseConfigChangeHandler(leaseConfiguration)); } } catch (ServiceException e) { throw new ConfigurationException(e.getMessage(), e); } }
Source:
<code><START> public AutoScalingData terminate(List<String> ips) <END> { log.info("Asked to terminate: [%s]", String.join(",", ips)); if (ips.isEmpty()) { return new AutoScalingData(new ArrayList<>()); } List<String> nodeIds = ipToIdLookup(ips); try { return new AutoScalingData(idToIpLookup( terminateWithIds(nodeIds != null ? nodeIds : new ArrayList<>()).getNodeIds()) ); } catch (Exception e) { log.error(e, "Unable to terminate any instances."); } return new AutoScalingData(new ArrayList<>()); }</code><technical_language>good a unit test for this method</technical_language>

Target:
public AutoScalingData terminate(List<String> ips) { log.info("Asked to terminate: [%s]", String.join(",", ips)); if (ips.isEmpty()) { return new AutoScalingData(new ArrayList<>()); } List<String> nodeIds = ipToIdLookup(ips); try { return terminateWithIds(nodeIds != null ? nodeIds : new ArrayList<>()); } catch (Exception e) { log.error(e, "Unable to terminate any instances."); } return new AutoScalingData(new ArrayList<>()); }
Source:
<code>public void whenCommitInvalidCursorsThenOk() throws Exception { when(cursorsService.commitCursors(any(), any())) .thenReturn(Collections.singletonMap(any(), false)); putCursors(DUMMY_CURSORS) <START> .andExpect(status().isOk()); <END> }</code><technical_language>I interesting test status code body, list of commit results</technical_language>

Target:
public void whenCommitInvalidCursorsThenOk() throws Exception { when(cursorsService.commitCursors(any(), any())) .thenReturn(Collections.singletonMap(DUMMY_CURSORS.get(0), false)); postCursors(DUMMY_CURSORS) .andExpect(status().isOk()) .andExpect(content().string(jsonHelper.matchesObject(new ItemsWrapper<>( Collections.singletonList( new CursorsController.CursorCommitResult(DUMMY_CURSORS.get(0), false)))))); }
Source:
<code>protected Expression visitBindExpression(BindExpression node, Context<C> context) { if (!context.isDefaultRewrite()) { Expression result = rewriter.rewriteBindExpression(node, context.get(), ExpressionTreeRewriter.this); if (result != null) { return result; } } List<Expression> values = node.getValues().stream() .map(value -> rewrite(value, context.get())) .collect(toImmutableList()); Expression function = rewrite(node.getFunction(), context.get()); <START> if ((!Objects.equals(values, node.getValues())) || (function != node.getFunction())) { <END> return new BindExpression(values, function); } return node; }</code><technical_language>This changes semantics of comparison. sameElements (instead of Objects.equals) in this class</technical_language>

Target:
protected Expression visitBindExpression(BindExpression node, Context<C> context) { if (!context.isDefaultRewrite()) { Expression result = rewriter.rewriteBindExpression(node, context.get(), ExpressionTreeRewriter.this); if (result != null) { return result; } } List<Expression> values = node.getValues().stream() .map(value -> rewrite(value, context.get())) .collect(toImmutableList()); Expression function = rewrite(node.getFunction(), context.get()); if (!sameElements(values, node.getValues()) || (function != node.getFunction())) { return new BindExpression(values, function); } return node; }
Source:
<code>public void testFullBucketOwnerControlAcl() throws Exception { Configuration config = new Configuration(); config.set(S3_ACL_TYPE, "BucketOwnerFullControl"); try (PrestoS3FileSystem fs = new PrestoS3FileSystem()) { MockAmazonS3 s3 = new MockAmazonS3(); String expectedBucketName = "test-bucket"; fs.initialize(new URI("s3n://" + expectedBucketName + "/"), config); fs.setS3Client(s3); <START> try (FSDataOutputStream stream = fs.create(new Path("s3n://test-bucket/test"))) { <END> stream.close(); assertEquals(CannedAccessControlList.BucketOwnerFullControl, s3.getAcl()); } } }</code><technical_language>try(FSDataOutputStream stream = fs.create(new Path("s3n://test-bucket/test"))) { // initiate upload creating a stream & closing immediately } assertEquals(s3.getAcl(), CannedAccessControlList.BucketOwnerFullControl);</technical_language>

Target:
public void testFullBucketOwnerControlAcl() throws Exception { Configuration config = new Configuration(); config.set(S3_ACL_TYPE, "BucketOwnerFullControl"); try (PrestoS3FileSystem fs = new PrestoS3FileSystem()) { MockAmazonS3 s3 = new MockAmazonS3(); String expectedBucketName = "test-bucket"; fs.initialize(new URI("s3n://" + expectedBucketName + "/"), config); fs.setS3Client(s3); try (FSDataOutputStream stream = fs.create(new Path("s3n://test-bucket/test"))) { } assertEquals(CannedAccessControlList.BucketOwnerFullControl, s3.getAcl()); } }
Source:
<code>public void shouldExecuteTestClassSuccessfully() throws InterruptedException { projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_ANOTHER_TEST_CLASS); projectExplorer.openItemByPath(PATH_TO_TEST_CLASS); editor.waitActiveEditor(); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully."); pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppOne"); pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppOne"); Assert.assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); Assert.assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); String testErrorMessage = pluginConsole.getTestErrorMessage(); <START> assertTrue( <END> testErrorMessage.startsWith(APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE), "Actual message was: " + testErrorMessage); }</code><technical_language>static import if star</technical_language>

Target:
public void shouldExecuteTestClassSuccessfully() throws InterruptedException { projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_ANOTHER_TEST_CLASS); projectExplorer.openItemByPath(PATH_TO_TEST_CLASS); editor.waitActiveEditor(); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully."); pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppOne"); pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppOne"); assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); String testErrorMessage = pluginConsole.getTestErrorMessage(); assertTrue( testErrorMessage.startsWith(APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE), "Actual message was: " + testErrorMessage); }
Source:
<code>public void delete(String parentUniqueId, String uuid, String reason, RequestContext context) throws ResponseException { if (parentUniqueId != null && uuid != null) { Allergy allergy = getByUniqueId(uuid); Patient patient = Context.getPatientService().getPatientByUuid(parentUniqueId); setParent(allergy, patient); delete(allergy, reason, context); } else if (parentUniqueId != null && uuid == null) { Patient patient = Context.getPatientService().getPatientByUuid(parentUniqueId); Allergies allergies = new Allergies(); Context.getPatientService().setAllergies(patient, allergies); <START> } else if (uuid != null) { <END> Allergy allergy = getByUniqueId(uuid); delete(allergy, reason); } }</code><technical_language>delete allergy uuid _without_ patient belongs to. I get rid of this branch</technical_language>

Target:
public void delete(String parentUniqueId, String uuid, String reason, RequestContext context) throws ResponseException { if (parentUniqueId != null && uuid != null) { Allergy allergy = getByUniqueId(uuid); Context.getPatientService().voidAllergy(allergy, reason); } else if (parentUniqueId != null && uuid == null) { Patient patient = Context.getPatientService().getPatientByUuid(parentUniqueId); Allergies allergies = Context.getPatientService().getAllergies(patient); for (Allergy allergy : allergies) { Context.getPatientService().voidAllergy(allergy, reason); } } }
Source:
<code><START> public void addParticipant(TestParticipant participant , String user , String password) { <END> sendJson(zatesRegistrationURL, "{\"subjectId\":\"" + participant.id + "\"," + "\"name\":\"" + participant.name + "\"," + "\"language\":\"" + participant.language + "\"," + "\"phoneNumber\":\"" + participant.phoneNumber + "\"," + "\"siteId\":\"" + participant.siteId + "\",\"headOfHousehold\":\"" + participant.headOfHousehold + "\"," + "\"householdName\":\"" + participant.householdName + "\"," + "\"community\":\"" + participant.community + "\",\"address\":\"" + participant.address + "\"" + "}" , user , password); }</code><technical_language>white spaces comma,</technical_language>

Target:
public void addParticipant(TestParticipant participant , String user , String password) { sendJson(zatesRegistrationURL, "{\"subjectId\":\"" + participant.getId() + "\"," + "\"name\":\"" + participant.getName() + "\"," + "\"language\":\"" + participant.getLanguage() + "\"," + "\"phoneNumber\":\"" + participant.getPhoneNumber() + "\"," + "\"siteId\":\"" + participant.getSiteId() + "\",\"headOfHousehold\":\"" + participant.getHeadOfHousehold() + "\"," + "\"householdName\":\"" + participant.getHeadOfHousehold() + "\"," + "\"community\":\"" + participant.getCommunity() + "\",\"address\":\"" + participant.getAddress() + "\"" + "}" , user , password); }
Source:
<code>public void addVersionRead(Object key, EntryVersion version) { if (version == null) { return; } if (versionsSeenMap == null) { versionsSeenMap = new EntryVersionsMap(); } if (!versionsSeenMap.containsKey(key)) { if (trace) { log.tracef("Transaction %s read %s with version %s", getGlobalTransaction().globalId(), key, version); } versionsSeenMap.put(key, (IncrementableEntryVersion) version); <START> } else { <END> if (trace) { log.tracef("Ignoring version read %s as already contains %s", version, versionsSeenMap.get(key)); } } }</code><technical_language>I guess update code putIfAbsent() return compose log message</technical_language>

Target:
public void addVersionRead(Object key, EntryVersion version) { if (version == null) { return; } if (versionsSeenMap == null) { versionsSeenMap = new EntryVersionsMap(); } Object prevVersion = versionsSeenMap.putIfAbsent(key, (IncrementableEntryVersion) version); if (trace) { if (prevVersion == null) { log.tracef("Transaction %s read %s with version %s", getGlobalTransaction().globalId(), key, version); } else { log.tracef("Ignoring version read %s as already contains %s", version, prevVersion); } } }
Source:
<code>public RoutingSlipHeaderValueMessageProcessor(String... routingSlipPath) { <START> Assert.noNullElements(routingSlipPath); <END> this.routingSlipPath = Arrays.asList(routingSlipPath); }</code><technical_language>needs Assert.notNull()</technical_language>

Target:
public RoutingSlipHeaderValueMessageProcessor(String... routingSlipPath) { Assert.notNull(routingSlipPath); Assert.noNullElements(routingSlipPath); this.routingSlipPath = Arrays.asList(routingSlipPath); }
Source:
<code>public final void request(long n) { if (n == 0) { return; } boolean mayDrain; long r; long u; do { r = requestedCount; mayDrain = r == 0; if (r == Long.MAX_VALUE) { <START> mayDrain = true; <END> break; } if (n == Long.MAX_VALUE) { u = n; mayDrain = true; } else { u = r + n; } } while (!REQUESTED_COUNT.compareAndSet(this, r, u)); if (mayDrain) { drain(); } }</code><technical_language>this allow requesting thread drain if requestedCount set Long.MAX_VALUE? a request previously emitted? If case, receiving another request a no-op (and happen). in queue drain. I this causing harm invoked, if is result in anything, I want understand if missing a code path this is applicable</technical_language>

Target:
public final void request(long n) { if (n == 0) { return; } boolean mayDrain; long r; long u; do { r = requestedCount; mayDrain = r == 0; if (r == Long.MAX_VALUE) { break; } if (n == Long.MAX_VALUE) { u = n; mayDrain = true; } else { if (r > Long.MAX_VALUE - n) { u = Long.MAX_VALUE; } else { u = r + n; } } } while (!REQUESTED_COUNT.compareAndSet(this, r, u)); if (mayDrain) { drain(); } }
Source:
<code><START> private SavedState(Parcel in) { <END> super(in); in.readList(mIds, List.class.getClassLoader()); }</code><technical_language>This SavedState constructor package-private avoid accessing a private member in createFromParcel method</technical_language>

Target:
SavedState(Parcel in) { super(in); in.readList(mIds, List.class.getClassLoader()); }
Source:
<code>protected BackendOpenStackVolumeAuthenticationKeyResource(String providerId, String id) { super(id, OpenstackVolumeAuthenticationKey.class, LibvirtSecret.class); this.providerId = providerId; <START> this.guid = asGuidOr404(id); <END> }</code><technical_language>I this assignment "guid" in base class? it</technical_language>

Target:
protected BackendOpenStackVolumeAuthenticationKeyResource(String providerId, String id) { super(id, OpenstackVolumeAuthenticationKey.class, LibvirtSecret.class); this.providerId = providerId; }
Source:
<code>public String getUrl(int requestId, CheckerInfo checkerInfo) { <START> return URL.concat(checkerInfo.getCurrencyBaseLowerCase()) <END> .concat("_") .concat(Currency.BRL.toLowerCase()); }</code><technical_language>return String.format(URL, checkerInfo.getCurrencyBaseLowerCase(), checkerInfo.getCurrencyCounterLowerCase());, hardcoding BRL here</technical_language>

Target:
public String getUrl(int requestId, CheckerInfo checkerInfo) { return String.format(URL, checkerInfo.getCurrencyBaseLowerCase(), checkerInfo.getCurrencyCounterLowerCase()); }
Source:
<code>private TableCellRenderer createCellRenderer(Class<?> columnClass) { <START> if (Double.class.equals(columnClass)){ <END> return new DecimalRenderer(); } else { return getTreeTable().getDefaultRenderer(columnClass); } }</code><technical_language>This _all_ columns Double type formatted decimal digits. is for cost (which is essentially money) for other columns, including user-defined (imagine e.g. weight measured in tons). I achieve goal is override method newTablecolumnext in GanttTreeTable check if creating COST column. similar approach in ResourceTreeTable. Also, done editor, no? user values 2 decimal digits, starts editing, different</technical_language>

Target:
private TableCellRenderer createCellRenderer(Class<?> columnClass) { return getTreeTable().getDefaultRenderer(columnClass); }
Source:
<code>public TranslatedExpression<T> translate(FunctionMetadata functionMetadata, RowExpression original, List<TranslatedExpression<T>> translatedArguments) { if (!isFunctionPresent(functionMetadata)) { return untranslated(original); } try { return new TranslatedExpression<>(Optional.of((T) functionMapping.get(functionMetadata).invokeWithArguments(translatedArguments)), original, translatedArguments); } <START> catch (Throwable t) { <END> return untranslated(original); } }</code><technical_language>throw error</technical_language>

Target:
public TranslatedExpression<T> translate(FunctionMetadata functionMetadata, RowExpression original, List<TranslatedExpression<T>> translatedArguments) throws Throwable { if (!functionMapping.containsKey(functionMetadata)) { return new TranslatedExpression<>(Optional.empty(), original, translatedArguments); } return new TranslatedExpression<>(Optional.of((T) functionMapping.get(functionMetadata).invokeWithArguments(translatedArguments)), original, translatedArguments); }