auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public RouterConfig(VerifiableProperties verifiableProperties) { routerScalingUnitCount = verifiableProperties.getIntInRange("router.scaling.unit.count", 1, 0, 10); routerHostname = verifiableProperties.getString("router.hostname"); routerDatacenterName = verifiableProperties.getString("router.datacenter.name"); routerScalingUnitMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.plain.text", 5, 1, 20); routerScalingUnitMaxConnectionsPerPortSsl = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.ssl", 2, 1, 20); routerConnectionCheckoutTimeoutMs = verifiableProperties.getIntInRange("router.connection.checkout.timeout.ms", 1000, 1, 5000); routerRequestTimeoutMs = verifiableProperties.getInt("router.request.timeout.ms", 2000); routerMaxPutChunkSizeBytes = verifiableProperties.getInt("router.max.put.chunk.size.bytes", 4 * 1024 * 1024); <START> routerPutRequestParallelism = verifiableProperties.getInt("router.put.request.parallelism", 3); <END> routerPutSuccessTarget = verifiableProperties.getInt("router.put.success.target", 2); }</code><technical_language>getIntInRange() for both? atleast neg/0 checks for of configs if them</technical_language>

Target:
public RouterConfig(VerifiableProperties verifiableProperties) { routerScalingUnitCount = verifiableProperties.getIntInRange("router.scaling.unit.count", 1, 0, 10); routerHostname = verifiableProperties.getString("router.hostname"); routerDatacenterName = verifiableProperties.getString("router.datacenter.name"); routerScalingUnitMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.plain.text", 5, 1, 20); routerScalingUnitMaxConnectionsPerPortSsl = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.ssl", 2, 1, 20); routerConnectionCheckoutTimeoutMs = verifiableProperties.getIntInRange("router.connection.checkout.timeout.ms", 1000, 1, 5000); routerRequestTimeoutMs = verifiableProperties.getInt("router.request.timeout.ms", 2000); routerMaxPutChunkSizeBytes = verifiableProperties.getInt("router.max.put.chunk.size.bytes", 4 * 1024 * 1024); routerPutRequestParallelism = verifiableProperties.getInt("router.put.request.parallelism", 3); routerPutSuccessTarget = verifiableProperties.getInt("router.put.success.target", 2); routerMaxSlippedPutAttempts = verifiableProperties.getInt("router.max.slipped.put.attempts", 1); }
Source:
<code>public void storeServerMetrics(final String serverId, final ServerMetrics metrics) { if (metricCollectionEnabled) { try { final int numDataBlocksOnServer = metrics.getNumModelParamBlocks(); final int numDataBlocksOnDriver = numBlockOwnershipByEvalIdForServer.get(serverId); if (numDataBlocksOnServer == numDataBlocksOnDriver) { final DataInfo dataInfo = new DataInfoImpl(numDataBlocksOnServer); final EvaluatorParameters evaluatorParameters = new ServerEvaluatorParameters(serverId, dataInfo, metrics); serverEvalParams.computeIfAbsent(serverId, metricList -> new ArrayList<>()).add(evaluatorParameters); } else { LOG.log(Level.FINE, "{0} contains {1} blocks, driver says {2} blocks. Dropping metric.", new Object[]{serverId, numDataBlocksOnServer, numDataBlocksOnDriver}); <START> } <END> } catch (NullPointerException e) { LOG.log(Level.FINE, "No information about {0}. Dropping metric.", serverId); } } else { LOG.log(Level.FINE, "Metric collection disabled. Dropping metric from {0}", serverId); } }</code><technical_language>If one-side reconfigured, this method treats other-side's metric valid collects them, system reconfiguration. collected metrics represent stable state of system, reconfiguration of one-side affects behaviour of other side</technical_language>

Target:
public void storeServerMetrics(final String serverId, final ServerMetrics metrics) { if (metricCollectionEnabled) { final int numModelBlocksOnServer = metrics.getNumModelBlocks(); if (numBlockByEvalIdForServer != null && numBlockByEvalIdForServer.containsKey(serverId)) { final int numModelBlocksOnDriver = numBlockByEvalIdForServer.get(serverId); if (numModelBlocksOnServer == numModelBlocksOnDriver) { final DataInfo dataInfo = new DataInfoImpl(numModelBlocksOnServer); final EvaluatorParameters evaluatorParameters = new ServerEvaluatorParameters(serverId, dataInfo, metrics); synchronized (serverEvalParams) { if (!serverEvalParams.containsKey(serverId)) { serverEvalParams.put(serverId, new ArrayList<>()); } serverEvalParams.get(serverId).add(evaluatorParameters); } } else { LOG.log(Level.FINE, "{0} contains {1} blocks, driver says {2} blocks. Dropping metric.", new Object[]{serverId, numModelBlocksOnServer, numModelBlocksOnDriver}); } } else { LOG.log(Level.FINE, "No information about {0}. Dropping metric.", serverId); } } else { LOG.log(Level.FINE, "Metric collection disabled. Dropping metric from {0}", serverId); } if (this.dashboardEnabled) { sendMetricsToDashboard(serverId, metrics.toString()); } }
Source:
<code>public void testDelete() throws Exception { checkIsSuccess(mAppSearch.setSchema(AppSearchEmail.SCHEMA)); AppSearchEmail email1 = new AppSearchEmail.Builder("uri1") .setFrom("from@example.com") .setTo("to1@example.com", "to2@example.com") .setSubject("testPut example") .setBody("This is the body of the testPut email") .build(); AppSearchEmail email2 = new AppSearchEmail.Builder("uri2") .setFrom("from@example.com") .setTo("to1@example.com", "to2@example.com") .setSubject("testPut example 2") .setBody("This is the body of the testPut second email") .build(); checkIsSuccess(mAppSearch.putDocuments(ImmutableList.of(email1, email2))); assertThat(doGet("uri1")).hasSize(1); assertThat(doGet("uri2")).hasSize(1); checkIsSuccess(mAppSearch.delete(ImmutableList.of("uri1"))); AppSearchBatchResult<String, AppSearchDocument> getResult = mAppSearch.getDocuments(ImmutableList.of("uri1", "uri2")).get(); assertThat(getResult.isSuccess()).isFalse(); assertThat(getResult.getFailures().get("uri1").getResultCode()) .isEqualTo(AppSearchResult.RESULT_NOT_FOUND); assertThat(getResult.getSuccesses().get("uri2")).isEqualTo(email2); <START> AppSearchBatchResult<String, Void> getResultNonexistentUri = mAppSearch.delete(ImmutableList.of("uri1")).get(); assertThat(getResultNonexistentUri.getFailures()).containsExactly("uri1", AppSearchResult.newFailedResult( AppSearchResult.RESULT_NOT_FOUND, null)); <END> }</code><technical_language>difference this test test line 194</technical_language>

