auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void pull_changesNewerThanOpenRevs() throws Exception { Bar bar1 = BarUtils.createBar(remoteDb, "Tom", 31); final ChangesResult changesResult1 = remoteDb.changes(null, 1000); Bar bar2 = BarUtils.updateBar(remoteDb, bar1.getId(), "Jerry", 41); final ChangesResult changesResult2 = remoteDb.changes(null, 1000); <START> System.out.println("compact"); <END> URI postURI = new URI(couchClient.getRootUri().toString() + "/_compact"); Assert.assertEquals(202, ClientTestUtils.executeHttpPostRequest(postURI, "")); CouchDbInfo info = couchClient.getDbInfo(); while(info.isCompactRunning()) { Thread.sleep(1000); info = couchClient.getDbInfo(); }; System.out.println("done compact"); PullReplication pullReplication = this.createPullReplication(); BasicPullStrategy customReplicator = new BasicPullStrategy(pullReplication, null, this.config); customReplicator.sourceDb = spy(customReplicator.sourceDb); doAnswer(new ChangesResultAnswer(changesResult1, changesResult2)) .when(customReplicator.sourceDb). changes((Replication.Filter) anyObject(), anyObject(), anyInt()); System.out.println("running...."); customReplicator.run(); System.out.println("done...."); Map m = datastore.getDocument(bar1.getId()).asMap(); System.out.println(m); Assert.assertEquals(41, m.get("age")); Assert.assertEquals("Jerry", m.get("name")); System.out.println("done asserts"); }</code><technical_language>sync tests use, java.util.Logger more appropriate</technical_language>

Target:
public void pull_changesNewerThanOpenRevs() throws Exception { Bar bar1 = BarUtils.createBar(remoteDb, "Tom", 31); final ChangesResult changesResult1 = remoteDb.changes(null, 1000); Bar bar2 = BarUtils.updateBar(remoteDb, bar1.getId(), "Jerry", 41); final ChangesResult changesResult2 = remoteDb.changes(null, 1000); URI postURI = new URI(couchClient.getRootUri().toString() + "/_compact"); Assert.assertEquals(202, ClientTestUtils.executeHttpPostRequest(postURI, "")); CouchDbInfo info = couchClient.getDbInfo(); while(info.isCompactRunning()) { Thread.sleep(1000); info = couchClient.getDbInfo(); }; PullReplication pullReplication = this.createPullReplication(); BasicPullStrategy customReplicator = new BasicPullStrategy(pullReplication, null, this.config); customReplicator.sourceDb = spy(customReplicator.sourceDb); doAnswer(new ChangesResultAnswer(changesResult1, changesResult2)) .when(customReplicator.sourceDb). changes((Replication.Filter) anyObject(), anyObject(), anyInt()); customReplicator.run(); Map m = datastore.getDocument(bar1.getId()).asMap(); Assert.assertEquals(41, m.get("age")); Assert.assertEquals("Jerry", m.get("name")); }
Source:
<code>public void loadInputs(String simulationName, Map<String, String> valuesMap) { this.simulationNameItem.setValue(simulationName); final Map<String, String> conflictMap = new HashMap<String, String>(); StringBuilder sb = new StringBuilder(); for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { final AbstractSourceLayout source = (AbstractSourceLayout) canvas; final String inputValue = valuesMap.get(source.getName()); if (inputValue != null) { <START> if (source.getValue() == null || source.getValue().isEmpty() || source.isModifiableRelaunchedSimulation()) { <END> if (source.isOptional()) { source.enableInputRelaunchedSimulation(); } source.setValue(inputValue); } else { conflictMap.put(source.getName(), inputValue); } } } } if (!conflictMap.isEmpty()) { SC.ask("The following fields already have a value.<br />" + "Do you want to replace them?<br />" + "Fields: " + conflictMap.keySet(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { AbstractSourceLayout source = (AbstractSourceLayout) canvas; source.setValue(conflictMap.get(source.getName())); } } } } }); } if (sb.length() > 0) { Layout.getInstance().setWarningMessage(sb.toString()); } }</code><technical_language>Indentation right</technical_language>

Target:
public void loadInputs(String simulationName, Map<String, String> valuesMap) { this.simulationNameItem.setValue(simulationName); final Map<String, String> conflictMap = new HashMap<String, String>(); StringBuilder sb = new StringBuilder(); for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { final AbstractSourceLayout source = (AbstractSourceLayout) canvas; final String inputValue = valuesMap.get(source.getName()); if (inputValue != null) { if (source.getValue() == null || source.getValue().isEmpty() || source.isValueModifiable()) { if (source.isOptional()) { source.enableInput(); } source.setValue(inputValue); } else { conflictMap.put(source.getName(), inputValue); } } } } if (!conflictMap.isEmpty()) { SC.ask("The following fields already have a value.<br />" + "Do you want to replace them?<br />" + "Fields: " + conflictMap.keySet(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { AbstractSourceLayout source = (AbstractSourceLayout) canvas; source.setValue(conflictMap.get(source.getName())); } } } } }); } if (sb.length() > 0) { Layout.getInstance().setWarningMessage(sb.toString()); } }
Source:
<code>protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getNetworkDAO().update(getNetwork()); for (NetworkCluster clusterAttachment : getNetworkClusterDAO().getAllForNetwork(getNetwork().getId())) { NetworkClusterHelper.setStatus(clusterAttachment.getClusterId(), getNetwork()); } if (networkChangedToNonVmNetwork()) { removeVnicProfiles(); } return null; } }); if (!getNetwork().isExternal()) { if (NetworkHelper.setupNetworkSupported(getStoragePool().getcompatibility_version())) { applyNetworkChangesToHosts(); } else { List<VdsNetworkInterface> nics = getDbFacade().getInterfaceDao().getVdsInterfacesByNetworkId(getNetwork().getId()); <START> if (nics != null && !nics.isEmpty()) { <END> AuditLogDirector.log(this, AuditLogType.MULTI_UPDATE_NETWORK_NOT_POSSIBLE); } } } setSucceeded(true); }</code><technical_language>i nics null, check for emptiness</technical_language>

