auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Color getBackground(Object element) { Security security = Adaptor.adapt(Security.class, element); if(security == null) return null; Attributes attributes = security.getAttributes(); LimitPrice limit = (LimitPrice) attributes.get(attribute); if(limit == null) return null; <START> if(limit.getCompareType() == CompareType.GREATER_OR_EQUAL) <END> { if(security.getLatest().getValue() >= limit.getLimitPrice()) return Colors.GREEN; } else if(limit.getCompareType() == CompareType.SMALLER_OR_EQUAL) { if(security.getLatest().getValue() <= limit.getLimitPrice()) return Colors.RED; } else if(limit.getCompareType() == CompareType.GREATER) { if(security.getLatest().getValue() > limit.getLimitPrice()) return Colors.GREEN; } else if(limit.getCompareType() == CompareType.SMALLER) { if(security.getLatest().getValue() < limit.getLimitPrice()) return Colors.RED; } return null; }</code><technical_language>vielleicht ist ein *switch* Statement lesbarer? java switch (limit.getCompareType()) { case GREATER_OR_EQUAL: return latest.getValue() >= limit.getLimitPrice() ? Colors.GREEN : null;</technical_language>

Target:
public Color getBackground(Object element) { Security security = Adaptor.adapt(Security.class, element); if(security == null) return null; Attributes attributes = security.getAttributes(); LimitPrice limit = (LimitPrice) attributes.get(attribute); if(limit == null) return null; SecurityPrice latestSecurityPrice = security.getSecurityPrice(LocalDate.now()); if(latestSecurityPrice == null) return null; switch(limit.getCompareType()) { case GREATER_OR_EQUAL: return (latestSecurityPrice.getValue() >= limit.getValue() ? Colors.GREEN : null); case SMALLER_OR_EQUAL: return (latestSecurityPrice.getValue() >= limit.getValue() ? Colors.RED : null); case GREATER: return (latestSecurityPrice.getValue() >= limit.getValue() ? Colors.GREEN : null); case SMALLER: return (latestSecurityPrice.getValue() >= limit.getValue() ? Colors.RED : null); default: return null; } }
Source:
<code>public static String getTopicProperty(final String topic, final String zkPath, final String propertyName) { KafkaZkClient zkClient = null; try { zkClient = getZkClient(zkPath); final AdminZkClient adminZkClient = new AdminZkClient(zkClient); final Properties topicConfig = adminZkClient.fetchEntityConfig(ConfigType.Topic(), topic); return topicConfig.getProperty(propertyName); } finally { if (zkClient != null) { zkClient.close(); <START> } <END> } }</code><technical_language>previous - final, check for null (reduce amount of lines)</technical_language>

Target:
public static String getTopicProperty(final String topic, final String zkPath, final String propertyName) { try (KafkaZkClient zkClient = createZkClient(zkPath)) { final AdminZkClient adminZkClient = new AdminZkClient(zkClient); final Properties topicConfig = adminZkClient.fetchEntityConfig(ConfigType.Topic(), topic); return topicConfig.getProperty(propertyName); } }
Source:
<code>public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { <START> if (servletLatency == null || !(servletRequest instanceof HttpServletRequest)) { <END> filterChain.doFilter(servletRequest, servletResponse); return; } HttpServletRequest request = (HttpServletRequest) servletRequest; String path = request.getRequestURI(); int lastSlash = StringUtils.ordinalIndexOf(path, "/", pathComponents+1); Histogram.Timer timer = servletLatency .labels(lastSlash == -1 ? path : path.substring(0, lastSlash), request.getMethod()) .startTimer(); try { filterChain.doFilter(servletRequest, servletResponse); } finally { timer.observeDuration(); } }</code><technical_language>servletLatency null</technical_language>

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { if (!(servletRequest instanceof HttpServletRequest)) { filterChain.doFilter(servletRequest, servletResponse); return; } HttpServletRequest request = (HttpServletRequest) servletRequest; String path = request.getRequestURI(); Histogram.Timer timer = histogram .labels(getComponents(path), request.getMethod()) .startTimer(); try { filterChain.doFilter(servletRequest, servletResponse); } finally { timer.observeDuration(); } }
Source:
<code>public ParsedRegistryID(String id) { try { id = URLDecoder.decode(id, StandardCharsets.UTF_8.displayName()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } List<String> textSegments = Splitter.on('/').omitEmptyStrings().splitToList(id); List<String> list = new ArrayList<>(textSegments); String firstTextSegment = list.get(0); <START> if (WORKFLOW_PREFIX.equalsIgnoreCase(firstTextSegment) || SERVICE_PREFIX.equals(firstTextSegment)) { <END> list.remove(0); tool = false; } checkToolId(list); registry = list.get(0); organization = list.get(1); name = list.get(2); toolName = list.size() > SEGMENTS_IN_ID ? list.get(SEGMENTS_IN_ID) : ""; }</code><technical_language>equalsIgnoreCase for SERVICE_PREFIX consistent WORKFLOW_PREFIX? is for workflows for legacy reasons, allow casing services</technical_language>

Target:
public ParsedRegistryID(String id) { try { id = URLDecoder.decode(id, StandardCharsets.UTF_8.displayName()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } List<String> textSegments = Splitter.on('/').omitEmptyStrings().splitToList(id); List<String> list = new ArrayList<>(textSegments); String firstTextSegment = list.get(0); if (WORKFLOW_PREFIX.equalsIgnoreCase(firstTextSegment) || SERVICE_PREFIX.equalsIgnoreCase(firstTextSegment)) { list.remove(0); tool = false; } checkToolId(list); registry = list.get(0); organization = list.get(1); name = list.get(2); toolName = list.size() > SEGMENTS_IN_ID ? list.get(SEGMENTS_IN_ID) : ""; }
Source:
<code>public void stop() { serverAnnouncer.unannounce(); <START> if (fireChiefExecutor != null) { <END> fireChiefExecutor.shutdownNow(); } }</code><technical_language>move serverAnnouncer.unannounce();</technical_language>

Target:
public void stop() { stopping = true; try { if (fireChiefExecutor != null) { fireChiefExecutor.shutdownNow(); Preconditions.checkState( fireChiefExecutor.awaitTermination(10, TimeUnit.SECONDS), "persistExecutor not terminated" ); } } catch (InterruptedException e) { throw new ISE(e, "Failed to shutdown fireChiefExecutor during stop()"); } serverAnnouncer.unannounce(); }
Source:
<code>public void refreshHooks() { log.debug("Refreshing hooks list"); List<VDSGroup> clusters = getClusterDao().getAll(); for (VDSGroup cluster : clusters) { <START> if (!cluster.supportsGlusterService() && GlusterFeatureSupported.glusterHooks(cluster.getcompatibility_version())) <END> { break; } List<VDS> upServers = getClusterUtils().getAllUpServers(cluster.getId()); List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS upServer : upServers) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue =runVdsCommand(VDSCommandType.GlusterHooksList, new VdsIdVDSCommandParametersBase(upServer.getId())); return new Pair<VDS, VDSReturnValue>(upServer, returnValue); } }); } List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); addOrUpdateHooks(cluster.getId(), pairResults); } }</code><technical_language>I this shold be: if (!(cluster.supportsGlusterService() && GlusterFeatureSupported.glusterHooks(cluster.getcompatibility_version()))) I mind putting && condition (everything !) a separate method called private boolean requiresHooksRefresh(VDSGroup cluster) if condition like: if (!requiresHooksRefresh(cluster)) { ... } I is easier understand</technical_language>

