auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void executePerformWithNoIncludeRegionsSuccess() { RestoreRedundancyRequest restoreRedundancyRequest = new RestoreRedundancyRequest(); restoreRedundancyRequest.setReassignPrimaries(true); RestoreRedundancyResultsImpl restoreRedundancyResultsImpl = new RestoreRedundancyResultsImpl(); restoreRedundancyResultsImpl.setStatusMessage(BOGUS_PASS_MESSAGE); restoreRedundancyResultsImpl.setSuccess(true); Map<String, RegionRedundancyStatus> satisfied = restoreRedundancyResultsImpl.getSatisfiedRedundancyRegionResults(); RegionRedundancyStatusImpl regionRedundancyStatusImpl = new RegionRedundancyStatusImpl(1, 1, REGION_1, RegionRedundancyStatus.RedundancyStatus.SATISFIED); satisfied.put(REGION_1, regionRedundancyStatusImpl); RestoreRedundancyPerformer spyRedundancyPerformer = Mockito.spy(restoreRedundancyPerformer); Mockito.doReturn(restoreRedundancyResultsImpl).when(spyRedundancyPerformer) .executeFunctionAndGetFunctionResult(Mockito.any(RestoreRedundancyFunction.class), <START> Mockito.any(Object.class), <END> Mockito.any( DistributedMember.class)); RestoreRedundancyResults restoreRedundancyResult = spyRedundancyPerformer .perform(internalCacheForClientAccess, restoreRedundancyRequest, false); assertThat(restoreRedundancyResult.getSuccess()).isTrue(); }</code><technical_language>import static for of Mockito methods improve readability a little</technical_language>

Target:
public void executePerformWithNoIncludeRegionsSuccess() { RestoreRedundancyRequest restoreRedundancyRequest = new RestoreRedundancyRequest(); restoreRedundancyRequest.setReassignPrimaries(true); RestoreRedundancyResultsImpl restoreRedundancyResultsImpl = new RestoreRedundancyResultsImpl(); restoreRedundancyResultsImpl.setStatusMessage(BOGUS_PASS_MESSAGE); restoreRedundancyResultsImpl.setSuccess(true); Map<String, RegionRedundancyStatus> satisfied = restoreRedundancyResultsImpl.getSatisfiedRedundancyRegionResults(); RegionRedundancyStatusImpl regionRedundancyStatusImpl = new RegionRedundancyStatusImpl(1, 1, REGION_1, RegionRedundancyStatus.RedundancyStatus.SATISFIED); satisfied.put(REGION_1, regionRedundancyStatusImpl); RestoreRedundancyPerformer spyRedundancyPerformer = spy(restoreRedundancyPerformer); doReturn(restoreRedundancyResultsImpl).when(spyRedundancyPerformer) .executeFunctionAndGetFunctionResult(any(RestoreRedundancyFunction.class), any(Object.class), any( DistributedMember.class)); RestoreRedundancyResults restoreRedundancyResult = spyRedundancyPerformer .perform(internalCacheForClientAccess, restoreRedundancyRequest, false); assertThat(restoreRedundancyResult.getSuccess()).isTrue(); }
Source:
<code>public void testEncryptionAlgorithmSSECWithNoEncryptionKey() throws Throwable { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("The value of property " + "fs.s3a.server-side-encryption-key must not be null"); <START> <END> Configuration conf = super.createConfiguration(); conf.set(Constants.SERVER_SIDE_ENCRYPTION_ALGORITHM, S3AEncryptionMethods .SSE_C.getMethod()); conf.set(Constants.SERVER_SIDE_ENCRYPTION_KEY, null); S3AContract contract = (S3AContract) createContract(conf); contract.init(); assumeEnabled(); FileSystem fileSystem = contract.getTestFileSystem(); assertNotNull("null filesystem", fileSystem); URI fsURI = fileSystem.getUri(); LOG.info("Test filesystem = implemented by {}", fsURI, fileSystem); assertEquals("wrong filesystem of " + fsURI, contract.getScheme(), fsURI.getScheme()); fileSystem.initialize(fsURI, conf); }</code><technical_language>generally moving LambdaTestUtils.intercept(), if a closure fails, intercept() print back. important for voids though, branch-2 & java7, compelling</technical_language>

Target:
public void testEncryptionAlgorithmSSECWithNoEncryptionKey() throws Throwable { assumeEnabled(); intercept(IllegalArgumentException.class, "The value of property " + Constants.SERVER_SIDE_ENCRYPTION_KEY + " must not be null", () -> { Configuration conf = super.createConfiguration(); conf.set(Constants.SERVER_SIDE_ENCRYPTION_ALGORITHM, S3AEncryptionMethods.SSE_C.getMethod()); conf.set(Constants.SERVER_SIDE_ENCRYPTION_KEY, null); S3AContract contract = (S3AContract) createContract(conf); contract.init(); FileSystem fileSystem = contract.getTestFileSystem(); assertNotNull("null filesystem", fileSystem); URI fsURI = fileSystem.getUri(); LOG.info("Test filesystem = implemented by {}", fsURI, fileSystem); assertEquals("wrong filesystem of " + fsURI, contract.getScheme(), fsURI.getScheme()); fileSystem.initialize(fsURI, conf); throw new Exception("Do not reach here"); }); }
Source:
<code>public void purgeMrrtReportTemplate_shouldDeleteReportTemplateFromDatabaseAndAlsoDeleteTemplateFileFromTheSystem() throws Exception { setUpTemporaryFolder(); MrrtReportTemplate template = new MrrtReportTemplate(); File templateFile = new File(radiologyProperties.getReportTemplateHome(), java.util.UUID.randomUUID() .toString()); templateFile.createNewFile(); template.setDcTermsTitle("sample title"); template.setDcTermsDescription("sample description"); template.setDcTermsIdentifier("identifier3"); template.setPath(templateFile.getAbsolutePath()); MrrtReportTemplate saved = mrrtReportTemplateService.saveMrrtReportTemplate(template); <START> assertNotNull(mrrtReportTemplateService.getMrrtReportTemplate(saved.getId())); <END> File savedFile = new File(saved.getPath()); assertThat(savedFile.exists(), is(true)); mrrtReportTemplateService.purgeMrrtReportTemplate(saved); assertNull(mrrtReportTemplateService.getMrrtReportTemplate(saved.getId())); assertThat(savedFile.exists(), is(false)); }</code><technical_language>dont need call mrrtReportTemplateService.getMrrtReportTemplate() here. saved.getId set</technical_language>