Target:
protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getNetworkDAO().update(getNetwork()); for (NetworkCluster clusterAttachment : getNetworkClusterDAO().getAllForNetwork(getNetwork().getId())) { NetworkClusterHelper.setStatus(clusterAttachment.getClusterId(), getNetwork()); } if (networkChangedToNonVmNetwork()) { removeVnicProfiles(); } return null; } }); if (!getNetwork().isExternal()) { if (NetworkHelper.setupNetworkSupported(getStoragePool().getcompatibility_version())) { applyNetworkChangesToHosts(); } else { List<VdsNetworkInterface> nics = getDbFacade().getInterfaceDao().getVdsInterfacesByNetworkId(getNetwork().getId()); if (!nics.isEmpty()) { AuditLogDirector.log(this, AuditLogType.MULTI_UPDATE_NETWORK_NOT_POSSIBLE); } } } setSucceeded(true); }
Source:
<code>public boolean hasCorrectVolType(Guid storagePoolId, Guid storageDomainId, Guid imageGroupId, Guid imageId) { DiskImage dbImage = getSnapshotLeaf(imageGroupId); DiskImage vdsmImage = getVolumeInfoFromVdsm(storagePoolId, storageDomainId, imageGroupId, imageId); if (dbImage.getId().equals(vdsmImage.getId())) { return VolType.LEAF == vdsmImage.getVolType(); } return <START> true; <END> }</code><technical_language>replaced with: return dbImage.getId().equals(vdsmImage.getId()) ? VolType.LEAF == vdsmImage.getVolType() : true; is a must, a matter of style</technical_language>

Target:
public boolean hasCorrectVolType(Guid storagePoolId, Guid storageDomainId, Guid imageGroupId, Guid imageId) { DiskImage dbImage = getSnapshotLeaf(imageGroupId); DiskImage vdsmImage = getVolumeInfoFromVdsm(storagePoolId, storageDomainId, imageGroupId, imageId); return dbImage.getId().equals(vdsmImage.getId()) ? VolType.LEAF == vdsmImage.getVolType() : true; }
Source:
<code>void setCurrentControllerInfo() { if (Build.VERSION.SDK_INT >= 28) { } <START> else if (Build.VERSION.SDK_INT >= 24) { <END> MediaSessionImpl sessionImpl = mSessionImpl != null ? mSessionImpl.get() : null; if (sessionImpl != null) { String packageName = sessionImpl.getCallingPackage(); if (TextUtils.isEmpty(packageName)) { packageName = LEGACY_CONTROLLER; } sessionImpl.setCurrentControllerInfo( new RemoteUserInfo(packageName, UNKNOWN_PID, UNKNOWN_UID)); } } else { MediaSessionImpl sessionImpl = mSessionImpl != null ? mSessionImpl.get() : null; if (sessionImpl != null) { sessionImpl.setCurrentControllerInfo( new RemoteUserInfo(LEGACY_CONTROLLER, UNKNOWN_PID, UNKNOWN_UID)); } } }</code><technical_language>Remove</technical_language>

Target:
void setCurrentControllerInfo() { if (Build.VERSION.SDK_INT >= 28) { return; } MediaSessionImpl sessionImpl = mSessionImpl != null ? mSessionImpl.get() : null; if (sessionImpl == null) { return; } String packageName; if (Build.VERSION.SDK_INT >= 24) { packageName = sessionImpl.getCallingPackage(); if (TextUtils.isEmpty(packageName)) { packageName = LEGACY_CONTROLLER; } } else { packageName = LEGACY_CONTROLLER; } sessionImpl.setCurrentControllerInfo(new RemoteUserInfo( packageName, UNKNOWN_PID, UNKNOWN_UID)); }
Source:
<code>public static int getArity(@NotNull ErlangSpecification o) { ErlangSpecificationStub stub = o.getStub(); if (stub != null) return stub.getArity(); <START> ErlangFunTypeSigs sigs = getFunTypeSigs(o); <END> List<ErlangTypeSig> typeSigs = sigs != null ? sigs.getTypeSigList() : ContainerUtil.<ErlangTypeSig>emptyList(); ErlangTypeSig sig = typeSigs.size() > 0 ? typeSigs.get(0) : null; return sig != null ? sig.getFunType().getFunTypeArguments().getTypeList().size() : -1; }</code><technical_language>org.intellij.erlang.psi.ErlangSpecification#getSignature instead</technical_language>

Target:
public static int getArity(@NotNull ErlangSpecification o) { ErlangSpecificationStub stub = o.getStub(); if (stub != null) return stub.getArity(); ErlangFunTypeSigs signature = getSignature(o); List<ErlangTypeSig> typeSigs = signature != null ? signature.getTypeSigList() : ContainerUtil.<ErlangTypeSig>emptyList(); ErlangTypeSig sig = typeSigs.size() > 0 ? typeSigs.get(0) : null; return sig != null ? sig.getFunType().getFunTypeArguments().getTypeList().size() : -1; }
Source:
<code>protected boolean validate() { if (getParameters() == null || getParameters().getAgent() == null || getParameters().getAgent().getId() == null) { return failValidation(EngineMessage.VDS_REMOVE_FENCE_AGENT_ID_REQUIRED); } if <START> (getVds().isPmEnabled()) <END> { List<FenceAgent> fenceAgents = fenceAgentDao.getFenceAgentsForHost(getVdsId()); if (fenceAgents.size() == 1) { return failValidation(EngineMessage.VDS_REMOVE_LAST_FENCE_AGENT_PM_ENABLED); } } return super.validate(); }</code><technical_language>IINW, this call potential produce NPE, check for existence of host</technical_language>

