auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void createHandAndLibrary(final int handSize) { startingHandSize = handSize; final MagicDeck deck = playerConfig.getDeck(); Thread thread = Thread.currentThread(); for (int i = 0; i < deck.size() && !thread.isInterrupted(); i++) { final MagicCardDefinition cardDefinition = deck.get(i); if (cardDefinition.isValid()) { final long id = currGame.getUniqueId(); try { <START> library.add(new MagicCard(cardDefinition, this, id)); <END> } catch (ScriptParseException e) { throw new InvalidDeckException( "Error parsing " + cardDefinition.getDistinctName() + ": " + e.getMessage(), e); } } } library.initialShuffle(MagicRandom.nextRNGInt()); for (int count = handSize; count > 0 && !library.isEmpty(); count--) { addCardToHand(library.removeCardAtTop()); } }</code><technical_language>exception caught closer place is thrown, in this case is thrown line loadAbilities in MagicCard constructor</technical_language>

Target:
void createHandAndLibrary(final int handSize) { startingHandSize = handSize; final MagicDeck deck = playerConfig.getDeck(); Thread thread = Thread.currentThread(); for (int i = 0; i < deck.size() && !thread.isInterrupted(); i++) { final MagicCardDefinition cardDefinition = deck.get(i); if (cardDefinition.isValid()) { final long id = currGame.getUniqueId(); library.add(new MagicCard(cardDefinition, this, id)); } } library.initialShuffle(MagicRandom.nextRNGInt()); for (int count = handSize; count > 0 && !library.isEmpty(); count--) { addCardToHand(library.removeCardAtTop()); } }
Source:
<code>public void add(double lat, double lon, double ele) { <START> if (this.isImmutable()) { <END> throw new IllegalStateException("You cannot change an immutable PointList"); } int newSize = size + 1; incCap(newSize); latitudes[size] = lat; longitudes[size] = lon; if (is3D) elevations[size] = ele; else if (!Double.isNaN(ele)) throw new IllegalStateException("This is a 2D list we cannot store elevation: " + ele); size = newSize; }</code><technical_language>reduce redundancy I move this check exception a ensureImmutability method</technical_language>

Target:
public void add(double lat, double lon, double ele) { ensureMutability(); int newSize = size + 1; incCap(newSize); latitudes[size] = lat; longitudes[size] = lon; if (is3D) elevations[size] = ele; else if (!Double.isNaN(ele)) throw new IllegalStateException("This is a 2D list we cannot store elevation: " + ele); size = newSize; }
Source:
<code>public void run() { try { info("sleep for 5 seconds before actually running the job"); <START> Thread.sleep(5 * 1000); <END> super.run(); } catch (final Exception ex) { this.getLog().error(ex); } }</code><technical_language>nit: this run for entire 5 sec? I wondering if cut sleep times a factor of 5. 200ms 1000ms</technical_language>

Target:
public void run() { try { info("sleep for 3 seconds before actually running the job"); Thread.sleep(3 * 1000); super.run(); } catch (final Exception ex) { this.getLog().error(ex); } }
Source:
<code>private static void setOldProcessStatus(ITmfStateSystemBuilder ss, Long prevState, Integer formerThreadNode, long timestamp) throws AttributeNotFoundException { ITmfStateValue value; <START> int state = (int) (prevState & (LinuxValues.TASK_NOLOAD - 1)); <END> switch (state) { case LinuxValues.TASK_STATE_RUNNING: value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE; break; case LinuxValues.TASK_INTERRUPTIBLE: case LinuxValues.TASK_UNINTERRUPTIBLE: value = StateValues.PROCESS_STATUS_WAIT_BLOCKED_VALUE; break; case LinuxValues.TASK_DEAD: value = TmfStateValue.nullValue(); break; default: value = StateValues.PROCESS_STATUS_WAIT_UNKNOWN_VALUE; break; } int quark = ss.getQuarkRelativeAndAdd(formerThreadNode, Attributes.STATUS); ss.modifyAttribute(timestamp, value, quark); }</code><technical_language>YES! this is doing... ~0x00100 -> 0xffEFF, want 0x00EFF</technical_language>

Target:
private static void setOldProcessStatus(ITmfStateSystemBuilder ss, Long prevState, Integer formerThreadNode, long timestamp) throws AttributeNotFoundException { ITmfStateValue value; int state = (int) (prevState & (LinuxValues.TASK_NOLOAD - 1)); if (isRunning(state)) { value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE; } else if (isWaiting(state)) { value = StateValues.PROCESS_STATUS_WAIT_BLOCKED_VALUE; } else if (isDead(state)) { value = TmfStateValue.nullValue(); } else { value = StateValues.PROCESS_STATUS_WAIT_UNKNOWN_VALUE; } int quark = ss.getQuarkRelativeAndAdd(formerThreadNode, Attributes.STATUS); ss.modifyAttribute(timestamp, value, quark); }
Source:
<code>public void validateDefaultRepresentation() throws Exception { <START> assertPropEquals("uuid", getUuidProperty()); <END> assertPropPresent("name"); assertPropPresent("description"); assertPropPresent("identifierType"); }</code><technical_language>forget add? super.validateFullRepresentation();</technical_language>

Target:
public void validateDefaultRepresentation() throws Exception { super.validateDefaultRepresentation(); assertPropEquals("uuid", getUuidProperty()); assertPropPresent("name"); assertPropPresent("description"); assertPropPresent("identifierType"); }
Source:
<code>public void init() { try { userService = UserService.getInstance(); } catch (Exception ex) { log.error(ex, "Unable to initialize User service!"); } try { permissionsService = OskariComponentManager.getComponentOfType(PermissionService.class); } catch (Exception ex) { <START> log.error(ex, "Unable to initialize permission service!"); <END> } }</code><technical_language>try recover error exceptions thrown init(). ActionHandler is for frontend need check if services initialized correctly for request preProcess()</technical_language>