Target:
public void testDelete() throws Exception { checkIsSuccess(mAppSearch.setSchema(AppSearchEmail.SCHEMA)); AppSearchEmail email1 = new AppSearchEmail.Builder("uri1") .setFrom("from@example.com") .setTo("to1@example.com", "to2@example.com") .setSubject("testPut example") .setBody("This is the body of the testPut email") .build(); AppSearchEmail email2 = new AppSearchEmail.Builder("uri2") .setFrom("from@example.com") .setTo("to1@example.com", "to2@example.com") .setSubject("testPut example 2") .setBody("This is the body of the testPut second email") .build(); checkIsSuccess(mAppSearch.putDocuments(ImmutableList.of(email1, email2))); assertThat(doGet("uri1")).hasSize(1); assertThat(doGet("uri2")).hasSize(1); checkIsSuccess(mAppSearch.delete(ImmutableList.of("uri1"))); AppSearchBatchResult<String, AppSearchDocument> getResult = mAppSearch.getDocuments(ImmutableList.of("uri1", "uri2")).get(); assertThat(getResult.isSuccess()).isFalse(); assertThat(getResult.getFailures().get("uri1").getResultCode()) .isEqualTo(AppSearchException.RESULT_NOT_FOUND); assertThat(getResult.getSuccesses().get("uri2")).isEqualTo(email2); AppSearchBatchResult<String, Void> getResultNonexistentUri = mAppSearch.delete(ImmutableList.of("uri1")).get(); assertThat(getResultNonexistentUri.getFailures().keySet()).containsExactly("uri1"); assertThat(getResultNonexistentUri.getFailures().get("uri1").getResultCode()).isEqualTo( AppSearchException.RESULT_NOT_FOUND); assertThat(getResultNonexistentUri.getFailures().get("uri1").getMessage()).isEqualTo( null); }
Source:
<code>public final boolean IsDynamicVariable(String strMessage) { <START> return strMessage.startsWith("$"); <END> }</code><technical_language>this modified</technical_language>

Target:
public final boolean IsDynamicVariable(String strMessage) { final String startsWithVariableDefinitionRegex = "^\\$[^{}\\s]+ .*"; return strMessage.matches(startsWithVariableDefinitionRegex); }
Source:
<code>public void register(@NonNull Context context, @Nullable Looper thread, @Nullable UserHandle user) { if (mRegisteredContext != null) { throw new IllegalStateException("Already registered"); } Handler handler = new Handler(thread == null ? getStaticLooper() : thread); mRegisteredContext = context; if (handler != null) { <START> Context contextForUser = user == null ? context : context.createContextAsUser(user, 0); contextForUser.registerReceiver(this, sPackageIntentFilter, null, handler); <END> } else { throw new NullPointerException(); } }</code><technical_language>This is part of cl, this work, here: b/141323834 #9</technical_language>

Target:
public void register(@NonNull Context context, @Nullable Looper thread, @Nullable UserHandle user) { if (mRegisteredContext != null) { throw new IllegalStateException("Already registered"); } Handler handler = new Handler(thread == null ? getStaticLooper() : thread); mRegisteredContext = user == null ? context : context.createContextAsUser(user, 0); mRegisteredContext.registerReceiver(this, sPackageIntentFilter, null, handler); }
Source:
<code>public void testUdp() throws Exception { <START> InInt32UDP udp = new InInt32UDP(ImmutableSet.of(42)); <END> InInt32UDP udp1 = new InInt32UDP(ImmutableSet.of(205)); assertTrue("Should drop block for non-matching UDP", canDrop(FilterApi.userDefined(intColumn("int32_field"), udp), ccmd, dictionaries)); assertFalse("Should not drop block for matching UDP", canDrop(FilterApi.userDefined(intColumn("int32_field"), udp1), ccmd, dictionaries)); }</code><technical_language>Nit: more clear if udp udp1 more descriptive names</technical_language>

Target:
public void testUdp() throws Exception { InInt32UDP dropabble = new InInt32UDP(ImmutableSet.of(42)); InInt32UDP undroppable = new InInt32UDP(ImmutableSet.of(205)); assertTrue("Should drop block for non-matching UDP", canDrop(userDefined(intColumn("int32_field"), dropabble), ccmd, dictionaries)); assertFalse("Should not drop block for matching UDP", canDrop(userDefined(intColumn("int32_field"), undroppable), ccmd, dictionaries)); }
Source:
<code><START> public void activate() { <END> for (ExtensionEntry entry: loadedEntries.values()) { if (entry.enabled) { activatedEntries.put(entry.name, entry); List<ExtensionEntry> entries = serviceEntries.get(entry.service); if (entries == null) { entries = new ArrayList<>(); serviceEntries.put(entry.service, entries); } entries.add(entry); } } }</code><technical_language>need activate... load resources "activate" your-self</technical_language>

Target:
private void activate() { for (ExtensionEntry entry: loadedEntries.values()) { if (entry.enabled) { activatedEntries.put(entry.name, entry); List<ExtensionEntry> entries = serviceEntries.get(entry.service); if (entries == null) { entries = new ArrayList<>(); serviceEntries.put(entry.service, entries); } entries.add(entry); } } }
Source:
<code>private boolean hasStatementFor(String sql) { try { <START> return statementMap.containsKey(sql) && !statementMap.get(sql).getConnection().isClosed(); <END> } catch (SQLException e) { return false; } }</code><technical_language>more efficient assign result of get() a local variable. i.e. node lookup. suggestion Statement statement = statementMap.get(sql); return statement != null && !statement.getConnection().isClosed();</technical_language>

