auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<String> listObjectNames( String bucketName, String objectNamePrefix, String delimiter, long maxResults) throws IOException { logger.atFine().log( "listObjectNames(%s, %s, %s, %s)", bucketName, objectNamePrefix, delimiter, maxResults); PageState pageState = new PageState(false); listStorageObjectsAndPrefixes( bucketName, objectNamePrefix, delimiter, false, maxResults, pageState); List<String> objectNames = new ArrayList<>(pageState.getPrefixes().size()); objectNames.addAll(pageState.getPrefixes()); <START> ; <END> for (StorageObject obj : pageState.getListedObjects()) { objectNames.add(obj.getName()); } return objectNames; }</code><technical_language>delete please</technical_language>

Target:
public List<String> listObjectNames( String bucketName, String objectNamePrefix, String delimiter, long maxResults) throws IOException { logger.atFine().log( "listObjectNames(%s, %s, %s, %s)", bucketName, objectNamePrefix, delimiter, maxResults); List<StorageObject> listedObjects = new ArrayList<>(); List<String> listedPrefixes = new ArrayList<>(); listStorageObjectsAndPrefixes( bucketName, objectNamePrefix, delimiter, false, maxResults, listedObjects, listedPrefixes); List<String> objectNames = listedPrefixes; for (StorageObject obj : listedObjects) { objectNames.add(obj.getName()); } return objectNames; }
Source:
<code>public void start(AbstractProject project, boolean newInstance) { logger.debug("Start project: {}", project); super.start(project, newInstance); initializeTriggerOnEvents(); this.myProject = project; try { if (PluginImpl.getInstance() != null) { PluginImpl.getInstance().addListener(this); } else { logger.warn("The plugin instance could not be found! Project will not be triggered!", project.getFullDisplayName()); } } catch (IllegalStateException e) { logger.error("I am too early!", e); } if (dynamicTriggerConfiguration) { gerritTriggerTimerTask = new GerritTriggerTimerTask(this); } if (allowTriggerMissedPatches) { for (GerritProject p : gerritProjects) { <START> GerritProjectList.addProject(p); <END> } } }</code><technical_language>If a user reconfigures project GerritProjectList project(s) new one. I ou fix in sop method of trigger</technical_language>

Target:
public void start(AbstractProject project, boolean newInstance) { logger.debug("Start project: {}", project); super.start(project, newInstance); initializeTriggerOnEvents(); this.myProject = project; try { if (PluginImpl.getInstance() != null) { PluginImpl.getInstance().addListener(this); } else { logger.warn("The plugin instance could not be found! Project will not be triggered!", project.getFullDisplayName()); } } catch (IllegalStateException e) { logger.error("I am too early!", e); } if (dynamicTriggerConfiguration) { gerritTriggerTimerTask = new GerritTriggerTimerTask(this); } GerritProjectList.removeTriggerFromProjectList(this); if (allowTriggeringUnreviewedPatches) { for (GerritProject p : gerritProjects) { GerritProjectList.addProject(p, this); } } }
Source:
<code>public String getStringValue() { String ret = null; try { ret = (String) defaultValue; <START> } catch (ClassCastException e2) { <END> ; } try { ret = (String) value; } catch (ClassCastException e) { ; } return ret; }</code><technical_language>ClassCastException e</technical_language>

Target:
public String getStringValue() { String ret = null; try { ret = (String) defaultValue; } catch (ClassCastException e) { ; } try { ret = (String) value; } catch (ClassCastException e) { ; } return ret; }
Source:
<code>public Evidence createEvidence(final CallbackProperties properties, final Subject subject) { LOG.debug("SamlCallbackHandler.createEvidence() -- Begin"); final String evAssertionID = properties.getEvidenceID(); final List<AttributeStatement> statements = createEvidenceStatements(properties); <START> return wrapperEvidence(new WrapperEvidenceParameter(evAssertionID, properties, statements, subject)); <END> }</code><technical_language>stylistic suggestions consider here: 1. Changing "wrapEvidence" follow normal verb-/action-based method naming convention. 2. "Wrapper" in a class name last, first; e.g., org.apache.wss4j.common.saml.**SamlAssertionWrapper**</technical_language>

Target:
public Evidence createEvidence(final CallbackProperties properties, final Subject subject) { LOG.debug("SamlCallbackHandler.createEvidence() -- Begin"); final List<AttributeStatement> statements = createEvidenceStatements(properties); return buildEvidence(properties, statements, subject); }
Source:
<code>private void buildOpenExistingRepresentationsMenu(final IMenuManager menu, final DSemanticDiagram designerDiag, final EditPart editpart, final EObject designerObj) { final EObject semantic = ((DSemanticDecorator) designerObj).getTarget(); if (semantic != null) { final Session session = SessionManager.INSTANCE.getSession(semantic); if (session != null) { final IMenuManager navigateManager = (IMenuManager) menu.find("navigateMenu"); navigateManager.remove("open"); final MenuManager openMenuManager = new MenuManager("Open", MENU_OPEN_REPRESENTATION_ID); <START> if (menu.getItems() != null) { <END> menu.insertBefore(menu.getItems()[FIRST_ITEM_INDEX].getId(), openMenuManager); } else { menu.add(openMenuManager); } contributeToPopupMenu(openMenuManager, null); final TransactionalEditingDomain transDomain = TransactionUtil.getEditingDomain(designerDiag); final Collection<DRepresentation> otherRepresentations = DialectManager.INSTANCE.getRepresentations(semantic, session); for (final DRepresentation representation : otherRepresentations) { if (!EcoreUtil.equals(designerDiag, representation) && isFromActiveViewpoint(session, representation)) { openMenuManager.add(buildOpenRepresentationAction(session, representation, editpart, transDomain)); } } if (designerObj instanceof DRepresentationElement) { buildOpenableRepresentationsMenu(openMenuManager, designerObj, session, editpart, transDomain); } } } }</code><technical_language>menu.getItems() null empty. In this case, menu.getItems()[FIRST_ITEM_INDEX] throws IndexOutOfBoundException Do a constant for "0"</technical_language>