Target:
public void init() { try { userService = UserService.getInstance(); } catch (ServiceException ex) { throw new ServiceRuntimeException("Exception occured while initializing user service",ex); } try { permissionsService = OskariComponentManager.getComponentOfType(PermissionService.class); } catch (Exception ex) { throw new ServiceRuntimeException("Exception occured while initializing permission service",ex); } }
Source:
<code>public void testGetTaskIdTrailingSlash() { <START> assertEquals("123", handler.getTaskId(repository, "<LINK_0>123/")); <END> }</code><technical_language>I in this case need init repo a url a slash end</technical_language>

Target:
public void testGetTaskIdTrailingSlash() { TaskRepository trailingSlashRepository = new TaskRepository(GerritConnector.CONNECTOR_KIND, "<LINK_0>"); assertEquals("123", handler.getTaskId(trailingSlashRepository, "<LINK_0>123")); }
Source:
<code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String fileName = request.getParameter("filename"); String contentType = request.getParameter("contenttype"); String content = request.getParameter("content"); Boolean cache = Boolean.parseBoolean(request.getParameter("cache")); response.setContentType(contentType); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); if (!cache) { response.setHeader("Cache-Control", "no-cache, must-revalidate"); response.setHeader("Expires", "Sat, 26 Jul 1997 05:00:00 GMT"); } <START> response.getWriter().println(content); <END> if (response.getWriter().checkError()) { throw new IOException("Error when writing to response stream"); } }</code><technical_language>do need extra new line</technical_language>

Target:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String fileName = request.getParameter("filename"); String contentType = request.getParameter("contenttype"); String content = request.getParameter("content"); Boolean cache = Boolean.parseBoolean(request.getParameter("cache")); response.setContentType(contentType); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); if (!cache) { response.setHeader("Cache-Control", "no-cache, must-revalidate"); response.setHeader("Expires", "Sat, 26 Jul 1997 05:00:00 GMT"); } response.getWriter().print(content); if (response.getWriter().checkError()) { throw new IOException("Error when writing to response stream"); } }
Source:
<code><START> public HaplotypeProbabilities merge(final HaplotypeProbabilities other) { <END> super.merge(other); if (!this.getHaplotype().equals(other.getHaplotype())) { throw new IllegalArgumentException("Mismatched haplotypes in call to HaplotypeProbabilities.merge(): " + getHaplotype() + ", " + other.getHaplotype()); } if (!(other instanceof HaplotypeProbabilitiesFromContaminatorSequence)) { throw new IllegalArgumentException("Can only merge HaplotypeProbabilities of same class."); } final HaplotypeProbabilitiesFromContaminatorSequence o = (HaplotypeProbabilitiesFromContaminatorSequence) other; if (o.contamination != this.contamination) { throw new IllegalArgumentException("Can only merge HaplotypeProbabilitiesFromContaminatorSequence with the same contamination value."); } for (final Genotype contGeno : Genotype.values()) { this.likelihoodMap[contGeno.v] = MathUtil.multiply(this.likelihoodMap[contGeno.v], o.likelihoodMap[contGeno.v]); } return this; }</code><technical_language>This covariant return types</technical_language>

Target:
public HaplotypeProbabilitiesFromContaminatorSequence merge(final HaplotypeProbabilities other) { super.merge(other); if (!this.getHaplotype().equals(other.getHaplotype())) { throw new IllegalArgumentException("Mismatched haplotypes in call to HaplotypeProbabilities.merge(): " + getHaplotype() + ", " + other.getHaplotype()); } if (!(other instanceof HaplotypeProbabilitiesFromContaminatorSequence)) { throw new IllegalArgumentException("Can only merge HaplotypeProbabilities of same class."); } final HaplotypeProbabilitiesFromContaminatorSequence o = (HaplotypeProbabilitiesFromContaminatorSequence) other; if (o.contamination != this.contamination) { throw new IllegalArgumentException("Can only merge HaplotypeProbabilitiesFromContaminatorSequence with the same contamination value."); } for (final Genotype contGeno : Genotype.values()) { this.likelihoodMap[contGeno.v] = MathUtil.multiply(this.likelihoodMap[contGeno.v], o.likelihoodMap[contGeno.v]); } return this; }
Source:
<code><START> public void init(FilterConfig filterConfig) throws ServletException { <END> GeoServerDataDirectory dataDirectory = GeoServerExtensions.bean(GeoServerDataDirectory.class); if (dataDirectory != null) { USE_AS_SERVLET_FILTER = true; Resource resource = dataDirectory.get(RulesDao.getRulesPath()); rules = RulesDao.getRules(resource.in()); resource.addListener(notify -> rules = RulesDao.getRules(resource.in())); } }</code><technical_language>this method get called bean is picked spring context, a servlet filter, right? clarify this</technical_language>

Target:
public void init(FilterConfig filterConfig) throws ServletException { GeoServerDataDirectory dataDirectory = GeoServerExtensions.bean(GeoServerDataDirectory.class); initRules(dataDirectory); }
Source:
<code>protected boolean findAffectedSourceFiles(IResourceDelta delta, ClasspathLocation[] classFoldersAndJars, IProject prereqProject) { for (int i = 0, l = classFoldersAndJars.length; i < l; i++) { ClasspathLocation bLocation = classFoldersAndJars[i]; if (bLocation != null) { IPath p = bLocation.getProjectRelativePath(); if (p != null) { IResourceDelta binaryDelta = delta.findMember(p); if (binaryDelta != null) { if (bLocation instanceof ClasspathJar) { if (JavaBuilder.DEBUG) System.out.println("ABORTING incremental build... found delta to jar/zip file"); return false; } if (binaryDelta.getKind() == IResourceDelta.ADDED || binaryDelta.getKind() == IResourceDelta.REMOVED) { if (JavaBuilder.DEBUG) System.out.println("ABORTING incremental build... found added/removed binary folder"); return false; } int segmentCount = binaryDelta.getFullPath().segmentCount(); IResourceDelta[] children = binaryDelta.getAffectedChildren(); <START> StringSet structurallyChangedTypes = <END> null; if (bLocation.isOutputFolder()) structurallyChangedTypes = this.newState.getStructurallyChangedTypes(this.javaBuilder.getLastState(prereqProject)); for (int j = 0, m = children.length; j < m; j++) findAffectedSourceFiles(children[j], segmentCount, structurallyChangedTypes); this.notifier.checkCancel(); } } } } return true; }</code><technical_language>This is place (plus callers State.structurallyChangedTypes) left StringSet is used. Is reason replaced this occurrence</technical_language>