Target:
private boolean hasStatementFor(String sql) { try { Statement statement = statementMap.get(sql); return statement != null && !statement.getConnection().isClosed(); } catch (SQLException e) { return false; } }
Source:
<code>private static Pair<String, String> getAttribute(String value) { <START> Pair<String, String> attrs = new Pair<>("", ""); <END> if (value.indexOf(':') != -1) { String[] values = value.split(":"); attrs = new Pair<>(cleanProp(values[0]), cleanProp(values[1])); } return attrs; }</code><technical_language>I avoid a dependency uberfire module due Pair class. I standard java map entry. For example this line Map.Entry<String, String> attrs = new AbstractMap.SimpleEntry<>("", ""); do think</technical_language>

Target:
private static Map.Entry<String, String> getAttribute(String value) { Map.Entry<String, String> attrs = new SimpleEntry<>("", ""); if (value.indexOf(':') != -1) { String[] values = value.split(":"); attrs = new SimpleEntry<>(cleanProp(values[0]), cleanProp(values[1])); } return attrs; }
Source:
<code>private Long decodeViewIndexId(Cell viewIndexIdKv, PDataType viewIndexType) { <START> boolean useLongViewIndex = MetaDataUtil.getViewIndexIdDataType().equals(viewIndexType); <END> return new Long( useLongViewIndex ? viewIndexType.getCodec().decodeLong(viewIndexIdKv.getValueArray(), viewIndexIdKv.getValueOffset(), SortOrder.getDefault()) : MetaDataUtil.getLegacyViewIndexIdDataType().getCodec().decodeShort(viewIndexIdKv.getValueArray(), viewIndexIdKv.getValueOffset(), SortOrder.getDefault()) ); }</code><technical_language>call getCodec().decodeLong() in cases here</technical_language>

Target:
private Long decodeViewIndexId(Cell viewIndexIdKv, PDataType viewIndexType) { return viewIndexType.getCodec().decodeLong(viewIndexIdKv.getValueArray(), viewIndexIdKv.getValueOffset(), SortOrder.getDefault()); }
Source:
<code>public void getServerRuntime() { NewRuntimeWizardDialog wizardDialog = preferencePage.addRuntime(); NewRuntimeWizardPage wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME); wizardDialog.finish(); wizardDialog = preferencePage.addRuntime(); wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME_2); wizardDialog.finish(); wizardDialog = preferencePage.addRuntime(); wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME_2); wizardDialog.finish(); List<Runtime> runtimes = preferencePage.getServerRuntimes(); assertThat(runtimes.size(), is(3)); Runtime runtime1 = preferencePage.getServerRuntime(SERVER_NAME, SERVER_NAME); assertThat(runtime1, is(new Runtime(SERVER_NAME, SERVER_NAME))); Runtime runtime2 = preferencePage.getServerRuntime(new Runtime(SERVER_NAME_2, SERVER_NAME_2)); assertThat(runtime2, is(new Runtime(SERVER_NAME_2, SERVER_NAME_2))); Runtime runtime3 = null; try { runtime3 = preferencePage.getServerRuntime(SERVER_NAME_2); <START> } catch (IllegalStateException exc) { <END> fail(exc.getMessage()); } assertThat(runtime3, is(new Runtime(SERVER_NAME_2, SERVER_NAME_2))); }</code><technical_language>I guess EclipseLayerEx in catch block</technical_language>

Target:
public void getServerRuntime() { NewRuntimeWizardDialog wizardDialog = preferencePage.addRuntime(); NewRuntimeWizardPage wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME); wizardDialog.finish(); wizardDialog = preferencePage.addRuntime(); wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME_2); wizardDialog.finish(); wizardDialog = preferencePage.addRuntime(); wizardPage = new NewRuntimeWizardPage(wizardDialog); wizardPage.selectType(SERVER_PATH, SERVER_NAME_2); wizardDialog.finish(); List<Runtime> runtimes = preferencePage.getServerRuntimes(); assertThat(runtimes.size(), is(3)); Runtime runtime1 = preferencePage.getServerRuntime(SERVER_NAME, SERVER_NAME); assertThat(runtime1, is(new Runtime(SERVER_NAME, SERVER_NAME))); Runtime runtime2 = preferencePage.getServerRuntime(new Runtime(SERVER_NAME_2, SERVER_NAME_2)); assertThat(runtime2, is(new Runtime(SERVER_NAME_2, SERVER_NAME_2))); Runtime runtime3 = null; try { runtime3 = preferencePage.getServerRuntime(SERVER_NAME_2); } catch (EclipseLayerException exc) { fail(exc.getMessage()); } assertThat(runtime3, is(new Runtime(SERVER_NAME_2, SERVER_NAME_2))); }
Source:
<code>private static InputStream openStream(URI uri) throws IOException { <START> if (uri.toString().startsWith("level://")) { <END> return new FileInputStream(new File(DimensionManager.getCurrentSaveRootDirectory(), uri.toString().substring("level://".length()))); } return uri.toURL().openStream(); }</code><technical_language>constant string level:// appears in this PR, a string constant somewhere</technical_language>

Target:
private static InputStream openStream(URI uri) throws IOException { if (uri.toString().startsWith(SpongeWorldResourcePack.LEVEL_PACK_PROTOCOL)) { return new FileInputStream(new File(DimensionManager.getCurrentSaveRootDirectory().getParent(), uri.toString().substring(SpongeWorldResourcePack.LEVEL_PACK_PROTOCOL.length()))); } return uri.toURL().openStream(); }
Source:
<code>public void collisions() throws Exception { WorkspaceLocatorImpl.MODE = WorkspaceLocatorImpl.Mode.ENABLED; FilePath firstWs = r.buildAndAssertSuccess(r.createFreeStyleProject("first_project-with-a-rather-long-name")).getWorkspace(); assertEquals("_project-with-a-rather-long-name", firstWs.getName()); firstWs.deleteRecursive(); <START> assertEquals("roject-with-a-rather-long-name_2", r.buildAndAssertSuccess(r.createFreeStyleProject("second_project-with-a-rather-long-name")).getWorkspace().getName()); <END> }</code><technical_language>This change is unnecessary I think, OK</technical_language>

