auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void storeUpdates(boolean isCompatible, HttpServletRequest req, HttpServletResponse resp) throws OseeCoreException { IDataTranslationService service = getTranslationService(); IOseeCachingService caching = getCachingService(); TransactionCache txCache = caching.getTransactionCache(); BranchCacheStoreRequest updateRequest = null; InputStream inputStream = null; try { inputStream = req.getInputStream(); updateRequest = service.convert(inputStream, CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST); } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } finally { Lib.close(inputStream); } Collection<Branch> updated = new BranchCacheUpdateUtil(factoryService.getBranchFactory(), txCache).updateCache(updateRequest, caching.getBranchCache()); BranchCache cache = caching.getBranchCache(); if (updateRequest.isServerUpdateMessage()) { for (Branch branch : updated) { if (StorageState.CREATED == branch.getStorageState()) { branch.setStorageState(StorageState.MODIFIED); } branch.clearDirty(); cache.decache(branch); if (branch.getStorageState() != StorageState.PURGED) { cache.cache(branch); } } } else { cache.storeItems(updated); } try { resp.setStatus(HttpServletResponse.SC_ACCEPTED); resp.setContentType("text/plain"); resp.setCharacterEncoding("UTF-8"); resp.getWriter().write("Branch Store Successful"); } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } }

Target:
private void storeUpdates(boolean isCompatible, HttpServletRequest req, HttpServletResponse resp) throws OseeCoreException { IDataTranslationService service = getTranslationService(); IOseeCachingService caching = getCachingService(); TransactionCache txCache = caching.getTransactionCache(); BranchCacheStoreRequest updateRequest = null; InputStream inputStream = null; try { inputStream = req.getInputStream(); updateRequest = service.convert(inputStream, CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST); } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } finally { Lib.close(inputStream); } Collection<Branch> updated = new BranchCacheUpdateUtil(factoryService.getBranchFactory(), txCache).updateCache(updateRequest, caching.getBranchCache()); BranchCache cache = caching.getBranchCache(); if (updateRequest.isServerUpdateMessage()) { for (Branch branch : updated) { if (branch.isCreated()) { branch.setStorageState(StorageState.MODIFIED); } branch.clearDirty(); cache.decache(branch); if (!branch.isPurged()) { cache.cache(branch); } } } else { cache.storeItems(updated); } try { resp.setStatus(HttpServletResponse.SC_ACCEPTED); resp.setContentType("text/plain"); resp.setCharacterEncoding("UTF-8"); resp.getWriter().write("Branch Store Successful"); } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; ProcessingDetailsImpl that = (ProcessingDetailsImpl) o; return Objects.equals(sourceId, that.sourceId) && Objects.equals(exception, that.exception); }

Target:
public boolean equals(Object o) { if (!super.equals(o)) { return false; } ProcessingDetailsImpl that = (ProcessingDetailsImpl) o; return Objects.equals(this.sourceId, that.sourceId) && Objects.equals(this.exception, that.exception); }
Source:
public double readDouble() { try { gatherElementDataFromStreams(valueByteBuffer); long b1 = valueByteBuffer[0] & 0xFF; long b2 = valueByteBuffer[1] & 0xFF; long b3 = valueByteBuffer[2] & 0xFF; long b4 = valueByteBuffer[3] & 0xFF; long b5 = valueByteBuffer[4] & 0xFF; long b6 = valueByteBuffer[5] & 0xFF; long b7 = valueByteBuffer[6] & 0xFF; long b8 = valueByteBuffer[7] & 0xFF; long value = b1 | (b2 << 8) | (b3 << 16) | (b4 << 24) | (b5 << 32) | (b6 << 40) | (b7 << 48) | (b8 << 56); return Double.longBitsToDouble(value); } catch (IOException | ArrayIndexOutOfBoundsException ex) { throw new ParquetDecodingException("Could not read double."); } }

Target:
public double readDouble() { gatherElementDataFromStreams(valueByteBuffer); return Double.longBitsToDouble(BytesUtils.bytesToLong(valueByteBuffer)); }
Source:
private Map<String, JSONObject> parseJsonFiles() throws IOException { Map<String, JSONObject> dotJsons = new HashMap<>( ); final String solutionPath = PentahoSystem.getApplicationContext().getSolutionPath( DEFAULT_CONTENT_FOLDER ); if ( solutionPath == null || solutionPath.isEmpty() ) { logger.info( getClass().getName() + " Empty solution path" ); } else { File[] jsonFiles = listFiles( new File( solutionPath ), WORK_ITEM_FILE_EXTENSION ); if ( jsonFiles != null ) { for ( File jsonFile : jsonFiles ) { JSONObject jsonObject = getJsonFromFile( jsonFile ); if ( jsonObject != null ) { dotJsons.put( jsonFile.getAbsolutePath(), jsonObject ); } } } } return dotJsons; }

Target:
private Map<String, JSONObject> parseJsonFiles( ) { Map<String, JSONObject> dotJsons = new HashMap<>(); final String solutionPath = PentahoSystem.getApplicationContext().getSolutionPath( DEFAULT_CONTENT_FOLDER ); if ( StringUtils.isEmpty( solutionPath ) ) { logger.info( getClass().getName() + " Empty solution path" ); } else { File[] jsonFiles = listFiles( new File( solutionPath ), WORK_ITEM_FILE_EXTENSION ); if ( jsonFiles != null ) { for ( File jsonFile : jsonFiles ) { JSONObject jsonObject = getJsonFromFile( jsonFile ); if ( jsonObject != null ) { dotJsons.put( jsonFile.getAbsolutePath(), jsonObject ); } } } } return dotJsons; }
Source:
protected void setupContent(ViewGroup rootView) { mEmailInput = (WPLoginInputRow) rootView.findViewById(R.id.login_email_row); autoFillFromBuildConfig("DEBUG_DOTCOM_LOGIN_EMAIL", mEmailInput.getEditText()); mEmailInput.addTextChangedListener(this); mEmailInput.setOnEditorCommitListener(this); LinearLayout googleLoginButton = (LinearLayout) rootView.findViewById(R.id.login_google_button); googleLoginButton.setOnClickListener(new OnClickListener() { @SuppressWarnings("PrivateMemberAccessBetweenOuterAndInnerClass") @Override public void onClick(View view) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_BUTTON_CLICK); ActivityUtils.hideKeyboardForced(getActivity().getCurrentFocus()); if (NetworkUtils.checkConnection(getActivity())) { if (isAdded()) { mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); isSocialLogin = true; addGoogleFragment(); } else { AppLog.e(T.NUX, "Google login could not be started. LoginEmailFragment was not attached."); } } } }); }

