auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { AsyncContext asyncContext = getAsyncContext(req); Observable<Metric<Object>> metricObservable = metricsService.scanAllMetricIndexes().onBackpressureBuffer(); PublishSubject<byte[]> byteSubject = PublishSubject.create(); Observable<byte[]> buffers = metricObservable.map(m -> { try { return objectWriter.writeValueAsBytes(m); } catch (JsonProcessingException e) { throw Exceptions.propagate(e); } <START> }).onBackpressureBuffer(); <END> buffers.subscribe(new Observer<byte[]>() { AtomicBoolean first = new AtomicBoolean(true); @Override public void onCompleted() { byteSubject.onNext("]".getBytes(Charset.forName("UTF-8"))); byteSubject.onCompleted(); } @Override public void onError(Throwable throwable) { } @Override public void onNext(byte[] bytes) { if(first.compareAndSet(true, false)) { byteSubject.onNext("[".getBytes(Charset.forName("UTF-8"))); byteSubject.onNext(bytes); } else { byteSubject.onNext(comma); byteSubject.onNext(bytes); } } }); ObservableServlet.write(byteSubject, resp.getOutputStream()) .subscribe(v -> {}, t -> { t.printStackTrace(); asyncContext.complete(); }, asyncContext::complete); }</code><technical_language>writeValueAsBytes do JSON mapping</technical_language>

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setCharacterEncoding("UTF-8"); resp.setContentType("application/json"); AsyncContext asyncContext = getAsyncContext(req); Observable<Metric<Object>> metricObservable = metricsService.scanAllMetricIndexes() .filter(m -> m.getTags().containsKey(DESCRIPTOR_TAG)) .onBackpressureBuffer(); PublishSubject<byte[]> byteSubject = PublishSubject.create(); Observable<byte[]> buffers = metricObservable.map(m -> { try { return objectWriter.writeValueAsBytes(m); } catch (JsonProcessingException e) { throw Exceptions.propagate(e); } }).onBackpressureBuffer(); buffers.subscribe(new Observer<byte[]>() { AtomicBoolean first = new AtomicBoolean(true); @Override public void onCompleted() { if(!first.get()) { byteSubject.onNext("]".getBytes(Charset.forName("UTF-8"))); } byteSubject.onCompleted(); } @Override public void onError(Throwable throwable) { } @Override public void onNext(byte[] bytes) { if(first.compareAndSet(true, false)) { byteSubject.onNext("[".getBytes(Charset.forName("UTF-8"))); byteSubject.onNext(bytes); } else { byteSubject.onNext(comma); byteSubject.onNext(bytes); } } }); ObservableServlet.write(byteSubject, resp.getOutputStream()) .subscribe(v -> {}, t -> { t.printStackTrace(); asyncContext.complete(); }, asyncContext::complete); }
Source:
<code>public void pruneQueryInfo() { Optional<QueryInfo> finalInfo = finalQueryInfo.get(); if (!finalInfo.isPresent() || !finalInfo.get().getOutputStage().isPresent()) { return; } QueryInfo queryInfo = finalInfo.get(); Optional<StageInfo> prunedOutputStage = queryInfo.getOutputStage().map(outputStage -> new StageInfo( outputStage.getStageId(), outputStage.getSelf(), Optional.empty(), <START> outputStage.getLatestAttemptExecutionInfo().isPresent() ? Optional.of(pruneStageExecutionInfo(outputStage.getLatestAttemptExecutionInfo().get())) : Optional.empty(), <END> ImmutableList.of(), ImmutableList.of())); QueryInfo prunedQueryInfo = new QueryInfo( queryInfo.getQueryId(), queryInfo.getSession(), queryInfo.getState(), getMemoryPool().getId(), queryInfo.isScheduled(), queryInfo.getSelf(), queryInfo.getFieldNames(), queryInfo.getQuery(), pruneQueryStats(queryInfo.getQueryStats()), queryInfo.getSetCatalog(), queryInfo.getSetSchema(), queryInfo.getSetSessionProperties(), queryInfo.getResetSessionProperties(), queryInfo.getSetRoles(), queryInfo.getAddedPreparedStatements(), queryInfo.getDeallocatedPreparedStatements(), queryInfo.getStartedTransactionId(), queryInfo.isClearTransactionId(), queryInfo.getUpdateType(), prunedOutputStage, queryInfo.getFailureInfo(), queryInfo.getErrorCode(), queryInfo.getWarnings(), queryInfo.getInputs(), queryInfo.getOutput(), queryInfo.isCompleteInfo(), queryInfo.getResourceGroupId(), queryInfo.getQueryType(), queryInfo.getFailedTasks()); finalQueryInfo.compareAndSet(finalInfo, Optional.of(prunedQueryInfo)); }</code><technical_language>nit: outputStage.getLatestAttemptExecutionInfo().map(QueryStateMachine:: pruneStageExecutionInfo)</technical_language>

Target:
public void pruneQueryInfo() { Optional<QueryInfo> finalInfo = finalQueryInfo.get(); if (!finalInfo.isPresent() || !finalInfo.get().getOutputStage().isPresent()) { return; } QueryInfo queryInfo = finalInfo.get(); Optional<StageInfo> prunedOutputStage = queryInfo.getOutputStage().map(outputStage -> new StageInfo( outputStage.getStageId(), outputStage.getSelf(), Optional.empty(), outputStage.getLatestAttemptExecutionInfo().map(QueryStateMachine::pruneStageExecutionInfo), ImmutableList.of(), ImmutableList.of())); QueryInfo prunedQueryInfo = new QueryInfo( queryInfo.getQueryId(), queryInfo.getSession(), queryInfo.getState(), getMemoryPool().getId(), queryInfo.isScheduled(), queryInfo.getSelf(), queryInfo.getFieldNames(), queryInfo.getQuery(), pruneQueryStats(queryInfo.getQueryStats()), queryInfo.getSetCatalog(), queryInfo.getSetSchema(), queryInfo.getSetSessionProperties(), queryInfo.getResetSessionProperties(), queryInfo.getSetRoles(), queryInfo.getAddedPreparedStatements(), queryInfo.getDeallocatedPreparedStatements(), queryInfo.getStartedTransactionId(), queryInfo.isClearTransactionId(), queryInfo.getUpdateType(), prunedOutputStage, queryInfo.getFailureInfo(), queryInfo.getErrorCode(), queryInfo.getWarnings(), queryInfo.getInputs(), queryInfo.getOutput(), queryInfo.isCompleteInfo(), queryInfo.getResourceGroupId(), queryInfo.getQueryType(), queryInfo.getFailedTasks()); finalQueryInfo.compareAndSet(finalInfo, Optional.of(prunedQueryInfo)); }
Source:
<code>public Bookmark(final VertexView vertex, final KnownMutation knownMutation, final long segmentPosition, final double scale) { super(RADIUS); <START> setLayoutX(vertex.getLayoutX() + (segmentPosition + 0.5) <END> * vertex.HORIZONTALSCALE * scale); setLayoutY(vertex.getLayoutY() + vertex.getHeight() / 2); setOpacity(OPACITY); setFill(STANDARD_COLOR); Tooltip tooltip = new Tooltip(knownMutation.toString()); Tooltip.install(this, tooltip); }</code><technical_language>magic number</technical_language>

