auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testWrap() { IntObjectMap<Object> map = new SynchronizedIntObjectHashMap<>(); StreamIdSupplier s = new StreamIdSupplier(Integer.MAX_VALUE - 3); assertEquals(2147483646, s.nextStreamId(map)); <START> assertEquals(0, s.nextStreamId(map)); <END> assertEquals(2, s.nextStreamId(map)); s = new StreamIdSupplier(Integer.MAX_VALUE - 2); assertEquals(2147483647, s.nextStreamId(map)); assertEquals(1, s.nextStreamId(map)); assertEquals(3, s.nextStreamId(map)); }</code><technical_language>2 result here</technical_language>

Target:
public void testWrap() { IntObjectMap<Object> map = new SynchronizedIntObjectHashMap<>(); StreamIdSupplier s = new StreamIdSupplier(Integer.MAX_VALUE - 3); assertEquals(2147483646, s.nextStreamId(map)); assertEquals(2, s.nextStreamId(map)); assertEquals(4, s.nextStreamId(map)); s = new StreamIdSupplier(Integer.MAX_VALUE - 2); assertEquals(2147483647, s.nextStreamId(map)); assertEquals(1, s.nextStreamId(map)); assertEquals(3, s.nextStreamId(map)); }
Source:
<code>private void validateAuth(DescriptorProperties properties) { <START> properties.validateString(CONNECTOR_USERNAME, true); properties.validateString(CONNECTOR_PASSWORD, true); <END> }</code><technical_language>I sense set minLen of user name 1. Besides, if properties CONNECTOR_USERNAME, CONNECTOR_PASSWORD is optional</technical_language>

Target:
private void validateAuth(DescriptorProperties properties) { if (properties.containsKey(CONNECTOR_USERNAME) || properties.containsKey(CONNECTOR_PASSWORD)) { properties.validateString(CONNECTOR_USERNAME, false, 1); properties.validateString(CONNECTOR_PASSWORD, false, 1); } }
Source:
<code>public SSHKeyAuthenticatorImpl(final SSHKeyStoreService keyStoreService, final Instance<WorkbenchUserManager> workbenchUserManagerInstance) { this.keyStoreService = keyStoreService; if (!workbenchUserManagerInstance.isUnsatisfied() && !workbenchUserManagerInstance.isAmbiguous()) { this.userManager = workbenchUserManagerInstance.get(); } else { <START> LOGGER.warn("Cannot find any implmenentation of 'WorkbenchUserManager'. Loading default implemntation from SSH module"); <END> this.userManager = this::getUser; } }</code><technical_language>suggestion LOGGER.warn("Cannot find implemenntation of 'WorkbenchUserManager'. Loading default implementation SSH module");</technical_language>

Target:
public SSHKeyAuthenticatorImpl(final SSHKeyStoreService keyStoreService, final Instance<WorkbenchUserManager> workbenchUserManagerInstance) { this.keyStoreService = keyStoreService; if (!workbenchUserManagerInstance.isUnsatisfied() && !workbenchUserManagerInstance.isAmbiguous()) { this.userManager = workbenchUserManagerInstance.get(); } else { LOGGER.warn("Cannot find any implementation of 'WorkbenchUserManager'. Loading default implementation on SSH module"); this.userManager = this::getUser; } }
Source:
<code>protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { sessionAirdResource = new UIResource(designerProject, "/", REPRESENTATIONS_RESOURCE_NAME); localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true); session = localSession.getOpenedSession(); <START> uiTableRepresentation = localSession.getLocalSessionBrowser().perCategory().selectViewpoint("manualAird").selectRepresentation("manualAirdTable") .selectRepresentationInstance("manualAirdTable", UITableRepresentation.class).open(); dTable = uiTableRepresentation.getTable(); tableEditor = uiTableRepresentation.getEditor(); <END> uiTreeRepresentation = localSession.getLocalSessionBrowser().perCategory().selectViewpoint("manualAird").selectRepresentation("manualAirdTree") .selectRepresentationInstance("manualAirdTree", UITreeRepresentation.class).open(); treeEditor = uiTreeRepresentation.getEditor(); airdResourceUri = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(sessionAirdResource.getFullPath())).getRawLocationURI(); }</code><technical_language>Replace more efficient code: tableEditor = openRepresentation(localSession.getOpenedSession(), "manualAirdTable", "manualAirdTable", DTable.class); dTable = tableEditor.bot().tree();</technical_language>

Target:
protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { sessionAirdResource = new UIResource(designerProject, "/", REPRESENTATIONS_RESOURCE_NAME); localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true); session = localSession.getOpenedSession(); tableEditor = openRepresentation(localSession.getOpenedSession(), "manualAirdTable", "manualAirdTable", DTable.class); tableTree = tableEditor.bot().tree(); treeEditor = openRepresentation(localSession.getOpenedSession(), "manualAirdTree", "manualAirdTree", DTree.class); airdResourceUri = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(sessionAirdResource.getFullPath())).getRawLocationURI(); }
Source:
<code>public QueryContext checkForDerivativeContextAndReturn(int newScope) { QueryContext newContext = potentialSpawnedContext; potentialSpawnedContext = null; <START> if(potentialSpawnedContext == null) { newContext = new QueryContext(this);} <END> newContext.contextScope = newScope; if(dominates(newContext.contextScope, this.contextScope)) { this.reportContextEscalation(this, newContext, "New"); return newContext; } else { return this; } }</code><technical_language>this is true set null in line above. this intended do / check for</technical_language>