Target:
protected void setupContent(ViewGroup rootView) { mEmailInput = (WPLoginInputRow) rootView.findViewById(R.id.login_email_row); autoFillFromBuildConfig("DEBUG_DOTCOM_LOGIN_EMAIL", mEmailInput.getEditText()); mEmailInput.addTextChangedListener(this); mEmailInput.setOnEditorCommitListener(this); LinearLayout googleLoginButton = (LinearLayout) rootView.findViewById(R.id.login_google_button); googleLoginButton.setOnClickListener(new OnClickListener() { @SuppressWarnings("PrivateMemberAccessBetweenOuterAndInnerClass") @Override public void onClick(View view) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_BUTTON_CLICK); ActivityUtils.hideKeyboardForced(getActivity().getCurrentFocus()); if (NetworkUtils.checkConnection(getActivity())) { if (isAdded()) { mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); isSocialLogin = true; addGoogleFragment(); } else { AppLog.e(T.NUX, "Google login could not be started. LoginEmailFragment was not attached."); showErrorDialog(getString(R.string.login_error_generic_start)); } } } }); }
Source:
List<String> upscaleCluster(HostGroup hostGroup, Collection<InstanceMetaData> metas) throws CloudbreakException; void stopCluster(boolean full) throws CloudbreakException; int startCluster(Set<InstanceMetaData> hostsInCluster) throws CloudbreakException; Map<String, String> getComponentsByCategory(String blueprintName, String hostGroupName); String getStackRepositoryJson(StackRepoDetails repoDetails, String stackRepoId); void cleanupCluster(Telemetry telemetry) throws CloudbreakException; void upgradeClusterRuntime(Set<ClusterComponent> components) throws CloudbreakException; default Map<String, String> gatherInstalledParcels(String stackName) { throw new UnsupportedOperationException("Interface not implemented."); }

Target:
List<String> upscaleCluster(HostGroup hostGroup, Collection<InstanceMetaData> metas) throws CloudbreakException; void stopCluster(boolean full) throws CloudbreakException; int startCluster(Set<InstanceMetaData> hostsInCluster) throws CloudbreakException; Map<String, String> getComponentsByCategory(String blueprintName, String hostGroupName); String getStackRepositoryJson(StackRepoDetails repoDetails, String stackRepoId); void cleanupCluster(Telemetry telemetry) throws CloudbreakException; void upgradeClusterRuntime(Set<ClusterComponent> components) throws CloudbreakException; Map<String, String> gatherInstalledParcels(String stackName); default void removeUnusedParcels(Set<ClusterComponent> usedParcelComponents) throws CloudbreakException { throw new UnsupportedOperationException("Interface not implemented."); }
Source:
private void addAppsTable(SQLiteDatabase db) { db.execSQL("CREATE TABLE custom_apps ( _id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL DEFAULT '', component_name TEXT NOT NULL UNIQUE, custom_flags INTEGER DEFAULT 0 )"); db.execSQL("CREATE INDEX index_component ON custom_apps(component_name);"); }

Target:
private void addAppsTable(SQLiteDatabase db) { db.execSQL("CREATE TABLE custom_apps ( _id INTEGER PRIMARY KEY AUTOINCREMENT, custom_flags INTEGER DEFAULT 0, component_name TEXT NOT NULL UNIQUE, name TEXT NOT NULL DEFAULT '' )"); db.execSQL("CREATE INDEX index_component ON custom_apps(component_name);"); }
Source:
public String getNameTokenUnitImport() { if (nameTokenPsiClass == null) { return ""; } String importString = "import " + nameTokenPsiClass.getQualifiedName() + ";"; return importString; }

Target:
public String getNameTokenUnitImport() { if (nameTokenPsiClass == null) { return ""; } return "import " + nameTokenPsiClass.getQualifiedName() + ";"; }
Source:
public void writeExternal(ObjectOutput out) throws IOException { out.writeBoolean(isNull); out.writeInt(sqlCharSize); if (isNull()) { return; } if ( _clobValue != null ) { writeClobUTF( out ); return; } String lvalue = null; char[] data = null; int strlen = rawLength; boolean isRaw; if (strlen < 0) { lvalue = value; strlen = lvalue.length(); isRaw = false; } else { data = rawData; isRaw = true; } int utflen = strlen; for (int i = 0 ; (i < strlen) && (utflen <= 65535); i++) { int c = isRaw ? data[i] : lvalue.charAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { } else if (c > 0x07FF) { utflen += 2; } else { utflen += 1; } } StreamHeaderGenerator header = getStreamHeaderGenerator(); if (SanityManager.DEBUG) { SanityManager.ASSERT(!header.expectsCharCount()); } header.generateInto(out, utflen); writeUTF(out, strlen, isRaw, null ); header.writeEOF(out, utflen); }