Target:
private void buildOpenExistingRepresentationsMenu(final IMenuManager menu, final DSemanticDiagram designerDiag, final EditPart editpart, final EObject designerObj) { final EObject semantic = ((DSemanticDecorator) designerObj).getTarget(); if (semantic != null) { final Session session = SessionManager.INSTANCE.getSession(semantic); if (session != null) { final IMenuManager navigateManager = (IMenuManager) menu.find("navigateMenu"); navigateManager.remove("open"); final MenuManager openMenuManager = new MenuManager("Open", MENU_OPEN_REPRESENTATION_ID); if (!menu.isEmpty()) { menu.insertBefore(menu.getItems()[0].getId(), openMenuManager); } else { menu.add(openMenuManager); } contributeToPopupMenu(openMenuManager, null); final TransactionalEditingDomain transDomain = TransactionUtil.getEditingDomain(designerDiag); final Collection<DRepresentation> otherRepresentations = DialectManager.INSTANCE.getRepresentations(semantic, session); for (final DRepresentation representation : otherRepresentations) { if (!EcoreUtil.equals(designerDiag, representation) && isFromActiveViewpoint(session, representation)) { openMenuManager.add(buildOpenRepresentationAction(session, representation, editpart, transDomain)); } } if (designerObj instanceof DRepresentationElement) { buildOpenableRepresentationsMenu(openMenuManager, designerObj, session, editpart, transDomain); } } } }
Source:
<code>public Application call(Application originalApplication, Application updatedApplication) { boolean isChaosMonkeyEnabled = isChaosMonkeyEnabled(updatedApplication); if (isChaosMonkeyEnabled(originalApplication) == isChaosMonkeyEnabled) { return updatedApplication; } Object rawPermissions = updatedApplication.details().get("permissions"); if (!(rawPermissions instanceof Map)) { log.warn("No permissions config found on application '{}'", updatedApplication.getName()); return updatedApplication; } @SuppressWarnings("unchecked") Map<String, List<String>> permissionsMap = (Map<String, List<String>>) rawPermissions; if (isChaosMonkeyEnabled) { List<String> readPermissions = permissionsMap.get("READ"); <START> if (!readPermissions.contains(properties.getUserRole())) { <END> log.info("Chaos Monkey READ permissions applied for '{}'", updatedApplication.getName()); readPermissions.add(properties.getUserRole()); } List<String> writePermissions = permissionsMap.get("WRITE"); if (!writePermissions.contains(properties.getUserRole())) { log.info("Chaos Monkey WRITE permissions applied for '{}'", updatedApplication.getName()); writePermissions.add(properties.getUserRole()); } } else { log.info( "Revoking Chaos Monkey READ and WRITE permissions for '{}'", updatedApplication.getName()); permissionsMap.get("READ").remove(properties.getUserRole()); permissionsMap.get("WRITE").remove(properties.getUserRole()); } return updatedApplication; }</code><technical_language>exit early if permissionsMap is empty, serialize empty permissions {}</technical_language>

Target:
public Application call(Application originalApplication, Application updatedApplication) { boolean isChaosMonkeyEnabled = isChaosMonkeyEnabled(updatedApplication); if (isChaosMonkeyEnabled(originalApplication) == isChaosMonkeyEnabled) { return updatedApplication; } Object rawPermissions = updatedApplication.details().get("permissions"); if (!(rawPermissions instanceof Map)) { log.warn("No permissions config found on application '{}'", updatedApplication.getName()); return updatedApplication; } @SuppressWarnings("unchecked") Map<String, List<String>> permissionsMap = (Map<String, List<String>>) rawPermissions; if (permissionsMap.isEmpty()) { return updatedApplication; } if (isChaosMonkeyEnabled) { List<String> readPermissions = permissionsMap.computeIfAbsent("READ", k -> new ArrayList<>()); if (!readPermissions.contains(properties.getUserRole())) { log.info("Chaos Monkey READ permissions applied for '{}'", updatedApplication.getName()); readPermissions.add(properties.getUserRole()); } List<String> writePermissions = permissionsMap.get("WRITE"); if (!writePermissions.contains(properties.getUserRole())) { log.info("Chaos Monkey WRITE permissions applied for '{}'", updatedApplication.getName()); writePermissions.add(properties.getUserRole()); } } else { log.info( "Revoking Chaos Monkey READ and WRITE permissions for '{}'", updatedApplication.getName()); permissionsMap.get("READ").remove(properties.getUserRole()); permissionsMap.get("WRITE").remove(properties.getUserRole()); } return updatedApplication; }
Source:
<code>public void sendIntervalsImmediately() { NetworkUtils.setConnectionTimeout(2000); NetworkUtils.cancelTransferAfter(2000); task.run(); <START> NetworkUtils.setConnectionTimeout(12000); <END> }</code><technical_language>reuse NetworkUtils.connectionTimeout</technical_language>

Target:
public void sendIntervalsImmediately() { NetworkUtils.setConnectionTimeout(2000); NetworkUtils.cancelTransferAfter(2000); task.run(); NetworkUtils.setConnectionTimeout(NetworkUtils.DEFAULT_TIMEOUT); }
Source:
<code>public void setBrowserInput(final Viewpoint viewpoint, final RepresentationDescription representationDescription) { if (browser != null && representationDescription != null && viewpoint != null) { String userDocumentation; if <START> (representationDescription.getEndUserDocumentation() != null && <END> !StringUtil.isEmpty(representationDescription.getEndUserDocumentation())) { userDocumentation = representationDescription.getEndUserDocumentation(); } else { userDocumentation = viewpoint.getEndUserDocumentation(); } String content = null; if (containsHTMLDocumentation(userDocumentation)) { content = getContentWhenHtml(userDocumentation, representationDescription.eResource().getURI()); } else { content = getContentWhenNoHtml(userDocumentation); } browser.setText(content); } else if (browser != null) { browser.setText("<br><br><center><b>" + Messages.ViewpointsSelectionWizardPage_documentation_title + "</b></center>"); } }</code><technical_language>StringUtil.isEmpty() checks for null, point of remark. If a more verbose wrapper String.isEmpty() useful..</technical_language>