Target:
protected boolean findAffectedSourceFiles(IResourceDelta delta, ClasspathLocation[] classFoldersAndJars, IProject prereqProject) { for (int i = 0, l = classFoldersAndJars.length; i < l; i++) { ClasspathLocation bLocation = classFoldersAndJars[i]; if (bLocation != null) { IPath p = bLocation.getProjectRelativePath(); if (p != null) { IResourceDelta binaryDelta = delta.findMember(p); if (binaryDelta != null) { if (bLocation instanceof ClasspathJar) { if (JavaBuilder.DEBUG) System.out.println("ABORTING incremental build... found delta to jar/zip file"); return false; } if (binaryDelta.getKind() == IResourceDelta.ADDED || binaryDelta.getKind() == IResourceDelta.REMOVED) { if (JavaBuilder.DEBUG) System.out.println("ABORTING incremental build... found added/removed binary folder"); return false; } int segmentCount = binaryDelta.getFullPath().segmentCount(); IResourceDelta[] children = binaryDelta.getAffectedChildren(); Set<String> structurallyChangedTypes = null; if (bLocation.isOutputFolder()) structurallyChangedTypes = this.newState.getStructurallyChangedTypes(this.javaBuilder.getLastState(prereqProject)); for (int j = 0, m = children.length; j < m; j++) findAffectedSourceFiles(children[j], segmentCount, structurallyChangedTypes); this.notifier.checkCancel(); } } } } return true; }
Source:
<code>private FormValidation checkUpdatesServer() throws Exception { <START> for (UpdateSite site : Jenkins.getInstance().getUpdateCenter().getSites()) { <END> FormValidation v = site.updateDirectlyNow(DownloadService.signatureCheck); if (v.kind != FormValidation.Kind.OK) { return v; } } for (DownloadService.Downloadable d : DownloadService.Downloadable.all()) { FormValidation v = d.updateNow(); if (v.kind != FormValidation.Kind.OK) { return v; } } return FormValidation.ok(); }</code><technical_language>suggestion for (UpdateSite site : Jenkins.get().getUpdateCenter().getSites()) {</technical_language>

Target:
private FormValidation checkUpdatesServer() throws Exception { for (UpdateSite site : Jenkins.get().getUpdateCenter().getSites()) { FormValidation v = site.updateDirectlyNow(DownloadService.signatureCheck); if (v.kind != FormValidation.Kind.OK) { return v; } } for (DownloadService.Downloadable d : DownloadService.Downloadable.all()) { FormValidation v = d.updateNow(); if (v.kind != FormValidation.Kind.OK) { return v; } } return FormValidation.ok(); }
Source:
<code><START> public StoredProcedureQuery createNamedStoredProcedureQuery(String s) { <END> return null; }</code><technical_language>please re-indent changes follow [coding convention](<LINK_0></technical_language>

Target:
public StoredProcedureQuery createNamedStoredProcedureQuery(String s) { throw new UnsupportedOperationException("createNamedStoredProcedureQuery"); }
Source:
<code>public void init() { broker = LdapFactory.getInstance(getProfileName()); context.put(ExtensionProperties.AUTHOR, "oVirt"); <START> context.put(ExtensionProperties.EXTENSION_NAME, "Provisional Authorization (LbapBroker code based)"); <END> context.put(ExtensionProperties.LICENSE, "ASL 2.0"); context.put(ExtensionProperties.HOME, "<LINK_0>"); context.put(ExtensionProperties.VERSION, "1.0"); }</code><technical_language>Internal Kerberos/LDAP Authorization</technical_language>

Target:
public void init() { broker = LdapFactory.getInstance(getProfileName()); context.put(ExtensionProperties.AUTHOR, "The oVirt Project"); context.put(ExtensionProperties.EXTENSION_NAME, "Internal Kerberos/LDAP authorization (Built-in)"); context.put(ExtensionProperties.LICENSE, "ASL 2.0"); context.put(ExtensionProperties.HOME, "<LINK_0>"); context.put(ExtensionProperties.VERSION, "N/A"); }
Source:
<code>public void restartTaskOnNodeFailure(final InternalTask task) { if (status.isUnusable()) { return; } infrastructure.getInternalOperationsThreadPool().submit(new Runnable() { @Override public void run() { TerminationData terminationData = jobs.restartTaskOnNodeFailure(task); try { terminationData.handleTermination(SchedulingService.this); <START> } catch (IOException e) { <END> e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } wakeUpSchedulingThread(); } }); }</code><technical_language>remark everywhere, a logger</technical_language>

Target:
public void restartTaskOnNodeFailure(final InternalTask task) { if (status.isUnusable()) { return; } infrastructure.getInternalOperationsThreadPool().submit(new Runnable() { @Override public void run() { TerminationData terminationData = jobs.restartTaskOnNodeFailure(task); try { terminationData.handleTermination(SchedulingService.this); } catch (Exception e) { logger.error("Exception occurred, fail to get variables into the cleaning script: ",e); } wakeUpSchedulingThread(); } }); }
Source:
<code>public boolean updateApiFromString(String apiName, String apiData) throws APIException{ final Lock lock = getLock(); try { lock.lock(); assertNameNotEmpty(apiName); OMElement apiElement = AXIOMUtil.stringToOM(apiData); OMAttribute nameAttribute = apiElement.getAttribute(new QName("name")); if(nameAttribute == null || "".equals(nameAttribute.getAttributeValue().trim())){ apiElement.addAttribute("name", apiName, null); } API api = APIFactory.createAPI(apiElement); SynapseConfiguration synapseConfiguration = getSynapseConfiguration(); API oldAPI = synapseConfiguration.getAPI(apiName); <START> if (oldAPI != null){ <END> oldAPI.destroy(); api.setFileName(oldAPI.getFileName()); } synapseConfiguration.removeAPI(apiName); synapseConfiguration.addAPI(api.getName(),api); api.init(getSynapseEnvironment()); if (oldAPI.getArtifactContainerName() != null) { api.setArtifactContainerName(oldAPI.getArtifactContainerName()); api.setIsEdited(true); getApiByName(api.getName()).setIsEdited(true); } else { MediationPersistenceManager pm = getMediationPersistenceManager(); String fileName = api.getFileName(); pm.deleteItem(apiName, fileName, ServiceBusConstants.ITEM_TYPE_REST_API); pm.saveItem(apiName, ServiceBusConstants.ITEM_TYPE_REST_API); } return true; } catch (XMLStreamException e) { handleException(log, "Could not parse String to OMElement", e); return false; } finally { lock.unlock(); } }</code><technical_language>Formatting issue fix this other places</technical_language>

Target:
public boolean updateApiFromString(String apiName, String apiData) throws APIException { final Lock lock = getLock(); try { lock.lock(); assertNameNotEmpty(apiName); OMElement apiElement = AXIOMUtil.stringToOM(apiData); OMAttribute nameAttribute = apiElement.getAttribute(new QName("name")); if (nameAttribute == null || nameAttribute.getAttributeValue().trim().isEmpty()) { apiElement.addAttribute("name", apiName, null); } API api = APIFactory.createAPI(apiElement); SynapseConfiguration synapseConfiguration = getSynapseConfiguration(); API oldAPI = synapseConfiguration.getAPI(apiName); if (oldAPI != null) { oldAPI.destroy(); api.setFileName(oldAPI.getFileName()); } synapseConfiguration.removeAPI(apiName); synapseConfiguration.addAPI(api.getName(),api); api.init(getSynapseEnvironment()); if (oldAPI.getArtifactContainerName() != null) { api.setArtifactContainerName(oldAPI.getArtifactContainerName()); api.setIsEdited(true); getApiByName(api.getName()).setIsEdited(true); } else { MediationPersistenceManager pm = getMediationPersistenceManager(); String fileName = api.getFileName(); pm.deleteItem(apiName, fileName, ServiceBusConstants.ITEM_TYPE_REST_API); pm.saveItem(apiName, ServiceBusConstants.ITEM_TYPE_REST_API); } return true; } catch (XMLStreamException e) { handleException(log, "Could not parse String to OMElement", e); return false; } finally { lock.unlock(); } }
Source:
<code>public RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final RevCommit r = super.next(); if (r == null) { return null; } if ((r.flags & UNINTERESTING) != 0) { markTreeUninteresting(r.getTree()); if (boundary) return r; continue; } <START> pendingObjects.add(r.getTree()); <END> return r; } }</code><technical_language>want add filter here: if (objectFilter.include(this, r.getTree()) pendingObjects.add(r.getTree());</technical_language>

Target:
public RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final RevCommit r = super.next(); if (r == null) { return null; } final RevTree t = r.getTree(); if ((r.flags & UNINTERESTING) != 0) { if (objectFilter.include(this, t)) { markTreeUninteresting(t); } if (boundary) { return r; } continue; } if (objectFilter.include(this, t)) { pendingObjects.add(t); } return r; } }
Source:
<code>protected String truncateValidationResultMessageToMaximumDatabaseFieldSize(String validationResultMessages) { if (validationResultMessages != null && validationResultMessages.length() > ConcurConstants.VALIDATION_RESULT_MESSAGE_MAX_LENGTH) { validationResultMessages = validationResultMessages.substring(0, ConcurConstants.VALIDATION_RESULT_MESSAGE_MAX_LENGTH); <START> } <END> return validationResultMessages; }</code><technical_language>constant names confusing in event notification validation size items for database meaning for rest of Concur processing (request extract, collector, sae) validation messages</technical_language>