Target:
public void collisions() throws Exception { WorkspaceLocatorImpl.MODE = WorkspaceLocatorImpl.Mode.ENABLED; FilePath firstWs = r.buildAndAssertSuccess(r.createFreeStyleProject("first-project-with-a-rather-long-name")).getWorkspace(); assertEquals("_project-with-a-rather-long-name", firstWs.getName()); firstWs.deleteRecursive(); assertEquals("roject-with-a-rather-long-name_2", r.buildAndAssertSuccess(r.createFreeStyleProject("second-project-with-a-rather-long-name")).getWorkspace().getName()); }
Source:
<code>public PreparedRead prepareRead(List<DriverRecord> driverRecords) { <START> requireNonNull(driverRecords); <END> OpcUaPreparedRead preparedRead = new OpcUaPreparedRead(); preparedRead.driverRecords = driverRecords; for (DriverRecord record : driverRecords) { OpcUaRequestInfo.extract(record).ifPresent(preparedRead.requestInfos::add); } return preparedRead; }</code><technical_language>I recommend a suitable localized message in precondition</technical_language>

Target:
public PreparedRead prepareRead(List<DriverRecord> driverRecords) { requireNonNull(driverRecords, message.recordListNonNull()); OpcUaPreparedRead preparedRead = new OpcUaPreparedRead(); preparedRead.driverRecords = driverRecords; for (DriverRecord record : driverRecords) { OpcUaRequestInfo.extract(record).ifPresent(preparedRead.requestInfos::add); } return preparedRead; }
Source:
<code>protected boolean AddVmImages() { if (getVmTemplate().getDiskMap().size() > 0) { if (getVm().getstatus() != VMStatus.Down) { log.error("Cannot add images. VM is not Down"); throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } VmHandler.LockVm(getVmId()); for (DiskImage dit : getVmTemplate().getDiskMap().values()) { CreateSnapshotFromTemplateParameters tempVar = new CreateSnapshotFromTemplateParameters( dit.getit_guid(), getParameters().getVmStaticData().getId()); tempVar.setStorageDomainId(getStorageDomainId().getValue()); tempVar.setVmSnapshotId(getVmSnapshotId()); tempVar.setParentCommand(VdcActionType.AddVm); tempVar.setEntityId(getParameters().getEntityId()); tempVar.setParentParemeters(getParameters()); VdcReturnValueBase result = Backend.getInstance().runInternalAction( VdcActionType.CreateSnapshotFromTemplate, tempVar); getParameters().getImagesParameters().add(tempVar); <START> <END> if (!result.getSucceeded()) { throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } else { getTaskIdList().addAll(result.getInternalTaskIdList()); } } } return true; }</code><technical_language>additional newlines</technical_language>

Target:
protected boolean AddVmImages() { if (getVmTemplate().getDiskMap().size() > 0) { if (getVm().getstatus() != VMStatus.Down) { log.error("Cannot add images. VM is not Down"); throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } VmHandler.LockVm(getVmId()); for (DiskImage dit : getVmTemplate().getDiskMap().values()) { CreateSnapshotFromTemplateParameters tempVar = new CreateSnapshotFromTemplateParameters( dit.getId(), getParameters().getVmStaticData().getId()); tempVar.setStorageDomainId(getStorageDomainId().getValue()); tempVar.setVmSnapshotId(getVmSnapshotId()); tempVar.setParentCommand(VdcActionType.AddVm); tempVar.setEntityId(getParameters().getEntityId()); tempVar.setParentParemeters(getParameters()); VdcReturnValueBase result = Backend.getInstance().runInternalAction( VdcActionType.CreateSnapshotFromTemplate, tempVar); getParameters().getImagesParameters().add(tempVar); if (!result.getSucceeded()) { throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } else { getTaskIdList().addAll(result.getInternalTaskIdList()); } } } return true; }
Source:
<code>public void setUp() { mockConnectionFactory = mock(ConnectionFactory.class); mockConnection = mock(Connection.class); amqpConfig = new AmqpBrokerConfig(host, port, Optional.of(username), Optional.of(password), Optional.of(virtualHost), groupId, durable, consumerThreadPoolSize); try { when(mockConnectionFactory.newConnection()).thenReturn(mockConnection); } catch (IOException e) { fail("Can't create MockConnectionFactory"); } <START> amqpConnectionManager = new AmqpConnectionManager(amqpConfig) { <END> protected ConnectionFactory createConnectionFactory() { return mockConnectionFactory; } }; }</code><technical_language>refactor AmqpConnectionManager connection factory injected avoid modification of class is test</technical_language>

Target:
public void setUp() { mockConnection = mock(Connection.class); amqpConnectionManager = new AmqpConnectionManager(mockConnection); }
Source:
<code>public GeneralPurposeArtifactViewer() { orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); <START> orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); <END> initComponents(); }</code><technical_language>is a copy-paste error here. TSK_WEB_BOOKMARK is added orderingMap times. accidentally works out of currently supported artifact types DEFAULT_ORDERING, is fall if artifact type is in orderingMap</technical_language>

Target:
public GeneralPurposeArtifactViewer() { orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID(), DEFAULT_ORDERING); orderingMap.put(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID(), DEFAULT_ORDERING); initComponents(); }
Source:
<code>private IFolder copyExperiment(final String newName) { WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { @Override public void execute(IProgressMonitor monitor) throws CoreException { try { monitor.beginTask("", 1000); if (monitor.isCanceled()) { throw new OperationCanceledException(); } <START> fExperiment.copy(newName, fExperimentFolder, true); <END> if (monitor.isCanceled()) { throw new OperationCanceledException(); } } finally { monitor.done(); } } }; try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(operation); } catch (InterruptedException exception) { return null; } catch (InvocationTargetException exception) { MessageDialog.openError(getShell(), "", NLS.bind("", exception.getTargetException().getMessage())); return null; } catch (RuntimeException exception) { return null; } return fExperiment.getResource(); }</code><technical_language>extra space</technical_language>

