auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean refreshConfigurations(String accessToken, Map<String, String> results) { boolean isSuccess = true; List<RandomizationConfiguration> randomizationConfigurations = new ArrayList<>(); ArrayList<Study> studies = studyDao.findAll(); studies.stream().filter(study->study.getStatus() == Status.AVAILABLE && StringUtils.isNotEmpty(study.getStudyEnvUuid())) .forEach(study-> { List<ModuleConfigDTO> configs = studyBuildService.getModuleConfigsFromStudyService(accessToken, study); String moduleEnabled = studyBuildService.isModuleEnabled(configs, study, Modules.RANDOMIZE); if (StringUtils.equalsIgnoreCase(moduleEnabled, StudyBuildService.ENABLED)) try { randomizationConfigurations.add(retrieveConfiguration(study.getStudyEnvUuid(), accessToken)); <START> results.put(study.getOc_oid(), SUCCESS_STR); <END> } catch (Exception e) { log.error("Error getting Randomize configuration for studyEnvUuid:" + study.getStudyEnvUuid()); log.error("Exception:" + e); results.put(study.getOc_oid(), "FAILED. Error:" + e.getMessage()); } }); randomizationMap.entrySet().stream().forEach(entry->{ if (results.get(entry.getValue().getConfiguration().getStudyOID()) == null) { randomizationMap.remove(entry.getKey()); } }); randomizationConfigurations.stream().forEach(config->{ randomizationMap.put(config.getStudyEnvUuid(), new RandomizationData(true, config)); }); isSuccess = results.size() == randomizationConfigurations.size() ? true: false; return isSuccess; }</code><technical_language>please move this out of try block</technical_language>

Target:
public boolean refreshConfigurations(String accessToken, Map<String, String> results) { boolean isSuccess = true; List<RandomizationConfiguration> randomizationConfigurations = new ArrayList<>(); ArrayList<Study> studies = studyDao.findAll(); studies.stream().filter(study->study.getStatus() == Status.AVAILABLE && StringUtils.isNotEmpty(study.getStudyEnvUuid())) .forEach(study-> { List<ModuleConfigDTO> configs = studyBuildService.getModuleConfigsFromStudyService(accessToken, study); String moduleEnabled = studyBuildService.isModuleEnabled(configs, study, Modules.RANDOMIZE); if (StringUtils.equalsIgnoreCase(moduleEnabled, ModuleStatus.ENABLED.name())) { boolean isRetrieveSuccess = false; try { randomizationConfigurations.add(retrieveConfiguration(study.getStudyEnvUuid(), accessToken)); isRetrieveSuccess = true; } catch (Exception e) { log.error("Error getting Randomize configuration for studyEnvUuid:" + study.getStudyEnvUuid()); log.error("Exception:" + e); results.put(study.getOc_oid(), "FAILED. Error:" + e.getMessage()); } if (isRetrieveSuccess) results.put(study.getOc_oid(), SUCCESS_STR); } }); randomizationMap.entrySet().stream().forEach(entry->{ if (results.get(entry.getValue().getConfiguration().getStudyOID()) == null) { randomizationMap.remove(entry.getKey()); } }); randomizationConfigurations.stream().forEach(config->{ randomizationMap.put(config.getStudyEnvUuid(), new RandomizationData(true, config)); }); isSuccess = results.size() == randomizationConfigurations.size() ? true: false; return isSuccess; }
Source:
<code>public Breakpoints parse(NodeJsOutput nodeJsOutput) throws NodeJsDebuggerParseException { final List<Breakpoint> breakpoints = new ArrayList<>(); @SuppressWarnings("unchecked") <START> Map<String, Object> m = GSON.fromJson(nodeJsOutput.getOutput(), Map.class); <END> if (m.containsKey("breakpoints")) { @SuppressWarnings("unchecked") Iterator<Map> iter = ((Iterable)m.get("breakpoints")).iterator(); while (iter.hasNext()) { @SuppressWarnings("unchecked") Map<String, Object> item = iter.next(); try { final String condition = (String)item.get("condition"); final boolean isEnabled = (Boolean)item.getOrDefault("active", false); final int lineNumber = ((Double)item.get("line")).intValue(); final String target; String targetType = (String)item.get("type"); switch (targetType) { case "scriptId": target = item.get("script_id").toString(); break; case "scriptRegExp": target = (String)item.get("script_regexp"); break; default: throw new IllegalArgumentException("Unsupported 'type' value: " + targetType); } Location location = new LocationImpl(targetType + ":" + target, lineNumber + 1); Breakpoint breakpoint = new BreakpointImpl(location, isEnabled, condition); breakpoints.add(breakpoint); } catch (Exception e) { LOG.error("Failed to parse breakpoint: " + item.toString(), e); } } } return new Breakpoints(breakpoints); }</code><technical_language>JsonObject get key</technical_language>

