auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Optional<SnmpAgentConfig> getAgentConfigFromProfiles(InetAddress inetAddress, String location, String oid) { List<SnmpProfile> snmpProfiles = agentConfigFactory.getProfiles(); List<SnmpProfile> matchedProfiles = snmpProfiles.stream() .filter(snmpProfile -> isFilterExpressionValid(inetAddress, snmpProfile.getFilterExpression())) .collect(Collectors.toList()); for (SnmpProfile snmpProfile : matchedProfiles) { <START> Optional<SnmpAgentConfig> config = fitProfile(snmpProfile, inetAddress, location, oid); <END> if (config.isPresent()) { return config; } } return Optional.empty(); }</code><technical_language>Profiles fitted in parallel instead of serially (take advantage of fact SNMP lookups async.). returned, iterate results order profiles defined in configuration file matched</technical_language>

Target:
public CompletableFuture<Optional<SnmpAgentConfig>> getAgentConfigFromProfiles(InetAddress inetAddress, String location, String oid) { CompletableFuture<Optional<SnmpAgentConfig>> future = new CompletableFuture<>(); List<SnmpProfile> snmpProfiles = agentConfigFactory.getProfiles(); List<SnmpProfile> matchedProfiles = snmpProfiles.stream() .filter(snmpProfile -> isFilterExpressionValid(inetAddress, snmpProfile.getFilterExpression())) .collect(Collectors.toList()); List<CompletableFuture<Optional<SnmpAgentConfig>>> futures = matchedProfiles.stream() .map(matchedProfile -> fitProfile(matchedProfile, inetAddress, location, oid)) .collect(Collectors.toList()); CompletableFuture<Void> allFutures = CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()])); CompletableFuture<List<Optional<SnmpAgentConfig>>> results = allFutures.thenApply(agentConfig -> { return futures.stream().map(CompletableFuture::join).collect(Collectors.toList()); }); results.whenComplete((configList, throwable) -> { if (throwable == null) { Optional<Optional<SnmpAgentConfig>> configOptional = configList.stream().filter(Optional::isPresent).findFirst(); future.complete(configOptional.orElse(Optional.empty())); } else { future.complete(Optional.empty()); } }); return future; }
Source:
<code><START> public final void createAndOpenNewBoard(String boardName, List<PanelInfo> panelList) { <END> prefs.addBoard(boardName, panelList); prefs.setLastOpenBoard(boardName); prefs.setLastOpenBoardPanelInfos(panelList); openBoard(boardName, panelList); ui.triggerEvent(new BoardSavedEvent()); logger.info("New board " + boardName + " created and opened"); ui.updateTitle(); }</code><technical_language>This method separated to: - saveBoard() - for prefs triggerEvent - showBoard() - for openBoard. ui.updateTitle() called in openBoard I believe</technical_language>

Target:
public final void createAndOpenNewBoard(String boardName, List<PanelInfo> panelList) { openBoard(boardName, panelList); saveBoard(); }
Source:
<code>public String toString() { return "SegmentPublishResult{" + "segments=" + segments + ", success=" + success + <START> ", exception=" + errorMsg + <END> '}'; }</code><technical_language>original name of member variable enclose string errorMsg single quotes. java @Override public String toString() { return "SegmentPublishResult{" + "segments=" + segments + ", success=" + success + ", errorMsg='" + errorMsg + '\'' + '}'; }</technical_language>

Target:
public String toString() { return "SegmentPublishResult{" + "segments=" + segments + ", success=" + success + ", errorMsg='" + errorMsg + '\'' + '}'; }
Source:
<code>public String toString() { InetAddress host = null; <START> try { <END> host = options.getTransportOptions().getHost(); } catch (IOException ignored) { } InetAddress adminHost = null; try { adminHost = options.getAdminTransportOptions().getHost(); } catch (IOException ignored) { } return String.format( "BigtableConnection-%d. Project: %s, Zone: %s, Cluster: %s. host: %s, adminhost: %s", id, options.getProjectId(), options.getZone(), options.getCluster(), host, adminHost); }</code><technical_language>try catch is pretty heavy, avoid if can</technical_language>

Target:
public String toString() { InetAddress host = options.getHost(); InetAddress adminHost = options.getAdminHost(); return MoreObjects.toStringHelper(BigtableConnection.class) .add("id", id) .add("zone", options.getZone()) .add("project", options.getProjectId()) .add("cluster", options.getCluster()) .add("host", host) .add("adminHost", adminHost) .toString(); }
Source:
<code>public void testCreateDigitalSignature() throws Exception { <START> InputStream inputStream = DigitalSignatureTest.class.getResourceAsStream("/example.zip"); <END> byte[] signature = digitalSignature.createDigitalSignature(inputStream, ALIAS, KEYSTORE_PASS); assertThat(signature, is(notNullValue())); }</code><technical_language>example.zip a constant</technical_language>

Target:
public void testCreateDigitalSignature() throws Exception { InputStream inputStream = DigitalSignatureTest.class.getResourceAsStream(EXAMPLE_EXPORT); byte[] signature = digitalSignature.createDigitalSignature(inputStream, ALIAS, KEYSTORE_PASS); assertThat(signature, is(notNullValue())); }
Source:
<code>public void removeIndex(Session session, Index h2Idx) { lock(true); try { ensureNotDestroyed(); ArrayList<Index> idxs = new ArrayList<>(this.idxs); Index targetIdx = (h2Idx instanceof GridH2ProxyIndex) ? ((GridH2ProxyIndex)h2Idx).underlyingIndex() : h2Idx; for (int i = pkIndexPos; i < idxs.size();) { Index idx = idxs.get(i); if (idx == targetIdx || (idx instanceof GridH2ProxyIndex && ((GridH2ProxyIndex)idx).underlyingIndex() == targetIdx)) { <START> Index idx0 = idxs.remove(i); <END> if (idx0 instanceof GridH2ProxyIndex && idx.getSchema().findIndex(session, idx.getName()) != null) database.removeSchemaObject(session, idx); GridCacheContext cctx0 = cacheInfo.cacheContext(); if (cctx0 != null && idx0 instanceof GridH2IndexBase) { cctx0.shared().database().checkpointReadLock(); try { ((GridH2IndexBase)idx0).destroy(rmIndex); } finally { cctx0.shared().database().checkpointReadUnlock(); } } continue; } i++; } this.idxs = idxs; } finally { unlock(true); } }</code><technical_language>is meaning of idx0 local variable? redundant</technical_language>