Target:
private IFolder copyExperiment(final String newName) { WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { @Override public void execute(IProgressMonitor monitor) throws CoreException { try { monitor.beginTask("", 1000); if (monitor.isCanceled()) { throw new OperationCanceledException(); } fExperiment.copy(newName, true); if (monitor.isCanceled()) { throw new OperationCanceledException(); } } finally { monitor.done(); } } }; try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(operation); } catch (InterruptedException exception) { return null; } catch (InvocationTargetException exception) { MessageDialog.openError(getShell(), "", NLS.bind("", exception.getTargetException().getMessage())); return null; } catch (RuntimeException exception) { return null; } return fExperiment.getResource(); }
Source:
<code>public static void refreshPlugins() throws Exception { List<File> refreshedFiles = new ArrayList<File>(); List<Refreshable> rps = getWorkspace().getPlugins(Refreshable.class); boolean changed = false; List<RepositoryPlugin> changedRepos = new ArrayList<>(); for (Refreshable rp : rps) { if (rp.refresh()) { changed = true; File root = rp.getRoot(); if (root != null) refreshedFiles.add(root); if (rp instanceof RepositoryPlugin) { changedRepos.add((RepositoryPlugin) rp); } } } if (changed) { try { for (File file : refreshedFiles) { refreshFile(file); } for (Project p : Central.getWorkspace().getAllProjects()) { p.setChanged(); for (ModelListener l : getInstance().listeners) l.modelChanged(p); } for (RepositoryPlugin rp : changedRepos) { repositoriesViewRefresher.repositoryRefreshed(rp); } } catch (Exception e) { e.printStackTrace(); <START> throw new RuntimeException(e); <END> } } }</code><technical_language>refreshPlugin(Refreshable plugin) below? is call repositoriesViewRefresher.repositoryRefreshed(rp) if plugin is a RepositoryPlugin</technical_language>

Target:
public static void refreshPlugins() throws Exception { List<File> refreshedFiles = new ArrayList<File>(); List<Refreshable> rps = getWorkspace().getPlugins(Refreshable.class); boolean changed = false; boolean repoChanged = false; for (Refreshable rp : rps) { if (rp.refresh()) { changed = true; File root = rp.getRoot(); if (root != null) refreshedFiles.add(root); if (rp instanceof RepositoryPlugin) { repoChanged = true; } } } if (changed) { try { for (File file : refreshedFiles) { refreshFile(file); } for (Project p : Central.getWorkspace().getAllProjects()) { p.setChanged(); for (ModelListener l : getInstance().listeners) l.modelChanged(p); } if (repoChanged) { repositoriesViewRefresher.repositoriesRefreshed(); } } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } }
Source:
<code>public Node visitColumnCheckConstraint(SqlBaseParser.ColumnCheckConstraintContext context) { SqlBaseParser.ColumnDefinitionContext columnCtx = (SqlBaseParser.ColumnDefinitionContext) context.parent; String columnName = getIdentText(columnCtx.ident()); <START> return visitCheckConstraint(context.checkConstraint(), columnName); <END> }</code><technical_language>inlining concrete logic visitColumnCheckConstraint visitTableCheckConstraint instead of a nullable columnName a distinction in visitCheckConstraint. a unnecessary generalization</technical_language>

Target:
public Node visitColumnCheckConstraint(SqlBaseParser.ColumnCheckConstraintContext context) { SqlBaseParser.CheckConstraintContext ctx = context.checkConstraint(); String name = ctx.CONSTRAINT() != null ? getIdentText(ctx.name) : null; Expression expression = (Expression) visit(ctx.expression); String expressionStr = ExpressionFormatter.formatStandaloneExpression(expression); return new CheckColumnConstraint<>(name, null, expression, expressionStr); }
Source:
<code>public void onMapReady(@NonNull final MapboxMap mapboxMap) { <START> this.mapboxMap = mapboxMap; <END> mapboxMap.setStyle(Style.DARK, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { symbolManager = new SymbolManager(mapView, mapboxMap, style); symbolManager.setIconAllowOverlap(true); symbolManager.setTextAllowOverlap(true); symbol = symbolManager.create(new SymbolOptions() .withLatLng(new LatLng(60.169091, 24.939876)) .withIconImage(MAKI_ICON_HARBOR) .withIconSize(2.0f) .setDraggable(true)); symbolManager.addClickListener(new OnSymbolClickListener() { @Override public void onAnnotationClick(Symbol symbol) { Toast.makeText(SymbolListenerActivity.this, String.format("Symbol clicked"), Toast.LENGTH_SHORT).show(); symbol.setIconImage(MAKI_ICON_CAFE); symbolManager.update(symbol); } }); symbolManager.addLongClickListener((new OnSymbolLongClickListener() { @Override public void onAnnotationLongClick(Symbol symbol) { Toast.makeText(SymbolListenerActivity.this, String.format("Symbol long clicked"), Toast.LENGTH_SHORT).show(); symbol.setIconImage(MAKI_ICON_AIRPORT); symbolManager.update(symbol); } })); symbolManager.addDragListener(new OnSymbolDragListener() { @Override public void onAnnotationDragStarted(Symbol annotation) { } @Override public void onAnnotationDrag(Symbol symbol) { } @Override public void onAnnotationDragFinished(Symbol annotation) { } }); } }); }</code><technical_language>delete this. mapboxMap elsewhere</technical_language>