Target:
public Breakpoints parse(NodeJsOutput nodeJsOutput) throws NodeJsDebuggerParseException { final List<Breakpoint> breakpoints = new ArrayList<>(); JsonObject json = new JsonParser().parse(nodeJsOutput.getOutput()).getAsJsonObject(); if (json.has("breakpoints")) { Iterator<JsonElement> iter = json.getAsJsonArray("breakpoints").iterator(); while (iter.hasNext()) { JsonObject item = iter.next().getAsJsonObject(); try { final String condition = item.has("condition") && !item.get("condition").isJsonNull() ? item.get("condition").getAsString() : null; final boolean isEnabled = item.has("active") && !item.get("active").isJsonNull() && item.get("active").getAsBoolean(); final int lineNumber = item.get("line").getAsInt(); final String target; String targetType = item.get("type").getAsString(); switch (targetType) { case "scriptId": target = String.valueOf(item.get("script_id").getAsInt()); break; case "scriptRegExp": target = item.get("script_regexp").getAsString(); break; default: throw new IllegalArgumentException("Unsupported 'type' value: " + targetType); } Location location = new LocationImpl(targetType + ":" + target, lineNumber + 1); Breakpoint breakpoint = new BreakpointImpl(location, isEnabled, condition); breakpoints.add(breakpoint); } catch (Exception e) { LOG.error("Failed to parse breakpoint: " + item.toString(), e); } } } return new Breakpoints(breakpoints); }
Source:
<code>private List<Message> readNewMessagesFromZK(HelixManager manager, String instanceName, HelixConstants.ChangeType changeType) { HelixDataAccessor accessor = manager.getHelixDataAccessor(); Builder keyBuilder = accessor.keyBuilder(); Set<String> messageIds = new HashSet<>(); if (changeType.equals(HelixConstants.ChangeType.MESSAGE)) { messageIds.addAll(accessor.getChildNames(keyBuilder.messages(instanceName))); } else if (changeType.equals(HelixConstants.ChangeType.MESSAGES_CONTROLLER)) { messageIds.addAll(accessor.getChildNames(keyBuilder.controllerMessages())); } else { LOG.warn("Unexpected ChangeType for Message Change CallbackHandler: " + changeType); return Collections.emptyList(); } _knownMessageIds.retainAll(messageIds); messageIds.removeAll(_knownMessageIds); List<PropertyKey> keys = new ArrayList<>(); for (String messageId : messageIds) { if (changeType.equals(HelixConstants.ChangeType.MESSAGE)) { keys.add(keyBuilder.message(instanceName, messageId)); } else if (changeType.equals(HelixConstants.ChangeType.MESSAGES_CONTROLLER)) { keys.add(keyBuilder.controllerMessage(messageId)); } } <START> List<Message> newMessages = accessor.getProperty(keys, true); <END> Iterator<Message> messageIterator = newMessages.iterator(); while(messageIterator.hasNext()) { if (messageIterator.next() == null) { messageIterator.remove(); } } return newMessages; }</code><technical_language>This is a good idea. If throws exception here, is event trigger message read. relies @mgao0 's periodical message refresh. if user set this up? Do throw exception read some message process them. ST done partial messages, delete message operation trigger another of read. I relies this logic is robust. least, is worse scenario throw exception here</technical_language>

Target:
private List<Message> readNewMessagesFromZK(HelixManager manager, String instanceName, HelixConstants.ChangeType changeType) { HelixDataAccessor accessor = manager.getHelixDataAccessor(); Builder keyBuilder = accessor.keyBuilder(); Set<String> messageIds = new HashSet<>(); if (changeType.equals(HelixConstants.ChangeType.MESSAGE)) { messageIds.addAll(accessor.getChildNames(keyBuilder.messages(instanceName))); } else if (changeType.equals(HelixConstants.ChangeType.MESSAGES_CONTROLLER)) { messageIds.addAll(accessor.getChildNames(keyBuilder.controllerMessages())); } else { LOG.warn("Unexpected ChangeType for Message Change CallbackHandler: " + changeType); return Collections.emptyList(); } _knownMessageIds.retainAll(messageIds); messageIds.removeAll(_knownMessageIds); List<PropertyKey> keys = new ArrayList<>(); for (String messageId : messageIds) { if (changeType.equals(HelixConstants.ChangeType.MESSAGE)) { keys.add(keyBuilder.message(instanceName, messageId)); } else if (changeType.equals(HelixConstants.ChangeType.MESSAGES_CONTROLLER)) { keys.add(keyBuilder.controllerMessage(messageId)); } } List<Message> newMessages = accessor.getProperty(keys, false); Iterator<Message> messageIterator = newMessages.iterator(); while(messageIterator.hasNext()) { if (messageIterator.next() == null) { messageIterator.remove(); } } return newMessages; }
Source:
<code>Slf4j(final Class<?> clazz) { <START> this(clazz, Slf4j.DEFAULT_LEVEL); <END> }</code><technical_language>do this(clazz.getName()) get rid of this DEFAULT_LEVEL constant,</technical_language>

Target:
Slf4j(final Class<?> clazz) { this(clazz.getName()); }
Source:
<code>public static Money zero() { <START> return new Money(org.joda.money.BigMoney.zero(CurrencyManager.getInstance().getDefaultCurrency())); <END> }</code><technical_language>java return Money.zero(CurrencyManager.getInstance().getDefaultCurrency());</technical_language>

Target:
public static Money zero() { return zero(CurrencyManager.getInstance().getDefaultCurrency()); }
Source:
<code>public Object getResult(VarianceData data) { <START> return new Double(Math.sqrt(data.squaredSum / data.count)); <END> }</code><technical_language>new Double is redundant</technical_language>

Target:
public Double getResult(VarianceData data) { return Math.sqrt(super.getResult(data)); }
Source:
<code>public boolean isActive() { <START> return isActive && (Math.abs(speed - 1f) >= CLOSE_THRESHOLD || Math.abs(pitch - 1f) >= CLOSE_THRESHOLD); <END> }</code><technical_language>AudioTrack.setPlaybackParameters currently assumes change playback parameters passthrough output. ENCODING_PCM_FLOAT behave if parameters applied, this processor inactive in case parameters applied. Thinking AudioProcessors more generally in context of this change: if in passthrough mode, moment AudioTrack applies ResamplingAudioProcessor get audio 16-bit PCM format applies other processors in turn, of expect 16-bit PCM input. In current design, expected audio processors other resampler input output PCM 16-bit encoding, throw if get else. If main case for this change is decode 32-bit float FfmpegAudioRenderer, I if simplify making ENCODING_PCM_FLOAT work passthrough, initially. (Perhaps a new boolean encodedOutput in AudioTrack, is true if passthrough is true true if writing float data.) audio processors need modified. in changes add support for resampling 24/32-bit PCM float a special case, potentially handle float input in other audio processors if is enough demand justify added complexity. do think</technical_language>

Target:
public boolean isActive() { return (Math.abs(speed - 1f) >= CLOSE_THRESHOLD || Math.abs(pitch - 1f) >= CLOSE_THRESHOLD); }
Source:
<code>public static ShannonEntropy createEntropy(final List<Rule> passwordRules, final PasswordData passwordData) { final boolean[] dictionaryCheck = new boolean[1]; <START> final boolean[] compositionCheck = new boolean[1]; <END> passwordRules.stream().forEach((rule) -> { if (!compositionCheck[0]) { if (rule instanceof CharacterCharacteristicsRule) { final CharacterCharacteristicsRule characteristicRule = (CharacterCharacteristicsRule) rule; for (CharacterRule r : characteristicRule.getRules()) { compositionCheck[0] = hasComposition(r, r.getValidCharacters(), passwordData); if (compositionCheck[0]) { break; } } } else if (rule instanceof AllowedCharacterRule) { final AllowedCharacterRule allowedCharacterRule = (AllowedCharacterRule) rule; compositionCheck[0] = hasComposition( rule, String.valueOf(allowedCharacterRule.getAllowedCharacters()), passwordData); } } if (AbstractDictionaryRule.class.isAssignableFrom(rule.getClass())) { dictionaryCheck[0] = true; } }); return new ShannonEntropy(dictionaryCheck[0], compositionCheck[0], passwordData.getPassword().length()); }</code><technical_language>I reason arrays other allow final mutability. If intent, simply drop final a plain boolean</technical_language>