Target:
protected boolean validate() { if (getParameters() == null || getParameters().getAgent() == null || getParameters().getAgent().getId() == null) { return failValidation(EngineMessage.VDS_REMOVE_FENCE_AGENT_ID_REQUIRED); } VDS host = getVds(); if (host != null && host.isPmEnabled()) { List<FenceAgent> fenceAgents = fenceAgentDao.getFenceAgentsForHost(getVdsId()); if (fenceAgents.size() == 1) { return failValidation(EngineMessage.VDS_REMOVE_LAST_FENCE_AGENT_PM_ENABLED); } } return super.validate(); }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { final Intent intent = getIntent(); final String url = intent.getStringExtra(Intent.EXTRA_TEXT); switch (item.getItemId()) { case R.id.open: Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); break; case R.id.copy_link: copyLink(url); break; case R.id.download: <START> downloadImage(url); <END> default: return super.onOptionsItemSelected(item); } return true; }</code><technical_language>is a break; missing here</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { final Intent intent = getIntent(); final String url = intent.getStringExtra(Intent.EXTRA_TEXT); switch (item.getItemId()) { case R.id.open: Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); break; case R.id.copy_link: copyLink(url); break; case R.id.download: if (ActivityCompat.checkSelfPermission(PhotoViewActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { allowPermission(); } else { downloadImage(url); } break; default: return super.onOptionsItemSelected(item); } return true; }
Source:
<code>private boolean mustCheckPasswordValidity() { <START> return Framework.getProperty(VALIDATE_PASSWORD_PARAM,"false").equals("true"); <END> }</code><technical_language>Boolean.parseBoolean equals("true")</technical_language>

Target:
private boolean mustCheckPasswordValidity() { return Boolean.parseBoolean(Framework.getProperty(VALIDATE_PASSWORD_PARAM,"false")); }
Source:
<code>private AdvancedViatraQueryEngine createEngine() { boolean wildcardMode = ViatraQueryGUIPlugin.getDefault().getPreferenceStore() .getBoolean(PreferenceConstants.WILDCARD_MODE); boolean dynamicEMFMode = ViatraQueryGUIPlugin.getDefault().getPreferenceStore() .getBoolean(PreferenceConstants.DYNAMIC_EMF_MODE); try { BaseIndexOptions options = new BaseIndexOptions(dynamicEMFMode, wildcardMode); QueryScope scope = new EMFScope(key.getNotifier(), options); <START> <END> Map<QueryHintOption, Object> mappings = new HashMap<QueryHintOption, Object>(); mappings.put(ReteHintOptions.deleteRederiveEvaluation, true); QueryEvaluationHint evaluationHint = new QueryEvaluationHint(mappings, new ReteBackendFactory()); ViatraQueryEngineOptions engineOptions = ViatraQueryEngineOptions.defineOptions().withDefaultHint(evaluationHint).build(); AdvancedViatraQueryEngine engine = AdvancedViatraQueryEngine.createUnmanagedEngine(scope); return engine; } catch (ViatraQueryException e) { logger.log(new Status(IStatus.ERROR, ViatraQueryGUIPlugin.PLUGIN_ID, "Could not retrieve ViatraQueryEngine for " + key.getNotifier(), e)); return null; } }</code><technical_language>This modification belong here, DRed-specific Gerrit change instead</technical_language>

Target:
private AdvancedViatraQueryEngine createEngine() { boolean wildcardMode = ViatraQueryGUIPlugin.getDefault().getPreferenceStore() .getBoolean(PreferenceConstants.WILDCARD_MODE); boolean dynamicEMFMode = ViatraQueryGUIPlugin.getDefault().getPreferenceStore() .getBoolean(PreferenceConstants.DYNAMIC_EMF_MODE); try { BaseIndexOptions options = new BaseIndexOptions(dynamicEMFMode, wildcardMode); QueryScope scope = new EMFScope(key.getNotifier(), options); AdvancedViatraQueryEngine engine = AdvancedViatraQueryEngine.createUnmanagedEngine(scope); return engine; } catch (ViatraQueryException e) { logger.log(new Status(IStatus.ERROR, ViatraQueryGUIPlugin.PLUGIN_ID, "Could not retrieve ViatraQueryEngine for " + key.getNotifier(), e)); return null; } }
Source:
<code>private Object evalShaHandleReloadScript(MethodContext context, List<String> keys, List<String> argv) { try { return jedis.evalsha(context.getSha1(), keys, argv); } catch (JedisDataException e) { <START> if (e.getMessage().contains("NOSCRIPT")) { <END> final String sha2 = jedis.scriptLoad(context.getLuaContext().getRenderedLuaString()); if (!sha2.equals(context.getSha1())) { throw new IllegalStateException("sha should match but they did not"); } return jedis.evalsha(context.getSha1(), keys, argv); } else { throw e; } } }</code><technical_language>potential NPE if message is null</technical_language>

Target:
private Object evalShaHandleReloadScript(MethodContext context, List<String> keys, List<String> argv) { try { return jedis.evalsha(context.getSha1(), keys, argv); } catch (JedisDataException e) { if (e.getMessage() != null && e.getMessage().contains("NOSCRIPT")) { final String newSha = jedis.scriptLoad(context.getLuaContext().getRenderedLuaString()); if (!newSha.equals(context.getSha1())) { throw new IllegalStateException("sha should match but they did not"); } return jedis.evalsha(context.getSha1(), keys, argv); } else { throw e; } } }
Source:
<code>public Map<String, String> getTimeBoundaryForTable(String table) throws Exception { final String url = String.format(TIME_BOUNDARY_API_TEMPLATE, getBrokerHost(table), table); String responseBody = sendHttpGet(url); JSONObject resp = JSONObject.parseObject(responseBody); Map<String, String> timeBoundary = new HashMap<>(); <START> if (resp.containsKey("timeColumnName")) { <END> timeBoundary.put("timeColumnName", resp.getString("timeColumnName")); } if (resp.containsKey("timeColumnValue")) { timeBoundary.put("timeColumnValue", resp.getString("timeColumnValue")); } return timeBoundary; }</code><technical_language>strings public constants. I in other classes well</technical_language>

Target:
public Map<String, String> getTimeBoundaryForTable(String table) throws Exception { final String url = String.format(TIME_BOUNDARY_API_TEMPLATE, getBrokerHost(table), table); String responseBody = sendHttpGet(url); JSONObject response = JSONObject.parseObject(responseBody); ImmutableMap.Builder<String, String> timeBoundaryBuilder = ImmutableMap.builder(); if (response.containsKey(TIME_COLUMN_NAME)) { timeBoundaryBuilder.put(TIME_COLUMN_NAME, response.getString(TIME_COLUMN_NAME)); } if (response.containsKey(TIME_COLUMN_VALUE)) { timeBoundaryBuilder.put(TIME_COLUMN_VALUE, response.getString(TIME_COLUMN_VALUE)); } return timeBoundaryBuilder.build(); }
Source:
<code>public GetRevisionTaskThreaded(CouchDB sourceDb, List<BulkGetRequest> requests, boolean pullAttachmentsInline) { Preconditions.checkNotNull(sourceDb, "sourceDb cannot be null"); Preconditions.checkNotNull(requests, "requests cannot be null"); for (BulkGetRequest request : requests) { Preconditions.checkNotNull(request.id, "id cannot be null"); Preconditions.checkNotNull(request.revs, "revs cannot be null"); } this.sourceDb = sourceDb; this.requests.addAll(requests); this.pullAttachmentsInline = pullAttachmentsInline; this.completionService = new QueuingExecutorCompletionService<BulkGetRequest, DocumentRevsList>(executorService, this.requests, threads + 1) { @Override public DocumentRevsList executeRequest(BulkGetRequest request) { <START> Thread.currentThread().setName("GetRevisionThread: "+GetRevisionTaskThreaded.this.sourceDb.getIdentifier()); <END> return new DocumentRevsList(GetRevisionTaskThreaded.this.sourceDb.getRevisions (request.id, request.revs, request.atts_since, GetRevisionTaskThreaded.this.pullAttachmentsInline)); } }; }</code><technical_language>catch SecurityException thrown call setName() set a custom thread name in case. I setName() fail Android, desktop Java a security manager</technical_language>

Target:
public GetRevisionTaskThreaded(CouchDB sourceDb, List<BulkGetRequest> requests, boolean pullAttachmentsInline) { Preconditions.checkNotNull(sourceDb, "sourceDb cannot be null"); Preconditions.checkNotNull(requests, "requests cannot be null"); for (BulkGetRequest request : requests) { Preconditions.checkNotNull(request.id, "id cannot be null"); Preconditions.checkNotNull(request.revs, "revs cannot be null"); } this.sourceDb = sourceDb; this.requests.addAll(requests); this.pullAttachmentsInline = pullAttachmentsInline; this.completionService = new QueuingExecutorCompletionService<BulkGetRequest, DocumentRevsList>(executorService, this.requests, threads + 1) { @Override public DocumentRevsList executeRequest(BulkGetRequest request) { try { Thread.currentThread().setName("GetRevisionThread: " + GetRevisionTaskThreaded.this.sourceDb.getIdentifier()); } catch (SecurityException e){ logger.log(Level.WARNING, "Could not rename pull strategy pool thread", e); } return new DocumentRevsList(GetRevisionTaskThreaded.this.sourceDb.getRevisions (request.id, request.revs, request.atts_since, GetRevisionTaskThreaded.this.pullAttachmentsInline)); } }; }
Source:
<code>private static Stream<Arguments> sameStateRepositories() { Set<Repository<?, ?>> repositories = ImmutableSet.of(new ProjectAggregateRepository(), new ProjectProjectionRepo(), new ProjectCreationRepository()); Set<Repository<?, ?>> sameStateRepositories = ImmutableSet.of(new AnotherProjectAggregateRepository(), new FinishedProjectProjectionRepo(), new ProjectRemovalRepository()); Set<List<Repository<?, ?>>> cartesianProduct = Sets.cartesianProduct(repositories, sameStateRepositories); Stream.Builder<Arguments> builder = Stream.builder(); <START> for (List<Repository<?, ?>> list : cartesianProduct) { <END> Repository<?, ?> firstRepo = list.get(0); Repository<?, ?> secondRepo = list.get(1); RepositoryPair pair = new RepositoryPair(firstRepo, secondRepo); builder.add(Arguments.of(pair)); } return builder.build(); }</code><technical_language>stream API instead of a loop</technical_language>

Target:
private static Stream<Arguments> sameStateRepositories() { Set<Repository<?, ?>> repositories = ImmutableSet.of(new ProjectAggregateRepository(), new ProjectProjectionRepo(), new ProjectCreationRepository()); Set<Repository<?, ?>> sameStateRepositories = ImmutableSet.of(new AnotherProjectAggregateRepository(), new FinishedProjectProjectionRepo(), new ProjectRemovalRepository()); Set<List<Repository<?, ?>>> cartesianProduct = Sets.cartesianProduct(repositories, sameStateRepositories); Stream<Arguments> result = cartesianProduct.stream() .map(repos -> Arguments.of(repos.get(0), repos.get(1))); return result; }
Source:
<code>public boolean registerAidGroupForService(int userId, ComponentName service, AidGroup aidGroup) throws RemoteException { NfcPermissions.validateUserId(userId); NfcPermissions.enforceUserPermissions(mContext); if (!isServiceRegistered(userId, service)) { return false; } <START> if (mServiceCache.registerAidGroupForService(userId, Binder.getCallingUid(), service, aidGroup)) { notifyPreferredPaymentChanged(); return true; } else return false; <END> }</code><technical_language>nit: prefer if (condition returns false) { return false; } return true;</technical_language>

Target:
public boolean registerAidGroupForService(int userId, ComponentName service, AidGroup aidGroup) throws RemoteException { NfcPermissions.validateUserId(userId); NfcPermissions.enforceUserPermissions(mContext); if (!isServiceRegistered(userId, service)) { return false; } if (!mServiceCache.registerAidGroupForService(userId, Binder.getCallingUid(), service, aidGroup)) { return false; } NfcService.getInstance().onPreferredPaymentChanged( NfcAdapter.PREFERRED_PAYMENT_UPDATED); return true; }
Source:
<code>public void testOpenShiftConnection() { OpenShiftExplorerView osExplorer = new OpenShiftExplorerView(); osExplorer.open(); try { <START> OpenShift2Connection connection = osExplorer.getOpenShift2Connection(OPENSHIFT_USER_NAME); <END> connection.refresh(); try { new WaitUntil(new ShellWithTextIsAvailable("Problem occurred"), TimePeriod.getCustom(30)); fail("Problem dialog occured when refreshing OpenShift connection"); } catch (WaitTimeoutExpiredException ex) { } try { treeViewerHandler.getTreeItem(connection.getTreeItem(), "OpenShift sample project"); } catch (JFaceLayerException ex) { fail("Could not find deployed sample OpenShift project"); } } catch (RedDeerException ex) { fail("Could not open OpenShift connection for " + OPENSHIFT_USER_NAME + " ended with exception: " + ex.getMessage()); } }</code><technical_language>expert in here, Openshift2Connection do CDK</technical_language>

Target:
public void testOpenShiftConnection() { startServerAdapter(); OpenShiftExplorerView osExplorer = new OpenShiftExplorerView(); osExplorer.open(); try { OpenShift3Connection connection = osExplorer.getOpenShift3Connection(OPENSHIFT_SERVER, OPENSHIFT_USER_NAME); connection.refresh(); try { new WaitUntil(new ShellWithTextIsAvailable("Problem occurred"), TimePeriod.getCustom(30)); fail("Problem dialog occured when refreshing OpenShift connection"); } catch (WaitTimeoutExpiredException ex) { } try { treeViewerHandler.getTreeItem(connection.getTreeItem(), "OpenShift sample project"); } catch (JFaceLayerException ex) { fail("Could not find deployed sample OpenShift project"); } } catch (RedDeerException ex) { fail("Could not open OpenShift connection for " + OPENSHIFT_USER_NAME + " ended with exception: " + ex.getMessage()); } }
Source:
<code>private static CommandLine parseArgs(String[] args) throws ParseException { Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("topic") .withDescription("topic to post to") .hasArg() .withArgName("<topic>") .withType(String.class) .create("t")); options.addOption(OptionBuilder.withLongOpt("messages") .withDescription("number of messages per producer to post") .hasArg() .withArgName("<num_messages>") .withType(Number.class) .create("m")); options.addOption(OptionBuilder.withLongOpt("producers") .withDescription("number of producer threads") .hasArg() .withArgName("<num_producer_threads>") .withType(Number.class) .create("p")); options.addOption(OptionBuilder.withLongOpt("type") <START> .withDescription("type of producer") <END> .hasArg() .withArgName("<type>") .withType(String.class) .create("type")); CommandLineParser parser = new GnuParser(); return parser.parse(options, args); }</code><technical_language>acceptable values</technical_language>

