auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public GlowItemFrame(GlowPlayer player, Location location, BlockFace clickedface) { super(location); this.face = clickedface; if (player != null) { if (player.getGameMode() != GameMode.CREATIVE) { ItemStack is = player.getItemInHand(); int amount = is.getAmount(); is.setAmount(amount - 1); if (is.getAmount() <= 0) { is = null; } player.setItemInHand(is); } <START> metadata.set(MetadataIndex.ITEM_FRAME_ROTATION, 0); <END> metadata.set(MetadataIndex.ITEM_FRAME_ITEM, new ItemStack(Material.AIR)); metadata.set(MetadataIndex.AIR_TIME, 300); itemInFrame = Material.AIR; } }</code><technical_language>dependent a player</technical_language>

Target:
public GlowItemFrame(GlowPlayer player, Location location, BlockFace clickedface) { super(location); this.face = clickedface; if (player != null) { if (player.getGameMode() != GameMode.CREATIVE) { ItemStack is = player.getItemInHand(); int amount = is.getAmount(); is.setAmount(amount - 1); if (is.getAmount() <= 0) { is = null; } player.setItemInHand(is); } } metadata.set(MetadataIndex.ITEM_FRAME_ROTATION, 0); metadata.set(MetadataIndex.ITEM_FRAME_ITEM, new ItemStack(Material.AIR)); itemInFrame = Material.AIR; }
Source:
<code>protected void updateEvent(final IssueEvent event) { TypefaceUtils.setOcticons(textView(0)); String message = String.format("<b>%s</b> %s", event.getActor().getLogin(), event.getEvent()); avatars.bind(imageView(2), event.getActor()); String eventString = event.getEvent(); switch (eventString) { case "closed": message += " this "; setText(0, ICON_ISSUE_CLOSE); <START> textView(0).setTextColor(Color.rgb(189,44,0)); <END> break; case "reopened": message += " this "; setText(0, ICON_ISSUE_REOPEN); textView(0).setTextColor(Color.rgb(108,198,68)); break; case "merged": message += String.format(" commit <b>%s</b> into <tt>%s</tt> from <tt>%s</tt> ", event.getCommitId().substring(0,6), issue.getPullRequest().getBase().getRef(), issue.getPullRequest().getHead().getRef()); setText(0, "\uf023"); textView(0).setTextColor(Color.rgb(110,84,148)); break; } message += TimeUtils.getRelativeTime(event.getCreatedAt()); setText(1, Html.fromHtml(message)); }</code><technical_language>I think, define color values in xml instead</technical_language>

Target:
protected void updateEvent(final IssueEvent event) { TypefaceUtils.setOcticons(textView(0)); String message = String.format("<b>%s</b> %s", event.getActor().getLogin(), event.getEvent()); avatars.bind(imageView(2), event.getActor()); String eventString = event.getEvent(); switch (eventString) { case "closed": message += " this "; setText(0, ICON_ISSUE_CLOSE); textView(0).setTextColor(context.getResources().getColor(R.color.issue_event_closed)); break; case "reopened": message += " this "; setText(0, ICON_ISSUE_REOPEN); textView(0).setTextColor(context.getResources().getColor(R.color.issue_event_reopened)); break; case "merged": message += String.format(" commit <b>%s</b> into <tt>%s</tt> from <tt>%s</tt> ", event.getCommitId().substring(0,6), issue.getPullRequest().getBase().getRef(), issue.getPullRequest().getHead().getRef()); setText(0, "\uf023"); textView(0).setTextColor(context.getResources().getColor(R.color.issue_event_merged)); break; } message += TimeUtils.getRelativeTime(event.getCreatedAt()); setText(1, Html.fromHtml(message)); }
Source:
<code>public Optional<PlanNode> apply(PlanNode node, Context context) { FilterNode filterNode = (FilterNode) node; Expression rewritten = rewriter.rewrite(filterNode.getPredicate(), context); if (filterNode.getPredicate().equals(rewritten)) { return Optional.empty(); } <START> else { <END> return Optional.of(new FilterNode(node.getId(), filterNode.getSource(), rewritten)); } }</code><technical_language>needed else block. in other rewrites well</technical_language>

Target:
public Optional<PlanNode> apply(PlanNode node, Context context) { FilterNode filterNode = (FilterNode) node; Expression rewritten = rewriter.rewrite(filterNode.getPredicate(), context); if (filterNode.getPredicate().equals(rewritten)) { return Optional.empty(); } return Optional.of(new FilterNode(node.getId(), filterNode.getSource(), rewritten)); }
Source:
<code>public String getKeyName() { if (!isEncrypt) { return this.requestKey; } int keyVersion = getVersion(this.requestKey); if (keyVersion == 0) { return this.requestKey; } String keyPrefix = getKeyPrefix(this.requestKey); <START> return this.availableKeys.stringPropertyNames().stream().filter(e -> e.startsWith(keyPrefix)) <END> .max(Comparator.comparing(e -> getVersion(e))).get(); }</code><technical_language>For encryption, requestKey is "system.encryption.key.v" right? In case, do this filter creating Properties object, store highest name of highest "v" key. time call this method for encryption perform stream</technical_language>

Target:
public String getKeyName() { return this.keyName; }
Source:
<code>public void sendKeys(String s, boolean enterAfter) { pressTime = System.currentTimeMillis(); for (char c : s.toCharArray()) { for (KeyEvent ke : createKeyClick(component, c)) { try { Thread.sleep(5); } catch (InterruptedException e) { e.printStackTrace(); } sendKeyEvent(ke); } } if (enterAfter) { <START> clickKey(10); <END> } }</code><technical_language>constant instead</technical_language>

Target:
public void sendKeys(String s, boolean enterAfter) { pressTime = System.currentTimeMillis(); for (char c : s.toCharArray()) { for (KeyEvent ke : createKeyClick(component, c)) { try { Thread.sleep(5); } catch (InterruptedException e) { e.printStackTrace(); } sendKeyEvent(ke); } } if (enterAfter) { clickKey(KeyEvent.VK_ENTER); } }
Source:
<code>private boolean <START> switchTopControl() <END> { Control oldTop = layout.topControl; IProject[] projs = ResourcesPlugin.getWorkspace().getRoot().getProjects(); if (projs.length > 0) { layout.topControl = control; } else { layout.topControl = emptyArea; } return oldTop != layout.topControl; }</code><technical_language>This is triggered async task. control disposed, check if is alive start it</technical_language>