Target:
public void writeExternal(ObjectOutput out) throws IOException { out.writeBoolean(isNull); if (isNull()) { return; } if ( _clobValue != null ) { writeClobUTF( out ); return; } String lvalue = null; char[] data = null; int strlen = rawLength; boolean isRaw; if (strlen < 0) { lvalue = value; strlen = lvalue.length(); isRaw = false; } else { data = rawData; isRaw = true; } int utflen = strlen; for (int i = 0 ; (i < strlen) && (utflen <= 65535); i++) { int c = isRaw ? data[i] : lvalue.charAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { } else if (c > 0x07FF) { utflen += 2; } else { utflen += 1; } } StreamHeaderGenerator header = getStreamHeaderGenerator(); if (SanityManager.DEBUG) { SanityManager.ASSERT(!header.expectsCharCount()); } header.generateInto(out, utflen); writeUTF(out, strlen, isRaw, null ); header.writeEOF(out, utflen); }
Source:
public static void executeTest(ZephyrConfigModel zephyrData, Long testId) { final String executeTestsURL = String.format(URL_EXECUTE_TEST, zephyrData.getRestClient().getUrl(), testId); final Header[] headers = new Header[1]; headers[0] = new BasicHeader("Content-Type", "application/json"); final TestCaseResultModel testCase = zephyrData.getTestcase(); final JsonObject obj = new JsonObject(); obj.addProperty("status", testCase.getIsPassed() ? PASS : FAIL); obj.addProperty("comment", testCase.getComment()); StringEntity entity = null; try { entity = new StringEntity(obj.toString()); } catch (UnsupportedEncodingException e) { ZephyrPlugin.log(e); } final CloseableHttpResponse response = zephyrData.getRestClient().put(executeTestsURL, headers, entity); final int statusCode = response.getStatusLine().getStatusCode(); if (statusCode < 200 && statusCode >= 300) { ZephyrPlugin.log("Unexpected response status: " + statusCode); } if (response != null) { try { response.close(); } catch (IOException e) { ZephyrPlugin.log(e); } } }

Target:
public static void executeTest(ZephyrConfigModel zephyrData, Long testId) { final String url = String.format(URL_EXECUTE_TEST, zephyrData.getRestClient().getUrl(), testId); final Header[] headers = new Header[1]; headers[0] = new BasicHeader("Content-Type", "application/json"); final TestCaseResultModel testCase = zephyrData.getTestcase(); final JsonObject obj = new JsonObject(); obj.addProperty("status", testCase.getIsPassed() ? PASS : FAIL); obj.addProperty("comment", testCase.getComment()); StringEntity entity = null; try { entity = new StringEntity(obj.toString()); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException(String.format("Bad response entity upon execute test <%s>", url), e); } try (final CloseableHttpResponse response = zephyrData.getRestClient().put(url, headers, entity)) { final int statusCode = response.getStatusLine().getStatusCode(); if (statusCode < 200 && statusCode >= 300) { throw new IllegalArgumentException( String.format("Unexpected response status <%s> upon execute test <%s>", statusCode, url)); } } catch (IOException e) { throw new IllegalArgumentException(e); } }
Source:
private void updateRemoteVideoSurfaceDimensions() { if (mVideoCallScreen == null) { LogUtil.i("VideoCallPresenter.updateRemoteVideoSurfaceDimensions", "mVideoCallScreen is null"); return; } Activity activity = mVideoCallScreen.getVideoCallScreenFragment().getActivity(); if (activity != null) { Point screenSize = new Point(); activity.getWindowManager().getDefaultDisplay().getSize(screenSize); getRemoteVideoSurfaceTexture().setSurfaceDimensions(screenSize); } }

Target:
private void updateRemoteVideoSurfaceDimensions() { if (mVideoCallScreen == null) { LogUtil.e("VideoCallPresenter.updateRemoteVideoSurfaceDimensions", "mVideoCallScreen is null"); return; } Activity activity = mVideoCallScreen.getVideoCallScreenFragment().getActivity(); if (activity != null) { Point screenSize = new Point(); activity.getWindowManager().getDefaultDisplay().getSize(screenSize); getRemoteVideoSurfaceTexture().setSurfaceDimensions(screenSize); } }
Source:
protected void bindToEntry(BibEntry entry) { setupSearchPane(); EasyBind.subscribe(viewModel.statusProperty(), status -> { switch (status) { case IN_PROGRESS: searchPane.getChildren().setAll(progressIndicator); break; case CITATIONS_FOUND: graphicCitationList.setAll(EasyBind.map(viewModel.getCitationList(), this::citationToGraphic)); searchPane.getChildren().setAll(getCitationsPane()); break; case NO_RESULTS: searchPane.getChildren().setAll(getNotFoundPane()); break; case ERROR: searchPane.getChildren().setAll(getErrorPane()); break; case INACTIVE: default: searchPane.getChildren().clear(); break; } }); viewModel.init(entry); }

Target:
protected void bindToEntry(BibEntry entry) { viewModel.init(entry); }
Source:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AuthorityPrincipal other = (AuthorityPrincipal) obj; if (m_name == null) { if (other.m_name != null) { return false; } } else if (!m_name.equals(other.m_name)) { return false; } return true; }

Target:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (obj instanceof AuthorityPrincipal) { final AuthorityPrincipal other = (AuthorityPrincipal) obj; return Objects.equals(m_name, other.m_name); } return false; }
Source:
void calculateIdle () { if (idleRunning) return; Runnable runnable = new Runnable() { @Override public void run() { if (styledText == null) return; int i; long start = System.currentTimeMillis(); for (i = 0; i < lineCount; i++) { LineSizeInfo line = getLineSize(i); if (line.height == -1 || line.width == -1) { calculate(i, 1); if (System.currentTimeMillis() - start > IDLE_TIME) break; } } if (i < lineCount) { Display display = styledText.getDisplay(); display.asyncExec(this); } else { idleRunning = false; styledText.setScrollBars(true); ScrollBar bar = styledText.getVerticalBar(); if (bar != null) { bar.setSelection(styledText.getVerticalScrollOffset()); } } } }; Display display = styledText.getDisplay(); display.asyncExec(runnable); idleRunning = true; }

