auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void doAddBundle() { try { Workspace workspace = model.getWorkspace(); RepoBundleSelectionWizard wizard = new RepoBundleSelectionWizard(workspace, new ArrayList<VersionedClause>(), DependencyPhase.Run); wizard.setSelectionPageTitle("Add Bundle Requirement"); WizardDialog dialog = new WizardDialog(getSection().getShell(), wizard); if (Window.OK == dialog.open()) { final List<VersionedClause> result = wizard.getSelectedBundles(); final List<Requirement> adding = new ArrayList<Requirement>(result.size()); for (VersionedClause bundle : result) { Filter filter = new SimpleFilter(IdentityNamespace.IDENTITY_NAMESPACE, bundle.getName()); String versionRange = bundle.getVersionRange(); if (versionRange != null && !"latest".equals(versionRange)) { filter = new AndFilter().addChild(filter).addChild(new LiteralFilter(Filters.fromVersionRange(versionRange))); } Requirement req = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString()).buildSyntheticRequirement(); <START> adding.add(req); <END> } addRequirementWithCheckForExisting(adding); } } catch (Exception e) { ErrorDialog.openError(getSection().getShell(), "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error selecting bundles.", e)); } }</code><technical_language>remove empty check calling new method. empty check. I assume consistent</technical_language>

Target:
private void doAddBundle() { try { Workspace workspace = model.getWorkspace(); RepoBundleSelectionWizard wizard = new RepoBundleSelectionWizard(workspace, new ArrayList<VersionedClause>(), DependencyPhase.Run); wizard.setSelectionPageTitle("Add Bundle Requirement"); WizardDialog dialog = new WizardDialog(getSection().getShell(), wizard); if (Window.OK == dialog.open()) { final List<VersionedClause> result = wizard.getSelectedBundles(); final Set<Requirement> adding = new HashSet<Requirement>(result.size()); for (VersionedClause bundle : result) { Filter filter = new SimpleFilter(IdentityNamespace.IDENTITY_NAMESPACE, bundle.getName()); String versionRange = bundle.getVersionRange(); if (versionRange != null && !"latest".equals(versionRange)) { filter = new AndFilter().addChild(filter).addChild(new LiteralFilter(Filters.fromVersionRange(versionRange))); } Requirement req = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString()).buildSyntheticRequirement(); adding.add(req); } if (!adding.isEmpty()) { updateViewerWithNewRequirements(adding); } } } catch (Exception e) { ErrorDialog.openError(getSection().getShell(), "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error selecting bundles.", e)); } }
Source:
<code>public void writeBasedOnFeaturePath(final Path featurePath) throws IOException { <START> if (!Files.isRegularFile(featurePath)) return; <END> write(Tribble.tabixIndexPath(featurePath)); }</code><technical_language>Ack, good catch. terrible behavior. I done way? needs log a warning. I prefer suggestion fail a TribbleException, I need investigate if break existing downstream code somehow. For now, log a warning, open a new ticket change behavior</technical_language>