Target:
public void refreshHooks() { log.debug("Refreshing hooks list"); List<VDSGroup> clusters = getClusterDao().getAll(); for (VDSGroup cluster : clusters) { if (!supportsGlusterHookFeature(cluster)) { continue; } List<VDS> upServers = getClusterUtils().getAllUpServers(cluster.getId()); List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS upServer : upServers) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue =runVdsCommand(VDSCommandType.GlusterHooksList, new VdsIdVDSCommandParametersBase(upServer.getId())); return new Pair<VDS, VDSReturnValue>(upServer, returnValue); } }); } List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); addOrUpdateHooks(cluster.getId(), pairResults); } }
Source:
<code>private void exitATCommandMode() { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); try { connectionInterface.writeData(COMMAND_MODE_EXIT.getBytes()); Thread.sleep(DEFAULT_GUARD_TIME); <START> } catch (IOException e) { logger.error(e.getMessage(), e); } catch (InterruptedException e) { <END> logger.error(e.getMessage(), e); } }</code><technical_language>NP: exceptions compacted in a multi-catch block repeat code (the below)</technical_language>

Target:
private void exitATCommandMode() { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); try { connectionInterface.writeData(COMMAND_MODE_EXIT.getBytes()); Thread.sleep(DEFAULT_GUARD_TIME); } catch (IOException | InterruptedException e) { logger.error(e.getMessage(), e); } }
Source:
<code>@Test public void allowRunOverrides() throws Exception { story.addStep(new Statement() { @Override public void evaluate() throws Throwable { DockerTestUtil.assumeDocker(); WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + <START> " withDockerContainer(args: '--entrypoint top', image: 'ubuntu') {\n" + <END> " sh 'cat /proc/1/cmdline'\n" + " }\n" + "}", true)); WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0)); story.j.assertLogContains("top", b); } }); }</code><technical_language>do with</technical_language>

Target:
@Test public void allowRunOverrides() throws Exception { story.addStep(new Statement() { @Override public void evaluate() throws Throwable { DockerTestUtil.assumeDocker(); WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " withDockerContainer(args: '--entrypoint /sbin/init', image: 'ubuntu') {\n" + " sh 'grep /sbin/init /proc/1/cmdline'\n" + " }\n" + "}", true)); WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0)); } }); }
Source:
<code>public void waitForNextAttempt() throws InterruptedException { log.debug("Sleeping for {}ms before retrying operation", currentWait); sleep(currentWait); <START> waitIncrement *= waitFactor; <END> currentWait = Math.min(maxWait, currentWait + waitIncrement); }</code><technical_language>useful be, add a tiny bit of jitter a small random number</technical_language>

Target:
public void waitForNextAttempt() throws InterruptedException { double waitFactor = (1 + (rand.nextDouble() - 0.5) / 10.0) * currentBackOffFactor; if (!doTimeJitter) waitFactor = currentBackOffFactor; currentBackOffFactor = currentBackOffFactor * backOffFactor; log.debug("Sleeping for {}ms before retrying operation", currentWait); sleep(currentWait); if (backOffFactor == 1) currentWait = Math.min(maxWait, currentWait + waitIncrement); else if (backOffFactor > 1.0) { waitIncrement = (long) (Math.ceil(waitFactor * this.initialWait)); currentWait = Math.min(maxWait, initialWait + waitIncrement); } }
Source:
<code>public IComposedStyledString getStyledName() { final IStyledString.IComposedStyledString ret = new ComposedStyledString(getName()); <START> int unresolvedRealDiffs = Iterables.size(Iterables.filter(getDifferences(), unresolvedReal)); <END> int unresolvedPseudoDiffs = Iterables.size(Iterables.filter(getDifferences(), unresolvedPseudo)); ret.append(" [" + unresolvedRealDiffs + " real and " + unresolvedPseudoDiffs + " pseudo unresolved difference", Style.DECORATIONS_STYLER); if (unresolvedRealDiffs + unresolvedPseudoDiffs > 1) { ret.append("s", Style.DECORATIONS_STYLER); } ret.append("]", Style.DECORATIONS_STYLER); return ret; }</code><technical_language>.. replace "unrsolvedReal" "and(hasState(DifferenceState.UNRESOLVED), hasConflict(ConflictKind.REAL))"</technical_language>

