auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ParseObject(String theClassName) { String objectIdForPointer = isCreatingPointerForObjectId.get(); if (theClassName == null) { throw new IllegalArgumentException( "You must specify a Parse class name when creating a new ParseObject."); } if (AUTO_CLASS_NAME.equals(theClassName)) { theClassName = getSubclassingController().getClassName(getClass()); } if (!getSubclassingController().isTypeValid(theClassName, getClass())) { throw new IllegalArgumentException( "You must create this type of ParseObject using ParseObject.create() or the proper subclass."); } operationSetQueue = new LinkedList<>(); operationSetQueue.add(new ParseOperationSet()); estimatedData = new HashMap<>(); State.Init<?> builder = newStateBuilder(theClassName); if (objectIdForPointer == null) { setDefaultValues(); <START> builder.isComplete(true); <END> } else { if (!objectIdForPointer.equals(NEW_OFFLINE_OBJECT_ID_PLACEHOLDER)) { builder.objectId(objectIdForPointer); } builder.isComplete(false); } state = builder.build(); OfflineStore store = Parse.getLocalDatastore(); if (store != null) { store.registerNewObject(this); } }</code><technical_language>lose this case</technical_language>

Target:
public ParseObject(String theClassName) { String objectIdForPointer = isCreatingPointerForObjectId.get(); if (theClassName == null) { throw new IllegalArgumentException( "You must specify a Parse class name when creating a new ParseObject."); } if (AUTO_CLASS_NAME.equals(theClassName)) { theClassName = getSubclassingController().getClassName(getClass()); } if (!getSubclassingController().isSubclassValid(theClassName, getClass())) { throw new IllegalArgumentException( "You must create this type of ParseObject using ParseObject.create() or the proper subclass."); } operationSetQueue = new LinkedList<>(); operationSetQueue.add(new ParseOperationSet()); estimatedData = new HashMap<>(); State.Init<?> builder = newStateBuilder(theClassName); if (objectIdForPointer == null) { setDefaultValues(); builder.isComplete(true); } else { if (!objectIdForPointer.equals(NEW_OFFLINE_OBJECT_ID_PLACEHOLDER)) { builder.objectId(objectIdForPointer); } builder.isComplete(false); } state = builder.build(); OfflineStore store = Parse.getLocalDatastore(); if (store != null) { store.registerNewObject(this); } }
Source:
<code>public Row next() throws IOException { while (true) { try { Row result = currentDelegate.next(); if (result != null) { lastRowKey = result.getKey(); rowCount++; } currentBackoff.reset(); return result; } catch (ScanTimeoutException rte) { <START> if (logWarningsBeforeRetry) { <END> LOG.warn("ReadTimeoutException: ", rte); } backOffAndRetry(rte); } catch (IOExceptionWithStatus ioe) { if (logWarningsBeforeRetry) { LOG.warn("IOExceptionWithStatus: ", ioe); } Status.Code code = ioe.getStatus().getCode(); if (retryOptions.isRetryableRead(code)) { backOffAndRetry(ioe); } else { throw ioe; } } } }</code><technical_language>ditto here, if in Logger nice</technical_language>

Target:
public Row next() throws IOException { while (true) { try { Row result = currentDelegate.next(); if (result != null) { lastRowKey = result.getKey(); rowCount++; } currentBackoff.reset(); return result; } catch (ScanTimeoutException rte) { logger.warn("ReadTimeoutException: ", rte); backOffAndRetry(rte); } catch (IOExceptionWithStatus ioe) { logger.warn("IOExceptionWithStatus: ", ioe); Status.Code code = ioe.getStatus().getCode(); if (retryOptions.isRetryableRead(code)) { backOffAndRetry(ioe); } else { throw ioe; } } } }
Source:
<code>public boolean isFetchOnFeatureStart() { StoredConfig config = repository.getConfig(); <START> String result = config.getString(GITFLOW_SECTION, FEATURE_START_SUBSECTION, FEATURE_START_FETCH_KEY); return (result == null) ? false : Boolean.valueOf(result).booleanValue(); <END> }</code><technical_language>config.getBoolean(...) directly</technical_language>

Target:
public boolean isFetchOnFeatureStart() { StoredConfig config = repository.getConfig(); return config.getBoolean(GITFLOW_SECTION, FEATURE_START_SUBSECTION, FEATURE_START_FETCH_KEY, false); }
Source:
<code>protected void addCommonColumnSettings(FilterSettingsBuilderHelper builder) { <START> builder.setColumn(COLUMN_ACTIVATION_TIME, <END> constants.ActivationTime(), DateUtils.getDateTimeFormatMask()); builder.setColumn(COLUMN_ACTUAL_OWNER, constants.Actual_Owner()); builder.setColumn(COLUMN_CREATED_BY, constants.CreatedBy()); builder.setColumn(COLUMN_CREATED_ON, constants.Created_On(), DateUtils.getDateTimeFormatMask()); builder.setColumn(COLUMN_DEPLOYMENT_ID, constants.DeploymentId()); builder.setColumn(COLUMN_DESCRIPTION, constants.Description()); builder.setColumn(COLUMN_DUE_DATE, constants.DueDate(), DateUtils.getDateTimeFormatMask()); builder.setColumn(COLUMN_NAME, constants.Task()); builder.setColumn(COLUMN_PARENT_ID, constants.ParentId()); builder.setColumn(COLUMN_PRIORITY, constants.Priority()); builder.setColumn(COLUMN_PROCESS_ID, constants.Process_Definition_Id()); builder.setColumn(COLUMN_PROCESS_INSTANCE_ID, constants.Process_Instance_Id()); builder.setColumn(COLUMN_PROCESS_SESSION_ID, constants.ProcessSessionId()); builder.setColumn(COLUMN_STATUS, constants.Status()); builder.setColumn(COLUMN_TASK_ID, constants.Id()); builder.setColumn(COLUMN_WORK_ITEM_ID, constants.WorkItemId()); builder.setColumn(COLUMN_LAST_MODIFICATION_DATE, constants.Last_Modification_Date()); builder.setColumn(COLUMN_PROCESS_INSTANCE_CORRELATION_KEY, constants.Process_Instance_Correlation_Key()); builder.setColumn(COLUMN_PROCESS_INSTANCE_DESCRIPTION, constants.Process_Instance_Description()); builder.setColumn(COLUMN_ERROR_COUNT, constants.Error_Count()); builder.filterOn(true, true, true); builder.tableOrderEnabled(true); builder.tableOrderDefault(COLUMN_CREATED_ON, SortOrder.DESCENDING); }</code><technical_language>I guess add error column in call super add remaining</technical_language>