Target:
public void writeBasedOnFeaturePath(final Path featurePath) throws IOException { if (!Files.isRegularFile(featurePath)) { LOGGER.warn("Index not written into ", featurePath); return; } write(Tribble.tabixIndexPath(featurePath)); }
Source:
<code>public ResponseEntity<FileSystemResource> getImportGermplasmExcelTemplate(@PathVariable final String cropName, @RequestParam(required = false) final String programUUID) { <START> final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); final List<VariableDetails> units = this.variableService.getVariablesByFilter(variableFilter); final List<LocationDto> storageLocation = this.locationService.getLocations(cropName, programUUID, GermplasmResource.STORAGE_LOCATION_TYPE, null, null, false); final List<LocationDto> locations = this.locationService.getLocations(cropName, programUUID, GermplasmResource.LOCATION_TYPE, null, null, false); final List<org.generationcp.middleware.api.brapi.v1.attribute.AttributeDTO> attributeDTOS = this.germplasmService.getGermplasmAttributes(); final List<Method> breedingMethods = this.germplasmService.getAllBreedingMethods(); final List<GermplasmName> germplasmNames = this.germplasmService.getGermplasmNames(); final File file = this.germplasmTemplateExportService.export(breedingMethods, germplasmNames, attributeDTOS, locations, storageLocation, units); <END> final HttpHeaders headers = new HttpHeaders(); headers .add(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=%s", FileUtils.sanitizeFileName(file.getName()))); final FileSystemResource fileSystemResource = new FileSystemResource(file); return new ResponseEntity<>(fileSystemResource, headers, HttpStatus.OK); }</code><technical_language>Is get parameters germplasmTemplateExportService.writeCodesSheet</technical_language>

Target:
public ResponseEntity<FileSystemResource> getImportGermplasmExcelTemplate(@PathVariable final String cropName, @RequestParam(required = false) final String programUUID) { final File file = this.germplasmTemplateExportService.export(cropName, programUUID); final HttpHeaders headers = new HttpHeaders(); headers .add(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=%s", FileUtils.sanitizeFileName(file.getName()))); final FileSystemResource fileSystemResource = new FileSystemResource(file); return new ResponseEntity<>(fileSystemResource, headers, HttpStatus.OK); }
Source:
<code>public long getMaxResultWindow() { if (maxResultWindow == null) { ConfigurationService cs = Framework.getService(ConfigurationService.class); String maxResultWindowStr = cs.getProperty(ES_MAX_RESULT_WINDOW_PROPERTY, DEFAULT_ES_MAX_RESULT_WINDOW_VALUE); try { maxResultWindow = Long.valueOf(maxResultWindowStr); } catch (NumberFormatException e) { log.warn(String.format( "Invalid maxResultWindow property value: %s for page provider: %s, fallback to default.", <START> maxResultWindow, getName())); <END> maxResultWindow = Long.valueOf(DEFAULT_ES_MAX_RESULT_WINDOW_VALUE); } } return maxResultWindow; }</code><technical_language>maxResultWindow -> maxResultWindowStr</technical_language>

Target:
public long getMaxResultWindow() { if (maxResultWindow == null) { ConfigurationService cs = Framework.getService(ConfigurationService.class); String maxResultWindowStr = cs.getProperty(ES_MAX_RESULT_WINDOW_PROPERTY, DEFAULT_ES_MAX_RESULT_WINDOW_VALUE); try { maxResultWindow = Long.valueOf(maxResultWindowStr); } catch (NumberFormatException e) { log.warn(String.format( "Invalid maxResultWindow property value: %s for page provider: %s, fallback to default.", maxResultWindowStr, getName())); maxResultWindow = Long.valueOf(DEFAULT_ES_MAX_RESULT_WINDOW_VALUE); } } return maxResultWindow; }
Source:
<code>public StaticHostProvider(Collection<InetSocketAddress> serverAddresses) throws UnknownHostException { for (InetSocketAddress address : serverAddresses) { InetAddress resolvedAddresses[]; <START> try { <END> Method m = InetSocketAddress.class.getDeclaredMethod("getHostString"); m.setAccessible(true); resolvedAddresses = InetAddress.getAllByName((String) m.invoke(address)); } catch (IllegalAccessException e) { resolvedAddresses = InetAddress.getAllByName(getHostString(address)); } catch (NoSuchMethodException e) { resolvedAddresses = InetAddress.getAllByName(getHostString(address)); } catch (InvocationTargetException e) { resolvedAddresses = InetAddress.getAllByName(getHostString(address)); } for (InetAddress resolvedAddress : resolvedAddresses) { this.serverAddresses.add(new InetSocketAddress(resolvedAddress, address.getPort())); } } if (this.serverAddresses.isEmpty()) { throw new IllegalArgumentException( "A HostProvider may not be empty!"); } Collections.shuffle(this.serverAddresses); }</code><technical_language>wrap reflection in abstraction in a static block in this file inspection of class done once, save some runtime inspection cycles</technical_language>

Target:
public StaticHostProvider(Collection<InetSocketAddress> serverAddresses) throws UnknownHostException { for (InetSocketAddress address : serverAddresses) { InetAddress resolvedAddresses[] = InetAddress.getAllByName(getHostString(address)); for (InetAddress resolvedAddress : resolvedAddresses) { this.serverAddresses.add(new InetSocketAddress(resolvedAddress, address.getPort())); } } if (this.serverAddresses.isEmpty()) { throw new IllegalArgumentException( "A HostProvider may not be empty!"); } Collections.shuffle(this.serverAddresses); }
Source:
<code>public void normalize(CertifiedProductSearchDetails listing) { if (listing.getSed() != null && listing.getSed().getTestTasks() != null && listing.getSed().getTestTasks().size() > 0) { listing.getSed().getTestTasks().stream() .forEach(testTask -> { <START> lookupTestParticipantAges(testTask); lookupTestParticipantEducationTypes(testTask); <END> }); } }</code><technical_language>I naming needs changed - based name I functions return a looked value. I a setting in object. I name of function side-effect of function is</technical_language>

Target:
public void normalize(CertifiedProductSearchDetails listing) { if (listing.getSed() != null && listing.getSed().getTestTasks() != null && listing.getSed().getTestTasks().size() > 0) { listing.getSed().getTestTasks().stream() .forEach(testTask -> { populateTestParticipantAges(testTask); populateTestParticipantEducationTypes(testTask); }); } }
Source:
<code>public String getParsedCheckDetails() { <START> return checkDetails != null ? new String(checkDetails, Charset.forName("US-ASCII")) : ""; <END> }</code><technical_language>is a global for Charset in utility packages. Please do hardcode here</technical_language>

Target:
public String getParsedCheckDetails() { return checkDetails != null ? new String(checkDetails, StringUtils.getPreferredCharset()) : ""; }
Source:
<code>public void log(AuditLogable auditLogable, AuditLogType logType, String message) { if (!logType.shouldBeLogged()) { return; } EventFloodRegulator eventFloodRegulator = new EventFloodRegulator(auditLogable, logType); if (eventFloodRegulator.isLegal()) { AuditLog[] savedAuditLog = { null }; TransactionSupport.executeInNewTransaction(() -> { savedAuditLog[0] = saveToDb(auditLogable, logType, message); return null; }); <START> if (savedAuditLog == null) { <END> log.warn("Unable to create AuditLog"); } else { logMessage(savedAuditLog[0]); } } }</code><technical_language>Please update this condition: if (savedAuditLog[0] == null) {</technical_language>

Target:
public void log(AuditLogable auditLogable, AuditLogType logType, String message) { if (!logType.shouldBeLogged()) { return; } EventFloodRegulator eventFloodRegulator = new EventFloodRegulator(auditLogable, logType); if (eventFloodRegulator.isLegal()) { AuditLog[] savedAuditLog = { null }; TransactionSupport.executeInNewTransaction(() -> { savedAuditLog[0] = saveToDb(auditLogable, logType, message); return null; }); if (savedAuditLog[0] == null) { log.warn("Unable to create AuditLog"); } else { logMessage(savedAuditLog[0]); } } }
Source:
<code>public Entity<TreeReference> getEntity(TreeReference data) { EvaluationContext nodeContext = new EvaluationContext(ec, data); getDetail().populateEvaluationContextVariables(nodeContext); <START> nodeContext.addFunctionHandler(hereFunctionHandler); <END> int length = detail.getHeaderForms().length; Object[] details = new Object[length]; String[] sortDetails = new String[length]; String[] backgroundDetails = new String[length]; boolean[] relevancyDetails = new boolean[length]; int count = 0; for (DetailField f : this.getDetail().getFields()) { try { details[count] = f.getTemplate().evaluate(nodeContext); Text sortText = f.getSort(); Text backgroundText = f.getBackground(); if (sortText == null) { sortDetails[count] = null; } else { sortDetails[count] = sortText.evaluate(nodeContext); } if (backgroundText == null) { backgroundDetails[count] = ""; } else { backgroundDetails[count] = backgroundText.evaluate(nodeContext); } relevancyDetails[count] = f.isRelevant(nodeContext); } catch (XPathSyntaxException | XPathException xpe) { xpe.printStackTrace(); details[count] = "<invalid xpath: " + xpe.getMessage() + ">"; backgroundDetails[count] = ""; relevancyDetails[count] = true; } count++; } return new Entity<>(details, sortDetails, backgroundDetails, relevancyDetails, data); }</code><technical_language>I consider writing: nodeContext.addFunctionHandler(EntitySelectActivity.hereFunctionHandler); allow eliminate hereFunctionHandler class field</technical_language>

Target:
public Entity<TreeReference> getEntity(TreeReference data) { EvaluationContext nodeContext = new EvaluationContext(ec, data); detail.populateEvaluationContextVariables(nodeContext); nodeContext.addFunctionHandler(EntitySelectActivity.hereFunctionHandler); int length = detail.getHeaderForms().length; Object[] details = new Object[length]; String[] sortDetails = new String[length]; boolean[] relevancyDetails = new boolean[length]; int count = 0; for (DetailField f : detail.getFields()) { try { details[count] = f.getTemplate().evaluate(nodeContext); Text sortText = f.getSort(); if (sortText == null) { sortDetails[count] = null; } else { sortDetails[count] = sortText.evaluate(nodeContext); } relevancyDetails[count] = f.isRelevant(nodeContext); } catch (XPathSyntaxException | XPathException xpe) { xpe.printStackTrace(); details[count] = "<invalid xpath: " + xpe.getMessage() + ">"; relevancyDetails[count] = true; } count++; } return new Entity<>(details, sortDetails, relevancyDetails, data); }
Source:
<code>public static AuthenticationProfileRepository getInstance() { return instance; <START> } <END></code><technical_language>I do understand two... for ut hell</technical_language>

Target:
public static AuthenticationProfileRepository getInstance() { if (instance == null) { synchronized (AuthenticationProfileRepository.class) { if (instance == null) { instance = new AuthenticationProfileRepository(); } } } return instance; }
Source:
<code>private OperatingMode getActualMode() throws InvalidOperatingModeException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); byte[] readData = new byte[256]; try { if (connectionInterface instanceof AbstractSerialPort) ((AbstractSerialPort)connectionInterface).purge(); connectionInterface.writeData(COMMAND_MODE_AP.getBytes()); Thread.sleep(100); int readBytes = connectionInterface.readData(readData); if (readBytes == 0) return OperatingMode.UNKNOWN; <START> return OperatingMode.get(Integer.parseInt(new String(readData).trim(), 16)); <END> } catch (IOException e) { logger.error(e.getMessage(), e); } catch (InterruptedException e) { logger.error(e.getMessage(), e); } return OperatingMode.UNKNOWN; }</code><technical_language>parseInt method throw a NumberFormatException if response is a number, catch in case</technical_language>

Target:
private OperatingMode getActualMode() throws InvalidOperatingModeException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); byte[] readData = new byte[256]; try { if (connectionInterface instanceof AbstractSerialPort) ((AbstractSerialPort)connectionInterface).purge(); connectionInterface.writeData(COMMAND_MODE_AP.getBytes()); Thread.sleep(100); int readBytes = connectionInterface.readData(readData); if (readBytes == 0) return OperatingMode.UNKNOWN; return OperatingMode.get(Integer.parseInt(new String(readData).trim(), 16)); } catch (IOException | NumberFormatException | InterruptedException e) { logger.error(e.getMessage(), e); } return OperatingMode.UNKNOWN; }
Source:
<code><START> protected int determineMaxQuipHistorySize(int sizeOfQuipGroup){ <END> return Math.min(MAXIMUM_QUIP_HISTORY_SIZE, (int) (sizeOfQuipGroup*MAXIMUM_QUIP_HISTORY_PERCENT)); }</code><technical_language>static</technical_language>