Target:
void calculateIdle () { if (idleRunning) return; Runnable runnable = new Runnable() { @Override public void run() { if (styledText == null) return; int i; long start = System.currentTimeMillis(); for (i = 0; i < lineCount; i++) { LineSizeInfo line = getLineSize(i); if (line.needsRecaculateSize()) { calculate(i, 1); if (System.currentTimeMillis() - start > IDLE_TIME) break; } } if (i < lineCount) { Display display = styledText.getDisplay(); display.asyncExec(this); } else { idleRunning = false; styledText.setScrollBars(true); ScrollBar bar = styledText.getVerticalBar(); if (bar != null) { bar.setSelection(styledText.getVerticalScrollOffset()); } } } }; Display display = styledText.getDisplay(); display.asyncExec(runnable); idleRunning = true; }
Source:
private int hostScore(VM vm, VDS host) { if (vm.getVmType() != VmType.HighPerformance) { return 1; } int vmSockets = vm.getNumOfSockets(); int vmCores = vmSockets * vm.getCpuPerSocket(); int vmThreads = vmCores * vm.getThreadsPerCpu(); if (vmSockets <= host.getCpuSockets() && vmCores <= host.getCpuCores() && vmThreads <= host.getCpuThreads()) { return 1; } return getMaxSchedulerWeight(); }

Target:
private int hostScore(VM vm, VDS host) { if (!policyUnitEnabled(vm)) { return 1; } int hostCoresPerSocket = host.getCpuCores() / host.getCpuSockets(); int hostThreadsPerCore = host.getCpuThreads() / host.getCpuCores(); if (vm.getNumOfSockets() <= host.getCpuSockets() && vm.getCpuPerSocket() <= hostCoresPerSocket && vm.getThreadsPerCpu() <= hostThreadsPerCore) { return 1; } return getMaxSchedulerWeight(); }
Source:
public ResourceResponse retrieveResource(URI resourceUri, Map<String, Serializable> arguments) throws IOException, ResourceNotFoundException, ResourceNotSupportedException { LOGGER.trace("ENTERING: retrieveResource"); ResourceResponse response = null; if (resourceUri == null) { throw new ResourceNotFoundException("Unable to find resource - resource URI was null"); } if (resourceUri.getScheme().equals(ContentItem.CONTENT_SCHEME)) { LOGGER.debug("Resource URI is content scheme"); String contentId = resourceUri.getSchemeSpecificPart(); if (contentId != null && !contentId.isEmpty()) { resourceUri = getUriWithQualifier(resourceUri, arguments); ReadStorageRequest readRequest = new ReadStorageRequestImpl(resourceUri, arguments); try { ReadStorageResponse readResponse = storage.read(readRequest); ContentItem contentItem = readResponse.getContentItem(); String fileName = contentItem.getFilename(); LOGGER.debug("resource name: {}", fileName); InputStream is = contentItem.getInputStream(); response = new ResourceResponseImpl( new ResourceImpl( new BufferedInputStream(is), contentItem.getMimeType(), fileName)); } catch (StorageException | NullPointerException e) { throw new ResourceNotFoundException(e); } } else { throw new IOException(String.format("Invalid URI %s received", resourceUri)); } } LOGGER.trace("EXITING: retrieveResource"); return response; }

Target:
public ResourceResponse retrieveResource(URI resourceUri, Map<String, Serializable> arguments) throws IOException, ResourceNotFoundException, ResourceNotSupportedException { LOGGER.trace("ENTERING: retrieveResource"); ResourceResponse response = null; if (resourceUri == null) { throw new ResourceNotFoundException("Unable to find resource - resource URI was null"); } if (resourceUri.getScheme().equals(ContentItem.CONTENT_SCHEME)) { LOGGER.debug("Resource URI is content scheme"); String contentId = resourceUri.getSchemeSpecificPart(); if (contentId != null && !contentId.isEmpty()) { ReadStorageRequest readRequest = new ReadStorageRequestImpl(resourceUri, arguments); try { ReadStorageResponse readResponse = storage.read(readRequest); ContentItem contentItem = readResponse.getContentItem(); String fileName = contentItem.getFilename(); LOGGER.debug("resource name: {}", fileName); InputStream is = contentItem.getInputStream(); response = new ResourceResponseImpl( new ResourceImpl( new BufferedInputStream(is), contentItem.getMimeType(), fileName)); } catch (StorageException e) { throw new ResourceNotFoundException(e); } } else { throw new ResourceNotSupportedException( String.format("Invalid URI %s received", resourceUri)); } } LOGGER.trace("EXITING: retrieveResource"); return response; }
Source:
private PhoneAccountHandle getAccountHandleFromNumber(String dialNumber) { Cursor cursor = mContentResolver.query(Calls.CONTENT_URI, PHONE_ACCOUNT_STRING, Calls.TYPE + "=" + Calls.OUTGOING_TYPE + " AND " + Calls.NUMBER + "=\"" + PhoneNumberUtils.normalizeNumber(dialNumber) + "\"", null, Calls.DEFAULT_SORT_ORDER + " LIMIT 1"); if (cursor == null) { return null; } if (cursor.getCount() < 1) { cursor.close(); retrun null; } cursor.moveToNext(); String componentName = cursor.getString( cursor.getColumnIndex(Calls.PHONE_ACCOUNT_COMPONENT_NAME)); String accountId = cursor.getString(cursor.getColumnIndex(Calls.PHONE_ACCOUNT_ID)); cursor.close(); if (TextUtils.isEmpty(componentName) || TextUtils.isEmpty(accountId)) { return null; } return new PhoneAccountHandle( ComponentName.unflattenFromString(componentName), accountId); }