Target:
protected String truncateValidationResultMessageToMaximumDatabaseFieldSize(String validationResultMessages) { return StringUtils.left(validationResultMessages, ConcurConstants.VALIDATION_RESULT_MESSAGE_MAX_LENGTH); }
Source:
<code>public OutputStream decorateLogger(AbstractBuild build, OutputStream logger) throws IOException, InterruptedException, Run.RunnerAbortedException { if (!bindings.isEmpty()) { return new Filter(build.getCharset().name()).decorateLogger(build, logger); } else { <START> return logger; <END> } }</code><technical_language>I guess is case for adding wrapper empty list of bindings, though, skip this check</technical_language>

Target:
public OutputStream decorateLogger(AbstractBuild build, OutputStream logger) throws IOException, InterruptedException, Run.RunnerAbortedException { return new Filter(build.getCharset().name()).decorateLogger(build, logger); }
Source:
<code>public void decrementCount(ResourceProfile profile, int decrement) { Preconditions.checkArgument(decrement > 0); <START> resources.computeIfPresent(profile, (ignored, currentCount) -> currentCount == decrement ? null : guardAgainstNegativeCount(currentCount - decrement)); <END> }</code><technical_language>Attempts for decreasing non-exist profiles silently. Is this intended? fail explicitly attempts? a bit counterintuitive fail currentCount - decrement negative, non-exist profiles (equivalent currentCount zero)</technical_language>

Target:
public void decrementCount(ResourceProfile profile, int decrement) { Preconditions.checkArgument(decrement > 0); resources.compute(profile, (p, currentCount) -> { Preconditions.checkState(currentCount != null, "Attempting to decrement count of profile %s, but no count was present.", p); return currentCount == decrement ? null : guardAgainstNegativeCount(currentCount - decrement); }); }
Source:
<code>public EMFCompare build() { if (matchEngineFactoryRegistry == null) { matchEngineFactoryRegistry = MatchEngineFactoryRegistryImpl.createStandaloneInstance(); } if (diffEngine == null) { diffEngine = new DefaultDiffEngine(new DiffBuilder()); } if (reqEngine == null) { reqEngine = new DefaultReqEngine(); } if (equiEngine == null) { equiEngine = new DefaultEquiEngine(); } if (registry == null) { registry = new PostProcessorDescriptorRegistryImpl<Object>(); } if (conflictDetector == null) { conflictDetector = new <START> FastConflictDetector(); <END> } return new EMFCompare(this.matchEngineFactoryRegistry, this.diffEngine, this.reqEngine, this.equiEngine, this.conflictDetector, this.registry); }</code><technical_language>change default conflict detection engine calling EMF Compare API, invoking EMF Compare UI. inconsistent</technical_language>