Target:
public QueryContext checkForDerivativeContextAndReturn(int newScope) { QueryContext newContext; potentialSpawnedContext = null; newContext = new QueryContext(this); newContext.contextScope = newScope; if (dominates(newContext.contextScope, this.contextScope)) { this.reportContextEscalation(newContext, "New"); return newContext; } else { return this; } }
Source:
<code>public void testRebalanceThreadPoolSize() { GridStringLogger gridStringLogger = new GridStringLogger(); gridStringLogger.logLength(1024 * 100); IgniteConfiguration cci = Config.getServerConfiguration().setClientMode(true); cci.setRebalanceThreadPoolSize(cci.getSystemThreadPoolSize()); cci.setGridLogger(gridStringLogger); try ( Ignite si = Ignition.start(Config.getServerConfiguration()); Ignite ci = Ignition.start(cci);) { <START> Set<ClusterNode> collect = si.cluster().nodes().stream().filter(new Predicate<ClusterNode>() { <END> @Override public boolean test(ClusterNode clusterNode) { return clusterNode.isClient(); } }).collect(Collectors.toSet()); String log = gridStringLogger.toString(); boolean containsMessage = log.contains("Setting the rebalance pool size has no effect on the client mode"); Assert.assertTrue(containsMessage); Assert.assertEquals(1, collect.size()); } catch (Exception e) { Assert.fail(); } }</code><technical_language>plz format this correctly</technical_language>

Target:
public void testRebalanceThreadPoolSize() { GridStringLogger gridStringLogger = new GridStringLogger(); gridStringLogger.logLength(1024 * 100); IgniteConfiguration cci = Config.getServerConfiguration().setClientMode(true); cci.setRebalanceThreadPoolSize(cci.getSystemThreadPoolSize()); cci.setGridLogger(gridStringLogger); try ( Ignite si = Ignition.start(Config.getServerConfiguration()); Ignite ci = Ignition.start(cci);) { Set<ClusterNode> collect = si.cluster().nodes().stream() .filter(new Predicate<ClusterNode>() { @Override public boolean test(ClusterNode clusterNode) { return clusterNode.isClient(); } }) .collect(Collectors.toSet()); String log = gridStringLogger.toString(); boolean containsMessage = log.contains("Setting the rebalance pool size has no effect on the client mode"); Assert.assertTrue(containsMessage); Assert.assertEquals(1, collect.size()); } }
Source:
<code>public void setUp() { mockedConfig1 = createMockConfig("Config1"); mockedConfig2 = createMockConfig("Config2"); availableConfigs = new ArrayList<Config>(); availableConfigs.add(mockedConfig1); availableConfigs.add(mockedConfig2); <START> PythonInterface mockPythonInterface = mock(PythonInterface.class); <END> when(mockPythonInterface.getActionDefinitions()).thenReturn(availableConfigs); configLoader = new ConfigLoader(mockPythonInterface); }</code><technical_language>of type this declares a new mockPythonInterface. Remove type declaration assignment only</technical_language>

Target:
public void setUp() { mockedConfig1 = createMockConfig("Config1"); mockedConfig2 = createMockConfig("Config2"); availableConfigs = new ArrayList<Config>(); availableConfigs.add(mockedConfig1); availableConfigs.add(mockedConfig2); mockPythonInterface = mock(PythonInterface.class); when(mockPythonInterface.getActionDefinitions()).thenReturn(availableConfigs); configLoader = new ConfigLoader(mockPythonInterface); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CheEditor)) { return false; } CheEditor cheEditor = (CheEditor) o; <START> return Objects.equals(getName(), cheEditor.getName()) <END> && Objects.equals(getId(), cheEditor.getId()) && Objects.equals(getVersion(), cheEditor.getVersion()) && Objects.equals(getContainers(), cheEditor.getContainers()) && Objects.equals(getEndpoints(), cheEditor.getEndpoints()); }</code><technical_language>I write equals hashcode methods in manner <LINK_0></technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CheEditor)) { return false; } CheEditor cheEditor = (CheEditor) o; return super.equals(cheEditor); }
Source:
<code>public List<Object> getAttributeAsList(final String key) { final Object o = getAttribute(key); if ( o == null ) return Collections.emptyList(); <START> else if ( o instanceof List ) return (List<Object>)o; <END> else if ( o instanceof int[]) { final int array[]=(int[])o; final List<Object> list = new ArrayList<>( array.length ); for( int i : array) list.add(i); return list; } else if ( o instanceof double[]) { final double array[]=(double[])o; final List<Object> list = new ArrayList<>( array.length ); for( double i : array) list.add(i); return list; } else if ( o.getClass().isArray() ) return Arrays.asList((Object[])o); return Collections.singletonList(o); }</code><technical_language>I appreciate this is a problem, I hate add more instanceof calls. I guess implicit vote for proposal @tfenne in #520</technical_language>

Target:
public List<Object> getAttributeAsList(final String key) { Object o = getAttribute(key); if ( o == null ) return Collections.emptyList(); if ( o instanceof List ) return (List<Object>)o; if ( o.getClass().isArray() ) return Arrays.asList((Object[])o); return Collections.singletonList(o); }
Source:
<code>static Task<BasicMachineDetails> taskForSshMachineLocation(SshMachineLocation location) { BufferedReader reader = new BufferedReader(Streams.reader( new ResourceUtils(BasicMachineDetails.class).getResourceFromUrl( "classpath://brooklyn/location/basic/os-details.sh"))); List<String> script; try { script = CharStreams.readLines(reader); <START> reader.close(); <END> } catch (IOException e) { LOG.error("Error reading os-details script", e); throw Throwables.propagate(e); } Task<BasicMachineDetails> task = new PlainSshExecTaskFactory<String>(location, script) .summary("Getting machine details for: " + location) .requiringZeroAndReturningStdout() .returning(taskToMachineDetailsFunction(location)) .newTask() .asTask(); return task; }</code><technical_language>do reader.close() in finally block</technical_language>