Target:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.DARK, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { symbolManager = new SymbolManager(mapView, mapboxMap, style); symbolManager.setIconAllowOverlap(true); symbolManager.setTextAllowOverlap(true); symbol = symbolManager.create(new SymbolOptions() .withLatLng(new LatLng(60.169091, 24.939876)) .withIconImage(MAKI_ICON_HARBOR) .withIconSize(2.0f) .setDraggable(true)); symbolManager.addClickListener(new OnSymbolClickListener() { @Override public void onAnnotationClick(Symbol symbol) { Toast.makeText(SymbolListenerActivity.this, String.format("Symbol clicked"), Toast.LENGTH_SHORT).show(); symbol.setIconImage(MAKI_ICON_CAFE); symbolManager.update(symbol); } }); symbolManager.addLongClickListener((new OnSymbolLongClickListener() { @Override public void onAnnotationLongClick(Symbol symbol) { Toast.makeText(SymbolListenerActivity.this, String.format("Symbol long clicked"), Toast.LENGTH_SHORT).show(); symbol.setIconImage(MAKI_ICON_AIRPORT); symbolManager.update(symbol); } })); symbolManager.addDragListener(new OnSymbolDragListener() { @Override public void onAnnotationDragStarted(Symbol annotation) { } @Override public void onAnnotationDrag(Symbol symbol) { } @Override public void onAnnotationDragFinished(Symbol annotation) { } }); } }); }
Source:
<code>public void start() { <START> if (getArguments().emailLink != null) { <END> setResult(Resource.<IdpResponse>forFailure(new IntentRequiredException( EmailLinkCatcherActivity.createIntent(getApplication(), getArguments()), RequestCodes.EMAIL_FLOW))); return; } EmailLinkPersistenceManager.getInstance().clearAllData(getApplication()); boolean supportPasswords = ProviderUtils.getConfigFromIdps( getArguments().providers, EmailAuthProvider.PROVIDER_ID) != null; List<String> accountTypes = getCredentialAccountTypes(); boolean willRequestCredentials = supportPasswords || accountTypes.size() > 0; if (getArguments().enableCredentials && willRequestCredentials) { setResult(Resource.<IdpResponse>forLoading()); GoogleApiUtils.getCredentialsClient(getApplication()) .request(new CredentialRequest.Builder() .setPasswordLoginSupported(supportPasswords) .setAccountTypes(accountTypes.toArray(new String[accountTypes.size()])) .build()) .addOnCompleteListener(new OnCompleteListener<CredentialRequestResponse>() { @Override public void onComplete(@NonNull Task<CredentialRequestResponse> task) { try { handleCredential( task.getResult(ApiException.class).getCredential()); } catch (ResolvableApiException e) { if (e.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { setResult(Resource.<IdpResponse>forFailure( new PendingIntentRequiredException( e.getResolution(), RequestCodes.CRED_HINT))); } else { startAuthMethodChoice(); } } catch (ApiException e) { startAuthMethodChoice(); } } }); } else { startAuthMethodChoice(); } }</code><technical_language>nit: TextUtils.isEmpty instead of a null check for strings</technical_language>

Target:
public void start() { if (!TextUtils.isEmpty(getArguments().emailLink)) { setResult(Resource.<IdpResponse>forFailure(new IntentRequiredException( EmailLinkCatcherActivity.createIntent(getApplication(), getArguments()), RequestCodes.EMAIL_FLOW))); return; } boolean supportPasswords = ProviderUtils.getConfigFromIdps( getArguments().providers, EmailAuthProvider.PROVIDER_ID) != null; List<String> accountTypes = getCredentialAccountTypes(); boolean willRequestCredentials = supportPasswords || accountTypes.size() > 0; if (getArguments().enableCredentials && willRequestCredentials) { setResult(Resource.<IdpResponse>forLoading()); GoogleApiUtils.getCredentialsClient(getApplication()) .request(new CredentialRequest.Builder() .setPasswordLoginSupported(supportPasswords) .setAccountTypes(accountTypes.toArray(new String[accountTypes.size()])) .build()) .addOnCompleteListener(new OnCompleteListener<CredentialRequestResponse>() { @Override public void onComplete(@NonNull Task<CredentialRequestResponse> task) { try { handleCredential( task.getResult(ApiException.class).getCredential()); } catch (ResolvableApiException e) { if (e.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { setResult(Resource.<IdpResponse>forFailure( new PendingIntentRequiredException( e.getResolution(), RequestCodes.CRED_HINT))); } else { startAuthMethodChoice(); } } catch (ApiException e) { startAuthMethodChoice(); } } }); } else { startAuthMethodChoice(); } }
Source:
<code>public void outputHTML(String file) throws FileNotFoundException, UnsupportedEncodingException { Date d = new Date(); <START> String outputfile = String.format("%s%d.html", file, d.getTime()); <END> PrintWriter writer = new PrintWriter(outputfile, "UTF-8"); writer.println("<!DOCTYPE html PUBLIC \"- writer.println("<html>"); writer.println("<head>"); writer.println("<title> Testing reading requirements and outputting them </title>"); writer.println("</head>"); writer.println("<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#EE0000\" alink=\"#808080\" vlink=\"#808080\">"); writer.println("<table border=\"\">"); writer.println("<tbody>"); for (DoorsTableRow dr : rawRows) { writer.println("<tr>"); for (Element e : dr.getRows()) { writer.println(e.toString()); } if (dr == getFirstRow()) { writer.println("<th width=\"100\" align=\"Left\">Combination</th>"); } else { writer.println(String.format("<td>%s</td>", dr.getType().toString())); } writer.println("</tr>"); } writer.println("</tbody>"); writer.println("</table>"); writer.println("</body>"); writer.println("</html>"); writer.close(); }</code><technical_language>Lib a utility do this</technical_language>

Target:
private void outputHTML(String file) throws FileNotFoundException, UnsupportedEncodingException { String outputfile = String.format("%s%s.html", file, Lib.getDateTimeString()); PrintWriter writer = new PrintWriter(outputfile, "UTF-8"); try { outputHTML(writer); } finally { writer.close(); } }
Source:
<code>public Response awaitResponse() throws Exception { <START> return Objects.requireNonNull(remoteFuture).get(); <END> }</code><technical_language>I advantage of requireNonNull()</technical_language>

Target:
public Response awaitResponse() throws Exception { return remoteFuture.get(); }
Source:
<code>private void takePictureInternal() { final TakePictureState state = new TakePictureState(); FluentFuture.from(preTakePicture(state)) .transformAsync(new AsyncFunction<Void, Void>() { @Override public ListenableFuture<Void> apply(Void v) throws Exception { return ImageCapture.this.issueTakePicture(); } }, mExecutor) .transformAsync(new AsyncFunction<Void, Void>() { @Override public ListenableFuture<Void> apply(Void v) throws Exception { return ImageCapture.this.postTakePicture(state); } }, mExecutor) .addCallback( new FutureCallback<Void>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(Throwable t) { Log.e(TAG, "takePictureInternal onFailure", t); <START> if (t instanceof IllegalCaptureStageException) { <END> ImageCaptureRequest request = mImageCaptureRequests.poll(); request.mListener.onError(UseCaseError.UNKNOWN_ERROR, t.getMessage(), t); issueImageCaptureRequests(); } } }, mExecutor); }</code><technical_language>need a generic exception (or other design) (or know) capture request is issued not. request is issued file next image capture request in onFailure() callback next request issued onImageAvailable(). For example, if failure happen "preTakePicture()", needs file next request. if failure happen "postTakePicture", file next request. depends capture request issued not. thought is define a flag in TakePictureState set flag capture request issued. depend flag issue next request not</technical_language>

Target:
private void takePictureInternal() { final TakePictureState state = new TakePictureState(); FluentFuture.from(preTakePicture(state)) .transformAsync(new AsyncFunction<Void, Void>() { @Override public ListenableFuture<Void> apply(Void v) throws Exception { return ImageCapture.this.issueTakePicture(state); } }, mExecutor) .transformAsync(new AsyncFunction<Void, Void>() { @Override public ListenableFuture<Void> apply(Void v) throws Exception { return ImageCapture.this.postTakePicture(state); } }, mExecutor) .addCallback( new FutureCallback<Void>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(Throwable t) { Log.e(TAG, "takePictureInternal onFailure", t); if (!state.mIsTakePictureRequestSubmitted) { ImageCaptureRequest request = mImageCaptureRequests.poll(); if (request != null) { request.callbackError(UseCaseError.UNKNOWN_ERROR, t.getMessage(), t); issueImageCaptureRequests(); } } } }, mExecutor); }
Source:
<code>private void toggleComments() { XWikiWebDriver driver = getDriver(); <START> List<WebElement> openCommentForm = driver.findElementsById("OpenCommentForm"); <END> if (openCommentForm.size() > 0) { openCommentForm.get(0).click(); } driver.waitUntilElementIsVisible(By.id("AddComment")); }</code><technical_language>need rely a list, a findElementById. findElementWithoutWaiting(By) a By.id button is supposed displayed</technical_language>

Target:
private void toggleComments() { String commentFormId = "AddComment"; String openFormId = "openCommentForm"; XWikiWebDriver driver = getDriver(); if (!driver.findElementWithoutWaiting(By.id(commentFormId)).isDisplayed()) { driver.findElementWithoutWaiting(By.id(openFormId)).click(); driver.waitUntilElementIsVisible(By.id(commentFormId)); } }
Source:
<code>public void setupChild(Configuration childConf) throws CheckstyleException { final String name = childConf.getName(); final Object module = moduleFactory.createModule(name); if (!(module instanceof AbstractCheck)) { throw new CheckstyleException( "TreeWalker is not allowed as a parent of " + name + " Please review 'Parent Module' section for this Check in web" <START> + " documentation if Checks is standard."); <END> } final AbstractCheck check = (AbstractCheck) module; check.contextualize(childContext); check.configure(childConf); check.init(); registerCheck(check); }</code><technical_language>Checks -> Check</technical_language>

Target:
public void setupChild(Configuration childConf) throws CheckstyleException { final String name = childConf.getName(); final Object module = moduleFactory.createModule(name); if (!(module instanceof AbstractCheck)) { throw new CheckstyleException( "TreeWalker is not allowed as a parent of " + name + " Please review 'Parent Module' section for this Check in web" + " documentation if Check is standard."); } final AbstractCheck check = (AbstractCheck) module; check.contextualize(childContext); check.configure(childConf); check.init(); registerCheck(check); }
Source:
<code>private void updateEnvVarsIfNecessary() { EnvironmentVariablesNodeProperty envVarsProp = Jenkins.getActiveInstance().getGlobalNodeProperties().get(EnvironmentVariablesNodeProperty.class); EnvVars globalEnvVars = envVarsProp.getEnvVars(); int newSystemEnvVarsHash = EnvVars.masterEnvVars.hashCode(); int newGlobalEnvVarsHash = globalEnvVars.hashCode(); if (newSystemEnvVarsHash != systemEnvVarsHash || newGlobalEnvVarsHash != globalHashVarsHash) { <START> this.envVars.clear(); <END> this.envVars.putAll(EnvVars.masterEnvVars); this.envVars.putAll(globalEnvVars); systemEnvVarsHash = newSystemEnvVarsHash; globalHashVarsHash = newGlobalEnvVarsHash; } }</code><technical_language>is EnvVars thread safe? multiple threads accessing this code, risk overwriting eachother</technical_language>

Target:
private synchronized void updateEnvVarsIfNecessary() { EnvironmentVariablesNodeProperty envVarsProp = Jenkins.getActiveInstance().getGlobalNodeProperties().get(EnvironmentVariablesNodeProperty.class); EnvVars globalEnvVars = envVarsProp.getEnvVars(); int newSystemEnvVarsHash = EnvVars.masterEnvVars.hashCode(); int newGlobalEnvVarsHash = globalEnvVars.hashCode(); if (newSystemEnvVarsHash != systemEnvVarsHash || newGlobalEnvVarsHash != globalHashVarsHash) { this.envVars.clear(); this.envVars.putAll(EnvVars.masterEnvVars); this.envVars.putAll(globalEnvVars); systemEnvVarsHash = newSystemEnvVarsHash; globalHashVarsHash = newGlobalEnvVarsHash; } }
Source:
<code>public void searchAudit() { if (NullChecker.isNullish(messageId) && NullChecker.isNullish(relatesTo)) { if (null != eventEndDate && null != eventEndDate && eventStartDate.getTime() > eventEndDate.getTime()) { <START> HelperUtil.addMessageError(null, "The EndTime should be greater than startTime."); <END> return; } auditRecordList = service.searchAuditRecord( selectedEventTypeList, NullChecker.isNotNullishIgnoreSpace(userId) ? userId.trim() : null, getRemoteHCIDFromSelectedOrgs(), eventStartDate, eventEndDate, getRemoteHcidOrgNameMap()); } else { auditRecordList = service.searchAuditRecordBasedOnMsgIdAndRelatesTo( NullChecker.isNotNullishIgnoreSpace(messageId) ? messageId.trim() : null, NullChecker.isNotNullishIgnoreSpace(relatesTo) ? relatesTo.trim() : null, getRemoteHcidOrgNameMap()); } if (NullChecker.isNullish(auditRecordList)) { auditMessage = AUDIT_RECORDS_NOT_FOUND; auditFound = false; } else { auditMessage = AUDIT_RECORDS_FOUND; auditFound = true; } }</code><technical_language>Optional: "The endTime greater startTime.". Better: retrieve msg a property file change modifying code</technical_language>

Target:
public void searchAudit() { if (NullChecker.isNullish(messageId) && NullChecker.isNullish(relatesTo)) { if (null != eventEndDate && null != eventEndDate && eventStartDate.after(eventEndDate)) { HelperUtil.addMessageError(null, HelperUtil.readPropertyAdminGui(KEY_STARTTIME_ENDTIME_MSG, DEFAULT_STARTTIME_ENDTIME_MSG)); return; } auditRecordList = service.searchAuditRecord( selectedEventTypeList, NullChecker.isNotNullishIgnoreSpace(userId) ? userId.trim() : null, getRemoteHCIDFromSelectedOrgs(), eventStartDate, eventEndDate, getRemoteHcidOrgNameMap()); } else { auditRecordList = service.searchAuditRecordBasedOnMsgIdAndRelatesTo( NullChecker.isNotNullishIgnoreSpace(messageId) ? messageId.trim() : null, NullChecker.isNotNullishIgnoreSpace(relatesTo) ? relatesTo.trim() : null, getRemoteHcidOrgNameMap()); } if (NullChecker.isNullish(auditRecordList)) { auditMessage = AUDIT_RECORDS_NOT_FOUND; auditFound = false; } else { auditMessage = AUDIT_RECORDS_FOUND; auditFound = true; } }
Source:
<code>public void testLoadOrderedPublicEvents_6() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_MAIN_GROUP_FILTER_KEY) .param("direction", FieldSearchFilter.ASC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); <START> String bodyResult = result.andReturn().getResponse().getContentAsString(); result.andExpect(status().isOk()); String expectedContentId = "EVN25"; int payloadSize = JsonPath.read(bodyResult, "$.payload.size()"); String extractedId = JsonPath.read(bodyResult, "$.payload[" + 0 + "].id"); Assert.assertEquals(expectedContentId, extractedId); <END> }</code><technical_language>Code style</technical_language>