Target:
public void setBrowserInput(final Viewpoint viewpoint, final RepresentationDescription representationDescription) { if (browser != null && representationDescription != null && viewpoint != null) { String userDocumentation; if (!StringUtil.isEmpty(representationDescription.getEndUserDocumentation())) { userDocumentation = representationDescription.getEndUserDocumentation(); } else { userDocumentation = viewpoint.getEndUserDocumentation(); } String content = null; if (containsHTMLDocumentation(userDocumentation)) { content = getContentWhenHtml(userDocumentation, representationDescription.eResource().getURI()); } else { content = getContentWhenNoHtml(userDocumentation); } browser.setText(content); } else if (browser != null) { browser.setText("<br><br><center><b>" + Messages.ViewpointsSelectionWizardPage_documentation_title + "</b></center>"); } }
Source:
<code>public void close() throws Exception { Exception exception = null; for ( AutoCloseable closeable : closeables ) { try { closeable.close(); } catch ( Exception e ) { if ( exception == null ) { exception = e; } if ( exception != e ) { exception = Exceptions.combine( exception, e ); } } } if ( exception != null ) { throw exception; <START> } <END> }</code><technical_language>IOUtils.close</technical_language>

Target:
public void close() { IOUtils.closeAll( RuntimeException.class, closeables.toArray( new AutoCloseable[closeables.size()] ) ); }
Source:
<code>public void readData(ObjectDataInput in) throws IOException { type = PermissionType.getType(in.readUTF()); name = in.readUTF(); principal = in.readUTF(); int endpointsSize = in.readInt(); if (endpointsSize != 0) { <START> Set<String> endpoints = new HashSet<>(); <END> for (int i = 0; i < endpointsSize; i++) { endpoints.add(in.readUTF()); } this.endpoints = endpoints; } int actionsSize = in.readInt(); if (actionsSize != 0) { Set<String> actions = new HashSet<>(); for (int i = 0; i < actionsSize; i++) { actions.add(in.readUTF()); } this.actions = actions; } }</code><technical_language>Minor: SetUtil.createHashSet() avoid rehashing</technical_language>

Target:
public void readData(ObjectDataInput in) throws IOException { type = PermissionType.getType(in.readUTF()); name = in.readUTF(); principal = in.readUTF(); int endpointsSize = in.readInt(); if (endpointsSize != 0) { Set<String> endpoints = createHashSet(endpointsSize); for (int i = 0; i < endpointsSize; i++) { endpoints.add(in.readUTF()); } this.endpoints = endpoints; } int actionsSize = in.readInt(); if (actionsSize != 0) { Set<String> actions = createHashSet(actionsSize); for (int i = 0; i < actionsSize; i++) { actions.add(in.readUTF()); } this.actions = actions; } }
Source:
<code>public static Configuration grabConfig(String content) { try { content = content.replaceAll("(?i)(?m)^[ \t]*includeConfig.*", ""); final Path nextflowDir = Files.createTempDirectory("nextflow"); final Path tempFile = Paths.get(nextflowDir.toString(), "nextflow.config"); Files.write(tempFile, content.getBytes(StandardCharsets.UTF_8)); final Configuration configuration = grabConfig(tempFile.toFile()); Files.deleteIfExists(tempFile); <START> Files.deleteIfExists(nextflowDir); <END> return configuration; } catch (IOException e) { throw new NextflowParsingException("unable to parse nexflow config"); } }</code><technical_language>If Files.write() throws IOException, this cleanup execute</technical_language>

Target:
public static Configuration grabConfig(String content) { Path nextflowDir = null; try { String newContent = content.replaceAll("(?i)(?m)^[ \t]*includeConfig.*", ""); nextflowDir = Files.createTempDirectory("nextflow"); final Path tempFile = Paths.get(nextflowDir.toString(), "nextflow.config"); Files.write(tempFile, newContent.getBytes(StandardCharsets.UTF_8)); return grabConfig(tempFile.toFile()); } catch (IOException e) { throw new NextflowParsingException("unable to parse nexflow config"); } finally { if (nextflowDir != null) { FileUtils.deleteQuietly(nextflowDir.toFile()); } } }
Source:
<code>private FeedbackResponseCommentAttributes getCommentFromDatastore(String jsonId, DataBundle bundle) { FeedbackResponseCommentAttributes comment = bundle.feedbackResponseComments.get(jsonId); String questionId = null; try { int qnNumber = Integer.parseInt(comment.feedbackQuestionId); questionId = fqLogic.getFeedbackQuestion( comment.feedbackSessionName, comment.courseId, qnNumber).getId(); } catch (NumberFormatException e) { <START> questionId = comment.feedbackQuestionId; <END> } comment.feedbackResponseId.replaceFirst(comment.feedbackQuestionId, questionId); return frcLogic.getFeedbackResponseComment(comment.feedbackResponseId, comment.commentGiver, comment.createdAt); }</code><technical_language>this assertion fail</technical_language>

Target:
private FeedbackResponseCommentAttributes getCommentFromDatastore(String jsonId, DataBundle bundle) { FeedbackResponseCommentAttributes comment = bundle.feedbackResponseComments.get(jsonId); return frcLogic.getFeedbackResponseComment(comment.feedbackResponseId, comment.commentGiver, comment.createdAt); }
Source:
<code>public void testExecuteAsyncNullTable() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(null); groupRequest.setNesting(Arrays.asList("os", "device", "version")); <START> queryExecutor.executeAsync(groupRequest); <END> }</code><technical_language>Check for equality of error code</technical_language>