Target:
public void removeIndex(Session session, Index h2Idx) { lock(true); try { ensureNotDestroyed(); ArrayList<Index> idxs = new ArrayList<>(this.idxs); Index targetIdx = (h2Idx instanceof GridH2ProxyIndex) ? ((GridH2ProxyIndex)h2Idx).underlyingIndex() : h2Idx; for (int i = pkIndexPos; i < idxs.size();) { Index idx = idxs.get(i); if (idx == targetIdx || (idx instanceof GridH2ProxyIndex && ((GridH2ProxyIndex)idx).underlyingIndex() == targetIdx)) { idxs.remove(i); if (idx instanceof GridH2ProxyIndex && idx.getSchema().findIndex(session, idx.getName()) != null) database.removeSchemaObject(session, idx); GridCacheContext cctx0 = cacheInfo.cacheContext(); if (cctx0 != null && idx instanceof GridH2IndexBase) { cctx0.shared().database().checkpointReadLock(); try { ((GridH2IndexBase)idx).destroy(rmIndex); } finally { cctx0.shared().database().checkpointReadUnlock(); } } continue; } i++; } this.idxs = idxs; } finally { unlock(true); } }
Source:
<code>public void finish(TimePeriod timeout, boolean createModule, String moduleName) { checkShell(); log.info("Finish wizard"); Button button = new FinishButton(this); button.click(); ShellIsAvailable moduleShell = new ShellIsAvailable("New module-info.java"); new WaitUntil(moduleShell, TimePeriod.MEDIUM, false); if (moduleShell.getResult() != null) { NewModuleInfoDialog moduleDialog = new NewModuleInfoDialog(new DefaultShell(moduleShell.getResult())); if (createModule) { if (moduleName != null && !moduleName.isEmpty()) { moduleDialog.setModuleName(moduleName); } moduleDialog.create(); } else { moduleDialog.dontCreate(); } new WaitWhile(moduleShell, TimePeriod.DEFAULT); } new WaitWhile(new WindowIsAvailable(this), timeout); try { new WaitWhile(new JobIsRunning(), timeout); <START> } catch (NoClassDefFoundError e) { <END> } }</code><technical_language>happen reddeer.eclipse a hard dependency reddeer.workbench :)</technical_language>

Target:
public void finish(TimePeriod timeout, boolean createModule, String moduleName) { checkShell(); log.info("Finish wizard"); Button button = new FinishButton(this); button.click(); ShellIsAvailable moduleShell = new ShellIsAvailable("New module-info.java"); new WaitUntil(moduleShell, TimePeriod.MEDIUM, false); if (moduleShell.getResult() != null) { NewModuleInfoDialog moduleDialog = new NewModuleInfoDialog(new DefaultShell(moduleShell.getResult())); if (createModule) { if (moduleName != null && !moduleName.isEmpty()) { moduleDialog.setModuleName(moduleName); } moduleDialog.create(); } else { moduleDialog.dontCreate(); } new WaitWhile(moduleShell, TimePeriod.DEFAULT); } new WaitWhile(new WindowIsAvailable(this), timeout); new WaitWhile(new JobIsRunning(), timeout); }
Source:
<code>private void loadVMsFromExternalProvider(final OriginType type, String uri, String username, String password) { startProgress(); AsyncQuery query = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { if (returnValue instanceof VdcQueryReturnValue) { setError(messages.providerFailure()); stopProgress(); } else { List<VM> remoteVms = (List<VM>) returnValue; List<VM> remoteDownVms = new ArrayList<>(); for (VM vm : remoteVms) { if (vm.isDown()) { <START> vm.setOrigin(type); <END> remoteDownVms.add(vm); } } if (remoteVms.size() != remoteDownVms.size()) { setWarning(constants.runningVmsWereFilteredOnImportVm()); } updateVms(remoteDownVms); } } }); query.setHandleFailure(true); AsyncDataProvider.getInstance().getVmsFromExternalServer( query, getDataCenters().getSelectedItem().getId(), getProxyHosts().getSelectedItem() != null ? getProxyHosts().getSelectedItem().getId() : null, uri, username, password); }</code><technical_language>duplicated set in vdsbroker part of query? I (if and) support rest-api, need</technical_language>

Target:
private void loadVMsFromExternalProvider(final OriginType type, String uri, String username, String password) { startProgress(); AsyncQuery query = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { if (returnValue instanceof VdcQueryReturnValue) { setError(messages.providerFailure()); stopProgress(); } else { List<VM> remoteVms = (List<VM>) returnValue; List<VM> remoteDownVms = new ArrayList<>(); for (VM vm : remoteVms) { if (vm.isDown()) { vm.setOrigin(type); remoteDownVms.add(vm); } } if (remoteVms.size() != remoteDownVms.size()) { setWarning(constants.runningVmsWereFilteredOnImportVm()); } updateVms(remoteDownVms); } } }); Guid proxyId = null; switch (type) { case XEN: proxyId = getXenProxyHosts().getSelectedItem() != null ? getXenProxyHosts().getSelectedItem().getId() : null; break; case VMWARE: default: proxyId = getProxyHosts().getSelectedItem() != null ? getProxyHosts().getSelectedItem().getId() : null; break; } query.setHandleFailure(true); AsyncDataProvider.getInstance().getVmsFromExternalServer( query, getDataCenters().getSelectedItem().getId(), proxyId, uri, username, password, type); }
Source:
<code>public void signInAccountIncomplete() { SignIn signIn = new SignIn.Builder().withStudy(TestConstants.TEST_STUDY_IDENTIFIER) .withPassword("password").build(); try { signIn.getAccountId(); <START> } catch(IllegalArgumentException e) { <END> assertEquals("SignIn not constructed with enough information to retrieve an account", e.getMessage()); } }</code><technical_language>Need a fail() here. Otherwise, this test passes if getAccountId() throw</technical_language>