Target:
private PhoneAccountHandle getAccountHandleFromNumber(String dialNumber) { Cursor cursor = mContentResolver.query(Calls.CONTENT_URI, PHONE_ACCOUNT_STRING, Calls.TYPE + "=" + Calls.OUTGOING_TYPE + " AND " + Calls.NUMBER + "=\"" + PhoneNumberUtils.normalizeNumber(dialNumber) + "\"", null, Calls.DEFAULT_SORT_ORDER + " LIMIT 1"); if (cursor == null) { return null; } if (!cursor.moveToNext()) { cursor.close(); retrun null; } String componentName = cursor.getString( cursor.getColumnIndex(Calls.PHONE_ACCOUNT_COMPONENT_NAME)); String accountId = cursor.getString(cursor.getColumnIndex(Calls.PHONE_ACCOUNT_ID)); cursor.close(); if (TextUtils.isEmpty(componentName) || TextUtils.isEmpty(accountId)) { return null; } return new PhoneAccountHandle( ComponentName.unflattenFromString(componentName), accountId); }
Source:
private static <RESPONSE extends PaxosResponse> void cancelOutstandingRequestsAfterTimeout( List<Future<RESPONSE>> responseFutures) { boolean areAllRequestsComplete = Iterables.all(responseFutures, Future::isDone); if (areAllRequestsComplete) { return; } CANCELLATION_EXECUTOR.schedule(() -> { for (Future<?> future : responseFutures) { boolean isCanceled = future.cancel(true); if (isCanceled) { cancelOutstandingRequestSuccess.mark(); } else { cancelOutstandingRequestNoOp.mark(); } } }, OUTSTANDING_REQUEST_CANCELLATION_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); if (shouldLogCancellationStatus()) { log.debug("Quorum checker canceled pending requests" + ". Rate of successful cancellations: {}, rate of no-op cancellations: {}", SafeArg.of("rateCancelled", cancelOutstandingRequestSuccess.getOneMinuteRate()), SafeArg.of("rateNoOpCancellation", cancelOutstandingRequestNoOp.getOneMinuteRate())); } }

Target:
private static <RESPONSE extends PaxosResponse> void cancelOutstandingRequestsAfterTimeout( List<Future<RESPONSE>> responseFutures) { boolean areAllRequestsComplete = Iterables.all(responseFutures, Future::isDone); if (areAllRequestsComplete) { return; } CANCELLATION_EXECUTOR.schedule(() -> { for (Future<?> future : responseFutures) { boolean isCanceled = future.cancel(true); if (isCanceled) { cancelOutstandingRequestSuccess.mark(); } else { cancelOutstandingRequestNoOp.mark(); } } }, OUTSTANDING_REQUEST_CANCELLATION_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); if (log.isDebugEnabled() && shouldLogCancellationStatus()) { log.debug("Quorum checker canceled pending requests" + ". Rate of successful cancellations: {}, rate of no-op cancellations: {}", SafeArg.of("rateCancelled", cancelOutstandingRequestSuccess.getOneMinuteRate()), SafeArg.of("rateNoOpCancellation", cancelOutstandingRequestNoOp.getOneMinuteRate())); } }
Source:
public Object perform(InvocationContext ctx) throws Throwable { MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key); if (e != null && !e.isRemoved()) { Object value = e.getValue(); Object prevValue = e.getValue(); Metadata metadata = e.getMetadata(); if (lifespan == null) { if (valueMatcher.matches(prevValue, value, null)) { e.setExpired(true); return performRemove(e, prevValue, ctx); } } else if (metadata == null || metadata.version() == nonExistentVersion) { if (value == null || valueMatcher.matches(prevValue, value, null)) { e.setExpired(true); return performRemove(e, prevValue, ctx); } } else if (e.getLifespan() > 0 && e.getLifespan() == lifespan) { if (valueMatcher.matches(prevValue, value, null)) { if (ExpiryHelper.isExpiredMortal(lifespan, e.getCreated(), timeService.wallClockTime() + 100)) { if (trace) { log.tracef("Removing entry as its lifespan and value match and it created on %s with a current time of %s", e.getCreated(), timeService.wallClockTime()); } e.setExpired(true); return performRemove(e, prevValue, ctx); } else if (trace) { log.tracef("Cannot remove entry due to it not being expired - this can be caused by different " + "clocks on nodes or a concurrent write"); } } } else if (trace) { log.trace("Cannot remove entry as its lifespan or value do not match"); } } else if (trace) { log.trace("Nothing to remove since the entry doesn't exist in the context or it is already removed"); } successful = false; return false; }

Target:
public Object perform(InvocationContext ctx) throws Throwable { MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key); if (e != null && !e.isRemoved()) { Object prevValue = e.getValue(); Metadata metadata = e.getMetadata(); if (lifespan == null) { if (valueMatcher.matches(prevValue, value, null)) { e.setExpired(true); return performRemove(e, prevValue, ctx); } } else if (metadata == null || metadata.version() == nonExistentVersion) { if (value == null || valueMatcher.matches(prevValue, value, null)) { e.setExpired(true); return performRemove(e, prevValue, ctx); } } else if (e.getLifespan() > 0 && e.getLifespan() == lifespan) { if (valueMatcher.matches(prevValue, value, null)) { if (ExpiryHelper.isExpiredMortal(lifespan, e.getCreated(), timeService.wallClockTime() + CLOCK_BUFFER)) { if (trace) { log.tracef("Removing entry as its lifespan and value match and it created on %s with a current time of %s", e.getCreated(), timeService.wallClockTime()); } e.setExpired(true); return performRemove(e, prevValue, ctx); } else if (trace) { log.tracef("Cannot remove entry due to it not being expired - this can be caused by different " + "clocks on nodes or a concurrent write"); } } } else if (trace) { log.trace("Cannot remove entry as its lifespan or value do not match"); } } else if (trace) { log.trace("Nothing to remove since the entry doesn't exist in the context or it is already removed"); } successful = false; return false; }
Source:
public void decorate(JLabel label) { label.setText("<html><a href=\"" + server.getBaseUrl().toString() + "\">" + getDescription() + "</a></html>"); label.setCursor(getPredefinedCursor(HAND_CURSOR)); label.addMouseListener(new MouseAdapterBuilder() .onClick(__ -> invokeLater(() -> uncheckedBrowse(server.getBaseUrl()))) .build()); }