Target:
protected void addCommonColumnSettings(FilterSettingsBuilderHelper builder) { builder.setColumn(COLUMN_ERROR_COUNT, constants.Error_Count()); super.addCommonColumnSettings(builder); }
Source:
<code>public void dontRequestIfDownstreamRequestsLate() { final List<Long> requested = new ArrayList<Long>(); Action1<Long> empty = Actions.empty(); final AtomicReference<Producer> producer = new AtomicReference<Producer>(); Observable.create(new OnSubscribe<Integer>() { @Override public void call(Subscriber<? super Integer> t) { t.setProducer(new Producer() { @Override public void request(long n) { requested.add(n); } }); } }).doOnRequest(empty).subscribe(new Subscriber<Object>() { @Override public void onNext(Object t) { } @Override public void onError(Throwable e) { } @Override public void onCompleted() { } @Override public void setProducer(Producer p) { producer.set(p); } }); producer.get().request(1); <START> System.out.println(requested); <END> Assert.assertEquals(2, requested.size()); Assert.assertEquals(Arrays.asList(0L, 1L), requested); }</code><technical_language>cull sysout reduce test noise</technical_language>

Target:
public void dontRequestIfDownstreamRequestsLate() { final List<Long> requested = new ArrayList<Long>(); Action1<Long> empty = Actions.empty(); final AtomicReference<Producer> producer = new AtomicReference<Producer>(); Observable.create(new OnSubscribe<Integer>() { @Override public void call(Subscriber<? super Integer> t) { t.setProducer(new Producer() { @Override public void request(long n) { requested.add(n); } }); } }).doOnRequest(empty).subscribe(new Subscriber<Object>() { @Override public void onNext(Object t) { } @Override public void onError(Throwable e) { } @Override public void onCompleted() { } @Override public void setProducer(Producer p) { producer.set(p); } }); producer.get().request(1); int s = requested.size(); if (s == 1) { Assert.assertEquals(Arrays.asList(1L), requested); } else { Assert.assertEquals(Arrays.asList(0L, 1L), requested); } }
Source:
<code>public void visitWhileStatement(WhileStatementTree tree) { ConditionalState conditionalState = visitCondition(tree.condition()); currentState = conditionalState.trueState; scan(tree.statement()); <START> currentState = currentState.parentState.merge(conditionalState.trueState, conditionalState.falseState); <END> }</code><technical_language>gonna end valuable information a merge this</technical_language>

Target:
public void visitWhileStatement(WhileStatementTree tree) { ConditionalState conditionalState = visitCondition(tree.condition()); currentState = conditionalState.trueState; scan(tree.statement()); currentState = currentState.parentState.mergeValues(conditionalState.trueState, conditionalState.falseState); }
Source:
<code>private Request redirectRequest(Request request, String redirectToUri) { final String currentUrl = request.url().toString(); String matchingUri = null; for (String uri : uris) { if (currentUrl.startsWith(uri)) { matchingUri = uri; break; } } if (matchingUri == null) { throw new IllegalStateException( <START> String.format("None of the URIs %s matched request URL %s", uris, currentUrl)); <END> } final String newUrl = currentUrl.replaceFirst(matchingUri, redirectToUri); return request.newBuilder() .url(HttpUrl.parse(newUrl)) .tag(request.tag().equals(request) ? null : request.tag()) .build(); }</code><technical_language>URI URL</technical_language>

Target:
private Request redirectRequest(Request request, String redirectToUri) { String requestUri = request.url().toString(); String matchingUri = null; for (String uri : uris) { if (requestUri.startsWith(uri)) { matchingUri = uri; break; } } if (matchingUri == null) { throw new IllegalStateException(String.format("Unrecognized server URI in the request %s. " + "Supported servers are %s. Did you use different server URI for the initial request?", requestUri, uris)); } String newRequestUrl = requestUri.replaceFirst(matchingUri, redirectToUri); return request.newBuilder() .url(HttpUrl.parse(newRequestUrl)) .tag(request.tag().equals(request) ? null : request.tag()) .build(); }
Source:
<code>private String firstNonOptionArgument(String[] line) { int i; for (i = 1; i < line.length; i++) { String component = line[i]; if (!component.startsWith("--")) { return line[i]; } } <START> return null; <END> }</code><technical_language>nit, I this simplified this: java return Arrays.stream(line) .skip(1) .filter(component -> !component.startsWith("--")) .findFirst() .orElse(null);</technical_language>

Target:
private String firstNonOptionArgument(String[] line) { return Arrays.stream(line) .skip(1) .filter(component -> !component.startsWith("--")) .findFirst() .orElse(null); }
Source:
<code>protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException { String aadIssuedBearerToken = Optional.of(httpServletRequest) .map(r -> r.getHeader(HttpHeaders.AUTHORIZATION)) .map(String::trim) .filter(s -> s.startsWith(Constants.BEARER_PREFIX)) .map(s -> s.replace(Constants.BEARER_PREFIX, "")) .filter(principalManager::isTokenIssuedByAAD) .orElse(null); if (aadIssuedBearerToken == null || alreadyAuthenticated()) { filterChain.doFilter(httpServletRequest, httpServletResponse); return; } try { final UserPrincipal userPrincipal = principalManager.buildUserPrincipal(aadIssuedBearerToken); Set<SimpleGrantedAuthority> authorities = toSimpleGrantedAuthoritySet(userPrincipal); <START> if(userPrincipal.getClaim(AADTokenClaim.SCP) != null){ <END> authorities.addAll(scopeToSimpleGrantedAuthoritySet(userPrincipal)); } final Authentication authentication = new PreAuthenticatedAuthenticationToken( userPrincipal, null, authorities ); LOGGER.info("Request token verification success. {}", authentication); SecurityContextHolder.getContext().setAuthentication(authentication); try { filterChain.doFilter(httpServletRequest, httpServletResponse); } finally { SecurityContextHolder.clearContext(); } } catch (BadJWTException ex) { httpServletResponse.sendError(HttpStatus.UNAUTHORIZED.value()); } catch (ParseException | BadJOSEException | JOSEException ex) { LOGGER.error("Failed to initialize UserPrincipal.", ex); throw new ServletException(ex); } }</code><technical_language>move this condition scopeToSimpleGrantedAuthoritySet</technical_language>