Target:
static Task<BasicMachineDetails> taskForSshMachineLocation(SshMachineLocation location) { BufferedReader reader = new BufferedReader(Streams.reader( new ResourceUtils(BasicMachineDetails.class).getResourceFromUrl( "classpath://brooklyn/location/basic/os-details.sh"))); List<String> script; try { script = CharStreams.readLines(reader); } catch (IOException e) { LOG.error("Error reading os-details script", e); throw Throwables.propagate(e); } finally { try { reader.close(); } catch (IOException e) { LOG.error("Error closing os-details script reader", e); } } Task<BasicMachineDetails> task = new PlainSshExecTaskFactory<String>(location, script) .summary("Getting machine details for: " + location) .requiringZeroAndReturningStdout() .returning(taskToMachineDetailsFunction(location)) .newTask() .asTask(); return task; }
Source:
<code>private void applyUcastAddition(MacLocation ml) { log.debug("Adding UCAST remote MAC to the VTEP: " + ml); try { List<UcastMac> ucasts = vtepDataClient.listUcastMacsRemote(); for (UcastMac uc : ucasts) { if (uc.mac.equals(ml.mac().toString())) { <START> log.debug("UCAST <END> remote MAC already in vtep"); return; } } } catch (VtepNotConnectedException e) { log.error("VTEP is not connected", e); return; } Status st = vtepDataClient.addUcastMacRemote(ml.logicalSwitchName(), ml.mac().IEEE802(), ml.ipAddr(), ml.vxlanTunnelEndpoint()); if (st.getCode().equals(StatusCode.CONFLICT)) { log.info("Conflict writing {}, not expected", ml); } else if (!st.isSuccess()) { throw new VxLanPeerSyncException("OVSDB error: " + st, ml, st.getCode()); } }</code><technical_language>I if this warn, in theory happen. Logging mac address in question in future debugging, well</technical_language>

Target:
private void applyUcastAddition(MacLocation ml) { log.debug("Adding UCAST remote MAC to the VTEP: " + ml); List<UcastMac> ucasts = null; try { ucasts = vtepDataClient.listUcastMacsRemote(); } catch (VtepNotConnectedException e) { log.error("VTEP is not connected", e); return; } for (UcastMac uc : ucasts) { if (ml.mac().toString().equalsIgnoreCase(uc.mac)) { String mlIp = ml.ipAddr() == null ? "" : ml.ipAddr().toString(); String ucIp = Strings.nullToEmpty(uc.ipAddr); if (ucIp.equals(mlIp)) { log.debug("UCAST remote MAC already in vtep"); return; } } } Status st = vtepDataClient.addUcastMacRemote(ml.logicalSwitchName(), ml.mac().IEEE802(), ml.ipAddr(), ml.vxlanTunnelEndpoint()); if (st.getCode().equals(StatusCode.CONFLICT)) { log.info("Conflict writing {}, not expected", ml); } else if (!st.isSuccess()) { throw new VxLanPeerSyncException("OVSDB error: " + st, ml, st.getCode()); } }
Source:
<code><START> protected boolean shouldShowSubjectDiscovery() { <END> return getActivity() instanceof MainDashboardActivity && environment.getConfig().getDiscoveryConfig().getCourseDiscoveryConfig().isSubjectFilterEnabled() && getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE; }</code><technical_language>This function longer needs protected. private</technical_language>

Target:
private boolean shouldShowSubjectDiscovery() { return getActivity() instanceof MainDashboardActivity && environment.getConfig().getDiscoveryConfig().getCourseDiscoveryConfig().isSubjectFilterEnabled() && getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE; }
Source:
<code>public void savePredicates() throws IOException { for (String session : sessions.keySet()) { <START> String[] parts = session.split("_"); <END> String username = parts[0]; String botname = session.substring(username.length() + 1); String sessionPredicateFilename = createSessionPredicateFilename(username, botname); File sessionPredFile = new File(sessionPredicateFilename); Chat chat = getChat(username, botname); log.info("Writing predicate file for session {}", session); FileWriter predWriter = new FileWriter(sessionPredFile, false); for (String predicate : chat.predicates.keySet()) { String value = chat.predicates.get(predicate); predWriter.write(predicate + ":" + value + "\n"); } predWriter.close(); } log.info("Done saving predicates."); }</code><technical_language>fixing else, address TODO here..</technical_language>

Target:
public void savePredicates() throws IOException { for (String botName : sessions.keySet()) { for (String userName : sessions.get(botName).keySet()) { String sessionPredicateFilename = createSessionPredicateFilename(userName, botName); File sessionPredFile = new File(sessionPredicateFilename); Chat chat = getChat(userName, botName); log.info("Writing predicate file for session {}", botName, userName); FileWriter predWriter = new FileWriter(sessionPredFile, false); for (String predicate : chat.predicates.keySet()) { String value = chat.predicates.get(predicate); predWriter.write(predicate + ":" + value + "\n"); } predWriter.close(); } } log.info("Done saving predicates."); }
Source:
<code>protected void onBindDialogView(View view) { SeekBar volumeBar = (SeekBar) view.findViewById(R.id.volume_bar); volumeBar.setProgress((int) (getPersistedFloat( PreferenceConstants.DEFAULT_BELL_VOLUME) * 100)); volumeBar.setOnSeekBarChangeListener(this); <START> super.onBindDialogView(view); <END> }</code><technical_language>this done in method</technical_language>

Target:
protected void onBindDialogView(View view) { super.onBindDialogView(view); SeekBar volumeBar = (SeekBar) view.findViewById(R.id.volume_bar); volumeBar.setProgress((int) (getPersistedFloat( PreferenceConstants.DEFAULT_BELL_VOLUME) * 100)); volumeBar.setOnSeekBarChangeListener(this); }
Source:
<code>ContainerNode<?> asJson(Object target) throws AccessException { if (target instanceof String) { try { JsonNode json = this.objectMapper.readTree((String) target); return assertContainerNode(json); } catch (JsonProcessingException e) { throw new AccessException("Exception while trying to deserialize String", e); } catch (IOException e) { throw new AccessException("Exception while trying to deserialize String", e); } } else { <START> throw new IllegalStateException("Can't happen. Check SUPPORTED_CLASSES"); <END> } }</code><technical_language>wrong is here, getSpecificTargetClasses() returns null</technical_language>

