auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private <ID extends Serializable> ResourceSupport findRelEntryInternal(HttpServletRequest request, String apiCategory, String model, String id, String rel, String relid, Pageable page, PagedResourcesAssembler assembler, String projection) { checkModelPluralForm(apiCategory, model); DSpaceRestRepository<DirectlyAddressableRestModel, ID> repository = utils.getResourceRepository(apiCategory, model); Class<DirectlyAddressableRestModel> domainClass = repository.getDomainClass(); LinkRest linkRest = utils.getLinkRest(rel, domainClass); if (linkRest != null) { LinkRestRepository linkRepository = utils.getLinkResourceRepository(apiCategory, model, linkRest.name()); Method linkMethod = repositoryUtils.getLinkMethod("getResource", linkRepository); try { Object object = linkMethod.invoke(linkRepository, request, id, relid, page, projection); Link link = linkTo(this.getClass(), apiCategory, English.plural(model)).slash(id) .slash(rel).withSelfRel(); List result = new ArrayList(); result.add(object); PageImpl<DirectlyAddressableRestModel> pageResult = new PageImpl(result, page, 1); return assembler.toResource(pageResult.map(linkRepository::wrapResource),link); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } } return null; }

Target:
private <ID extends Serializable> ResourceSupport findRelEntryInternal(HttpServletRequest request, String apiCategory, String model, String id, String rel, String relid, Pageable page, PagedResourcesAssembler assembler, String projection) { checkModelPluralForm(apiCategory, model); DSpaceRestRepository<RestAddressableModel, ID> repository = utils.getResourceRepository(apiCategory, model); Class<RestAddressableModel> domainClass = repository.getDomainClass(); LinkRest linkRest = utils.getLinkRest(rel, domainClass); if (linkRest != null) { LinkRestRepository linkRepository = utils.getLinkResourceRepository(apiCategory, model, linkRest.name()); Method linkMethod = repositoryUtils.getLinkMethod("getResource", linkRepository); try { Object object = linkMethod.invoke(linkRepository, request, id, relid, page, projection); Link link = linkTo(this.getClass(), apiCategory, English.plural(model)).slash(id) .slash(rel).withSelfRel(); List result = new ArrayList(); result.add(object); PageImpl<RestAddressableModel> pageResult = new PageImpl(result, page, 1); Page<HALResource> halResources = pageResult.map(linkRepository::wrapResource); halResources.forEach(linkService::addLinks); return assembler.toResource(halResources, link); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } } return null; }
Source:
private long getMemoryMb(String key) { long memoryMb = 1536L; memoryMb = this.jobConf.getLong(key, 1536L); if (memoryMb == 0L) { throw new ProcessingException( "While correcting slot millis, " + key + " was found to be 0 "); } return memoryMb; }

Target:
private long getMemoryMb(String key) { long memoryMb = 0L; if (Constants.MAP_MEMORY_MB_CONF_KEY.equals(key)){ memoryMb = this.jobConf.getLong(key, Constants.DEFAULT_MAP_MEMORY_MB); }else if (Constants.REDUCE_MEMORY_MB_CONF_KEY.equals(key)){ memoryMb = this.jobConf.getLong(key, Constants.DEFAULT_REDUCE_MEMORY_MB); } if (memoryMb == 0L) { throw new ProcessingException( "While correcting slot millis, " + key + " was found to be 0 "); } return memoryMb; }
Source:
private AuthenticationResult getTokenWithRefreshTokenAndUpdateCache( final AuthenticationRequest request, final RefreshItem refreshItem) throws AuthenticationException { AuthenticationResult result = getTokenWithRefreshToken(request, refreshItem.mRefreshToken); if (result == null || StringExtensions.IsNullOrBlank(result.getAccessToken())) { String errLogInfo = result == null ? "" : result.getErrorLogInfo(); Logger.e(TAG, "Refresh token did not return accesstoken.", request.getLogInfo() + errLogInfo, ADALError.AUTH_FAILED_NO_TOKEN); if (AuthenticationConstants.OAuth2ErrorCode.INVALID_GRANT.equals(result.getErrorCode())) { Logger.v(TAG, "Removing token cache for invalid_grant error returned from server."); removeItemFromCache(refreshItem); } return result; } else { Logger.v(TAG, "It finished refresh token request:" + request.getLogInfo()); if (result.getUserInfo() == null && refreshItem.mUserInfo != null) { Logger.v(TAG, "UserInfo is updated from cached result:" + request.getLogInfo()); result.setUserInfo(refreshItem.mUserInfo); result.setIdToken(refreshItem.mRawIdToken); result.setTenantId(refreshItem.mTenantId); } Logger.v(TAG, "Cache is used. It will set item to cache" + request.getLogInfo()); setItemToCacheFromRefresh(refreshItem, request, result); return result; } }