Target:
public IComposedStyledString getStyledName() { final IStyledString.IComposedStyledString ret = new ComposedStyledString(getName()); int unresolvedRealDiffs = Iterables.size(Iterables.filter(getDifferences(), and( hasState(DifferenceState.UNRESOLVED), hasConflict(ConflictKind.REAL)))); int unresolvedPseudoDiffs = Iterables.size(Iterables.filter(getDifferences(), and( hasState(DifferenceState.UNRESOLVED), hasConflict(ConflictKind.PSEUDO)))); ret.append(" [" + unresolvedRealDiffs + " real and " + unresolvedPseudoDiffs + " pseudo unresolved difference", Style.DECORATIONS_STYLER); if (unresolvedRealDiffs + unresolvedPseudoDiffs > 1) { ret.append("s", Style.DECORATIONS_STYLER); } ret.append("]", Style.DECORATIONS_STYLER); return ret; }
Source:
<code>private Object cast(String valueAsString, Class<?> type) throws ParseException { <START> if (String.class.getCanonicalName().equals(type.getCanonicalName())) { <END> return valueAsString; } else if (Byte.class.getCanonicalName().equals(type.getCanonicalName())) { return Byte.valueOf(valueAsString); } else if (Short.class.getCanonicalName().equals(type.getCanonicalName())) { return Short.valueOf(valueAsString); } else if (Integer.class.getCanonicalName().equals(type.getCanonicalName())) { return Integer.valueOf(valueAsString); } else if (Long.class.getCanonicalName().equals(type.getCanonicalName())) { return Long.valueOf(valueAsString); } else if (Float.class.getCanonicalName().equals(type.getCanonicalName())) { return Float.valueOf(valueAsString); } else if (Double.class.getCanonicalName().equals(type.getCanonicalName())) { return Double.valueOf(valueAsString); } else if (Boolean.class.getCanonicalName().equals(type.getCanonicalName())) { return Boolean.valueOf(valueAsString); } else if (Date.class.getCanonicalName().equals(type.getCanonicalName())) { return KnoxShellTableJSONSerializer.JSON_DATE_FORMAT.parse(valueAsString); } return type.cast(valueAsString); }</code><technical_language>instanceof work here? check Types</technical_language>

Target:
private Object cast(String valueAsString, Class<?> type) throws ParseException { if (String.class == type) { return valueAsString; } else if (Byte.class == type) { return Byte.valueOf(valueAsString); } else if (Short.class == type) { return Short.valueOf(valueAsString); } else if (Integer.class == type) { return Integer.valueOf(valueAsString); } else if (Long.class == type) { return Long.valueOf(valueAsString); } else if (Float.class == type) { return Float.valueOf(valueAsString); } else if (Double.class == type) { return Double.valueOf(valueAsString); } else if (Boolean.class == type) { return Boolean.valueOf(valueAsString); } else if (Date.class == type) { return KnoxShellTableJSONSerializer.JSON_DATE_FORMAT.parse(valueAsString); } return type.cast(valueAsString); }
Source:
<code>private Block getProperBlock(WorldProvider worldProvider, Vector3i location) { List<Side> sides = new ArrayList<>(); for (Side side : new Side[] {Side.TOP, Side.BOTTOM}) { Vector3i neighborLocation = new Vector3i(location); neighborLocation.add(side.getVector3i()); if (worldProvider.isBlockRelevant(neighborLocation)) { Block neighborBlock = worldProvider.getBlock(neighborLocation); final BlockFamily blockFamily = neighborBlock.getBlockFamily(); if (blockFamily instanceof RomanColumnFamily) { sides.add(side); } } } <START> if (sides.contains(Side.BOTTOM) && !sides.contains(Side.TOP)) { <END> return BLOCKS.get(SideBitFlag.getSide(Side.TOP)); } else if (!sides.contains(Side.BOTTOM) && sides.contains(Side.TOP)) { return BLOCKS.get(SideBitFlag.getSide(Side.BOTTOM)); } else if (sides.contains(Side.BOTTOM) && sides.contains(Side.TOP)) { return BLOCKS.get(SideBitFlag.getSides(Side.BOTTOM, Side.TOP)); } else if (!sides.contains(Side.BOTTOM) && !sides.contains(Side.TOP)) { return BLOCKS.get(SideBitFlag.getSides(Side.BOTTOM, Side.TOP)); } return null; }</code><technical_language>argue this is overly verbose defeats purpose of a map in place. do is add results in bytes for map bit patterns in map. byte sides = (byte)0; for (Side side : new Side[] {Side.TOP, Side.BOTTOM}) { Vector3i neighborLocation = new Vector3i(location); neighborLocation.add(side.getVector3i()); if (worldProvider.isBlockRelevant(neighborLocation)) { Block neighborBlock = worldProvider.getBlock(neighborLocation); final BlockFamily blockFamily = neighborBlock.getBlockFamily(); if (blockFamily instanceof RomanColumnFamily) { sides += SidbitFlag.getSide(side); } } } return blocks.get(sides); // Returns a normal column block</technical_language>