Target:
protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException { String aadIssuedBearerToken = Optional.of(httpServletRequest) .map(r -> r.getHeader(HttpHeaders.AUTHORIZATION)) .map(String::trim) .filter(s -> s.startsWith(Constants.BEARER_PREFIX)) .map(s -> s.replace(Constants.BEARER_PREFIX, "")) .filter(principalManager::isTokenIssuedByAAD) .orElse(null); if (aadIssuedBearerToken == null || alreadyAuthenticated()) { filterChain.doFilter(httpServletRequest, httpServletResponse); return; } try { final UserPrincipal userPrincipal = principalManager.buildUserPrincipal(aadIssuedBearerToken); final Authentication authentication = new PreAuthenticatedAuthenticationToken( userPrincipal, null, toSimpleGrantedAuthoritySet(userPrincipal) ); LOGGER.info("Request token verification success. {}", authentication); SecurityContextHolder.getContext().setAuthentication(authentication); try { filterChain.doFilter(httpServletRequest, httpServletResponse); } finally { SecurityContextHolder.clearContext(); } } catch (BadJWTException ex) { httpServletResponse.sendError(HttpStatus.UNAUTHORIZED.value()); } catch (ParseException | BadJOSEException | JOSEException ex) { LOGGER.error("Failed to initialize UserPrincipal.", ex); throw new ServletException(ex); } }
Source:
<code>public void setTypeBasedOptimizationOptions(CompilerOptions options) { switch (this) { case ADVANCED_OPTIMIZATIONS: options.inferTypes = true; options.disambiguateProperties = true; options.ambiguateProperties = true; options.inlineProperties = true; options.useTypesForOptimization = true; break; case SIMPLE_OPTIMIZATIONS: <START> options.useTypesForOptimization = true; <END> break; case WHITESPACE_ONLY: break; } }</code><technical_language>philosophy of simple-mode is work soundly code, minimal restrictions (using reflection). type-based optimizations in simple mode</technical_language>

Target:
public void setTypeBasedOptimizationOptions(CompilerOptions options) { switch (this) { case ADVANCED_OPTIMIZATIONS: options.inferTypes = true; options.disambiguateProperties = true; options.ambiguateProperties = true; options.inlineProperties = true; options.useTypesForOptimization = true; break; case SIMPLE_OPTIMIZATIONS: case WHITESPACE_ONLY: break; } }
Source:
<code>protected void updateEnvironmentVariables() throws OpenShiftException { if (!canGetEnvironmentVariables()) { return; } <START> if (environmentVariablesMap == null) { <END> environmentVariablesMap = loadEnvironmentVariables(); } else { environmentVariablesMap.clear(); environmentVariablesMap.putAll(loadEnvironmentVariables()); } }</code><technical_language>checking for env map null, is more, right (since initialize empty map)</technical_language>

Target:
protected void updateEnvironmentVariables() throws OpenShiftException { if (!canGetEnvironmentVariables()) return; else { environmentVariablesMap.clear(); environmentVariablesMap = loadEnvironmentVariables(); } }
Source:
<code>public static Archive<?> deployment() { final Archive<?> deployment = ShrinkWrap.create(JavaArchive.class, "JMSMessageDrivenBeanTestCase.jar") .addClasses(ReplyingMDB.class,JMSMessagingUtil.class) .addClass(CreateQueueSetupTask.class) <START> .addClass(TimeoutUtil.class); <END> return deployment; }</code><technical_language>deployment need a system property read permission for this test work a security manager. MDBTestCase example of setup</technical_language>

Target:
public static Archive<?> deployment() { final Archive<?> deployment = ShrinkWrap.create(JavaArchive.class, "JMSMessageDrivenBeanTestCase.jar") .addClasses(ReplyingMDB.class,JMSMessagingUtil.class) .addClass(CreateQueueSetupTask.class) .addClass(TimeoutUtil.class) .addAsResource(createPermissionsXmlAsset(new PropertyPermission("ts.timeout.factor", "read")), "META-INF/jboss-permissions.xml"); return deployment; }
Source:
<code>private String getFileName(Attr source) throws MimeTypeException { String value = source.getValue(); String fileName = null; @SuppressWarnings("unchecked") Map<String, byte[]> embeddedImages = (Map<String, byte[]>) source.getOwnerDocument().getUserData(EMBEDDED_IMAGES); if (embeddedImages != null && value.startsWith("data:")) { DataUri dataURI = DataUri.parse(value, Charset.forName(UTF_8)); fileName = dataURI.getFilename(); if (StringUtils.isEmpty(fileName)) { fileName = String.valueOf(Math.abs(dataURI.hashCode())); if (!StringUtils.isEmpty(dataURI.getMime())) { String extension = MimeTypes.getDefaultMimeTypes().forName(dataURI.getMime()).getExtension(); fileName += extension; } } embeddedImages.put(fileName, dataURI.getData()); } else if (!value.contains("://")) { int separator = value.lastIndexOf('/'); fileName = separator < 0 ? value : value.substring(separator + 1); try { fileName = URLDecoder.decode(fileName, UTF_8); <START> fileName = fileName.replaceAll("&amp;", "&"); <END> } catch (Exception e) { } } return fileName; }</code><technical_language>I feel this is a workaround for a bug is more located in DefaultHTMLCleaner is parse HTML: resolving HTML entities</technical_language>