Target:
public static ShannonEntropy createEntropy(final List<Rule> passwordRules, final PasswordData passwordData) { if (!passwordData.getOrigin().equals(PasswordData.Origin.User)) { throw new IllegalArgumentException("Password data must have an origin of " + PasswordData.Origin.User); } boolean dictionaryCheck = false; boolean compositionCheck = false; for (Rule rule : passwordRules) { if (!compositionCheck) { if (rule instanceof CharacterCharacteristicsRule) { final CharacterCharacteristicsRule characteristicRule = (CharacterCharacteristicsRule) rule; for (CharacterRule r : characteristicRule.getRules()) { compositionCheck = hasComposition(r, r.getValidCharacters(), passwordData); if (compositionCheck) { break; } } } else if (rule instanceof CharacterRule) { final CharacterRule characterRule = (CharacterRule) rule; compositionCheck = hasComposition(characterRule, characterRule.getValidCharacters(), passwordData); } else if (rule instanceof AllowedCharacterRule) { final AllowedCharacterRule allowedCharacterRule = (AllowedCharacterRule) rule; compositionCheck = hasComposition( rule, String.valueOf(allowedCharacterRule.getAllowedCharacters()), passwordData); } } if (AbstractDictionaryRule.class.isAssignableFrom(rule.getClass())) { dictionaryCheck = true; } } return new ShannonEntropy(dictionaryCheck, compositionCheck, passwordData.getPassword().length()); }
Source:
<code>public String toString() { <START> return MoreObjects.toStringHelper(this) <END> .add("name", name) .add("column", columnName) .add("expression", expressionStr) .toString(); }</code><technical_language>a simple string concat instead? this avoids unnecessary goggle common dependencies</technical_language>

Target:
public String toString() { return "CheckColumnConstraint{" + "name='" + name + '\'' + ", columnName='" + columnName + '\'' + ", expression=" + expression + '}'; }
Source:
<code>private static Collection<MethodNode> removeCovariantsAndInterfaceEquivalents(Collection<MethodNode> collection) { if (collection.size()<=1) return collection; List<MethodNode> toBeRemoved = new LinkedList<MethodNode>(); List<MethodNode> list = new LinkedList<MethodNode>(new HashSet<MethodNode>(collection)); for (int i=0;i<list.size()-1;i++) { MethodNode one = list.get(i); if (toBeRemoved.contains(one)) continue; for (int j=i+1;j<list.size();j++) { MethodNode two = list.get(j); if (toBeRemoved.contains(two)) continue; Parameter[] onePars = one.getParameters(); Parameter[] twoPars = two.getParameters(); if (onePars.length == twoPars.length) { if (areOverloadMethodsInSameClass(one,two)) { <START> if (ParameterUtils.parametersEqual(onePars, twoPars)){ <END> removeMethodWithSuperReturnType(toBeRemoved, one, two); } else { removeSyntheticMethodIfOne(toBeRemoved, one, two); } }else if(areEquivalentInterfaceMethods(one, two, onePars, twoPars)){ removeMethodInSuperInterface(toBeRemoved, one, two); } } } } if (toBeRemoved.isEmpty()) return list; List<MethodNode> result = new LinkedList<MethodNode>(list); result.removeAll(toBeRemoved); return result; }</code><technical_language>If Parameter[] parameters removed areEquivalentInterfaceMethods method I arguments replaced one.getParameters(), two.getParameters() local variables needed. a suggestion</technical_language>

Target:
private static Collection<MethodNode> removeCovariantsAndInterfaceEquivalents(Collection<MethodNode> collection) { if (collection.size()<=1) return collection; List<MethodNode> toBeRemoved = new LinkedList<MethodNode>(); List<MethodNode> list = new LinkedList<MethodNode>(new HashSet<MethodNode>(collection)); for (int i=0;i<list.size()-1;i++) { MethodNode one = list.get(i); if (toBeRemoved.contains(one)) continue; for (int j=i+1;j<list.size();j++) { MethodNode two = list.get(j); if (toBeRemoved.contains(two)) continue; if (one.getParameters().length == two.getParameters().length) { if (areOverloadMethodsInSameClass(one,two)) { if (ParameterUtils.parametersEqual(one.getParameters(), two.getParameters())){ removeMethodWithSuperReturnType(toBeRemoved, one, two); } else { removeSyntheticMethodIfOne(toBeRemoved, one, two); } }else if(areEquivalentInterfaceMethods(one, two)){ removeMethodInSuperInterface(toBeRemoved, one, two); } } } } if (toBeRemoved.isEmpty()) return list; List<MethodNode> result = new LinkedList<MethodNode>(list); result.removeAll(toBeRemoved); return result; }
Source:
<code>default <T> List<T> findDescendantsOfType(Class<T> targetType) { final List<T> list = new ArrayList<>(); TraversalUtils.findDescendantsOfType(this, targetType, list, false); <START> return list; <END> }</code><technical_language>this implementation bogus, simply call return findDescendantsOfType(targetType, false);</technical_language>

Target:
default <T> List<T> findDescendantsOfType(Class<T> targetType) { return findDescendantsOfType(targetType, false); }
Source:
<code>public void setup() throws Exception { <START> System.setProperty("java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory"); <END> System.setProperty("org.osjava.sj.root", "file://src/test/resources"); System.setProperty("org.osjava.sj.delimiter", "."); System.setProperty("jndi.syntax.separator", "/"); System.setProperty("org.osjava.sj.space", "java:/comp/env"); this.initContext = new InitialContext(); }</code><technical_language>If System properties reset test tears down? want unexpected side effects other tests run</technical_language>