Target:
private Block getProperBlock(WorldProvider worldProvider, Vector3i location) { byte connections = 0; for (Side connectSide : new Side[] {Side.TOP, Side.BOTTOM}) { if (this.connectionCondition(location, connectSide)) { connections += SideBitFlag.getSide(connectSide); } } return blocks.get(connections); }
Source:
<code>public void play(Location location) { for (String name : effects) { if (name.startsWith("SMOKE")) { name = trimSpace(name.substring(5)); Integer data = null; if (name.length() >= 2) { data = DIR_NAMES.get(name.substring(0, 2)); } if (data == null && name.length() >= 1) { data = DIR_NAMES.get(name.substring(0, 1)); } if (data == null) { try { data = ParseUtil.parseInt(name, null); } catch (NumberFormatException ignored) { } } if (data == null) { data = 0; } if (data == 4) { play(location.clone().add(0.0, 0.5, 0.0), org.bukkit.Effect.SMOKE, data); } else { play(location, org.bukkit.Effect.SMOKE, data); } continue; } else if (name.startsWith("RECORD")) { name = trimSpace(name.substring(6)); if (name.startsWith("PLAY")) { name = trimSpace(name.substring(4)); } Integer data = DISK_NAMES.get(name); if (data == null) { try { data = ParseUtil.parseInt(name, null); } catch (NumberFormatException ignored) { } } if (data == null) { data = 2257; } play(location, org.bukkit.Effect.RECORD_PLAY, data); continue; } org.bukkit.Effect effect = ParseUtil.parseEnum(org.bukkit.Effect.class, name, null); if (effect != null && !effect.toString().toUpperCase(Locale.ENGLISH).endsWith("_BREAK")) { play(location, effect, 0); continue; } Sound sound = ParseUtil.parseEnum(Sound.class, name, null); if (sound != null) { location.getWorld().playSound(location, sound, volume, pitch); continue; } <START> location.getWorld().playSound(location, name, volume, pitch); <END> } }</code><technical_language>This method exist in 1.8.8. Custom resource pack sounds supported [sound sign](<LINK_0> sound sign allows longer sound names split 2 lines</technical_language>

Target:
public void play(Location location) { for (String name : effects) { if (name.startsWith("SMOKE")) { name = trimSpace(name.substring(5)); Integer data = null; if (name.length() >= 2) { data = DIR_NAMES.get(name.substring(0, 2)); } if (data == null && name.length() >= 1) { data = DIR_NAMES.get(name.substring(0, 1)); } if (data == null) { try { data = ParseUtil.parseInt(name, null); } catch (NumberFormatException ignored) { } } if (data == null) { data = 0; } if (data == 4) { play(location.clone().add(0.0, 0.5, 0.0), org.bukkit.Effect.SMOKE, data); } else { play(location, org.bukkit.Effect.SMOKE, data); } continue; } else if (name.startsWith("RECORD")) { name = trimSpace(name.substring(6)); if (name.startsWith("PLAY")) { name = trimSpace(name.substring(4)); } Integer data = DISK_NAMES.get(name); if (data == null) { try { data = ParseUtil.parseInt(name, null); } catch (NumberFormatException ignored) { } } if (data == null) { data = 2257; } play(location, org.bukkit.Effect.RECORD_PLAY, data); continue; } org.bukkit.Effect effect = ParseUtil.parseEnum(org.bukkit.Effect.class, name, null); if (effect != null && !effect.toString().toUpperCase(Locale.ENGLISH).endsWith("_BREAK")) { play(location, effect, 0); continue; } Sound sound = ParseUtil.parseEnum(Sound.class, name, null); if (sound != null) { location.getWorld().playSound(location, sound, volume, pitch); continue; } play(location, name, volume, pitch); } }
Source:
<code>protected void saveCredentialsInSmartLock(LoginListener loginListener, String username, String password) { if (loginListener != null) { <START> loginListener.saveCredentials(username, password, mAccountStore.getAccount().getDisplayName(), <END> Uri.parse(mAccountStore.getAccount().getAvatarUrl())); } }</code><technical_language>I this repetitive but, name interface method saveCredentialsInSmartLock well? saveCredentials feels generalized, especially interface. WDYT</technical_language>

Target:
protected void saveCredentialsInSmartLock(LoginListener loginListener, String username, String password) { if (loginListener != null) { loginListener.saveCredentialsInSmartLock(username, password, mAccountStore.getAccount().getDisplayName(), Uri.parse(mAccountStore.getAccount().getAvatarUrl())); } }
Source:
<code>public void tearDown() throws Exception { <START> jedis.disconnect(); jedis1.disconnect(); <END> }</code><technical_language>Follow setUp()</technical_language>

Target:
public void tearDown() throws Exception { lfuJedis.disconnect(); super.tearDown(); }
Source:
<code>private boolean redefineVmCheckpoints() { List<VmCheckpoint> checkpoints = vmCheckpointDao.getAllForVm(getVmId()); if (checkpoints.isEmpty()) { log.info("No previous VM checkpoints found for VM '{}', skip redefining VM checkpoints", getVmId()); return true; } List<Guid> definedCheckpointsIds = performVmCheckpointsOperation(VDSCommandType.ListVmCheckpoints, new VdsAndVmIDVDSParametersBase(getVdsId(), getVmId())); if (definedCheckpointsIds != null && <START> definedCheckpointsIds.contains(getParameters().getVmBackup() .getFromCheckpointId())) { <END> log.info("Checkpoints chain is already defined for VM '{}'", getVmId()); return true; } for (VmCheckpoint checkpoint : checkpoints) { List<Guid> redefinedCheckpointsIds = performVmCheckpointsOperation(VDSCommandType.RedefineVmCheckpoints, new VmCheckpointsVDSParameters(getVdsId(), getVmId(), List.of(checkpoint))); if (redefinedCheckpointsIds == null || redefinedCheckpointsIds.isEmpty()) { return false; } } return true; }</code><technical_language>for readability, move condition a new line</technical_language>

Target:
private boolean redefineVmCheckpoints() { List<VmCheckpoint> checkpoints = vmCheckpointDao.getAllForVm(getVmId()); if (checkpoints.isEmpty()) { log.info("No previous VM checkpoints found for VM '{}', skip redefining VM checkpoints", getVmId()); return true; } VDSReturnValue listVdsReturnValue = performVmCheckpointsOperation(VDSCommandType.ListVmCheckpoints, new VdsAndVmIDVDSParametersBase(getVdsId(), getVmId())); List<Guid> definedCheckpointsIds = (List<Guid>) listVdsReturnValue.getReturnValue(); if (definedCheckpointsIds != null && definedCheckpointsIds.contains(getParameters().getVmBackup() .getFromCheckpointId())) { log.info("Checkpoints chain is already defined for VM '{}'", getVmId()); return true; } for (VmCheckpoint checkpoint : checkpoints) { VDSReturnValue redefineVdsReturnValue = performVmCheckpointsOperation(VDSCommandType.RedefineVmCheckpoints, new VmCheckpointsVDSParameters(getVdsId(), getVmId(), List.of(checkpoint))); VmCheckpointInfo vmCheckpointInfo = (VmCheckpointInfo) redefineVdsReturnValue.getReturnValue(); if (vmCheckpointInfo == null || vmCheckpointInfo.getError() != null || vmCheckpointInfo.getCheckpointsUuids().length == 0) { return false; } } return true; }
Source:
<code>public static List<RGBColor> getDefaultPalette() { return Arrays.asList( BLUE, RED, GREEN, MAGENTA, CYAN, DARK_BLUE, DARK_RED, DARK_GREEN, <START> DARK_BLUE, DARK_RED, DARK_GREEN, DARK_MAGENTA, <END> DARK_CYAN, DARK_YELLOW, BLACK, GRAY, YELLOW); }</code><technical_language>repeated colors</technical_language>

Target:
public static List<RGBColor> getDefaultPalette() { return Arrays.asList( BLUE, RED, GREEN, MAGENTA, CYAN, DARK_BLUE, DARK_RED, DARK_GREEN, DARK_MAGENTA, DARK_CYAN, DARK_YELLOW, BLACK, GRAY, YELLOW); }
Source:
<code>private boolean dispatchToAPI(MessageContext synCtx) { Collection<API> apiSet = synCtx.getEnvironment().getSynapseConfiguration().getAPIs(); List<API> defaultStrategyApiSet = new ArrayList<API>(apiSet); API defaultAPI = null; if (null != synCtx.getProperty(RESTConstants.IS_ALREADY_PROCESSED)) { API api = (API) synCtx.getProperty("PROCESSED_API"); identifyAPI(api, synCtx); } else { for (API api : apiSet) { identifyAPI(api, synCtx); } <START> for (API api : defaultStrategyApiSet) { <END> api.setLogSetterValue(); if (api.canProcess(synCtx)) { if (log.isDebugEnabled()) { log.debug("Located specific API: " + api.getName() + " for processing message"); } apiProcess(synCtx, api); return true; } } } for (API api : defaultStrategyApiSet) { api.setLogSetterValue(); if (api.canProcess(synCtx)) { if (log.isDebugEnabled()) { log.debug("Located specific API: " + api.getName() + " for processing message"); } apiProcess(synCtx, api); return true; } } if (defaultAPI != null && defaultAPI.canProcess(synCtx)) { defaultAPI.setLogSetterValue(); apiProcess(synCtx, defaultAPI); return true; } return false; }</code><technical_language>combine this for loop loop</technical_language>

Target:
private boolean dispatchToAPI(MessageContext synCtx) { Collection<API> apiSet = synCtx.getEnvironment().getSynapseConfiguration().getAPIs(); List<API> defaultStrategyApiSet = new ArrayList<API>(apiSet); API defaultAPI = null; if (null != synCtx.getProperty(RESTConstants.IS_PROMETHEUS_ENGAGED)) { API api = (API) synCtx.getProperty(RESTConstants.PROCESSED_API); identifyAPI(api, synCtx, defaultStrategyApiSet); } else { for (API api : apiSet) { identifyAPI(api, synCtx, defaultStrategyApiSet); } for (API api : defaultStrategyApiSet) { api.setLogSetterValue(); if (api.canProcess(synCtx)) { if (log.isDebugEnabled()) { log.debug("Located specific API: " + api.getName() + " for processing message"); } apiProcess(synCtx, api); return true; } } } for (API api : defaultStrategyApiSet) { api.setLogSetterValue(); if (api.canProcess(synCtx)) { if (log.isDebugEnabled()) { log.debug("Located specific API: " + api.getName() + " for processing message"); } apiProcess(synCtx, api); return true; } } if (defaultAPI != null && defaultAPI.canProcess(synCtx)) { defaultAPI.setLogSetterValue(); apiProcess(synCtx, defaultAPI); return true; } return false; }
Source:
<code>protected void setJcrSessionUserData(ResourceResolver resourceResolver) { try { resourceResolver.adaptTo(Session.class).getWorkspace().getObservationManager().setUserData(EVENT_DATA); } catch (RepositoryException e) { <START> log.warn("Unable to set user-data to [ " + EVENT_DATA + " ]", e); <END> } }</code><technical_language>please log.warn("Unable set user-data [ ]", EVENT_DATA, e); instead string concatenation (much more readable)</technical_language>

Target:
protected void setJcrSessionUserData(ResourceResolver resourceResolver) { try { resourceResolver.adaptTo(Session.class).getWorkspace().getObservationManager().setUserData(EVENT_DATA); } catch (RepositoryException e) { log.warn("Unable to set user-data to [ ]", EVENT_DATA, e); } }
Source:
<code>public final <T> TypeAdapter<T> create(@NonNull Gson gson, @NonNull TypeToken<T> typeToken) { Class<?> rawType = typeToken.getRawType(); Set<Field> requiredFields = collectRequiredFields(rawType); if (!requiredFields.isEmpty()) { setFieldsAccessible(requiredFields, true); return new Adapter<>(gson.getAdapter(JsonElement.class), gson.getDelegateAdapter(this, typeToken), requiredFields); } <START> return null; <END> }</code><technical_language>Feel free ignore: I handle null case feels special nonempty case is generic: if (requiredFields.isEmpty()) { return null } setFieldsAccessible(requiredFields, true); return new Adapter<>(gson.getAdapter(JsonElement.class), gson.getDelegateAdapter(this, typeToken), requiredFields);</technical_language>

Target:
public final <T> TypeAdapter<T> create(@NonNull Gson gson, @NonNull TypeToken<T> typeToken) { Class<?> rawType = typeToken.getRawType(); Set<Field> requiredFields = collectRequiredFields(rawType); if (requiredFields.isEmpty()) { return null; } setFieldsAccessible(requiredFields, true); return new Adapter<>(gson.getDelegateAdapter(this, typeToken), requiredFields); }
Source:
<code>protected void submitCallback(int code) { <START> System.out.println("submitCallback "+code); <END> if (BKException.Code.OK == code) { numPendingEntries--; if (numPendingEntries != 0) { return; } } if (!complete.compareAndSet(false, true)) { return; } long latencyNanos = MathUtils.elapsedNanos(requestTimeNanos); if (code != BKException.Code.OK) { long firstUnread = LedgerHandle.INVALID_ENTRY_ID; for (LedgerEntryRequest req : seq) { if (!req.isComplete()) { firstUnread = req.getEntryId(); break; } } LOG.error("Read of ledger entry failed: L{} E{}-E{}, Heard from : bitset = {}. First unread entry is {}", new Object[] { lh.getId(), startEntryId, endEntryId, heardFromHosts, heardFromHostsBitSet, firstUnread }); readOpLogger.registerFailedEvent(latencyNanos, TimeUnit.NANOSECONDS); } else { readOpLogger.registerSuccessfulEvent(latencyNanos, TimeUnit.NANOSECONDS); } cancelSpeculativeTask(true); cb.readComplete(code, lh, PendingReadOp.this, PendingReadOp.this.ctx); cb = null; }</code><technical_language>please remove this line</technical_language>

Target:
protected void submitCallback(int code) { if (BKException.Code.OK == code) { numPendingEntries--; if (numPendingEntries != 0) { return; } } if (!complete.compareAndSet(false, true)) { return; } long latencyNanos = MathUtils.elapsedNanos(requestTimeNanos); if (code != BKException.Code.OK) { long firstUnread = LedgerHandle.INVALID_ENTRY_ID; for (LedgerEntryRequest req : seq) { if (!req.isComplete()) { firstUnread = req.getEntryId(); break; } } LOG.error("Read of ledger entry failed: L{} E{}-E{}, Heard from : bitset = {}. First unread entry is {}", new Object[] { lh.getId(), startEntryId, endEntryId, heardFromHosts, heardFromHostsBitSet, firstUnread }); readOpLogger.registerFailedEvent(latencyNanos, TimeUnit.NANOSECONDS); } else { readOpLogger.registerSuccessfulEvent(latencyNanos, TimeUnit.NANOSECONDS); } cancelSpeculativeTask(true); cb.readComplete(code, lh, PendingReadOp.this, PendingReadOp.this.ctx); cb = null; }
Source:
<code>protected AbstractRebaseCommandHandler(String jobname, String dialogMessage) { this.dialogMessage = dialogMessage; <START> this.jobname = jobname; <END> }</code><technical_language>unnecessarily flipped order of statements diff unnecessarily larger</technical_language>

Target:
protected AbstractRebaseCommandHandler(String jobname, String dialogMessage) { this.jobname = jobname; this.dialogMessage = dialogMessage; }
Source:
<code><START> public void verifyThereIsError(){ <END> waitForElementByElement(errorField); if(errorField.getText().isEmpty()){ PageObjectLogging.log("verifyThereIsError", "Template was found. Error was not showed.",false,driver); }else{ PageObjectLogging.log("verifyThereIsError", "Template was not found. Error was showed",true,driver); } }</code><technical_language>please add space {</technical_language>

Target:
public void verifyThereIsError() { waitForElementVisibleByElement(errorField); Assertion.assertEquals(checkIfElementOnPage(errorField), true); }
Source:
<code>private int pushIndexUpdateOnReorder(final String schemeId) throws DotDataException { <START> final Set<String> identifiers = workFlowFactory.findNullTaskContentletIdenitfiersForScheme(schemeId); <END> return distributedJournalAPI.addIdentifierReindex(identifiers); }</code><technical_language>is a typo</technical_language>

Target:
private int pushIndexUpdateOnReorder(final String schemeId) throws DotDataException { final Set<String> identifiers = workFlowFactory.findNullTaskContentletIdentifiersForScheme(schemeId); return distributedJournalAPI.addIdentifierReindex(identifiers); }
Source:
<code>public Date getLatestDateOfCube(LensSessionHandle sessionid, String cubeName, String timeDimension) throws LensException, HiveException { <START> Cube c = (Cube) getClient(sessionid).getCube(cubeName); <END> String partitionColumn = c.getPartitionColumnOfTimeDim(timeDimension); List<FactTable> factTables = getAllFactsOfCube(sessionid, cubeName); Date latestDate = null; if (factTables != null && !factTables.isEmpty()) { for (FactTable factTable : factTables) { List<String> storages = getStoragesOfFact(sessionid, factTable.getName()); if (storages != null && !storages.isEmpty()) { for (String storage : storages) { String storageTableName = MetastoreUtil.getFactStorageTableName(factTable.getName(), storage); List<Partition> parts = getClient(sessionid).getPartitionsByFilter(storageTableName, StorageConstants.getLatestPartFilter(partitionColumn)); if (parts.size() == 1) { Date tmpDate = getClient(sessionid).getLatestTimeStamp(parts.get(0), partitionColumn); if (latestDate == null || latestDate.before(tmpDate)) { latestDate = tmpDate; } } else if (parts.size() > 1) { throw new LensException("CubeMetastoreClient return more than 1 partitions for filter " + partitionColumn + "='latest'"); } else { throw new LensException("No latest partition found."); } } } } } return latestDate; }</code><technical_language>check if c is instanceof Cube if throw bad request exception</technical_language>

Target:
public Date getLatestDateOfCube(LensSessionHandle sessionid, String cubeName, String timeDimension) throws LensException, HiveException { CubeInterface ci = getClient(sessionid).getCube(cubeName); if (!(ci instanceof Cube)) { throw new BadRequestException("cubeName : " + cubeName + " is not a base cube."); } Cube c = (Cube) ci; String partitionColumn = c.getPartitionColumnOfTimeDim(timeDimension); List<FactTable> factTables = getAllFactsOfCube(sessionid, cubeName); Date latestDate = null; if (factTables != null && !factTables.isEmpty()) { for (FactTable factTable : factTables) { List<String> storages = getStoragesOfFact(sessionid, factTable.getName()); if (storages != null && !storages.isEmpty()) { for (String storage : storages) { String storageTableName = MetastoreUtil.getFactStorageTableName(factTable.getName(), storage); List<Partition> parts = getClient(sessionid).getPartitionsByFilter(storageTableName, StorageConstants.getLatestPartFilter(partitionColumn)); if (parts.size() == 1) { Date tmpDate = getClient(sessionid).getLatestTimeStamp(parts.get(0), partitionColumn); if (latestDate == null || latestDate.before(tmpDate)) { latestDate = tmpDate; } } else if (parts.size() > 1) { throw new LensException("CubeMetastoreClient return more than 1 partitions for filter " + partitionColumn + "='latest'"); } } } } } return latestDate; }
Source:
<code>public final IAnalysisModule getAnalysisModule(String analysisId) { <START> if (!fAnalysisModules.containsKey(analysisId)) { <END> return null; } return fAnalysisModules.get(analysisId); }</code><technical_language>Unnecessary check, get() return null</technical_language>

Target:
public final IAnalysisModule getAnalysisModule(String analysisId) { return fAnalysisModules.get(analysisId); }
Source:
<code>public void run() throws Exception { List<String> args = (List <String>)argMap.get("__other__"); String action = args.remove(0); if(!actions.containsKey(action)) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } <START> actions.get(action).getDeclaredConstructor(getClass()).newInstance(this).run(); <END> }</code><technical_language>a reference instance need do dynamic here. do this anonymous class I showed. in case instance</technical_language>

Target:
public void run() throws Exception { List<String> argsList = (List <String>)args.get("__other__"); String action = argsList.remove(0); if(!actions.containsKey(action)) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } actions.get(action).run(); }
Source:
<code>public void enter() { super.enter(); if (!mBluetoothRouteManager.isInbandRingingEnabled()) { <START> setSpeakerphoneOn(false); <END> } CallAudioState newState = new CallAudioState(mIsMuted, ROUTE_BLUETOOTH, mAvailableRoutes); setSystemAudioState(newState); updateInternalCallAudioState(); }</code><technical_language>need do this. this stage setSpeakerphoneOn(true/false) called this applies in call state. Hall, called in place? Is a reset speakerphone state starting call</technical_language>