Target:
private AuthenticationResult getTokenWithRefreshTokenAndUpdateCache( final AuthenticationRequest request, final RefreshItem refreshItem) throws AuthenticationException { final AuthenticationResult result = getTokenWithRefreshToken(request, refreshItem.mRefreshToken); if (result == null || StringExtensions.IsNullOrBlank(result.getAccessToken())) { String errLogInfo = result == null ? "" : result.getErrorLogInfo(); Logger.e(TAG, "Refresh token did not return accesstoken.", request.getLogInfo() + errLogInfo, ADALError.AUTH_FAILED_NO_TOKEN); if (result != null && AuthenticationConstants.OAuth2ErrorCode.INVALID_GRANT.equalsIgnoreCase(result.getErrorCode())) { Logger.v(TAG, "Removing token cache for invalid_grant error returned from server."); removeItemFromCache(refreshItem); } } else { if (result.getUserInfo() == null && refreshItem.mUserInfo != null) { Logger.v(TAG, "UserInfo is updated from cached result:" + request.getLogInfo()); result.setUserInfo(refreshItem.mUserInfo); result.setIdToken(refreshItem.mRawIdToken); result.setTenantId(refreshItem.mTenantId); } Logger.v(TAG, "Saving item into the cache." + request.getLogInfo()); setItemToCacheFromRefresh(refreshItem, request, result); } return result; }
Source:
protected ImmutableSet<Path> getWritableDirs(Path sandboxExecRoot, Map<String, String> env) throws IOException { ImmutableSet.Builder<Path> writablePaths = ImmutableSet.builder(); writablePaths.add(sandboxExecRoot); String testTmpdir = env.get("TEST_TMPDIR"); if (testTmpdir != null) { addWritablePath( sandboxExecRoot, writablePaths, testTmpdir, "Cannot resolve symlinks in TEST_TMPDIR because it doesn't exist: \"%s\""); } if (OS.getCurrent() == OS.WINDOWS) { addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TEMP")), "Cannot resolve symlinks in TMPDIR because it doesn't exist: \"%s\""); addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TMP")), "Cannot resolve symlinks in TMPDIR because it doesn't exist: \"%s\""); } else { addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TMPDIR")), "Cannot resolve symlinks in TMPDIR because it doesn't exist: \"%s\""); } FileSystem fileSystem = sandboxExecRoot.getFileSystem(); for (String writablePath : sandboxOptions.sandboxWritablePath) { Path path = fileSystem.getPath(writablePath); writablePaths.add(path); if (path.isSymbolicLink()) { writablePaths.add(path.resolveSymbolicLinks()); } } return writablePaths.build(); }

Target:
protected ImmutableSet<Path> getWritableDirs(Path sandboxExecRoot, Map<String, String> env) throws IOException { ImmutableSet.Builder<Path> writablePaths = ImmutableSet.builder(); writablePaths.add(sandboxExecRoot); String testTmpdir = env.get("TEST_TMPDIR"); if (testTmpdir != null) { addWritablePath( sandboxExecRoot, writablePaths, testTmpdir, "Cannot resolve symlinks in TEST_TMPDIR because it doesn't exist: \"%s\""); } if (OS.getCurrent() == OS.WINDOWS) { addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TEMP")), "Cannot resolve symlinks in TEMP because it doesn't exist: \"%s\""); addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TMP")), "Cannot resolve symlinks in TMP because it doesn't exist: \"%s\""); } else { addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TMPDIR")), "Cannot resolve symlinks in TMPDIR because it doesn't exist: \"%s\""); } FileSystem fileSystem = sandboxExecRoot.getFileSystem(); for (String writablePath : sandboxOptions.sandboxWritablePath) { Path path = fileSystem.getPath(writablePath); writablePaths.add(path); if (OS.getCurrent() != OS.WINDOWS || path.isSymbolicLink()) { writablePaths.add(path.resolveSymbolicLinks()); } } return writablePaths.build(); }
Source:
public RedisAssociationRowAccessor(String[] prefixedColumns, String prefix) { this.prefix = prefix; if ( prefix != null ) { this.prefixedColumns = Arrays.asList( prefixedColumns ); } else { this.prefixedColumns = new ArrayList<String>( 0 ); } }

Target:
public RedisAssociationRowAccessor(String[] prefixedColumns, String prefix) { this.prefix = prefix; if ( prefix != null ) { this.prefixedColumns = Arrays.asList( prefixedColumns ); } else { this.prefixedColumns = Collections.emptyList(); } }
Source:
public static String extractDigestFromAssertion(AssertionType assertion) { return assertion != null && !StringUtils.isBlank(assertion.getDigestAlgorithm()) ? assertion.getDigestAlgorithm() : getDigestAlgorithm(); }

Target:
public static String extractDigestFromAssertion(AssertionType assertion) { return assertion != null && StringUtils.isNotBlank(assertion.getDigestAlgorithm()) ? assertion.getDigestAlgorithm() : getDigestAlgorithm(); }
Source:
private List<GlusterHostEntity> getGlusterPeers(Guid upServerId) { VDSReturnValue returnValue = Backend.getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GlusterHostsList, new VdsIdVDSCommandParametersBase(upServerId)); if (!returnValue.getSucceeded()) { getReturnValue().getFault().setError(returnValue.getVdsError().getCode()); getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage()); AuditLogDirector.log(new AuditLogableBase(upServerId), AuditLogType.GLUSTER_HOST_LIST_FAILED); } return (List<GlusterHostEntity>) returnValue.getReturnValue(); }

Target:
private List<GlusterServerInfo> getGlusterPeers(Guid upServerId) { List<GlusterServerInfo> glusterServers = new ArrayList<GlusterServerInfo>(); VDSReturnValue returnValue = Backend.getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(upServerId)); if (!returnValue.getSucceeded()) { getReturnValue().getFault().setError(returnValue.getVdsError().getCode()); getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage()); AuditLogDirector.log(new AuditLogableBase(upServerId), AuditLogType.GLUSTER_SERVERS_LIST_FAILED); } else { glusterServers = (List<GlusterServerInfo>) returnValue.getReturnValue(); } return glusterServers; }
Source:
protected NuxeoGroup readEntity(JsonNode jn) throws IOException { GroupConfig groupConfig = userManager.getGroupConfig(); String id = getStringField(jn, "id"); String groupName = getStringField(jn, "groupname"); if (StringUtils.isBlank(id) || ((StringUtils.isNotBlank(groupName)) && !id.equals(groupName))) { id = groupName; } DocumentModel groupModel = null; if (StringUtils.isNotBlank(id)) { groupModel = userManager.getGroupModel(id); } if (groupModel == null) { groupModel = userManager.getBareGroupModel(); groupModel.setProperty(groupConfig.schemaName, groupConfig.idField, id); } String beforeReadLabel = (String) groupModel.getProperty(groupConfig.schemaName, groupConfig.labelField); readProperties(groupModel, groupConfig, jn); readMemberUsers(groupModel, groupConfig, jn); readMemberGroups(groupModel, groupConfig, jn); readParentGroups(groupModel, groupConfig, jn); if (StringUtils.isNotBlank(id)) { groupModel.setProperty(groupConfig.schemaName, groupConfig.idField, id); } if (jn.has("grouplabel")) { String compatLabel = getStringField(jn, "grouplabel"); String label = (String) groupModel.getProperty(groupConfig.schemaName, groupConfig.labelField); if (!Objects.equals(label, compatLabel) && (beforeReadLabel == null || Objects.equals(beforeReadLabel, label))) { groupModel.setProperty(groupConfig.schemaName, groupConfig.labelField, getStringField(jn, "grouplabel")); } } return new NuxeoGroupImpl(groupModel, groupConfig); }