Target:
private boolean switchTopControl() { if (control.isDisposed() || emptyArea.isDisposed()) { return false; } Control oldTop = layout.topControl; IProject[] projs = ResourcesPlugin.getWorkspace().getRoot().getProjects(); if (projs.length > 0) { layout.topControl = control; } else { layout.topControl = emptyArea; } return oldTop != layout.topControl; }
Source:
<code>public void setDerivativeThreshold(double derivativeThreshold) { <START> assertionManager.assertTrue(derivativeThreshold >= 0, "Thresholds won't work if they are negative!"); <END> propDerivativeThreshold.set(derivativeThreshold); }</code><technical_language>If a negative number running on-robot, I absolute sane</technical_language>

Target:
public void setDerivativeThreshold(double derivativeThreshold) { assertionManager.assertTrue(derivativeThreshold >= 0, "Thresholds won't work if they are negative!"); propDerivativeThreshold.set(Math.abs(derivativeThreshold)); }
Source:
<code>public List<String> getPage(final String url, final Map<String, String> postData) throws IOException { <START> return getPage(url, postData.entrySet().stream().map(Object::toString) <END> .collect(Collectors.joining("&"))); }</code><technical_language>Hmm, this work same? urlencoded key value</technical_language>

Target:
public List<String> getPage(final String url, final Map<String, String> postData) throws IOException { return getPage(url, postData.entrySet().stream() .flatMap(CollectionFunctions::flattenAndEncodeKeyPair) .collect(Collectors.joining("&"))); }
Source:
<code>public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { if (_idType == JsonTypeInfo.Id.NONE) { return null; } if (baseType.isPrimitive()) { return null; } TypeIdResolver idRes = idResolver(config, baseType, subtypes, false, true); JavaType defaultImpl; if (_defaultImpl == null) { defaultImpl = null; } else { if (_defaultImpl == Void.class) { defaultImpl = config.getTypeFactory().constructType(_defaultImpl); } else if (!baseType.getRawClass().isAssignableFrom(_defaultImpl)) { <START> defaultImpl = null; <END> } else { defaultImpl = config.getTypeFactory() .constructSpecializedType(baseType, _defaultImpl); } } switch (_includeAs) { case WRAPPER_ARRAY: return new AsArrayTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); case PROPERTY: case EXISTING_PROPERTY: return new AsPropertyTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl, _includeAs); case WRAPPER_OBJECT: return new AsWrapperTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); case EXTERNAL_PROPERTY: return new AsExternalTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); } throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: "+_includeAs); }</code><technical_language>If default implementation is a subtype of base type, this throw exception? simply hide incorrect usage. (I realize ideally method allow throwing of JsonMappingException, IOException, for that'd IllegalArgumentException get converted call stack)</technical_language>

Target:
public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { if (_idType == JsonTypeInfo.Id.NONE) { return null; } if (baseType.isPrimitive()) { return null; } TypeIdResolver idRes = idResolver(config, baseType, subtypes, false, true); JavaType defaultImpl; if (_defaultImpl == null) { defaultImpl = null; } else { if (_defaultImpl == Void.class) { defaultImpl = config.getTypeFactory().constructType(_defaultImpl); } else if (!baseType.getRawClass().isAssignableFrom(_defaultImpl) && isBaseActuallySpecializedType(config, baseType)) { defaultImpl = null; } else { defaultImpl = config.getTypeFactory() .constructSpecializedType(baseType, _defaultImpl); } } switch (_includeAs) { case WRAPPER_ARRAY: return new AsArrayTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); case PROPERTY: case EXISTING_PROPERTY: return new AsPropertyTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl, _includeAs); case WRAPPER_OBJECT: return new AsWrapperTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); case EXTERNAL_PROPERTY: return new AsExternalTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); } throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: "+_includeAs); }
Source:
<code>void configureShouldOnlyCreateSnifferInstance() { this.contextRunner.run( (context) -> assertThat(context).doesNotHaveBean(RestClient.class) .hasSingleBean(RestHighLevelClient.class)); <START> this.contextRunner.run( <END> (context) -> assertThat(context).hasSingleBean(Sniffer.class)); }</code><technical_language>A single test run context ideally</technical_language>

Target:
void configureShouldOnlyCreateSnifferInstance() { this.contextRunner.run((context) -> { assertThat(context).hasSingleBean(Sniffer.class); assertThat(context).doesNotHaveBean(RestClient.class).hasSingleBean(RestHighLevelClient.class); }); }
Source:
<code>public ReadyMarkerFilter() { <START> this.type = null; <END> this.identifier = null; }</code><technical_language>this(null, null);</technical_language>

Target:
public ReadyMarkerFilter() { this(null, null); }
Source:
<code>private <T extends Comparable<T>, U extends UserDefinedPredicate<T>> Boolean visit(UserDefined<T, U> ud, boolean inverted) { Column<T> filterColumn = ud.getColumn(); ColumnChunkMetaData meta = getColumnChunk(filterColumn.getColumnPath()); <START> if (meta == null || hasNonDictionaryPages(meta)) { <END> return BLOCK_MIGHT_MATCH; } try { Set<T> dictSet = expandDictionary(meta); if (dictSet == null) { return BLOCK_MIGHT_MATCH; } boolean allMatch = true; for(T entry : dictSet) { if (ud.getUserDefinedPredicate().keep(entry)) { if (!inverted) { return BLOCK_MIGHT_MATCH; } } else { allMatch = false; } } if (inverted && allMatch) { return BLOCK_CANNOT_MATCH; } else if (inverted) { return BLOCK_MIGHT_MATCH; } else { return BLOCK_CANNOT_MATCH; } } catch (IOException e) { LOG.warn("Failed to process dictionary for filter evaluation.", e); } return BLOCK_MIGHT_MATCH; }</code><technical_language>meta == null, column is missing values in column null. In @viirya's patch, 71cff7c5940b7101ff098601850d46b7a4698180, user-defined predicate is called null rows filtered. I this patch work way</technical_language>