Target:
protected static int determineMaxQuipHistorySize(int sizeOfQuipGroup){ return Math.min(MAXIMUM_QUIP_HISTORY_SIZE, (int) (sizeOfQuipGroup*MAXIMUM_QUIP_HISTORY_PERCENT)); }
Source:
<code>private void invokeOnComplete(final IoCallback callback) { sendThread = null; inCall = Thread.currentThread(); try { callback.onComplete(exchange, this); } finally { inCall = null; } if (Thread.currentThread() != sendThread) { return; } while (next != null) { String next = this.next; IoCallback queuedCallback = this.queuedCallback; this.next = null; this.queuedCallback = null; writer.write(next); if (writer.checkError()) { queuedCallback.onException(exchange, this, new IOException()); } else { sendThread = null; inCall = Thread.currentThread(); try { <START> callback.onComplete(exchange, this); <END> } finally { inCall = null; } if (Thread.currentThread() != sendThread) { return; } } } }</code><technical_language>@stuartwdouglas here, supposed process queuedCallback in this block</technical_language>

Target:
private void invokeOnComplete(final IoCallback callback) { sendThread = null; inCall = Thread.currentThread(); try { callback.onComplete(exchange, this); } finally { inCall = null; } if (Thread.currentThread() != sendThread) { return; } while (next != null) { String next = this.next; IoCallback queuedCallback = this.queuedCallback; this.next = null; this.queuedCallback = null; writer.write(next); if (writer.checkError()) { queuedCallback.onException(exchange, this, new IOException()); } else { sendThread = null; inCall = Thread.currentThread(); try { queuedCallback.onComplete(exchange, this); } finally { inCall = null; } if (Thread.currentThread() != sendThread) { return; } } } }
Source:
<code>public void shouldNotCreateNewAutoGenerationOptionWithNullParameters() throws Exception { SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("identifierType", null); <START> autoGenerationOption.add("location", null); <END> autoGenerationOption.add("source", null); autoGenerationOption.add("automaticGenerationEnabled", null); autoGenerationOption.add("manualEntryEnabled", null); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI()); req.setContent(json.getBytes()); handle(req); }</code><technical_language>For null values, do supply properties in autoGenerationOption</technical_language>