Target:
protected NuxeoGroup readEntity(JsonNode jn) throws IOException { GroupConfig groupConfig = userManager.getGroupConfig(); String id = getStringField(jn, "id"); String groupName = getStringField(jn, GROUP_NAME_COMPATIBILITY_FIELD); if (StringUtils.isBlank(id) || (StringUtils.isNotBlank(groupName) && !id.equals(groupName))) { id = groupName; } DocumentModel groupModel = null; if (StringUtils.isNotBlank(id)) { groupModel = userManager.getGroupModel(id); } if (groupModel == null) { groupModel = userManager.getBareGroupModel(); groupModel.setProperty(groupConfig.schemaName, groupConfig.idField, id); } String beforeReadLabel = (String) groupModel.getProperty(groupConfig.schemaName, groupConfig.labelField); readProperties(groupModel, groupConfig, jn); readMemberUsers(groupModel, groupConfig, jn); readMemberGroups(groupModel, groupConfig, jn); readParentGroups(groupModel, groupConfig, jn); if (StringUtils.isNotBlank(id)) { groupModel.setProperty(groupConfig.schemaName, groupConfig.idField, id); } if (jn.has(GROUP_LABEL_COMPATIBILITY_FIELD)) { String compatLabel = getStringField(jn, GROUP_LABEL_COMPATIBILITY_FIELD); String label = (String) groupModel.getProperty(groupConfig.schemaName, groupConfig.labelField); if (!Objects.equals(label, compatLabel) && (beforeReadLabel == null || Objects.equals(beforeReadLabel, label))) { groupModel.setProperty(groupConfig.schemaName, groupConfig.labelField, compatLabel); } } return new NuxeoGroupImpl(groupModel, groupConfig); }
Source:
public String getIdentifierQuoteString() throws SQLException { HPCCJDBCUtils.traceoutln(TraceLevel.VERBOSE, "HPCCDatabaseMetaData getIdentifierQuoteString"); return ""; }

Target:
public String getIdentifierQuoteString() throws SQLException { HPCCJDBCUtils.traceoutln(Level.FINEST, "HPCCDatabaseMetaData getIdentifierQuoteString"); return ""; }
Source:
private static Point drawArrowHead(int x0, int y0, int x1, int y1, float scale, GC gc) { double factor = 10 + 2.0 * scale; double cos = 0.9510; double sin = 0.3090; long lenx = x1 - x0; long leny = y1 - y0; double len = Math.sqrt(lenx * lenx + leny * leny); double dx = factor * lenx / len; double dy = factor * leny / len; int end1X = (int) Math.round((x1 - (dx * cos + dy * -sin))); int end1Y = (int) Math.round((y1 - (dx * sin + dy * cos))); int end2X = (int) Math.round((x1 - (dx * cos + dy * sin))); int end2Y = (int) Math.round((y1 - (dx * -sin + dy * cos))); gc.toString(); int[] arrow = new int[] { x1, y1, end1X, end1Y, end2X, end2Y, x1, y1 }; gc.fillPolygon(arrow); return new Point((3 * ((end1X + end2X) / 2) + x1) / 4, (3 * ((end1Y + end2Y) / 2) + y1) / 4); }

Target:
private static Point drawArrowHead(int x0, int y0, int x1, int y1, float scale, GC gc) { double factor = 10 + 2.0 * scale; double cos = 0.9510; double sin = 0.3090; long lenx = x1 - x0; long leny = y1 - y0; double len = Math.sqrt(lenx * lenx + leny * leny); double dx = factor * lenx / len; double dy = factor * leny / len; int end1X = (int) Math.round((x1 - (dx * cos + dy * -sin))); int end1Y = (int) Math.round((y1 - (dx * sin + dy * cos))); int end2X = (int) Math.round((x1 - (dx * cos + dy * sin))); int end2Y = (int) Math.round((y1 - (dx * -sin + dy * cos))); int[] arrow = new int[] { x1, y1, end1X, end1Y, end2X, end2Y, x1, y1 }; gc.fillPolygon(arrow); return new Point((3 * ((end1X + end2X) / 2) + x1) / 4, (3 * ((end1Y + end2Y) / 2) + y1) / 4); }
Source:
public void testGetScript() throws Exception { School.SrlBankProblem.Builder bankProblem = School.SrlBankProblem.newBuilder(); bankProblem.setId(FAKE_ID); bankProblem.setScript("Fake Script"); bankProblem.setQuestionText(FAKE_QUESTION_TEXT); Util.SrlPermission.Builder permissionBuilder = Util.SrlPermission.newBuilder(); permissionBuilder.addAdminPermission(ADMIN_USER); permissionBuilder.addUserPermission(USER_USER); bankProblem.setAccessPermission(permissionBuilder); String problemBankId = mongoInsertBankProblem(db, bankProblem.build()); SrlBankProblem getProblem = mongoGetBankProblem(fauth, db, problemBankId, ADMIN_USER); String testString = getProblem.getScript().toString(); Assert.assertEquals("Fake Script", testString); }

Target:
public void testGetScript() throws Exception { School.SrlBankProblem.Builder bankProblem = School.SrlBankProblem.newBuilder(); bankProblem.setId(FAKE_ID); bankProblem.setScript(FAKE_SCRIPT); bankProblem.setQuestionText(FAKE_QUESTION_TEXT); Util.SrlPermission.Builder permissionBuilder = Util.SrlPermission.newBuilder(); permissionBuilder.addAdminPermission(ADMIN_USER); permissionBuilder.addUserPermission(USER_USER); bankProblem.setAccessPermission(permissionBuilder); String problemBankId = mongoInsertBankProblem(db, bankProblem.build()); SrlBankProblem getProblem = mongoGetBankProblem(fauth, db, problemBankId, ADMIN_USER); String testString = getProblem.getScript().toString(); Assert.assertEquals(FAKE_SCRIPT, testString); }
Source:
public void init() throws Exception { deviceTypePluginDeployer = Mockito.mock(DeviceTypePluginDeployer.class, Mockito.CALLS_REAL_METHODS); serviceRegistration = Mockito.mock(ServiceRegistration.class, Mockito.CALLS_REAL_METHODS); Mockito.doReturn(serviceRegistration).when(deviceTypePluginDeployer).registerDeviceType(Mockito.any(), Mockito.any()); deviceTypeServiceRegistrations = DeviceTypePluginDeployer.class.getDeclaredField ("deviceTypeServiceRegistrations"); deviceTypeServiceRegistrations.setAccessible(true); deviceTypeServiceRegistrations.set(deviceTypePluginDeployer, new ConcurrentHashMap()); deviceTypeConfigurationDataMap = DeviceTypePluginDeployer.class.getDeclaredField ("deviceTypeConfigurationDataMap"); deviceTypeConfigurationDataMap.setAccessible(true); deviceTypeConfigurationDataMap.set(deviceTypePluginDeployer, new ConcurrentHashMap()); this.initializeCarbonContext(); }