Target:
ContainerNode<?> asJson(Object target) throws AccessException { if (target instanceof String) { try { JsonNode json = this.objectMapper.readTree((String) target); return assertContainerNode(json); } catch (IOException e) { throw new AccessException("Exception while trying to deserialize String", e); } } else { throw new IllegalStateException("Can't happen. Check SUPPORTED_CLASSES"); } }
Source:
<code>public String scheduleACronJob(Object instance, String methodName, Class<?>[] inputTypes, Object[] inputParams, String cronExpression) { String triggerName = ""; try { triggerName = generateUniqueNameForInstance(instance, TRIGGER_PREFIX); JavaCronTrigger trigger = new JavaCronTrigger(new JavaCronExpression(cronExpression)); <START> executor.schedule(getRunnable(instance, methodName, inputTypes, inputParams), trigger); <END> } catch (Exception se) { log.error("failed to schedule job: {}", se.getMessage()); log.debug("Exception", se); return null; } return triggerName; }</code><technical_language>is a delete a scheduled job a cron trigger is set</technical_language>

Target:
public String scheduleACronJob(Object instance, String methodName, Class<?>[] inputTypes, Object[] inputParams, String cronExpression) { TimerConfig config = new TimerConfig(); try { timerService.schedule(instance.getClass() .getName(), config, methodName, inputTypes, inputParams, cronExpression); } catch (Exception se) { log.error("failed to schedule job: {}", se.getMessage()); log.debug("Exception", se); return null; } return config.getInfo().toString(); }
Source:
<code>public ModuleDirectiveTree PROVIDES_MODULE_DIRECTIVE() { return b.<ModuleDirectiveTree>nonterminal(JavaLexer.PROVIDES_DIRECTIVE) .is( f.newProvidesModuleDirective( b.token(JavaRestrictedKeyword.PROVIDES), <START> EXPRESSION_QUALIFIED_IDENTIFIER(), <END> b.token(JavaRestrictedKeyword.WITH), QUALIFIED_IDENTIFIER_LIST(), b.token(JavaPunctuator.SEMI))); }</code><technical_language>TYPE_QUALIFIED_IDENTIFIER consistent USES_MODULE_DIRECTIVE</technical_language>

Target:
public ModuleDirectiveTree PROVIDES_MODULE_DIRECTIVE() { return b.<ModuleDirectiveTree>nonterminal(JavaLexer.PROVIDES_DIRECTIVE) .is( f.newProvidesModuleDirective( b.token(JavaRestrictedKeyword.PROVIDES), TYPE_QUALIFIED_IDENTIFIER(), b.token(JavaRestrictedKeyword.WITH), QUALIFIED_IDENTIFIER_LIST(), b.token(JavaPunctuator.SEMI))); }
Source:
<code>protected HBaseFieldValueGenerator(final Class<?> clazz, List<HBaseFieldInfo> fieldInfos) { for (HBaseFieldInfo fieldInfo : fieldInfos) { <START> fieldInfoMap.put(fieldInfo.getFamilyName() + ":" + fieldInfo.getColumnName(), fieldInfo); <END> PojoUtils.Getter<Object, Object> getter = PojoUtils.createGetter(clazz, fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType()); fieldGetterMap.put(fieldInfo, getter); } for (HBaseFieldInfo fieldInfo : fieldInfos) { PojoUtils.Setter<Object, Object> setter = PojoUtils.createSetter(clazz, fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType()); fieldSetterMap.put(fieldInfo, setter); } }</code><technical_language>declare ":" constant</technical_language>

Target:
protected HBaseFieldValueGenerator(final Class<?> clazz, List<HBaseFieldInfo> fieldInfos) { for (HBaseFieldInfo fieldInfo : fieldInfos) { fieldInfoMap.put(fieldInfo.getFamilyName() + COLON + fieldInfo.getColumnName(), fieldInfo); PojoUtils.Getter<Object, Object> getter = PojoUtils.createGetter(clazz, fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType()); fieldGetterMap.put(fieldInfo, getter); } for (HBaseFieldInfo fieldInfo : fieldInfos) { PojoUtils.Setter<Object, Object> setter = PojoUtils.createSetter(clazz, fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType()); fieldSetterMap.put(fieldInfo, setter); } }
Source:
<code>public SingularityRunNowRequestBuilder() { this.message = Optional.absent(); this.runId = Optional.absent(); this.commandLineArgs = Optional.absent(); this.skipHealthchecks = Optional.absent(); this.resources = Optional.absent(); <START> this.envOverrides = null; <END> this.runAt = Optional.absent(); }</code><technical_language>empty map instead of null here</technical_language>

Target:
public SingularityRunNowRequestBuilder() { this.message = Optional.absent(); this.runId = Optional.absent(); this.commandLineArgs = Optional.absent(); this.skipHealthchecks = Optional.absent(); this.resources = Optional.absent(); this.runAsUserOverride = Optional.absent(); this.envOverrides = Collections.emptyMap(); this.extraArtifacts = Collections.emptyList(); this.runAt = Optional.absent(); }
Source:
<code>protected ObjectNode getDockerContainer(ObjectMapper mapper) { ObjectNode dockerNode = mapper.createObjectNode(); <START> dockerNode.put(MarathonConstants.DOCKER_IMAGE, "ndustrialio/heron-executor:jre8"); <END> dockerNode.put(MarathonConstants.DOCKER_NETWORK, "BRIDGE"); dockerNode.put(MarathonConstants.DOCKER_PRIVILEGED, false); dockerNode.put(MarathonConstants.DOCKER_FORCE_PULL, true); dockerNode.set(MarathonConstants.DOCKER_PORT_MAPPINGS, getPorts(mapper)); return dockerNode; }</code><technical_language>This is a hardcoded value. move this a generic config is flexible</technical_language>