Target:
public void testExecuteAsyncNullTable() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(null); groupRequest.setNesting(Arrays.asList("os", "device", "version")); try { queryExecutor.executeAsync(groupRequest); } catch (QueryStoreException e) { assertEquals(QueryStoreException.ErrorCode.INVALID_REQUEST, e.getErrorCode()); throw e; } }
Source:
<code>protected HttpConnection httpOpen(String method, URL u, AcceptEncoding acceptEncoding) throws IOException { if (method == null || u == null || acceptEncoding == null) { throw new NullPointerException(); } final Proxy proxy = HttpSupport.proxyFor(proxySelector, u); HttpConnection conn = connectionFactory.create(u, proxy); if (!sslVerify && "https".equals(u.getProtocol())) { HttpSupport.disableSslVerify(conn); } conn.setInstanceFollowRedirects(false); conn.setRequestMethod(method); conn.setUseCaches(false); if (acceptEncoding == AcceptEncoding.GZIP) { conn.setRequestProperty(HDR_ACCEPT_ENCODING, ENCODING_GZIP); } conn.setRequestProperty(HDR_PRAGMA, "no-cache"); if (UserAgent.get() != null) { conn.setRequestProperty(HDR_USER_AGENT, UserAgent.get()); } int timeOut = getTimeout(); if (timeOut != -1) { int effTimeOut = timeOut * 1000; conn.setConnectTimeout(effTimeOut); conn.setReadTimeout(effTimeOut); } StringBuilder cookieHeaderValue = new StringBuilder(); for (HttpCookie cookie : relevantCookies) { if (!cookie.hasExpired()) { if (cookieHeaderValue.length() > 0) { <START> cookieHeaderValue.append(";"); END> } cookieHeaderValue.append(cookie.toString()); } } if (cookieHeaderValue.length() >= 0) { conn.setRequestProperty(HDR_COOKIE, cookieHeaderValue.toString()); } if (this.headers != null && !this.headers.isEmpty()) { for (Map.Entry<String, String> entry : this.headers.entrySet()) conn.setRequestProperty(entry.getKey(), entry.getValue()); } authMethod.configureRequest(conn); return conn; }</code><technical_language>append(';'); avoids need for NON-NLS</technical_language>

Target:
protected HttpConnection httpOpen(String method, URL u, AcceptEncoding acceptEncoding) throws IOException { if (method == null || u == null || acceptEncoding == null) { throw new NullPointerException(); } final Proxy proxy = HttpSupport.proxyFor(proxySelector, u); HttpConnection conn = connectionFactory.create(u, proxy); if (!sslVerify && "https".equals(u.getProtocol())) { HttpSupport.disableSslVerify(conn); } conn.setInstanceFollowRedirects(false); conn.setRequestMethod(method); conn.setUseCaches(false); if (acceptEncoding == AcceptEncoding.GZIP) { conn.setRequestProperty(HDR_ACCEPT_ENCODING, ENCODING_GZIP); } conn.setRequestProperty(HDR_PRAGMA, "no-cache"); if (UserAgent.get() != null) { conn.setRequestProperty(HDR_USER_AGENT, UserAgent.get()); } int timeOut = getTimeout(); if (timeOut != -1) { int effTimeOut = timeOut * 1000; conn.setConnectTimeout(effTimeOut); conn.setReadTimeout(effTimeOut); } StringBuilder cookieHeaderValue = new StringBuilder(); for (HttpCookie cookie : relevantCookies) { if (!cookie.hasExpired()) { if (cookieHeaderValue.length() > 0) { cookieHeaderValue.append(';'); } cookieHeaderValue.append(cookie.toString()); } } if (cookieHeaderValue.length() >= 0) { conn.setRequestProperty(HDR_COOKIE, cookieHeaderValue.toString()); } if (this.headers != null && !this.headers.isEmpty()) { for (Map.Entry<String, String> entry : this.headers.entrySet()) conn.setRequestProperty(entry.getKey(), entry.getValue()); } authMethod.configureRequest(conn); return conn; }
Source:
<code><START> public void createOrUpdateCounter(Class<?> clazz, String key, String metricName, long value) { <END> Map<String, Metric> metricMap = getMetricsForKey(key); if (!metricMap.containsKey(metricName)) { Counter counter = _metricRegistry.counter(MetricRegistry.name(clazz, key, metricName)); counter.inc(value); metricMap.put(metricName, counter); } else { Metric metric = metricMap.get(metricName); if (metric instanceof Counter) { ((Counter) metric).inc(value); } } }</code><technical_language>This needs synchronized</technical_language>

Target:
public synchronized void createOrUpdateCounter(Class<?> clazz, String key, String metricName, long value) { validateArguments(clazz, key, metricName); String fullMetricName = MetricRegistry.name(clazz, key, metricName); Counter counter = _metricRegistry.getCounters().get(fullMetricName); if (counter == null) { counter = _metricRegistry.counter(fullMetricName); } counter.inc(value); }
Source:
<code>public static void readPlayerNames() { final File folder = new File(State.getDefaultSaveDir()); <START> for (final File file : folder.listFiles()) { <END> if (file.isDirectory()) { continue; } final String fileName = removeExtension(file.getName()); State.getSaveGames().add(fileName); } }</code><technical_language>Findbugs this statment, trigger a nullpointer. I quote: "Possible null pointer dereference in nl.tudelft.ti2206.group9.util.SaveGame.readPlayerNames() due return of called method". check for null. <review,bug</technical_language>

Target:
public static void readPlayerNames() { try { final File folder = new File(State.getDefaultSaveDir()); for (final File file : folder.listFiles()) { if (file.isDirectory()) { continue; } final String fileName = removeExtension(file.getName()); State.getSaveGames().add(fileName); } } catch (NullPointerException e) { OBSERVABLE.notify(GameObserver.Category.ERROR, GameObserver.Error.NULLPOINTEREXCEPTION, "SaveGame.readPlayerNames()", e.getMessage()); } }
Source:
<code>public void testListDeploymentEmpty() throws Exception { final DeploymentApi deploymentApi = api.getDeploymentApi(resourceGroup); server.enqueue(new MockResponse().setResponseCode(404)); List<Deployment> deployments = deploymentApi.list(); <START> assertTrue(deployments.size() == 0); <END> }</code><technical_language>Verify recorded request</technical_language>