Target:
public void enter() { super.enter(); setSpeakerphoneOn(false); CallAudioState newState = new CallAudioState(mIsMuted, ROUTE_BLUETOOTH, mAvailableRoutes); setSystemAudioState(newState); updateInternalCallAudioState(); }
Source:
<code><START> protected void assertSlicePositionUnchecked(Block block, int internalPosition, Slice expectedSliceValue) <END> { int num128Integers = Math.min(getNum128Integers(expectedSliceValue.length()), block.getPositionCount() - internalPosition + block.getOffsetBase()); for (int offset = 0; offset < num128Integers; offset++) { assertEquals(expectedSliceValue.length(), SIZE_OF_LONG * 2); assertEquals(block.getSlice(internalPosition - block.getOffsetBase(), offset, SIZE_OF_LONG * 2), expectedSliceValue.slice(offset, expectedSliceValue.length())); assertEquals(block.getSliceLength(internalPosition - block.getOffsetBase()), SIZE_OF_LONG * 2); assertTrue(block.bytesEqual(internalPosition - block.getOffsetBase(), offset, expectedSliceValue, 0, SIZE_OF_LONG * 2)); assertFalse(block.bytesEqual(internalPosition - block.getOffsetBase(), offset, Slices.utf8Slice("XXXXXXXXXXXXXXXX"), 0, SIZE_OF_LONG * 2)); } }</code><technical_language>@yingsu00 this method implemented assertSlicePosition(block, internalPosition - block.getOffsetBase(), expectedSliceValue)</technical_language>