Target:
public Bookmark(final VertexView vertex, final KnownMutation knownMutation, final long segmentPosition, final double scale) { super(RADIUS); setLayoutX(vertex.getLayoutX() + (segmentPosition + SEGMENT_CENTER) * vertex.HORIZONTALSCALE * scale); setLayoutY(vertex.getLayoutY() + vertex.getHeight() / 2); setOpacity(OPACITY); setFill(STANDARD_COLOR); Tooltip tooltip = new Tooltip(knownMutation.toString()); Tooltip.install(this, tooltip); }
Source:
<code>public void readData(ObjectDataInput in) throws IOException { name = in.readUTF(); type = IndexType.getById(in.readInt()); attributes = readNullableList(in); if (type == IndexType.BITMAP) { <START> bitmapIndexOptions = in.readObject(); <END> } }</code><technical_language>If do write options unconditionally, validate server-side. Consider a user submits IndexConfig{type=HASH, bitmapOptions=<not null object>}. This is invalid config, do real intention - create a hash index a bitmap index? I read/write object is, throw exception invalid config, ignoring invalid state silently</technical_language>

Target:
public void readData(ObjectDataInput in) throws IOException { name = in.readUTF(); type = IndexType.getById(in.readInt()); attributes = readNullableList(in); bitmapIndexOptions = in.readObject(); }
Source:
<code>public ImmutableSpongeSizeData(float base, float height, float scale) { super(ImmutableSizeData.class); <START> checkArgument(scale > 0, "The base size must be greater than 0."); <END> checkArgument(height > 0, "The height must be greater than 0."); checkArgument(scale > 0, "The scale must be greater than 0."); this.base = base; this.height = height; this.scale = scale; this.baseValue = SpongeValueFactory.boundedBuilder(Keys.BASE_SIZE) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.base) .build() .asImmutable(); this.heightValue = SpongeValueFactory.boundedBuilder(Keys.HEIGHT) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.height) .build() .asImmutable(); this.scaleValue = SpongeValueFactory.boundedBuilder(Keys.SCALE) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.scale) .build() .asImmutable(); registerGetters(); }</code><technical_language>base > 0</technical_language>

Target:
public ImmutableSpongeSizeData(float base, float height, float scale) { super(ImmutableSizeData.class); checkArgument(base > 0, "The base size must be greater than 0."); checkArgument(height > 0, "The height must be greater than 0."); checkArgument(scale > 0, "The scale must be greater than 0."); this.base = base; this.height = height; this.scale = scale; this.baseValue = SpongeValueFactory.boundedBuilder(Keys.BASE_SIZE) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.base) .build() .asImmutable(); this.heightValue = SpongeValueFactory.boundedBuilder(Keys.HEIGHT) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.height) .build() .asImmutable(); this.scaleValue = SpongeValueFactory.boundedBuilder(Keys.SCALE) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.scale) .build() .asImmutable(); registerGetters(); }
Source:
<code>public void flush() { Set<Identified> written = Sets.newHashSet(); for(ContentHierarchyAndBroadcast hierarchy : ImmutableList.copyOf(hierarchies.get()).reverse()) { Item item = hierarchy.getItem(); if (hierarchy.getBrand().isPresent()) { Brand brand = hierarchy.getBrand().get(); if (!written.contains(brand)) { writer.createOrUpdate(brand); written.add(brand); } item.setContainer(brand); } if (hierarchy.getSeries().isPresent()) { Series series = hierarchy.getSeries().get(); if (!written.contains(series)) { if (hierarchy.getBrand().isPresent()) { series.setParent(hierarchy.getBrand().get()); } writer.createOrUpdate(series); written.add(series); } if (!hierarchy.getBrand().isPresent()) { hierarchy.getItem().setContainer(series); } else { <START> if (hierarchy.getItem() instanceof Episode) { <END> ((Episode) item).setSeries(series); } } } if ( ! (hierarchy.getSeries().isPresent() ^ hierarchy.getBrand().isPresent())) { item = ensureItem(item); } if (!written.contains(hierarchy.getItem())) { writer.createOrUpdate(item); peopleWriter.createOrUpdatePeople(item); written.add(item); } } hierarchies.get().clear(); contentCache.get().clear(); }</code><technical_language>item instead of hierarchy.getItem()</technical_language>