Target:
public void init() throws NoSuchFieldException, IllegalAccessException, IOException, RegistryException { deviceTypePluginDeployer = Mockito.mock(DeviceTypePluginDeployer.class, Mockito.CALLS_REAL_METHODS); serviceRegistration = Mockito.mock(ServiceRegistration.class, Mockito.CALLS_REAL_METHODS); Mockito.doReturn(serviceRegistration).when(deviceTypePluginDeployer).registerDeviceType(Mockito.any(), Mockito.any()); deviceTypeServiceRegistrations = DeviceTypePluginDeployer.class.getDeclaredField ("deviceTypeServiceRegistrations"); deviceTypeServiceRegistrations.setAccessible(true); deviceTypeServiceRegistrations.set(deviceTypePluginDeployer, new ConcurrentHashMap()); deviceTypeConfigurationDataMap = DeviceTypePluginDeployer.class.getDeclaredField ("deviceTypeConfigurationDataMap"); deviceTypeConfigurationDataMap.setAccessible(true); deviceTypeConfigurationDataMap.set(deviceTypePluginDeployer, new ConcurrentHashMap()); this.initializeCarbonContext(); }
Source:
public void setSort(SortOrder sort) { this.mySort = sort; }

Target:
public void setSort(SortOrder sort) { mySort = sort; }
Source:
protected void requestFileName(){ String name = "Enter File Name"; Builder builder = new AlertDialog.Builder(mapActivity); builder.setTitle(name); FrameLayout parent = new FrameLayout(mapActivity); final EditText editText = new EditText(mapActivity); editText.setId(R.id.TextView); parent.setPadding(15, 0, 15, 0); parent.addView(editText); builder.setView(parent); builder.setNegativeButton(R.string.default_buttons_cancel, null); builder.setPositiveButton(R.string.default_buttons_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String fileName = editText.getText().toString(); requestedName = fileName; } }); builder.show(); }

Target:
protected void requestFileName(){ mapActivity.showDialog(DIALOG_REQUEST_FILENAME_ID); }
Source:
public void initialise() { uiTitle = find("title", UILabel.class); if (uiTitle != null) { uiTitle.setText(title); } uiSubtitle = find("subtitle", UILabel.class); if (uiSubtitle != null) { uiSubtitle.setText(subtitle); } }

Target:
public void initialise() { uiTitle = find("title", UILabel.class); if (uiTitle != null) { uiTitle.bindText(new ReadOnlyBinding<String>() { @Override public String get() { return title; } }); } uiSubtitle = find("subtitle", UILabel.class); if (uiSubtitle != null) { uiSubtitle.bindText(new ReadOnlyBinding<String>() { @Override public String get() { return subtitle; } }); } }
Source:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == EMAIL_CREDENTIALS) { if (resultCode == RESULT_OK) { Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY); mEmailInput.getEditText().setText(credential.getId()); next(getCleanedEmail()); } else { hasDismissedEmailHints = true; EditTextUtils.showSoftInput(mEmailInput.getEditText()); } isDisplayingEmailHints = false; } }

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == EMAIL_CREDENTIALS) { if (resultCode == RESULT_OK) { Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY); mEmailInput.getEditText().setText(credential.getId()); next(getCleanedEmail()); } else { hasDismissedEmailHints = true; mEmailInput.getEditText().postDelayed(new Runnable() { @Override public void run() { if (isAdded()) { EditTextUtils.showSoftInput(mEmailInput.getEditText()); } } }, getResources().getInteger(android.R.integer.config_mediumAnimTime)); } isDisplayingEmailHints = false; } }
Source:
protected boolean waitForWritable(DistributionSchedule.WriteSet writeSet, long key, int allowedNonWritableCount, long durationMs) { if (durationMs < 0) { return true; } final long startTime = MathUtils.nowInNano(); boolean success = true; if (durationMs == 0) { success = isWritesetWritable(writeSet, key, allowedNonWritableCount); } else { int backoff = 1; final Instant deadline = Instant.now().plus(durationMs, ChronoUnit.MILLIS); while (!isWritesetWritable(writeSet, key, allowedNonWritableCount)) { if (Instant.now().isBefore(deadline)) { long maxSleep = Duration.between(Instant.now(), deadline).toMillis(); if (maxSleep < 0) { maxSleep = 1; } long sleepMs = Math.min(backoff, maxSleep); try { Thread.sleep(sleepMs); } catch (InterruptedException e) { Thread.currentThread().interrupt(); success = isWritesetWritable(writeSet, key, allowedNonWritableCount); break; } backoff = backoff * 2; } else { success = false; break; } } } if (success) { sendWaitStats.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } else { sendWaitStats.registerFailedEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } return success; }