Target:
private static CommandLine parseArgs(String[] args) throws ParseException { Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("topic") .withDescription("topic to post to") .hasArg() .withArgName("<topic>") .withType(String.class) .create("t")); options.addOption(OptionBuilder.withLongOpt("messages") .withDescription("number of messages per producer to post") .hasArg() .withArgName("<num_messages>") .withType(Number.class) .create("m")); options.addOption(OptionBuilder.withLongOpt("producers") .withDescription("number of producer threads") .hasArg() .withArgName("<num_producer_threads>") .withType(Number.class) .create("p")); options.addOption(OptionBuilder.withLongOpt("type") .withDescription("type of producer - [json, binary]") .hasArg() .withArgName("<type>") .withType(String.class) .create("type")); CommandLineParser parser = new GnuParser(); return parser.parse(options, args); }
Source:
<code>public Observable<ArrayList<DepictedItem>> getParentQIDs(String qid) throws IOException { String queryString = FileUtils.readFromResource("/queries/parentclasses_query.rq"); String query = queryString. replace("${QID}", qid) .replace("${LANG}", "\""+Locale.getDefault().getLanguage()+"\""); Timber.e(query); HttpUrl.Builder urlBuilder = HttpUrl .parse(sparqlQueryUrl) .newBuilder() .addQueryParameter("query", query) .addQueryParameter("format", "json"); Request request = new Request.Builder() .url(urlBuilder.build()) .build(); return Observable.fromCallable(() -> { Response response = okHttpClient.newCall(request).execute(); try { String json = response.body().string(); JSONObject jsonObject = new JSONObject(json); ArrayList<DepictedItem> subItems = new ArrayList<>(); <START> JSONObject results = (JSONObject) jsonObject.get("results"); JSONArray bindings = (JSONArray) results.get("bindings"); for (int i = 0; i < bindings.length(); i++) { Timber.e(bindings.get(i).getClass().toString()); JSONObject object = (JSONObject) bindings.get(i); JSONObject parentClassLabel = (JSONObject) object.get("parentClassLabel"); if (parentClassLabel.get("value") != null) { String labelString = parentClassLabel.getString("value"); JSONObject parentClass = (JSONObject) object.get("parentClass"); if (parentClass.get("value") != null) { String entityId = parentClass.getString("value"); entityId = entityId.substring(entityId.lastIndexOf("/") + 1); subItems.add(new DepictedItem(labelString, "", "", false, entityId)); <END> } } } return subItems; } catch (Exception e) { return new ArrayList<DepictedItem>(); } }).doOnError(throwable -> { Timber.e("line578"+throwable.toString()); }); }</code><technical_language>Define concrete classes</technical_language>