Target:
protected ObjectNode getDockerContainer(ObjectMapper mapper) { ObjectNode dockerNode = mapper.createObjectNode(); dockerNode.put(MarathonConstants.DOCKER_IMAGE, MarathonContext.getExecutorDockerImage(config)); dockerNode.put(MarathonConstants.DOCKER_NETWORK, MarathonConstants.DOCKER_NETWORK_BRIDGE); dockerNode.put(MarathonConstants.DOCKER_PRIVILEGED, false); dockerNode.put(MarathonConstants.DOCKER_FORCE_PULL, true); dockerNode.set(MarathonConstants.DOCKER_PORT_MAPPINGS, getPorts(mapper)); return dockerNode; }
Source:
<code>private void populateContent() { final VBox vBox = new VBox(); Label description = new Label(shortcut.getDescription()); description.setWrapText(true); final GridPane gridPane = new GridPane(); gridPane.getStyleClass().add("grid"); try { <START> System.out.println(shortcut.getScript()); <END> final Map<String, String> shortcutProperties = objectMapper.readValue(shortcut.getScript(), new TypeReference<Map<String, String>>() {}); int i = 0; for(String shortcutKey: shortcutProperties.keySet()) { final Label keyLabel = new Label(shortcutKey + ":"); keyLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS); GridPane.setValignment(keyLabel, VPos.TOP); gridPane.add(keyLabel, 0, i); final Label valueLabel = new Label(shortcutProperties.get(shortcutKey)); valueLabel.setWrapText(true); gridPane.add(valueLabel, 1, i); i++; } } catch (IOException e) { LOGGER.warn("Could not parse shortcut script JSON", e); } gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70)); vBox.getChildren().addAll(description, gridPane); this.setCenter(vBox); }</code><technical_language>This a forgotten debug output. LOGGER remove it</technical_language>

Target:
private void populateContent() { final VBox vBox = new VBox(); Label description = new Label(shortcut.getDescription()); description.setWrapText(true); final GridPane gridPane = new GridPane(); gridPane.getStyleClass().add("grid"); try { LOGGER.info("Reading shortcut: {}", shortcut.getScript()); final Map<String, String> shortcutProperties = objectMapper.readValue(shortcut.getScript(), new TypeReference<Map<String, String>>() {}); int i = 0; for(String shortcutKey: shortcutProperties.keySet()) { final Label keyLabel = new Label(shortcutKey + ":"); keyLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS); GridPane.setValignment(keyLabel, VPos.TOP); gridPane.add(keyLabel, 0, i); final Label valueLabel = new Label(shortcutProperties.get(shortcutKey)); valueLabel.setWrapText(true); gridPane.add(valueLabel, 1, i); i++; } } catch (IOException e) { LOGGER.warn("Could not parse shortcut script JSON", e); } gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70)); vBox.getChildren().addAll(description, gridPane); this.setCenter(vBox); }
Source:
<code>private void handleGenerationException(Throwable e) { Throwable cause = e.getCause(); <START> if (cause instanceof InvalidParameterException) { log.warn("Map generation failed", e); notificationService.addImmediateErrorNotification(e, "mapGenerator.invalidName"); } else if (cause instanceof UnsupportedVersionException) { log.warn("Map generation failed", e); notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooNewVersion"); } else if (cause instanceof OutdatedVersionException) { log.warn("Map generation failed", e); notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooOldVersion"); } else { log.warn("Map generation failed", e); notificationService.addImmediateErrorNotification(e, "mapGenerator.generationFailed"); } } <END></code><technical_language>of warning moved if block customized more type of error</technical_language>

Target:
private void handleGenerationException(Throwable e) { Throwable cause = e.getCause(); if (cause instanceof InvalidParameterException) { log.warn("Map generation failed due to invalid parameter", e); notificationService.addImmediateErrorNotification(e, "mapGenerator.invalidName"); } else if (cause instanceof UnsupportedVersionException) { log.warn("Map generation failed due to unsupported version", e); notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooNewVersion"); } else if (cause instanceof OutdatedVersionException) { log.warn("Map generation failed due to outdated version", e); notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooOldVersion"); } else { log.warn("Map generation failed", e); notificationService.addImmediateErrorNotification(e, "mapGenerator.generationFailed"); } }
Source:
<code>public static boolean isUsbPolicyLegal(UsbPolicy usbPolicy, VmOsType osType, VDSGroup vdsGroup, List<String> messages) { <START> boolean retVal = true; <END> if (usbPolicy != null && usbPolicy.equals(UsbPolicy.ENABLED_NATIVE)) { if (vdsGroup.getcompatibility_version().compareTo(Version.v3_1) < 0) { messages.add(VdcBllMessages.USB_NATIVE_SUPPORT_ONLY_AVAILABLE_ON_CLUSTER_LEVEL.toString()); retVal = false; } } else if (usbPolicy != null && usbPolicy.equals(UsbPolicy.ENABLED_LEGACY)) { if (osType.isLinux()) { messages.add(VdcBllMessages.USB_LEGACY_NOT_SUPPORTED_ON_LINUX_VMS.toString()); retVal = false; } } return retVal; }</code><technical_language>ENABLED_NATIVE.equals(usbPolicy) clearer</technical_language>

Target:
public static boolean isUsbPolicyLegal(UsbPolicy usbPolicy, VmOsType osType, VDSGroup vdsGroup, List<String> messages) { boolean retVal = true; if (UsbPolicy.ENABLED_NATIVE.equals(usbPolicy)) { if (vdsGroup.getcompatibility_version().compareTo(Version.v3_1) < 0) { messages.add(VdcBllMessages.USB_NATIVE_SUPPORT_ONLY_AVAILABLE_ON_CLUSTER_LEVEL.toString()); retVal = false; } } else if (UsbPolicy.ENABLED_LEGACY.equals(usbPolicy)) { if (osType.isLinux()) { messages.add(VdcBllMessages.USB_LEGACY_NOT_SUPPORTED_ON_LINUX_VMS.toString()); retVal = false; } } return retVal; }
Source:
<code>private void drawSideBar() { LeftSideBar leftContent = new LeftSideBar(); this.getChildren().add(leftContent); searchBar = new TextField(); <START> searchBar.setOnKeyReleased(event -> { <END> applicationListWidget.search(searchBar.getText()); }); this.runScript = new LeftButton("/com/playonlinux/ui/impl/javafx/mainwindow/library/script.png", "Run a script"); LeftSpacer spacer = new LeftSpacer(); leftContent.getChildren().addAll(searchBar, spacer, new LeftBarTitle("Advanced tools"), runScript); }</code><technical_language>remove {}, instruction in this lambda</technical_language>