Target:
public void setup() throws Exception { this.initContext = new InitialContext(); }
Source:
<code>public String toString() { <START> return "MistDataEvent with value: " + value.toString() + ", timestamp: " + timestamp; <END> }</code><technical_language>Please StringBuilder</technical_language>

Target:
public String toString() { return new StringBuilder("MistDataEvent with value: ") .append(value.toString()) .append(", timestamp: ") .append(timestamp) .toString(); }
Source:
<code>public long extractTimestampMillis(final Message message) { JSONObject jsonObject = (JSONObject) JSONValue.parse(message.getPayload()); if (jsonObject != null) { Object fieldValue = jsonObject.get(mConfig.getMessageTimestampName()); if (fieldValue != null) { <START> String timestamp = fieldValue.toString(); <END> try { return toMillis(Double.valueOf(timestamp).longValue()); } catch (NumberFormatException e) { DateTime dateTime = new DateTime(timestamp); return dateTime.getMillis(); } } } return 0; }</code><technical_language>This functionality (parsing date string in a DateFormatter) is provided in DatesMessageParser.java</technical_language>

Target:
public long extractTimestampMillis(final Message message) { JSONObject jsonObject = (JSONObject) JSONValue.parse(message.getPayload()); if (jsonObject != null) { Object fieldValue = jsonObject.get(mConfig.getMessageTimestampName()); if (fieldValue != null) { return toMillis(Double.valueOf(fieldValue.toString()).longValue()); } } return 0; }
Source:
<code>private void initSmartLockForPasswords() { <START> if (!isSmartLockAvailable()) { <END> return; } mCredentialsClient = new GoogleApiClient.Builder(getActivity()) .addConnectionCallbacks(this) .enableAutoManage(getActivity(), this) .addApi(Auth.CREDENTIALS_API) .build(); }</code><technical_language>Nope isGooglePlayServicesAvailable test , mCredentialsClient null</technical_language>

Target:
private void initSmartLockForPasswords() { if (!isGooglePlayServicesAvailable()) { return; } mCredentialsClient = new GoogleApiClient.Builder(getActivity()) .addConnectionCallbacks(this) .enableAutoManage(getActivity(), this) .addApi(Auth.CREDENTIALS_API) .build(); }
Source:
<code>private CreateWsResponse doHandle(DbSession dbSession, CreateRequest createRequest, Request request, OrganizationDto organization) { QProfileResult result = new QProfileResult(); QualityProfileDto profile = profileFactory.checkAndCreate(dbSession, organization, QProfileName.createFor(createRequest.getLanguage(), createRequest.getProfileName())); result.setProfile(profile); for (ProfileImporter importer : importers) { String importerKey = importer.getKey(); InputStream contentToImport = request.paramAsInputStream(getBackupParamName(importerKey)); if (contentToImport != null) { result.add(exporters.importXml(profile, importerKey, contentToImport, dbSession)); } } String organizationKey = qProfileWsSupport.getOrganization(dbSession, result.profile()).getKey(); dbSession.commit(); activeRuleIndexer.index(result.getChanges()); <START> return buildResponse(result, organizationKey); <END> }</code><technical_language>minor - OrganizationDto IMO</technical_language>

Target:
private CreateWsResponse doHandle(DbSession dbSession, CreateRequest createRequest, Request request, OrganizationDto organization) { QProfileResult result = new QProfileResult(); QualityProfileDto profile = profileFactory.checkAndCreate(dbSession, organization, QProfileName.createFor(createRequest.getLanguage(), createRequest.getProfileName())); result.setProfile(profile); for (ProfileImporter importer : importers) { String importerKey = importer.getKey(); InputStream contentToImport = request.paramAsInputStream(getBackupParamName(importerKey)); if (contentToImport != null) { result.add(exporters.importXml(profile, importerKey, contentToImport, dbSession)); } } dbSession.commit(); activeRuleIndexer.index(result.getChanges()); return buildResponse(result, organization); }
Source:
<code>public void testMetricIngestionWithEnum() throws Exception { final String tenant_id = "333333"; String prefix = getPrefix(); <START> final String metric_name = prefix + "enum_metric_test"; <END> Set<Locator> locators = new HashSet<Locator>(); locators.add(Locator.createLocatorFromPathComponents(tenant_id, metric_name)); HttpResponse response = postMetric(tenant_id, postAggregatedPath, "sample_enums_payload.json", prefix ); assertEquals( "Should get status 200 from ingestion server for POST", 200, response.getStatusLine().getStatusCode() ); EntityUtils.consume(response.getEntity()); EnumValidator enumValidator = new EnumValidator(locators); enumValidator.run(); Thread.sleep(3000); HttpResponse query_response = queryMetricIncludeEnum(tenant_id, metric_name); assertEquals( "Should get status 200 from query server for GET", 200, query_response.getStatusLine().getStatusCode() ); String responseContent = EntityUtils.toString(query_response.getEntity(), "UTF-8"); assertEquals( String.format( "[{\"metric\":\"%s\",\"enum_values\":[\"v1\",\"v2\",\"v3\"]}]", metric_name ), responseContent ); EntityUtils.consume(query_response.getEntity()); }</code><technical_language>curious, put random number prefix, supposed postfix? harder for search in Cassandra ES want verify if metrics in systems</technical_language>

Target:
public void testMetricIngestionWithEnum() throws Exception { final String tenant_id = "333333"; String postfix = getPostfix(); final String metric_name = "enum_metric_test" + postfix; Set<Locator> locators = new HashSet<Locator>(); locators.add(Locator.createLocatorFromPathComponents(tenant_id, metric_name)); HttpResponse response = postMetric(tenant_id, postAggregatedPath, "sample_enums_payload.json", postfix ); assertEquals( "Should get status 200 from ingestion server for POST", 200, response.getStatusLine().getStatusCode() ); EntityUtils.consume(response.getEntity()); EnumValidator enumValidator = new EnumValidator(locators); enumValidator.run(); Thread.sleep(3000); HttpResponse query_response = queryMetricIncludeEnum(tenant_id, metric_name); assertEquals( "Should get status 200 from query server for GET", 200, query_response.getStatusLine().getStatusCode() ); String responseContent = EntityUtils.toString(query_response.getEntity(), "UTF-8"); assertEquals( String.format( "[{\"metric\":\"%s\",\"enum_values\":[\"v1\",\"v2\",\"v3\"]}]", metric_name ), responseContent ); EntityUtils.consume(query_response.getEntity()); }
Source:
<code>protected void drawStepContent() { Text textWidget = new Text(textToShow); ScrollPane scrollPane = new ScrollPane(); scrollPane.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY))); <START> scrollPane.setStyle("-fx-background: #F4F4F4; -fx-border-color: #F4F4F4;"); <END> scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setFitToWidth(true); scrollPane.setContent(new TextFlow(textWidget)); this.addToContentPane(scrollPane); }</code><technical_language>This need set in CSS</technical_language>