Target:
public void purgeMrrtReportTemplate_shouldDeleteReportTemplateFromDatabaseAndAlsoDeleteTemplateFileFromTheSystem() throws Exception { setUpTemporaryFolder(); MrrtReportTemplate template = new MrrtReportTemplate(); File templateFile = new File(radiologyProperties.getReportTemplateHome(), java.util.UUID.randomUUID() .toString()); templateFile.createNewFile(); template.setDcTermsTitle("sample title"); template.setDcTermsDescription("sample description"); template.setDcTermsIdentifier("identifier3"); template.setPath(templateFile.getAbsolutePath()); MrrtReportTemplate saved = mrrtReportTemplateService.saveMrrtReportTemplate(template); assertNotNull(saved.getId()); File savedFile = new File(saved.getPath()); assertThat(savedFile.exists(), is(true)); mrrtReportTemplateService.purgeMrrtReportTemplate(saved); assertNull(mrrtReportTemplateService.getMrrtReportTemplate(saved.getId())); assertThat(savedFile.exists(), is(false)); }
Source:
<code>private List<String> getSearchTermFieldValues(QueryResponse solrResponse) { Map<String, Suggestion> suggestions = solrResponse.getSpellCheckResponse().getSuggestionMap(); Set<String> fieldValues = suggestions.keySet(); removeResourceFieldValue(fieldValues); <START> return new ArrayList<>(fieldValues); <END> }</code><technical_language>I need perform check. If set string remove it</technical_language>

Target:
private List<String> getSearchTermFieldValues(QueryResponse solrResponse) { Set<String> fieldValues = solrResponse.getSpellCheckResponse().getSuggestionMap().keySet(); removeResourceFieldValue(fieldValues); return new ArrayList<>(fieldValues); }
Source:
<code>public static void setJavaClassPath(URL[] antClasspath) { StringBuilder buff = new StringBuilder(); File file = null; for (URL <START> element : <END> antClasspath) { try { try { URL thisURL = URIUtil.toURI(element).toURL(); file = URIUtil.toFile(FileLocator.toFileURL(thisURL).toURI()); } catch (URISyntaxException e) { file = new File(FileLocator.toFileURL(element).getPath()); AntUIPlugin.log(e); e.printStackTrace(); } } catch (IOException e) { continue; } buff.append(file.getAbsolutePath()); buff.append("; "); } org.apache.tools.ant.types.Path systemClasspath = new org.apache.tools.ant.types.Path(null, buff.substring(0, buff.length() - 2)); org.apache.tools.ant.types.Path.systemClasspath = systemClasspath; }</code><technical_language>rename url</technical_language>

Target:
public static void setJavaClassPath(URL[] antClasspath) { StringBuilder buff = new StringBuilder(); File file = null; for (URL url : antClasspath) { try { try { URL thisURL = URIUtil.toURI(url).toURL(); file = URIUtil.toFile(FileLocator.toFileURL(thisURL).toURI()); } catch (URISyntaxException e) { file = new File(FileLocator.toFileURL(url).getPath()); AntUIPlugin.log(e); e.printStackTrace(); } } catch (IOException e) { continue; } buff.append(file.getAbsolutePath()); buff.append("; "); } org.apache.tools.ant.types.Path systemClasspath = new org.apache.tools.ant.types.Path(null, buff.substring(0, buff.length() - 2)); org.apache.tools.ant.types.Path.systemClasspath = systemClasspath; }
Source:
<code>public HelixNotifier(HelixPropertyStoreConfig storeConfig) { if (storeConfig == null) { <START> throw new IllegalArgumentException("storeConfig and metricRegistry cannot be null"); <END> } long startTimeMs = System.currentTimeMillis(); logger.info("Starting a HelixNotifier"); ZkClient zkClient = new ZkClient(storeConfig.zkClientConnectString, storeConfig.zkClientSessionTimeoutMs, storeConfig.zkClientConnectionTimeoutMs, new ZNRecordSerializer()); List<String> subscribedPaths = Collections.singletonList(storeConfig.rootPath + HelixNotifier.TOPIC_PATH); HelixPropertyStore<ZNRecord> helixStore = new ZkHelixPropertyStore<>(new ZkBaseDataAccessor<>(zkClient), storeConfig.rootPath, subscribedPaths); logger.info("HelixPropertyStore started with zkClientConnectString={}, zkClientSessionTimeoutMs={}, " + "zkClientConnectionTimeoutMs={}, rootPath={}, subscribedPaths={}", storeConfig.zkClientConnectString, storeConfig.zkClientSessionTimeoutMs, storeConfig.zkClientConnectionTimeoutMs, storeConfig.rootPath, subscribedPaths); this.helixStore = helixStore; long startUpTimeInMs = System.currentTimeMillis() - startTimeMs; logger.info("HelixNotifier started, took ms", startUpTimeInMs); }</code><technical_language>minor: more metric registry</technical_language>

Target:
public HelixNotifier(HelixPropertyStoreConfig storeConfig) { if (storeConfig == null) { throw new IllegalArgumentException("storeConfig cannot be null"); } long startTimeMs = System.currentTimeMillis(); logger.info("Starting a HelixNotifier"); ZkClient zkClient = new ZkClient(storeConfig.zkClientConnectString, storeConfig.zkClientSessionTimeoutMs, storeConfig.zkClientConnectionTimeoutMs, new ZNRecordSerializer()); List<String> subscribedPaths = Collections.singletonList(storeConfig.rootPath + HelixNotifier.TOPIC_PATH); HelixPropertyStore<ZNRecord> helixStore = new ZkHelixPropertyStore<>(new ZkBaseDataAccessor<>(zkClient), storeConfig.rootPath, subscribedPaths); logger.info("HelixPropertyStore started with zkClientConnectString={}, zkClientSessionTimeoutMs={}, " + "zkClientConnectionTimeoutMs={}, rootPath={}, subscribedPaths={}", storeConfig.zkClientConnectString, storeConfig.zkClientSessionTimeoutMs, storeConfig.zkClientConnectionTimeoutMs, storeConfig.rootPath, subscribedPaths); this.helixStore = helixStore; long startUpTimeInMs = System.currentTimeMillis() - startTimeMs; logger.info("HelixNotifier started, took ms", startUpTimeInMs); }
Source:
<code>public void setup() { initVds(); initConditions(); when(vdsManager.getRefreshStatistics()).thenReturn(false); vmsMonitoring = Mockito.spy( new VmsMonitoring(vdsManager, vds) { @Override public DbFacade getDbFacade() { return dbFacade; } @Override protected void auditLog(AuditLogableBase auditLogable, AuditLogType logType) { AuditLog al = new AuditLog(); <START> al.setlog_type(logType); <END> mockAuditLogDao.save(al); } @Override protected Map[] getVmInfo(List<String> vmsToUpdate) { return vmInfo; } @Override protected List<VmDynamic> getPoweringUpVms() { return poweringUpVms; } } ); }</code><technical_language>in 13: al.setLogType(logType);</technical_language>