Target:
private void drawSideBar() { LeftSideBar leftContent = new LeftSideBar(); this.getChildren().add(leftContent); searchBar = new TextField(); searchBar.setOnKeyReleased(event -> applicationListWidget.search(searchBar.getText())); this.runScript = new LeftButton("/com/playonlinux/ui/impl/javafx/mainwindow/library/script.png", "Run a script"); LeftSpacer spacer = new LeftSpacer(); leftContent.getChildren().addAll(searchBar, spacer, new LeftBarTitle("Advanced tools"), runScript); }
Source:
<code>public TypeSerializer<Row> createPriorSerializer() { <START> return createRowSerializer(true); <END> }</code><technical_language>I a mis-understanding in of this createPriorSerializer method. This method is writing test snapshot files, target branch. e.g. - if checkout release-1.10 branch generate a snapshot, this create a serializer writes in format. - if checkout release-1.11 branch generate a snapshot, this create a serializer writes in new format. current changes in PR, generated snapshot files written format, of branch on. suggestion // in older branches, this writes in format; // in newer branches >= 1.11, this writes in new format return new RowSerializer(fieldSerializers);</technical_language>

Target:
public TypeSerializer<Row> createPriorSerializer() { return createRowSerializer(); }
Source:
<code>void extractPrefetchFiles(Content dataSource) { List<AbstractFile> pFiles; FileManager fileManager = Case.getCurrentCase().getServices().getFileManager(); try { <START> pFiles = fileManager.findFiles(dataSource, "%.pf"); END> } catch (TskCoreException ex) { logger.log(Level.WARNING, "Unable to find prefetch files.", ex); return; } for (AbstractFile pFile : pFiles) { if (context.dataSourceIngestIsCancelled()) { return; } String prefetchFile = RAImageIngestModule.getRATempPath(Case.getCurrentCase(), "prefetch") + File.separator + pFile.getName(); if (pFile.getParentPath().contains(PREFETCH_FILE_LOCATION)) { try { ContentUtils.writeToFile(pFile, new File(prefetchFile)); } catch (IOException ex) { logger.log(Level.WARNING, String.format("Unable to write %s to temp directory. File name: %s", pFile.getName(), prefetchFile), ex); } } } }</code><technical_language>files typically named multiple data sources</technical_language>

Target:
void extractPrefetchFiles(Content dataSource) { List<AbstractFile> pFiles; FileManager fileManager = Case.getCurrentCase().getServices().getFileManager(); try { pFiles = fileManager.findFiles(dataSource, "%.pf"); } catch (TskCoreException ex) { logger.log(Level.WARNING, "Unable to find prefetch files.", ex); return; } for (AbstractFile pFile : pFiles) { if (context.dataSourceIngestIsCancelled()) { return; } String prefetchFile = RAImageIngestModule.getRATempPath(Case.getCurrentCase(), PREFETCH_DIR_NAME) + File.separator + pFile.getName(); if (pFile.getParentPath().contains(PREFETCH_FILE_LOCATION)) { try { ContentUtils.writeToFile(pFile, new File(prefetchFile)); } catch (IOException ex) { logger.log(Level.WARNING, String.format("Unable to write %s to temp directory. File name: %s", pFile.getName(), prefetchFile), ex); } } } }
Source:
<code>public EmailWrapper sendConfirmationEmailForSubmission(String courseId, String feedbackSessionName, String userId, String unregisteredStudentEmail, String regKey) throws EntityDoesNotExistException { FeedbackSessionAttributes session = getFeedbackSession(feedbackSessionName, courseId); StudentAttributes student = null; InstructorAttributes instructor = null; if (userId != null) { student = studentsLogic.isStudentInAnyCourse(userId) <START> ? studentsLogic.getStudentForCourseIdAndGoogleId(courseId, userId) : null; <END> instructor = instructorsLogic.isGoogleIdOfInstructorOfCourse(userId, courseId) ? instructorsLogic.getInstructorForGoogleId(courseId, userId) : null; } if (student == null && unregisteredStudentEmail != null) { student = new StudentAttributes(); student.email = unregisteredStudentEmail; student.name = ""; student.key = regKey; } try { EmailWrapper email = new EmailGenerator().generateFeedbackSubmissionConfirmationEmails( session, student, instructor); new EmailSender().sendEmailWithLogging(email); return email; } catch (Exception e) { throw new RuntimeException(ERROR_SENDING_EMAILS, e); } }</code><technical_language>do this way: java student = studentsLogic.isStudentInAnyCourse(userId) ? studentsLogic.getStudentForCourseIdAndGoogleId(courseId, userId) : null;</technical_language>