Target:
public void testListDeploymentEmpty() throws Exception { final DeploymentApi deploymentApi = api.getDeploymentApi(resourceGroup); server.enqueue(new MockResponse().setResponseCode(404)); List<Deployment> deployments = deploymentApi.list(); assertTrue(deployments.size() == 0); assertSent(server, "GET", "/subscriptions/" + subscriptionId + "/resourcegroups/" + resourceGroup + "/providers/microsoft.resources/deployments?api-version=2016-02-01"); }
Source:
<code>private void preRenderUpdate(RenderingStage renderingStage) { resetStats(); currentRenderingStage = renderingStage; if (currentRenderingStage == RenderingStage.MONO || currentRenderingStage == RenderingStage.LEFT_EYE) { isFirstRenderingStageForCurrentFrame = true; } else { isFirstRenderingStageForCurrentFrame = false; } if (isFirstRenderingStageForCurrentFrame) { timeSmoothedMainLightIntensity = TeraMath.lerp(timeSmoothedMainLightIntensity, getMainLightIntensityAt(playerCamera.getPosition()), secondsSinceLastFrame); playerCamera.update(secondsSinceLastFrame); renderableWorld.update(); renderableWorld.generateVBOs(); secondsSinceLastFrame = 0; displayResolutionDependentFBOs.update(); millisecondsSinceRenderingStart += secondsSinceLastFrame * 1000; } if (currentRenderingStage != RenderingStage.MONO) { playerCamera.updateFrustum(); } renderableWorld.queueVisibleChunks(isFirstRenderingStageForCurrentFrame); if (requestedTaskListRefresh) { <START> List<Node> orderedNodes = renderGraph.getNodesInTopologicalOrder(); <END> renderTaskListGenerator.generateFrom(orderedNodes); requestedTaskListRefresh = false; } }</code><technical_language>I noticed change enabling/disabling of conditional nodes. explanation is clear me. please rephrase in a new explanation</technical_language>

Target:
private void preRenderUpdate(RenderingStage renderingStage) { resetStats(); currentRenderingStage = renderingStage; if (currentRenderingStage == RenderingStage.MONO || currentRenderingStage == RenderingStage.LEFT_EYE) { isFirstRenderingStageForCurrentFrame = true; } else { isFirstRenderingStageForCurrentFrame = false; } if (isFirstRenderingStageForCurrentFrame) { timeSmoothedMainLightIntensity = TeraMath.lerp(timeSmoothedMainLightIntensity, getMainLightIntensityAt(playerCamera.getPosition()), secondsSinceLastFrame); playerCamera.update(secondsSinceLastFrame); renderableWorld.update(); renderableWorld.generateVBOs(); secondsSinceLastFrame = 0; displayResolutionDependentFBOs.update(); millisecondsSinceRenderingStart += secondsSinceLastFrame * 1000; } if (currentRenderingStage != RenderingStage.MONO) { playerCamera.updateFrustum(); } renderableWorld.queueVisibleChunks(isFirstRenderingStageForCurrentFrame); if (requestedTaskListRefresh) { List<Node> orderedNodes = renderGraph.getNodesInTopologicalOrder(); renderPipelineTaskList = renderTaskListGenerator.generateFrom(orderedNodes); requestedTaskListRefresh = false; } }
Source:
<code><START> public boolean isOpen() { <END> return fileChannel.isOpen(); }</code><technical_language>I guess idea Counters is critical path, object is monitored offer information instead of pulled Counter. I guess this dangerous other around: if counter fetches size of channel block actual workflow (so a monitoring UI effectively block dataflow). In this change I pattern counter pulls isOpen information filechannel. In this case isOpen block in future this assumption fail</technical_language>

Target:
public boolean isOpen() { return open; }
Source:
<code>public void onMessage(MessageHolderWithTokens message) { try { <START> logger.debug("receiving tokens from queue, triggering Notification Dispatcher class to pick the right sender"); <END> dequeueEvent.fire(message); } catch (DispatchInitiationException e) { throw e; } catch (Exception e) { logger.error("NotificationDispatcher or PushNotificationSender unexpectedly failed, the message won't be redelivered", e); } }</code><technical_language>Do want move this trace debug</technical_language>

Target:
public void onMessage(MessageHolderWithTokens message) { try { logger.trace("receiving tokens from queue, triggering Notification Dispatcher class to pick the right sender"); dequeueEvent.fire(message); } catch (DispatchInitiationException e) { throw e; } catch (Exception e) { logger.error("NotificationDispatcher or PushNotificationSender unexpectedly failed, the message won't be redelivered", e); } }
Source:
<code>public Object fromBytes(byte[] bytes) throws ConversionException { if (bytes == null || bytes.length == 0) { return null; } try { JsonNode root = unmarshallingMapper.readTree(bytes); String typeName = root.fieldNames().next(); JsonNode value = root.get(typeName); if (value.isArray()) { String className = value.get(0).asText(); <START> return mapper.treeToValue(value,Class.forName(className)); <END> } if (typeName.equals("String")) { return value.asText(); } else if (typeName.equals("Long")) { return value.asLong(); } else if (typeName.equals("Integer")) { return value.asInt(); } else if (typeName.equals("BigDecimal")) { return value.decimalValue(); } else if (typeName.equals("Double")) { return value.doubleValue(); } else if (typeName.equals("Float")) { return value.doubleValue(); } else if (typeName.equals("Boolean")) { return value.asBoolean(); } else if (typeName.equals("byte[]")) { return value.binaryValue(); } else if (typeName.equals("char[]")) { return value.asText().toCharArray(); } else if (typeName.equals("DateTime")) { return new DateTime(value.get("millis").asLong()); } else if (typeName.equals("DefaultTuple")) { return jsonBytesToTupleConverter.convert(value.binaryValue()); } String className = value.get("@class") == null ? null : value.get("@class").asText(); if (className != null) { return mapper.treeToValue(value, Class.forName(className)); } return jsonBytesToTupleConverter.convert(bytes); } catch (Exception e) { throw new SmartJsonConversionException(e.getMessage(), e); } }</code><technical_language>this class implement BeanClassLoaderAware instead of direct Class.forName(..) call</technical_language>