Target:
private <T extends Comparable<T>, U extends UserDefinedPredicate<T>> Boolean visit(UserDefined<T, U> ud, boolean inverted) { Column<T> filterColumn = ud.getColumn(); ColumnChunkMetaData meta = getColumnChunk(filterColumn.getColumnPath()); U udp = ud.getUserDefinedPredicate(); if (meta == null) { if (inverted) { return udp.keep(null); } else { return !udp.keep(null); } } if (hasNonDictionaryPages(meta)) { return BLOCK_MIGHT_MATCH; } try { Set<T> dictSet = expandDictionary(meta); if (dictSet == null) { return BLOCK_MIGHT_MATCH; } for (T entry : dictSet) { boolean keep = udp.keep(entry); if ((keep && !inverted) || (!keep && inverted)) return BLOCK_MIGHT_MATCH; } return BLOCK_CANNOT_MATCH; } catch (IOException e) { LOG.warn("Failed to process dictionary for filter evaluation.", e); } return BLOCK_MIGHT_MATCH; }
Source:
<code>public String getNamespace() { <START> if(namespace==null || "".equals(namespace)) { <END> namespace=ConfigUtils.getNamespace(namespace); } return namespace; }</code><technical_language>StringUtils.isEmpty(namespace) care of (not important, FYI)</technical_language>

Target:
public String getNamespace() { if(StringUtils.isEmpty(namespace)) { namespace=ConfigUtils.getSystemNamespace(); } return namespace; }
Source:
<code>public static int onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, BlockPos pos) { boolean preCancelEvent = false; <START> if (gameType.isCreative() && !entityPlayer.getHeldItemMainhand().isEmpty() && !entityPlayer.getHeldItemMainhand().getItem().canDestroyBlockInCreative(entityPlayer.getHeldItemMainhand(), world.getBlockState(pos), entityPlayer)) <END> preCancelEvent = true; if (gameType.isAdventure()) { if (gameType == GameType.SPECTATOR) preCancelEvent = true; if (!entityPlayer.isAllowEdit()) { ItemStack itemstack = entityPlayer.getHeldItemMainhand(); if (itemstack.isEmpty() || !itemstack.canDestroy(world.getBlockState(pos).getBlock())) preCancelEvent = true; } } if (world.getTileEntity(pos) == null) { SPacketBlockChange packet = new SPacketBlockChange(world, pos); packet.blockState = Blocks.AIR.getDefaultState(); entityPlayer.connection.sendPacket(packet); } IBlockState state = world.getBlockState(pos); BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, state, entityPlayer); event.setCanceled(preCancelEvent); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { entityPlayer.connection.sendPacket(new SPacketBlockChange(world, pos)); TileEntity tileentity = world.getTileEntity(pos); if (tileentity != null) { Packet<?> pkt = tileentity.getUpdatePacket(); if (pkt != null) { entityPlayer.connection.sendPacket(pkt); } } } return event.isCanceled() ? -1 : event.getExpToDrop(); }</code><technical_language>Put entityPlayer.getHeldItemMainhand() a local variable</technical_language>

Target:
public static int onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, BlockPos pos) { boolean preCancelEvent = false; ItemStack itemstack = entityPlayer.getHeldItemMainhand(); if (gameType.isCreative() && !itemstack.isEmpty() && !itemstack.getItem().canDestroyBlockInCreative(world, pos, itemstack, entityPlayer)) preCancelEvent = true; if (gameType.isAdventure()) { if (gameType == GameType.SPECTATOR) preCancelEvent = true; if (!entityPlayer.isAllowEdit()) { if (itemstack.isEmpty() || !itemstack.canDestroy(world.getBlockState(pos).getBlock())) preCancelEvent = true; } } if (world.getTileEntity(pos) == null) { SPacketBlockChange packet = new SPacketBlockChange(world, pos); packet.blockState = Blocks.AIR.getDefaultState(); entityPlayer.connection.sendPacket(packet); } IBlockState state = world.getBlockState(pos); BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, state, entityPlayer); event.setCanceled(preCancelEvent); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { entityPlayer.connection.sendPacket(new SPacketBlockChange(world, pos)); TileEntity tileentity = world.getTileEntity(pos); if (tileentity != null) { Packet<?> pkt = tileentity.getUpdatePacket(); if (pkt != null) { entityPlayer.connection.sendPacket(pkt); } } } return event.isCanceled() ? -1 : event.getExpToDrop(); }
Source:
<code>public List<Span> getTrace(String tenant, String id) { if (id == null) { throw new NullPointerException("Id should not be null!"); } <START> QueryFactory<?> queryFactory = Search.getQueryFactory(spansCache); <END> Query query = queryFactory.from(Span.class) .having("traceId") .eq(id) .toBuilder().build(); return query.list(); }</code><technical_language>a heads - I this in server some dependency problems. need create integration test, some suitable source span data, try this mechanism out running in server, sure</technical_language>

Target:
public Set<Span> getTrace(String tenant, String id) { if (id == null) { throw new NullPointerException("Id should not be null!"); } Set<Span> trace = traceCache.get(id); return trace == null ? null : Collections.unmodifiableSet(trace); }
Source:
<code>public void testRecursiveUploadForYarnS3n() throws Exception { <START> Assume.assumeTrue("This test is skipped for Hadoop versions above 3", VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") <= 0); <END> try { Class.forName("org.apache.hadoop.fs.s3native.NativeS3FileSystem"); } catch (ClassNotFoundException e) { String msg = "Skipping test because NativeS3FileSystem is not in the class path"; log.info(msg); assumeNoException(msg, e); } testRecursiveUploadForYarn("s3n", "testYarn-s3n"); }</code><technical_language>suggestion Assume.assumeTrue("This test is skipped for Hadoop versions 3", VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") < 0);</technical_language>