Target:
public Observable<List<DepictedItem>> getParentQIDs(String qid) throws IOException { return depictedItemsFrom(sparqlQuery(qid, "/queries/parentclasses_query.rq")); }
Source:
<code>private void attachPreviewHandler() { detachPreviewHandler(); preview_ = Event.addNativePreviewHandler(new NativePreviewHandler() { @Override public void onPreviewNativeEvent(NativePreviewEvent preview) { if (preview.getTypeInt() == Event.ONMOUSEMOVE) { NativeEvent event = preview.getNativeEvent(); coordinates_ = new MouseCoordinates( event.getClientX(), event.getClientY()); } else if (preview.getTypeInt() == Event.ONKEYDOWN) { coordinates_ = null; } <START> timer_.schedule(DELAY_MS); <END> } }); }</code><technical_language>do want schedule timer for _all_ types of native events</technical_language>

Target:
private void attachPreviewHandler() { detachPreviewHandler(); preview_ = Event.addNativePreviewHandler(new NativePreviewHandler() { @Override public void onPreviewNativeEvent(NativePreviewEvent preview) { if (preview.getTypeInt() == Event.ONMOUSEMOVE) { NativeEvent event = preview.getNativeEvent(); coordinates_ = new MouseCoordinates( event.getClientX(), event.getClientY()); ready_ = true; } else if (preview.getTypeInt() == Event.ONKEYDOWN) { coordinates_ = null; ready_ = true; if (preview.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) suppressed_ = true; } } }); }
Source:
<code>public PacketCubeBlockChange(Cube cube, TShortCollection localAddresses) { this.cubePos = cube.getCoords(); this.localAddresses = localAddresses.toArray(); this.blockStates = new IBlockState[localAddresses.size()]; int i = localAddresses.size() - 1; TIntSet xzAddresses = new TIntHashSet(); for (; i >= 0; i--) { int localAddress = this.localAddresses[i]; int x = AddressTools.getLocalX(localAddress); int y = AddressTools.getLocalY(localAddress); int z = AddressTools.getLocalZ(localAddress); this.blockStates[i] = cube.getBlockState(x, y, z); <START> xzAddresses.add(x | z << 4); END> } this.heightValues = new int[xzAddresses.size()]; i = 0; TIntIterator it = xzAddresses.iterator(); while (it.hasNext()) { int v = it.next(); int height = cube.getColumn().getOpacityIndex().getTopBlockY(blockToLocal(v), blockToCube(v)); v |= height << 8; heightValues[i] = v; i++; } }</code><technical_language>This x | z << 4 is in height map, z shifted Cube.BIT_SIZE (5 for size = 32) bits "x" "z" overlap others</technical_language>