Target:
private String getFileName(Attr source) throws MimeTypeException { String value = source.getValue(); String fileName = null; @SuppressWarnings("unchecked") Map<String, byte[]> embeddedImages = (Map<String, byte[]>) source.getOwnerDocument().getUserData(EMBEDDED_IMAGES); if (embeddedImages != null && value.startsWith("data:")) { DataUri dataURI = DataUri.parse(value, Charset.forName(UTF_8)); fileName = dataURI.getFilename(); if (StringUtils.isEmpty(fileName)) { fileName = String.valueOf(Math.abs(dataURI.hashCode())); if (!StringUtils.isEmpty(dataURI.getMime())) { String extension = MimeTypes.getDefaultMimeTypes().forName(dataURI.getMime()).getExtension(); fileName += extension; } } embeddedImages.put(fileName, dataURI.getData()); } else if (!value.contains("://")) { int separator = value.lastIndexOf('/'); fileName = separator < 0 ? value : value.substring(separator + 1); try { fileName = fileName.replaceAll("\\+", "%2B"); fileName = URLDecoder.decode(fileName, UTF_8); fileName = fileName.replaceAll("&amp;", "&"); fileName = fileName.replaceAll("@", "\\\\@"); } catch (Exception e) { } } return fileName; }
Source:
<code>public static ByteBuf metadata(final ByteBuf byteBuf) { boolean hasMetadata = FrameHeaderFlyweight.hasMetadata(byteBuf); FrameHeaderFlyweight.ensureFrameType(FrameType.LEASE, byteBuf); byteBuf.markReaderIndex(); byteBuf.skipBytes(FrameHeaderFlyweight.size() + Integer.BYTES * 2); <START> ByteBuf metadata = DataAndMetadataFlyweight.metadataWithoutMarking(byteBuf, hasMetadata); <END> byteBuf.resetReaderIndex(); return metadata; }</code><technical_language>metadataWithoutMarking assumes is metadata length encoded - spec, Lease frame encode metadata length</technical_language>

Target:
public static ByteBuf metadata(final ByteBuf byteBuf) { FrameHeaderFlyweight.ensureFrameType(FrameType.LEASE, byteBuf); if (FrameHeaderFlyweight.hasMetadata(byteBuf)) { byteBuf.markReaderIndex(); byteBuf.skipBytes(FrameHeaderFlyweight.size() + Integer.BYTES * 2); ByteBuf metadata = byteBuf.slice(); byteBuf.resetReaderIndex(); return metadata; } else { return Unpooled.EMPTY_BUFFER; } }
Source:
<code>TableDataBuilder addRowsFrom(File file, FileParser fileParser) { if (fileParser.hasColumnNames()) { <START> if (names != schema.getFieldNames()) { <END> throw new IllegalArgumentException("Mixing manual column selection and header column names is not supported."); } List<String> columns = fileParser.getColumnNames(file); withColumns(columns.toArray(new String[columns.size()])); } return addRows(fileParser.parse(file, schema, names)); }</code><technical_language>Precondition instead. Cleaner code</technical_language>

Target:
TableDataBuilder addRowsFrom(File file, FileParser fileParser) { if (fileParser.hasColumnNames()) { checkArgument(names.equals(schema.getFieldNames()), "Manual column spec and header column spec are mutually exclusive"); List<String> columns = fileParser.getColumnNames(file); withColumns(columns.toArray(new String[columns.size()])); } return addRows(fileParser.parse(file, schema, names)); }
Source:
<code>public boolean shouldEmitContainer( final int currentReferenceContextID, final int nextRecordIndex, final int numberOfSliceEntries) { <START> return numberOfSliceEntries == encodingStrategy.getSlicesPerContainer() || <END> currentReferenceContextID == ReferenceContext.MULTIPLE_REFERENCE_ID || currentReferenceContextID != nextRecordIndex; }</code><technical_language>this >= ("just in case")</technical_language>

Target:
public boolean shouldEmitContainer( final int currentReferenceContextID, final int nextRecordIndex, final int numberOfSliceEntries) { return numberOfSliceEntries >= encodingStrategy.getSlicesPerContainer() || currentReferenceContextID == ReferenceContext.MULTIPLE_REFERENCE_ID || currentReferenceContextID != nextRecordIndex; }
Source:
<code>public Publisher<T> apply(Publisher<T> publisher) { if (publisher instanceof Mono) { return withTimeout((Mono<T>) publisher); } else if (publisher instanceof Flux) { return withTimeout((Flux<T>) publisher); } else { <START> throw new IllegalStateException("Publisher of type <" + publisher.getClass().getSimpleName() <END> + "> is not supported by this operator"); } }</code><technical_language>throw a IllegalPublisherException in RxJava2</technical_language>

Target:
public Publisher<T> apply(Publisher<T> publisher) { if (publisher instanceof Mono) { return withTimeout((Mono<T>) publisher); } else if (publisher instanceof Flux) { return withTimeout((Flux<T>) publisher); } else { throw new IllegalPublisherException(publisher); } }
Source:
<code>public static GeometryCollection unifyWindingOrderForGeometryCollection( GeometryCollection geoCollection, boolean counterClockWise) { int noOfGeoms = geoCollection.getNumGeometries(); Geometry[] revGeoms = new Geometry[noOfGeoms]; for (int i = 0; i < noOfGeoms; i++) { Geometry geometry = geoCollection.getGeometryN(i); <START> if (geometry instanceof MultiPolygon) { <END> revGeoms[i] = unifyWindingOrderForMultiPolygon((MultiPolygon) geometry, counterClockWise); } else if (geometry instanceof Polygon) { revGeoms[i] = unifyWindingOrderForPolyGon((Polygon) geometry, counterClockWise); } else if (geometry instanceof LinearRing) { revGeoms[i] = unifyWindingOrderForLinearRing((LinearRing) geometry, counterClockWise); } else if (geometry instanceof GeometryCollection) { revGeoms[i] = unifyWindingOrderForGeometryCollection((GeometryCollection) geometry, counterClockWise); } else revGeoms[i] = geometry; } return factory.createGeometryCollection(revGeoms); }</code><technical_language>Instead of conditions for geometry types duplicated here, call unifyWindingOrder(geometry, counterClockWise) for individual geometries in collection</technical_language>