Target:
public void testRecursiveUploadForYarnS3n() throws Exception { Assume.assumeTrue("This test is skipped for Hadoop versions above 3", VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") < 0); try { Class.forName("org.apache.hadoop.fs.s3native.NativeS3FileSystem"); } catch (ClassNotFoundException e) { String msg = "Skipping test because NativeS3FileSystem is not in the class path"; log.info(msg); assumeNoException(msg, e); } testRecursiveUploadForYarn("s3n", "testYarn-s3n"); }
Source:
<code>private void closeQuietly(FileChannel channel) { if (channel != null) { try { channel.close(); } catch (IOException e) { LOG.warn("Exception during closing", e.getMessage()); <START> <END> } } }</code><technical_language>remove extra empty line</technical_language>

Target:
private void closeQuietly(FileChannel channel) { if (channel != null) { try { channel.close(); } catch (IOException e) { LOG.warn("Exception during closing: {}", e.getMessage(), e); } } }
Source:
<code><START> protected int getFullShots() { if (oneShot) { return 1; } return getType().getShots(); } <END></code><technical_language>Ternary candidate</technical_language>

Target:
protected int getFullShots() { return oneShot ? 1 : getType().getShots(); }
Source:
<code>public void fromCS(Vertx vertx, CompletionStage<String> completionStage) { <START> Future.from(completionStage, vertx.getOrCreateContext()) <END> .onSuccess(str -> { System.out.println("We have a result: " + str); }) .onFailure(err -> { System.err.println("We have a problem"); err.printStackTrace(); }); }</code><technical_language>This example give user a hint do this. CS result in a future flatMap operation</technical_language>

Target:
public void fromCS(Vertx vertx, CompletionStage<String> completionStage) { Future.fromCompletionStage(completionStage, vertx.getOrCreateContext()) .flatMap(str -> { String key = UUID.randomUUID().toString(); return storeInDb(key, str); }) .onSuccess(str -> { System.out.println("We have a result: " + str); }) .onFailure(err -> { System.err.println("We have a problem"); err.printStackTrace(); }); }
Source:
<code>private void addExecutorHelper(String host, int port) throws ExecutorManagerException { final String INSERT = "INSERT INTO executors " + "(host, port) values (?,?)"; QueryRunner runner = createQueryRunner(); String errString = String.format("Error adding %s:%d ", host, port); try { int rows = runner.update(INSERT, host, port); <START> if (rows == 0) { <END> throw new ExecutorManagerException(errString); } } catch (SQLException e) { throw new ExecutorManagerException(errString, e); } }</code><technical_language>I circumstance update method returns 0 rows</technical_language>

Target:
private void addExecutorHelper(String host, int port) throws ExecutorManagerException { final String INSERT = "INSERT INTO executors (host, port) values (?,?)"; QueryRunner runner = createQueryRunner(); try { runner.update(INSERT, host, port); } catch (SQLException e) { throw new ExecutorManagerException(String.format("Error adding %s:%d ", host, port), e); } }
Source:
<code>public Receive createReceive() { return receiveBuilder() <START> .matchEquals(FETCH_MSG, <END> work -> fetchMetricsForRollup()) .match(KairosMetricNamesQueryResponse.class, this::updateMetricsSet) .match(Status.Failure.class, failure -> LOGGER.warn("Failed to get metrics from Kairo", failure.cause())) .match(MetricFetch.class, work -> { final Optional<String> metricName = getNextMetric(); if (metricName.isPresent()) { getSender().tell(metricName.get(), getSelf()); } else { getSender().tell(NoMoreMetrics.getInstance(), getSelf()); } }) .build(); }</code><technical_language>Convention is wrap-all; e.g. not: foo(argA, argB, argC) instead: foo( argA, argB, argC)</technical_language>

Target:
public Receive createReceive() { return receiveBuilder() .matchEquals( FETCH_MSG, work -> { getTimers().startSingleTimer(REFRESH_TIMER, FETCH_MSG, _fetchInterval); _refreshDeadline = _fetchInterval.fromNow(); fetchMetricsForRollup(); }) .match(KairosMetricNamesQueryResponse.class, this::updateMetricsSet) .match( Status.Failure.class, failure -> LOGGER.warn("Failed to get metrics from Kairos", failure.cause())) .match( MetricFetch.class, work -> { final Optional<String> metricName = getNextMetric(); if (metricName.isPresent()) { getSender().tell(metricName.get(), getSelf()); } else { getSender().tell(new NoMoreMetrics(_refreshDeadline), getSelf()); } }) .build(); }
Source:
<code>static void calculateProbes(Map<InetAddressAndPort, AnnotatedMeasurement> samples, long intervalMillis) { for (Map.Entry<InetAddressAndPort, AnnotatedMeasurement> entry: samples.entrySet()) { if (entry.getKey().equals(FBUtilities.getBroadcastAddressAndPort())) continue; AnnotatedMeasurement measurement = entry.getValue(); <START> long lastMeasure = measurement.millisSinceLastMeasure.getAndAdd(intervalMillis); <END> long lastRequest = measurement.millisSinceLastRequest.getAndAdd(intervalMillis); if (lastMeasure >= MIN_PROBE_INTERVAL_MS && lastRequest < MAX_PROBE_INTERVAL_MS) { if (measurement.probeTimerMillis == 0) { measurement.probeTimerMillis = intervalMillis; } else if (measurement.probeFuture != null && measurement.probeFuture.isDone()) { measurement.probeTimerMillis = Math.min(MAX_PROBE_INTERVAL_MS, measurement.probeTimerMillis * 2); } } else { measurement.probeTimerMillis = 0; } } }</code><technical_language>addAndGet</technical_language>

Target:
protected static void calculateProbes(Map<InetAddressAndPort, AnnotatedMeasurement> samples, long intervalMillis) { for (Map.Entry<InetAddressAndPort, AnnotatedMeasurement> entry: samples.entrySet()) { AnnotatedMeasurement measurement = entry.getValue(); long lastMeasure = measurement.millisSinceLastMeasure.addAndGet(intervalMillis); long lastRequest = measurement.millisSinceLastRequest.addAndGet(intervalMillis); if (lastMeasure >= MIN_PROBE_INTERVAL_MS && lastRequest < MAX_PROBE_INTERVAL_MS) { if (measurement.nextProbeDelayMillis == 0) { measurement.nextProbeDelayMillis = intervalMillis; } else if (measurement.probeFuture != null && measurement.probeFuture.isDone()) { measurement.nextProbeDelayMillis = Math.min(MAX_PROBE_INTERVAL_MS, measurement.nextProbeDelayMillis * 2); } } else { measurement.nextProbeDelayMillis = 0; } } }
Source:
<code>protected boolean isFileExist(HttpMessage msg) { <START> boolean isFileExist = isPage200(msg); return isFileExist ? isFileExist : parent.getAnalyser().isFileExist(msg); <END> }</code><technical_language>This done in isPage200 this method call one</technical_language>

Target:
protected boolean isFileExist(HttpMessage msg) { return isPage200(msg); }
Source:
<code>protected void doRun() throws Exception { Double cpuLoad; try { VMMetricProviderImpl vmMetricProvider = ExtensionList.lookup(MetricProvider.class).get(VMMetricProviderImpl.class); MetricSet vmProviderMetricSet = vmMetricProvider.getMetricSet(); Gauge cpu = (Gauge) vmProviderMetricSet.getMetrics().get("vm.cpu.load"); cpuLoad = new Double(cpu.getValue().toString()); } catch (NullPointerException nullPointerException) { LOGGER.log(WARNING, "Support Core plugin can't generate thread dumps. Metrics plugin does not seem to be available", nullPointerException); return; } if (Double.compare(Runtime.getRuntime().availableProcessors() * CPU_USAGE_THRESHOLD, cpuLoad) < 0) { countConsequtivePositives++; if (countConsequtivePositives >= HIGH_CPU_CONSECUTIVE_TIMES) { <START> countConsequtivePositives = 0; <END> File threadDumpFile = logs.file(format.format(new Date()) + ".txt"); try (FileOutputStream fileOutputStream = new FileOutputStream(threadDumpFile)) { ThreadDumps.threadDump(fileOutputStream); logs.add(threadDumpFile); } } } else { countConsequtivePositives = 0; } }</code><technical_language>Note this happen 4th time, I think</technical_language>

Target:
protected void doRun() throws Exception { Double cpuLoad; try { VMMetricProviderImpl vmMetricProvider = ExtensionList.lookup(MetricProvider.class).get(VMMetricProviderImpl.class); MetricSet vmProviderMetricSet = vmMetricProvider.getMetricSet(); Gauge cpu = (Gauge) vmProviderMetricSet.getMetrics().get("vm.cpu.load"); cpuLoad = new Double(cpu.getValue().toString()); } catch (NullPointerException nullPointerException) { LOGGER.log(WARNING, "Support Core plugin can't generate automatically thread dumps on high cpu load. Metrics plugin does not seem to be available", nullPointerException); return; } if (cpuLoad != null && Double.compare(Runtime.getRuntime().availableProcessors() * CPU_USAGE_THRESHOLD, cpuLoad) < 0) { countConsecutivePositives++; if (countConsecutivePositives >= HIGH_CPU_CONSECUTIVE_TIMES) { countConsecutivePositives = 0; File threadDumpFile = logs.file(format.format(new Date()) + ".txt"); try (FileOutputStream fileOutputStream = new FileOutputStream(threadDumpFile)) { ThreadDumps.threadDump(fileOutputStream); logs.add(threadDumpFile); } } } else { countConsecutivePositives = 0; } }
Source:
<code>public boolean equals(Object obj) { return obj instanceof ProgramInformation <START> && ((ProgramInformation)obj).title.equals(this.title) <END> && ((ProgramInformation)obj).source.equals(this.source) && ((ProgramInformation)obj).copyright.equals(this.copyright) && validateEvents(((ProgramInformation)obj).customEvents); }</code><technical_language>This code a bit confused fields null not. hashCode assumes null, equals crash if are. Allowing null conveys slightly more information, distinguishes element present in manifest empty string, omitted entirely. Notes: * Util.areEqual(other.title, this.title), handle nulls for you. * cast once? kinda ugly casting line :)</technical_language>

Target:
public boolean equals(Object obj) { if (!(obj instanceof ProgramInformation)) { return false; } ProgramInformation other = (ProgramInformation) obj; return Util.areEqual(this.title, other.title) && Util.areEqual(this.source, other.source) && Util.areEqual(this.copyright, other.copyright) && Util.areEqual(this.moreInformationURL, other.moreInformationURL) && Util.areEqual(this.lang, other.lang); }
Source:
<code>public boolean checkFileExistsInUserSpace(Session session, String pathname) throws NotConnectedException, PermissionException { try { return fileSystem(session).resolveFileInUserspace(pathname).exists(); <START> } catch (FileSystemException e) { <END> return false; } }</code><technical_language>log debug, in case</technical_language>

Target:
public boolean checkFileExistsInUserSpace(Session session, String pathname) throws NotConnectedException, PermissionException { try { return fileSystem(session).resolveFileInUserspace(pathname).exists(); } catch (FileSystemException e) { logger.debug(String.format("Can't parse the file name [%s] in the user space.", pathname), e); return false; } }
Source:
<code><START> public static Version fromVersionString(String versionString) { <END> if(StringUtils.isEmpty(versionString)) { return null; } String[] parts = versionString.split("\\."); Version version = new Version(); if(parts.length < 1) { return null; } try { version.setMajor(Integer.parseInt(StringUtils.stripStart(parts[0], "0"))); } catch(NumberFormatException e) { log.error("Failed to map version string major component", e); return null; } if (parts.length > 1) { try { version.setMinor(Integer.parseInt(StringUtils.stripStart(parts[1], "0"))); } catch(NumberFormatException e) { log.error("Failed to map version string minor component", e); return version; } } if (parts.length > 2) { try { version.setBuild(Integer.parseInt(StringUtils.stripStart(parts[2], "0"))); } catch(NumberFormatException e) { log.error("Failed to map version string build component", e); return version; } } if (parts.length > 3) { try { version.setRevision(Integer.parseInt(StringUtils.stripStart(parts[3], "0"))); } catch(NumberFormatException e) { log.error("Failed to map version string revision component", e); return version; } } return version; }</code><technical_language>apply for this method ??</technical_language>

Target:
public static Version fromVersionString(String versionString) { if (versionString == null) { return null; } Version version = new Version(); version.setFullVersion(versionString); Matcher match = VERSION_PATTERN.matcher(versionString); if (match.matches()) { String major = match.group("major"); String minor = match.group("minor"); String build = match.group("build"); String revision = match.group("revision"); if (major != null) { version.setMajor(Integer.parseInt(major)); } if (minor != null) { version.setMinor(Integer.parseInt(minor)); } if (build != null) { version.setBuild(Integer.parseInt(build)); } if (revision != null) { version.setRevision(Integer.parseInt(revision)); } } else { log.warn( "The version string \"{}\" doesn't match the expected pattern, only the full version will be reported.", versionString ); } return version; }
Source:
<code>public void testStitchPointsEquals() { DSTFileGenerator.StitchPoint stitchPoint1 = new DSTFileGenerator.StitchPoint(new PointF(1, 2), true); DSTFileGenerator.StitchPoint stitchPoint2 = new DSTFileGenerator.StitchPoint(new PointF(2, 1), true); DSTFileGenerator.StitchPoint stitchPoint3 = new DSTFileGenerator.StitchPoint(new PointF(1, 2)); DSTFileGenerator.StitchPoint stitchPoint4 = stitchPoint1; <START> assertFalse(stitchPoint1.equals(stitchPoint2)); <END> assertFalse(stitchPoint1.equals(stitchPoint3)); assertEquals(stitchPoint1, stitchPoint4); }</code><technical_language>assertNotEquals nicer here. (like in test below)</technical_language>

Target:
public void testStitchPointsEquals() { DSTFileGenerator.StitchPoint stitchPoint1 = new DSTFileGenerator.StitchPoint(new PointF(1, 2), true); DSTFileGenerator.StitchPoint stitchPoint2 = new DSTFileGenerator.StitchPoint(new PointF(2, 1), true); DSTFileGenerator.StitchPoint stitchPoint3 = new DSTFileGenerator.StitchPoint(new PointF(1, 2)); DSTFileGenerator.StitchPoint stitchPoint4 = stitchPoint1; assertNotEquals(stitchPoint1, stitchPoint2); assertNotEquals(stitchPoint1, stitchPoint3); assertEquals(stitchPoint1, stitchPoint4); }
Source:
<code>public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { <START> System.out.println("InjectClientHeadersFactory update"); <END> MultivaluedMap<String, String> updatedHeaders = new MultivaluedHashMap<>(); updatedHeaders.putSingle("REQUEST_METHOD", jaxrsRequest == null ? "NOT_INJECTED" : jaxrsRequest.getMethod()); return updatedHeaders; }</code><technical_language>Debug leftovers? ;-)</technical_language>