Target:
public PacketCubeBlockChange(Cube cube, TShortCollection localAddresses) { this.cubePos = cube.getCoords(); this.localAddresses = localAddresses.toArray(); this.blockStates = new IBlockState[localAddresses.size()]; int i = localAddresses.size() - 1; TIntSet xzAddresses = new TIntHashSet(); for (; i >= 0; i--) { int localAddress = this.localAddresses[i]; int x = AddressTools.getLocalX(localAddress); int y = AddressTools.getLocalY(localAddress); int z = AddressTools.getLocalZ(localAddress); this.blockStates[i] = cube.getBlockState(x, y, z); xzAddresses.add(AddressTools.getLocalAddress(x, z)); } this.heightValues = new int[xzAddresses.size()]; i = 0; TIntIterator it = xzAddresses.iterator(); while (it.hasNext()) { int v = it.next(); int height = cube.getColumn().getOpacityIndex().getTopBlockY(blockToLocal(v), blockToCube(v)); v |= height << 8; heightValues[i] = v; i++; } }
Source:
<code>public void remoteInit() { try { exchangeMetaData = ((CoinbeneMarketDataService) marketDataService).getMetadata(); } catch (IOException e) { <START> LOG.error("Retrieving MetaData for Coinbene failed", e); <END> } }</code><technical_language>This logged. IOException through</technical_language>

Target:
public void remoteInit() throws IOException, ExchangeException { exchangeMetaData = ((CoinbeneMarketDataService) marketDataService).getMetadata(); }
Source:
<code>private void putInternal(K key, V value, EntityTag eTag) { if (service.isRunning()) { try { String target = buildUrl(service.cacheName, key); Invocation put = null; <START> if (eTag != null) { <END> put = service.getHttpClient().target(target).request().accept(service.getContentType()) .header("If-Match", eTag.getValue()) .buildPut(Entity.entity(encodeObject(value), service.getContentType())); } else { put = service.getHttpClient().target(target).request().accept(service.getContentType()) .buildPut(Entity.entity(encodeObject(value), service.getContentType())); } Response response = put.invoke(); int status = response.getStatus(); String reason = response.getStatusInfo().getReasonPhrase(); response.close(); if (status != Status.OK.getStatusCode() && status != Status.CREATED.getStatusCode() && status != Status.NO_CONTENT.getStatusCode()) { throw new RuntimeException("RESTEasyHTTPOperations.put::Unexpected HttpStatus: " + status + " " + reason + " for request " + target); } } catch (IOException e) { throw new RuntimeException(e); } } }</code><technical_language>Minor: duplicit code, I Invocation.Builder builder = service.getHttpClient().target(target).request().accept(service.getContentType()); if (eTag != null) builder.header("If-Match", eTag.getValue()) Invocation put = .buildPut(Entity.entity(encodeObject(value), service.getContentType()));</technical_language>

Target:
private void putInternal(K key, V value, EntityTag eTag) { if (service.isRunning()) { Response response = null; try { String target = buildUrl(service.cacheName, key); Builder putBuilder = service.getHttpClient().target(target).request().accept(service.getContentType()); if (eTag != null) { putBuilder = putBuilder.header(HttpHeaders.IF_MATCH, eTag.getValue()); } response = putBuilder.buildPut(Entity.entity(encodeObject(value), service.getContentType())).invoke(); int status = response.getStatus(); String reason = response.getStatusInfo().getReasonPhrase(); response.close(); if (status != Status.OK.getStatusCode() && status != Status.CREATED.getStatusCode() && status != Status.NO_CONTENT.getStatusCode()) { throw new RuntimeException("RESTEasyHTTPOperations.put::Unexpected HttpStatus: " + status + " " + reason + " for request " + target); } } catch (IOException e) { throw new RuntimeException(e); } finally { if (response != null) { response.close(); } } } }
Source:
<code>public LogPage log(LogRequest logRequest) throws GitException { LogCommand logCommand = getGit().log(); <START> String sFilePath = null; <END> try { setRevisionRange(logCommand, logRequest); setPaging(logCommand, logRequest); if (logRequest != null) { sFilePath = logRequest.getFilePath(); if (sFilePath != null && !sFilePath.isEmpty()) { logCommand.addPath(sFilePath); } } Iterator<RevCommit> revIterator = logCommand.call().iterator(); List<Revision> commits = new ArrayList<Revision>(); while (revIterator.hasNext()) { RevCommit commit = revIterator.next(); Revision revision = getRevision(commit, sFilePath); commits.add(revision); } return new LogPage(commits); } catch (GitAPIException | IOException exception) { String errorMessage = exception.getMessage(); LOG.error("Failed to retrieve log. ", errorMessage); if (ERROR_LOG_NO_HEAD_EXISTS.equals(errorMessage)) { throw new GitException(errorMessage, ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED); }else{ throw new GitException(exception); } } }</code><technical_language>I is call this variable 's' prefix</technical_language>