Target:
public void setup() { initVds(); initConditions(); when(vdsManager.getRefreshStatistics()).thenReturn(false); vmsMonitoring = Mockito.spy( new VmsMonitoring(vdsManager, vds) { @Override public DbFacade getDbFacade() { return dbFacade; } @Override protected void auditLog(AuditLogableBase auditLogable, AuditLogType logType) { AuditLog al = new AuditLog(); al.setLogType(logType); mockAuditLogDao.save(al); } @Override protected Map[] getVmInfo(List<String> vmsToUpdate) { return vmInfo; } @Override protected List<VmDynamic> getPoweringUpVms() { return poweringUpVms; } } ); }
Source:
<code>public Server getOrCreateServer(final String serverId) throws DotDataException { Server tryServer = getServer(serverId); if(tryServer==null || tryServer.getServerId() ==null) { <START> LocalTransaction.wrap(() ->{ <END> Server newServer = new Server(); newServer.setServerId(serverId); newServer.setIpAddress(ClusterFactory.getIPAdress()); String hostName = "localhost"; try { hostName = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { Logger.error(ClusterFactory.class, "Error trying to get the host name. ", e); } newServer.setName(hostName); saveServer(newServer); String port=ClusterFactory.getNextAvailablePort(newServer.getServerId(), ServerPort.CACHE_PORT); Config.setProperty(ServerPort.CACHE_PORT.getPropertyName(), port); newServer.setCachePort(Integer.parseInt(port)); port=new ESClient().getNextAvailableESPort(newServer.getServerId(), newServer.getIpAddress(), String.valueOf(newServer.getEsTransportTcpPort())); Config.setProperty(ServerPort.ES_TRANSPORT_TCP_PORT.getPropertyName(), port); newServer.setEsTransportTcpPort(Integer.parseInt(port)); port=ClusterFactory.getNextAvailablePort(newServer.getServerId(), ServerPort.ES_HTTP_PORT); Config.setProperty(ServerPort.ES_HTTP_PORT.getPropertyName(), port); newServer.setEsHttpPort(Integer.parseInt(port)); updateServer(newServer); try { writeHeartBeatToDisk(newServer.getServerId()); } catch (IOException e) { Logger.error(ClusterFactory.class, "Could not write Server ID to file system" , e); } }); } return serverFactory.getServer(serverId); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Reduce this lambda expression number of lines 28 20. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public Server getOrCreateServer(final String serverId) throws DotDataException { Server tryServer = getServer(serverId); if(tryServer==null || tryServer.getServerId() ==null) { LocalTransaction.wrap(() ->{ getServerTransaction(serverId); }); } return serverFactory.getServer(serverId); }
Source:
<code>void createTransactionAndRollbackMessagesTest(MessagingEntityType entityType) { setSender(entityType, TestUtils.USE_CASE_DEFAULT, isSessionEnabled); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); sendMessage(message).block(OPERATION_TIMEOUT); setReceiver(entityType, TestUtils.USE_CASE_DEFAULT, isSessionEnabled); AtomicReference<ServiceBusTransactionContext> transaction = new AtomicReference<>(); StepVerifier.create(receiver.createTransaction()) .assertNext(txn -> { transaction.set(txn); assertNotNull(transaction); }) .verifyComplete(); StepVerifier.create(receiver.receiveMessages() <START> .concatMap(receivedMessage -> receiver.complete(receivedMessage).thenReturn(receivedMessage)).next()) <END> .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }).verifyComplete(); StepVerifier.create(receiver.rollbackTransaction(transaction.get())) .verifyComplete(); }</code><technical_language>concatMap flatMap? confused this chain</technical_language>

Target:
void createTransactionAndRollbackMessagesTest(MessagingEntityType entityType) { setSender(entityType, TestUtils.USE_CASE_DEFAULT, isSessionEnabled); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); sendMessage(message).block(OPERATION_TIMEOUT); setReceiver(entityType, TestUtils.USE_CASE_DEFAULT, isSessionEnabled); AtomicReference<ServiceBusTransactionContext> transaction = new AtomicReference<>(); StepVerifier.create(receiver.createTransaction()) .assertNext(txn -> { transaction.set(txn); assertNotNull(transaction); }) .verifyComplete(); StepVerifier.create(receiver.receiveMessages() .flatMap(receivedMessage -> receiver.complete(receivedMessage).thenReturn(receivedMessage)).take(1)) .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }).verifyComplete(); StepVerifier.create(receiver.rollbackTransaction(transaction.get())) .verifyComplete(); }
Source:
<code>private ShadowActivity navigateFormEntry(Intent formEntryIntent) { FormEntryActivity formEntryActivity = Robolectric.buildActivity(FormEntryActivity.class).withIntent(formEntryIntent) .create().start().resume().get(); ImageButton nextButton = (ImageButton)formEntryActivity.findViewById(R.id.nav_btn_next); <START> assertTrue(nextButton.getTag().equals(FormEntryActivity.NAV_STATE_DONE)); <END> ODKView odkView = formEntryActivity.getODKView(); IntegerWidget favoriteNumber = (IntegerWidget)odkView.getWidgets().get(0); favoriteNumber.setAnswer("2"); assertTrue(nextButton.getTag().equals(FormEntryActivity.NAV_STATE_NEXT)); nextButton.performClick(); ShadowActivity shadowFormEntryActivity = Shadows.shadowOf(formEntryActivity); while (!shadowFormEntryActivity.isFinishing()) { Log.d(TAG, "Waiting for the form to save and the form entry activity to finish"); } return shadowFormEntryActivity; }</code><technical_language>if lacking context this, confused testing for _persistence_ of bugs, line 119. Is a reason fixed</technical_language>