Target:
public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { MultivaluedMap<String, String> updatedHeaders = new MultivaluedHashMap<>(); updatedHeaders.putSingle("REQUEST_METHOD", jaxrsRequest == null ? "NOT_INJECTED" : jaxrsRequest.getMethod()); return updatedHeaders; }
Source:
<code>public void enableTableReplication(String tableName) throws IOException { TableName tn = tableInfoFactory.getTableInfo(tableName); try { HTableDescriptor htd = admin.getTableDescriptor(tn); if (admin.isTableEnabled(tn)) { admin.disableTable(tn); } for (HColumnDescriptor hcd : htd.getFamilies()) { hcd.setScope(HConstants.REPLICATION_SCOPE_GLOBAL); } admin.modifyTable(tn, htd); SpliceLogUtils.info(LOG, "enabled replication for table %s", tn); } finally { if (tn != null && !admin.isTableEnabled(tn)) { admin.enableTable(tn); <START> } <END> } }</code><technical_language>if table disabled with? act of enabling replication enable table in case, right? Also, allow enabling of replication tables currently enabled in HBase, error out other cases, is OK enable replication well</technical_language>

Target:
public void enableTableReplication(String tableName) throws IOException { TableName tn = tableInfoFactory.getTableInfo(tableName); boolean tableEnabled = admin.isTableEnabled(tn); try { HTableDescriptor htd = admin.getTableDescriptor(tn); if (tableEnabled) { admin.disableTable(tn); } for (HColumnDescriptor hcd : htd.getFamilies()) { hcd.setScope(HConstants.REPLICATION_SCOPE_GLOBAL); } admin.modifyTable(tn, htd); SpliceLogUtils.info(LOG, "enabled replication for table %s", tn); } finally { if (tn != null && !admin.isTableEnabled(tn) && tableEnabled) { admin.enableTable(tn); } } }
Source:
<code>public static boolean isRetryable(Throwable t) { if (t instanceof GoogleJsonResponseException) { final GoogleJsonResponseException e = (GoogleJsonResponseException) t; <START> return e.getStatusCode() == 429; END> } return t instanceof IOException; }</code><technical_language>metal:</technical_language>