Target:
public void signInAccountIncomplete() { SignIn signIn = new SignIn.Builder().withStudy(TestConstants.TEST_STUDY_IDENTIFIER) .withPassword("password").build(); try { signIn.getAccountId(); fail("Should have thrown an exception"); } catch(IllegalArgumentException e) { assertEquals("SignIn not constructed with enough information to retrieve an account", e.getMessage()); } }
Source:
<code>public void should_operate_silently() { String login = randomAlphabetic(10).toLowerCase(); String password = randomAlphabetic(10).toLowerCase(); <START> userRule.createUser(login, password); <END> WsResponse response = ItUtils.newUserWsClient(orchestrator, login, password).users().skipOnboardingTutorial(); assertThat(response.code()).isEqualTo(204); assertThat(response.hasContent()).isFalse(); }</code><technical_language>Dont' forget remove user end of test</technical_language>

Target:
public void should_operate_silently() { String login = randomAlphabetic(10).toLowerCase(); String password = randomAlphabetic(10).toLowerCase(); userRule.createUser(login, password); WsResponse response; try { response = ItUtils.newUserWsClient(orchestrator, null, null).users().skipOnboardingTutorial(); } finally { userRule.deactivateUsers(login); } assertThat(response.code()).isEqualTo(204); assertThat(response.hasContent()).isFalse(); }
Source:
<code>void serializeMessageInfoAndMetadataList(ByteBuffer outputBuffer) { outputBuffer.putInt(messageInfoList == null ? 0 : messageInfoList.size()); if (messageInfoList != null) { ListIterator<MessageInfo> infoListIterator = messageInfoList.listIterator(); ListIterator<MessageMetadata> metadataListIterator = messageMetadataList.listIterator(); while (infoListIterator.hasNext()) { MessageInfo messageInfo = infoListIterator.next(); MessageMetadata messageMetadata = metadataListIterator.next(); outputBuffer.put(messageInfo.getStoreKey().toBytes()); outputBuffer.putLong(messageInfo.getSize()); outputBuffer.putLong(messageInfo.getExpirationTimeInMs()); outputBuffer.put(messageInfo.isDeleted() ? DELETED : (byte) ~DELETED); if (version < VERSION_1 || version > VERSION_4) { throw new IllegalArgumentException("Unknown version in MessageInfoList " + version); } if (version > VERSION_1) { <START> Long crc = messageInfo.getCrc(); <END> if (crc != null) { outputBuffer.put(CRC_PRESENT); outputBuffer.putLong(crc); } else { outputBuffer.put((byte) ~CRC_PRESENT); } } if (version > VERSION_2) { outputBuffer.putShort(messageInfo.getAccountId()); outputBuffer.putShort(messageInfo.getContainerId()); outputBuffer.putLong(messageInfo.getOperationTimeMs()); } if (version > VERSION_3) { if (messageMetadata == null) { outputBuffer.putInt(0); } else { messageMetadata.serializeMessageMetadata(outputBuffer); } } } } }</code><technical_language>add size of MessageMetadata outputBuffer serializing MessageMetadata</technical_language>

Target:
void serializeMessageInfoAndMetadataList(ByteBuffer outputBuffer) { outputBuffer.putInt(messageInfoList == null ? 0 : messageInfoList.size()); if (messageInfoList != null) { ListIterator<MessageInfo> infoListIterator = messageInfoList.listIterator(); ListIterator<MessageMetadata> metadataListIterator = messageMetadataList.listIterator(); while (infoListIterator.hasNext()) { MessageInfo messageInfo = infoListIterator.next(); MessageMetadata messageMetadata = metadataListIterator.next(); outputBuffer.put(messageInfo.getStoreKey().toBytes()); outputBuffer.putLong(messageInfo.getSize()); outputBuffer.putLong(messageInfo.getExpirationTimeInMs()); outputBuffer.put(messageInfo.isDeleted() ? DELETED : (byte) ~DELETED); if (version < VERSION_1 || version > VERSION_4) { throw new IllegalArgumentException("Unknown version in MessageInfoList " + version); } if (version > VERSION_1) { Long crc = messageInfo.getCrc(); if (crc != null) { outputBuffer.put(FIELD_PRESENT); outputBuffer.putLong(crc); } else { outputBuffer.put((byte) ~FIELD_PRESENT); } } if (version > VERSION_2) { outputBuffer.putShort(messageInfo.getAccountId()); outputBuffer.putShort(messageInfo.getContainerId()); outputBuffer.putLong(messageInfo.getOperationTimeMs()); } if (version > VERSION_3) { if (messageMetadata != null) { outputBuffer.put(FIELD_PRESENT); messageMetadata.serializeMessageMetadata(outputBuffer); } else { outputBuffer.put((byte) ~FIELD_PRESENT); } } } } }
Source:
<code>public static String getExceptionAsString(Throwable t) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter, true); log.error(t); printWriter.flush(); stringWriter.flush(); <START> return stringWriter.toString(); <END> }</code><technical_language>This call log.error(t). return ExceptionUtil.getStrackTrace(t);</technical_language>

Target:
public static String getExceptionAsString(Throwable t) { return ExceptionUtils.getStackTrace(t); }
Source:
<code><START> public static EventContext createEventContext(Any producerId, <END> @Nullable Version version, CommandContext commandContext) { final EventId eventId = generateId(); final Timestamp timestamp = getCurrentTime(); final EventContext.Builder builder = EventContext.newBuilder() .setEventId(eventId) .setTimestamp(timestamp) .setCommandContext(commandContext) .setProducerId(producerId); if (version != null) { builder.setVersion(version); } return builder.build(); }</code><technical_language>long is public, ensure producerId commandContext nulls. I assume a nullability check for static methods of this class in tests</technical_language>