Target:
public EmailWrapper sendConfirmationEmailForSubmission(String courseId, String feedbackSessionName, String userId, String unregisteredStudentEmail, String regKey) throws EntityDoesNotExistException { if (!isFeedbackSessionExists(feedbackSessionName, courseId)) { throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_CONFIRM + courseId + "/" + feedbackSessionName); } FeedbackSessionAttributes session = getFeedbackSession(feedbackSessionName, courseId); StudentAttributes student = null; InstructorAttributes instructor = null; if (userId != null) { student = studentsLogic.getStudentForCourseIdAndGoogleId(courseId, userId); instructor = instructorsLogic.getInstructorForGoogleId(courseId, userId); } if (student == null && unregisteredStudentEmail != null) { student = new StudentAttributes(); student.email = unregisteredStudentEmail; student.name = unregisteredStudentEmail; student.key = regKey; } Assumption.assertFalse(student == null && instructor == null); try { String timestamp = TimeHelper.formatTime12H(Calendar.getInstance().getTime()); EmailWrapper email = instructor == null ? new EmailGenerator().generateFeedbackSubmissionConfirmationEmailForStudent(session, student, timestamp) : new EmailGenerator().generateFeedbackSubmissionConfirmationEmailForInstructor(session, instructor, timestamp); new EmailSender().sendEmail(email); return email; } catch (Exception e) { throw new RuntimeException(ERROR_SENDING_EMAILS, e); } }
Source:
<code>public Container andNot(BitmapContainer x) { int card = this.getCardinality(); if (card <= ArrayContainer.DEFAULT_MAX_SIZE) { ArrayContainer answer = new ArrayContainer(card); answer.cardinality = 0; for (int rlepos = 0; rlepos < this.nbrruns; ++rlepos) { int runStart = Util.toIntUnsigned(this.getValue(rlepos)); int runEnd = runStart + Util.toIntUnsigned(this.getLength(rlepos)); for (int runValue = runStart; runValue <= runEnd; ++runValue) { if (!x.contains((short) runValue)) { answer.content[answer.cardinality++] = (short) runValue; } } } return answer; } BitmapContainer answer = x.clone(); int lastPos = 0; for (int rlepos = 0; rlepos < this.nbrruns; ++rlepos) { int start = Util.toIntUnsigned(this.getValue(rlepos)); int end = start + Util.toIntUnsigned(this.getLength(rlepos)) + 1; int prevOnes = Util.cardinalityInBitmapRange(answer.bitmap, lastPos, start); int flippedOnes = Util.cardinalityInBitmapRange(answer.bitmap, start, end); Util.resetBitmapRange(answer.bitmap, lastPos, start); Util.flipBitmapRange(answer.bitmap, start, end); answer.updateCardinality(prevOnes + flippedOnes, end - start - flippedOnes); lastPos = end; } int prevOnes = Util.cardinalityInBitmapRange(answer.bitmap, lastPos, BitmapContainer.MAX_CAPACITY); <START> Util.resetBitmapRange(answer.bitmap, lastPos, BitmapContainer.MAX_CAPACITY); <END> answer.updateCardinality(prevOnes, 0); if (answer.getCardinality() > ArrayContainer.DEFAULT_MAX_SIZE) { return answer; } else { return answer.toArrayContainer(); } }</code><technical_language>a glance, fine</technical_language>

Target:
public Container andNot(BitmapContainer x) { int card = this.getCardinality(); if (card <= ArrayContainer.DEFAULT_MAX_SIZE) { ArrayContainer answer = new ArrayContainer(card); answer.cardinality = 0; for (int rlepos = 0; rlepos < this.nbrruns; ++rlepos) { int runStart = Util.toIntUnsigned(this.getValue(rlepos)); int runEnd = runStart + Util.toIntUnsigned(this.getLength(rlepos)); for (int runValue = runStart; runValue <= runEnd; ++runValue) { if (!x.contains((short) runValue)) { answer.content[answer.cardinality++] = (short) runValue; } } } return answer; } BitmapContainer answer = x.clone(); int lastPos = 0; for (int rlepos = 0; rlepos < this.nbrruns; ++rlepos) { int start = Util.toIntUnsigned(this.getValue(rlepos)); int end = start + Util.toIntUnsigned(this.getLength(rlepos)) + 1; int prevOnes = answer.cardinalityInRange(lastPos, start); int flippedOnes = answer.cardinalityInRange(start, end); Util.resetBitmapRange(answer.bitmap, lastPos, start); Util.flipBitmapRange(answer.bitmap, start, end); answer.updateCardinality(prevOnes + flippedOnes, end - start - flippedOnes); lastPos = end; } int ones = answer.cardinalityInRange(lastPos, BitmapContainer.MAX_CAPACITY); Util.resetBitmapRange(answer.bitmap, lastPos, BitmapContainer.MAX_CAPACITY); answer.updateCardinality(ones, 0); if (answer.getCardinality() > ArrayContainer.DEFAULT_MAX_SIZE) { return answer; } else { return answer.toArrayContainer(); } }
Source:
<code>public CallStatus call() throws Exception { if (this instanceof BlockingOperation) { BlockingOperation blockingOperation = (BlockingOperation) this; if (blockingOperation.shouldWait()) { return WAIT; } } run(); <START> return returnsResponse() ? DONE_RESPONSE : DONE_VOID_BACKUP; <END> }</code><technical_language>I do understand this change. change this for operations, a backup. This part logical. DONE_VOID is is needed; operation is complete is response. DONE_VOID_BACKUP added for RAFT; replaced DONE_VOID</technical_language>

Target:
public CallStatus call() throws Exception { if (this instanceof BlockingOperation) { BlockingOperation blockingOperation = (BlockingOperation) this; if (blockingOperation.shouldWait()) { return WAIT; } } run(); return returnsResponse() ? RESPONSE : VOID; }
Source:
<code>public T getHighestRankingElement(final Collection<T> elements, final RankTester<T> rankTester) { T highestRankingElement = null; double highestRank = initialRank; for (final T element : elements) { final double rank = rankTester.getRank(element); if (ignoreRankValue != null && ignoreRankValue.equals(rank)) { continue; } else if (rank > highestRank) { highestRank = rank; highestRankingElement = element; } else if (rank == highestRank && highestRankingElement != null) { <START> reportClashingPriorities(highestRankingElement, <END> element, rank); } } return highestRankingElement; }</code><technical_language>report this, more highest ranked elements? If elements rank of is returned, care. this code if elements rank, report this twice, we</technical_language>

Target:
public T getHighestRankingElement(final Collection<T> elements, final RankTester<T> rankTester) { final List<T> highestRankingElements = new ArrayList<T>(); double highestRank = initialRank; for (final T element : elements) { final double rank = rankTester.getRank(element); if (ignoreRankValue != null && ignoreRankValue.equals(rank)) { continue; } else if (rank >= highestRank) { if (rank > highestRank) { highestRank = rank; highestRankingElements.clear(); } highestRankingElements.add(element); } } if (highestRankingElements.size() > 1) { reportClashingPriorities(createWarning(highestRankingElements, highestRank)); } if (highestRankingElements.isEmpty()) { return null; } return highestRankingElements.get(0); }
Source:
<code>public int get(int index) { <START> return 0; <END> }</code><technical_language>intentionally omitted index check</technical_language>