Target:
public Object fromBytes(byte[] bytes) throws ConversionException { if (bytes == null || bytes.length == 0) { return null; } try { JsonNode root = unmarshallingMapper.readTree(bytes); String typeName = root.fieldNames().next(); JsonNode value = root.get(typeName); if (value.isArray()) { String className = value.get(0).asText(); return mapper.treeToValue(value, this.beanClassLoader.loadClass(className)); } if (typeName.equals("String")) { return value.asText(); } else if (typeName.equals("Long")) { return value.asLong(); } else if (typeName.equals("Integer")) { return value.asInt(); } else if (typeName.equals("BigDecimal")) { return value.decimalValue(); } else if (typeName.equals("Double")) { return value.doubleValue(); } else if (typeName.equals("Float")) { return value.doubleValue(); } else if (typeName.equals("Boolean")) { return value.asBoolean(); } else if (typeName.equals("byte[]")) { return value.binaryValue(); } else if (typeName.equals("char[]")) { return value.asText().toCharArray(); } else if (typeName.equals("DateTime")) { return new DateTime(value.get("millis").asLong()); } else if (typeName.equals("DefaultTuple")) { return jsonBytesToTupleConverter.convert(value.binaryValue()); } String className = value.get("@class") == null ? null : value.get("@class").asText(); if (className != null) { return mapper.treeToValue(value, Class.forName(className)); } return jsonBytesToTupleConverter.convert(bytes); } catch (Exception e) { throw new SmartJsonConversionException(e.getMessage(), e); } }
Source:
<code>public void asyncGetCube(int cubeX, int cubeY, int cubeZ, @Nonnull Requirement req, @Nonnull Consumer<Cube> callback) { Cube cube = getLoadedCube(cubeX, cubeY, cubeZ); if (req == Requirement.LOAD_CACHED || (cube != null && req.compareTo(Requirement.GENERATE) <= 0)) { callback.accept(cube); return; } if (cube == null) { AsyncWorldIOExecutor.queueCubeLoad(worldServer, cubeIO, this, cubeX, cubeY, cubeZ, loaded -> { <START> Column col = getLoadedChunk(cubeX, cubeZ); <END> onCubeLoaded(loaded, col); loaded = postCubeLoadAttempt(cubeX, cubeY, cubeZ, loaded, col, req); callback.accept(loaded); }); } }</code><technical_language>This null - relying calling this loading column</technical_language>

Target:
public void asyncGetCube(int cubeX, int cubeY, int cubeZ, @Nonnull Requirement req, @Nonnull Consumer<Cube> callback) { Cube cube = getLoadedCube(cubeX, cubeY, cubeZ); if (req == Requirement.LOAD_CACHED || (cube != null && req.compareTo(Requirement.GENERATE) <= 0)) { callback.accept(cube); return; } if (cube == null) { AsyncWorldIOExecutor.queueCubeLoad(worldServer, cubeIO, this, cubeX, cubeY, cubeZ, loaded -> { Column col = getLoadedChunk(cubeX, cubeZ); if(col != null) { onCubeLoaded(loaded, col); } loaded = postCubeLoadAttempt(cubeX, cubeY, cubeZ, loaded, col, req); callback.accept(loaded); }); } }
Source:
<code>public void getDiffStatistics() { statistics.setFileNumDiff(records.size()); for (Map.Entry<String, List<CheckstyleRecord>> entry : records.entrySet()) { final List<CheckstyleRecord> list = entry.getValue(); for (CheckstyleRecord rec : list) { <START> if (rec.getIndex() == CheckstyleReportsParser.BASE_REPORT_INDEX) { <END> statistics.addSeverityRecordRemoved(rec.getSeverity()); statistics.addModuleRecordRemoved(rec.getSource()); } else if (rec.getIndex() == CheckstyleReportsParser.PATCH_REPORT_INDEX) { statistics.addSeverityRecordAdded(rec.getSeverity()); statistics.addModuleRecordAdded(rec.getSource()); } else { throw new AssertionError(); } statistics.incrementUniqueMessageCount(rec.getIndex()); } } }</code><technical_language>I remove add records inline here. this new logic in Statistics class</technical_language>

Target:
public void getDiffStatistics() { statistics.setFileNumDiff(records.size()); for (Map.Entry<String, List<CheckstyleRecord>> entry : records.entrySet()) { final List<CheckstyleRecord> list = entry.getValue(); for (CheckstyleRecord rec : list) { if (rec.getIndex() == CheckstyleReportsParser.BASE_REPORT_INDEX) { statistics.addSeverityRecordRemoved(rec.getSeverity()); statistics.addModuleRecordRemoved(rec.getSource()); } else { statistics.addSeverityRecordAdded(rec.getSeverity()); statistics.addModuleRecordAdded(rec.getSource()); } statistics.incrementUniqueMessageCount(rec.getIndex()); } } }
Source:
<code>public static ClientSettings getClientSettingsFromConnectionStringBuilder(ConnectionStringBuilder builder) { TokenProvider tokenProvider = null; if (builder.getAuthentication() != null) { <START> if (builder.getAuthentication().replace(" ", "").equalsIgnoreCase(ConnectionStringBuilder.MANAGED_IDENTITY_AUTHENTICATION.replace(" ", ""))) { <END> tokenProvider = new ManagedIdentityTokenProvider(); } } else if (builder.getSharedAccessSignatureToken() == null) { tokenProvider = new SharedAccessSignatureTokenProvider(builder.getSasKeyName(), builder.getSasKey(), SecurityConstants.DEFAULT_SAS_TOKEN_VALIDITY_IN_SECONDS); } else { tokenProvider = new SharedAccessSignatureTokenProvider(builder.getSharedAccessSignatureToken(), Instant.MAX); } return new ClientSettings(tokenProvider, builder.getRetryPolicy(), builder.getOperationTimeout(), builder.getTransportType()); }</code><technical_language>.replace(" ", "") [](start = 133, length = 17) do need this? a constant defined in code. remove spaces? remove spaces, if any, declared constant value</technical_language>