Target:
public void flush() { Set<Identified> written = Sets.newHashSet(); for(ContentHierarchyAndBroadcast hierarchy : ImmutableList.copyOf(hierarchies.get()).reverse()) { Item item = hierarchy.getItem(); if (hierarchy.getBrand().isPresent()) { Brand brand = hierarchy.getBrand().get(); if (!written.contains(brand)) { writer.createOrUpdate(brand); written.add(brand); } item.setContainer(brand); } if (hierarchy.getSeries().isPresent()) { Series series = hierarchy.getSeries().get(); if (!written.contains(series)) { if (hierarchy.getBrand().isPresent()) { series.setParent(hierarchy.getBrand().get()); } writer.createOrUpdate(series); written.add(series); } if (!hierarchy.getBrand().isPresent()) { item.setContainer(series); } else { if (item instanceof Episode) { ((Episode) item).setSeries(series); } } } if ( ! (hierarchy.getSeries().isPresent() || hierarchy.getBrand().isPresent())) { item = ensureItem(item); item.setContainer(null); } if (!written.contains(item)) { writer.createOrUpdate(item); peopleWriter.createOrUpdatePeople(item); written.add(item); } } hierarchies.get().clear(); contentCache.get().clear(); }
Source:
<code><START> public static Pair<Float, Float> parsePosition(String line){ <END> Matcher matcher = SSA_POSITION_PATTERN.matcher(line); if(!matcher.find()){ return null; } float x = Float.parseFloat(matcher.group(1)); float y = Float.parseFloat(matcher.group(3)); return new Pair<>(x,y); }</code><technical_language>more sense android.graphics.PointF a general/ambiguous Pair<Float, Float> avoids auto-boxing</technical_language>

Target:
private static PointF parsePosition(String line) { Matcher matcher = SSA_POSITION_PATTERN.matcher(line); if (!matcher.find()) { return null; } float x = Float.parseFloat(matcher.group(1)); float y = Float.parseFloat(matcher.group(3)); return new PointF(x, y); }
Source:
<code>private void badSupervisors(Map<String, SupervisorDetails> supervisors) { Set<String> cachedSupervisorsKeySet = cachedSupervisors.keySet(); Set<String> supervisorsKeySet = supervisors.keySet(); Set<String> badSupervisorKeys = Sets.difference(cachedSupervisorsKeySet, supervisorsKeySet); HashMap<String, Set<Integer>> badSupervisors = new HashMap<>(); for (String key : badSupervisorKeys) { badSupervisors.put(key, cachedSupervisors.get(key)); } if (blacklistOnBadSlots) { for (Map.Entry<String, SupervisorDetails> entry : supervisors.entrySet()) { String key = entry.getKey(); SupervisorDetails supervisorDetails = entry.getValue(); if (cachedSupervisors.containsKey(key)) { Set<Integer> badSlots = badSlots(supervisorDetails, key); if (badSlots.size() > 0) { badSupervisors.put(key, badSlots); } } else { <START> cachedSupervisors.put(key, supervisorDetails.getAllPorts()); END> } } } badSupervisorsToleranceSlidingWindow.add(badSupervisors); }</code><technical_language>I this line execute matter if blacklistOnBadSlots is true false</technical_language>

Target:
private void badSupervisors(Map<String, SupervisorDetails> supervisors) { Set<String> cachedSupervisorsKeySet = cachedSupervisors.keySet(); Set<String> supervisorsKeySet = supervisors.keySet(); Set<String> badSupervisorKeys = Sets.difference(cachedSupervisorsKeySet, supervisorsKeySet); HashMap<String, Set<Integer>> badSupervisors = new HashMap<>(); for (String key : badSupervisorKeys) { badSupervisors.put(key, cachedSupervisors.get(key)); } for (Map.Entry<String, SupervisorDetails> entry : supervisors.entrySet()) { String key = entry.getKey(); SupervisorDetails supervisorDetails = entry.getValue(); if (cachedSupervisors.containsKey(key)) { if (blacklistOnBadSlots) { Set<Integer> badSlots = badSlots(supervisorDetails, key); if (badSlots.size() > 0) { badSupervisors.put(key, badSlots); } } } else { cachedSupervisors.put(key, supervisorDetails.getAllPorts()); } } badSupervisorsToleranceSlidingWindow.add(badSupervisors); }
Source:
<code>public Dialog onCreateDialog(Bundle savedInstanceState) { final AlertDialog alertDialog = new AlertDialog.Builder(getContext()) .setTitle(R.string.reset_dialog_title) .setMessage(R.string.confirm_dialog_message_help) .setPositiveButton(android.R.string.ok, null) .setNegativeButton(android.R.string.cancel, null) .create(); alertDialog.setCanceledOnTouchOutside(false); final ViewGroup layout = (ViewGroup) getActivity().getLayoutInflater() .inflate(R.layout.reset_dialog_email_input, null); textInputLayout = (TextInputLayout) layout.findViewById(R.id.input_layout); editText = (TextInputEditText) layout.findViewById(R.id.edit_text); loadingIndicator = layout.findViewById(R.id.loading_indicator); editText.setText(getArguments().getString(EXTRA_LOGIN_EMAIL)); <START> alertDialog.setView(layout); <END> return alertDialog; }</code><technical_language>This view set in builder instead of in built AlertDialog</technical_language>

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.reset_password_dialog, null, false); binding.emailEditText.setText(getArguments().getString(ARG_LOGIN_EMAIL)); final AlertDialog alertDialog = new AlertDialog.Builder(getContext()) .setTitle(R.string.confirm_dialog_title_help) .setMessage(R.string.confirm_dialog_message_help) .setPositiveButton(android.R.string.ok, null) .setNegativeButton(android.R.string.cancel, null) .setView(binding.getRoot()) .create(); alertDialog.setCanceledOnTouchOutside(false); return alertDialog; }
Source:
<code><START> private synchronized void discardMark() { <END> this.mark = -1; this.markLimit = 0; markBuffers = new ArrayList<>(); }</code><technical_language>This class is thread safe. synchronized is unnecessary I is misleading</technical_language>

Target:
private void discardMark() { this.mark = -1; this.markLimit = 0; markBuffers = new ArrayList<>(); }
Source:
<code>public Map<String, Construct> evaluate(BindableEvent e) throws EventException { if (e instanceof MCPlayerInteractAtEntityEvent) { MCPlayerInteractAtEntityEvent event = (MCPlayerInteractAtEntityEvent) e; Map<String, Construct> map = evaluate_helper(e); map.put("player", new CString(event.getPlayer().getName(), Target.UNKNOWN)); map.put("clicked", new CString(event.getEntity().getType().name(), Target.UNKNOWN)); map.put("id", new CInt(event.getEntity().getEntityId(),Target.UNKNOWN)); <START> map.put("position", ObjectGenerator.GetGenerator().vector(event.getClickedPosition(), Target.UNKNOWN)); <END> String data = ""; if(event.getEntity() instanceof MCPlayer) { data = ((MCPlayer)event.getEntity()).getName(); } map.put("data", new CString(data, Target.UNKNOWN)); return map; } else { throw new EventException("Cannot convert e to MCPlayerDropItemEvent"); } }</code><technical_language>recommend changing this location for convenience</technical_language>