Target:
public static EventContext createEventContext(Any producerId, @Nullable Version version, CommandContext commandContext) { checkNotNull(producerId); checkNotNull(commandContext); final EventId eventId = generateId(); final Timestamp timestamp = getCurrentTime(); final EventContext.Builder builder = EventContext.newBuilder() .setEventId(eventId) .setTimestamp(timestamp) .setCommandContext(commandContext) .setProducerId(producerId); if (version != null) { builder.setVersion(version); } return builder.build(); }
Source:
<code>public void deinit() { <START> synchronized (this) { <END> if (!mThreadPoolExecutor.isShutdown()) { mThreadPoolExecutor.shutdown(); } } }</code><technical_language>good practice synchronize 'this'. a private 'new Object()' a lock is defensive programming</technical_language>

Target:
public void deinit() { synchronized (mExecutorLock) { if (!mThreadPoolExecutor.isShutdown()) { mThreadPoolExecutor.shutdown(); } } }
Source:
<code>public SubscriptionValidationConfig build() { SubscriptionValidationConfig subscriptionValidationConfig = new SubscriptionValidationConfig(); subscriptionValidationConfig.serviceURL = serviceURL; subscriptionValidationConfig.username = username; subscriptionValidationConfig.password = password; <START> return subscriptionValidationConfig; <END> }</code><technical_language>enabled property is set</technical_language>

Target:
public SubscriptionValidationConfig build() { SubscriptionValidationConfig subscriptionValidationConfig = new SubscriptionValidationConfig(); subscriptionValidationConfig.serviceURL = serviceURL; subscriptionValidationConfig.username = username; subscriptionValidationConfig.password = password; subscriptionValidationConfig.enabled = enabled; return subscriptionValidationConfig; }
Source:
<code>public void validateSaveUser() { if (user == null || user.getUsername() == null || user.getUsername().trim().equals("")) { addFieldError("user.username", REQUIRED); } if (user == null || user.getLastNm() == null || user.getLastNm().trim().equals("")) { addFieldError("user.lastNm", REQUIRED); } if (user == null || user.getFirstNm() == null || user.getFirstNm().trim().equals("")) { addFieldError("user.firstNm", REQUIRED); } if (user != null && !User.PASSIVE.equals(user.getUserType())) { <START> if (user != null && user.getPassword() != null && !user.getPassword().trim().equals("")){ <END> if(!user.getPassword().equals(user.getPasswordConfirm())) { addActionError("Passwords do not match"); } else if(!PasswordUtil.isValid(user.getPassword())) { addActionError(PasswordUtil.PASSWORD_REQ_ERROR_MSG); } } if(user!=null && user.getId()==null && !Auth.AUTH_EXTERNAL.equals(user.getAuthType()) && (user.getPassword()==null || user.getPassword().trim().equals(""))){ addActionError("Password is required"); } } if(user!=null && !UserDB.isUnique(user.getId(),user.getUsername())){ addActionError("Username has been taken"); } if (!this.getFieldErrors().isEmpty()||!this.getActionErrors().isEmpty()) { Long userId = AuthUtil.getUserId(servletRequest.getSession()); sortedSet = UserDB.getUserSet(sortedSet); user.setId(userId); } }</code><technical_language>Saving a passive user's data a user entity empty password case in lines I noted above. If change a user 'passive' allows set a password, validation</technical_language>

Target:
public void validateSaveUser() { if (user == null || user.getUsername() == null || user.getUsername().trim().equals("")) { addFieldError("user.username", REQUIRED); } if (user == null || user.getLastNm() == null || user.getLastNm().trim().equals("")) { addFieldError("user.lastNm", REQUIRED); } if (user == null || user.getFirstNm() == null || user.getFirstNm().trim().equals("")) { addFieldError("user.firstNm", REQUIRED); } if (user != null && !User.PASSIVE.equals(user.getUserType())) { if (user.getPassword() != null && !user.getPassword().trim().equals("")){ if(!user.getPassword().equals(user.getPasswordConfirm())) { addActionError("Passwords do not match"); } else if(!PasswordUtil.isValid(user.getPassword())) { addActionError(PasswordUtil.PASSWORD_REQ_ERROR_MSG); } } if(user!=null && user.getId()==null && !Auth.AUTH_EXTERNAL.equals(user.getAuthType()) && (user.getPassword()==null || user.getPassword().trim().equals(""))){ addActionError("Password is required"); } } if(user!=null && !UserDB.isUnique(user.getId(),user.getUsername())){ addActionError("Username has been taken"); } if (!this.getFieldErrors().isEmpty()||!this.getActionErrors().isEmpty()) { Long userId = AuthUtil.getUserId(servletRequest.getSession()); sortedSet = UserDB.getUserSet(sortedSet); user.setId(userId); } }
Source:
<code>private long writeArtifact(RepositoryPath repositoryPath, InputStream is, OutputStream os) throws IOException { ArtifactOutputStream aos = StreamUtils.findSource(ArtifactOutputStream.class, os); Repository repository = repositoryPath.getRepository(); Boolean checksumAttribute = RepositoryFiles.isChecksum(repositoryPath); if (Boolean.TRUE.equals(checksumAttribute)) { aos.setCacheOutputStream(new ByteArrayOutputStream()); } if (repository.isHostedRepository()) { artifactEventListenerRegistry.dispatchArtifactUploadingEvent(repositoryPath); } long totalAmountOfBytes = IOUtils.copy(is, os); Map<String, String> digestMap = aos.getDigestMap(); if (Boolean.FALSE.equals(checksumAttribute) && !digestMap.isEmpty()) { addChecksumsToCacheManager(digestMap, repositoryPath); } if (Boolean.TRUE.equals(checksumAttribute)) { String checksumValue = ((ByteArrayOutputStream) aos.getCacheOutputStream()).toString(StandardCharsets.UTF_8.name()); String algorithm = FilenameUtils.getExtension(repositoryPath.toString()); String fileBaseName = FilenameUtils.getBaseName(repositoryPath.toString()); <START> checksumCacheManager.addArtifactChecksum(repositoryPath.resolveSibling(fileBaseName), <END> algorithm, checksumValue); } return totalAmountOfBytes; }</code><technical_language>drop this logic related checksum validation</technical_language>