Target:
private ShadowActivity navigateFormEntry(Intent formEntryIntent) { FormEntryActivity formEntryActivity = Robolectric.buildActivity(FormEntryActivity.class).withIntent(formEntryIntent) .create().start().resume().get(); ImageButton nextButton = (ImageButton)formEntryActivity.findViewById(R.id.nav_btn_next); ODKView odkView = formEntryActivity.getODKView(); IntegerWidget favoriteNumber = (IntegerWidget)odkView.getWidgets().get(0); favoriteNumber.setAnswer("2"); assertTrue(nextButton.getTag().equals(FormEntryActivity.NAV_STATE_NEXT)); nextButton.performClick(); ShadowActivity shadowFormEntryActivity = Shadows.shadowOf(formEntryActivity); while (!shadowFormEntryActivity.isFinishing()) { Log.d(TAG, "Waiting for the form to save and the form entry activity to finish"); } return shadowFormEntryActivity; }
Source:
<code>private void runTasks() { delegate.getSinkChannel().suspendWrites(); delegate.getSourceChannel().suspendReads(); List<Runnable> tasks = new ArrayList<>(); Runnable t = engine.getDelegatedTask(); while (t != null) { tasks.add(t); t = engine.getDelegatedTask(); } synchronized (this) { outstandingTasks += tasks.size(); for (final Runnable task : tasks) { getWorker().execute(new Runnable() { @Override public void run() { try { task.run(); } finally { synchronized (SslConduit.this) { if (outstandingTasks == 1) { getWriteThread().execute(new Runnable() { @Override public void run() { synchronized (SslConduit.this) { SslConduit.this.notifyAll(); --outstandingTasks; try { doHandshake(); } catch (IOException | RuntimeException | Error e) { <START> IoUtils.safeClose(connection); <END> UndertowLogger.REQUEST_LOGGER.error("Closing SSLConduit after exception on handshake", e); } if (anyAreSet(state, FLAG_READS_RESUMED)) { wakeupReads(); } if (anyAreSet(state, FLAG_WRITES_RESUMED)) { resumeWrites(); } } } }); } else { outstandingTasks--; } } } } }); } } }</code><technical_language>I other bad inputs logged debug level. this error? logging occur prior closing connection</technical_language>

Target:
private void runTasks() { delegate.getSinkChannel().suspendWrites(); delegate.getSourceChannel().suspendReads(); List<Runnable> tasks = new ArrayList<>(); Runnable t = engine.getDelegatedTask(); while (t != null) { tasks.add(t); t = engine.getDelegatedTask(); } synchronized (this) { outstandingTasks += tasks.size(); for (final Runnable task : tasks) { getWorker().execute(new Runnable() { @Override public void run() { try { task.run(); } finally { synchronized (SslConduit.this) { if (outstandingTasks == 1) { getWriteThread().execute(new Runnable() { @Override public void run() { synchronized (SslConduit.this) { SslConduit.this.notifyAll(); --outstandingTasks; try { doHandshake(); } catch (IOException | RuntimeException | Error e) { UndertowLogger.REQUEST_LOGGER.error("Closing SSLConduit after exception on handshake", e); IoUtils.safeClose(connection); } if (anyAreSet(state, FLAG_READS_RESUMED)) { wakeupReads(); } if (anyAreSet(state, FLAG_WRITES_RESUMED)) { resumeWrites(); } } } }); } else { outstandingTasks--; } } } } }); } } }
Source:
<code>public Pair<String, String[]> createWhereAndroid(String[] fieldNames, Object[] values, EncryptedModel em, Persistable p){ org.commcare.modern.util.Pair<String, String[]> mPair = DatabaseHelper.createWhere(fieldNames, values, em, p); Pair<String, String[]> returnPair = new Pair<String, String[]>(mPair.first, mPair.second); <START> return returnPair; <END> }</code><technical_language>2 lines return new Pair<>(mPair.first, mPair.second);</technical_language>

Target:
public Pair<String, String[]> createWhereAndroid(String[] fieldNames, Object[] values, EncryptedModel em, Persistable p){ org.commcare.modern.util.Pair<String, String[]> mPair = DatabaseHelper.createWhere(fieldNames, values, em, p); return new Pair<>(mPair.first, mPair.second); }
Source:
<code>private Configuration createConfiguration(AppReference appReference) { AppConfig appConfig = YamlFileParser.parse(appReference.getConfiguration(), AppConfig.class); Configuration configuration = new Configuration(); configuration.setContextPath(appConfig.getContextPath()); configuration.setThemeName(appConfig.getTheme()); <START> configuration.setLoginPageUri(appConfig.getLoginPageUri()); <END> configuration.setSessionManager(appConfig.getSessionManager()); Map<Integer, String> errorPageUris = appConfig.getErrorPages().entrySet().stream() .filter(entry -> NumberUtils.isNumber(entry.getKey())) .collect(toMap(entry -> Integer.valueOf(entry.getKey()), Map.Entry::getValue)); configuration.setErrorPageUris(errorPageUris); configuration.setDefaultErrorPageUri(appConfig.getErrorPages().get("default")); configuration.setMenus(appConfig.getMenus().stream() .map(AppConfig.Menu::toConfigurationMenu) .collect(toList())); configuration.setCsrfIgnoreUris(Sets.newHashSet(appConfig.getSecurity().getCsrfIgnoreUris())); configuration.setXssIgnoreUris(Sets.newHashSet(appConfig.getSecurity().getXssIgnoreUris())); configuration.setResponseHeaders(appConfig.getSecurity().getResponseHeaders().toConfigurationResponseHeaders()); configuration.setOther(appConfig.getOther()); return configuration; }</code><technical_language>Revert this formatting</technical_language>