Target:
public static ClientSettings getClientSettingsFromConnectionStringBuilder(ConnectionStringBuilder builder) { TokenProvider tokenProvider = null; String authentication = builder.getAuthentication(); if (authentication != null) { if (authentication.equalsIgnoreCase(ConnectionStringBuilder.MANAGED_IDENTITY_AUTHENTICATION_WITH_SPACE) || authentication.equalsIgnoreCase(ConnectionStringBuilder.MANAGED_IDENTITY_AUTHENTICATION_WITHOUT_SPACE)) { tokenProvider = new ManagedIdentityTokenProvider(); } } else if (builder.getSharedAccessSignatureToken() == null) { tokenProvider = new SharedAccessSignatureTokenProvider(builder.getSasKeyName(), builder.getSasKey(), SecurityConstants.DEFAULT_SAS_TOKEN_VALIDITY_IN_SECONDS); } else { tokenProvider = new SharedAccessSignatureTokenProvider(builder.getSharedAccessSignatureToken(), Instant.MAX); } return new ClientSettings(tokenProvider, builder.getRetryPolicy(), builder.getOperationTimeout(), builder.getTransportType()); }
Source:
<code>public void install() { List<String> urls = resolver.getTargets(); String saveAs = resolver.getFilename(); String osMajorVersion = getMachine().getOsDetails().getVersion(); <START> osMajorVersion = osMajorVersion.indexOf(".") > 0 ? osMajorVersion.substring(0, osMajorVersion.indexOf('.')) : osMajorVersion; <END> String epelVersion = Strings.nullToEmpty(CENTOS_VERSION_TO_EPEL_VERSION.get(osMajorVersion)); String osArchitecture = getMachine().getOsDetails().getArch(); List<String> commands = ImmutableList.<String>builder() .add(chainGroup("which yum", sudo("yum -y update ca-certificates"), sudo("rpm -Uvh " + format("<LINK_4>", osMajorVersion, osArchitecture, epelVersion)))) .add(ifExecutableElse0("zypper", chainGroup( ok(sudo("zypper --non-interactive addrepo <LINK_2> erlang_sles_11")), ok(sudo("zypper --non-interactive addrepo <LINK_0> erlang_suse_11")), ok(sudo("zypper --non-interactive addrepo <LINK_1> erlang_suse_12")), ok(sudo("zypper --non-interactive addrepo <LINK_3> erlang_suse_13"))))) .add(installPackage( ImmutableMap.of( "apt", "erlang-nox erlang-dev", "port", "erlang@"+getErlangVersion()+"+ssl"), "erlang")) .addAll(commandsToDownloadUrlsAs(urls, saveAs)) .add(installExecutable("tar")) .add(format("tar xvzf %s",saveAs)) .build(); newScript(INSTALLING). failOnNonZeroResultCode(). body.append(commands).execute(); }</code><technical_language>osMajorVersion osArchitecture annotated @Nullable a chance of NullPointerExceptions here</technical_language>

Target:
public void install() { List<String> urls = resolver.getTargets(); String saveAs = resolver.getFilename(); String osMajorVersion = getMachine().getOsDetails().getVersion(); if (Strings.isNullOrEmpty(osMajorVersion)) { osMajorVersion = "7"; } else { osMajorVersion = osMajorVersion.indexOf(".") > 0 ? osMajorVersion.substring(0, osMajorVersion.indexOf('.')) : osMajorVersion; if (!CENTOS_VERSION_TO_EPEL_VERSION.keySet().contains(osMajorVersion)) { osMajorVersion = "7"; } } String epelVersion = CENTOS_VERSION_TO_EPEL_VERSION.get(osMajorVersion); String osArchitecture = getMachine().getOsDetails().getArch(); if (Strings.isNullOrEmpty(osArchitecture)) { osArchitecture = "x86_64"; } List<String> commands = ImmutableList.<String>builder() .add(chainGroup("which yum", sudo("yum -y update ca-certificates"), sudo("rpm -Uvh " + format("<LINK_4>", osMajorVersion, osArchitecture, epelVersion)))) .add(ifExecutableElse0("zypper", chainGroup( ok(sudo("zypper --non-interactive addrepo <LINK_2> erlang_sles_11")), ok(sudo("zypper --non-interactive addrepo <LINK_0> erlang_suse_11")), ok(sudo("zypper --non-interactive addrepo <LINK_1> erlang_suse_12")), ok(sudo("zypper --non-interactive addrepo <LINK_3> erlang_suse_13"))))) .add(installPackage( ImmutableMap.of( "apt", "erlang-nox erlang-dev", "port", "erlang@"+getErlangVersion()+"+ssl"), "erlang")) .addAll(commandsToDownloadUrlsAs(urls, saveAs)) .add(installExecutable("tar")) .add(format("tar xvzf %s",saveAs)) .build(); newScript(INSTALLING). failOnNonZeroResultCode(). body.append(commands).execute(); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; <START> } else if (o instanceof String) { <END> return o != null && o.equals(name); } else if (o instanceof OperationStats) { OperationStats that = (OperationStats) o; return name != null ? name.equals(that.name) : that.name == null; } else { return false; } }</code><technical_language>This comparison is problematic if objects in some collection: heavily depend equals method a String OperationStats instance exchanged - leading potential ClassCastException runtime. mention earlier, I add a dedicated method compare name, equalsName(String name)</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } OperationStats stats = (OperationStats) o; return name != null ? name.equals(stats.name) : stats.name == null; }
Source:
<code>public void testIdManyPrices() { ProductItemPrice price1 = ProductItemPrice.builder().id(1234).build(); ProductItemPrice price2 = ProductItemPrice.builder().id(5678).build(); ProductItem item = ProductItem.builder().id(1234).prices(ImmutableSet.of(price1,price2)).build(); <START> assertEquals("Expected the ID of the ProductItemPrice to be returned", "1234",imageId().apply(item)); <END> }</code><technical_language>Message last. Also, space comma</technical_language>