Target:
public void decorate(JLabel label) { label.setText("<html><a href=\"" + server.getBaseUrl().toString() + "\">" + getDescription() + "</a></html>"); label.setCursor(getPredefinedCursor(HAND_CURSOR)); removeAllMouseListeners(label); label.addMouseListener(new MouseAdapterBuilder() .onClick(__ -> invokeLater(() -> uncheckedBrowse(server.getBaseUrl()))) .build()); }
Source:
public void testSlackResponseObject() throws Exception { SlackSendStep.SlackSendStepExecution stepExecution = spy(new SlackSendStep.SlackSendStepExecution()); SlackSendStep slackSendStep = new SlackSendStep("message"); slackSendStep.setToken("token"); slackSendStep.setTokenCredentialId("tokenCredentialId"); slackSendStep.setBotUser(true); slackSendStep.setBaseUrl("baseUrl/"); slackSendStep.setTeamDomain("teamDomain"); slackSendStep.setChannel("channel"); slackSendStep.setColor("good"); stepExecution.step = slackSendStep; when(Jenkins.getActiveInstance()).thenReturn(jenkins); stepExecution.listener = taskListenerMock; when(taskListenerMock.getLogger()).thenReturn(printStreamMock); doNothing().when(printStreamMock).println(); when(stepExecution.getSlackService(anyString(), anyString(), anyString(), anyString(), anyBoolean(), anyString())).thenReturn(slackServiceMock); String savedResponse = IOUtils.toString( this.getClass().getResourceAsStream("response.json") ); when(slackServiceMock.getResponseString()).thenReturn(savedResponse); when(slackServiceMock.publish(anyString(), anyString())).thenReturn(true); SlackResponse response = stepExecution.run(); String expectedId = "F4KE1DABC"; String expectedTs = "1543931401.000500"; assertNotNull(response); assertEquals(expectedId, response.getChannelId()); assertEquals(expectedTs, response.getTs()); }

Target:
public void testSlackResponseObject() throws Exception { SlackSendStep.SlackSendStepExecution stepExecution = spy(new SlackSendStep.SlackSendStepExecution()); SlackSendStep slackSendStep = new SlackSendStep(); slackSendStep.setMessage("message"); slackSendStep.setToken("token"); slackSendStep.setTokenCredentialId("tokenCredentialId"); slackSendStep.setBotUser(true); slackSendStep.setBaseUrl("baseUrl/"); slackSendStep.setTeamDomain("teamDomain"); slackSendStep.setChannel("channel"); slackSendStep.setColor("good"); stepExecution.step = slackSendStep; when(Jenkins.getActiveInstance()).thenReturn(jenkins); stepExecution.listener = taskListenerMock; when(taskListenerMock.getLogger()).thenReturn(printStreamMock); doNothing().when(printStreamMock).println(); when(stepExecution.getSlackService(anyString(), anyString(), anyString(), anyString(), anyBoolean(), anyString())).thenReturn(slackServiceMock); String savedResponse = IOUtils.toString( this.getClass().getResourceAsStream("response.json") ); when(slackServiceMock.getResponseString()).thenReturn(savedResponse); when(slackServiceMock.publish(anyString(), anyString())).thenReturn(true); SlackResponse response = stepExecution.run(); String expectedId = "F4KE1DABC"; String expectedTs = "1543931401.000500"; String expectedThreadId = "F4KE1DABC:1543931401.000500"; assertNotNull(response); assertEquals(expectedId, response.getChannelId()); assertEquals(expectedTs, response.getTs()); assertEquals(expectedThreadId, response.getThreadId()); }
Source:
private void toggleCartVisibility() { if (shoppingCartOpen) { closeCart(); } else { $(sidePanelContainer).addClass(res.style().rightPanel__open()); $(cartIcon).text("+"); $(cartIcon).removeClass("class", font.icons().iconCart()); $(cartButton).addClass(res.style().active()); shoppingCartOpen = true; } }

Target:
private void toggleCartVisibility() { if (shoppingCartOpen) { closeCart(); } else { openCart(); } }
Source:
private void updateDataModel(){ unitList.clear(); if( selectedUnit == null || selectedUnit.getRoot() == null ) { logger.warn("selectedUnit is null?"); return; } List<CourseComponent> leaves = new ArrayList<>(); PrefManager.UserPrefManager userPrefManager = new PrefManager.UserPrefManager(MainApplication.instance()); EnumSet<BlockType> types = userPrefManager.isUserPrefVideoModel() ? EnumSet.of(BlockType.VIDEO) : EnumSet.allOf(BlockType.class); (selectedUnit.getRoot()).fetchAllLeafComponents(leaves, types); unitList.addAll( leaves ); pagerAdapter.notifyDataSetChanged(); ViewPagerDownloadManager.instance.setMainComponent(selectedUnit, unitList); int index = unitList.indexOf(selectedUnit); if ( index >= 0 ){ pager.setCurrentItem( index ); tryToUpdateForEndOfSequential(); } if ( pagerAdapter != null ) pagerAdapter.notifyDataSetChanged(); }

Target:
private void updateDataModel(){ unitList.clear(); if( selectedUnit == null || selectedUnit.getRoot() == null ) { logger.warn("selectedUnit is null?"); return; } List<CourseComponent> leaves = new ArrayList<>(); PrefManager.UserPrefManager userPrefManager = new PrefManager.UserPrefManager(MainApplication.instance()); EnumSet<BlockType> types = userPrefManager.isUserPrefVideoModel() ? EnumSet.of(BlockType.VIDEO) : EnumSet.allOf(BlockType.class); selectedUnit.getRoot().fetchAllLeafComponents(leaves, types); unitList.addAll( leaves ); pagerAdapter.notifyDataSetChanged(); ViewPagerDownloadManager.instance.setMainComponent(selectedUnit, unitList); int index = unitList.indexOf(selectedUnit); if ( index >= 0 ){ pager.setCurrentItem( index ); tryToUpdateForEndOfSequential(); } if ( pagerAdapter != null ) pagerAdapter.notifyDataSetChanged(); }
Source:
public static EditorHandle fetchAndOpen(final IWorkbenchPage page, IBuild build) { final EditorHandle handle = new EditorHandle(); final BuildEditor editor = openEditor(page, handle, build, true); final IBuildPlan plan = build.getPlan(); final String label = build.getLabel(); GetBuildsRequest request = new GetBuildsRequest(build.getPlan(), Collections.singletonList(label), Scope.FULL); GetBuildsOperation operation = BuildsUiInternal.getFactory().getGetBuildsOperation(request); operation.addOperationChangeListener(new OperationChangeListener() { @Override public void done(OperationChangeEvent event) { if (event.getStatus().isOK() && !Display.getDefault().isDisposed()) { final GetBuildsOperation operation = (GetBuildsOperation) event.getOperation(); List<IBuild> builds = operation.getBuilds(); if (builds != null && builds.size() > 0) { final IBuild build2 = builds.get(0); build2.setPlan(plan); build2.setServer(plan.getServer()); PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { editor.setBuild(build2); } }); } else { IStatus status = new Status(IStatus.ERROR, BuildsUiPlugin.ID_PLUGIN, NLS.bind( "The requested build ''{0}'' was not found", label)); handle.setStatus(status); } } else { handle.setStatus(event.getStatus()); } } }); operation.execute(); return handle; }