Target:
public void shouldNotCreateNewAutoGenerationOptionWithNullParameters() throws Exception { SimpleObject autoGenerationOption = new SimpleObject(); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI()); req.setContent(json.getBytes()); handle(req); }
Source:
<code>public boolean performOk() { doGetPreferenceStore().setValue(UIPreferences.WARN_BEFORE_COMMITTING, warnCheckbox.getSelection()); <START> System.out.println(warnCheckbox.getSelection()); <END> System.out.println(blockCheckbox.getSelection()); doGetPreferenceStore().setValue(UIPreferences.BLOCK_COMMIT, blockCheckbox.getSelection()); return super.performOk(); }</code><technical_language>trace statements removed</technical_language>

Target:
public boolean performOk() { doGetPreferenceStore().setValue(UIPreferences.WARN_BEFORE_COMMITTING, warnCheckbox.getSelection()); doGetPreferenceStore().setValue(UIPreferences.BLOCK_COMMIT, blockCheckbox.getSelection()); return super.performOk(); }
Source:
<code>private boolean run() { try { if (log.isDebugEnabled()) { log.debug("Executing run: " + runSql); } jdbcTemplate.execute(runSql); } catch (DataAccessException e) { <START> lastException = e; <END> return false; } return true; }</code><technical_language>log this error</technical_language>

Target:
private boolean run() { try { if (log.isDebugEnabled()) { log.debug("Executing run: " + runSql); } jdbcTemplate.execute(runSql); } catch (DataAccessException e) { log.error("Error during run sql", e); lastException = e; return false; } return true; }
Source:
<code>private void processStatus(Position position, long status) { if (!BitUtil.check(status, 0) || !BitUtil.check(status, 1) || !BitUtil.check(status, 3) || !BitUtil.check(status, 4) || !BitUtil.check(status, 7)) { position.set(Position.KEY_ALARM, true); if (!BitUtil.check(status, 0)){ <START> position.set(Position.KEY_ALARM_TYPE, "theft alarm"); <END> } else if (!BitUtil.check(status, 1)){ position.set(Position.KEY_ALARM_TYPE, "robbery alarm"); } else if (!BitUtil.check(status, 3)){ position.set(Position.KEY_ALARM_TYPE, "illegal ignition alarm"); } else if (!BitUtil.check(status, 4)){ position.set(Position.KEY_ALARM_TYPE, "entering alarm"); } else if (!BitUtil.check(status, 7)){ position.set(Position.KEY_ALARM_TYPE, "out alarm"); } } position.set(Position.KEY_IGNITION, !BitUtil.check(status, 10)); position.set(Position.KEY_STATUS, status); }</code><technical_language>Word "alarm" removed alarm</technical_language>

Target:
private void processStatus(Position position, long status) { if (!BitUtil.check(status, 0) || !BitUtil.check(status, 1) || !BitUtil.check(status, 3) || !BitUtil.check(status, 4) || !BitUtil.check(status, 7)) { if (!BitUtil.check(status, 0)) { position.set(Position.KEY_ALARM, Position.ALARM_VIBRATION); } else if (!BitUtil.check(status, 1)) { position.set(Position.KEY_ALARM, "robbery"); } else if (!BitUtil.check(status, 3)) { position.set(Position.KEY_ALARM, "illegal ignition"); } else if (!BitUtil.check(status, 4)) { position.set(Position.KEY_ALARM, "entering"); } else if (!BitUtil.check(status, 7)) { position.set(Position.KEY_ALARM, "out"); } } position.set(Position.KEY_IGNITION, !BitUtil.check(status, 10)); position.set(Position.KEY_STATUS, status); }
Source:
<code>public boolean isCompatibleWithJavaVersion(Integer version) { <START> return JavaVersionHelper.java8Compatible(version); <END> }</code><technical_language>@m-g-sonar compatible guaranteed</technical_language>

Target:
public boolean isCompatibleWithJavaVersion(Integer version) { return JavaVersionHelper.java8Guaranteed(version); }
Source:
<code>public PanelControl(UI ui, Preferences prefs) { this.ui = ui; this.prefs = prefs; setSpacing(10); setPadding(new Insets(0, 10, 0, 10)); ui.registerEvent((IssueSelectedEventHandler) e -> setCurrentlySelectedPanel(Optional.of(e.panelIndex))); ui.registerEvent((PanelClickedEventHandler) e -> setCurrentlySelectedPanel(Optional.of(e.panelIndex))); ui.registerEvent((ShowRenamePanelEventHandler) e -> <START> ((FilterPanel) getPanel(e.panelId)).initRenameHandler()); <END> setupKeyEvents(); }</code><technical_language>method named in a mention implementation details, startRename something</technical_language>

Target:
public PanelControl(UI ui, Preferences prefs) { this.ui = ui; this.prefs = prefs; setSpacing(10); setPadding(new Insets(0, 10, 0, 10)); ui.registerEvent((IssueSelectedEventHandler) e -> setCurrentlySelectedPanel(Optional.of(e.panelIndex))); ui.registerEvent((PanelClickedEventHandler) e -> setCurrentlySelectedPanel(Optional.of(e.panelIndex))); ui.registerEvent((ShowRenamePanelEventHandler) e -> ((FilterPanel) getPanel(e.panelId)).startRename()); setupKeyEvents(); }
Source:
<code><START> public boolean equals(final Object obj) { <END> if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass() != obj.getClass()) { return false; } final DeviceManagementMapper other = (DeviceManagementMapper) obj; if (this.ssldRepository == null) { if (other.ssldRepository != null) { return false; } } else if (!this.ssldRepository.equals(other.ssldRepository)) { return false; } return true; }</code><technical_language>java.util.Objects</technical_language>

Target:
public boolean equals(final Object obj) { return super.equals(obj) && Objects.equals(this.ssldRepository, ((DeviceManagementMapper) obj).ssldRepository); }
Source:
<code>public List<DocumentType> getSpecialDocumentTypes() { checkDirty(); <START> return specialDocumentTypes.values().stream().collect(Collectors.toList()); <END> }</code><technical_language>Collections#unmodifiableList there</technical_language>