Target:
public static boolean isRetryable(Throwable t) { if (t instanceof HttpResponseException) { final HttpResponseException e = (HttpResponseException) t; return e.getStatusCode() == 429 || (e.getStatusCode() / 500 == 1); } return t instanceof IOException; }
Source:
<code>public List<FeedbackQuestionAttributes> getQuestionsWithRecipients( List<FeedbackQuestionAttributes> questions, String giver) throws EntityDoesNotExistException { List<FeedbackQuestionAttributes> questionsWithRecipients = new ArrayList<FeedbackQuestionAttributes>(); for (FeedbackQuestionAttributes question : questions) { if (question.numberOfEntitiesToGiveFeedbackTo == Const.MAX_POSSIBLE_RECIPIENTS) { <START> question.numberOfEntitiesToGiveFeedbackTo = this <END> .getRecipientsForQuestion(question, giver).size(); } if (question.numberOfEntitiesToGiveFeedbackTo > 0) { questionsWithRecipients.add(question); } } return questionsWithRecipients; }</code><technical_language>right calling this function, of question.numberOfEntitiesToGiveFeedbackTo is changed</technical_language>

Target:
public List<FeedbackQuestionAttributes> getQuestionsWithRecipients( List<FeedbackQuestionAttributes> questions, String giver) throws EntityDoesNotExistException { List<FeedbackQuestionAttributes> questionsWithRecipients = new ArrayList<FeedbackQuestionAttributes>(); for (FeedbackQuestionAttributes question : questions) { int numRecipients = question.numberOfEntitiesToGiveFeedbackTo; if (numRecipients == Const.MAX_POSSIBLE_RECIPIENTS) { numRecipients = this.getRecipientsForQuestion(question, giver) .size(); } if (numRecipients > 0) { questionsWithRecipients.add(question); } } return questionsWithRecipients; }
Source:
<code>public List<Long> getSizeOfTasksForNotTemplateProcessesForProjectIdOrderByOrdering(Integer projectId) { <START> return getCount("SELECT COUNT(t.id) FROM Task AS t INNER JOIN t.process AS p INNER JOIN p.project AS pr " <END> + "WITH pr.id = " + projectId + " GROUP BY t.title ORDER BY t.ordering"); }</code><technical_language>change query parameters other places</technical_language>