Target:
protected void assertSlicePositionUnchecked(Block block, int internalPosition, Slice expectedSliceValue) { assertSlicePosition(block, internalPosition - block.getOffsetBase(), expectedSliceValue); }
Source:
<code>public void createTaskManagerPod(KubernetesPod kubernetesPod) { <START> CompletableFuture.runAsync(() -> { <END> final Deployment masterDeployment = this.internalClient .apps() .deployments() .inNamespace(this.nameSpace) .withName(KubernetesUtils.getDeploymentName(clusterId)) .get(); if (masterDeployment == null) { throw new RuntimeException( "Failed to find Deployment named " + clusterId + " in namespace " + this.nameSpace); } setOwnerReference(masterDeployment, Collections.singletonList(kubernetesPod.getInternalResource())); LOG.debug("Start to create pod with metadata {}, spec {}", kubernetesPod.getInternalResource().getMetadata(), kubernetesPod.getInternalResource().getSpec()); this.internalClient .pods() .inNamespace(this.nameSpace) .create(kubernetesPod.getInternalResource()); }, executorWrapper.getExecutor()); }</code><technical_language>ignore error result of this async call? If called code throws exception in executor thread (e.g. http request failure), lost. happen KubernetesResourceManager get PodCallbackHandler#onError callback pod allocation failure? in stopPod, log if async request fails</technical_language>