Target:
public Set<String> getSpecialDocumentTypes() { checkDirty(); return specialDocumentTypes; }
Source:
<code>@Override public void handleMessage(Message msg) { switch (msg.what) { case REQUEST_SUBMIT: { Request request = (Request) msg.obj; performSubmit(request); break; } case REQUEST_CANCEL: { Request request = (Request) msg.obj; performCancel(request); break; } case HUNTER_COMPLETE: { BitmapHunter hunter = (BitmapHunter) msg.obj; performComplete(hunter); break; } case HUNTER_RETRY: { BitmapHunter hunter = (BitmapHunter) msg.obj; performRetry(hunter); break; } case HUNTER_DECODE_FAILED: { BitmapHunter hunter = (BitmapHunter) msg.obj; performError(hunter); break; } case NETWORK_STATE_CHANGE: { NetworkInfo info = (NetworkInfo) msg.obj; performNetworkStateChange(info); break; } case AIRPLANE_MODE_CHANGE: { <START> performAirplaneModeChange(msg.arg1 == 1); <END> break; } default: throw new AssertionError("Unknown handler message received: " + msg.what); } }</code><technical_language>..that this magical</technical_language>

Target:
@Override public void handleMessage(Message msg) { switch (msg.what) { case REQUEST_SUBMIT: { Request request = (Request) msg.obj; performSubmit(request); break; } case REQUEST_CANCEL: { Request request = (Request) msg.obj; performCancel(request); break; } case HUNTER_COMPLETE: { BitmapHunter hunter = (BitmapHunter) msg.obj; performComplete(hunter); break; } case HUNTER_RETRY: { BitmapHunter hunter = (BitmapHunter) msg.obj; performRetry(hunter); break; } case HUNTER_DECODE_FAILED: { BitmapHunter hunter = (BitmapHunter) msg.obj; performError(hunter); break; } case NETWORK_STATE_CHANGE: { NetworkInfo info = (NetworkInfo) msg.obj; performNetworkStateChange(info); break; } case AIRPLANE_MODE_CHANGE: { performAirplaneModeChange(msg.arg1 == AIRPLANE_MODE_ON); break; } default: throw new AssertionError("Unknown handler message received: " + msg.what); } }
Source:
<code>CharSequence getTitle() { if (overriddenTitleFromExtender != null) return overriddenTitleFromExtender; <START> return jsonPayload.optString("title", null); <END> }</code><technical_language>start this strings constants</technical_language>

Target:
CharSequence getTitle() { if (overriddenTitleFromExtender != null) return overriddenTitleFromExtender; return jsonPayload.optString(TITLE_PAYLOAD_PARAM, null); }
Source:
<code>public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class); List<String> supported = Arrays.asList(consumesAnnotation.value()); if(request.getContentType() == null) { <START> logger.info("Request does not have Content-Type and parameters will be not deserialized"); <END> stack.next(method, resourceInstance); return; } String contentType = mime(request.getContentType()); if (!supported.isEmpty() && !supported.contains(contentType)) { unsupported(String.format("Request with media type [%s]. Expecting one of %s.", contentType, supported)); return; } try { Deserializer deserializer = deserializers.deserializerFor(contentType, container); if (deserializer == null) { unsupported(String.format("Unable to handle media type [%s]: no deserializer found.", contentType)); return; } Object[] deserialized = deserializer.deserialize(request.getInputStream(), method); Object[] parameters = methodInfo.getParameters(); logger.debug("Deserialized parameters for are ", method, deserialized); for (int i = 0; i < deserialized.length; i++) { if (deserialized[i] != null) { parameters[i] = deserialized[i]; } } stack.next(method, resourceInstance); } catch (IOException e) { throw new InterceptionException(e); } }</code><technical_language>warn</technical_language>

Target:
public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class); List<String> supported = Arrays.asList(consumesAnnotation.value()); if(request.getContentType() == null) { logger.warn("Request does not have Content-Type and parameters will be not deserialized"); stack.next(method, resourceInstance); return; } String contentType = mime(request.getContentType()); if (!supported.isEmpty() && !supported.contains(contentType)) { unsupported(String.format("Request with media type [%s]. Expecting one of %s.", contentType, supported)); return; } try { Deserializer deserializer = deserializers.deserializerFor(contentType, container); if (deserializer == null) { unsupported(String.format("Unable to handle media type [%s]: no deserializer found.", contentType)); return; } Object[] deserialized = deserializer.deserialize(request.getInputStream(), method); Object[] parameters = methodInfo.getParameters(); logger.debug("Deserialized parameters for are ", method, deserialized); for (int i = 0; i < deserialized.length; i++) { if (deserialized[i] != null) { parameters[i] = deserialized[i]; } } stack.next(method, resourceInstance); } catch (IOException e) { throw new InterceptionException(e); } }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { String header = ((HttpServletRequest) request).getHeader("Authorization"); <START> String header_hive = ((HttpServletRequest) request).getHeader("HiveAuthToken"); <END> String wireToken; if (header != null && header.startsWith(BEARER)) { wireToken = header.substring(BEARER.length()); } else if (header_hive != null) { wireToken = header_hive; } else { wireToken = request.getParameter(paramName); } if (wireToken != null && !wireToken.isEmpty()) { validateJWTtoken(wireToken, request, response, chain); } else { ((HttpServletResponse) response).sendError(HttpServletResponse.SC_UNAUTHORIZED); } }</code><technical_language>weird a special case for Hive here</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { String header = ((HttpServletRequest) request).getHeader("Authorization"); String wireToken; if (header != null && header.startsWith(BEARER)) { wireToken = header.substring(BEARER.length()); } else { wireToken = request.getParameter(paramName); } if (wireToken != null) { try { JWT token = new JWTToken(wireToken); if (validateToken((HttpServletRequest)request, (HttpServletResponse)response, chain, token)) { Subject subject = createSubjectFromToken(token); continueWithEstablishedSecurityContext(subject, (HttpServletRequest)request, (HttpServletResponse)response, chain); } } catch (ParseException ex) { ((HttpServletResponse) response).sendError(HttpServletResponse.SC_UNAUTHORIZED); } } else { ((HttpServletResponse) response).sendError(HttpServletResponse.SC_UNAUTHORIZED); } }
Source:
<code>public void startTimer() { isTimerOn = true; Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() { public boolean execute() { moveProductsSideways(); return isTimerOn; } <START> }, 7750); <END> }</code><technical_language>Constant</technical_language>