Target:
public Map<String, Construct> evaluate(BindableEvent e) throws EventException { if (e instanceof MCPlayerInteractAtEntityEvent) { MCPlayerInteractAtEntityEvent event = (MCPlayerInteractAtEntityEvent) e; Map<String, Construct> map = evaluate_helper(e); map.put("player", new CString(event.getPlayer().getName(), Target.UNKNOWN)); map.put("clicked", new CString(event.getEntity().getType().name(), Target.UNKNOWN)); map.put("id", new CInt(event.getEntity().getEntityId(),Target.UNKNOWN)); map.put("position", ObjectGenerator.GetGenerator().vector(event.getClickedPosition(), Target.UNKNOWN)); String data = ""; if(event.getEntity() instanceof MCPlayer) { data = ((MCPlayer)event.getEntity()).getName(); } map.put("data", new CString(data, Target.UNKNOWN)); return map; } else { throw new EventException("Cannot convert e to MCPlayerInteractAtEntityEvent"); } }
Source:
<code><START> public PermissionManager getPermissionManager() { <END> return permissionManager.get(); }</code><technical_language>is designed for user get PermissionManager? this API constructor? is confusing if close() called return of this API</technical_language>

Target:
public PermissionManager getPermissionManager() { return PermissionManager.getInstance(this); }
Source:
<code>public Message<?> preSend(Message<?> message, MessageChannel channel) { if (this.traceManager.isTracing() || message.getHeaders().containsKey(Trace.NOT_SAMPLED_NAME)) { return SpanMessageHeaders.addSpanHeaders(message, this.traceManager.getCurrentSpan()); } String spanId = getHeader(message, Trace.SPAN_ID_NAME); String traceId = getHeader(message, Trace.TRACE_ID_NAME); String name = "message/" + getChannelName(channel); Trace trace; if (hasText(spanId) && hasText(traceId)) { MilliSpanBuilder span = MilliSpan.builder().traceId(traceId).spanId(spanId); String parentId = getHeader(message, Trace.PARENT_ID_NAME); String processId = getHeader(message, Trace.PROCESS_ID_NAME); String spanName = getHeader(message, Trace.SPAN_NAME_NAME); if (spanName != null) { <START> span.name(spanName); <END> } if (processId != null) { span.processId(processId); } if (parentId != null) { span.parent(parentId); } span.remote(true); trace = this.traceManager.startSpan(name, span.build()); } else { trace = this.traceManager.startSpan(name); } this.traceManagerScopeHolder.set(trace); return StompMessageBuilderHelper.fromMessage(message).setHeadersFromSpan(trace.getSpan()).build(); }</code><technical_language>intent of defensive programming here. expecting a call span.name(null) throw? (I lombok behaves, does)</technical_language>

Target:
public Message<?> preSend(Message<?> message, MessageChannel channel) { final TraceManager traceManager = this.traceManager; if (traceManager.isTracing() || message.getHeaders().containsKey(Trace.NOT_SAMPLED_NAME)) { return StompMessageBuilder.fromMessage(message).setHeadersFromSpan(traceManager.getCurrentSpan()).build(); } String spanId = getHeader(message, Trace.SPAN_ID_NAME); String traceId = getHeader(message, Trace.TRACE_ID_NAME); String name = "message/" + getChannelName(channel); Trace trace; if (hasText(spanId) && hasText(traceId)) { MilliSpanBuilder span = MilliSpan.builder().traceId(traceId).spanId(spanId); String parentId = getHeader(message, Trace.PARENT_ID_NAME); String processId = getHeader(message, Trace.PROCESS_ID_NAME); String spanName = getHeader(message, Trace.SPAN_NAME_NAME); if (spanName != null) { span.name(spanName); } if (processId != null) { span.processId(processId); } if (parentId != null) { span.parent(parentId); } span.remote(true); trace = traceManager.startSpan(name, span.build()); } else { trace = traceManager.startSpan(name); } this.traceScopeHolder.set(trace); return StompMessageBuilder.fromMessage(message).setHeadersFromSpan(trace.getSpan()).build(); }
Source:
<code>private boolean fetchRemoteBranch(SubMonitor subMonitor) { subMonitor.setTaskName(Messages.AutoRebaseProcess_FetchingRemoteBranch); <START> List<RefSpec> branchSpecs = new ArrayList<>(1); <END> if (baseChange == null) { Ref refBranch = null; try { refBranch = localRepo.findRef(revisionInfo.getChangeInfo().getBranch()); } catch (IOException e2) { EGerritCorePlugin.logError(e2.getMessage()); return false; } RefSpec refSpecBranch = new RefSpec().setSource(refBranch.getName()).setDestination(Constants.FETCH_HEAD); branchSpecs.add(refSpecBranch); } else { baseChange.getRevision(); branchSpecs.add( new RefSpec().setSource(baseChange.getRevision().getRef()).setDestination(Constants.FETCH_HEAD)); } FetchResult fetchResBranch = null; try { URIish uri = getRemoteURI(); if (uri != null) { fetchResBranch = new FetchOperationUI(localRepo, uri, branchSpecs, 0, false).execute(subMonitor); } else { return false; } } catch (CoreException e) { EGerritCorePlugin.logError(e.getMessage()); } if (fetchResBranch == null) { return false; } else { return true; } }</code><technical_language>simplify this code setting baseChange? baseChange is (the case user enter in rebase dialog) set changeInfo underlying revisionInfo object. this, I code path</technical_language>