Target:
public static EditorHandle fetchAndOpen(final IWorkbenchPage page, IBuild build) { final EditorHandle handle = new EditorHandle(); openEditor(page, handle, build, true); final IBuildPlan plan = build.getPlan(); final String label = build.getLabel(); GetBuildsRequest request = new GetBuildsRequest(build.getPlan(), Collections.singletonList(label), Scope.FULL); GetBuildsOperation operation = BuildsUiInternal.getFactory().getGetBuildsOperation(request); operation.addOperationChangeListener(new OperationChangeListener() { @Override public void done(OperationChangeEvent event) { if (event.getStatus().isOK() && !Display.getDefault().isDisposed()) { final GetBuildsOperation operation = (GetBuildsOperation) event.getOperation(); List<IBuild> builds = operation.getBuilds(); if (builds != null && builds.size() > 0) { final IBuild build2 = builds.get(0); build2.setPlan(plan); build2.setServer(plan.getServer()); PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { if (handle.getPart() instanceof BuildEditor) { BuildEditor buildEditor = (BuildEditor) handle.getPart(); if (!buildEditor.isDisposed() && !page.getWorkbenchWindow().getShell().isDisposed()) { buildEditor.getEditorInput().setCompleteBuild(build2); buildEditor.refresh(); } } } }); } else { IStatus status = new Status(IStatus.ERROR, BuildsUiPlugin.ID_PLUGIN, NLS.bind( "The requested build ''{0}'' was not found", label)); handle.setStatus(status); } } else { handle.setStatus(event.getStatus()); } } }); operation.execute(); return handle; }
Source:
public void networkNotInUse() throws Exception { networkNotUsedTest(ValidationResult.VALID, new ArrayList<Nameable>()); }

Target:
public void networkNotInUse() throws Exception { networkNotUsedTest(ValidationResult.VALID, Collections.<Nameable> emptyList()); }
Source:
public boolean hasMultipleValues(final String dimension) { if (isVirtualColumn(dimension)) { return virtualColumns.getVirtualColumn(dimension).capabilities(dimension).hasMultipleValues(); } final Column column = index.getColumn(dimension); if (column == null || !columnSupportsFiltering(column)) { return false; } else { return column.getCapabilities().hasMultipleValues(); } }

Target:
public boolean hasMultipleValues(final String dimension) { if (isVirtualColumn(dimension)) { return virtualColumns.getVirtualColumn(dimension).capabilities(dimension).hasMultipleValues(); } final Column column = index.getColumn(dimension); return column != null && column.getCapabilities().hasMultipleValues(); }
Source:
private String getUniqueSynchronizationString(final Message message) { final String triggeringContainer = message.getHeader(MBHeader.TRIGGERINGCONTAINER_STRING.toString(), String.class); final String deploymentLocation = Settings.OPENTOSCA_CONTAINER_HOSTNAME; final QName typeImplementationID = message.getHeader(MBHeader.TYPEIMPLEMENTATIONID_QNAME.toString(), QName.class); final String implementationArtifactName = message.getHeader(MBHeader.IMPLEMENTATIONARTIFACTNAME_STRING.toString(), String.class); if (triggeringContainer != null && deploymentLocation != null && typeImplementationID != null && implementationArtifactName != null) { return triggeringContainer + "/" + deploymentLocation + "/" + typeImplementationID.toString() + "/" + implementationArtifactName; } else { return null; } }

Target:
private String getUniqueSynchronizationString(final Message message) { final String triggeringContainer = message.getHeader(MBHeader.TRIGGERINGCONTAINER_STRING.toString(), String.class); final String deploymentLocation = Settings.OPENTOSCA_CONTAINER_HOSTNAME; final QName typeImplementationID = message.getHeader(MBHeader.TYPEIMPLEMENTATIONID_QNAME.toString(), QName.class); final String implementationArtifactName = message.getHeader(MBHeader.IMPLEMENTATIONARTIFACTNAME_STRING.toString(), String.class); return ManagementBusServiceImpl.getUniqueSynchronizationString(triggeringContainer, deploymentLocation, typeImplementationID, implementationArtifactName); }
Source:
private static boolean isBuilderSetterMethod(Accessor method) { if ( method.isBuilder() ) { String methodReturnType = method.getExecutable().getReturnType().toString(); String builderType = method.getBuilderType().toString(); return methodReturnType.equals( builderType ); } else { return false; } }

Target:
private static boolean isBuilderSetterMethod(Accessor method) { if ( method.isBuilder() ) { return !method.getSimpleName().contentEquals( "build" ); } else { return false; } }
Source:
private void listFiles(File directory, List<File> files, String suffix) { if (directory != null) { File[] fList = directory.listFiles(); if (fList != null) { for (File file : fList) { if (suffix != null) { if (file.isFile() && file.getName().toLowerCase().endsWith("." + suffix)) { files.add(file); } else if (file.isDirectory()) { listFiles(file, files, suffix); } } else { if (file.isFile()) { files.add(file); } else if (file.isDirectory()) { listFiles(file, files, suffix); } } } } } }