Target:
public List<Long> getSizeOfTasksForNotTemplateProcessesForProjectIdOrderByOrdering(Integer projectId) { Map<String, Object> parameters = new HashMap<>(); parameters.put("projectId", projectId); return getCount("SELECT COUNT(t.id) FROM Task AS t INNER JOIN t.process AS p INNER JOIN p.project AS pr " + "WITH pr.id = :projectId GROUP BY t.title ORDER BY t.ordering", parameters); }
Source:
<code>public PageableResult search(RequestContext context) throws ResponseException { String identifier = context.getRequest().getParameter("identifier"); String searchType = context.getParameter("searchType"); if (StringUtils.isNotBlank(identifier)) { if("start".equals(searchType)){ <START> List<Patient> patients = restHelperService.findPatientsByIdentifierStartingWith(identifier, false); <END> if (patients != null && patients.size() > 0) { return new NeedsPaging<Patient>(patients, context); } } else { List<Patient> patients = Context.getPatientService().getPatients(null, identifier, null, true); if (patients != null && patients.size() > 0) { return new NeedsPaging<Patient>(patients, context); } } } return new EmptySearchResult(); }</code><technical_language>Is return voided patients? Please add support for includeAll=true <LINK_0> Call context.getIncludeAll()</technical_language>

Target:
public PageableResult search(RequestContext context) throws ResponseException { String identifier = context.getRequest().getParameter("identifier"); String searchType = context.getParameter("searchType"); if (StringUtils.isNotBlank(identifier)) { if ("start".equals(searchType)) { List<Patient> patients = restHelperService.findPatientsByIdentifierStartingWith(identifier, context.getIncludeAll()); if (patients != null && patients.size() > 0) { return new NeedsPaging<Patient>(patients, context); } } else { List<Patient> patients = Context.getPatientService().getPatients(null, identifier, null, true); if (patients != null && patients.size() > 0) { return new NeedsPaging<Patient>(patients, context); } } } return new EmptySearchResult(); }
Source:
<code>private void openWindow(Stage mainStage) { GUIGlobals.init(); LOGGER.debug("Initializing frame"); mainFrame.init(); if (Globals.prefs.getBoolean(JabRefPreferences.WINDOW_MAXIMISED)) { mainStage.setMaximized(true); } else { mainStage.setX(Globals.prefs.getDouble(JabRefPreferences.POS_X)); mainStage.setY(Globals.prefs.getDouble(JabRefPreferences.POS_Y)); mainStage.setWidth(Globals.prefs.getDouble(JabRefPreferences.SIZE_X)); mainStage.setHeight(Globals.prefs.getDouble(JabRefPreferences.SIZE_Y)); } DecorationPane root = new DecorationPane(); root.getChildren().add(JabRefGUI.mainFrame); Scene scene = new Scene(root, 800, 800); Globals.getThemeLoader().installCss(scene, Globals.prefs); mainStage.setTitle(JabRefFrame.FRAME_TITLE); mainStage.getIcons().addAll(IconTheme.getLogoSetFX()); mainStage.setScene(scene); mainStage.show(); mainStage.setOnCloseRequest(event -> { saveWindowState(mainStage); boolean reallyQuit = mainFrame.quit(); if (!reallyQuit) { event.consume(); } }); <START> this.openDatabases(); <END> }</code><technical_language>This run javafx (Platform.runLater)</technical_language>

Target:
private void openWindow(Stage mainStage) { GUIGlobals.init(); LOGGER.debug("Initializing frame"); mainFrame.init(); if (Globals.prefs.getBoolean(JabRefPreferences.WINDOW_MAXIMISED)) { mainStage.setMaximized(true); } else { mainStage.setX(Globals.prefs.getDouble(JabRefPreferences.POS_X)); mainStage.setY(Globals.prefs.getDouble(JabRefPreferences.POS_Y)); mainStage.setWidth(Globals.prefs.getDouble(JabRefPreferences.SIZE_X)); mainStage.setHeight(Globals.prefs.getDouble(JabRefPreferences.SIZE_Y)); } DecorationPane root = new DecorationPane(); root.getChildren().add(JabRefGUI.mainFrame); Scene scene = new Scene(root, 800, 800); Globals.getThemeLoader().installCss(scene, Globals.prefs); mainStage.setTitle(JabRefFrame.FRAME_TITLE); mainStage.getIcons().addAll(IconTheme.getLogoSetFX()); mainStage.setScene(scene); mainStage.show(); mainStage.setOnCloseRequest(event -> { saveWindowState(mainStage); boolean reallyQuit = mainFrame.quit(); if (!reallyQuit) { event.consume(); } }); Platform.runLater(this::openDatabases); }
Source:
<code>protected CompletableFuture<Boolean> subscribeRaw(String topic) { <START> logger.trace("Unsubscribing message consumer for topic '{}' from broker '{}'", topic, host); <END> CompletableFuture<Boolean> future = new CompletableFuture<Boolean>(); try { MqttAsyncClient client = this.client; if (client != null && client.isConnected()) { client.subscribe(topic, qos, future, actionCallbacks); } else { future.complete(false); } } catch (org.eclipse.paho.client.mqttv3.MqttException e) { logger.info("Error subscribing to topic {}", topic, e); future.completeExceptionally(e); } return future; }</code><technical_language>logger "Unsubscribing"</technical_language>