Target:
protected void drawStepContent() { Text textWidget = new Text(textToShow); ScrollPane scrollPane = new ScrollPane(); scrollPane.setId("stepScrollPane"); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setFitToWidth(true); scrollPane.setContent(new TextFlow(textWidget)); this.addToContentPane(scrollPane); }
Source:
<code>public void shouldReportOOMAfterWait() { try ( GenericContainer container = new GenericContainer<>() .waitingFor(new WaitForState(ContainerState::getOOMKilled)) .withCreateContainerCmdModifier(it -> { it.getHostConfig().withMemory(4 * FileUtils.ONE_MB); }) <START> .withCommand("sh", "-c", "usleep 100; dd if=/dev/urandom bs=128GB count=1 > test.txt") <END> ) { assertThatThrownBy(container::start) .hasStackTraceContaining("Container crashed with out-of-memory"); } }</code><technical_language>Gulp... get this right sight I perplexed writing disk OOMKill all, realised matters is blocksize >4MB, dd buffers memory writing. If case, > /dev/null of=/dev/null explicit blackholing data? This slightly alarming for reading code in future fears fill disk garbage</technical_language>

Target:
public void shouldReportOOMAfterWait() { try ( GenericContainer container = new GenericContainer<>() .withStartupCheckStrategy(new NoopStartupCheckStrategy()) .waitingFor(new WaitForState(ContainerState::getOOMKilled)) .withCreateContainerCmdModifier(it -> { it.getHostConfig().withMemory(4 * FileUtils.ONE_MB); }) .withCommand("sh", "-c", "A='0123456789'; for i in $(seq 0 32); do A=$A$A; done") ) { assertThatThrownBy(container::start) .hasStackTraceContaining("Container crashed with out-of-memory"); } }
Source:
<code>private Integer getQosBandwidth(Guid clusterId) { <START> final HostNetworkQos migrationalHostNetworkQos = getDbFacade().getHostNetworkQosDao() <END> .getHostNetworkQosOfMigrationNetworkByClusterId(clusterId); if (migrationalHostNetworkQos == null) { return null; } if (migrationalHostNetworkQos.getOutAverageRealtime() != null) { return migrationalHostNetworkQos.getOutAverageRealtime(); } return migrationalHostNetworkQos.getOutAverageUpperlimit(); }</code><technical_language>migrationHostNetworkQos instead maybe? migrational sounds weird.</technical_language>

Target:
private Integer getQosBandwidth(Guid clusterId) { final HostNetworkQos migrationHostNetworkQos = getDbFacade().getHostNetworkQosDao() .getHostNetworkQosOfMigrationNetworkByClusterId(clusterId); if (migrationHostNetworkQos == null) { return null; } if (migrationHostNetworkQos.getOutAverageRealtime() != null) { return migrationHostNetworkQos.getOutAverageRealtime(); } return migrationHostNetworkQos.getOutAverageUpperlimit(); }
Source:
<code>private List<String> generateTableList() throws ODataServiceFault { List<String> tableList = new ArrayList<>(); Connection connection = null; ResultSet rs = null; try { connection = initializeConnection(); DatabaseMetaData meta = connection.getMetaData(); if (meta.getDatabaseProductName().toLowerCase().contains(ORACLE_SERVER)) { rs = meta.getTables(null, meta.getUserName(), null, new String[] { TABLE, VIEW }); } else if (meta.getDatabaseProductName().toLowerCase().contains(MSSQL_SERVER)) { rs = meta.getTables(null, connection.getSchema(), null, new String[] { TABLE, VIEW }); } else { rs = meta.getTables(null, null, null, new String[] { TABLE, VIEW }); } while (rs.next()) { String tableName = rs.getString(TABLE_NAME); tableList.add(tableName); } if (meta.getDatabaseProductName().toLowerCase().contains(ORACLE_SERVER) && !connection.getSchema(). <START> equals(meta.getUserName())) { <END> rs = meta.getTables(null, connection.getSchema(), null, new String[] { TABLE, VIEW }); while (rs.next()) { String tableName = rs.getString(TABLE_NAME); tableList.add(tableName); } } return tableList; } catch (SQLException e) { throw new ODataServiceFault(e, "Error in reading tables from the database. :" + e.getMessage()); } finally { releaseResources(rs, null); releaseConnection(connection); } }</code><technical_language>do a null check for connection.getSchema()</technical_language>