Target:
private Configuration createConfiguration(AppReference appReference) { AppConfig appConfig = YamlFileParser.parse(appReference.getConfiguration(), AppConfig.class); Configuration configuration = new Configuration(); configuration.setContextPath(appConfig.getContextPath()); configuration.setThemeName(appConfig.getTheme()); configuration.setLoginPageUri(appConfig.getLoginPageUri()); configuration.setSessionManagerFactoryClassName(appConfig.getSessionManagement().getFactoryClassName()); configuration.setSessionTimeout(appConfig.getSessionManagement().getTimeout()); Map<Integer, String> errorPageUris = appConfig.getErrorPages().entrySet().stream() .filter(entry -> NumberUtils.isNumber(entry.getKey())) .collect(toMap(entry -> Integer.valueOf(entry.getKey()), Map.Entry::getValue)); configuration.setErrorPageUris(errorPageUris); configuration.setDefaultErrorPageUri(appConfig.getErrorPages().get("default")); configuration.setMenus(appConfig.getMenus().stream() .map(AppConfig.Menu::toConfigurationMenu) .collect(toList())); configuration.setCsrfIgnoreUris(Sets.newHashSet(appConfig.getSecurity().getCsrfIgnoreUris())); configuration.setXssIgnoreUris(Sets.newHashSet(appConfig.getSecurity().getXssIgnoreUris())); configuration.setResponseHeaders(appConfig.getSecurity().getResponseHeaders().toConfigurationResponseHeaders()); configuration.setOther(appConfig.getOther()); return configuration; }
Source:
<code>public boolean isBound(Input newInput) { <START> return data.containsValue(newInput) && newInput != null; <END> }</code><technical_language>This is a minor nitpick, a "newInput != null; && data.containsValue(newInput)" more efficient newInput is null, of programming languages handle (using short circuit logic)</technical_language>

Target:
public boolean isBound(Input newInput) { return newInput != null && data.containsValue(newInput) ; }
Source:
<code>private void updateActiveConfiguration() { final boolean[] fire = new boolean[] { false }; IWorkspaceRunnable runnable = new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException { synchronized (sync) { if (! live) { return; } ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescriptionManager().getProjectDescription(project); setActiveConfiguration(projectDescription != null ? projectDescription.getActiveConfiguration() : null); qmakeInfo = null; fire[0] = true; } } }; try { <START> if (ResourcesPlugin.getWorkspace().isTreeLocked()) { <END> runnable.run(null); } else { ResourcesPlugin.getWorkspace().run(runnable, project, IWorkspace.AVOID_UPDATE, null); } } catch (CoreException e) { QtPlugin.log(e); } if (fire[0]) { notifyListeners(); } }</code><technical_language>is this call for? like: 1) introduces a new race condition this test running result 2) unnecessarily avoids scheduling rule unrelated projects in a locks tree</technical_language>

Target:
private void updateActiveConfiguration() { final boolean[] fire = new boolean[] { false }; IWorkspaceRunnable runnable = new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException { synchronized (sync) { if (! live) { return; } ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescriptionManager().getProjectDescription(project); setActiveConfiguration(projectDescription != null ? projectDescription.getActiveConfiguration() : null); qmakeInfo = null; fire[0] = true; } } }; try { ResourcesPlugin.getWorkspace().run(runnable, project, IWorkspace.AVOID_UPDATE, null); } catch (CoreException e) { QtPlugin.log(e); } if (fire[0]) { notifyListeners(); } }
Source:
<code>public String toString() { return "Alert{" + "tenantId='" + tenantId + '\'' + ", alertId='" + alertId + '\'' + ", triggerId='" + triggerId + '\'' + ", ctime=" + ctime + ", evalSets=" + evalSets + ", severity=" + severity + ", status=" + status + ", ackTime=" + ackTime + ", ackBy='" + ackBy + '\'' + ", resolvedTime=" + resolvedTime + ", resolvedBy='" + resolvedBy + '\'' + ", notes=" + notes + ", trigger=" + trigger + ", dampening=" + dampening + ", resolvedEvalSets=" + resolvedEvalSets + ", context=" + context + '}'; <START> } <END></code><technical_language>previous toString() specifically left out evalSets resolvedEvalSets verbose. (basically, this 'thin'). Also, this is a definite formatting/generation discrepancy IJ Eclipse, do it... I do wish opposed for consistency</technical_language>

Target:
String toString() { return "Alert" + '[' + "tenantId='" + tenantId + '\'' + ", alertId='" + alertId + '\'' + ", triggerId='" + triggerId + '\'' + ", ctime=" + ctime + ", severity=" + severity + ", status=" + status + ", ackTime=" + ackTime + ", ackBy='" + ackBy + '\'' + ", resolvedTime=" + resolvedTime + ", resolvedBy='" + resolvedBy + '\'' + ", notes=" + notes + ", trigger=" + trigger + ", dampening=" + dampening + ", context=" + context + ']'; }
Source:
<code>private static void addFormattedText(XWPFRun run, String text, int fontSize, boolean bold, String rrggbbColor) { <START> addFormattedText(run, text, "Calibri", fontSize, bold, rrggbbColor); <END> }</code><technical_language>magic string "Calibri". Is font/fontfamily Callibri present OS</technical_language>

Target:
private static void addFormattedText(XWPFRun run, String text, int fontSize, boolean bold, String rrggbbColor) { addFormattedText(run, text, FONT_FAMILY, fontSize, bold, rrggbbColor); }
Source:
<code>public StreamGraph generate() { <START> runtimeExecutionMode = determineExecutionMode(runtimeExecutionMode); <END> streamGraph = new StreamGraph(executionConfig, checkpointConfig, savepointRestoreSettings); configureStreamGraph(streamGraph, runtimeExecutionMode); alreadyTransformed = new HashMap<>(); for (Transformation<?> transformation: transformations) { transform(transformation); } final StreamGraph builtStreamGraph = streamGraph; alreadyTransformed.clear(); alreadyTransformed = null; streamGraph = null; return builtStreamGraph; }</code><technical_language>I a separate field modify original hard debug things. a local boolean field isBounded options have. AUTOMATIC this point on. need verifyRuntimeModeIsSet() checks later. WDYT</technical_language>

Target:
public StreamGraph generate() { streamGraph = new StreamGraph(executionConfig, checkpointConfig, savepointRestoreSettings); configureStreamGraph(streamGraph); alreadyTransformed = new HashMap<>(); for (Transformation<?> transformation: transformations) { transform(transformation); } final StreamGraph builtStreamGraph = streamGraph; alreadyTransformed.clear(); alreadyTransformed = null; streamGraph = null; return builtStreamGraph; }
Source:
<code>public void doFilter(RefUpdatedEvent hook) throws IOException { String gitComment = getComment(hook.refUpdate.project, hook.refUpdate.newRev); log.debug("Git commit " + hook.refUpdate.newRev + ": " + gitComment); URL gitUrl = getGitUrl(hook); <START> if (gitUrl != null) { <END> String[] issues = getIssueIds(gitComment); for (String issue : issues) { log.debug("Adding GitWeb URL " + gitUrl + " to issue " + issue); its.addRelatedLink(issue, gitUrl, "Git: " + hook.refUpdate.newRev); } } }</code><technical_language>Checks in positive form (gitUrl == null) in this case want return: break flow avoid nesting. if (gitUrl == null) { return; }</technical_language>