Target:
public int get(int index) { assert index == 0; return 0; }
Source:
<code>public void start(StartContext context) { <START> logger.debugf("Started AdvancedCacheLoader service with name = %s", className + " " + deployedCacheStoreFactory); <END> deployedCacheStoreFactory.getValue().addInstance(extension); }</code><technical_language>Oh, it, impl detail? subclass it</technical_language>

Target:
public void start(StartContext context) { InfinispanLogger.ROOT_LOGGER.deployedStoreStarted(className); deployedCacheStoreFactory.getValue().addInstance(extension); }
Source:
<code>void initTable(ApplicationConstants constants) { getTable().enableColumnResizing(); TextColumnWithTooltip<VDSGroup> nameColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getName(); } }; nameColumn.makeSortable(new Comparator<VDSGroup>() { @Override <START> public int compare(VDSGroup a, VDSGroup b) { <END> if (a == b) { return 0; } else if (a == null) { return -1; } else if (b == null) { return 1; } return a.getName().compareTo(b.getName()); } }); getTable().addColumn(nameColumn, constants.nameCluster(), "300px"); TextColumnWithTooltip<VDSGroup> versionColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getcompatibility_version().getValue(); } }; getTable().addColumn(versionColumn, constants.comptVersCluster(), "300px"); TextColumnWithTooltip<VDSGroup> descColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getdescription(); } }; getTable().addColumn(descColumn, constants.descriptionCluster()); }</code><technical_language>re-use Linq class comparators</technical_language>

Target:
void initTable(ApplicationConstants constants) { getTable().enableColumnResizing(); TextColumnWithTooltip<VDSGroup> nameColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getName(); } }; nameColumn.makeSortable(new Linq.VDSGroupComparator()); getTable().addColumn(nameColumn, constants.nameCluster(), "300px"); TextColumnWithTooltip<VDSGroup> versionColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getcompatibility_version().getValue(); } }; getTable().addColumn(versionColumn, constants.comptVersCluster(), "300px"); TextColumnWithTooltip<VDSGroup> descColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getdescription(); } }; getTable().addColumn(descColumn, constants.descriptionCluster()); }
Source:
<code>public CIBAGrant createCIBAGrant(User user, Client client, int expiresIn) { Long expirationDate = DateUtils.addSeconds(new Date(), expiresIn).getTime(); if (appConfiguration.getCibaGrantLifeExtraTimeSec() > 0) { expiresIn += appConfiguration.getCibaGrantLifeExtraTimeSec(); } CIBAGrant grant = grantInstance.select(CIBAGrant.class).get(); grant.init(user, client, expiresIn); CIBACacheGrant memcachedGrant = new CIBACacheGrant(grant, appConfiguration); cacheService.put(grant.getCIBAAuthenticationRequestId().getExpiresIn(), memcachedGrant.cacheKey(), memcachedGrant); log.trace("Put CIBA grant in cache, authReqId: " + grant.getCIBAAuthenticationRequestId().getCode() + ", clientId: " + grant.getClientId()); CIBACacheAuthReqIds cibaCacheAuthReqIds = grantService.getCacheCibaAuthReqIds(); cibaCacheAuthReqIds.getAuthReqIds().put(memcachedGrant.cacheKey(), expirationDate); <START> cacheService.put(CIBACacheAuthReqIds.CACHE_KEY, cibaCacheAuthReqIds); <END> log.trace("Put grant into the list of authentication request ids", memcachedGrant.cacheKey()); return grant; }</code><technical_language>save persistence grab state. I discussed it. Cache is bad put key in other part able query key. Persistence allows query data (while cache don't)</technical_language>

Target:
public CIBAGrant createCIBAGrant(User user, Client client, int expiresIn) { if (appConfiguration.getCibaGrantLifeExtraTimeSec() > 0) { expiresIn += appConfiguration.getCibaGrantLifeExtraTimeSec(); } CIBAGrant grant = grantInstance.select(CIBAGrant.class).get(); grant.init(user, client, expiresIn); CIBACacheGrant memcachedGrant = new CIBACacheGrant(grant, appConfiguration); cacheService.put(grant.getCIBAAuthenticationRequestId().getExpiresIn(), memcachedGrant.cacheKey(), memcachedGrant); log.trace("Put CIBA grant in cache, authReqId: " + grant.getCIBAAuthenticationRequestId().getCode() + ", clientId: " + grant.getClientId()); return grant; }
Source:
<code>public Brawl(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}{R}"); <START> Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BrawlEffect(), new TapSourceCost()); <END> ability.addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect( new GainAbilityAllEffect(ability, Duration.EndOfTurn, new FilterCreaturePermanent()) .setText("Until end of turn, all creatures gain \"{T}: This creature deals damage equal to its power to target creature.\"") ); }</code><technical_language>new DamageTargetEffect(new SourcePermanentPowerCount()) here</technical_language>

Target:
public Brawl(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}{R}"); Ability ability = new SimpleActivatedAbility(new DamageWithPowerTargetEffect(), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect( new GainAbilityAllEffect(ability, Duration.EndOfTurn, new FilterCreaturePermanent()) .setText("Until end of turn, all creatures gain \"{T}: This creature deals damage equal to its power to target creature.\"") ); }
Source:
<code>private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); final DataOutputSerializer ser = new DataOutputSerializer(256); <START> hadoopConfig.write(out); <END> out.writeInt(ser.length()); out.write(ser.getSharedBuffer(), 0, ser.length()); }</code><technical_language>ser instead of out</technical_language>

Target:
private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); final DataOutputSerializer ser = new DataOutputSerializer(256); hadoopConfig.write(ser); out.writeInt(ser.length()); out.write(ser.getSharedBuffer(), 0, ser.length()); }