Target:
private boolean fetchRemoteBranch(SubMonitor subMonitor) { subMonitor.setTaskName(Messages.AutoRebaseProcess_FetchingRemoteBranch); List<RefSpec> branchSpecs = new ArrayList<>(1); RefSpec refSpecBranch; if (baseChange == null) { refSpecBranch = new RefSpec().setSource("refs/heads/" + revisionInfo.getChangeInfo().getBranch()) .setDestination(Constants.FETCH_HEAD); } else { refSpecBranch = new RefSpec().setSource(baseChange.getRevision().getRef()) .setDestination(Constants.FETCH_HEAD); } branchSpecs.add(refSpecBranch); FetchResult fetchResBranch = null; try { URIish uri = getRemoteURI(); if (uri != null) { fetchResBranch = new FetchOperationUI(localRepo, uri, branchSpecs, 0, false).execute(subMonitor); } else { return false; } } catch (CoreException e) { EGerritCorePlugin.logError(e.getMessage()); } if (fetchResBranch == null) { return false; } else { return true; } }
Source:
<code>Object[][] testIntervalListData() { return new Object[][]{ <START> new Object[]{new File("testdata/picard/sam/aligned.sam"), null}, <END> new Object[]{new File("testdata/picard/sam/aligned.sam"), new File("testdata/picard/analysis/directed/CollectHsMetrics/chrM.interval_list")}, new Object[]{new File("testdata/picard/sam/aligned.sam"), new File("testdata/picard/sam/contiguous.interval_list")} }; }</code><technical_language>I guess this test cases intervals only</technical_language>

Target:
Object[][] testIntervalListData() { return new Object[][]{ new Object[]{TEST_DIR.resolve("aligned.sam").toFile(), null, OA_TEST_DIR.resolve("aligned_no_intervals.sam").toFile()}, new Object[]{TEST_DIR.resolve("aligned.sam").toFile(), new File("testdata/picard/analysis/directed/CollectHsMetrics/chrM.interval_list"), TEST_DIR.resolve("aligned.sam").toFile()}, new Object[]{TEST_DIR.resolve("aligned.sam").toFile(), TEST_DIR.resolve("contiguous.interval_list").toFile(), OA_TEST_DIR.resolve("aligned_with_intervals.sam").toFile()} }; }
Source:
<code>public static String format(String inField) { Objects.requireNonNull(inField); try { <START> return parse(inField); <END> } catch (IllegalArgumentException ignored) { return Normalizer.normalize(inField, Normalizer.Form.NFC); } }</code><technical_language>suggestion return parse(inField).orElse(Normalizer.normalize(inField, Normalizer.Form.NFC)); work get rid of try catch block</technical_language>

Target:
public static String format(String inField) { Objects.requireNonNull(inField); return parse(inField).orElse(Normalizer.normalize(inField, Normalizer.Form.NFC)); }
Source:
<code>public void endStateTransfer(String sendingSite) { if (debug) { log.debugf("Ending state transfer from %s", sendingSite); } String currentSendingSite = this.sendingSite.get(); if (sendingSite == null || sendingSite.equals(currentSendingSite)) { this.sendingSite.set(null); <START> commitManager.stopTrack(PUT_FOR_X_SITE_STATE_TRANSFER); <END> } }</code><technical_language>Else log a warning</technical_language>

Target:
public void endStateTransfer(String sendingSite) { if (debug) { log.debugf("Ending state transfer from %s", sendingSite); } String currentSendingSite = this.sendingSite.get(); if (sendingSite == null || sendingSite.equals(currentSendingSite)) { this.sendingSite.set(null); commitManager.stopTrack(PUT_FOR_X_SITE_STATE_TRANSFER); } else { if (log.isDebugEnabled()) { log.debugf("Received an end request from a non-sender site. Expects %s but got %s", currentSendingSite, sendingSite); } } }
Source:
<code>public void decorate(Object element, IDecoration decoration) { IScript iScript = (IScript) element; ScriptType scriptType = iScript.getType(); <START> String filePath = iScript.getLocation().substring(12); <END> if (scriptType != null) { try { VerifySignature verifySignature = VerifySignature.getInstance(scriptType, iScript.getInputStream(), new FileInputStream(ISignatureHelperConstants.PATH_TO_SIGNATURES + "/" + filePath)); boolean signState; if (verifySignature != null) { signState = verifySignature.verify(); if (signState) decoration.addOverlay(OVERLAY1); else decoration.addOverlay(OVERLAY2); } } catch (FileNotFoundException e) { Logger.error(Activator.PLUGIN_ID, filePath + " Signature File Not found"); } catch (IllegalStateException e) { Logger.error(Activator.PLUGIN_ID, e.getMessage(), e); } catch (ScriptSignatureException e) { Logger.error(Activator.PLUGIN_ID, e.getMessage(), e); } } }</code><technical_language>works for workspace:// style locations. file://, http://, plugin://, ...</technical_language>

Target:
public void decorate(Object element, IDecoration decoration) { IScript iScript = (IScript) element; ScriptType scriptType = iScript.getType(); if (scriptType != null) { try { VerifySignature verifySignature = VerifySignature.getInstance(scriptType, iScript.getInputStream()); if (verifySignature != null) decoration.addOverlay(verifySignature.verify() ? OVERLAY1 : OVERLAY2); } catch (Exception e) { Logger.error(Activator.PLUGIN_ID, e.getMessage(), e); } } }
Source:
<code>public ValueNode replaceIndexExpression(ResultColumnList childRCL) throws StandardException { if (childRCL == null) { return this; } <START> if (receiver != null) { <END> receiver = receiver.replaceIndexExpression(childRCL); } if (leftOperand != null) { leftOperand = leftOperand.replaceIndexExpression(childRCL); } if (rightOperand != null) { rightOperand = rightOperand.replaceIndexExpression(childRCL); } return this; }</code><technical_language>is need check receiver. is left operand right operand code generation phase</technical_language>

Target:
public ValueNode replaceIndexExpression(ResultColumnList childRCL) throws StandardException { if (childRCL == null) { return this; } if (leftOperand != null) { leftOperand = leftOperand.replaceIndexExpression(childRCL); } if (rightOperand != null) { rightOperand = rightOperand.replaceIndexExpression(childRCL); } return this; }
Source:
<code>public boolean isLocalOnly() { <START> switch (this) { <END> case LOCAL: return true; default: return false; } }</code><technical_language>simpler return this == LOCAL</technical_language>