Target:
public void doFilter(RefUpdatedEvent hook) throws IOException { String gitComment = getComment(hook.refUpdate.project, hook.refUpdate.newRev); log.debug("Git commit " + hook.refUpdate.newRev + ": " + gitComment); URL gitUrl = getGitUrl(hook); if (gitUrl == null) { return; } String[] issues = getIssueIds(gitComment); for (String issue : issues) { log.debug("Adding GitWeb URL " + gitUrl + " to issue " + issue); its.addRelatedLink(issue, gitUrl, "Git: " + hook.refUpdate.newRev); } }
Source:
<code>public List<Group> getSpecialGroups(Context context, HttpServletRequest request) { try { if (context.getCurrentUser() != null && <START> (EPersonServiceFactory.getInstance().getEPersonService().getPasswordHash(context.getCurrentUser()) != null && <END> StringUtils.isNotBlank(EPersonServiceFactory.getInstance().getEPersonService().getPasswordHash(context.getCurrentUser()).toString()))) { String groupName = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("authentication-password.login.specialgroup"); if ((groupName != null) && (!groupName.trim().equals(""))) { Group specialGroup = EPersonServiceFactory.getInstance().getGroupService().findByName(context, groupName); if (specialGroup == null) { log.warn(LogManager.getHeader(context, "password_specialgroup", "Group defined in modules/authentication-password.cfg login.specialgroup does not exist")); return ListUtils.EMPTY_LIST; } else { return Arrays.asList(specialGroup); } } } } catch (Exception e) { log.error(LogManager.getHeader(context,"getSpecialGroups",""),e); } return ListUtils.EMPTY_LIST; }</code><technical_language>StringUtils.isNotBlank safely treat null blank, this test needed, saving reading looooong line</technical_language>

Target:
public List<Group> getSpecialGroups(Context context, HttpServletRequest request) { try { if (context.getCurrentUser() != null && StringUtils.isNotBlank(EPersonServiceFactory.getInstance().getEPersonService().getPasswordHash(context.getCurrentUser()).toString())) { String groupName = DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("authentication-password.login.specialgroup"); if ((groupName != null) && (!groupName.trim().equals(""))) { Group specialGroup = EPersonServiceFactory.getInstance().getGroupService().findByName(context, groupName); if (specialGroup == null) { log.warn(LogManager.getHeader(context, "password_specialgroup", "Group defined in modules/authentication-password.cfg login.specialgroup does not exist")); return ListUtils.EMPTY_LIST; } else { return Arrays.asList(specialGroup); } } } } catch (Exception e) { log.error(LogManager.getHeader(context,"getSpecialGroups",""),e); } return ListUtils.EMPTY_LIST; }
Source:
<code>public void testCheck() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(JavadocTagContinuationIndentationCheck.class); final String[] expected = { "47: " + getCheckMessage(MSG_KEY, 4), "109: " + getCheckMessage(MSG_KEY, 4), "112: " + getCheckMessage(MSG_KEY, 4), "203: " + getCheckMessage(MSG_KEY, 4), "206: " + getCheckMessage(MSG_KEY, 4), "221: " + getCheckMessage(MSG_KEY, 4), "223: " + getCheckMessage(MSG_KEY, 4), "285: " + getCheckMessage(MSG_KEY, 4), "288: " + getCheckMessage(MSG_KEY, 4), "290: " + getCheckMessage(MSG_KEY, 4), "310: " + getCheckMessage(MSG_KEY, 4), "322: " + getCheckMessage(MSG_KEY, 4), "324: " + getCheckMessage(MSG_KEY, 4), }; verify(checkConfig, <START> getPath("InputJavaDocTagContinuationIndentation.java"), <END> expected); }</code><technical_language>File name change this line change is completely unnecessary. Please undo change</technical_language>

Target:
public void testCheck() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(JavadocTagContinuationIndentationCheck.class); final String[] expected = { "47: " + getCheckMessage(MSG_KEY, 4), "109: " + getCheckMessage(MSG_KEY, 4), "112: " + getCheckMessage(MSG_KEY, 4), "203: " + getCheckMessage(MSG_KEY, 4), "206: " + getCheckMessage(MSG_KEY, 4), "221: " + getCheckMessage(MSG_KEY, 4), "223: " + getCheckMessage(MSG_KEY, 4), "285: " + getCheckMessage(MSG_KEY, 4), "288: " + getCheckMessage(MSG_KEY, 4), "290: " + getCheckMessage(MSG_KEY, 4), "310: " + getCheckMessage(MSG_KEY, 4), "322: " + getCheckMessage(MSG_KEY, 4), "324: " + getCheckMessage(MSG_KEY, 4), }; verify(checkConfig, getPath("InputJavadocTagContinuationIndentation.java"), expected); }
Source:
<code>private void getPhonebook() { try { ContentResponse contentResponse = httpClient.newRequest(phonebookUrl).method(HttpMethod.GET) .timeout(2, TimeUnit.SECONDS).send(); InputStream xml = new ByteArrayInputStream(contentResponse.getContent()); JAXBContext context = JAXBContext.newInstance(PhonebooksType.class); Unmarshaller um = context.createUnmarshaller(); PhonebooksType phonebooksType = um.unmarshal(new StreamSource(xml), PhonebooksType.class).getValue(); phonebookName = phonebooksType.getPhonebook().getName(); phonebook = phonebooksType.getPhonebook().getContact().stream().map(contact -> { String contactName = contact.getPerson().getRealName(); return contact.getTelephony().getNumber().stream() .collect(Collectors.toMap(number -> normalizeNumber(number.getValue()), number -> contactName, <START> (nameA, nameB) -> mergeSameContactNames(nameA, nameB))); <END> }).collect(HashMap::new, HashMap::putAll, HashMap::putAll); logger.debug("Downloaded phonebook {}: {}", phonebookName, phonebook); } catch (JAXBException | InterruptedException | ExecutionException | TimeoutException e) { logger.warn("Failed to get phonebook with URL {}:", phonebookUrl, e); } }</code><technical_language>suggestion this::mergeSameContactNames));</technical_language>