Target:
protected boolean waitForWritable(DistributionSchedule.WriteSet writeSet, long key, int allowedNonWritableCount, long durationMs) { if (durationMs < 0) { return true; } final long startTime = MathUtils.nowInNano(); boolean success = isWritesetWritable(writeSet, key, allowedNonWritableCount); if (!success && durationMs > 0) { int backoff = 1; final int maxBackoff = 4; final long deadline = startTime + TimeUnit.MILLISECONDS.toNanos(durationMs); while (!isWritesetWritable(writeSet, key, allowedNonWritableCount)) { if (MathUtils.nowInNano() < deadline) { long maxSleep = MathUtils.elapsedMSec(startTime); if (maxSleep < 0) { maxSleep = 1; } long sleepMs = Math.min(backoff, maxSleep); try { TimeUnit.MILLISECONDS.sleep(sleepMs); } catch (InterruptedException e) { Thread.currentThread().interrupt(); success = isWritesetWritable(writeSet, key, allowedNonWritableCount); break; } if (backoff <= maxBackoff) { backoff++; } } else { success = false; break; } } if (backoff > 1) { LOG.info("Spent ms waiting for writable channels", MathUtils.elapsedMSec(startTime), writeSet.size() - allowedNonWritableCount); } } if (success) { clientChannelWriteWaitStats.registerSuccessfulEvent( MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } else { clientChannelWriteWaitStats.registerFailedEvent( MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } return success; }
Source:
public IStatus run(IProgressMonitor mymonitor) { PullResult pullResult = null; try (Git git = new Git(repository)) { PullCommand pull = git.pull(); SubMonitor monitor = SubMonitor.convert(mymonitor, 4); pull.setProgressMonitor(new EclipseGitProgressTransformer( monitor)); monitor.newChild(3); pull.setTimeout(timeout); pull.setCredentialsProvider(credentialsProvider); if (config != null) { if (config.getRemote() != null) { pull.setRemote(config.getRemote()); } if (config.getReference() != null) { pull.setRemoteBranchName(config.getReference()); } pull.setRebase(config.getUpstreamConfig()); } MergeStrategy strategy = Activator.getDefault() .getPreferredMergeStrategy(); if (strategy != null) { pull.setStrategy(strategy); } pullResult = pull.call(); synchronized (results) { results.put(repository, pullResult); } IProject[] projects = ProjectUtil .getValidOpenProjects(repository); if (refreshNeeded(pullResult)) { ProjectUtil.refreshValidProjects(projects, monitor); } monitor.newChild(1); return Status.OK_STATUS; } catch (DetachedHeadException e) { return Activator.error( CoreText.PullOperation_DetachedHeadMessage, e); } catch (InvalidConfigurationException e) { return Activator .error(CoreText.PullOperation_PullNotConfiguredMessage, e); } catch (GitAPIException | CoreException e) { return Activator.error(e.getMessage(), e); } catch (JGitInternalException e) { Throwable cause = e.getCause(); if (cause == null || !(cause instanceof TransportException)) cause = e; return Activator.error(cause.getMessage(), cause); } finally { mymonitor.done(); } }

Target:
public IStatus run(IProgressMonitor mymonitor) { PullResult pullResult = null; try (Git git = new Git(repository)) { PullCommand pull = git.pull(); SubMonitor monitor = SubMonitor.convert(mymonitor, 4); pull.setProgressMonitor(new EclipseGitProgressTransformer( monitor.newChild(3))); pull.setTimeout(timeout); pull.setCredentialsProvider(credentialsProvider); if (config != null) { if (config.getRemote() != null) { pull.setRemote(config.getRemote()); } if (config.getReference() != null) { pull.setRemoteBranchName(config.getReference()); } pull.setRebase(config.getUpstreamConfig()); } MergeStrategy strategy = Activator.getDefault() .getPreferredMergeStrategy(); if (strategy != null) { pull.setStrategy(strategy); } pullResult = pull.call(); synchronized (results) { results.put(repository, pullResult); } IProject[] projects = ProjectUtil .getValidOpenProjects(repository); if (refreshNeeded(pullResult)) { ProjectUtil.refreshValidProjects(projects, monitor.newChild(1)); } else { monitor.worked(1); } return Status.OK_STATUS; } catch (DetachedHeadException e) { return Activator.error( CoreText.PullOperation_DetachedHeadMessage, e); } catch (InvalidConfigurationException e) { return Activator .error(CoreText.PullOperation_PullNotConfiguredMessage, e); } catch (GitAPIException | CoreException e) { return Activator.error(e.getMessage(), e); } catch (JGitInternalException e) { Throwable cause = e.getCause(); if (cause == null || !(cause instanceof TransportException)) { cause = e; } return Activator.error(cause.getMessage(), cause); } finally { mymonitor.done(); } }
Source:
public ParametersBuilder add(int year, int month, int day, int hour, int minute, int second, int nanosecond, String offset, ZoneId defaultTimeZone) { if ( isNanosecondPrecisionSupported() ) { nanosecond = 0; } return add( defaultTimeZone, year, month, day, hour, minute, second, nanosecond, offset ); }

Target:
public ParametersBuilder add(int year, int month, int day, int hour, int minute, int second, int nanosecond, String offset, ZoneId defaultTimeZone) { if ( !isNanosecondPrecisionSupported() ) { nanosecond = 0; } return add( defaultTimeZone, year, month, day, hour, minute, second, nanosecond, offset ); }
Source:
public void sendSeatOverrideMail(User user) { String subject = "Your seat was reset"; String message = "Your seat was reset by an admin.\nPlease log in to My Area to select your new seat."; sendMail(user.getUsername(), user.getUsername(), subject, message); }

Target:
public void sendSeatOverrideMail(User user) { String subject = "Your seat was reset"; String message = "Unfortunately we had to reallocate your reserved seat.\n" + "Please contact us if you have any questions.\n" + "You can reserve a new seat through <a href=\"<LINK_0>\">My Area</a>."; sendMail(user.getUsername(), user.getUsername(), subject, message); }
Source:
void testUpdateWhenResultDetailIsNotEmpty() { when(mockResultServiceEventData.getResultDetails()).thenReturn("SomeData"); underTest.update(mockAttemptAuditEventResult, mockResultServiceEventData); verify(mockResultServiceEventDataBuilder, times(1)).setResultDetails(any()); }

Target:
void testUpdateWhenResultDetailIsNotEmpty() { String detailsValue = "SomeData"; when(mockResultServiceEventData.getResultDetails()).thenReturn(detailsValue); underTest.update(mockAttemptAuditEventResult, mockResultServiceEventData); verify(mockResultServiceEventDataBuilder, times(1)).setResultDetails(any()); verify(mockResultServiceEventDataBuilder, times(1)).setResultDetails(detailsValue); }
Source:
public ExtSource createExtSource(PerunSession sess, ExtSource extSource, Map<String, String> attributes) throws InternalErrorException, ExtSourceExistsException { getPerunBl().getAuditer().log(sess, new ExtSourceCreated(extSource)); ExtSource extSource1 = getExtSourcesManagerImpl().createExtSource(sess, extSource, attributes); extSourcesByIdMap.put(extSource1.getId(), extSource); extSourcesByNameMap.put(extSource1.getName(), extSource); return extSource1; }

Target:
public ExtSource createExtSource(PerunSession sess, ExtSource extSource, Map<String, String> attributes) throws InternalErrorException, ExtSourceExistsException { getPerunBl().getAuditer().log(sess, new ExtSourceCreated(extSource)); ExtSource extSourceImpl = getExtSourcesManagerImpl().createExtSource(sess, extSource, attributes); extSourcesByIdMap.put(extSourceImpl.getId(), extSource); extSourcesByNameMap.put(extSourceImpl.getName(), extSource); return extSourceImpl; }
Source:
protected void setValue(final int rowIndex, final int columnIndex, final Date value) { DTCellValue52 dtCellValue52 = table52.getData() .get(rowIndex) .get(columnIndex); dtCellValue52 .setDateValue(value); try { updateManager.update(table52, getUpdates(rowIndex, columnIndex)); } catch (UpdateException e) { e.printStackTrace(); } }

Target:
protected void setValue(final int rowIndex, final int columnIndex, final Date value) { DTCellValue52 dtCellValue52 = table52.getData() .get(rowIndex) .get(columnIndex); dtCellValue52 .setDateValue(value); updateManager.update(table52, getUpdates(rowIndex, columnIndex)); }
Source:
protected void extractPropertyDescriptor(Field field, Object defaultInstance) { DefaultPropertyDescriptor desc = new DefaultPropertyDescriptor(); PropertyHidden parameterHidden = field.getAnnotation(PropertyHidden.class); if (parameterHidden == null) { PropertyId propertyId = field.getAnnotation(PropertyId.class); desc.setId(propertyId != null ? propertyId.value() : field.getName()); desc.setPropertyType(field.getGenericType()); PropertyDisplayType displayTypeAnnotation = field.getAnnotation(PropertyDisplayType.class); Type displayType; if (displayTypeAnnotation != null) { displayType = displayTypeAnnotation.value(); } else { displayType = desc.getPropertyType(); } desc.setDisplayType(displayType); PropertyName parameterName = field.getAnnotation(PropertyName.class); desc.setName(parameterName != null ? parameterName.value() : desc.getId()); PropertyDescription parameterDescription = field.getAnnotation(PropertyDescription.class); desc.setDescription(parameterDescription != null ? parameterDescription.value() : desc.getId()); Map<Class, Annotation> annotations = new HashMap<>(); annotations.put(PropertyMandatory.class, field.getAnnotation(PropertyMandatory.class)); annotations.put(Deprecated.class, field.getAnnotation(Deprecated.class)); annotations.put(PropertyAdvanced.class, field.getAnnotation(PropertyAdvanced.class)); annotations.put(PropertyGroup.class, field.getAnnotation(PropertyGroup.class)); annotations.put(PropertyFeature.class, field.getAnnotation(PropertyFeature.class)); setCommonProperties(desc, annotations); if (defaultInstance != null) { try { desc.setDefaultValue(field.get(defaultInstance)); } catch (Exception e) { LOGGER.error( MessageFormat.format("Failed to get default property value from field {0} in class {1}", field.getName(), this.beanClass), e); } } desc.setField(field); this.parameterDescriptorMap.put(desc.getId(), desc); } }

Target:
protected void extractPropertyDescriptor(Field field, Object defaultInstance) { DefaultPropertyDescriptor desc = new DefaultPropertyDescriptor(); PropertyHidden parameterHidden = field.getAnnotation(PropertyHidden.class); if (parameterHidden == null) { PropertyId propertyId = field.getAnnotation(PropertyId.class); desc.setId(propertyId != null ? propertyId.value() : field.getName()); desc.setPropertyType(field.getGenericType()); PropertyName parameterName = field.getAnnotation(PropertyName.class); desc.setName(parameterName != null ? parameterName.value() : desc.getId()); PropertyDescription parameterDescription = field.getAnnotation(PropertyDescription.class); desc.setDescription(parameterDescription != null ? parameterDescription.value() : desc.getId()); Map<Class, Annotation> annotations = new HashMap<>(); COMMON_ANNOTATION_CLASSES.forEach(aClass -> annotations.put(aClass, field.getAnnotation(aClass)) ); setCommonProperties(desc, annotations); if (defaultInstance != null) { try { desc.setDefaultValue(field.get(defaultInstance)); } catch (Exception e) { LOGGER.error( MessageFormat.format("Failed to get default property value from field {0} in class {1}", field.getName(), this.beanClass), e); } } desc.setField(field); this.parameterDescriptorMap.put(desc.getId(), desc); } }
Source:
private void setConverters(Element element, RestHolder holder) { List<DeclaredType> converters = annotationHelper.extractAnnotationClassArrayParameter(element, getTarget(), "converters"); if (converters != null && !converters.isEmpty()) { JFieldVar restTemplateField = holder.getRestTemplateField(); JBlock init = holder.getInit().body(); init.add(invoke(restTemplateField, "getMessageConverters").invoke("clear")); for (DeclaredType converterType : converters) { JInvocation newConverter = codeModelHelper.newBeanOrEBean(holder, converterType, holder.getInitContextParam()); init.add(invoke(restTemplateField, "getMessageConverters").invoke("add").arg(newConverter)); } } }

Target:
private void setConverters(Element element, RestHolder holder) { List<DeclaredType> converters = annotationHelper.extractAnnotationClassArrayParameter(element, getTarget(), "converters"); JFieldVar restTemplateField = holder.getRestTemplateField(); JBlock init = holder.getInit().body(); init.add(invoke(restTemplateField, "getMessageConverters").invoke("clear")); for (DeclaredType converterType : converters) { JInvocation newConverter = codeModelHelper.newBeanOrEBean(holder, converterType, holder.getInitContextParam()); init.add(invoke(restTemplateField, "getMessageConverters").invoke("add").arg(newConverter)); } }
Source:
public void waitProposalIntoSignaturesContainer(final String expectedProposal) { webDriverWaitFactory .get(ELEMENT_TIMEOUT_SEC) .until( (ExpectedCondition<Boolean>) webDriver -> getAllVisibleTextFromSignaturesContainer().contains(expectedProposal)); }

Target:
public void waitProposalIntoSignaturesContainer(final String expectedProposal) { seleniumWebDriverHelper.waitTextContains(signaturesContainer, expectedProposal); }
Source:
@Override public void helpHandleDiscoveryError( String siteAddress, String endpointAddress, String username, String password, String userAvatarUrl, int errorMessage) { }

Target:
public void helpHandleDiscoveryError( String siteAddress, String endpointAddress, String username, String password, String userAvatarUrl, int errorMessage) { }
Source:
static <T> Iterator<Optional<T>> yieldingIteratorFrom(WorkProcessor<T> processor) { return new AbstractIterator<Optional<T>>() { @Override protected Optional<T> computeNext() { if (processor.process()) { if (processor.isFinished()) { return endOfData(); } return Optional.of(processor.getResult()); } else if (processor.isBlocked()) { throw new IllegalStateException("Work is blocked"); } else { return Optional.empty(); } } }; }

Target:
static <T> Iterator<Optional<T>> yieldingIteratorFrom(WorkProcessor<T> processor) { requireNonNull(processor, "processor is null"); return new AbstractIterator<Optional<T>>() { @Override protected Optional<T> computeNext() { if (processor.process()) { if (processor.isFinished()) { return endOfData(); } return Optional.of(processor.getResult()); } else if (processor.isBlocked()) { throw new IllegalStateException("Cannot iterate over blocking WorkProcessor"); } return Optional.empty(); } }; }
Source:
public static SortedMap<String, String> getAllProviderNames() { SortedMap<String, String> ret = new TreeMap<String, String>(); IConfigurationElement[] configs = getConfigurationElements(); for (IConfigurationElement config : configs) { if (config.getName().equals("provider")) { String currentId = config.getAttribute("id"); String currentName = config.getAttribute("name"); String currentType = config.getAttribute("type"); if (currentName != null && currentId != null) { ret.put(currentName, currentId); } } } return ret; }

Target:
public static SortedMap<String, String> getAllProviderNames() { SortedMap<String, String> ret = new TreeMap<String, String>(); IConfigurationElement[] configs = getConfigurationElements(); for (IConfigurationElement config : configs) { if (config.getName().equals("provider")) { String currentId = config.getAttribute("id"); String currentName = config.getAttribute("name"); if (currentName != null && currentId != null) { ret.put(currentName, currentId); } } } return ret; }
Source:
public String toString() { return "name=" + name + ";javaType=" + javaType + ";uuid=" + uuid.toString(); }

Target:
public String toString() { ToStringBuilder builder = ToStringBuilder.forInstance(this); builder.append("name", name); builder.append("javaType", javaType); builder.append("uuid", uuid); return builder.toString(); }
Source:
public void onLoadFinished(Loader<Cursor> loader, final Cursor data) { if (data == null) { Toast.makeText(this, getResources().getString(R.string.cloud_error_failed_restart), Toast.LENGTH_LONG).show(); return; } if (mCloudCursorData != null && mCloudCursorData == data) return; mCloudCursorData = data; if (cloudLoaderAsyncTask != null && cloudLoaderAsyncTask.getStatus() == AsyncTask.Status.RUNNING) { return; } cloudLoaderAsyncTask = new CloudLoaderAsyncTask(new WeakReference<>(this), cloudHandler, mCloudCursorData); cloudLoaderAsyncTask.execute(); }

Target:
public void onLoadFinished(Loader<Cursor> loader, final Cursor data) { if (data == null) { Toast.makeText(this, getResources().getString(R.string.cloud_error_failed_restart), Toast.LENGTH_LONG).show(); return; } if (cloudCursorData != null && cloudCursorData == data) return; cloudCursorData = data; if (cloudLoaderAsyncTask != null && cloudLoaderAsyncTask.getStatus() == AsyncTask.Status.RUNNING) { return; } cloudLoaderAsyncTask = new CloudLoaderAsyncTask(this, cloudHandler, cloudCursorData); cloudLoaderAsyncTask.execute(); }
Source:
public void suggestions_without_query_should_order_results() throws Exception { ComponentDto project1 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Alpha")); ComponentDto project2 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Bravo")); ComponentDto project3 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Charlie")); ComponentDto project4 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Delta")); doReturn(asList(project4, project2)).when(favoriteFinder).list(); componentIndexer.indexOnStartup(null); authorizationIndexerTester.allowOnlyAnyone(project1); authorizationIndexerTester.allowOnlyAnyone(project2); authorizationIndexerTester.allowOnlyAnyone(project3); authorizationIndexerTester.allowOnlyAnyone(project4); SuggestionsWsResponse response = actionTester.newRequest() .setMethod("POST") .setParam(PARAM_RECENTLY_BROWSED, Stream.of(project3, project1).map(ComponentDto::getKey).collect(joining(","))) .executeProtobuf(SuggestionsWsResponse.class); assertThat(response.getResultsList()) .flatExtracting(Category::getItemsList) .extracting(Suggestion::getKey) .containsExactly( project2.getKey(), project4.getKey(), project1.getKey(), project3.getKey() ); }