Target:
public static GeometryCollection unifyWindingOrderForGeometryCollection( GeometryCollection geoCollection, boolean counterClockWise) { int noOfGeoms = geoCollection.getNumGeometries(); Geometry[] revGeoms = new Geometry[noOfGeoms]; for (int i = 0; i < noOfGeoms; i++) { revGeoms[i] = unifyWindingOrder(geoCollection.getGeometryN(i), counterClockWise); } return factory.createGeometryCollection(revGeoms); }
Source:
<code>public void enableOtherFeedbackPathOptionsForNewQuestion() { WebElement questionTable = browser.driver.findElement(By.id("questionTableNew")); WebElement dropdownButton = questionTable.findElement(By.cssSelector(".feedback-path-dropdown > button")); WebElement otherOption = questionTable.findElement( By.className("feedback-path-dropdown-option-other")); dropdownButton.click(); <START> otherOption.click(); <END> }</code><technical_language>I Travis build report. *.click() click(*) new version of Selenium's change in implementation</technical_language>

Target:
public void enableOtherFeedbackPathOptionsForNewQuestion() { WebElement questionTable = browser.driver.findElement(By.id("questionTable--1")); WebElement dropdownButton = questionTable.findElement(By.cssSelector(".feedback-path-dropdown > button")); WebElement otherOption = questionTable.findElement( By.className("feedback-path-dropdown-option-other")); click(dropdownButton); click(otherOption); }
Source:
<code>public boolean hasNext() { <START> if (episodes.hasNext()) { <END> return true; } return false; }</code><technical_language>Again, return boolean value</technical_language>

Target:
public boolean hasNext() { return episodes.hasNext(); }
Source:
<code>public JSONObject getPayLoadJSON() { JSONObject payloadJSON = null; HttpServletRequest req = this.getRequest(); try (InputStream in = req.getInputStream()) { final byte[] json = IOHelper.readBytes(in); final String jsonString = new String(json, StandardCharsets.UTF_8); return new JSONObject(jsonString); } catch (Exception ignored) <START> return payloadJSON; <END> }</code><technical_language>Instead of silently swallowing exception this method throw caller decide he/she wants handle it</technical_language>

Target:
public JSONObject getPayLoadJSON() throws ActionParamsException { HttpServletRequest req = this.getRequest(); try (InputStream in = req.getInputStream()) { final byte[] json = IOHelper.readBytes(in); final String jsonString = new String(json, StandardCharsets.UTF_8); return new JSONObject(jsonString); } catch (Exception exception) { throw new ActionParamsException("Cannot get payload JSON"); } }
Source:
<code>private String generateClusterId() { <START> final String randomUUID = UUID.randomUUID().toString().replaceAll("-", ""); <END> return (CLUSTER_ID_PREFIX + randomUUID).substring(0, Constants.MAXIMUM_CHARACTERS_OF_CLUSTER_ID); }</code><technical_language>Instead of string replacement, suggestion final String randomID = new AbstractID().toString(); this a bit simpler</technical_language>

Target:
private String generateClusterId() { final String randomID = new AbstractID().toString(); return (CLUSTER_ID_PREFIX + randomID).substring(0, Constants.MAXIMUM_CHARACTERS_OF_CLUSTER_ID); }
Source:
<code>public void writeUrls(URI baseUri) { setUrl(WritableUrls.buildUriPath(baseUri, "/rest/tree/sample/{id}", getId())); setUpdatedByUrl(WritableUrls.buildUriPath(baseUri, "/rest/user/{id}", getUpdatedById())); if (getRootSampleClassId() != null) { setRootSampleClassUrl(WritableUrls.buildUriPath(baseUri, "/rest/sampleclass/{id}", getRootSampleClassId())); } <START> setUrl(WritableUrls.buildUriPath(baseUri, "/rest/sample/{id}", getId())); <END> }</code><technical_language>setUrl called path</technical_language>

Target:
public void writeUrls(URI baseUri) { setUrl(WritableUrls.buildUriPath(baseUri, "/rest/tree/sample/{id}", getId())); setUpdatedByUrl(WritableUrls.buildUriPath(baseUri, "/rest/user/{id}", getUpdatedById())); if (getRootSampleClassId() != null) { setRootSampleClassUrl(WritableUrls.buildUriPath(baseUri, "/rest/sampleclass/{id}", getRootSampleClassId())); } }
Source:
<code>public void setParams(MatrixLib mean, MatrixLib covariance) { if (mean != null) { if (!(mean.numCols() == 1 && mean.numRows() > 0)) { throw new IllegalArgumentException( "The mean given is not a valid column vector. It has dimensions " + mean.numRows() + " by " + mean.numCols() + "."); } this.mean = mean; this.hasMean = true; <START> this.legalAssignment = false; <END> } if (covariance != null) { if (!(covariance.numCols() > 0 && covariance.isSymmetric())) { throw new IllegalArgumentException( "The covariance matrix given is not symmetric"); } this.covariance = covariance; this.hasCovariance = true; this.legalAssignment = false; } if (!this.legalAssignment && this.hasMean && this.hasCovariance) { if (this.covariance.numCols() != this.mean.numCols()) { throw new IllegalArgumentException( "Dimensions of the mean vector and the covariance matrix do not match: " + "The covariance matrix is " + covariance.numCols() + " by " + covariance.numRows() + " while the mean vector is " + mean.numRows() + " by " + mean.numCols() + "."); } initializeConstants(); this.legalAssignment = true; } }</code><technical_language>do need legalAssignment</technical_language>