Target:
public boolean isLocalOnly() { return this == LOCAL; }
Source:
<code>public void handleMilliSecondsSpentInputChange( ChangeEvent event ) { try { Long value = millisecondsSpentInput.getValue().isEmpty() ? null : Long.parseLong( millisecondsSpentInput.getValue() ); presenter.onMillisecondsSpentChange( value ); } catch ( NumberFormatException e ) { <START> <END> } }</code><technical_language>Likewise.</technical_language>

Target:
public void handleMilliSecondsSpentInputChange( ChangeEvent event ) { boolean isNumeric = millisecondsSpentInput.getValue().matches( "\\d+" ); if (isNumeric) { presenter.onMillisecondsSpentChange( Long.parseLong( millisecondsSpentInput.getValue() ) ); } else { presenter.onMillisecondsSpentChange( 0l ); millisecondsSpentInput.setValue( "0" ); } }
Source:
<code>public void configure(Config config) throws Exception { super.configure(config); <START> if (!(productIndex instanceof ExtentIndex)) { <END> throw new ConfigurationException("[" + getName() + "] index must be of type ExtentIndex. Given type " + productIndex.getClass().getName()); } }</code><technical_language>getProductIndex method, in case subclasses need override</technical_language>

Target:
public void configure(Config config) throws Exception { super.configure(config); if (!(this.getProductIndex() instanceof ExtentIndex)) { throw new ConfigurationException("[" + getName() + "] index must be of type ExtentIndex. Given type " + productIndex.getClass().getName()); } }
Source:
<code>protected void actionPerformed(GuiButton button) throws IOException { if(button.id == 0) { if(PAGE < PAGE_MAX) PAGE++; <START> } <END> if(button.id == 1) { if(PAGE > 1) PAGE--; } }</code><technical_language>this drawing replaced 9 draw calls only: 4 for edges, 4 for sides (stretch texture horizontally vertically depending side) 1 for center (stretch in directions) However, texture stretched, obviously. matter in this case variation (such noise) in it</technical_language>

Target:
protected void actionPerformed(GuiButton button) throws IOException { if (button.id == 0) { if (page < pageMax) { page++; } this.nextPageBtn.enabled = page != pageMax; this.prevPageBtn.enabled = page != 1; sliderProgress = 0.0F; updateSlider(); text = splitLines(StringUtils.translate("book.quickstart." + page), fontRenderer, maxLength); } if (button.id == 1) { if (page > 1) { page--; } this.nextPageBtn.enabled = page != pageMax; this.prevPageBtn.enabled = page != 1; sliderProgress = 0.0F; updateSlider(); text = splitLines(StringUtils.translate("book.quickstart." + page), fontRenderer, maxLength); } }
Source:
<code>private static int getIntegerPort(String stringPort) { if(StringUtils.isBlank(stringPort) || stringPort.length() > 5) { return -1; } int value = 0; <START> for (int i = 0; i < stringPort.length(); i++) { <END> char c = stringPort.charAt(i); if(c < '0' || c > '9') { return -1; } value = 10 * value + ((int)c) - ((int)'0'); } return (value > 65535) ? -1 : value; }</code><technical_language>Wouldnt easier utilize StringUtils#isNumeric in conjuctions Integer.parse</technical_language>

Target:
private static int getIntegerPort(String stringPort) { if(StringUtils.isBlank(stringPort) || stringPort.length() > 5 || !StringUtils.isNumeric(stringPort)) { return -1; } int value = Integer.parseInt(stringPort); return (value > 65535) ? -1 : value; }
Source:
<code>public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, DSpaceRestPermission permission) { <START> if (!StringUtils.equals("CLAIMEDTASK", targetType)) { <END> return false; } Request request = requestService.getCurrentRequest(); Context context = ContextUtil.obtainContext(request.getServletRequest()); EPerson ePerson = null; try { ePerson = ePersonService.findByEmail(context, (String) authentication.getPrincipal()); if (ePerson == null) { return false; } Integer dsoId = Integer.parseInt(targetId.toString()); ClaimedTask claimedTask = claimedTaskService.find(context, dsoId); if (claimedTask == null) { return true; } if (claimedTask != null && ePerson.equals(claimedTask.getOwner())) { return true; } } catch (SQLException e) { log.error(e.getMessage(), e); } return false; }</code><technical_language>I hardcoding type again, instead IndexableClaimedTask.TYPE similar</technical_language>

Target:
public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, DSpaceRestPermission permission) { if (!StringUtils.equalsIgnoreCase(ClaimedTaskRest.NAME, targetType)) { return false; } Request request = requestService.getCurrentRequest(); Context context = ContextUtil.obtainContext(request.getServletRequest()); EPerson ePerson = null; try { ePerson = ePersonService.findByEmail(context, (String) authentication.getPrincipal()); if (ePerson == null) { return false; } Integer dsoId = Integer.parseInt(targetId.toString()); ClaimedTask claimedTask = claimedTaskService.find(context, dsoId); if (claimedTask == null) { return true; } if (claimedTask != null && ePerson.equals(claimedTask.getOwner())) { return true; } } catch (SQLException e) { log.error(e.getMessage(), e); } return false; }
Source:
<code>protected void initButton(final Button button) { button.setToolTipText("Abandon Merge Branch"); button.setImage(ImageManager.getImage(FrameworkImage.DOT_GREEN)); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { refreshEnablement(button); boolean hasMergeBranch = BranchManager.hasMergeBranches(getTeamArt().getWorkingBranch()); if (hasMergeBranch) { List<MergeBranch> br = BranchManager.getMergeBranches(getTeamArt().getWorkingBranch()); if (br.size() > 1) { <START> AWorkbench.popup( <END> "The Working Branch: " + getTeamArt().getWorkingBranch() + " has more than 1 merge conflict. Manually open the merge manager to cancel merge"); } else { BranchManager.purgeBranch(br.get(0)); } button.setText(""); button.getParent().layout(); refreshEnablement(button); } } }); }</code><technical_language>wording. pull out a public static in places</technical_language>