Target:
public void suggestions_without_query_should_order_results() throws Exception { ComponentDto project1 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Alpha")); ComponentDto project2 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Bravo")); ComponentDto project3 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Charlie")); ComponentDto project4 = db.components().insertComponent(newPrivateProjectDto(organization).setName("Delta")); doReturn(asList(project4, project2)).when(favoriteFinder).list(); componentIndexer.indexOnStartup(null); userSessionRule.addProjectPermission(USER, project1); userSessionRule.addProjectPermission(USER, project2); userSessionRule.addProjectPermission(USER, project3); userSessionRule.addProjectPermission(USER, project4); SuggestionsWsResponse response = ws.newRequest() .setMethod("POST") .setParam(PARAM_RECENTLY_BROWSED, Stream.of(project3, project1).map(ComponentDto::getKey).collect(joining(","))) .executeProtobuf(SuggestionsWsResponse.class); assertThat(response.getResultsList()) .flatExtracting(Category::getItemsList) .extracting(Suggestion::getName, Suggestion::getIsFavorite, Suggestion::getIsRecentlyBrowsed) .containsExactly( tuple("Bravo", true, false), tuple("Delta", true, false), tuple("Alpha", false, true), tuple("Charlie", false, true)); }
Source:
public void operationComplete(int rc, Set<LedgerFragment> fragments) { if (rc == BKException.Code.OK) { Set<BookieSocketAddress> bookies = Sets.newHashSet(); for (LedgerFragment f : fragments) { bookies.addAll(f.getAddresses()); } publishSuspectedLedgersAsync( bookies.stream().map(BookieSocketAddress::toString).collect(Collectors.toList()), Sets.newHashSet(lh.getId()) ).whenComplete((result, cause) -> { if (null != cause) { callback.processResult(Code.ReplicationException, null, null); } else { callback.processResult(Code.OK, null, null); } }); } else { callback.processResult(rc, null, null); } lh.closeAsync().whenComplete((result, cause) -> { if (null != cause) { LOG.warn("Error closing ledger : {}", lh.getId(), cause.getMessage()); } }); }