Target:
public CompletableFuture<Void> createTaskManagerPod(KubernetesPod kubernetesPod) { return CompletableFuture.runAsync( () -> { final Deployment masterDeployment = this.internalClient .apps() .deployments() .inNamespace(this.nameSpace) .withName(KubernetesUtils.getDeploymentName(clusterId)) .get(); if (masterDeployment == null) { throw new RuntimeException( "Failed to find Deployment named " + clusterId + " in namespace " + this.nameSpace); } setOwnerReference(masterDeployment, Collections.singletonList(kubernetesPod.getInternalResource())); LOG.debug("Start to create pod with metadata {}, spec {}", kubernetesPod.getInternalResource().getMetadata(), kubernetesPod.getInternalResource().getSpec()); this.internalClient .pods() .inNamespace(this.nameSpace) .create(kubernetesPod.getInternalResource()); }, kubeClientExecutorService); }
Source:
<code>private void listenToDocumentChanges() throws IllegalArgumentException { IDocumentProvider documentProvider = editor.getDocumentProvider(); document = documentProvider.getDocument(editor.getEditorInput()); documentListener = new IDocumentListener() { @Override public void documentChanged(DocumentEvent event) { <START> int modCount = Math.max(event.getLength(), <END> event.getText().length()); EditorEvent newEvent = new EditorEvent(editor, EventType.SUBSEQUENT_EDIT); newEvent.setModCount(modCount); eventManager.update(newEvent); } @Override public void documentAboutToBeChanged(DocumentEvent event) { eventManager.update(new EditorEvent(editor, EventType.START_EDIT)); } }; document.addDocumentListener(documentListener); }</code><technical_language>event.getLength() more so, event.getText().length() null here? Do need protect this</technical_language>

Target:
private void listenToDocumentChanges() throws IllegalArgumentException { IDocumentProvider documentProvider = editor.getDocumentProvider(); document = documentProvider.getDocument(editor.getEditorInput()); documentListener = new IDocumentListener() { @Override public void documentChanged(DocumentEvent event) { int textLength = 0; if (event.getText() != null) { textLength = event.getText().length(); } int modCount = Math.max(event.getLength(), textLength); EditorEvent newEvent = new EditorEvent(editor, EventType.SUBSEQUENT_EDIT); newEvent.setModCount(modCount); eventManager.update(newEvent); } @Override public void documentAboutToBeChanged(DocumentEvent event) { eventManager .update(new EditorEvent(editor, EventType.START_EDIT)); } }; document.addDocumentListener(documentListener); }
Source:
<code>public boolean equals(Object obj) { if(obj == null){ return false; } if(!(obj instanceof TupleSerializer<?>)){ return false; } TupleSerializer<?> otherTS = (TupleSerializer<?>) obj; return (otherTS.tupleClass == this.tupleClass) && <START> this.fieldSerializers.equals(fieldSerializers); <END> }</code><technical_language>I this work. need check equals element of array. Arrays#deepEquals(...)</technical_language>