Target:
public EMFCompare build() { if (matchEngineFactoryRegistry == null) { matchEngineFactoryRegistry = MatchEngineFactoryRegistryImpl.createStandaloneInstance(); } if (diffEngine == null) { diffEngine = new DefaultDiffEngine(new DiffBuilder()); } if (reqEngine == null) { reqEngine = new DefaultReqEngine(); } if (equiEngine == null) { equiEngine = new DefaultEquiEngine(); } if (registry == null) { registry = new PostProcessorDescriptorRegistryImpl<Object>(); } if (conflictDetector == null) { conflictDetector = new MatchBasedConflictDetector(); } return new EMFCompare(this.matchEngineFactoryRegistry, this.diffEngine, this.reqEngine, this.equiEngine, this.conflictDetector, this.registry); }
Source:
<code>public boolean isRequestAllowed(HttpServletRequest request) { String site = request.getHeader(SEC_FETCH_SITE_HEADER); <START> if (Strings.isEmpty((site))){ <END> return true; } if (SAME_ORIGIN.equals(site) || SAME_SITE.equals(site) || NONE.equals(site)) { return true; } return isAllowedTopLevelNavigation(request); }</code><technical_language>nitpick: waste parenteses. Additionally org.apache.commons.lang3.StringUtils.isEmpty/isBlank instead</technical_language>

Target:
public boolean isRequestAllowed(HttpServletRequest request) { String site = request.getHeader(SEC_FETCH_SITE_HEADER); if (Strings.isEmpty(site)){ return true; } if (SAME_ORIGIN.equals(site) || SAME_SITE.equals(site) || NONE.equals(site)) { return true; } return isAllowedTopLevelNavigation(request); }
Source:
<code>public void testSetPropertiesAsNonAdmin() throws Exception { <START> testSetProperties("Tutu"); <END> }</code><technical_language>if Tutu is supposed a user name obvious choose a common english name uppercase char</technical_language>

Target:
public void testSetPropertiesAsNonAdmin() throws Exception { testSetProperties(USERNAME); }
Source:
<code>public void testGetResourceBundleOK() { String moduleID = "foobar_1"; String locale = "en"; ResourceBundle resourceBundle = mock( ResourceBundle.class ); when( this.localizationService.getResourceBundle( eq( moduleID ), eq( locale ) ) ).thenReturn( resourceBundle ); Response response = this.endpoint.getResourceBundle( moduleID, locale ); <START> assertNotNull( response ); <END> Status actualStatus = Status.fromStatusCode( response.getStatus() ); assertEquals( Status.OK, actualStatus ); }</code><technical_language>this check is needed</technical_language>

Target:
public void testGetResourceBundleOK() { String moduleID = "foobar_1"; String locale = "en"; ResourceBundle resourceBundle = mock( ResourceBundle.class ); when( this.localizationService.getResourceBundle( eq( moduleID ), eq( locale ) ) ).thenReturn( resourceBundle ); Response response = this.endpoint.getResourceBundle( moduleID, locale ); Status actualStatus = Status.fromStatusCode( response.getStatus() ); assertEquals( Status.OK, actualStatus ); }
Source:
<code>public void startVDOService(VDS vds) { boolean succeeded = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("vdo"), "restart")).getSucceeded(); if (!succeeded) { <START> log.error("Failed to start VDO service while moving the host '{}' to maintenance", vds.getHostName()); <END> } }</code><technical_language>correct message</technical_language>

Target:
public void startVDOService(VDS vds) { boolean succeeded = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("vdo"), "restart")).getSucceeded(); if (!succeeded) { log.error("Failed to start VDO service while activating the host '{}'", vds.getHostName()); } }
Source:
<code>public E get(int location) { E obj; realm.checkIfValid(); <START> if (!isTablePresent()) { <END> return null; } TableOrView table = getTable(); if (table instanceof TableView) { obj = realm.get(classSpec, className, ((TableView) table).getSourceRowIndex(location)); } else { obj = realm.get(classSpec, className, location); } return obj; }</code><technical_language>Remove this</technical_language>

Target:
public E get(int location) { E obj; realm.checkIfValid(); if (isTableRemoved()) { throw new IndexOutOfBoundsException("No results were found."); } TableOrView table = getTable(); if (table instanceof TableView) { obj = realm.get(classSpec, className, ((TableView) table).getSourceRowIndex(location)); } else { obj = realm.get(classSpec, className, location); } return obj; }
Source:
<code>private void processEntriesForContainerBucket(ScanResults results, List<IndexEntry> indexEntries, Map<StoreKey, Long> deletedKeys) { for (IndexEntry indexEntry : indexEntries) { IndexValue indexValue = indexEntry.getValue(); if (!indexValue.isFlagSet(IndexValue.Flags.Delete_Index)) { results.updateContainerBucket(results.containerForecastStartTimeMs, String.valueOf(indexValue.getServiceId()), String.valueOf(indexValue.getContainerId()), indexValue.getSize()); long expOrDelTimeInMs = indexValue.getExpiresAtMs(); if (deletedKeys.containsKey(indexEntry.getKey())) { long deleteTimeInMs = deletedKeys.get(indexEntry.getKey()); expOrDelTimeInMs = expOrDelTimeInMs != Utils.Infinite_Time && expOrDelTimeInMs < deleteTimeInMs ? expOrDelTimeInMs : deleteTimeInMs; } <START> handleContainerBucketUpdate(results, indexValue, expOrDelTimeInMs, SUBTRACT); <END> } } }</code><technical_language>do need subtract if put record is deleted expired</technical_language>