Target:
public void operationComplete(int rc, Set<LedgerFragment> fragments) { if (rc == BKException.Code.OK) { Set<BookieSocketAddress> bookies = Sets.newHashSet(); for (LedgerFragment f : fragments) { bookies.addAll(f.getAddresses()); } publishSuspectedLedgersAsync( bookies.stream().map(BookieSocketAddress::toString).collect(Collectors.toList()), Sets.newHashSet(lh.getId()) ).whenComplete((result, cause) -> { if (null != cause) { LOG.error("Auditor exception publishing suspected ledger with lost bookies {}", lh.getId(), bookies, cause); callback.processResult(Code.ReplicationException, null, null); } else { callback.processResult(Code.OK, null, null); } }); } else { callback.processResult(rc, null, null); } lh.closeAsync().whenComplete((result, cause) -> { if (null != cause) { LOG.warn("Error closing ledger : {}", lh.getId(), cause.getMessage()); } }); }
Source:
public String getRestURI(String baseServiceURI) { StringBuilder b = new StringBuilder(128); b.append(baseServiceURI); if (!baseServiceURI.endsWith("/")) { b.append('/'); } b.append("lock/"); return b.toString(); }

Target:
public String getRestURI(String baseServiceURI) { StringBuilder b = new StringBuilder(128); b.append(baseServiceURI); if (!baseServiceURI.endsWith("/")) { b.append('/'); } b.append("lock"); return b.toString(); }
Source:
private EventHubClientManager createOrGetEventHubClientManagerForSSP(String streamId, SystemStreamPartition ssp) { EventHubClientManager eventHubClientManager; if (config.getPerPartitionConnection(systemName)) { if (perPartitionEventHubManagers.containsKey(ssp)) { LOG.warn(String.format("Trying to create new EventHubClientManager for ssp=%s. But one already exists", ssp)); eventHubClientManager = perPartitionEventHubManagers.get(ssp); } else { LOG.info("Creating EventHub client manager for SSP: " + ssp); eventHubClientManager = eventHubClientManagerFactory.getEventHubClientManager(systemName, streamId, config); eventHubClientManager.init(); perPartitionEventHubManagers.put(ssp, eventHubClientManager); } } else { if (!perStreamEventHubManagers.containsKey(streamId)) { LOG.info("Creating EventHub client manager for stream: " + streamId); EventHubClientManager perStreamEventHubClientManager = eventHubClientManagerFactory.getEventHubClientManager(systemName, streamId, config); perStreamEventHubClientManager.init(); perStreamEventHubManagers.put(streamId, perStreamEventHubClientManager); } eventHubClientManager = perStreamEventHubManagers.get(streamId); perPartitionEventHubManagers.put(ssp, eventHubClientManager); } Validate.notNull(eventHubClientManager, String.format("Fail to create or get EventHubClientManager for ssp=%s", ssp)); return eventHubClientManager; }