Target:
protected void initButton(final Button button) { button.setToolTipText("Abandon Merge Branch"); button.setImage(ImageManager.getImage(FrameworkImage.ABORT_MERGE)); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { refreshEnablement(button); boolean hasMergeBranch = BranchManager.hasMergeBranches(getTeamArt().getWorkingBranch()); if (hasMergeBranch) { List<MergeBranch> br = BranchManager.getMergeBranches(getTeamArt().getWorkingBranch()); if (br.size() > 1) { AWorkbench.popup( "The Working Branch: " + getTeamArt().getWorkingBranch() + " has more than 1 merge conflict. Manually open the merge manager to cancel merge"); } else { BranchManager.purgeBranch(br.get(0)); } button.setText(""); button.getParent().layout(); refreshEnablement(button); } } }); }
Source:
<code>int decompressDirect(ByteBuffer src, ByteBuffer dst) throws IOException { assert (this instanceof SnappyDirectDecompressor); <START> <END> ByteBuffer presliced = dst; if (dst.position() > 0) { presliced = dst; dst = dst.slice(); } Buffer originalCompressed = compressedDirectBuf; Buffer originalUncompressed = uncompressedDirectBuf; int originalBufferSize = directBufferSize; compressedDirectBuf = src.slice(); compressedDirectBufLen = src.remaining(); uncompressedDirectBuf = dst; directBufferSize = dst.remaining(); int n = 0; try { n = decompressBytesDirect(); presliced.position(presliced.position() + n); src.position(src.limit()); finished = true; } finally { compressedDirectBuf = originalCompressed; uncompressedDirectBuf = originalUncompressed; compressedDirectBufLen = 0; directBufferSize = originalBufferSize; } return n; }</code><technical_language>please stop IDE removing trailing whitespace lines edited; complicates life</technical_language>

Target:
int decompressDirect(ByteBuffer src, ByteBuffer dst) throws IOException { assert (this instanceof SnappyDirectDecompressor); ByteBuffer presliced = dst; if (dst.position() > 0) { presliced = dst; dst = dst.slice(); } Buffer originalCompressed = compressedDirectBuf; Buffer originalUncompressed = uncompressedDirectBuf; int originalBufferSize = directBufferSize; compressedDirectBuf = src.slice(); compressedDirectBufLen = src.remaining(); uncompressedDirectBuf = dst; directBufferSize = dst.remaining(); int n = 0; try { n = decompressDirectBuf(); presliced.position(presliced.position() + n); src.position(src.limit()); finished = true; } finally { compressedDirectBuf = originalCompressed; uncompressedDirectBuf = originalUncompressed; compressedDirectBufLen = 0; directBufferSize = originalBufferSize; } return n; }
Source:
<code>protected CompositeJsonFormatter<ILoggingEvent> createFormatter() { LogstashFormatter formatter = new LogstashFormatter(this); <START> formatter.setLineSeparator(getLineSeparator()); <END> return formatter; }</code><technical_language>Hmm. Encoder's lineSeparator property is string output events. Coupling separator output events regex split message string ideal. I regex split message string separate separator string events</technical_language>

Target:
protected CompositeJsonFormatter<ILoggingEvent> createFormatter() { return new LogstashFormatter(this); }
Source:
<code>protected String getTableName(String streamName) { StringBuilder sb = new StringBuilder(); sb.append(TABLE_PREFIX); <START> sb.append("_"); <END> sb.append(streamName); return sb.toString(); }</code><technical_language>"_" a constant</technical_language>

Target:
protected String getTableName(String streamName) { StringBuilder sb = new StringBuilder(); sb.append(TABLE_PREFIX); sb.append(TABLE_NAME_SEPARATOR); sb.append(streamName); return sb.toString(); }
Source:
<code>public void shouldNotConvertBeforeGetOnFailedCompletion() throws Exception { final Throwable expectedError = new Throwable(); TestConvertingFutureCallback testCallback = new TestConvertingFutureCallback(); testCallback.onCompletion(expectedError, null); assertEquals(0, testCallback.numberOfConversions()); try { <START> testCallback.get(); <END> } catch (ExecutionException e) { assertEquals(expectedError, e.getCause()); } }</code><technical_language>fail() if exception</technical_language>

Target:
public void shouldNotConvertBeforeGetOnFailedCompletion() throws Exception { final Throwable expectedError = new Throwable(); TestConvertingFutureCallback testCallback = new TestConvertingFutureCallback(); testCallback.onCompletion(expectedError, null); assertEquals(0, testCallback.numberOfConversions()); try { testCallback.get(); fail("Expected ExecutionException"); } catch (ExecutionException e) { assertEquals(expectedError, e.getCause()); } }
Source:
<code>private boolean rollbackOtherTransaction(long startTs, TransactionService transactionService) { try { transactionService.putUnlessExists(startTs, TransactionConstants.FAILED_COMMIT_TS); return true; } catch (KeyAlreadyExistsException e) { <START> log.error("This isn't a bug but it should be very infrequent. Two transactions tried to roll back someone" <END> + " else's request with start: {}", SafeArg.of("startTs", startTs), new TransactionFailedRetriableException( "Two transactions tried to roll back someone else's request with start: " + startTs, e)); return false; } }</code><technical_language>error. warn log tracking in places now, pick if this frequent</technical_language>

Target:
private boolean rollbackOtherTransaction(long startTs, TransactionService transactionService) { try { transactionService.putUnlessExists(startTs, TransactionConstants.FAILED_COMMIT_TS); return true; } catch (KeyAlreadyExistsException e) { log.info("This isn't a bug but it should be very infrequent. Two transactions tried to roll back someone" + " else's request with start: {}", SafeArg.of("startTs", startTs), new TransactionFailedRetriableException( "Two transactions tried to roll back someone else's request with start: " + startTs, e)); return false; } }
Source:
<code>protected void executeQueryCommand() { final Map<Integer, VmIconIdSizePair> result = new HashMap<>(); final List<VmIconDefault> iconDefaults = vmIconDefaultDao.getAll(); for (VmIconDefault iconDefault : iconDefaults) { result.put(iconDefault.getOsId(), new VmIconIdSizePair(iconDefault.getSmallIconId(), iconDefault.getLargeIconId())); } if (!result.containsKey(OsRepository.DEFAULT_X86_OS)) { <START> throw new RuntimeException("Default icon pair not found."); <END> } setReturnValue(result); }</code><technical_language>please engine exception</technical_language>