Target:
private void getPhonebook() { try { ContentResponse contentResponse = httpClient.newRequest(phonebookUrl).method(HttpMethod.GET) .timeout(2, TimeUnit.SECONDS).send(); InputStream xml = new ByteArrayInputStream(contentResponse.getContent()); JAXBContext context = JAXBContext.newInstance(PhonebooksType.class); Unmarshaller um = context.createUnmarshaller(); PhonebooksType phonebooksType = um.unmarshal(new StreamSource(xml), PhonebooksType.class).getValue(); phonebookName = phonebooksType.getPhonebook().getName(); phonebook = phonebooksType.getPhonebook().getContact().stream().map(contact -> { String contactName = contact.getPerson().getRealName(); return contact.getTelephony().getNumber().stream() .collect(Collectors.toMap(number -> normalizeNumber(number.getValue()), number -> contactName, this::mergeSameContactNames)); }).collect(HashMap::new, HashMap::putAll, HashMap::putAll); logger.debug("Downloaded phonebook {}: {}", phonebookName, phonebook); } catch (JAXBException | InterruptedException | ExecutionException | TimeoutException e) { logger.warn("Failed to get phonebook with URL {}:", phonebookUrl, e); } }
Source:
<code>public boolean equals(Object o) { <START> return o == this || o instanceof AwaitCommand && equalTo((AwaitCommand) o); <END> }</code><technical_language>copy paste error ? o instanceof NotifyCommand cast NotifyCommand</technical_language>

Target:
public boolean equals(Object o) { return o == this || o instanceof NotifyCommand && equalTo((NotifyCommand) o); }
Source:
<code>void deleteEntityViaMigration() { ProjectId id = createId(42); TestProcessManager entity = createEntity(id); repository().store(entity); repository().applyMigration(id, new MarkPmDeleted<>()); Optional<TestProcessManager> found = repository().find(id); <START> assertThat(found.isPresent()).isTrue(); <END> assertThat(found.get() .isDeleted()).isTrue(); }</code><technical_language>a set of Truth8 assertions allow a bit nicer syntax for Optionals. please check out consider instead</technical_language>

Target:
void deleteEntityViaMigration() { ProjectId id = createId(42); TestProcessManager entity = createEntity(id); repository().store(entity); repository().applyMigration(id, new MarkPmDeleted<>()); Optional<TestProcessManager> found = repository().find(id); assertThat(found).isPresent(); assertThat(found.get() .isDeleted()).isTrue(); }
Source:
<code>protected boolean canDoAction() { if (getDiskImage() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } try { if (!validate(new StorageDomainValidator(getStorageDomain()).isDomainExistAndActive())) { return false; } } catch (Exception e) { <START> e.printStackTrace(); <END> } if (!getDiskImage().getParentId().equals(Guid.Empty)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED); } for (VM vm : getVmDAO().getVmsListForDisk(getDiskImage().getId())) { if (vm.getStatus() != VMStatus.Down) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_RUNNING); } } return true; }</code><technical_language>this pring stderr - a robust approach. Besides, exception get here? NPE</technical_language>

Target:
protected boolean canDoAction() { if (getDiskImage() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } if (!validate(new StorageDomainValidator(getStorageDomain()).isDomainExistAndActive())) { return false; } if (!getDiskImage().getParentId().equals(Guid.Empty)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED); } for (VM vm : getVmDAO().getVmsListForDisk(getDiskImage().getId())) { if (vm.getStatus() != VMStatus.Down) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_RUNNING); } } return true; }
Source:
<code>public static void main(String[] args) throws Exception { Locale.setDefault(Locale.ENGLISH); Context.init(args); Log.info("Starting server..."); Context.getServerManager().start(); if (Context.getWebServer() != null) { Context.getWebServer().start(); } Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { try { Context.getDataManager().clearPositionsHistory(); } catch (Exception error) { Log.warning(error); } } <START> }, 10*1000, 24*60*60*1000); <END> Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { Log.info("Shutting down server..."); if (Context.getWebServer() != null) { Context.getWebServer().stop(); } Context.getServerManager().stop(); } }); }</code><technical_language>Move constants static variables top of class give some name</technical_language>

Target:
public static void main(String[] args) throws Exception { Locale.setDefault(Locale.ENGLISH); Context.init(args); Log.info("Starting server..."); Context.getServerManager().start(); if (Context.getWebServer() != null) { Context.getWebServer().start(); } Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { try { Context.getDataManager().clearPositionsHistory(); } catch (SQLException error) { Log.warning(error); } } }, CLEAN_DELAY, CLEAN_PERIOD); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { Log.info("Shutting down server..."); if (Context.getWebServer() != null) { Context.getWebServer().stop(); } Context.getServerManager().stop(); } }); }
Source:
<code>void save(File file) throws IOException { if (facets.isEmpty()) { file.getParentFile().mkdirs(); AtomicFileWriter afw = new AtomicFileWriter(file); try { <START> try (PrintWriter w = new PrintWriter(afw)) { <END> w.println("<?xml version='1.1' encoding='UTF-8'?>"); w.println("<fingerprint>"); w.print(" <timestamp>"); w.print(DATE_CONVERTER.toString(timestamp)); w.println("</timestamp>"); if (original != null) { w.println(" <original>"); w.print(" <name>"); w.print(Util.xmlEscape(original.name)); w.println("</name>"); w.print(" <number>"); w.print(original.number); w.println("</number>"); w.println(" </original>"); } w.print(" <md5sum>"); w.print(Util.toHexString(md5sum)); w.println("</md5sum>"); w.print(" <fileName>"); w.print(Util.xmlEscape(fileName)); w.println("</fileName>"); w.println(" <usages>"); for (Entry<String, RangeSet> e : usages.entrySet()) { w.println(" <entry>"); w.print(" <string>"); w.print(Util.xmlEscape(e.getKey())); w.println("</string>"); w.print(" <ranges>"); w.print(RangeSet.ConverterImpl.serialize(e.getValue())); w.println("</ranges>"); w.println(" </entry>"); } w.println(" </usages>"); w.println(" <facets/>"); w.print("</fingerprint>"); w.flush(); } afw.commit(); } finally { afw.abort(); } } else { getConfigFile(file).write(this); } }</code><technical_language>previously, try line 1262 try resources for PrintWriter</technical_language>