Target:
private void processEntriesForContainerBucket(ScanResults results, List<IndexEntry> indexEntries, Map<StoreKey, Long> deletedKeys) { for (IndexEntry indexEntry : indexEntries) { IndexValue indexValue = indexEntry.getValue(); if (!indexValue.isFlagSet(IndexValue.Flags.Delete_Index)) { results.updateContainerBaseBucket(String.valueOf(indexValue.getServiceId()), String.valueOf(indexValue.getContainerId()), indexValue.getSize()); long expOrDelTimeInMs = indexValue.getExpiresAtMs(); if (deletedKeys.containsKey(indexEntry.getKey())) { long deleteTimeInMs = deletedKeys.get(indexEntry.getKey()); expOrDelTimeInMs = expOrDelTimeInMs != Utils.Infinite_Time && expOrDelTimeInMs < deleteTimeInMs ? expOrDelTimeInMs : deleteTimeInMs; } if (expOrDelTimeInMs != Utils.Infinite_Time) { handleContainerBucketUpdate(results, indexValue, expOrDelTimeInMs, SUBTRACT); } } } }
Source:
<code>protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { <START> GraphqlConfiguration configuration = new GraphqlConfiguration(remaining, parameters); <END> return new GraphqlEndpoint(uri, this, configuration); }</code><technical_language>I follow other components set configurations, meaning configuration properties mutable Camel do job of binding parameters setProperties(configuration, parameters);</technical_language>

Target:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { GraphqlEndpoint endpoint = new GraphqlEndpoint(uri, this); endpoint.setHttpUri(new URI(remaining)); setProperties(endpoint, parameters); return endpoint; }
Source:
<code>private void updateFiltersCheckState() { Object[] children = filterContentProvider .getElements(getContentService()); ICommonFilterDescriptor filterDescriptor; INavigatorFilterService filterService = getContentService() .getFilterService(); for (Object <START> element : <END> children) { filterDescriptor = (ICommonFilterDescriptor) element; if(filterService.isActive(filterDescriptor.getId())) { getTableViewer().setChecked(element, true); getCheckedItems().add(element); } else { getTableViewer().setChecked(element, false); } } }</code><technical_language>rename 'child'</technical_language>

Target:
private void updateFiltersCheckState() { ICommonFilterDescriptor filterDescriptor; INavigatorFilterService filterService = getContentService() .getFilterService(); for (Object child : filterContentProvider.getElements(getContentService())) { filterDescriptor = (ICommonFilterDescriptor) child; if(filterService.isActive(filterDescriptor.getId())) { getTableViewer().setChecked(child, true); getCheckedItems().add(child); } else { getTableViewer().setChecked(child, false); } } }
Source:
<code>public void duplicatePathsTest() { rc.register(TestDuplicateResource.class); final String expectedLog = String.format("The following paths were found for the configured resources:%n" + "%n" + " GET /anotherMe (io.dropwizard.jersey.DropwizardResourceConfigTest.TestDuplicateResource)%n" + " GET /callme (io.dropwizard.jersey.DropwizardResourceConfigTest.TestDuplicateResource)%n"); final String shouldNotContainLog = String.format( " GET /callme (io.dropwizard.jersey.DropwizardResourceConfigTest.TestDuplicateResource)%n" + " GET /callme (io.dropwizard.jersey.DropwizardResourceConfigTest.TestDuplicateResource)%n" + " GET /callme (io.dropwizard.jersey.DropwizardResourceConfigTest.TestDuplicateResource)%n"); assertThat(rc.getEndpointsInfo()).contains(expectedLog); <START> assertThat(rc.getEndpointsInfo()).doesNotContain(shouldNotContainLog); <END> }</code><technical_language>sense java assertThat(rc.getEndpointsInfo()) .containsOnlyOnce()(" GET /callme (io.dropwizard.jersey.DropwizardResourceConfigTest.TestDuplicateResource"))</technical_language>

Target:
public void duplicatePathsTest() { rc.register(TestDuplicateResource.class); final String expectedLog = String.format("The following paths were found for the configured resources:%n" + "%n" + " GET /anotherMe (io.dropwizard.jersey.DropwizardResourceConfigTest.TestDuplicateResource)%n" + " GET /callme (io.dropwizard.jersey.DropwizardResourceConfigTest.TestDuplicateResource)%n"); assertThat(rc.getEndpointsInfo()).contains(expectedLog); assertThat(rc.getEndpointsInfo()).containsOnlyOnce(" GET /callme (io.dropwizard.jersey.DropwizardResourceConfigTest.TestDuplicateResource)"); }
Source:
<code>public String toJSON(MaxwellOutputConfig outputConfig) throws IOException { JsonGenerator g = jsonGeneratorThreadLocal.get(); g.writeStartObject(); g.writeStringField("database", this.database); g.writeStringField("table", this.table); g.writeStringField("type", this.rowType); g.writeNumberField("ts", this.timestamp); if ( outputConfig.includesCommitInfo ) { if ( this.xid != null ) g.writeNumberField("xid", this.xid); if ( this.txCommit ) g.writeBooleanField("commit", true); } if ( outputConfig.includesBinlogPosition ) g.writeStringField("position", (nextPosition.getGtidStr() != null ? nextPosition.getGtidStr() + ":" : "") <START> + this.nextPosition.getFile() + ":" + this.nextPosition.getOffset()); <END> if ( outputConfig.includesServerId && this.serverId != null ) { g.writeNumberField("server_id", this.serverId); } if ( outputConfig.includesThreadId && this.threadId != null ) { g.writeNumberField("thread_id", this.threadId); } if ( outputConfig.excludeColumns.size() > 0 ) { Set<String> keys = new HashSet<>(); keys.addAll(this.data.keySet()); keys.addAll(this.oldData.keySet()); for ( Pattern p : outputConfig.excludeColumns ) { for ( String key : keys ) { if ( p.matcher(key).matches() ) { this.data.remove(key); this.oldData.remove(key); } } } } writeMapToJSON("data", this.data, outputConfig.includesNulls); if ( !this.oldData.isEmpty() ) { writeMapToJSON("old", this.oldData, true); } g.writeEndObject(); g.flush(); return jsonFromStream(); }</code><technical_language>gtid *or* binlog position? yet, move gtid field gtid_position something</technical_language>