Target:
protected void executeQueryCommand() { final Map<Integer, VmIconIdSizePair> result = new HashMap<>(); final List<VmIconDefault> iconDefaults = vmIconDefaultDao.getAll(); for (VmIconDefault iconDefault : iconDefaults) { result.put(iconDefault.getOsId(), new VmIconIdSizePair(iconDefault.getSmallIconId(), iconDefault.getLargeIconId())); } if (!result.containsKey(OsRepository.DEFAULT_X86_OS)) { throw new EngineException(EngineError.DefaultIconPairNotFound); } setReturnValue(result); }
Source:
<code>public void returns_project_visibility_public() { OrganizationDto organization = dbTester.organizations().insert(); <START> dbClient.organizationDao().setNewProjectPrivate(dbTester.getSession(), organization, false); <END> dbTester.commit(); userSession.logIn().addPermission(PROVISION_PROJECTS, organization); assertJson(executeRequest(organization).getInput()).isSimilarTo("{\"organization\": {\"projectVisibility\": \"public\"}}"); }</code><technical_language>replacing lines 221 222 a method in OrganizationDbTester</technical_language>

Target:
public void returns_project_visibility_public() { OrganizationDto organization = dbTester.organizations().insert(); dbTester.organizations().setNewProjectPrivate(organization, false); userSession.logIn().addPermission(PROVISION_PROJECTS, organization); assertJson(executeRequest(organization).getInput()).isSimilarTo("{\"organization\": {\"projectVisibility\": \"public\"}}"); }
Source:
<code>public LeaderElectionHealthStatus leaderElectionRateHealthStatus() { <START> return leaderElectionServiceMetrics.proposedLeadership().getFiveMinuteRate() < MAX_ALLOWED_LAST_5_MINUTE_RATE <END> ? LeaderElectionHealthStatus.HEALTHY : LeaderElectionHealthStatus.UNHEALTHY; }</code><technical_language>nit: name of constant implies <=</technical_language>

Target:
public LeaderElectionHealthStatus leaderElectionRateHealthStatus() { return leaderElectionServiceMetrics.proposedLeadership().getFiveMinuteRate() <= MAX_ALLOWED_LAST_5_MINUTE_RATE ? LeaderElectionHealthStatus.HEALTHY : LeaderElectionHealthStatus.UNHEALTHY; }
Source:
<code>public void onAddToPlaylistClicked(View v) { final PlaylistType.Item playListItem = new PlaylistType.Item(); playListItem.artistid = artistId; <START> MediaPlayerUtils.queueAudio(this, playListItem); <END> }</code><technical_language>Breaks build. changed signature of this method in PR, this reflect that</technical_language>

Target:
public void onAddToPlaylistClicked(View v) { final PlaylistType.Item playListItem = new PlaylistType.Item(); playListItem.artistid = artistId; MediaPlayerUtils.queue(this, playListItem, PlaylistType.GetPlaylistsReturnType.AUDIO); }
Source:
<code>public String getHashString(RowMap r, PartitionBy by) { if ( by == null ) <START> return UUID.randomUUID().toString(); <END> switch ( by ) { case TABLE: String t = r.getTable(); if ( t == null && partitionByFallback == PartitionBy.DATABASE ) return r.getDatabase(); else return t; case DATABASE: return r.getDatabase(); case PRIMARY_KEY: return r.pkAsConcatString(); case COLUMN: String s = r.buildPartitionKey(partitionColumns); if ( s.length() > 0 ) return s; else return getHashString(r, partitionByFallback); } return null; }</code><technical_language>Is this new behaviour? database default</technical_language>

Target:
public String getHashString(RowMap r, PartitionBy by) { switch ( by ) { case TABLE: String t = r.getTable(); if ( t == null && partitionByFallback == PartitionBy.DATABASE ) return r.getDatabase(); else return t; case DATABASE: return r.getDatabase(); case PRIMARY_KEY: return r.pkAsConcatString(); case COLUMN: String s = r.buildPartitionKey(partitionColumns); if ( s.length() > 0 ) return s; else return getHashString(r, partitionByFallback); } return null; }
Source:
<code><START> public final long argSize() { <END> long size = 0; if (arg2 != null) { size += arg2.readableBytes(); } if (arg3 != null) { size += arg3.readableBytes(); } return size; }</code><technical_language>need long type. int fit size</technical_language>

Target:
public final int argSize() { int size = 0; if (arg2 != null) { size += arg2.readableBytes(); } if (arg3 != null) { size += arg3.readableBytes(); } return size; }
Source:
<code>private IZenSymbol find(IEnvironmentGlobal environment, List<Token> tokens, int startIndex, int endIndex) { StringBuilder valueBuilder = new StringBuilder(); for (int i = startIndex; i < endIndex; i++) { Token token = tokens.get(i); valueBuilder.append(token.getValue()); } IMaterial material = getMaterial(valueBuilder.toString()); if (!material.getName().equals("unknown")) { MineTweakerAPI.logInfo("Material wasn't null"); return new MaterialReferenceSymbol(environment, valueBuilder.toString()); } <START> MineTweakerAPI.logInfo("Material was null"); <END> return null; }</code><technical_language>This a logError</technical_language>

Target:
private IZenSymbol find(IEnvironmentGlobal environment, List<Token> tokens, int startIndex, int endIndex) { StringBuilder valueBuilder = new StringBuilder(); for (int i = startIndex; i < endIndex; i++) { Token token = tokens.get(i); valueBuilder.append(token.getValue()); } IMaterial material = getMaterial(valueBuilder.toString()); if (!material.getName().equals("unknown")) { MineTweakerAPI.logInfo("Material wasn't null"); return new MaterialReferenceSymbol(environment, valueBuilder.toString()); } MineTweakerAPI.logError("Material was null"); return null; }
Source:
<code>public String getName() { <START> return "ListBox"; <END> }</code><technical_language>constant suitable there</technical_language>

Target:
public String getName() { return ListBoxFieldType.NAME; }