Target:
private EventHubClientManager createOrGetEventHubClientManagerForSSP(String streamId, SystemStreamPartition ssp) { EventHubClientManager eventHubClientManager; if (config.getPerPartitionConnection(systemName)) { if (perPartitionEventHubManagers.containsKey(ssp)) { LOG.warn(String.format("Trying to create new EventHubClientManager for ssp=%s. But one already exists", ssp)); eventHubClientManager = perPartitionEventHubManagers.get(ssp); } else { LOG.info("Creating EventHub client manager for SSP: " + ssp); eventHubClientManager = eventHubClientManagerFactory.getEventHubClientManager(systemName, streamId, config); eventHubClientManager.init(); perPartitionEventHubManagers.put(ssp, eventHubClientManager); } } else { if (!perStreamEventHubManagers.containsKey(streamId)) { LOG.info("Creating EventHub client manager for stream: " + streamId); EventHubClientManager perStreamEventHubClientManager = eventHubClientManagerFactory.getEventHubClientManager(systemName, streamId, config); perStreamEventHubClientManager.init(); perStreamEventHubManagers.put(streamId, perStreamEventHubClientManager); } eventHubClientManager = perStreamEventHubManagers.get(streamId); perPartitionEventHubManagers.put(ssp, eventHubClientManager); } LOG.info("EventHub client created for ssp: " + ssp); Validate.notNull(eventHubClientManager, String.format("Fail to create or get EventHubClientManager for ssp=%s", ssp)); return eventHubClientManager; }
Source:
public void testGetScalerUnit() throws Exception { DlmsDeviceMessageMetadata dlmsDeviceMessageMetadata = new DlmsDeviceMessageMetadata(); dlmsDeviceMessageMetadata.setDeviceIdentification("E0004001515495114"); dlmsDeviceMessageMetadata.setIpAddress("89.200.96.223"); LnClientConnection connection = dlmsConnectionFactory .getConnection(domainHelperService.findDlmsDevice(dlmsDeviceMessageMetadata)); ScalerUnitTestResponse execute = commandExecutor.execute(connection, new TestChannelQuery()); Assert.assertEquals(execute.getScalerUnit().getDlmsUnit(), DlmsUnit.wh); }

Target:
public void testGetScalerUnit() throws Exception { final DlmsDeviceMessageMetadata dlmsDeviceMessageMetadata = new DlmsDeviceMessageMetadata(); dlmsDeviceMessageMetadata.setDeviceIdentification("E0004001515495114"); dlmsDeviceMessageMetadata.setIpAddress("89.200.96.223"); final LnClientConnection connection = this.dlmsConnectionFactory.getConnection(this.domainHelperService .findDlmsDevice(dlmsDeviceMessageMetadata)); final ScalerUnitTestResponse execute = this.commandExecutor.execute(connection, new TestChannelQuery()); Assert.assertEquals(DlmsUnit.WH, execute.getScalerUnit().getDlmsUnit()); }
Source:
public void close() throws IOException { if (this.sysOutStream != null) { try { this.sysOutStream.close(); } catch (Exception e) { } } if (this.sysErrStream != null) { try { this.sysErrStream.close(); } catch (Exception e) { } } }

Target:
public void close() throws IOException { FileUtils.close(this.sysOutStore); FileUtils.close(this.sysErrStore); }