Target:
public boolean equals(Object obj) { if(obj == null){ return false; } if(!(obj instanceof TupleSerializer<?>)){ return false; } TupleSerializer<?> otherTS = (TupleSerializer<?>) obj; return (otherTS.tupleClass == this.tupleClass) && Arrays.deepEquals(this.fieldSerializers,fieldSerializers); }
Source:
<code>public int getPositiveAmount(final MagicEvent event) { <START> if (this == MagicAmountFactory.NegXCost) { <END> return Math.min(getAmount(event), 0); } else { return Math.max(getAmount(event), 0); } }</code><technical_language>applies here, remove special case</technical_language>

Target:
public int getPositiveAmount(final MagicEvent event) { return Math.max(getAmount(event), 0); }
Source:
<code>public static void beforeClass() { SWTBotUtils.initialize(); SWTBotPreferences.TIMEOUT = 20000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; fLogger.removeAllAppenders(); fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", fBot); SWTBotUtils.switchToPerspective(KERNEL_PERSPECTIVE_ID); SWTBotUtils.createProject(TRACE_PROJECT_NAME); <START> String tracePath = null; try { tracePath = FileLocator.toFileURL(CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL()).getPath(); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, tracePath, KERNEL_TRACE_TYPE); WaitUtils.waitForJobs(); } catch (IOException e) { } <END> Assume.assumeNotNull(tracePath); }</code><technical_language>do want fail silently</technical_language>

Target:
public static void beforeClass() throws IOException { SWTBotUtils.initialize(); SWTBotPreferences.TIMEOUT = 20000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; fLogger.removeAllAppenders(); fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", fBot); SWTBotUtils.switchToPerspective(KERNEL_PERSPECTIVE_ID); SWTBotUtils.createProject(TRACE_PROJECT_NAME); String tracePath = FileLocator.toFileURL(CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL()).getPath(); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, tracePath, KERNEL_TRACE_TYPE); SWTBotUtils.activateEditor(fBot, CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL().getPath().replaceAll("/", "")); Assume.assumeNotNull(tracePath); }
Source:
<code>public void reset(WritableByteChannel channel) throws IOException { <START> this.channel = channel; <END> }</code><technical_language>This code be: this.channel.close();</technical_language>

Target:
public void reset(WritableByteChannel channel) throws IOException { this.channel.close(); this.channel = channel; }
Source:
<code>public LocalAgentRegistryImpl() throws IOException { this.agents = new HashMap<>(); <START> IoUtil.getResources(this.getClass(), AGENTS, inputStream -> { <END> final Agent agent; try { agent = DtoFactory.getInstance().createDtoFromJson(inputStream, AgentDto.class); agents.put(agent.getName(), agent); } catch (IOException e) { LOG.error("Can't create agent.", e); } }); }</code><technical_language>close stream</technical_language>

Target:
public LocalAgentRegistryImpl() throws IOException { this.agents = new HashMap<>(); findAgents(); this.agentNames = ImmutableList.copyOf(agents.keySet()); }
Source:
<code>public Config addMerkleTreeConfig(MerkleTreeConfig merkleTreeConfig) { final String mapName = merkleTreeConfig.getMapName(); <START> if (StringUtil.isNullOrEmpty(mapName)) { <END> throw new IllegalArgumentException("Merkle tree config must define a map name"); } return this; }</code><technical_language>Preconditions.checkHasText() for same, a fit</technical_language>

Target:
public Config addMerkleTreeConfig(MerkleTreeConfig merkleTreeConfig) { final String mapName = merkleTreeConfig.getMapName(); Preconditions.checkHasText(mapName, "Merkle tree config must define a map name"); return this; }
Source:
<code><START> public static float convertRawToCelsius(final int tempRaw, final Optional<Integer> tempRawLastMinOptional) { <END> if (!tempRawLastMinOptional.isPresent()) { return DataUtils.dbIntToFloat(tempRaw); } final int tempCalibration = getTempCalibration(tempRaw, tempRawLastMinOptional.get()); return DataUtils.dbIntToFloat(tempRaw - tempCalibration); }</code><technical_language>add a usage note here: (i.e. smooth output derivative output noisy</technical_language>

Target:
public static float convertRawToCelsius(final int tempRaw, final Optional<Integer> tempRawLastMinOptional) { if (!tempRawLastMinOptional.isPresent()) { return DataUtils.dbIntToFloat(tempRaw - TEMP_ALPHA_TWO); } final int tempCalibration = getTempCalibration(tempRaw, tempRawLastMinOptional.get()); return DataUtils.dbIntToFloat(tempRaw - tempCalibration); }
Source:
<code><START> private <T extends SmeltingRecipe> void onSmeltingRecipeAdded(RecipeEvent.Add<T> e) { <END> }</code><technical_language>is this blank?</technical_language>

Target:
private <T extends SmeltingRecipe> void onSmeltingRecipeAdded(RecipeEvent.Add<T> e) { recipes.add(e.recipe); }
Source:
<code><START> private boolean write(Model model, org.uberfire.java.nio.file.Path pathToPOMXML, IOService ioService) { <END> ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { writer.write(baos, model); ioService.write(pathToPOMXML, new String(baos.toByteArray(), StandardCharsets.UTF_8)); return true; } catch (Exception e) { return false; } finally { try { baos.close(); } catch (IOException e) { } } }</code><technical_language>Do need return this method (since return place this method)</technical_language>

Target:
private void write(Model model, org.uberfire.java.nio.file.Path pathToPOMXML, IOService ioService) { try (ByteArrayOutputStream baos = new ByteArrayOutputStream()){ writer.write(baos, model); ioService.write(pathToPOMXML, new String(baos.toByteArray(), StandardCharsets.UTF_8)); } catch (Exception e) { logger.error(e.getMessage(), e); } }