Target:
public void startTimer() { isTimerOn = true; Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() { public boolean execute() { moveProductsSideways(); return isTimerOn; } }, timerSidewaysPeriod); }
Source:
<code>public List<Client> getClients() { <START> init(); <END> if (this.clients == null) { return Collections.emptyList(); } else { return this.clients; } }</code><technical_language>While getClients initialization</technical_language>

Target:
public List<Client> getClients() { return this.clients; }
Source:
<code>private void onSetOrCreateGameRule(GameRules gameRules, String key, String value) { <START> for (WorldServer server : SpongeImpl.getServer().worldServers) { <END> server.getGameRules().setOrCreateGameRule(key, value); } }</code><technical_language>WorldServer is a world, a server</technical_language>

Target:
private void onSetOrCreateGameRule(GameRules gameRules, String key, String value) { for (WorldServer world : SpongeImpl.getServer().worldServers) { world.getGameRules().setOrCreateGameRule(key, value); } }
Source:
<code>public void undeployVMReplica(ClaudiaData claudiaData, TierInstance tierInstance) throws InfrastructureException { log.debug("Undeploy VM replica " + tierInstance.getName() + " for region " + tierInstance.getTier().getRegion() + " and user " + tierInstance.getTier().getVdc()); try { <START> OpenStackAccess openStackAccess = openStackRegion.getTokenAdmin(); <END> String region = tierInstance.getTier().getRegion(); log.debug("tenantId " + openStackAccess.getTenantId()); log.debug("token " + openStackAccess.getToken()); openStackUtil.deleteServer(tierInstance.getVM().getVmid(), tierInstance.getTier().getRegion(), openStackAccess.getToken(), openStackAccess.getTenantId()); checkDeleteServerTaskStatus(tierInstance, claudiaData); log.debug("Undeployed VM replica " + tierInstance.getName() + " for region " + tierInstance.getTier().getRegion() + " and user " + tierInstance.getTier().getVdc()); if (tierInstance.getTier().getFloatingip().equals("true")) { log.debug("Delete floating ip "); openStackUtil.disAllocateFloatingIP(region, openStackAccess.getToken(), openStackAccess.getTenantId(), tierInstance.getVM().getFloatingIp()); } } catch (OpenStackException oes) { String errorMessage = "Error deleting serverId: " + tierInstance.getVM().getVmid(); log.error(errorMessage); throw new InfrastructureException(errorMessage); } }</code><technical_language>estrange here. Do get admin token do it? This PR is of admin token in order delete operations? openStackAccess.getToken() openStackRegion.getTokenAdmin()</technical_language>