Target:
private long writeArtifact(RepositoryPath repositoryPath, InputStream is, OutputStream os) throws IOException { LayoutOutputStream aos = StreamUtils.findSource(LayoutOutputStream.class, os); Repository repository = repositoryPath.getRepository(); Boolean checksumAttribute = RepositoryFiles.isChecksum(repositoryPath); if (Boolean.TRUE.equals(checksumAttribute)) { aos.setCacheOutputStream(new ByteArrayOutputStream()); } if (repository.isHostedRepository()) { artifactEventListenerRegistry.dispatchArtifactUploadingEvent(repositoryPath); } long totalAmountOfBytes = IOUtils.copy(is, os); URI repositoryPathId = repositoryPath.toUri(); Map<String, String> digestMap = aos.getDigestMap(); if (Boolean.FALSE.equals(checksumAttribute) && !digestMap.isEmpty()) { addChecksumsToCacheManager(digestMap, repositoryPathId); writeChecksums(repositoryPath, digestMap); } if (Boolean.TRUE.equals(checksumAttribute)) { byte[] checksumValue = ((ByteArrayOutputStream) aos.getCacheOutputStream()).toByteArray(); if (checksumValue != null && checksumValue.length > 0) { validateUploadedChecksumAgainstCache(checksumValue, repositoryPathId); } } return totalAmountOfBytes; }
Source:
<code>public void onPartitionBecomeLeaderFromStandby(String partitionName) { try { PartitionStateChangeListener cloudToStoreReplicationListener = partitionStateChangeListeners.get(StateModelListenerType.CloudToStoreReplicationManagerListener); if (cloudToStoreReplicationListener != null) { cloudToStoreReplicationListener.onPartitionBecomeLeaderFromStandby(partitionName); } } catch (Exception e) { <START> participantMetrics.standbyCount.addAndGet(-1); <END> participantMetrics.errorStateCount.addAndGet(1); throw e; } participantMetrics.standbyCount.addAndGet(-1); participantMetrics.leaderCount.addAndGet(1); }</code><technical_language>finally</technical_language>

Target:
public void onPartitionBecomeLeaderFromStandby(String partitionName) { try { PartitionStateChangeListener cloudToStoreReplicationListener = partitionStateChangeListeners.get(StateModelListenerType.CloudToStoreReplicationManagerListener); if (cloudToStoreReplicationListener != null) { cloudToStoreReplicationListener.onPartitionBecomeLeaderFromStandby(partitionName); } } catch (Exception e) { participantMetrics.errorStateCount.addAndGet(1); throw e; } finally { participantMetrics.standbyCount.addAndGet(-1); } participantMetrics.leaderCount.addAndGet(1); }
Source:
<code>protected boolean canDoAction() { if (disk == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } buildSharedLockMap(); return acquireLockInternal() && <START> validateAllVmsForDiskAreDown() && <END> disk.getDiskStorageType() == DiskStorageType.IMAGE ? canRemoveDiskBasedOnImageStorageCheck() : true; }</code><technical_language>This is done now, logical. making mistake</technical_language>

Target:
protected boolean canDoAction() { if (disk == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } buildSharedLockMap(); return acquireLockInternal() && validateAllVmsForDiskAreDown() && canRemoveDiskBasedOnStorageTypeCheck(); }
Source:
<code>public <T> Mono<T> getDataAsync(Class<T> clazz, JsonSerializer dataDeserializer) { if (!parsed) { <START> throw logger.logExceptionAsError(new IllegalStateException( <END> "This method should only be called on events created through the parse method")); } return dataDeserializer.deserializeAsync(new ByteArrayInputStream((byte[]) this.event.getData()), TypeReference.createInstance(clazz)); }</code><technical_language>For async methods, exceptions passed publisher. FluxUtil.monoError()</technical_language>

Target:
public <T> Mono<T> getDataAsync(Class<T> clazz, JsonSerializer dataDeserializer) { if (!parsed) { return FluxUtil.monoError(logger, new IllegalStateException( "This method should only be called on events created through the parse method")); } return dataDeserializer.deserializeAsync(new ByteArrayInputStream((byte[]) this.event.getData()), TypeReference.createInstance(clazz)); }
Source:
<code>public DiskBuffer(File bufferDir, int maxEvents) { super(); this.bufferDir = bufferDir; this.maxEvents = maxEvents; String errMsg = "Could not create or write to disk buffer dir: " + bufferDir.getAbsolutePath(); try { bufferDir.mkdirs(); if (!bufferDir.isDirectory() || !bufferDir.canWrite()) { logger.error(errMsg); } } catch (Exception e) { logger.error(errMsg, e); <START> } <END> logger.debug(Integer.toString(getNumStoredEvents()) + " stored events found in dir: " + bufferDir.getAbsolutePath()); }</code><technical_language>want this block throw (and errors logged caller?)</technical_language>

Target:
public DiskBuffer(File bufferDir, int maxEvents) { super(); this.bufferDir = bufferDir; this.maxEvents = maxEvents; String errMsg = "Could not create or write to disk buffer dir: " + bufferDir.getAbsolutePath(); try { bufferDir.mkdirs(); if (!bufferDir.isDirectory() || !bufferDir.canWrite()) { throw new RuntimeException(errMsg); } } catch (Exception e) { throw new RuntimeException(errMsg, e); } logger.debug(Integer.toString(getNumStoredEvents()) + " stored events found in dir: " + bufferDir.getAbsolutePath()); }
Source:
<code>private void visitEnrollPage_forCourseWithResponses_hasWarningMessage() throws Exception { ______TS("Typical case 2: open the enroll page of a course with existing feedback responses"); InstructorAttributes instructor = dataBundle.instructors.get("instructor1OfCourse1"); gaeSimulation.loginAsInstructor(instructor.getGoogleId()); String courseId = instructor.getCourseId(); String[] submissionParams = new String[]{Const.ParamsNames.COURSE_ID, courseId}; InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams); ShowPageResult pageResult = getShowPageResult(enrollPageAction); assertEquals(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL + "?error=false&user=idOfInstructor1OfCourse1", pageResult.getDestinationWithParams()); assertFalse(pageResult.isError); assertEquals(Const.StatusMessages.COURSE_ENROLL_POSSIBLE_DATA_LOSS, pageResult.getStatusMessage()); InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data; assertEquals(courseId, pageData.getCourseId()); assertEquals(null, pageData.getEnrollStudents()); <START> String expectedLogSegment = "instructorCourseEnroll Page Load<br>" <END> + "Enrollment for Course <span class=\"bold\">[" + courseId + "]</span>"; AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage()); }</code><technical_language>affect this</technical_language>