Target:
private List<String> generateTableList() throws ODataServiceFault { List<String> tableList = new ArrayList<>(); Connection connection = null; ResultSet rs = null; try { connection = initializeConnection(); DatabaseMetaData meta = connection.getMetaData(); if (meta.getDatabaseProductName().toLowerCase().contains(ORACLE_SERVER)) { rs = meta.getTables(null, meta.getUserName(), null, new String[] { TABLE, VIEW }); } else if (meta.getDatabaseProductName().toLowerCase().contains(MSSQL_SERVER)) { rs = meta.getTables(null, connection.getSchema(), null, new String[] { TABLE, VIEW }); } else { rs = meta.getTables(null, null, null, new String[] { TABLE, VIEW }); } while (rs.next()) { String tableName = rs.getString(TABLE_NAME); tableList.add(tableName); } if (connection.getSchema() != null) { if (meta.getDatabaseProductName().toLowerCase().contains(ORACLE_SERVER) && !connection.getSchema(). equals(meta.getUserName())) { rs = meta.getTables(null, connection.getSchema(), null, new String[] { TABLE, VIEW }); while (rs.next()) { String tableName = rs.getString(TABLE_NAME); tableList.add(tableName); } } } return tableList; } catch (SQLException e) { throw new ODataServiceFault(e, "Error in reading tables from the database. :" + e.getMessage()); } finally { releaseResources(rs, null); releaseConnection(connection); } }
Source:
<code>private void processDirectoryTree(Path path) throws IOException, InterruptedException { FileStatus[] fileStatuses = abfsStore.listStatus(path); for (FileStatus fileStatus : fileStatuses) { if (fileStatus.isDirectory()) { queue.put(fileStatus); processDirectory(); synchronized (this) { if (!queue.isEmpty()) { executorService.submit(() -> { try { FileStatus fileStatus1; <START> while ((fileStatus1 = queue.poll(100, TimeUnit.MILLISECONDS)) != null) { <END> processDirectoryTree(fileStatus1.getPath()); } } catch (InterruptedException | IOException e) { e.printStackTrace(); } }); } } } else { processFile(fileStatus); } } }</code><technical_language>I end < max threads in case: is 1 thread work, rest waiting queue.poll thread is files list responses slow. is queue subdir. rest of threads timeout fall of thread main</technical_language>

Target:
private void processDirectoryTree(Path path) throws IOException, InterruptedException { FileStatus[] fileStatuses = abfsStore.listStatus(path); for (FileStatus fileStatus : fileStatuses) { if (fileStatus.isDirectory()) { queue.put(fileStatus); processDirectory(); synchronized (this) { if (!queue.isEmpty() && numTasks.get() < NUM_THREADS) { numTasks.incrementAndGet(); Future<Object> future = executorService.submit(() -> { FileStatus fileStatus1; while ((fileStatus1 = queue.poll(POLL_TIMEOUT, TimeUnit.MILLISECONDS)) != null) { processDirectoryTree(fileStatus1.getPath()); } numTasks.decrementAndGet(); return null; }); futures.add(future); } } } else { processFile(fileStatus); } } }
Source:
<code>public Pattern getHeaderPattern(String key) { <START> String pattern = configuration.getString(key); <END> if(pattern == null) return null; return Pattern.compile(configuration.getString(key)); }</code><technical_language>configuration.getString is invoked</technical_language>

Target:
public Optional<Pattern> getHeaderPattern(String key) { Optional<String> property = getString(key); if (property.isPresent()) { return Optional.of(Pattern.compile(property.get())); } else { return Optional.empty(); } }
Source:
<code>public void downloadLockedEmailTest() throws Exception { when(authService.getUserDetails("test@test.com")) .thenReturn((Map)ImmutableMap.of( <START> "locked", true <END> )); this.mockMvc.perform(get("/occurrences/offline/download*") .param("reasonTypeId", "10") .param("email", "test@test.com")) .andExpect(status().is4xxClientError()); verify(authService).getUserDetails("test@test.com"); }</code><technical_language>useful a "locked=true" test ROLE_USER (and "activated=true", "activated=false")</technical_language>

Target:
public void downloadLockedEmailTest() throws Exception { when(authService.getUserDetails("test@test.com")) .thenReturn((Map)ImmutableMap.of( "activated", true, "locked", true )); this.mockMvc.perform(get("/occurrences/offline/download*") .param("reasonTypeId", "10") .param("email", "test@test.com")) .andExpect(status().is4xxClientError()); verify(authService).getUserDetails("test@test.com"); }
Source:
<code>public boolean belongsTo(Object family) { return family == <START> AbstractDispatchJob.class; <END> }</code><technical_language>This .class .this, this allow get debugger events dispatched jobs for current dispatched</technical_language>

Target:
public boolean belongsTo(Object family) { return family == EventDispatcher.class || family == EventDispatcher.this; }
Source:
<code>public String getName() { <START> return "Line"; <END> }</code><technical_language>"line"</technical_language>

Target:
public String getName() { return "line"; }
Source:
<code>private boolean contentCheck(DirCacheEntry entry) { if (getEntryObjectId().equals(entry.getObjectId())) { entry.setLength((int) getEntryLength()); return false; } else { switch (getOptions().getAutoCRLF()) { case INPUT: case TRUE: InputStream dcIn = null; try { ObjectLoader loader = repository.open(entry.getObjectId()); dcIn = loader.openStream(); if (RawText.isBinary(dcIn)) return true; dcIn.close(); dcIn = new EolCanonicalizingInputStream( loader.openStream(), true); long dcInLen = computeLength(dcIn); dcIn.close(); dcIn = new EolCanonicalizingInputStream( loader.openStream(), true); byte[] autoCrLfHash = computeHash(dcIn, dcInLen); <START> return getEntryObjectId().compareTo(autoCrLfHash, 0) != 0; <END> } catch (IOException e) { return false; } finally { if (dcIn != null) try { dcIn.close(); } catch (IOException e) { } } case FALSE: break; } return true; } }</code><technical_language>I algorithm work. I wondering more efficient way. In this block reading some parts of content 3 times. RawText.isBinary read 8 KB. reading complete file compute resulting length . finally reading a time, do EOLCanonicalization in previous step comput a SHA1 of content. If a InputStream do EolCanonicalization a arbitrary length stream save of reading file. If InputStream implementation throw exception if detects file is binary save another of reading content. a big performance boost I guess. do in a change - I fix this</technical_language>

Target:
private boolean contentCheck(DirCacheEntry entry) { if (getEntryObjectId().equals(entry.getObjectId())) { entry.setLength((int) getEntryLength()); return false; } else { switch (getOptions().getAutoCRLF()) { case INPUT: case TRUE: InputStream dcIn = null; try { ObjectLoader loader = repository.open(entry.getObjectId()); dcIn = loader.openStream(); if (RawText.isBinary(dcIn)) return true; dcIn.close(); dcIn = new EolCanonicalizingInputStream( loader.openStream(), true); long dcInLen = computeLength(dcIn); dcIn.close(); dcIn = new EolCanonicalizingInputStream( loader.openStream(), true); byte[] autoCrLfHash = computeHash(dcIn, dcInLen); boolean changed = getEntryObjectId().compareTo( autoCrLfHash, 0) != 0; if (!changed) { entry.setLength((int) getEntryLength()); entry.setObjectIdFromRaw(autoCrLfHash, 0); } return changed; } catch (IOException e) { return false; } finally { if (dcIn != null) try { dcIn.close(); } catch (IOException e) { } } case FALSE: break; } return true; } }
Source:
<code><START> protected CharacterHit hit(double x, double y) { <END> VirtualFlowHit<Cell<Paragraph<S, PS>, ParagraphBox<S, PS>>> hit = virtualFlow.hit(x, y); if(hit.isBeforeCells()) { return CharacterHit.insertionAt(0); } else if(hit.isAfterCells()) { return CharacterHit.insertionAt(getLength()); } else { int parIdx = hit.getCellIndex(); int parOffset = getParagraphOffset(parIdx); ParagraphBox<S, PS> cell = hit.getCell().getNode(); Point2D cellOffset = hit.getCellOffset(); CharacterHit parHit = cell.hit(cellOffset); return parHit.offset(parOffset); } }</code><technical_language>want this public other package private</technical_language>