Target:
public LogPage log(LogRequest logRequest) throws GitException { LogCommand logCommand = getGit().log(); String filePath = null; try { setRevisionRange(logCommand, logRequest); setPaging(logCommand, logRequest); if (logRequest != null) { logRequest.getFileFilter().forEach(logCommand::addPath); filePath = logRequest.getFilePath(); if (!isNullOrEmpty(filePath)) { logCommand.addPath(filePath); } } Iterator<RevCommit> revIterator = logCommand.call().iterator(); List<Revision> commits = new ArrayList<>(); while (revIterator.hasNext()) { RevCommit commit = revIterator.next(); Revision revision = getRevision(commit, filePath); commits.add(revision); } return new LogPage(commits); } catch (GitAPIException | IOException exception) { String errorMessage = exception.getMessage(); if (ERROR_LOG_NO_HEAD_EXISTS.equals(errorMessage)) { throw new GitException(errorMessage, ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED); } else { LOG.error("Failed to retrieve log. ", exception); throw new GitException(exception); } } }
Source:
<code>public static void main(String[] args) { LOGGER.info("---------------------"); LOGGER.info("KEY VAULT - SECRETS"); LOGGER.info("IDENTITY - CREDENTIAL"); LOGGER.info("---------------------"); <START> String authorityHostAlias = System.getenv("AZURE_CLOUD"); <END> String authorityHost = AUTHORITY_HOST_MAP.getOrDefault( authorityHostAlias, KnownAuthorityHosts.AZURE_CLOUD); secretClient = new SecretClientBuilder() .vaultUrl(System.getenv("AZURE_PROJECT_URL")) .credential( new DefaultAzureCredentialBuilder() .authorityHost(authorityHost) .build() ).buildClient(); try { setSecret(); getSecret(); } finally { deleteSecret(); } }</code><technical_language>rename variable azureCloud</technical_language>

Target:
public static void main(String[] args) { LOGGER.info("---------------------"); LOGGER.info("KEY VAULT - SECRETS"); LOGGER.info("IDENTITY - CREDENTIAL"); LOGGER.info("---------------------"); String azureCloud = System.getenv("AZURE_CLOUD"); String authorityHost = AUTHORITY_HOST_MAP.getOrDefault( azureCloud, KnownAuthorityHosts.AZURE_CLOUD); secretClient = new SecretClientBuilder() .vaultUrl(System.getenv("AZURE_PROJECT_URL")) .credential( new DefaultAzureCredentialBuilder() .authorityHost(authorityHost) .build() ).buildClient(); try { setSecret(); getSecret(); } finally { deleteSecret(); } }
Source:
<code>public void setTemporalOps(TemporalOperatorsType temporalOperators) { temporalOps = new ConcurrentHashMap<TEMPORAL_OPERATORS, TemporalOperatorType>( new EnumMap<TEMPORAL_OPERATORS, TemporalOperatorType>(TEMPORAL_OPERATORS.class)); for (TemporalOperatorType temporalOp : temporalOperators.getTemporalOperator()) { LOGGER.debug("Adding key [temporalOp Name: {}]", temporalOp.getName()); temporalOps.put(TEMPORAL_OPERATORS.valueOf(temporalOp.getName()), temporalOp); if (LOGGER.isDebugEnabled()) { <START> LOGGER.debug("temporalOps Map: {}", temporalOps.toString()); <END> } } }</code><technical_language>remove call .toString() avoid if</technical_language>

Target:
public void setTemporalOps(TemporalOperatorsType temporalOperators) { temporalOps = new ConcurrentHashMap<TEMPORAL_OPERATORS, TemporalOperatorType>( new EnumMap<TEMPORAL_OPERATORS, TemporalOperatorType>(TEMPORAL_OPERATORS.class)); for (TemporalOperatorType temporalOp : temporalOperators.getTemporalOperator()) { LOGGER.debug("Adding key [temporalOp Name: {}]", temporalOp.getName()); temporalOps.put(TEMPORAL_OPERATORS.valueOf(temporalOp.getName()), temporalOp); LOGGER.debug("temporalOps Map: {}", temporalOps); } }
Source:
<code>public void generateChunk(CoreChunk chunk, Region chunkRegion) { BaseFacet baseFacet = chunkRegion.getFacet(BaseFacet.class); for (Entry<BaseVector3i, Base> entry : baseFacet.getWorldEntries().entrySet()) { Vector3i centerBasePosition = new Vector3i(entry.getKey()); int extent = entry.getValue().getExtent(); <START> centerBasePosition.add(0, extent, 0); <END> Vector3i min = new Vector3i(centerBasePosition.x() - extent + 2, centerBasePosition.y() - extent, centerBasePosition.z() - extent); Vector3i max = new Vector3i(centerBasePosition.x() + extent - 2, centerBasePosition.y() - extent, centerBasePosition.z() + extent); Region3i walls = Region3i.createFromMinMax(min, max); for (Vector3i newBlockPosition : walls) { if (chunkRegion.getRegion().encompasses(newBlockPosition)) { chunk.setBlock(ChunkMath.calcBlockPos(newBlockPosition), stone); } if (centerBasePosition.x > 0){ if (chunkRegion.getRegion().encompasses(centerBasePosition)) { chunk.setBlock(ChunkMath.calcBlockPos(centerBasePosition.x(), centerBasePosition.y() - extent + 1, centerBasePosition.z() + 2), redFlag); } } if (centerBasePosition.x < 0){ if (chunkRegion.getRegion().encompasses(centerBasePosition)) { chunk.setBlock(ChunkMath.calcBlockPos(centerBasePosition.x(), centerBasePosition.y() - extent + 1, centerBasePosition.z() + 2), blackFlag); } } } } }</code><technical_language>add extent y subtract in next line</technical_language>

Target:
public void generateChunk(CoreChunk chunk, Region chunkRegion) { BaseFacet baseFacet = chunkRegion.getFacet(BaseFacet.class); for (Base base : baseFacet.getBases()) { Region3i baseRegion = base.getArea(); Region3i flagRegion = base.getFlagArea(); for (Vector3i baseBlockPosition : baseRegion) { if (chunkRegion.getRegion().encompasses(baseBlockPosition)) { chunk.setBlock(ChunkMath.calcBlockPos(baseBlockPosition), stone); } } for (Vector3i flagPosition : flagRegion) { if (chunkRegion.getRegion().encompasses(flagPosition) && flagPosition.x > 0) { chunk.setBlock(ChunkMath.calcBlockPos(flagPosition), redFlag); } else if (chunkRegion.getRegion().encompasses(flagPosition)) { chunk.setBlock(ChunkMath.calcBlockPos(flagPosition), blackFlag); } } } }
Source:
<code><START> public ByteBuf getAndRelease() { <END> if (released.compareAndSet(false, true)) { try { return buffer.retainedDuplicate(); } finally { buffer.release(); } } else { throw new IllegalStateException("Payload already released"); } }</code><technical_language>this method return null if buffer created buffer released of error? Right now, throw exception calling retainedDuplicate()</technical_language>