Target:
private void visitEnrollPage_forCourseWithResponses_hasWarningMessage() throws Exception { ______TS("Typical case 2: open the enroll page of a course with existing feedback responses"); InstructorAttributes instructor = dataBundle.instructors.get("instructor1OfCourse1"); gaeSimulation.loginAsInstructor(instructor.getGoogleId()); String courseId = instructor.getCourseId(); String[] submissionParams = new String[]{Const.ParamsNames.COURSE_ID, courseId}; InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams); ShowPageResult pageResult = getShowPageResult(enrollPageAction); assertEquals(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL + "?error=false&user=idOfInstructor1OfCourse1", pageResult.getDestinationWithParams()); assertFalse(pageResult.isError); assertEquals(Const.StatusMessages.COURSE_ENROLL_POSSIBLE_DATA_LOSS, pageResult.getStatusMessage()); InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data; assertEquals(courseId, pageData.getCourseId()); assertEquals(null, pageData.getEnrollStudents()); String expectedLogSegment = String.format( Const.StatusMessages.ADMIN_LOG_INSTRUCTOR_COURSE_ENROLL_PAGE_LOAD, courseId); AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage()); }
Source:
<code>public void injectProtocolAndPortToComponent(Map<String, String> configurations, Component component) { try { ComponentPropertyPattern confMap = ComponentPropertyPattern <START> .valueOf(component.getName()); <END> String value = configurations.get(confMap.getConnectionConfName()); if (value != null) { Matcher matcher = confMap.getParsePattern().matcher(value); if (matcher.matches()) { String protocol = matcher.group(1); String portStr = matcher.group(2); if (!protocol.isEmpty()) { component.setProtocol(protocol); } if (!portStr.isEmpty()) { try { component.setPort(Integer.parseInt(portStr)); } catch (NumberFormatException e) { LOG.warn( "Protocol/Port information for component doesn't seem to known format [{}]." + "skip assigning...", value, component.getName(), confMap.getParsePattern()); component.setProtocol(null); } } } else { LOG.warn("Protocol/Port information for component doesn't seem to known format [{}]. " + "skip assigning...", value, component.getName(), confMap.getParsePattern()); } } else { LOG.warn("Protocol/Port related configuration ({}) is not set", confMap.getConnectionConfName()); } } catch (IllegalArgumentException e) { } }</code><technical_language>add instead of inject</technical_language>

Target:
public void injectProtocolAndPortToComponent(Map<String, String> configurations, Component component) { try { ComponentPropertyPattern confMap = ComponentPropertyPattern .valueOf(component.getName()); String value = configurations.get(confMap.getConnectionConfName()); if (value != null) { Matcher matcher = confMap.getParsePattern().matcher(value); if (matcher.matches()) { String protocol = matcher.group(1); String portStr = matcher.group(2); if (!protocol.isEmpty()) { component.setProtocol(protocol); } if (!portStr.isEmpty()) { try { component.setPort(Integer.parseInt(portStr)); } catch (NumberFormatException e) { LOG.warn( "Protocol/Port information for component has illegal format [{}]." + "skip assigning...", value, component.getName(), confMap.getParsePattern()); component.setProtocol(null); } } } else { LOG.warn("Protocol/Port information for component doesn't seem to known format [{}]. " + "skipping assignment...", value, component.getName(), confMap.getParsePattern()); } } else { LOG.warn("Protocol/Port related configuration ({}) is not set", confMap.getConnectionConfName()); } } catch (IllegalArgumentException e) { } }
Source:
<code>private void setupMetacardMappers() { metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_METACARDS, remapKey(Associations.RELATED)); metacardToJsonEntryMapper.put("src", remapKey(QueryMetacardTypeImpl.QUERY_SOURCES)); metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_QUERIES, remapValue( value -> { List<Map<String, Object>> queries = (List) value; return queries .stream() .map(query -> transformIntoMetacard(new QueryMetacardImpl()).apply(query)) .map(this::toMetacardXml) .collect(Collectors.toList()); })); metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_LISTS, remapValue( value -> { List<Map<String, Object>> content = (List) value; return content .stream() .map(transformIntoMetacard(new ListMetacardImpl())) .map(this::toMetacardXml) .collect(Collectors.toList()); })); metacardToJsonEntryMapper.put( Security.ACCESS_INDIVIDUALS, remapValue( value -> { if (!(value instanceof List)) { return value; } return ((List<String>) value) .stream() .filter(StringUtils::isNotBlank) .collect(Collectors.toCollection(ArrayList::new)); })); metacardToJsonEntryMapper.put( QueryMetacardTypeImpl.QUERY_SORTS, remapValue( value -> <START> ((List<LazyValueMap>) value) <END> .stream() .map( lazyValueMap -> lazyValueMap.get("attribute") + "," + lazyValueMap.get("direction")) .collect(Collectors.toList()))); }</code><technical_language>List<ValueMap> boon [implements ValueMap here](<LINK_0> nice if Map a superinterface a standard Java collection, ValueMap add a methods may, someday, want</technical_language>

Target:
private void setupMetacardMappers() { metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_METACARDS, remapKey(Associations.RELATED)); metacardToJsonEntryMapper.put("src", remapKey(QueryMetacardTypeImpl.QUERY_SOURCES)); metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_QUERIES, remapValue( value -> { List<Map<String, Object>> queries = (List) value; return queries .stream() .map(query -> transformIntoMetacard(new QueryMetacardImpl()).apply(query)) .map(this::toMetacardXml) .collect(Collectors.toList()); })); metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_LISTS, remapValue( value -> { List<Map<String, Object>> content = (List) value; return content .stream() .map(transformIntoMetacard(new ListMetacardImpl())) .map(this::toMetacardXml) .collect(Collectors.toList()); })); metacardToJsonEntryMapper.put( Security.ACCESS_INDIVIDUALS, remapValue( value -> { if (!(value instanceof List)) { return value; } return ((List<String>) value) .stream() .filter(StringUtils::isNotBlank) .collect(Collectors.toCollection(ArrayList::new)); })); metacardToJsonEntryMapper.put( QueryMetacardTypeImpl.QUERY_SORTS, remapValue( value -> ((List<ValueMap>) value) .stream() .map( lazyValueMap -> lazyValueMap.get("attribute") + "," + lazyValueMap.get("direction")) .collect(Collectors.toList()))); }
Source:
<code>private void fail(Throwable t, JobConfig jobConfig, Serializable taskArgs) { if (ServerConfiguration.getBoolean(PropertyKey.DEBUG)) { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, ExceptionUtils.getStackTrace(t)); } else { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, t.getMessage()); } LOG.warn("Exception running task for job {}({}) : {}", (jobConfig == null) ? "" : jobConfig.getName(), <START> (taskArgs == null) ? "" : taskArgs.toString(), t.getMessage()); <END> return; }</code><technical_language>more helpful special values for null instead of empty string reading logs</technical_language>