Target:
public CharacterHit hit(double x, double y) { VirtualFlowHit<Cell<Paragraph<S, PS>, ParagraphBox<S, PS>>> hit = virtualFlow.hit(x, y); if(hit.isBeforeCells()) { return CharacterHit.insertionAt(0); } else if(hit.isAfterCells()) { return CharacterHit.insertionAt(getLength()); } else { int parIdx = hit.getCellIndex(); int parOffset = getParagraphOffset(parIdx); ParagraphBox<S, PS> cell = hit.getCell().getNode(); Point2D cellOffset = hit.getCellOffset(); CharacterHit parHit = cell.hit(cellOffset); return parHit.offset(parOffset); } }
Source:
<code>public boolean isConstantExpression(IASTNode point) { return fArgument.isConstantExpression(point) <START> && (getOverload(point) == null || getOverload(point).isConstexpr()); <END> }</code><technical_language>Avoid calling getOverload twice</technical_language>

Target:
public boolean isConstantExpression(IASTNode point) { return fArgument.isConstantExpression(point) && isConstexprFuncOrNull(getOverload(point)); }
Source:
<code>private HikariCPCollector getCollector() { if (collector == null) { if (globalCollector == null) { <START> collector = globalCollector = new HikariCPCollector(); <END> } else { collector = globalCollector; } } return collector; }</code><technical_language>atomic. threads reach line 100</technical_language>

Target:
private HikariCPCollector getCollector() { if (collector == null) { checkGlobalCollector(); collector = globalCollector; } return collector; }
Source:
<code>public void run(Display display, Shell shell) { shell.setSize(700, 500); try { new TextCanvas(shell, SWT.NONE); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } FillLayout fillLayout = new FillLayout(); shell.setLayout(fillLayout); shell.open(); <START> shell.addDisposeListener(new DisposeListener() { <END> public void widgetDisposed(DisposeEvent e) { ColorFactory.disposeAll(); } }); }</code><technical_language>this equivalent of [in Examples.java](<LINK_0></technical_language>

Target:
public void run(Display display, Shell shell) { shell.setSize(700, 500); try { new TextCanvas(shell, SWT.NONE); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } FillLayout fillLayout = new FillLayout(); shell.setLayout(fillLayout); shell.open(); }
Source:
<code>public void onModelFound(Request _request) { request = _request; User client = request.getClient(); createViews(client); createMapViews(client); bar.setTitle(request.getDisplayDollars() + " | " + request.getTitle()); bar.setXMarkVisibility(View.VISIBLE, null); bar.setRightArrowVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { request.setState(Request.State.PENDING); request.saveEventually(new SaveCallback() { @Override public void done(ParseException e) { if (e==null) { <START> Intent i = new Intent(getBaseContext(), RequestPendingVendorActivity.class); <END> startActivity(i); } else { onError(e); } } }); } }); }</code><technical_language>getBaseContext() RequestActiveVendorActivity.this (I Nate recommended this)</technical_language>

Target:
public void onModelFound(Request _request) { request = _request; User client = request.getClient(); createViews(client); createMapViews(client); bar.setTitle(request.getDisplayDollars() + " | " + request.getTitle()); bar.setXMarkVisibility(View.VISIBLE, null); bar.setRightArrowVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { request.setState(Request.State.PENDING); request.saveEventually(new SaveCallback() { @Override public void done(ParseException e) { if (e==null) { Intent i = new Intent( RequestActiveVendorActivity.this, RequestPendingVendorActivity.class ); startActivity(i); } else { onError(e); } } }); } }); }
Source:
<code>public void sequentialPredict(PredictParams predictParams) throws Exception { try { MultiLayerNetwork model = predictParams.getSequentialModel(); DataSetIterator dataSetIterator = new HDF5MiniBatchDataSetIterator( predictParams.getFeaturesDirectory() ); while(dataSetIterator.hasNext()) { DataSet data = dataSetIterator.next(); <START> model.output(data.getFeatures()); <END> } log.info("model.predict() operation complete."); } catch (Throwable e) { log.error("Error while performing model.predict()", e); throw e; } }</code><technical_language>Results saved anywhere..</technical_language>

Target:
public double[][] sequentialPredict(PredictParams predictParams) throws Exception { try { MultiLayerNetwork model = predictParams.getSequentialModel(); DataSetIterator dataSetIterator = new HDF5MiniBatchDataSetIterator( predictParams.getFeaturesDirectory() ); INDArray ret = model.output(dataSetIterator); log.info("model.predict() operation complete."); return NDArrayHelper.toFlattened(ret); } catch (Throwable e) { log.error("Error while performing model.predict()", e); throw e; } }
Source:
<code>public void applicationDefaultServiceAccountWhenConfigured() throws Exception { CredentialFactory credentialFactory = getCredentialFactory(); withEnvironmentVariable(CREDENTIAL_ENV_VAR, getStringPath("test-credential.json")) <START> .execute(() -> { <END> GoogleCredentialWithRetry credential = (GoogleCredentialWithRetry) credentialFactory.getCredential(TEST_SCOPES); assertThat(credential.getServiceAccountId()).isEqualTo("test-email@gserviceaccount.com"); assertThat(credential.getServiceAccountPrivateKeyId()).isEqualTo("test-key-id"); }); }</code><technical_language>suggestion for future feature - good if execute other method returns result consumed and/or asserted of lambda - similar pattern JUnit assertThrows method: java Exception e = assertThrows(Exception.class, () -> ...) this functionality allow tests more readable, obvious exact commands need env variables set</technical_language>