Target:
public void testLoadOrderedPublicEvents_6() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_MAIN_GROUP_FILTER_KEY) .param("direction", FieldSearchFilter.ASC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); result.andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.payload.size()", is(9))) .andExpect(jsonPath("$.payload[0].id", is("EVN25"))); }
Source:
<code><START> protected void execute(final String schema, <END> final String table, final LocalDate startDate, final LocalDate endDate) { final SqlQuery sql = _ebeanServer.createSqlQuery( "select * from create_daily_partition(?::text, ?::text, ?::date, ?::date)") .setParameter(1, schema) .setParameter(2, table) .setParameter(3, startDate) .setParameter(4, endDate); sql.findOneOrEmpty().orElseThrow(() -> new IllegalStateException("Expected a single empty result.")); }</code><technical_language>nit: If wrap one, wrap all</technical_language>

Target:
protected void execute( final String schema, final String table, final LocalDate startDate, final LocalDate endDate ) { final SqlQuery sql = _ebeanServer.createSqlQuery( "select * from create_daily_partition(?::text, ?::text, ?::date, ?::date)") .setParameter(1, schema) .setParameter(2, table) .setParameter(3, startDate) .setParameter(4, endDate); sql.findOneOrEmpty().orElseThrow(() -> new PersistenceException("Expected a single empty result.")); }
Source:
<code>public long getCardinality() { try { response = searchBuilder .execute() .actionGet(); return response.getHits().getTotalHits(); } catch (Exception e) { <START> return 0; <END> } }</code><technical_language>if is a network other valid error, this method return 0? strange</technical_language>