Target:
public String toJSON(MaxwellOutputConfig outputConfig) throws IOException { JsonGenerator g = jsonGeneratorThreadLocal.get(); g.writeStartObject(); g.writeStringField("database", this.database); g.writeStringField("table", this.table); g.writeStringField("type", this.rowType); g.writeNumberField("ts", this.timestamp); if ( outputConfig.includesCommitInfo ) { if ( this.xid != null ) g.writeNumberField("xid", this.xid); if ( this.txCommit ) g.writeBooleanField("commit", true); } if ( outputConfig.includesBinlogPosition ) g.writeStringField("position", this.nextPosition.getFile() + ":" + this.nextPosition.getOffset()); if ( outputConfig.includesGtidPosition) g.writeStringField("gtid", this.nextPosition.getGtid()); if ( outputConfig.includesServerId && this.serverId != null ) { g.writeNumberField("server_id", this.serverId); } if ( outputConfig.includesThreadId && this.threadId != null ) { g.writeNumberField("thread_id", this.threadId); } if ( outputConfig.excludeColumns.size() > 0 ) { Set<String> keys = new HashSet<>(); keys.addAll(this.data.keySet()); keys.addAll(this.oldData.keySet()); for ( Pattern p : outputConfig.excludeColumns ) { for ( String key : keys ) { if ( p.matcher(key).matches() ) { this.data.remove(key); this.oldData.remove(key); } } } } writeMapToJSON("data", this.data, outputConfig.includesNulls); if ( !this.oldData.isEmpty() ) { writeMapToJSON("old", this.oldData, true); } g.writeEndObject(); g.flush(); return jsonFromStream(); }
Source:
<code>public DownloadConfig(DownloadService downloadService) { <START> this.downloadService = downloadService; <END> }</code><technical_language>suggestion this.downloadService = requireNonNull(downloadService);</technical_language>

Target:
public DownloadConfig(DownloadService downloadService) { this.downloadService = requireNonNull(downloadService); }
Source:
<code>public void metersResults() { BatchSizeRecorder batchSizeRecorder = BatchSizeRecorder.create(SAFE_IDENTIFIER); batchSizeRecorder.markBatchProcessed(5); batchSizeRecorder.markBatchProcessed(10); <START> Histogram meter = (Histogram) SharedTaggedMetricRegistries.getSingleton().getMetrics() <END> .get(MetricName.builder().safeName(BatchSizeRecorder.AUTOBATCHER_METER) .putSafeTags("safeIdentifier", SAFE_IDENTIFIER) .build()); assertThat(meter).isNotNull(); assertThat(meter.getCount()).isEqualTo(2); assertThat(meter.getSnapshot().getMean()).isEqualTo(7.5); }</code><technical_language>nice meter</technical_language>

Target:
public void metersResults() { BatchSizeRecorder batchSizeRecorder = BatchSizeRecorder.create(SAFE_IDENTIFIER); batchSizeRecorder.markBatchProcessed(5); batchSizeRecorder.markBatchProcessed(10); Histogram histogram = (Histogram) SharedTaggedMetricRegistries.getSingleton().getMetrics() .get(MetricName.builder().safeName(BatchSizeRecorder.AUTOBATCHER_METER) .putSafeTags("identifier", SAFE_IDENTIFIER) .build()); assertThat(histogram).isNotNull(); assertThat(histogram.getCount()).isEqualTo(2); assertThat(histogram.getSnapshot().getMean()).isEqualTo(7.5); }
Source:
<code>protected <T> CompletableFuture<T> sendRequest(Request request) { requestLock.readLock().lock(); try { checkArgument(request.hasHeader()); Header header = request.getHeader(); CompletableFuture<T> retVal = new CompletableFuture<>(); pendingRequests.put(header.getRequestId(), retVal); ByteBuf outBuf = PooledByteBufAllocator.DEFAULT.buffer(); <START> outBuf.writeByte(0x2); END> outBuf.writeBytes(request.toByteArray()); channel.writeAndFlush(outBuf); requestTimeoutQueue.add(new RequestTime(System.currentTimeMillis(), header.getRequestId())); return retVal; } finally { requestLock.readLock().unlock(); } }</code><technical_language>I 0x2 0x1 converted statics. Rebase @zfrenette latest branch</technical_language>

Target:
protected <T> CompletableFuture<T> sendRequest(Request request) { requestLock.readLock().lock(); try { checkArgument(request.hasHeader()); Header header = request.getHeader(); CompletableFuture<T> retVal = new CompletableFuture<>(); pendingRequests.put(header.getRequestId(), retVal); ByteBuf outBuf = PooledByteBufAllocator.DEFAULT.buffer(); outBuf.writeByte(API.PROTO_CORFU_MSG_MARK); outBuf.writeBytes(request.toByteArray()); channel.writeAndFlush(outBuf); requestTimeoutQueue.add(new RequestTime(System.currentTimeMillis(), header.getRequestId())); return retVal; } finally { requestLock.readLock().unlock(); } }
Source:
<code>public Callable<?> createCallable(Console console, ConsoleParameters params) { List<Long> branchUuids = new ArrayList<Long>(); for (String uuid : params.getArray("branchUuids")) { if (Strings.isNumeric(uuid)) { branchUuids.add(Long.parseLong(uuid)); <START> } <END> } if (branchUuids.isEmpty()) { console.writeln("No branch uuids where specified"); } Collection<String> options = params.getOptions(); boolean recurse = options.contains("R"); boolean unArchived = options.contains("A"); boolean unDeleted = options.contains("D"); boolean baseline = options.contains("B"); boolean runPurge = options.contains("P"); OrcsBranch orcsBranch = getOrcsApi().getBranchOps(null); return new PurgeBranchCallable(console, orcsBranch, getOrcsApi().getQueryFactory(null), branchUuids, recurse, unArchived, unDeleted, baseline, runPurge); }</code><technical_language>error out if format is incorrect</technical_language>