Target:
public void setParams(MatrixLib mean, MatrixLib covariance) { if (mean != null) { if (!(mean.numCols() > 0 && mean.numRows() == 1)) { throw new IllegalArgumentException( "The mean given is not a valid row vector. It has dimensions " + mean.numRows() + " by " + mean.numCols() + "."); } this.mean = mean; this.hasMean = true; } if (covariance != null) { if (!(covariance.numCols() > 0 && covariance.isSymmetric())) { throw new IllegalArgumentException( "The covariance matrix given is not symmetric"); } this.covariance = covariance; this.hasCovariance = true; } if (this.hasMean && this.hasCovariance) { if (this.covariance.numRows() != this.mean.numCols()) { throw new IllegalArgumentException( "Dimensions of the mean vector and the covariance matrix do not match: " + "The covariance matrix is " + covariance.numCols() + " by " + covariance.numRows() + " while the mean vector is " + mean.numRows() + " by " + mean.numCols() + "."); } initializeConstants(); } }
Source:
<code>private void checkForDRBufferLimit() { <START> tmLog.debug("drBufferChanged: " + m_drBufferChangedAgg + " limit:" + MAX_DR_BUFFER_SIZE); <END> if (m_drBufferChangedAgg >= MAX_DR_BUFFER_SIZE) { tmLog.debug("rollback for dr limit"); setNeedsRollback(true); throw new SQLException(volt_output_buffer_overflow, "Aggregate MP Transaction requiring " + m_drBufferChangedAgg + " bytes exceeds max DR Buffer size of " + MAX_DR_BUFFER_SIZE + " bytes."); } }</code><technical_language>If check here. Also, this trace level</technical_language>

Target:
private void checkForDRBufferLimit() { if (!m_drProducerActive) { return; } if (tmLog.isTraceEnabled()) { tmLog.trace("Total DR buffer allocate for this txn: " + m_drBufferChangedAgg + " limit:" + DR_MAX_AGGREGATE_BUFFERSIZE); } if (getDRMessageSizeEstimation() >= DR_MAX_AGGREGATE_BUFFERSIZE) { if (tmLog.isDebugEnabled()) { tmLog.debug("Transaction txnid: " + TxnEgo.txnIdToString(txnId) + " exceeding DR Buffer Limit, need rollback."); } setNeedsRollback(true); throw new SQLException(volt_output_buffer_overflow, "Aggregate MP Transaction requiring " + m_drBufferChangedAgg + " bytes exceeds max DR Buffer size of " + DR_MAX_AGGREGATE_BUFFERSIZE + " bytes."); } }
Source:
<code>public boolean supports(final Element<? extends Definition> element) { <START> return element.getContent().getDefinition() instanceof DMNDiagram; <END> }</code><technical_language>please replace element.getContent().getDefinition() DefinitionUtils.getElementDefinition(element)</technical_language>

Target:
public boolean supports(final Element<? extends Definition> element) { return DefinitionUtils.getElementDefinition(element) instanceof DMNDiagram; }
Source:
<code>public void createSchema(SimpleFeatureType featureType) throws IOException { List<String> header = new ArrayList<String>(); GeometryDescriptor geometryDescrptor = featureType.getGeometryDescriptor(); if (geometryDescrptor != null && CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, geometryDescrptor.getCoordinateReferenceSystem()) && geometryDescrptor.getType().getBinding().isAssignableFrom(Point.class)) { header.add("LAT"); <START> header.add("LON"); <END> } else { throw new IOException("Unable use LAT/LON to represent " + geometryDescrptor); } for (AttributeDescriptor descriptor : featureType.getAttributeDescriptors()) { if (descriptor instanceof GeometryDescriptor) continue; header.add(descriptor.getLocalName()); } CsvWriter writer = new CsvWriter(new FileWriter(this.csvFileState.getFile()),','); try { writer.writeRecord( header.toArray(new String[header.size()])); } finally { writer.close(); } }</code><technical_language>I find odd specifically asking constructor for a custom "lat" "lon" name ... ignoring making schema? If I a user I feel :) I a straight port right now, nice clean this a refactor this module supported</technical_language>

Target:
public void createSchema(SimpleFeatureType featureType) throws IOException { List<String> header = new ArrayList<String>(); GeometryDescriptor geometryDescrptor = featureType.getGeometryDescriptor(); if (geometryDescrptor != null && CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, geometryDescrptor.getCoordinateReferenceSystem()) && geometryDescrptor.getType().getBinding().isAssignableFrom(Point.class)) { header.add(this.latField); header.add(this.lngField); } else { throw new IOException("Unable use LAT/LON to represent " + geometryDescrptor); } for (AttributeDescriptor descriptor : featureType.getAttributeDescriptors()) { if (descriptor instanceof GeometryDescriptor) continue; header.add(descriptor.getLocalName()); } CsvWriter writer = new CsvWriter(new FileWriter(this.csvFileState.getFile()),','); try { writer.writeRecord( header.toArray(new String[header.size()])); } finally { writer.close(); } }
Source:
<code>public BackgroundTask<Path> prepareDownloadTask(Path targetDirectory, URLDownload urlDownload) { StringBuilder messageError = new StringBuilder(); BackgroundTask<Path> downloadTask = BackgroundTask .wrap(() -> { Optional<ExternalFileType> suggestedType = inferFileType(urlDownload); ExternalFileType externalFileType = suggestedType.orElse(StandardExternalFileType.PDF); String suggestedTypeName = externalFileType.getName(); linkedFile.setFileType(suggestedTypeName); String suggestedName = linkedFileHandler.getSuggestedFileName(externalFileType.getExtension()); String fulltextDir = FileUtil.createDirNameFromPattern(databaseContext.getDatabase(), entry, filePreferences.getFileDirectoryPattern()); String finalName = FileNameUniqueness.getNonOverWritingFileName(targetDirectory.resolve(fulltextDir), suggestedName); if (!suggestedName.equals(finalName)) { <START> messageError.append("File: \""); <END> messageError.append(suggestedName); messageError.append("\" already exists"); return null; } return targetDirectory.resolve(fulltextDir).resolve(finalName); }) .then(destination -> new FileDownloadTask(urlDownload.getSource(), destination)) .onFailure(exception -> handleDownloadError(messageError, exception)); return downloadTask; }</code><technical_language>StringBuilder is necessary, I simply add a localized string .e.g messageError = Localization.lang("File name %0 exists. Aborting download.", suggestedName)</technical_language>