Target:
public ByteBuf getAndRelease() { if (buffer == null) { return null; } else { try { return buffer.retainedDuplicate(); } finally { buffer.release(); buffer = null; } } }
Source:
<code><START> public void testIncludeSameReport() throws Exception { <END> FreeStyleProject p = j.createFreeStyleProject("include_job"); final String reportDir = "autogen"; p.getBuildersList().add(new TestBuilder() { public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { FilePath ws = build.getWorkspace().child(reportDir); ws.child("tab1.html").write("hello", "UTF-8"); ws.child("tab2.html").write("hello", "UTF-8"); ws.child("dummy.html").write("hello", "UTF-8"); return true; } }); HtmlPublisherTarget target1 = new HtmlPublisherTarget("tab1", reportDir, "tab1.html", true, true, false, true); target1.setIncludes(HtmlPublisherTarget.INCLUDE_ALL_PATTERN); HtmlPublisherTarget target2 = new HtmlPublisherTarget("tab1", reportDir, "tab1.html", true, true, false, true); String includes = "tab2.html"; target2.setIncludes(includes); assertEquals(includes, target2.getIncludes()); HtmlPublisherTarget[] l = { target1, target2 }; p.getPublishersList().add(new HtmlPublisher(Arrays.asList(l))); AbstractBuild build = j.buildAndAssertSuccess(p); Assert.assertEquals(build.getActions(HtmlPublisherTarget.HTMLBuildAction.class).size(), 1); }</code><technical_language>please include a test for false & true settings of flag ensure coverage of scenarios</technical_language>

Target:
public void testIncludeSameReport() throws Exception { FreeStyleProject p = j.createFreeStyleProject("include_job"); final String reportDir = "autogen"; p.getBuildersList().add(new TestBuilder() { public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { FilePath ws = build.getWorkspace().child(reportDir); ws.child("tab1.html").write("hello", "UTF-8"); ws.child("tab2.html").write("hello", "UTF-8"); ws.child("dummy.html").write("hello", "UTF-8"); return true; } }); HtmlPublisherTarget target1 = new HtmlPublisherTarget("tab1", reportDir, "tab1.html", true, true, false); target1.setOnlyCreateReportWithDifferentName(true); target1.setIncludes(HtmlPublisherTarget.INCLUDE_ALL_PATTERN); HtmlPublisherTarget target2 = new HtmlPublisherTarget("tab1", reportDir, "tab1.html", true, true, false); target2.setOnlyCreateReportWithDifferentName(true); String includes = "tab2.html"; target2.setIncludes(includes); assertEquals(includes, target2.getIncludes()); HtmlPublisherTarget[] l = { target1, target2 }; p.getPublishersList().add(new HtmlPublisher(Arrays.asList(l))); AbstractBuild build = j.buildAndAssertSuccess(p); Assert.assertEquals(build.getActions(HtmlPublisherTarget.HTMLBuildAction.class).size(), 1); }
Source:
<code>public void showProjectWithNonRegisteredProject() throws Exception { CommandStatus initStatus = main("init", "-c", config.toString(), projectDir.toString()); assertThat(initStatus.code(), is(0)); copyResource("acceptance/basic.dig", projectDir.resolve("basic.dig")); { CommandStatus pushStatus = main( "push", "--project", projectDir.toString(), "foo", "-c", config.toString(), "-e", server.endpoint()); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); } { CommandStatus pushStatus = main( "push", "--project", projectDir.toString(), "bar", "-c", config.toString(), "-e", server.endpoint()); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); } CommandStatus showProjectStatus = main("projects","not_exist_project", "-c", config.toString(), "-e", server.endpoint()); <START> assertThat(showProjectStatus.errUtf8(), showProjectStatus.code(), is(0)); <END> assertThat(showProjectStatus.outUtf8(), containsString(" Not found")); }</code><technical_language>Is exit code 0 is right resource found? other commands 'workflows' return non-zero if resource found. $ digdag workflows not_exist_workflow || echo fail 2019-04-10 14:35:53 +0900: Digdag v0.9.35 error: Resource found: project found: not_exist_workflow fail</technical_language>

Target:
public void showProjectWithNonRegisteredProject() throws Exception { CommandStatus initStatus = main("init", "-c", config.toString(), projectDir.toString()); assertThat(initStatus.code(), is(0)); copyResource("acceptance/basic.dig", projectDir.resolve("basic.dig")); { CommandStatus pushStatus = main( "push", "--project", projectDir.toString(), "foo", "-c", config.toString(), "-e", server.endpoint()); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); } { CommandStatus pushStatus = main( "push", "--project", projectDir.toString(), "bar", "-c", config.toString(), "-e", server.endpoint()); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); } CommandStatus showProjectStatus = main("projects","not_exist_project", "-c", config.toString(), "-e", server.endpoint()); assertThat(showProjectStatus.errUtf8(), showProjectStatus.code(), is(1)); assertThat(showProjectStatus.errUtf8(), containsString("does not exist.")); }
Source:
<code>private void updateActionAvailability() { ArrayList<StorageDomainDR> domainDRs = getSelectedItems() != null ? Linq.<StorageDomainDR> cast(getSelectedItems()) : new ArrayList<StorageDomainDR>(); <START> getNewCommand().setIsExecutionAllowed(true); <END> getEditCommand().setIsExecutionAllowed(domainDRs.size() == 1); }</code><technical_language>Is new allowed always. I default commands allowed. If remove it</technical_language>

Target:
private void updateActionAvailability() { ArrayList<StorageDomainDR> domainDRs = getSelectedItems() != null ? Linq.<StorageDomainDR> cast(getSelectedItems()) : new ArrayList<StorageDomainDR>(); getEditCommand().setIsExecutionAllowed(domainDRs.size() == 1); }