Target:
private void fail(Throwable t, JobConfig jobConfig, Serializable taskArgs) { if (ServerConfiguration.getBoolean(PropertyKey.DEBUG)) { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, ExceptionUtils.getStackTrace(t)); } else { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, t.getMessage()); } LOG.warn("Exception running task for job {}({}) : {}", (jobConfig == null) ? "Undefined" : jobConfig.getName(), (taskArgs == null) ? "Undefined" : taskArgs.toString(), t.getMessage()); return; }
Source:
<code>protected void buildMessageInternal() { if (currentProcessedMimeMessage != null) { throw new IllegalStateException("message can only be built once!"); } if (cryptoStatus == null) { throw new IllegalStateException("PgpMessageBuilder must have cryptoStatus set before building!"); } Long openPgpKeyId = cryptoStatus.getOpenPgpKeyId(); try { currentProcessedMimeMessage = build(); } catch (MessagingException me) { queueMessageBuildException(me); return; } if (openPgpKeyId == null) { queueMessageBuildSuccess(currentProcessedMimeMessage); return; } if (!cryptoStatus.isProviderStateOk()) { queueMessageBuildException(new MessagingException("OpenPGP Provider is not ready!")); return; } addAutocryptHeaderIfAvailable(openPgpKeyId); <START> addDraftStateHeader(); <END> startOrContinueBuildMessage(null); }</code><technical_language>this add Autocrypt-Draft-State header messages, of a draft message</technical_language>

Target:
protected void buildMessageInternal() { if (currentProcessedMimeMessage != null) { throw new IllegalStateException("message can only be built once!"); } if (cryptoStatus == null) { throw new IllegalStateException("PgpMessageBuilder must have cryptoStatus set before building!"); } Long openPgpKeyId = cryptoStatus.getOpenPgpKeyId(); try { currentProcessedMimeMessage = build(); } catch (MessagingException me) { queueMessageBuildException(me); return; } if (openPgpKeyId == null) { queueMessageBuildSuccess(currentProcessedMimeMessage); return; } if (!cryptoStatus.isProviderStateOk()) { queueMessageBuildException(new MessagingException("OpenPGP Provider is not ready!")); return; } addAutocryptHeaderIfAvailable(openPgpKeyId); if (isDraft()) { addDraftStateHeader(); } startOrContinueBuildMessage(null); }
Source:
<code>public Boolean shouldAllowRequest(String url) { <START> return true; <END> }</code><technical_language>Aye; I missed I changed a _b_ oolean</technical_language>

Target:
public Boolean shouldAllowRequest(String url) { return null; }
Source:
<code>public void deleteTenant(String tenantDomain) throws StratosException, org.wso2.carbon.user.api.UserStoreException { TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager(); if (tenantManager != null) { int tenantId = tenantManager.getTenantId(tenantDomain); try { if (log.isDebugEnabled()) { log.debug(String.format("Starting tenant deletion for domain: %s and tenant id: %d from the system", tenantDomain, tenantId)); } ServerConfigurationService serverConfigurationService = TenantMgtServiceComponent.getServerConfigurationService(); if (Boolean.parseBoolean(serverConfigurationService.getFirstProperty("Tenant.TenantDelete"))) { TenantMgtUtil.deleteTenant(tenantDomain, tenantManager, tenantId, serverConfigurationService); } else { if (log.isDebugEnabled()) { <START> log.debug("Tenant.TenantDelete flag is not set to true in carbon.xml. " + <END> "Tenant will not be deleted."); } } } catch (Exception e) { String msg = String.format("Deleted tenant with domain: %s and tenant id: %d from the system.", tenantDomain, tenantId); log.error(msg, e); throw new StratosException(msg, e); } } }</code><technical_language>is set true => is set false :)</technical_language>