Target:
void save(File file) throws IOException { if (facets.isEmpty()) { file.getParentFile().mkdirs(); AtomicFileWriter afw = new AtomicFileWriter(file); try { PrintWriter w = new PrintWriter(afw); w.println("<?xml version='1.1' encoding='UTF-8'?>"); w.println("<fingerprint>"); w.print(" <timestamp>"); w.print(DATE_CONVERTER.toString(timestamp)); w.println("</timestamp>"); if (original != null) { w.println(" <original>"); w.print(" <name>"); w.print(Util.xmlEscape(original.name)); w.println("</name>"); w.print(" <number>"); w.print(original.number); w.println("</number>"); w.println(" </original>"); } w.print(" <md5sum>"); w.print(Util.toHexString(md5sum)); w.println("</md5sum>"); w.print(" <fileName>"); w.print(Util.xmlEscape(fileName)); w.println("</fileName>"); w.println(" <usages>"); for (Map.Entry<String,RangeSet> e : usages.entrySet()) { w.println(" <entry>"); w.print(" <string>"); w.print(Util.xmlEscape(e.getKey())); w.println("</string>"); w.print(" <ranges>"); w.print(RangeSet.ConverterImpl.serialize(e.getValue())); w.println("</ranges>"); w.println(" </entry>"); } w.println(" </usages>"); w.println(" <facets/>"); w.print("</fingerprint>"); w.flush(); afw.commit(); } finally { afw.abort(); } } else { getConfigFile(file).write(this); } }
Source:
<code>public static boolean areEquivalent(String left, String right) { if ((left == null) && (right == null)) return true; if ((left == null) || (right == null)) return false; if (left.equals(right)) return true; String leftName = stripGenerics(toSimpleName(left)); String rightName = stripGenerics(toSimpleName(right)); String leftPackage = getPackage(left); String rightPackage = getPackage(right); if (leftName.equals(rightName)) { if (!leftPackage.isEmpty() && !rightPackage.isEmpty()) { <START> return leftPackage.equals(rightPackage); <END> } return !(!leftPackage.isEmpty() && !rightPackage.isEmpty()); } return false; }</code><technical_language>This changes method behavior</technical_language>

Target:
public static boolean areEquivalent(String left, String right) { if (left.equals(notNull(right))) return true; String leftName = stripGenerics(toSimpleName(left)); String rightName = stripGenerics(toSimpleName(right)); String leftPackage = getPackage(left); String rightPackage = getPackage(right); if (leftName.equals(rightName)) { if (!leftPackage.isEmpty() && !rightPackage.isEmpty()) { return leftPackage.equals(rightPackage); } return !(!leftPackage.isEmpty() && !rightPackage.isEmpty()); } return false; }
Source:
<code>public void handleEvent(@NonNull ITmfStateSystemBuilder ss, @NonNull ITmfEvent event) throws AttributeNotFoundException { ITmfEventField content = event.getContent(); long ts = event.getTimestamp().getValue(); <START> Integer phydisk = ((Long) content.getField(getLayout().fieldBlockDeviceId()).getValue()).intValue(); <END> Integer sector = ((Long) content.getField(getLayout().fieldBlockSector()).getValue()).intValue(); Integer nrSector = ((Long) content.getField(getLayout().fieldBlockNrSector()).getValue()).intValue(); Integer rwbs = ((Long) content.getField(getLayout().fieldBlockRwbs()).getValue()).intValue(); DiskWriteModel disk = fStateProvider.getDisk(phydisk); if (nrSector.intValue() == 0) { return; } Bio bio = new Bio(sector, nrSector, disk, rwbs); Request request = new Request(bio); disk.addWaitingRequest(ts, request); }</code><technical_language>ints</technical_language>

Target:
public void handleEvent(@NonNull ITmfStateSystemBuilder ss, @NonNull ITmfEvent event) throws AttributeNotFoundException { ITmfEventField content = event.getContent(); long ts = event.getTimestamp().getValue(); int phydisk = ((Long) content.getField(getLayout().fieldBlockDeviceId()).getValue()).intValue(); Long sector = NonNullUtils.checkNotNull((Long) content.getField(getLayout().fieldBlockSector()).getValue()); int nrSector = ((Long) content.getField(getLayout().fieldBlockNrSector()).getValue()).intValue(); int rwbs = ((Long) content.getField(getLayout().fieldBlockRwbs()).getValue()).intValue(); DiskWriteModel disk = fStateProvider.getDisk(phydisk); if (nrSector == 0) { return; } BlockIO bio = new BlockIO(sector, nrSector, disk, rwbs); Request request = new Request(bio); disk.addWaitingRequest(ts, request); }
Source:
<code>private boolean isInStudy(Set<Roles> roles, StudyIdentifier studyId, Survey survey) { <START> if (studyId == null || (!roles.isEmpty() && roles.contains(Roles.ADMIN))) { <END> return true; } if (survey == null || survey.getStudyIdentifier() == null) { return false; } return survey.getStudyIdentifier().equals(studyId.getIdentifier()); }</code><technical_language>Nitpick: Set.contains() simply return false if called empty set, isEmpty() check is redundant</technical_language>

Target:
private boolean isInStudy(Set<Roles> roles, StudyIdentifier studyId, Survey survey) { if (studyId == null || roles.contains(Roles.ADMIN)) { return true; } if (survey == null || survey.getStudyIdentifier() == null) { return false; } return survey.getStudyIdentifier().equals(studyId.getIdentifier()); }
Source:
<code>private LuceneQuery<PersonName> getPersonNameLuceneQuery(String query, boolean includeVoided) { StringBuilder newQuery = new StringBuilder(); newQuery.append("givenName:\"").append(query).append("\" OR familyName:\"").append(query) .append("\" OR middleName:\"").append(query).append("\""); LuceneQuery<PersonName> luceneQuery = LuceneQuery .newQuery(PersonName.class, sessionFactory.getCurrentSession(), newQuery.toString()); if(!includeVoided){ luceneQuery.include("voided", false); } <START> luceneQuery.skipSame("person.personId"); <END> return luceneQuery; }</code><technical_language>Is needed here? line 761 do it</technical_language>

Target:
private LuceneQuery<PersonName> getPersonNameLuceneQuery(String query, boolean includeVoided) { String[] fields = {"givenName", "givenNameExact", "middleName", "middleNameExact", "familyName", "familyNameExact", "familyName2", "familyName2Exact"}; LuceneQuery<PersonName> luceneQuery = LuceneQuery .newQuery(PersonName.class, sessionFactory.getCurrentSession(), query, fields); if(!includeVoided){ luceneQuery.include("voided", false); luceneQuery.include("person.voided", false); } return luceneQuery; }