Target:
public void applicationDefaultServiceAccountWhenConfigured() throws Exception { CredentialFactory credentialFactory = getCredentialFactory(); GoogleCredentialWithRetry credential = (GoogleCredentialWithRetry) withEnvironmentVariable(CREDENTIAL_ENV_VAR, getStringPath("test-credential.json")) .execute(() -> credentialFactory.getCredential(TEST_SCOPES)); assertThat(credential.getServiceAccountId()).isEqualTo("test-email@gserviceaccount.com"); assertThat(credential.getServiceAccountPrivateKeyId()).isEqualTo("test-key-id"); }
Source:
<code>String getApiTailUrl(String tail) { <START> return repo.getApiTailUrl(tail); <END> }</code><technical_language>of children stats/, string move in here. suggestion return repo.getApiTailUrl("stats/" + tail);</technical_language>

Target:
String getApiTailUrl(String tail) { return repo.getApiTailUrl("stats/" + tail); }
Source:
<code>private void log(Level level, Object message, Throwable t) { <START> log(level, message, t, null); <END> }</code><technical_language>indentation. please code style guidelines wiki</technical_language>

Target:
private void log(Level level, Object message, Throwable t) { if (!logger.isLoggable(level)) { return; } String msg = (message == null) ? "NULL" : message.toString(); LogRecord record = new LogRecord(level, msg); record.setLoggerName(logger.getName()); record.setThrown(t); record.setSourceClassName(null); logger.log(record); }
Source:
<code>public void doNotVerifyHostnameWhenVerificationIsOff() throws Exception { Properties properties = new Properties(); <START> properties.setProperty(GeneralOption.HOST.getKey(), "127.0.0.1"); <END> properties.setProperty(GeneralOption.PORT.getKey(), Integer.toString(trustedService.httpsPort())); properties.setProperty(GeneralOption.USE_HTTPS.getKey(), "true"); properties.setProperty(GeneralOption.VERIFY_SSL.getKey(), "false"); ConnectorDetails connectorDetails = new ConnectorDetails(ConfigurationBuilder.initFromProperties(properties)); HttpHelper httpHelper = new HttpHelper(); HttpHost httpHost = httpHelper.buildHttpHost(connectorDetails); CloseableHttpClient closeableHttpClient = httpHelper.buildClient(httpHost, connectorDetails); CloseableHttpResponse response = closeableHttpClient.execute(httpHost, new HttpGet("/hello")); assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); }</code><technical_language>[PMD] INFO: Do hard code IP address</technical_language>

Target:
public void doNotVerifyHostnameWhenVerificationIsOff() throws Exception { ConnectorDetails connectorDetails = buildConnectorDetails("127.0.0.1", trustedService.httpsPort(), "true", "false"); HttpHelper httpHelper = new HttpHelper(); HttpHost httpHost = httpHelper.buildHttpHost(connectorDetails); CloseableHttpClient closeableHttpClient = httpHelper.buildClient(httpHost, connectorDetails); CloseableHttpResponse response = closeableHttpClient.execute(httpHost, new HttpGet("/hello")); assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); }
Source:
<code>public QuectelEC25(ModemDevice device, String platform, ConnectionFactory connectionFactory) { super(device, platform, connectionFactory); try { String atPort = getAtPort(); String gpsPort = getGpsPort(); if (atPort != null) { if (atPort.equals(getDataPort()) || atPort.equals(gpsPort)) { <START> this.m_serialNumber = getSerialNumber(); <END> this.m_imsi = getMobileSubscriberIdentity(); this.m_iccid = getIntegratedCirquitCardId(); this.m_model = getModel(); this.m_manufacturer = getManufacturer(); this.m_revisionId = getRevisionID(); this.m_gpsSupported = isGpsSupported(); this.m_rssi = getSignalStrength(); s_logger.trace("{} :: Serial Number={}", getClass().getName(), this.m_serialNumber); s_logger.trace("{} :: IMSI={}", getClass().getName(), this.m_imsi); s_logger.trace("{} :: ICCID={}", getClass().getName(), this.m_iccid); s_logger.trace("{} :: Model={}", getClass().getName(), this.m_model); s_logger.trace("{} :: Manufacturer={}", getClass().getName(), this.m_manufacturer); s_logger.trace("{} :: Revision ID={}", getClass().getName(), this.m_revisionId); s_logger.trace("{} :: GPS Supported={}", getClass().getName(), this.m_gpsSupported); s_logger.trace("{} :: RSSI={}", getClass().getName(), this.m_rssi); } } } catch (KuraException e) { e.printStackTrace(); } }</code><technical_language>class variables used/assigned declared</technical_language>

Target:
public QuectelEC25(ModemDevice device, String platform, ConnectionFactory connectionFactory) { super(device, platform, connectionFactory); try { String atPort = getAtPort(); String gpsPort = getGpsPort(); if (atPort != null) { if (atPort.equals(getDataPort()) || atPort.equals(gpsPort)) { this.m_serialNumber = getSerialNumber(); this.m_imsi = getMobileSubscriberIdentity(); this.m_iccid = getIntegratedCirquitCardId(); this.m_model = getModel(); this.m_manufacturer = getManufacturer(); this.m_revisionId = getRevisionID(); this.m_gpsSupported = isGpsSupported(); this.m_rssi = getSignalStrength(); logger.trace("{} :: Serial Number={}", getClass().getName(), this.m_serialNumber); logger.trace("{} :: IMSI={}", getClass().getName(), this.m_imsi); logger.trace("{} :: ICCID={}", getClass().getName(), this.m_iccid); logger.trace("{} :: Model={}", getClass().getName(), this.m_model); logger.trace("{} :: Manufacturer={}", getClass().getName(), this.m_manufacturer); logger.trace("{} :: Revision ID={}", getClass().getName(), this.m_revisionId); logger.trace("{} :: GPS Supported={}", getClass().getName(), this.m_gpsSupported); logger.trace("{} :: RSSI={}", getClass().getName(), this.m_rssi); } } } catch (KuraException e) { e.printStackTrace(); } }