Target:
public void deleteTenant(String tenantDomain) throws StratosException, org.wso2.carbon.user.api.UserStoreException { TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager(); if (tenantManager != null) { int tenantId = tenantManager.getTenantId(tenantDomain); try { if (log.isDebugEnabled()) { log.debug(String.format("Starting tenant deletion for domain: %s and tenant id: %d from the system", tenantDomain, tenantId)); } ServerConfigurationService serverConfigurationService = TenantMgtServiceComponent.getServerConfigurationService(); if (Boolean.parseBoolean(serverConfigurationService.getFirstProperty("Tenant.TenantDelete"))) { TenantMgtUtil.deleteTenant(tenantDomain); } else { if (log.isDebugEnabled()) { log.debug("Tenant.TenantDelete flag is set to false in carbon.xml. Hence the tenant will " + "not be deleted."); } } } catch (Exception e) { String msg = String.format("Deleted tenant with domain: %s and tenant id: %d from the system.", tenantDomain, tenantId); log.error(msg, e); throw new StratosException(msg, e); } } }
Source:
<code>public void process(final SonarLintJobManager.SonarLintJob job, final Collection<Issue> issues, Collection<ClientInputFile> failedAnalysisFiles, TriggerType trigger) { Map<VirtualFile, Collection<LocalIssuePointer>> map; long start = System.currentTimeMillis(); AccessToken token = ReadAction.start(); try { map = transformIssues(issues, job.files(), failedAnalysisFiles); Set<VirtualFile> notAnalyzed = <START> job.files().stream().filter(store::containsFile).collect(Collectors.toSet()); <END> store.store(map); for (VirtualFile file : job.files()) { if (shouldTrackServerIssues(file, trigger, notAnalyzed)) { serverIssueUpdater.fetchAndMatchServerIssues(file); } } getPsi(job.files()).forEach(codeAnalyzer::restart); } finally { token.finish(); } console.debug("Stored matched issues in " + (System.currentTimeMillis() - start) + " ms"); String end; if (issues.size() == 1) { end = " issue"; } else { end = " issues"; } console.info("Found " + issues.size() + end); }</code><technical_language>filter shouldTrackServerIssues? reduce accesses store processing store.store(map)</technical_language>

Target:
public void process(final SonarLintJobManager.SonarLintJob job, final Collection<Issue> issues, Collection<ClientInputFile> failedAnalysisFiles, TriggerType trigger) { Map<VirtualFile, Collection<LocalIssuePointer>> map; long start = System.currentTimeMillis(); AccessToken token = ReadAction.start(); try { map = transformIssues(issues, job.files(), failedAnalysisFiles); Set<VirtualFile> notAnalyzed = job.files().stream().filter(store::containsFile).collect(Collectors.toSet()); store.store(map); for (VirtualFile file : job.files()) { if (shouldUpdateServerIssues(file, trigger, notAnalyzed)) { serverIssueUpdater.fetchAndMatchServerIssues(file); } } getPsi(job.files()).forEach(codeAnalyzer::restart); } finally { token.finish(); } console.debug("Stored matched issues in " + (System.currentTimeMillis() - start) + " ms"); String end; if (issues.size() == 1) { end = " issue"; } else { end = " issues"; } console.info("Found " + issues.size() + end); }
Source:
<code>public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { String code = request.getParameter(openIdAuthenticationManager.getCodeNameParameter()); if (code == null) { throw new IllegalArgumentException("authorization code cannot be null"); } String claimsUrl = openIdAuthenticationManager.buildClaimsRetrieverUrl(); Map<String, Object> claims; try { claims = retrieveClaims(claimsUrl, code); } catch (InterruptedException e) { <START> e.printStackTrace(); <END> throw new RuntimeException(e); } OpenIdAlfioUser alfioUser = extractUserInfoFrom(claims); if (!userManager.usernameExists(alfioUser.getEmail())) { createUser(alfioUser); } updateRoles(alfioUser.getAlfioRoles(), alfioUser.getEmail()); updateOrganizations(alfioUser, response); List<GrantedAuthority> authorities = alfioUser.getAlfioRoles().stream().map(Role::getRoleName) .map(SimpleGrantedAuthority::new).collect(Collectors.toList()); OpenIdAlfioAuthentication authentication = new OpenIdAlfioAuthentication(authorities, alfioUser.getIdToken(), alfioUser.getSubject(), alfioUser.getEmail(), openIdAuthenticationManager.buildLogoutUrl()); return getAuthenticationManager().authenticate(authentication); }</code><technical_language>Move "try / catch {throw}" retrieveClaims method flow is more linear, log exception, e.printStackTrace();</technical_language>

Target:
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { String code = request.getParameter(openIdAuthenticationManager.getCodeNameParameter()); if (code == null) { throw new IllegalArgumentException("authorization code cannot be null"); } String claimsUrl = openIdAuthenticationManager.buildClaimsRetrieverUrl(); Map<String, Object> claims = retrieveClaims(claimsUrl, code); OpenIdAlfioUser alfioUser = extractUserInfoFrom(claims); if (!userManager.usernameExists(alfioUser.getEmail())) { createUser(alfioUser); } updateRoles(alfioUser.getAlfioRoles(), alfioUser.getEmail()); updateOrganizations(alfioUser, response); List<GrantedAuthority> authorities = alfioUser.getAlfioRoles().stream().map(Role::getRoleName) .map(SimpleGrantedAuthority::new).collect(Collectors.toList()); OpenIdAlfioAuthentication authentication = new OpenIdAlfioAuthentication(authorities, alfioUser.getIdToken(), alfioUser.getSubject(), alfioUser.getEmail(), openIdAuthenticationManager.buildLogoutUrl()); return getAuthenticationManager().authenticate(authentication); }
Source:
<code><START> public static void beforeClass() throws InterruptedException, TimeoutException, IOException { <END> serviceAddress = client.options().isDomain ? Address.host(client.options().defaultHost) .and("core-service", "management") .and("service", "configuration-changes") : Address.coreService("management") .and("service", "configuration-changes"); changesResource = new ConfigurationChangesResource(client); }</code><technical_language>need for throws exceptions thrown methods</technical_language>

Target:
public static void beforeClass() { serviceAddress = client.options().isDomain ? Address.host(client.options().defaultHost) .and("core-service", "management") .and("service", "configuration-changes") : Address.coreService("management") .and("service", "configuration-changes"); changesResource = new ConfigurationChangesResource(client); }
Source:
<code><START> private OnmsApplication getApplicationEntity(Integer applicationId) throws NoSuchElementException { <END> Objects.requireNonNull(applicationId); final OnmsApplication application = applicationDao.get(applicationId); if (application == null) { throw new NoSuchElementException("OnmsAppliction with id " + applicationId); } return application; }</code><technical_language>This return entity it</technical_language>

Target:
private OnmsApplication getApplicationEntity(Integer applicationId) throws NoSuchElementException { Objects.requireNonNull(applicationId); final OnmsApplication application = applicationDao.get(applicationId); if (application == null) { throw new NoSuchElementException("OnmsApplication with id " + applicationId); } return application; }