Target:
public BackgroundTask<Path> prepareDownloadTask(Path targetDirectory, URLDownload urlDownload) { StringBuilder messageError = new StringBuilder(); BackgroundTask<Path> downloadTask = BackgroundTask .wrap(() -> { Optional<ExternalFileType> suggestedType = inferFileType(urlDownload); ExternalFileType externalFileType = suggestedType.orElse(StandardExternalFileType.PDF); String suggestedTypeName = externalFileType.getName(); linkedFile.setFileType(suggestedTypeName); String suggestedName = linkedFileHandler.getSuggestedFileName(externalFileType.getExtension()); String fulltextDir = FileUtil.createDirNameFromPattern(databaseContext.getDatabase(), entry, filePreferences.getFileDirectoryPattern()); String finalName = FileNameUniqueness.getNonOverWritingFileName(targetDirectory.resolve(fulltextDir), suggestedName); if (!suggestedName.equals(finalName)) { messageError.append(Localization.lang("File")); messageError.append(": \""); messageError.append(suggestedName); messageError.append("\""); messageError.append(Localization.lang(" already exists")); return null; } return targetDirectory.resolve(fulltextDir).resolve(finalName); }) .then(destination -> new FileDownloadTask(urlDownload.getSource(), destination)) .onFailure(exception -> handleDownloadError(messageError, exception)); return downloadTask; }
Source:
<code>public <P extends ProviderProxy<?>> P create(Provider<?> provider) { switch (provider.getType()) { case EXTERNAL_NETWORK: <START> if (provider.getIsUnmanaged()) { <END> return (P) new UnmanagedNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); } return (P) new ExternalNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case FOREMAN: return (P) new ForemanHostProviderProxy(provider); case OPENSTACK_NETWORK: if (provider.getIsUnmanaged()) { return (P) new UnmanagedNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); } return (P) new OpenstackNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case OPENSTACK_IMAGE: return (P) new OpenStackImageProviderProxy((Provider<OpenStackImageProviderProperties>) provider); case OPENSTACK_VOLUME: return (P) new OpenStackVolumeProviderProxy((Provider<OpenStackVolumeProviderProperties>) provider); case VMWARE: return (P) Injector.injectMembers(new VmwareVmProviderProxy((Provider<VmwareVmProviderProperties>) provider)); case KVM: return (P) Injector.injectMembers(new KVMVmProviderProxy((Provider<KVMVmProviderProperties>) provider)); case XEN: return (P) Injector.injectMembers(new XENVmProviderProxy((Provider<XENVmProviderProperties>) provider)); default: return null; } }</code><technical_language>EXTERNAL_NETWORK OPENSTACK_NETWORK needed? decide 'unmanaged provider' EXTERNAL_NETWORK</technical_language>

Target:
public <P extends ProviderProxy<?>> P create(Provider<?> provider) { switch (provider.getType()) { case EXTERNAL_NETWORK: if (provider.getIsUnmanaged()) { return (P) new UnmanagedNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); } return (P) new ExternalNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case FOREMAN: return (P) new ForemanHostProviderProxy(provider); case OPENSTACK_NETWORK: return (P) new OpenstackNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case OPENSTACK_IMAGE: return (P) new OpenStackImageProviderProxy((Provider<OpenStackImageProviderProperties>) provider); case OPENSTACK_VOLUME: return (P) new OpenStackVolumeProviderProxy((Provider<OpenStackVolumeProviderProperties>) provider); case VMWARE: return (P) Injector.injectMembers(new VmwareVmProviderProxy((Provider<VmwareVmProviderProperties>) provider)); case KVM: return (P) Injector.injectMembers(new KVMVmProviderProxy((Provider<KVMVmProviderProperties>) provider)); case XEN: return (P) Injector.injectMembers(new XENVmProviderProxy((Provider<XENVmProviderProperties>) provider)); default: return null; } }
Source:
<code>private void assertFailureCatalogContains(Class<?> beanClass, String failureStringToCheck) { Assert.assertFalse("Failure on checking bean " + beanClass.getName() + " should happen", FailureCatalog.INSTANCE.isEmpty()); <START> Assert.assertThat(FailureCatalog.INSTANCE.formatCatalogContent().split(String.format("%n")), <END> HamcrestRegexpMatcher.matches(failureStringToCheck)); }</code><technical_language>System.lineSeparator()</technical_language>

Target:
private void assertFailureCatalogContains(Class<?> beanClass, String failureStringToCheck) { Assert.assertFalse("Failure on checking bean " + beanClass.getName() + " should happen", FailureCatalog.INSTANCE.isEmpty()); Assert.assertThat(FailureCatalog.INSTANCE.formatCatalogContent().split(System.lineSeparator()), HamcrestRegexpMatcher.matches(failureStringToCheck)); }
Source:
<code>private void logProjectCreatedEvent(@Nonnull String projectName, @Nonnull String projectType) { <START> String paas = projectType.startsWith("GAE") ? "GAE" : "default"; <END> LOG.info("EVENT#project-created# PROJECT#{}# TYPE#{}# WS#{}# USER#{}# PAAS#{}#", projectName, projectType, EnvironmentContext.getCurrent().getWorkspaceName(), EnvironmentContext.getCurrent().getUser().getName(), paas); }</code><technical_language>Hardcode good. event service for this</technical_language>

Target:
private void logProjectCreatedEvent(@Nonnull String projectName, @Nonnull String projectType) { LOG.info("EVENT#project-created# PROJECT#{}# TYPE#{}# WS#{}# USER#{}# PAAS#default#", projectName, projectType, EnvironmentContext.getCurrent().getWorkspaceId(), EnvironmentContext.getCurrent().getUser().getId()); }
Source:
<code>public long getTailSegment() { if (tailSegment.get() == Address.NON_ADDRESS) { <START> long dbTailSegment = Optional.ofNullable(dataStore.get(TAIL_SEGMENT_RECORD)).orElse(0L); <END> tailSegment.set(dbTailSegment); } return tailSegment.get(); }</code><technical_language>ZERO_ADDRESS</technical_language>