Target:
public long getCardinality() { if (pos > 0) { return totalHits; } try { EsResponse res = client.search(index, type, query); Document hits = (Document) res.get("hits"); totalHits = hits.getInteger("total"); return totalHits; } catch (Exception e) { throw new EsIndexException(e); } }
Source:
<code>private void initCommandExecutor() { if (!cmdExecutorInitialized) { for (CommandEntity cmdEntity : coco.getCommandsWithCallBackEnabled()) { switch(cmdEntity.getCommandStatus()) { case ACTIVE_SYNC: case ACTIVE_ASYNC: <START> case NOT_STARTED: <END> coco.retrieveCommand(cmdEntity.getId()).setCommandStatus(CommandStatus.FAILED_RESTARTED); break; default: if (!cmdEntity.isCallBackNotified()) { addToCallBackMap(cmdEntity); } break; } } cmdExecutorInitialized = true; } }</code><technical_language>missing "ACTIVE"</technical_language>

Target:
private void initCommandExecutor() { if (!cmdExecutorInitialized) { for (CommandEntity cmdEntity : coco.getCommandsWithCallBackEnabled()) { if (!cmdEntity.isExecuted()) { coco.retrieveCommand(cmdEntity.getId()).setCommandStatus(CommandStatus.FAILED_RESTARTED); } else if (!cmdEntity.isCallBackNotified()) { addToCallBackMap(cmdEntity); } } cmdExecutorInitialized = true; } }