Target:
protected CompletableFuture<Boolean> subscribeRaw(String topic) { logger.trace("subscribeRaw message consumer for topic '{}' from broker '{}'", topic, host); CompletableFuture<Boolean> future = new CompletableFuture<Boolean>(); try { MqttAsyncClient client = this.client; if (client != null && client.isConnected()) { client.subscribe(topic, qos, future, actionCallback); } else { future.complete(false); } } catch (org.eclipse.paho.client.mqttv3.MqttException e) { logger.info("Error subscribing to topic {}", topic, e); future.completeExceptionally(e); } return future; }
Source:
<code>public ModelAndView receiveBulkLibraries(@RequestParam("quantity") Integer quantity, @RequestParam(value = "sampleClassId", required = false) Long aliquotClassId, @RequestParam(value = "projectId", required = false) Long projectId, ModelMap model) throws IOException { LibraryDto libDto = null; Project project = null; if (projectId != null) { project = projectService.getProjectById(projectId); <START> if (project == null) throw new NotFoundException("No project found for ID " + projectId.toString()); <END> } SampleClass aliquotClass = null; if (isDetailedSampleEnabled()) { if (aliquotClassId == null) throw new NotFoundException("Sample Class ID is required"); aliquotClass = sampleClassService.get(aliquotClassId); if (aliquotClass == null) throw new NotFoundException("Requested sample class not found"); DetailedLibraryDto detailedDto = new DetailedLibraryDto(); libDto = detailedDto; SampleAliquotDto samDto = new SampleAliquotDto(); detailedDto.setSample(samDto); samDto.setSampleClassId(aliquotClassId); detailedDto.setParentSampleClassId(aliquotClassId); } else { libDto = new LibraryDto(); libDto.setSample(new SampleDto()); } return new BulkReceiveLibraryBackend(libDto, quantity, project, aliquotClass, defaultSciName).create(model); }</code><technical_language>This is invalid parameter, page</technical_language>

Target:
public ModelAndView receiveBulkLibraries(@RequestParam("quantity") Integer quantity, @RequestParam(value = "sampleClassId", required = false) Long aliquotClassId, @RequestParam(value = "projectId", required = false) Long projectId, ModelMap model) throws IOException { LibraryDto libDto = null; Project project = null; if (projectId != null) { project = projectService.getProjectById(projectId); if (project == null) throw new InvalidParameterException("No project found for ID " + projectId.toString()); } SampleClass aliquotClass = null; if (isDetailedSampleEnabled()) { if (aliquotClassId == null) throw new InvalidParameterException("Sample Class ID is required"); aliquotClass = sampleClassService.get(aliquotClassId); if (aliquotClass == null) throw new InvalidParameterException("Requested sample class not found"); DetailedLibraryDto detailedDto = new DetailedLibraryDto(); libDto = detailedDto; SampleAliquotDto samDto = new SampleAliquotDto(); detailedDto.setSample(samDto); samDto.setSampleClassId(aliquotClassId); detailedDto.setParentSampleClassId(aliquotClassId); } else { libDto = new LibraryDto(); libDto.setSample(new SampleDto()); } return new BulkReceiveLibraryBackend(libDto, quantity, project, aliquotClass, defaultSciName).create(model); }
Source:
<code>protected void validateJoinFilters(List<RexNode> aboveFilters, List<RexNode> joinFilters, Join join, JoinRelType joinType) { final Iterator<RexNode> filterIter = joinFilters.iterator(); while (filterIter.hasNext()) { RexNode exp = filterIter.next(); int maxIndex = -1; ImmutableList<RexInputRef> inputRefs = RexUtil.getAllInputRef(exp); for (RexInputRef rexInputRef: inputRefs) { if (rexInputRef.getIndex() > maxIndex) { maxIndex = rexInputRef.getIndex(); } } if (!predicate.apply(join, joinType, exp) && maxIndex < join.getRowType().getFieldCount()) { aboveFilters.add(exp); filterIter.remove(); <START> } <END> } }</code><technical_language>Well, surprised this -- joinFilters is join condition, contains a RexInputRef index bigger join.getRowType().getFieldCount()</technical_language>

Target:
protected void validateJoinFilters(List<RexNode> aboveFilters, List<RexNode> joinFilters, Join join, JoinRelType joinType) { final Iterator<RexNode> filterIter = joinFilters.iterator(); while (filterIter.hasNext()) { RexNode exp = filterIter.next(); if (!predicate.apply(join, joinType, exp) && joinType.projectsRight()) { aboveFilters.add(exp); filterIter.remove(); } } }
Source:
<code><START> public TagUserRules(Context context) { <END> super("Tag rules which are not builtin with 'symbolic' tag", context); notSymbolicTags = ImmutableSet.of( Constants.MACRO, Constants.FUNCTION, Constants.STRUCTURAL, Constants.ANYWHERE, SymbolicBackend.NOTSYMBOLIC); if (!kompileOptions.experimental.nonSymbolicTags.isEmpty()) { notSymbolicTags.addAll(kompileOptions.experimental.nonSymbolicTags); } }</code><technical_language>understand a static object is bad in this instance, notSymbolicTags is practically a constant. benefit I is is initialized accessed other classes</technical_language>

Target:
public TagUserRules(Context context) { super("Tag rules which are not builtin with 'symbolic' tag", context); notSymbolicTags = ImmutableSet.of( Constants.MACRO, Constants.FUNCTION, Constants.STRUCTURAL, Constants.ANYWHERE, SymbolicBackend.NOTSYMBOLIC); if (!kompileOptions.experimental.nonSymbolicRules.isEmpty()) { notSymbolicTags.addAll(kompileOptions.experimental.nonSymbolicRules); } }