Target:
public void testIdManyPrices() { ProductItemPrice price1 = ProductItemPrice.builder().id(1234).build(); ProductItemPrice price2 = ProductItemPrice.builder().id(5678).build(); ProductItem item = ProductItem.builder().id(9012).prices(ImmutableSet.of(price1,price2)).build(); assertEquals(imageId().apply(item), "1234", "Expected the ID of the ProductItemPrice to be returned"); }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); stopPlayingTracks(); if (id == R.id.action_edit_project) { startEditActionMode(); return true; } if (id == R.id.action_delete_project) { startDeleteActionMode(); return true; } if (id == R.id.action_import_project) { ioHandler = new ImportProjectHandler(this); ioHandler.onSend(null); return true; } if (id == R.id.action_share_project) { startShareActionMode(); return true; } if (id == R.id.action_about) { DialogFragment newFragment = AboutDialog.newInstance(R.string.app_name); newFragment.show(getFragmentManager(), "dialog"); <START> return true; <END> } return super.onOptionsItemSelected(item); }</code><technical_language>do a static newInstance Method? do f.e. this: AboutDialog aboutDialog = new AboutDialog(); aboutDialog.show(getFragmentManager(), "dialog");</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); stopPlayingTracks(); if (id == R.id.action_edit_project) { startEditActionMode(); return true; } if (id == R.id.action_delete_project) { startDeleteActionMode(); return true; } if (id == R.id.action_import_project) { ioHandler = new ImportProjectHandler(this); ioHandler.onSend(null); return true; } if (id == R.id.action_share_project) { startShareActionMode(); return true; } if (id == R.id.action_about) { AboutDialog aboutDialog = new AboutDialog(); aboutDialog.show(getFragmentManager(), "dialog"); return true; } return super.onOptionsItemSelected(item); }
Source:
<code><START> Configuration(Configuration defaults) <END> { this(); setDefaults(defaults); }</code><technical_language>remove public</technical_language>

Target:
public Configuration(Configuration defaults) { this(); setDefaults( defaults ); }
Source:
<code>protected boolean isImporterAvailable(FileImporter importer, String normalizedMimeType, String mimeType, boolean excludeOneToMany) { <START> return importer.isEnabled() && (!excludeOneToMany || !importer.isOneToMany()) <END> && (importer.matches(normalizedMimeType) || importer.matches(mimeType)); }</code><technical_language>Personally I read this && !(importer.isOneToMany() && excludeOneToMany) you</technical_language>

Target:
protected boolean isImporterAvailable(FileImporter importer, String normalizedMimeType, String mimeType, boolean excludeOneToMany) { return importer.isEnabled() && !(importer.isOneToMany() && excludeOneToMany) && (importer.matches(normalizedMimeType) || importer.matches(mimeType)); }
Source:
<code>public String formatScreenShotPath(Driver driver) { if (!driver.config().screenshots()) { log.debug("Automatic screenshots are disabled."); return ""; } String screenshot = takeScreenShot(driver); if (screenshot == null) { return ""; } if (driver.config().reportsUrl() != null) { Path current = Paths.get(System.getProperty("user.dir")); Path target = Paths.get(screenshot).normalize(); String screenshotUrl; if (isInsideFolder(current, target)) { Path relativePath = current.relativize(target); screenshotUrl = driver.config().reportsUrl() + relativePath.toString().replace('\\', '/'); } else { String name = target.toFile().getName(); screenshotUrl = driver.config().reportsUrl() + name; } <START> screenshotUrl = normalizeURL(screenshotUrl); <END> log.debug("Replaced screenshot file path '{}' by public CI URL '{}'", screenshot, screenshotUrl); return screenshotUrl; } log.debug("reportsUrl is not configured. Returning screenshot file name '{}'", screenshot); try { return new File(screenshot).toURI().toURL().toExternalForm(); } catch (MalformedURLException e) { return "file://" + screenshot; } }</code><technical_language>this removed all? problem is URL is combined string, is normalized. create URL proper APIs in place? For instance, screenshotUrl = new URL(.., driver.config().reportsUrl(), ..., name, ...) on</technical_language>

Target:
public String formatScreenShotPath(Driver driver) { if (!driver.config().screenshots()) { log.debug("Automatic screenshots are disabled."); return ""; } String screenshot = takeScreenShot(driver); if (screenshot == null) { return ""; } if (driver.config().reportsUrl() != null) { String screenShotURL = formatScreenShotURL(driver.config().reportsUrl(), screenshot); log.info("Replaced screenshot file path '{}' by public CI URL '{}'", screenshot, screenShotURL); return screenShotURL; } log.debug("reportsUrl is not configured. Returning screenshot file name '{}'", screenshot); try { return new File(screenshot).toURI().toURL().toExternalForm(); } catch (MalformedURLException e) { return "file://" + screenshot; } }
Source:
<code>public String getMode() { if (!isEnabled()) { return DISABLED_MODE; } <START> if (active || (TabbingManager.focusedWidget != null && TabbingManager.focusedWidget.equals(this))) { <END> return ACTIVE_MODE; } else if (tickerListener.isMouseOver()) { return HOVER_MODE; } return DEFAULT_MODE; }</code><technical_language>If do this.equals(TabbingManager.focusedWidget) need bulky null check here, equals returns false for null</technical_language>

Target:
public String getMode() { if (!isEnabled()) { return DISABLED_MODE; } if (active || this.equals(TabbingManager.focusedWidget)) { return ACTIVE_MODE; } else if (tickerListener.isMouseOver()) { return HOVER_MODE; } return DEFAULT_MODE; }
Source:
<code>public <T> Set<T> getStores(Class<T> storeClass) { storesMutex.readLock().lock(); try { Set<T> result = new HashSet<T>(); for (CacheLoader l : loaders) { CacheLoader real = undelegate(l); if (storeClass.isInstance(real)) { result.add((T) real); } } <START> getWritersStream().forEach(w -> { <END> CacheWriter real = undelegate(w); if (storeClass.isInstance(real)) result.add((T) real); }); return result; } finally { storesMutex.readLock().unlock(); } }</code><technical_language>avoid creating some extra stream instances a forEachWriter method calls writers.forEach() txWriters.forEach()</technical_language>

Target:
public <T> Set<T> getStores(Class<T> storeClass) { storesMutex.readLock().lock(); try { Set<T> result = new HashSet<T>(); for (CacheLoader l : loaders) { CacheLoader real = undelegate(l); if (storeClass.isInstance(real)) { result.add((T) real); } } Consumer<CacheWriter> getWriters = writer -> { CacheWriter real = undelegate(writer); if (storeClass.isInstance(real)) result.add((T) real); }; nonTxWriters.forEach(getWriters); txWriters.forEach(getWriters); return result; } finally { storesMutex.readLock().unlock(); } }