Target:
public Callable<?> createCallable(Console console, ConsoleParameters params) { List<Long> branchUuids = new ArrayList<Long>(); for (String uuid : params.getArray("branchUuids")) { if (Strings.isNumeric(uuid)) { branchUuids.add(Long.parseLong(uuid)); } else { console.writeln("UUID listed %s is not a valid UUID", uuid); } } if (branchUuids.isEmpty()) { console.writeln("No branch uuids where specified"); } Collection<String> options = params.getOptions(); boolean recurse = options.contains("R"); boolean unArchived = options.contains("A"); boolean unDeleted = options.contains("D"); boolean baseline = options.contains("B"); boolean runPurge = options.contains("P"); OrcsBranch orcsBranch = getOrcsApi().getBranchOps(null); return new PurgeBranchCallable(console, orcsBranch, getOrcsApi().getQueryFactory(null), branchUuids, recurse, unArchived, unDeleted, baseline, runPurge); }
Source:
<code>public CTFStreamInput(CTFStream stream, File file) throws CTFReaderException { fStream = stream; fFile = file; <START> fBitBuffer = BitBuffer.EMPTY_BITBUFFER; <END> fByteOrder = getStream().getTrace().getByteOrder(); fBitBuffer.setByteOrder(fByteOrder); try { fFileInputStream = new FileInputStream(file); } catch (FileNotFoundException e) { throw new CTFReaderException(e); } fFileChannel = fFileInputStream.getChannel(); fIndex = new StreamInputPacketIndex(); }</code><technical_language>hmm, ugly workaround. If is / final, leave field nullable mark null here. more representative</technical_language>

Target:
public CTFStreamInput(CTFStream stream, File file) throws CTFReaderException { fStream = stream; fFile = file; try { fFileInputStream = new FileInputStream(file); } catch (FileNotFoundException e) { throw new CTFReaderException(e); } fFileChannel = fFileInputStream.getChannel(); fIndex = new StreamInputPacketIndex(); }
Source:
<code>protected ResolveMerger(Repository local) { super(local); commitNames = new String[] { "BASE", "OURS", "THEIRS" }; <START> oi = local.newObjectInserter(); <END> }</code><technical_language>This necessary. need inserter call getObjectInserter(). super class manages allocation release for you</technical_language>

Target:
protected ResolveMerger(Repository local) { super(local); commitNames = new String[] { "BASE", "OURS", "THEIRS" }; oi = getObjectInserter(); }
Source:
<code>protected double convertPositionToAngle(double value) { <START> return value * getServoAngleRange() + ServoSubsystem.kMinServoAngle; <END> }</code><technical_language>passed in values</technical_language>

Target:
protected static double convertPositionToAngle(double value) { return value * ServoSubsystem.getServoAngleRange() + ServoSubsystem.MIN_SERVO_ANGLE; }
Source:
<code>private static boolean isUnacceptableCharacter( char ch ) { <START> return " .,:(){}[]\"`'*/+-".indexOf( ch ) != -1; <END> }</code><technical_language>raise this a public constant public static final MQL_RESERVED_CHARS = " .,:(){}[]\"'*/+-";</technical_language>

Target:
private static boolean isUnacceptableCharacter( char ch ) { return MQL_RESERVED_CHARS.indexOf( ch ) != -1; }
Source:
<code>public String toSerializable(final LogEvent loggingEvent) { JSONObject logstashEvent = new JSONObject(); JSONObject userFieldsEvent = new JSONObject(); HostData host = new HostData(); LayoutUtils.addUserFields(ADDITIONNAL_ATTRIBUTES, userFieldsEvent); Map<String, String> mdc = LayoutUtils.processMDCMetaFields(loggingEvent.getContextData().toMap(), logstashEvent, metaFields); logstashEvent.put(LayoutFields.VERSION, LayoutFields.VERSION_VALUE); logstashEvent.put(LayoutFields.TIME_STAMP, LayoutUtils.dateFormat(loggingEvent.getTimeMillis())); logstashEvent.put(LayoutFields.SEVERITY, loggingEvent.getLevel().toString()); logstashEvent.put(LayoutFields.THREAD_NAME, loggingEvent.getThreadName()); logstashEvent.put(LayoutFields.AGENT_TIME_STAMP, LayoutUtils.dateFormat(new Date().getTime())); <START> if (loggingEvent.getMessage().getFormattedMessage() != null) { <END> logstashEvent.put(LayoutFields.LOG_MESSAGE, loggingEvent.getMessage().getFormattedMessage()); } handleThrown(logstashEvent, loggingEvent); JSONObject logSourceEvent = createLogSourceEvent(loggingEvent, host); logstashEvent.put(LayoutFields.LOG_SOURCE, logSourceEvent); LayoutUtils.addMDC(mdc, userFieldsEvent, logstashEvent); if (!userFieldsEvent.isEmpty()) { logstashEvent.put(LayoutFields.CUSTOM_INFO, userFieldsEvent); } return logstashEvent.toString() + "\n"; }</code><technical_language>I choose refactor this</technical_language>

Target:
public String toSerializable(final LogEvent loggingEvent) { JSONObject logstashEvent = new JSONObject(); JSONObject userFieldsEvent = new JSONObject(); HostData host = new HostData(); LayoutUtils.addUserFields(ADDITIONNAL_ATTRIBUTES, userFieldsEvent); Map<String, String> mdc = LayoutUtils.processMDCMetaFields(loggingEvent.getContextData().toMap(), logstashEvent, metaFields); logstashEvent.put(LayoutFields.VERSION, LayoutFields.VERSION_VALUE); logstashEvent.put(LayoutFields.TIME_STAMP, LayoutUtils.dateFormat(loggingEvent.getTimeMillis())); logstashEvent.put(LayoutFields.SEVERITY, loggingEvent.getLevel().toString()); logstashEvent.put(LayoutFields.THREAD_NAME, loggingEvent.getThreadName()); logstashEvent.put(LayoutFields.AGENT_TIME_STAMP, LayoutUtils.dateFormat(new Date().getTime())); final String formattedMessage = loggingEvent.getMessage().getFormattedMessage(); if (formattedMessage != null) { logstashEvent.put(LayoutFields.LOG_MESSAGE, formattedMessage); } handleThrown(logstashEvent, loggingEvent); JSONObject logSourceEvent = createLogSourceEvent(loggingEvent, host); logstashEvent.put(LayoutFields.LOG_SOURCE, logSourceEvent); LayoutUtils.addMDC(mdc, userFieldsEvent, logstashEvent); if (!userFieldsEvent.isEmpty()) { logstashEvent.put(LayoutFields.CUSTOM_INFO, userFieldsEvent); } return logstashEvent.toString() + "\n"; }