Target:
public void undeployVMReplica(ClaudiaData claudiaData, TierInstance tierInstance) throws InfrastructureException { log.debug("Undeploy VM replica " + tierInstance.getName() + " for region " + tierInstance.getTier().getRegion() + " and user " + tierInstance.getTier().getVdc()); try { OpenStackAccess openStackAccess = openStackRegion.getTokenAdmin(); String region = tierInstance.getTier().getRegion(); String tenantAdminId = openStackAccess.getTenantId(); String tokenAdminId = openStackAccess.getToken(); log.debug("tenantId " + tenantAdminId ); log.debug("token " + tokenAdminId); openStackUtil.deleteServer(tierInstance.getVM().getVmid(), region, tokenAdminId, tenantAdminId); checkDeleteServerTaskStatus(tierInstance, claudiaData); log.debug("Undeployed VM replica " + tierInstance.getName() + " for region " + region + " and user " + tierInstance.getTier().getVdc()); if (tierInstance.getTier().getFloatingip().equals("true")) { log.debug("Delete floating ip "); openStackUtil.disAllocateFloatingIP(region, tokenAdminId, tenantAdminId, tierInstance.getVM().getFloatingIp()); } } catch (OpenStackException oes) { String errorMessage = "Error deleting serverId: " + tierInstance.getVM().getVmid(); log.error(errorMessage); throw new InfrastructureException(errorMessage); } }
Source:
<code>public void testMemoryLeak() throws Exception { final int port = SocketUtils.findAvailableServerSocket(); TcpNioClientConnectionFactory factory = new TcpNioClientConnectionFactory("localhost", port); factory.setNioHarvestInterval(100); factory.start(); final CountDownLatch latch = new CountDownLatch(1); Executors.newSingleThreadExecutor().execute(new Runnable() { @Override public void run() { try { ServerSocket server = ServerSocketFactory.getDefault().createServerSocket(port); latch.countDown(); Socket socket = server.accept(); byte[] b = new byte[6]; readFully(socket.getInputStream(), b); } catch (Exception e) { e.printStackTrace(); } } }); assertTrue(latch.await(10000, TimeUnit.MILLISECONDS)); try { TcpConnection connection = factory.getConnection(); Map<SocketChannel, TcpNioConnection> connections = factory.getConnections(); assertEquals(1, connections.size()); connection.close(); assertTrue(!connection.isOpen()); <START> TestUtils.getPropertyValue(factory, "selector", Selector.class).wakeup(); <END> int n = 0; while (connections.size() > 0) { Thread.sleep(100); if (n++ > 100) { break; } } assertEquals(0, connections.size()); } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception " + e); } factory.stop(); }</code><technical_language>Right, close selector factory.close()</technical_language>

Target:
public void testMemoryLeak() throws Exception { final int port = SocketUtils.findAvailableServerSocket(); TcpNioClientConnectionFactory factory = new TcpNioClientConnectionFactory("localhost", port); factory.setNioHarvestInterval(100); factory.start(); final CountDownLatch latch = new CountDownLatch(1); final AtomicReference<ServerSocket> serverSocket = new AtomicReference<ServerSocket>(); Executors.newSingleThreadExecutor().execute(new Runnable() { @Override public void run() { try { ServerSocket server = ServerSocketFactory.getDefault().createServerSocket(port); serverSocket.set(server); latch.countDown(); Socket socket = server.accept(); byte[] b = new byte[6]; readFully(socket.getInputStream(), b); } catch (Exception e) { e.printStackTrace(); } } }); assertTrue(latch.await(10000, TimeUnit.MILLISECONDS)); try { TcpConnection connection = factory.getConnection(); Map<SocketChannel, TcpNioConnection> connections = factory.getConnections(); assertEquals(1, connections.size()); connection.close(); assertTrue(!connection.isOpen()); TestUtils.getPropertyValue(factory, "selector", Selector.class).wakeup(); int n = 0; while (connections.size() > 0) { Thread.sleep(100); if (n++ > 100) { break; } } assertEquals(0, connections.size()); } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception " + e); } factory.stop(); serverSocket.get().close(); }
Source:
<code>public void eventReceived(Event event) { switch (event.getEventType()) { case HistoryReferenceEventPublisher.EVENT_NOTE_SET: LOGGER.debug("NOTE SET EVENT recieved..."); int refIdAdd = Integer.valueOf( event.getParameters() .get( HistoryReferenceEventPublisher .FIELD_HISTORY_REFERENCE_ID)); addRowToNotesTable(refIdAdd); break; case HistoryReferenceEventPublisher.EVENT_REMOVED: <START> LOGGER.debug("NOTE REMOVE EVENT recieved... {}", event.getParameters().toString()); <END> int refIdDelete = Integer.valueOf( event.getParameters() .get( HistoryReferenceEventPublisher .FIELD_HISTORY_REFERENCE_ID)); deleteRowFromNotes(refIdDelete); break; default: } }</code><technical_language>fix typo in received? (In debug messages.)</technical_language>

Target:
public void eventReceived(Event event) { switch (event.getEventType()) { case HistoryReferenceEventPublisher.EVENT_NOTE_SET: LOGGER.debug("NOTE SET EVENT received..."); int refIdAdd = Integer.valueOf( event.getParameters() .get( HistoryReferenceEventPublisher .FIELD_HISTORY_REFERENCE_ID)); addRowToNotesTable(refIdAdd); break; case HistoryReferenceEventPublisher.EVENT_REMOVED: LOGGER.debug("NOTE REMOVE EVENT received... {}", event.getParameters().toString()); int refIdDelete = Integer.valueOf( event.getParameters() .get( HistoryReferenceEventPublisher .FIELD_HISTORY_REFERENCE_ID)); deleteRowFromNotes(refIdDelete); break; default: } }
Source:
<code>protected void updateTab(CTabItem cti, MPart part, String attName, Object newValue) { if (UIEvents.UILabel.LABEL.equals(attName)) { String newName = (String) newValue; cti.setText(getLabel(part, newName)); } else if (UIEvents.UILabel.ICONURI.equals(attName)) { cti.setImage(getImage(part)); } else if (UIEvents.UILabel.TOOLTIP.equals(attName)) { String newTTip = (String) newValue; cti.setToolTipText(newTTip); } else if (UIEvents.Dirtyable.DIRTY.equals(attName)) { Boolean dirtyState = (Boolean) newValue; String text = cti.getText(); boolean hasAsterisk = text.length() > 0 && text.charAt(0) == '*'; if (dirtyState.booleanValue()) { if (!hasAsterisk) { cti.setText('*' + text); } } else if (hasAsterisk) { cti.setText(text.substring(1)); } <START> } else if (UIEvents.UILifeCycle.BUSY.equals(attName)) { <END> setCSSInfo(part, cti); reapplyStyles(cti); } }</code><technical_language>This removed change managed adding removing busy tag re-style folder tab</technical_language>

Target:
protected void updateTab(CTabItem cti, MPart part, String attName, Object newValue) { if (UIEvents.UILabel.LABEL.equals(attName)) { String newName = (String) newValue; cti.setText(getLabel(part, newName)); } else if (UIEvents.UILabel.ICONURI.equals(attName)) { cti.setImage(getImage(part)); } else if (UIEvents.UILabel.TOOLTIP.equals(attName)) { String newTTip = (String) newValue; cti.setToolTipText(newTTip); } else if (UIEvents.Dirtyable.DIRTY.equals(attName)) { Boolean dirtyState = (Boolean) newValue; String text = cti.getText(); boolean hasAsterisk = text.length() > 0 && text.charAt(0) == '*'; if (dirtyState.booleanValue()) { if (!hasAsterisk) { cti.setText('*' + text); } } else if (hasAsterisk) { cti.setText(text.substring(1)); } } }
Source:
<code>public BaseResultIterators(QueryPlan plan, Integer perScanLimit, ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { super(plan.getContext(), plan.getTableRef(), plan.getGroupBy(), plan.getOrderBy(), plan.getStatement().getHint(), plan.getLimit()); this.plan = plan; this.scanGrouper = scanGrouper; StatementContext context = plan.getContext(); <START> this.scan = scan == null ? context.getScan() : scan; <END> this.mutationState = new MutationState(context.getConnection().getMutationState()); TableRef tableRef = plan.getTableRef(); PTable table = tableRef.getTable(); physicalTableName = table.getPhysicalName().getBytes(); tableStats = useStats() ? new MetaDataClient(context.getConnection()).getTableStats(table) : PTableStats.EMPTY_STATS; scanId = UUID.randomUUID().toString(); initializeScan(plan, perScanLimit, scan); this.scans = getParallelScans(); List<KeyRange> splitRanges = Lists.newArrayListWithExpectedSize(scans.size() * ESTIMATED_GUIDEPOSTS_PER_REGION); for (List<Scan> scanList : scans) { for (Scan aScan : scanList) { splitRanges.add(KeyRange.getKeyRange(aScan.getStartRow(), aScan.getStopRow())); } } this.splits = ImmutableList.copyOf(splitRanges); this.allFutures = Lists.newArrayListWithExpectedSize(1); }</code><technical_language>is scan null</technical_language>

Target:
public BaseResultIterators(QueryPlan plan, Integer perScanLimit, ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { super(plan.getContext(), plan.getTableRef(), plan.getGroupBy(), plan.getOrderBy(), plan.getStatement().getHint(), plan.getLimit()); this.plan = plan; this.scanGrouper = scanGrouper; StatementContext context = plan.getContext(); this.scan = scan; this.mutationState = new MutationState(context.getConnection().getMutationState()); TableRef tableRef = plan.getTableRef(); PTable table = tableRef.getTable(); physicalTableName = table.getPhysicalName().getBytes(); tableStats = useStats() ? new MetaDataClient(context.getConnection()).getTableStats(table) : PTableStats.EMPTY_STATS; scanId = UUID.randomUUID().toString(); initializeScan(plan, perScanLimit, scan); this.scans = getParallelScans(); List<KeyRange> splitRanges = Lists.newArrayListWithExpectedSize(scans.size() * ESTIMATED_GUIDEPOSTS_PER_REGION); for (List<Scan> scanList : scans) { for (Scan aScan : scanList) { splitRanges.add(KeyRange.getKeyRange(aScan.getStartRow(), aScan.getStopRow())); } } this.splits = ImmutableList.copyOf(splitRanges); this.allFutures = Lists.newArrayListWithExpectedSize(1); }
Source:
<code>public static AbstractParallelWorker newWorker(XmlSuite.ParallelMode mode) { if (XmlSuite.ParallelMode.INSTANCES.equals(mode)) { return new InstanceBasedParallelParallelWorker(); } <START> return new ClassBasedParallelParallelWorker(); <END> }</code><technical_language>"parallel"</technical_language>

Target:
public static AbstractParallelWorker newWorker(XmlSuite.ParallelMode mode) { if (XmlSuite.ParallelMode.INSTANCES.equals(mode)) { return new InstanceBasedParallelParallelWorker(); } return new ClassBasedParallelWorker(); }
Source:
<code>protected ImmutableValue<Boolean> constructImmutableValue(Boolean value) { <START> return ImmutableSpongeValue.cachedOf(Keys.IS_ADULT, false, value); <END> }</code><technical_language>default true</technical_language>

Target:
protected ImmutableValue<Boolean> constructImmutableValue(Boolean value) { return ImmutableSpongeValue.cachedOf(Keys.IS_ADULT, true, value); }
Source:
<code>public void getAllDocumentIds() throws Exception { Assert.assertTrue(datastore.getAllDocumentIds().isEmpty()); createTwoDocuments(); <START> Assert.assertEquals(2, datastore.getAllDocumentIds().size()); <END> }</code><technical_language>a check docIds correct</technical_language>

Target:
public void getAllDocumentIds() throws Exception { Assert.assertTrue(datastore.getAllDocumentIds().isEmpty()); MutableDocumentRevision rev = new MutableDocumentRevision(); rev.docId = "document-one"; rev.body = bodyOne; datastore.createDocumentFromRevision(rev); rev.docId = "document-two"; rev.body = bodyTwo; datastore.createDocumentFromRevision(rev); Assert.assertThat(datastore.getAllDocumentIds(), containsInAnyOrder("document-one", "document-two")); }
Source:
<code>private Pair<Integer,Integer> getWidthHeight(int widthMeasureSpec, int heightMeasureSpec, double imageScaleFactor) { double maxWidth = mMaxWidth; double maxHeight = mMaxHeight; if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.AT_MOST) { maxWidth = Math.min(MeasureSpec.getSize(widthMeasureSpec), mMaxWidth) * imageScaleFactor; } if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) { maxHeight = Math.min(MeasureSpec.getSize(heightMeasureSpec), mMaxHeight) * imageScaleFactor; } Drawable drawable = getDrawable(); float dWidth = dipToPixels(getContext(), drawable.getIntrinsicWidth()); float dHeight = dipToPixels(getContext(), drawable.getIntrinsicHeight()); float ratio = (dWidth) / dHeight; <START> double width = (int) Math.min(Math.max(dWidth, getSuggestedMinimumWidth()), maxWidth); <END> double height = (int) (width / ratio); height = Math.min(Math.max(height, getSuggestedMinimumHeight()), maxHeight); width = (int) (height * ratio); if (width > maxWidth) { width = maxWidth; height = (int) (width / ratio); } return new Pair<Integer, Integer>(new Double(width).intValue(), new Double(height).intValue()); }</code><technical_language>here, this is of type double casting int</technical_language>

Target:
private Pair<Integer,Integer> getWidthHeight(int widthMeasureSpec, int heightMeasureSpec, double imageScaleFactor) { double maxWidth = mMaxWidth; double maxHeight = mMaxHeight; if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.AT_MOST) { maxWidth = Math.min(MeasureSpec.getSize(widthMeasureSpec), mMaxWidth) * imageScaleFactor; } if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) { maxHeight = Math.min(MeasureSpec.getSize(heightMeasureSpec), mMaxHeight) * imageScaleFactor; } Drawable drawable = getDrawable(); float dWidth = dipToPixels(getContext(), drawable.getIntrinsicWidth()); float dHeight = dipToPixels(getContext(), drawable.getIntrinsicHeight()); float ratio = (dWidth) / dHeight; double width = Math.min(Math.max(dWidth, getSuggestedMinimumWidth()), maxWidth); double height = width / ratio; height = Math.min(Math.max(height, getSuggestedMinimumHeight()), maxHeight); width = height * ratio; if (width > maxWidth) { width = maxWidth; height = width / ratio; } return new Pair<Integer, Integer>(new Double(width).intValue(), new Double(height).intValue()); }