Target:
public long getTailSegment() { if (tailSegment.get() == Address.NON_ADDRESS) { tailSegment.set(dataStore.get(TAIL_SEGMENT_RECORD, ZERO_ADDRESS)); } return tailSegment.get(); }
Source:
<code>public void visitScript(ScriptTree tree) { <START> storageTypes = new HashedMap(); <END> super.visitScript(tree); checkForIssues(); }</code><technical_language>@ganncamp minor: instantiate field declaration level cleared calling storage.clear() WDYT</technical_language>

Target:
public void visitScript(ScriptTree tree) { storageTypes.clear(); super.visitScript(tree); checkForIssues(); }
Source:
<code>public void updateVisibility() { messageLabel.setVisible(false); if (!ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)) { <START> externalProviderEditor.setVisible(false); <END> neutronPhysicalNetwork.setVisible(false); createSubnetEditor.setVisible(false); vlanTagging.setVisible(false); vlanTag.setVisible(false); exportLabel.setVisible(false); exportEditor.setVisible(false); profilesTab.setVisible(false); } }</code><technical_language>reason visibility of messageLabel is controlled form is messageLabel is part of NetworkModel. other fields a representation in NetworkModel please control visibility model (the model method for controlling visibility is- setIsAvailiable(..))</technical_language>

Target:
public void updateVisibility() { messageLabel.setVisible(false); exportLabel.setVisible(ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)); }
Source:
<code>protected IContributionItem[] getContributionItems() { List<IContributionItem> result = new ArrayList<>(); ISelection selection = serviceLocator .getService(ISelectionService.class).getSelection(); final <START> List<String> selectedRepoDirectories <END> = getDirectoriesOfSelectedRepositoryNodes( selection); if (!selectedRepoDirectories.isEmpty()) { final RepositoryGroups util = new RepositoryGroups(); addStaticItems(util, selectedRepoDirectories, result); List<RepositoryGroup> groups = util.getGroups(); Collections.sort(groups); if (!groups.isEmpty()) { result.add(new Separator()); for (RepositoryGroup group : groups) { result.add(getAssignGroupItem(util, group, selectedRepoDirectories)); } } } return result.toArray(new IContributionItem[0]); }</code><technical_language>File</technical_language>

Target:
protected IContributionItem[] getContributionItems() { List<IContributionItem> result = new ArrayList<>(); ISelection selection = serviceLocator .getService(ISelectionService.class).getSelection(); final List<File> selectedRepoDirectories = getDirectoriesOfSelectedRepositoryNodes( selection); if (!selectedRepoDirectories.isEmpty()) { final RepositoryGroups groupsUtil = RepositoryGroups.getInstance(); addStaticItems(groupsUtil, selectedRepoDirectories, result); List<RepositoryGroup> groups = groupsUtil.getGroups(); Collections.sort(groups, (g1, g2) -> CommonUtils.STRING_ASCENDING_COMPARATOR .compare(g1.getName(), g2.getName())); if (!groups.isEmpty()) { result.add(new Separator()); for (RepositoryGroup group : groups) { result.add(getAssignGroupItem(groupsUtil, group, selectedRepoDirectories)); } } } return result.toArray(new IContributionItem[0]); }
Source:
<code>public String getPathForHadoop() { String hadoopPath = StringUtils.format( "%s://%s@%s.%s/%s", AzureUtils.AZURE_STORAGE_HADOOP_PROTOCOL, segmentConfig.getContainer(), accountConfig.getAccount(), AzureUtils.AZURE_STORAGE_HOST_ADDRESS, <START> segmentConfig.getPrefix().isEmpty() ? "" : segmentConfig.getPrefix() + '/' <END> ); log.info("Using Azure blob storage Hadoop path: %s", hadoopPath); return hadoopPath; }</code><technical_language>if prefix ends a / Is a util build path separator end? Is harm if path ends /</technical_language>

Target:
public String getPathForHadoop() { String prefix = segmentConfig.getPrefix(); boolean prefixIsNullOrEmpty = org.apache.commons.lang.StringUtils.isEmpty(prefix); String hadoopPath = StringUtils.format( "%s://%s@%s.%s/%s", AzureUtils.AZURE_STORAGE_HADOOP_PROTOCOL, segmentConfig.getContainer(), accountConfig.getAccount(), AzureUtils.AZURE_STORAGE_HOST_ADDRESS, prefixIsNullOrEmpty ? "" : StringUtils.maybeRemoveTrailingSlash(prefix) + '/' ); log.info("Using Azure blob storage Hadoop path: %s", hadoopPath); return hadoopPath; }
Source:
<code>public Operator createOperator(DriverContext driverContext) { checkState(!closed, "Factory is already closed"); LocalExchange inMemoryExchange = localExchangeFactory.getLocalExchange(driverContext.getLifespan()); <START> OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, LocalExchangeSourceOperator.class.getSimpleName()); <END> PageWithPositionComparator comparator = comparatorFactory.create(types, sortChannels, orderings); List<LocalExchangeSource> sources = IntStream.range(0, inMemoryExchange.getBufferCount()) .boxed() .map(index -> inMemoryExchange.getNextSource()) .collect(toImmutableList()); return new LocalMergeSourceOperator(operatorContext, sources, types, comparator); }</code><technical_language>s/LocalExchangeSourceOperator/LocalMergeSourceOperator</technical_language>

Target:
public Operator createOperator(DriverContext driverContext) { checkState(!closed, "Factory is already closed"); LocalExchange localExchange = localExchangeFactory.getLocalExchange(driverContext.getLifespan()); OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, LocalMergeSourceOperator.class.getSimpleName()); PageWithPositionComparator comparator = orderingCompiler.compilePageWithPositionComparator(types, sortChannels, orderings); List<LocalExchangeSource> sources = IntStream.range(0, localExchange.getBufferCount()) .boxed() .map(index -> localExchange.getNextSource()) .collect(toImmutableList()); return new LocalMergeSourceOperator(operatorContext, sources, types, comparator); }