Target:
private void listFiles(File directory, List<File> files, String suffix) { if (directory != null) { File[] fList = directory.listFiles(); if (fList != null) { for (File file : fList) { if (file.isFile() && ((suffix == null) || (file.getName().toLowerCase().endsWith("." + suffix)))) { files.add(file); } else if (file.isDirectory()) { listFiles(file, files, suffix); } } } } }
Source:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptyTopEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, ""); assertDataIOSet(emptyTopEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptyTopEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, EMPTY_VALUE); assertDataIOSet(emptyTopEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
public LocalTime getStartTimeForTrips (Collection<Trip> trips) { int earliestDeparture = Integer.MAX_VALUE; for (Trip trip : trips) { StopTime st; try { st = StreamSupport.stream(feed.getInterpolatedStopTimesForTrip(trip.trip_id).spliterator(), false) .findFirst() .orElse(null); } catch (GTFSFeed.FirstAndLastStopsDoNotHaveTimes e) { return null; } if (st.departure_time > 86399) continue; if (st.departure_time <= earliestDeparture) { earliestDeparture = st.departure_time; } } return LocalTime.ofSecondOfDay(earliestDeparture); }

Target:
public LocalTime getStartTimeForTrips (Collection<Trip> trips) { int earliestDeparture = Integer.MAX_VALUE; for (Trip trip : trips) { StopTime st = feed.getOrderedStopTimesForTrip(trip.trip_id).iterator().next(); int dep = st.departure_time; if (dep > 86399) { dep = dep % 86399; } if (dep <= earliestDeparture) { earliestDeparture = dep; } } return LocalTime.ofSecondOfDay(earliestDeparture); }
Source:
public static Message parseMessage(InputStream is) throws IOException, MimeIOException { try { MessageImpl message = new MessageImpl(); MimeConfig cfg = new MimeConfig(); boolean strict = cfg.isStrictParsing(); DecodeMonitor mon = strict ? DecodeMonitor.STRICT : DecodeMonitor.SILENT; BodyDescriptorBuilder bdb = new DefaultBodyDescriptorBuilder(null, strict ? DefaultFieldParser.getParser() : LenientFieldParser.getParser(), mon); BodyFactory bf = new BasicBodyFactory(); MimeStreamParser parser = new MimeStreamParser(cfg, mon, bdb); parser.setContentHandler(new Mime4jWorkaroundBinaryEntityBuilder(message, bf)); parser.setContentDecoding(false); parser.setRecurse(); parser.parse(is); return message; } catch (MimeException e) { throw new MimeIOException(e); } }

Target:
public static Message parseMessage(InputStream is) throws IOException, MimeIOException { try { MessageImpl message = new MessageImpl(); MimeConfig cfg = new MimeConfig(); boolean strict = cfg.isStrictParsing(); DecodeMonitor mon = strict ? DecodeMonitor.STRICT : DecodeMonitor.SILENT; BodyDescriptorBuilder bdb = new DefaultBodyDescriptorBuilder(null, strict ? DefaultFieldParser.getParser() : LenientFieldParser.getParser(), mon); StorageProvider storageProvider; if (System.getProperty(DefaultStorageProvider.DEFAULT_STORAGE_PROVIDER_PROPERTY) != null) { storageProvider = DefaultStorageProvider.getInstance(); } else { StorageProvider backend = new CustomTempFileStorageProvider(); storageProvider = new ThresholdStorageProvider(backend, 1024); } BodyFactory bf = new StorageBodyFactory(storageProvider, mon); MimeStreamParser parser = new MimeStreamParser(cfg, mon, bdb); parser.setContentHandler(new Mime4jWorkaroundBinaryEntityBuilder(message, bf)); parser.setContentDecoding(false); parser.setRecurse(); parser.parse(is); return message; } catch (MimeException e) { throw new MimeIOException(e); } }
Source:
public String enqueueGetMbusEncryptionKeyStatusByChannelRequest(final String organisationIdentification, final String deviceIdentification, final int messagePriority, final Long scheduleTime, final short channel) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); final Device device = this.domainHelperService.findActiveDevice(deviceIdentification); this.domainHelperService.isAllowed(organisation, device, DeviceFunction.GET_MBUS_ENCRYPTION_KEY_STATUS); LOGGER.debug("enqueueGetMbusEncryptionKeyStatusRequest called with organisation and device {}", organisationIdentification, deviceIdentification); final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification); final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(deviceIdentification, organisationIdentification, correlationUid, SmartMeteringRequestMessageType.GET_MBUS_ENCRYPTION_KEY_STATUS_BY_CHANNEL.toString(), messagePriority, scheduleTime); final SmartMeteringRequestMessage message = new SmartMeteringRequestMessage.Builder() .deviceMessageMetadata(deviceMessageMetadata) .request(new GetMbusEncryptionKeyStatusByChannelRequestData(channel)).build(); this.smartMeteringRequestMessageSender.send(message); return correlationUid; }

Target:
public String enqueueGetMbusEncryptionKeyStatusByChannelRequest(final String organisationIdentification, final String deviceIdentification, final int messagePriority, final Long scheduleTime, final short channel) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); final Device device = this.domainHelperService.findActiveDevice(deviceIdentification); this.domainHelperService.isAllowed(organisation, device, DeviceFunction.GET_MBUS_ENCRYPTION_KEY_STATUS_BY_CHANNEL); LOGGER.debug("enqueueGetMbusEncryptionKeyStatusByChannelRequest called with organisation and device {}", organisationIdentification, deviceIdentification); final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification); final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(deviceIdentification, organisationIdentification, correlationUid, SmartMeteringRequestMessageType.GET_MBUS_ENCRYPTION_KEY_STATUS_BY_CHANNEL.toString(), messagePriority, scheduleTime); final SmartMeteringRequestMessage message = new SmartMeteringRequestMessage.Builder() .deviceMessageMetadata(deviceMessageMetadata) .request(new GetMbusEncryptionKeyStatusByChannelRequestData(channel)).build(); this.smartMeteringRequestMessageSender.send(message); return correlationUid; }
Source:
public KinesisInputDescriptor<StreamMessageType> withRegion(String region) { this.region = Optional.of(region); return this; }

Target:
public KinesisInputDescriptor<StreamMessageType> withRegion(String region) { this.region = Optional.of(StringUtils.stripToNull(region)); return this; }