auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<Object[]> fetchJudgmentsReferencingTags(List<Long> judgmentIds) { String select = "SELECT refId\\:\\:text\\:\\:bigint refId, tag.judgment_id, tag.tag_type, tag.value\\:\\:text" + " FROM enrichment_tag tag" + " JOIN json_array_elements(tag.value) tagValue ON true" + " JOIN json_array_elements(tagValue->'judgmentIds') refId ON true" + " WHERE tag.tag_type = 'REFERENCED_COURT_CASES' AND refId\\:\\:text\\:\\:bigint in (:judgmentIds);"; Query query = entityManager.createNativeQuery(select); query.setParameter("judgmentIds", judgmentIds); @SuppressWarnings("unchecked") List<Object[]> results = query.getResultList(); return results; }

Target:
private Map<Long, JudgmentEnrichmentTags> fetchJudgmentsReferencingTags(List<Long> judgmentIds) { String select = "SELECT refId\\:\\:text\\:\\:bigint refId, tag.judgment_id, tag.tag_type, tag.value\\:\\:text" + " FROM enrichment_tag tag" + " JOIN json_array_elements(tag.value) tagValue ON true" + " JOIN json_array_elements(tagValue->'judgmentIds') refId ON true" + " WHERE tag.tag_type = 'REFERENCED_COURT_CASES' AND refId\\:\\:text\\:\\:bigint in (:judgmentIds);"; Query query = entityManager.createNativeQuery(select); query.setParameter("judgmentIds", judgmentIds); @SuppressWarnings("unchecked") List<Object[]> results = query.getResultList(); Map<Long, JudgmentEnrichmentTags> judgmentsEnrichmentTagsMap = Maps.newHashMap(); for (Object[] result : results) { long referencedJudgmentId = ((BigInteger)result[0]).longValue(); long judgmentId = ((BigInteger)result[1]).longValue(); String tagType = (String)result[2]; String value = (String)result[3]; EnrichmentTag tag = new EnrichmentTag(); tag.setJudgmentId(judgmentId); tag.setTagType(tagType); tag.setValue(value); putEnrichmentTagInMap(judgmentsEnrichmentTagsMap, referencedJudgmentId, tag); } return judgmentsEnrichmentTagsMap; }
Source:
public void setup() throws Exception { when(metadata.getDefinitionSetId()).thenReturn(DEF_SET_ID); when(profile.getProjectProfileName()).thenReturn(org.kie.workbench.common.profile.api.preferences.Profile.PLANNER_AND_RULES.getName()); doAnswer(invocation -> { ParameterizedCommand<ProfilePreferences> callback = (ParameterizedCommand<ProfilePreferences>) invocation.getArguments()[0]; callback.execute(profilePreferences); return null; }).when(profilePreferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class)); when(profilePreferences.getProfile()).thenReturn(PROJECT_PROFILE); when(profileManager.getProfiles(eq(DEF_SET_ID))).thenReturn(Collections.singletonList(profile)); tested = new StunnerProfilePreferencesLoader(profileManager, profilePreferences, DEFAULT_PROFILE); }

Target:
public void setup() { when(metadata.getDefinitionSetId()).thenReturn(DEF_SET_ID); when(profile.getProjectProfileName()).thenReturn(org.kie.workbench.common.profile.api.preferences.Profile.PLANNER_AND_RULES.getName()); doAnswer(invocation -> { ParameterizedCommand<ProfilePreferences> callback = (ParameterizedCommand<ProfilePreferences>) invocation.getArguments()[0]; callback.execute(profilePreferences); return null; }).when(profilePreferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class)); when(profilePreferences.getProfile()).thenReturn(PROJECT_PROFILE); when(profileManager.getProfiles(eq(DEF_SET_ID))).thenReturn(Collections.singletonList(profile)); tested = new StunnerProfilePreferencesLoader(profileManager, profilePreferences, DEFAULT_PROFILE); }
Source:
public boolean restoreDeletedDocument(long deletedDocumentId, boolean checkContextUser) { XWikiContext context = this.xcontextProvider.get(); XWiki xwiki = context.getWiki(); DocumentReference deletedDocumentReference = null; try { XWikiDeletedDocument deletedDocument = xwiki.getDeletedDocument(deletedDocumentId, context); if (deletedDocument == null) { logger.error("Deleted document with ID does not exist.", deletedDocumentId); return false; } deletedDocumentReference = deletedDocument.getDocumentReference(); if (xwiki.exists(deletedDocumentReference, context)) { logger.error("Document with ID can not be restored. Document already exists", deletedDocument.getFullName(), deletedDocumentId); } else if (checkContextUser && (!canRestoreDeletedDocument(deletedDocumentId, context.getUserReference()) || !canRestoreDeletedDocument(deletedDocumentId, context.getAuthorReference())) ) { logger.error("You are not allowed to restore document with ID [{}]", deletedDocumentReference, deletedDocumentId); } else { xwiki.restoreFromRecycleBin(deletedDocument.getId(), "Restored from recycle bin", context); logger.info("Document has been restored", deletedDocumentReference); return true; } } catch (Exception e) { if (deletedDocumentReference != null) { logger.error("Failed to restore document with ID [{}]", deletedDocumentReference, deletedDocumentId, e); } else { logger.error("Failed to restore deleted document with ID [{}]", deletedDocumentId, e); } } return false; }

Target:
public boolean restoreDeletedDocument(long deletedDocumentId, boolean checkContextUser) { XWikiContext context = this.xcontextProvider.get(); XWiki xwiki = context.getWiki(); DocumentReference deletedDocumentReference = null; try { XWikiDeletedDocument deletedDocument = xwiki.getDeletedDocument(deletedDocumentId, context); if (deletedDocument == null) { logger.error("Deleted document with ID does not exist.", deletedDocumentId); return false; } deletedDocumentReference = deletedDocument.getDocumentReference(); if (xwiki.exists(deletedDocumentReference, context)) { logger.error("Document with ID can not be restored. Document already exists", deletedDocument.getFullName(), deletedDocumentId); } else if (checkContextUser && !canRestoreDeletedDocument(deletedDocumentId, context.getAuthorReference())) { logger.error("The author of this script is not allowed to restore document with ID [{}]", context.getAuthorReference(), deletedDocumentReference, deletedDocumentId); } else if (checkContextUser && !canRestoreDeletedDocument(deletedDocumentId, context.getUserReference())) { logger.error("You are not allowed to restore document with ID [{}]", deletedDocumentReference, deletedDocumentId); } else { xwiki.restoreFromRecycleBin(deletedDocument.getId(), "Restored from recycle bin", context); logger.info("Document has been restored", deletedDocumentReference); return true; } } catch (Exception e) { if (deletedDocumentReference != null) { logger.error("Failed to restore document with ID [{}]", deletedDocumentReference, deletedDocumentId, e); } else { logger.error("Failed to restore deleted document with ID [{}]", deletedDocumentId, e); } } return false; }
Source:
public OSProcess[] getProcesses(int limit, ProcessSort sort) { List<OSProcess> procs = new ArrayList<>(); File[] pids = ProcUtil.getPidFiles(); LinuxUserInfo userInfo = getUserInfo(); Map<String, String> users = userInfo.getUsers(); Map<String, String> groups = userInfo.getGroups(); for (File pid : pids) { OSProcess proc = getProcess(ParseUtil.parseIntOrDefault(pid.getName(), 0), users, groups); if (proc != null) { procs.add(proc); } } List<OSProcess> sorted = processSort(procs, limit, sort); return sorted.toArray(new OSProcess[sorted.size()]); }

Target:
public OSProcess[] getProcesses(int limit, ProcessSort sort) { List<OSProcess> procs = new ArrayList<>(); File[] pids = ProcUtil.getPidFiles(); for (File pid : pids) { OSProcess proc = getProcess(ParseUtil.parseIntOrDefault(pid.getName(), 0)); if (proc != null) { procs.add(proc); } } List<OSProcess> sorted = processSort(procs, limit, sort); return sorted.toArray(new OSProcess[sorted.size()]); }
Source:
public void log(RequestLogLine requestLogLine) throws IOException { final Map mdc = MDC.getCopyOfContextMap(); try { if (setMDC) { try { final Query query = requestLogLine.getQuery(); MDC.put("queryId", query.getId()); MDC.put("dataSource", findInnerDatasource(query).toString()); MDC.put("queryType", query.getType()); MDC.put("hasFilters", Boolean.toString(query.hasFilters())); MDC.put("remoteAddr", requestLogLine.getRemoteAddr()); MDC.put("duration", query.getDuration().toString()); MDC.put("descending", Boolean.toString(query.isDescending())); if (setContextMDC) { final Iterable<Map.Entry<String, Object>> entries = query.getContext() == null ? ImmutableList.of() : query.getContext().entrySet(); for (Map.Entry<String, Object> entry : entries) { MDC.put(entry.getKey(), entry.getValue() == null ? "NULL" : entry.getValue().toString()); } } } catch (RuntimeException re) { LOG.error(re, "Error preparing MDC"); } } final String line = requestLogLine.getLine(mapper); LOG.info("%s", line); } finally { if (setMDC) { if (mdc != null) { MDC.setContextMap(mdc); } else { MDC.clear(); } } } }

Target:
public void log(RequestLogLine requestLogLine) throws IOException { final Map mdc = MDC.getCopyOfContextMap(); try { if (setMDC) { try { final Query query = requestLogLine.getQuery(); MDC.put("queryId", query.getId()); MDC.put("dataSource", findInnerDatasource(query).toString()); MDC.put("queryType", query.getType()); MDC.put("isNested", String.valueOf(!(query.getDataSource() instanceof TableDataSource))); MDC.put("hasFilters", Boolean.toString(query.hasFilters())); MDC.put("remoteAddr", requestLogLine.getRemoteAddr()); MDC.put("duration", query.getDuration().toString()); MDC.put("descending", Boolean.toString(query.isDescending())); if (setContextMDC) { final Iterable<Map.Entry<String, Object>> entries = query.getContext() == null ? ImmutableList.of() : query.getContext().entrySet(); for (Map.Entry<String, Object> entry : entries) { MDC.put(entry.getKey(), entry.getValue() == null ? "NULL" : entry.getValue().toString()); } } } catch (RuntimeException re) { LOG.error(re, "Error preparing MDC"); } } final String line = requestLogLine.getLine(mapper); LOG.info("%s", line); } finally { if (setMDC) { if (mdc != null) { MDC.setContextMap(mdc); } else { MDC.clear(); } } } }
Source:
ExecutionPlan getExecutionPlan(String runId) { Map<String, String> allowedUserConfig = new HashMap<>(userConfig); Map<String, String> generatedConfig = new HashMap<>(); if (!LegacyTaskApplication.class.isAssignableFrom(appDesc.getAppClass())) { if (StringUtils.isBlank(userConfig.get(TaskConfig.INPUT_STREAMS()))) { allowedUserConfig.remove(TaskConfig.INPUT_STREAMS()); } generatedConfig.putAll(getGeneratedConfig(runId)); } Config mergedConfig = JobNodeConfigurationGenerator.mergeConfig(allowedUserConfig, generatedConfig); StreamManager streamManager = buildAndStartStreamManager(mergedConfig); try { ExecutionPlanner planner = new ExecutionPlanner(mergedConfig, streamManager); return planner.plan(appDesc); } finally { streamManager.stop(); } }

Target:
ExecutionPlan getExecutionPlan(String runId) { Map<String, String> allowedUserConfig = new HashMap<>(userConfig); Map<String, String> generatedConfig = new HashMap<>(); if (!LegacyTaskApplication.class.isAssignableFrom(appDesc.getAppClass())) { if (StringUtils.isBlank(userConfig.get(TaskConfig.INPUT_STREAMS))) { allowedUserConfig.remove(TaskConfig.INPUT_STREAMS); } generatedConfig.putAll(getGeneratedConfig(runId)); } Config mergedConfig = JobNodeConfigurationGenerator.mergeConfig(allowedUserConfig, generatedConfig); StreamManager streamManager = buildAndStartStreamManager(mergedConfig); try { ExecutionPlanner planner = new ExecutionPlanner(mergedConfig, streamManager); return planner.plan(appDesc); } finally { streamManager.stop(); } }
Source:
public void testCall() { String change_id = null; String commit_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !\n This is the second line \n"); gAccess.pushFile(); change_id = gAccess.getChangeId(); commit_id = gAccess.getCommitId(); } catch (Exception e1) { e1.printStackTrace(); } CreateDraftCommand command = fGerrit.createDraftComments(change_id, commit_id); CommentInfo commentInfo = new CommentInfo(); commentInfo.setLine(2); commentInfo.setMessage("This is a test comment"); commentInfo.setPath("EGerritTestReviewFile.java"); command.setCommentInfo(commentInfo); command.requiresAuthentication(true); CommentInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } assertEquals(result.getMessage(), commentInfo.getMessage()); }

Target:
public void testCall() { String change_id = null; String commit_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !\n This is the second line \n"); gAccess.pushFile(); change_id = gAccess.getChangeId(); commit_id = gAccess.getCommitId(); } catch (Exception e1) { fail(e1.getMessage()); } CreateDraftCommand command = fGerrit.createDraftComments(change_id, commit_id); CommentInfo commentInfo = new CommentInfo(); commentInfo.setLine(2); commentInfo.setMessage("This is a test comment"); commentInfo.setPath("EGerritTestReviewFile.java"); command.setCommentInfo(commentInfo); CommentInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } assertEquals(result.getLine(), commentInfo.getLine()); assertEquals(result.getMessage(), commentInfo.getMessage()); assertEquals(result.getPath(), commentInfo.getPath()); }
Source:
public CqlQueryResponse executeCqlQuery(CqlRequest cqlRequest) throws UnsupportedQueryException, SourceUnavailableException, FederationException { QueryRequest request = cqlRequest.createQueryRequest(catalogFramework.getId(), filterBuilder); Stopwatch stopwatch = Stopwatch.createStarted(); List<QueryResponse> responses = Collections.synchronizedList(new ArrayList<>()); QueryFunction queryFunction = (queryRequest) -> { QueryResponse queryResponse = catalogFramework.query(queryRequest); responses.add(queryResponse); return queryResponse; }; List<Result> results; if (cqlRequest.getCount() == 0) { results = ResultIterable.resultIterable(queryFunction, request) .stream() .collect(Collectors.toList()); } else { results = ResultIterable.resultIterable(queryFunction, request, cqlRequest.getCount()) .stream() .collect(Collectors.toList()); } QueryResponse response = new QueryResponseImpl( request, results, true, responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getHits) .findFirst() .orElse(-1l), responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getProperties) .findFirst() .orElse(Collections.emptyMap())); stopwatch.stop(); return new CqlQueryResponse( cqlRequest.getId(), request, response, cqlRequest.getSource(), stopwatch.elapsed(TimeUnit.MILLISECONDS), cqlRequest.isNormalize(), filterAdapter, actionRegistry); }

Target:
public CqlQueryResponse executeCqlQuery(CqlRequest cqlRequest) throws UnsupportedQueryException, SourceUnavailableException, FederationException { QueryRequest request = cqlRequest.createQueryRequest(catalogFramework.getId(), filterBuilder); Stopwatch stopwatch = Stopwatch.createStarted(); List<QueryResponse> responses = Collections.synchronizedList(new ArrayList<>()); List<Result> results; if (cqlRequest.getCount() == 0) { results = retrieveHitCount(request, responses); } else { results = retrieveResults(cqlRequest, request, responses); } QueryResponse response = new QueryResponseImpl( request, results, true, responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getHits) .findFirst() .orElse(-1L), responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getProperties) .findFirst() .orElse(Collections.emptyMap())); stopwatch.stop(); return new CqlQueryResponse( cqlRequest.getId(), request, response, cqlRequest.getSource(), stopwatch.elapsed(TimeUnit.MILLISECONDS), cqlRequest.isNormalize(), filterAdapter, actionRegistry); }
Source:
private void charge(StateTransitionThrottleConfig.RebalanceType rebalanceType, Map<StateTransitionThrottleConfig.RebalanceType, Long> quota) { if (StateTransitionThrottleConfig.RebalanceType.NONE.equals(rebalanceType)) { logger.error("Wrong rebalance type NONE as parameter"); return; } quota.computeIfPresent(StateTransitionThrottleConfig.RebalanceType.ANY, (key, val) -> Math.max(0, val - 1)); if (!rebalanceType.equals(StateTransitionThrottleConfig.RebalanceType.ANY)) { quota.computeIfPresent(rebalanceType, (key, val) -> Math.max(0, val - 1)); } }

Target:
private void charge(StateTransitionThrottleConfig.RebalanceType rebalanceType, Map<StateTransitionThrottleConfig.RebalanceType, Long> quota) { if (StateTransitionThrottleConfig.RebalanceType.NONE.equals(rebalanceType)) { logger.error("Wrong rebalance type NONE as parameter"); return; } quota.computeIfPresent(StateTransitionThrottleConfig.RebalanceType.ANY, (type, quotaNumber) -> Math.max(0, quotaNumber - 1)); if (!rebalanceType.equals(StateTransitionThrottleConfig.RebalanceType.ANY)) { quota.computeIfPresent(rebalanceType, (type, quotaNumber) -> Math.max(0, quotaNumber - 1)); } }
Source:
public void testConstructorModifiedSince() throws SearchException, IOException, ImapAsyncClientException { final ExtendedSearchSequence searchSeq = new ExtendedSearchSequence(); final ExtendedModifiedSinceTerm extendedModifiedSinceTerm = new ExtendedModifiedSinceTerm(1L); final Argument args = new Argument(); args.append(searchSeq.generateSequence(extendedModifiedSinceTerm)); final String searchStr = args.toString(); Assert.assertEquals(searchStr, "MODSEQ 1", "result mismatched."); }

Target:
public void testConstructorModifiedSince() throws SearchException, IOException { final ExtendedSearchSequence searchSeq = new ExtendedSearchSequence(); final ExtendedModifiedSinceTerm extendedModifiedSinceTerm = new ExtendedModifiedSinceTerm(1L); final Argument args = new Argument(); args.append(searchSeq.generateSequence(extendedModifiedSinceTerm)); final String searchStr = args.toString(); Assert.assertEquals(searchStr, "MODSEQ 1", "generateSequence() mismatched."); }
Source:
private boolean tryLockVmForUpdate(Pair<VM, VmInternalData> pair) { Guid vmId = getVmId(pair); if (vmId != null) { VmManager vmManager = getResourceManager().getVmManager(vmId); if (vmManager.trylock()) { if (vmManager.getLastUpdateDate().compareTo(fetchTime) > 0) { log.warn("skipping VM '{}' from this monitoring cycle" + " - the VM data has changed since fetching the data", vmId); vmManager.unlock(); } else { vmManagers.put(vmId, vmManager); return true; } } else { log.debug("skipping VM '{}' from this monitoring cycle" + " - the VM is locked by its VmManager ", getVmId(pair)); } } return false; }

Target:
private boolean tryLockVmForUpdate(Pair<VM, VmInternalData> pair) { Guid vmId = getVmId(pair); if (vmId != null) { VmManager vmManager = getResourceManager().getVmManager(vmId); if (vmManager.trylock()) { if (fetchTime - vmManager.getVmDataChangedTime() < 0) { log.warn("skipping VM '{}' from this monitoring cycle" + " - the VM data has changed since fetching the data", vmId); vmManager.unlock(); } else { vmManagers.put(vmId, vmManager); return true; } } else { log.debug("skipping VM '{}' from this monitoring cycle" + " - the VM is locked by its VmManager ", getVmId(pair)); } } return false; }
Source:
public void handleLifecycleEvent(SaveablesLifecycleEvent event) { if (currentPart == null || event.getEventType() != SaveablesLifecycleEvent.DIRTY_CHANGED) { return; } Saveable[] saveables = event.getSaveables(); for (Saveable saveable : saveables) { if (new DefaultSaveable(PropertySheet.this).equals(saveable)) { return; } } if (event.getSource() instanceof SaveablesList) { SaveablesList saveablesList = (SaveablesList) event.getSource(); for (Saveable saveable : saveables) { IWorkbenchPart[] parts = saveablesList.getPartsForSaveable(saveable); for (IWorkbenchPart part : parts) { if (PropertySheet.this.currentPart == part) { firePropertyChange(IWorkbenchPartConstants.PROP_DIRTY); return; } } } } }

Target:
public void handleLifecycleEvent(SaveablesLifecycleEvent event) { if (currentPart == null || event.getEventType() != SaveablesLifecycleEvent.DIRTY_CHANGED) { return; } Saveable[] saveables = event.getSaveables(); if (saveables == null) { return; } for (Saveable saveable : saveables) { if (new DefaultSaveable(PropertySheet.this).equals(saveable)) { return; } } if (event.getSource() instanceof SaveablesList) { SaveablesList saveablesList = (SaveablesList) event.getSource(); for (Saveable saveable : saveables) { IWorkbenchPart[] parts = saveablesList.getPartsForSaveable(saveable); for (IWorkbenchPart part : parts) { if (PropertySheet.this.currentPart == part) { firePropertyChange(IWorkbenchPartConstants.PROP_DIRTY); return; } } } } }
Source:
public void destroy(ClaudiaData claudiaData, EnvironmentInstance envInstance) throws Exception { log.info("Destroying enviornment isntance " + envInstance.getBlueprintName() + " with environment " + envInstance.getEnvironment().getName() + " vdc " + envInstance.getVdc()); boolean error = false; try { envInstance.setStatus(Status.UNINSTALLING); envInstance = environmentInstanceDao.update(envInstance); for (int i = 0; i < envInstance.getTierInstances().size(); i++) { deleteVM(claudiaData, envInstance); } } catch (NullPointerException ne) { log.info("Environment Instance " + envInstance.getBlueprintName() + " does not have any TierInstances associated"); } List<TierInstance> tierInstancesSDC = envInstance.getTierInstances(); envInstance.setTierInstances(null); for (int i = 0; i < tierInstancesSDC.size(); i++) { TierInstance tierInstance = tierInstancesSDC.get(i); try { deleteTierOnSDC(claudiaData, tierInstance, error); } catch (Exception e) { String errorMsg = "Error deleting node from Node Manager : " + tierInstance.getVM().getFqn() + "" + e.getMessage(); log.error(errorMsg); error = true; } envInstance.setStatus(Status.UNINSTALLED); envInstance = environmentInstanceDao.update(envInstance); deletePaasDB(claudiaData, envInstance, tierInstance, error); } log.info("Environment Instance " + envInstance.getBlueprintName() + " DESTROYED"); envInstance.setStatus(Status.UNDEPLOYED); environmentInstanceDao.remove(envInstance); if (error) { String errorMsg = "Unexpected error destroying environmentInstance"; throw new Exception(errorMsg); } }

Target:
public void destroy(ClaudiaData claudiaData, EnvironmentInstance envInstance) throws Exception { log.info("Destroying enviornment isntance " + envInstance.getBlueprintName() + " with environment " + envInstance.getEnvironment().getName() + " vdc " + envInstance.getVdc()); boolean error = false; try { envInstance.setStatus(Status.UNINSTALLING); envInstance = environmentInstanceDao.update(envInstance); for (int i = 0; i < envInstance.getTierInstances().size(); i++) { deleteVM(claudiaData, envInstance); } } catch (NullPointerException ne) { log.info("Environment Instance " + envInstance.getBlueprintName() + " does not have any TierInstances associated"); } List<TierInstance> tierInstancesSDC = envInstance.getTierInstances(); envInstance.setTierInstances(null); for (int i = 0; i < tierInstancesSDC.size(); i++) { TierInstance tierInstance = tierInstancesSDC.get(i); try { deleteTierOnSDC(claudiaData, tierInstance, error); } catch (Exception e) { String errorMsg = "Error deleting node from Node Manager : " + tierInstance.getVM().getFqn() + "" + e.getMessage(); log.error(errorMsg); error = true; } envInstance.setStatus(Status.UNINSTALLED); envInstance = environmentInstanceDao.update(envInstance); deletePaaSDB(claudiaData, envInstance, tierInstance, error); } log.info("Environment Instance " + envInstance.getBlueprintName() + " DESTROYED"); envInstance.setStatus(Status.UNDEPLOYED); environmentInstanceDao.remove(envInstance); if (error) { String errorMsg = "Unexpected error destroying environmentInstance"; throw new Exception(errorMsg); } }
Source:
private Map<String, String> parseAccount(String account) { assertNotEmpty(account, "accountName"); this.accountName = account; Map<String, String> h = new HashMap<String, String>(); if (account.startsWith("http://") || account.startsWith("https://")) { try { URI uri = new URI(account); uri.getPort(); h.put("scheme", uri.getScheme()); h.put("hostname", uri.getHost()); h.put("port", new Integer(uri.getPort()).toString()); if(uri.getUserInfo() != null && !uri.getUserInfo().isEmpty()) { h.put("username", uri.getUserInfo().split(":")[0]); h.put("password", uri.getUserInfo().split(":")[1]); } } catch (URISyntaxException e) { } } else { h.put("scheme", "https"); h.put("hostname", account + ".cloudant.com"); h.put("port", "443"); } return h; }

Target:
private Map<String, String> parseAccount(String account) { assertNotEmpty(account, "accountName"); this.accountName = account; Map<String, String> h = new HashMap<String, String>(); if (account.startsWith("http://") || account.startsWith("https://")) { try { URI uri = new URI(account); uri.getPort(); h.put("scheme", uri.getScheme()); h.put("hostname", uri.getHost()); h.put("port", new Integer(uri.getPort()).toString()); } catch (URISyntaxException e) { } } else { h.put("scheme", "https"); h.put("hostname", account + ".cloudant.com"); h.put("port", "443"); } return h; }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { return Collections.singletonList(new PermissionSubject(getUserId(), VdcObjectType.System, ActionGroup.EDIT_PROFILE)); }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { return Collections.singletonList(new PermissionSubject(getUserId(), VdcObjectType.System, getActionType().getActionGroup())); }
Source:
protected List<MarketoField> getLeadColumns() { List<MarketoField> columns = marketoService.describeLead(); if (pluginTask.getIncludedLeadFields().isPresent() && !pluginTask.getIncludedLeadFields().get().isEmpty()) { List<MarketoField> filteredColumns = new ArrayList<>(); List<String> includedFields = pluginTask.getIncludedLeadFields().get(); for (String fieldName : includedFields) { Optional<MarketoField> includedField = lookupFieldIgnoreCase(columns, fieldName); if (includedField.isPresent()) { filteredColumns.add(includedField.get()); } else { LOGGER.warn("Included field not found in Marketo lead field", fieldName); } } columns = filteredColumns; } LOGGER.info("Included Fields option is set, included columns: [{}]", columns); return columns; }

Target:
protected List<MarketoField> getLeadColumns() { List<MarketoField> columns = marketoService.describeLead(); if (pluginTask.getIncludedLeadFields().isPresent() && !pluginTask.getIncludedLeadFields().get().isEmpty()) { List<MarketoField> filteredColumns = new ArrayList<>(); List<String> includedFields = pluginTask.getIncludedLeadFields().get(); for (String fieldName : includedFields) { Optional<MarketoField> includedField = lookupFieldIgnoreCase(columns, fieldName); if (includedField.isPresent()) { filteredColumns.add(includedField.get()); } else { LOGGER.warn("Included field not found in Marketo lead field", fieldName); } } columns = filteredColumns; LOGGER.info("Included Fields option is set, included columns: [{}]", columns); } return columns; }
Source:
void prepare() throws InfrastructureException { KubernetesClient k8sClient = clientFactory.create(workspaceId); if (k8sClient.serviceAccounts().inNamespace(namespace).withName(serviceAccountName).get() == null) { createWorkspaceServiceAccount(k8sClient); } String execRoleName = "exec"; if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(execRoleName).get() == null) { createExecRole(k8sClient, execRoleName); } String viewRoleName = "workspace-view"; if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(viewRoleName).get() == null) { createViewRole(k8sClient, viewRoleName); } k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createExecRoleBinding()); k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createViewRoleBinding()); String customClusterRoleName = System.getenv("CHE_WORKSPACE_CLUSTER_ROLE"); if (!"".equals(customClusterRoleName)) { k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createCustomRoleBinding(customClusterRoleName)); } }

Target:
void prepare() throws InfrastructureException { KubernetesClient k8sClient = clientFactory.create(workspaceId); if (k8sClient.serviceAccounts().inNamespace(namespace).withName(serviceAccountName).get() == null) { createWorkspaceServiceAccount(k8sClient); } String execRoleName = "exec"; if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(execRoleName).get() == null) { createExecRole(k8sClient, execRoleName); } String viewRoleName = "workspace-view"; if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(viewRoleName).get() == null) { createViewRole(k8sClient, viewRoleName); } k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createExecRoleBinding()); k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createViewRoleBinding()); if (!isNullOrEmpty(this.clusterRoleName)) { if (k8sClient.rbac().kubernetesClusterRoles().withName(this.clusterRoleName).get() != null) { k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createCustomRoleBinding(this.clusterRoleName)); } else { LOG.warn( "Unable to find the cluster role {}. Skip creating custom role binding.", this.clusterRoleName); } } }
Source:
public RemoveAsset(final String assetId) { super("removeAsset"); this.assetId = assetId; }

Target:
private RemoveAsset(final String assetId) { super("removeAsset"); this.assetId = assetId; }
Source:
private static boolean containsGlusterServer(ArrayList<VdcActionParametersBase> parameters) { Set<Guid> processed = new HashSet<Guid>(); for(VdcActionParametersBase param : parameters) { VDS vds = DbFacade.getInstance().getVdsDao().get(((RemoveVdsParameters) param).getVdsId()); if (!processed.contains(vds.getvds_group_id())) { VDSGroup cluster = DbFacade.getInstance().getVdsGroupDao().get(vds.getvds_group_id()); if (cluster.supportsGlusterService()) { return true; } processed.add(vds.getvds_group_id()); } } return false; }

Target:
private static boolean containsGlusterServer(ArrayList<VdcActionParametersBase> parameters) { Set<Guid> processed = new HashSet<Guid>(); for (VdcActionParametersBase param : parameters) { VDS vds = DbFacade.getInstance().getVdsDao().get(((RemoveVdsParameters) param).getVdsId()); if (vds != null && !processed.contains(vds.getvds_group_id())) { VDSGroup cluster = DbFacade.getInstance().getVdsGroupDao().get(vds.getvds_group_id()); if (cluster.supportsGlusterService()) { return true; } processed.add(vds.getvds_group_id()); } } return false; }
Source:
public void handleGpioPinAnalogValueChangeEvent(GpioPinAnalogValueChangeEvent event) { GpioPin pin = event.getPin(); MCP3424GpioProvider provider = (MCP3424GpioProvider) pin.getProvider(); if (pin.getTag() instanceof NumberItem) { double value = provider.getAnalogValue(pin.getPin()); try { this.eventPublisher.postUpdate(pin.getName(), new DecimalType(value)); } catch (NumberFormatException exception) { logger.warn("Unable to convert '{}' for item to number", new String[] { String.valueOf(value), pin.getName() }); } logger.debug("GPIO channel change: = {}", pin, value); } else if (pin.getTag() instanceof DimmerItem) { double value = provider.getPercentValue(pin.getPin()); try { this.eventPublisher.postUpdate(pin.getName(), new PercentType((int) value)); } catch (NumberFormatException e) { logger.warn("Unable to convert '{}' for item to number", new String[] { String.valueOf(value), pin.getName() }); } logger.debug("GPIO channel change: = {}", pin, value); } }

Target:
public void handleGpioPinAnalogValueChangeEvent(GpioPinAnalogValueChangeEvent event) { GpioPin pin = event.getPin(); MCP3424GpioProvider provider = (MCP3424GpioProvider) pin.getProvider(); if (pin.getTag() instanceof NumberItem) { double value = provider.getAnalogValue(pin.getPin()); try { this.eventPublisher.postUpdate(pin.getName(), new DecimalType(value)); } catch (NumberFormatException exception) { logger.warn("Unable to convert '{}' for item to number", String.valueOf(value), pin.getName()); } logger.debug("GPIO channel change: = {}", pin, value); } else if (pin.getTag() instanceof DimmerItem) { double value = provider.getPercentValue(pin.getPin()); try { this.eventPublisher.postUpdate(pin.getName(), new PercentType((int) value)); } catch (NumberFormatException e) { logger.warn("Unable to convert '{}' for item to number", String.valueOf(value), pin.getName()); } logger.debug("GPIO channel change: = {}", pin, value); } }
Source:
public static List<NameValuePair> getQueryParametersWithPriceSelection(@Nullable final PriceSelection priceSelection, final List<NameValuePair> currentParameters) { final List<NameValuePair> currentParametersWithoutPriceSelectionParameters = currentParameters.stream() .filter(pair -> !ALL_PARAMETERS.contains(pair.getName())) .collect(toList()); final List<NameValuePair> resultingParameters = new LinkedList<>(currentParametersWithoutPriceSelectionParameters); if (priceSelection != null && priceSelection.getPriceCurrency() != null) { addParamIfNotNull(resultingParameters, PRICE_CURRENCY, priceSelection.getPriceCurrency()); addParamIfNotNull(resultingParameters, PRICE_COUNTRY, priceSelection.getPriceCountry()); addParamIfNotNull(resultingParameters, PRICE_CUSTOMER_GROUP, priceSelection.getPriceCustomerGroup()); addParamIfNotNull(resultingParameters, PRICE_CHANNEL, priceSelection.getPriceChannel()); addParamIfNotNull(resultingParameters, STORE_PROJECTION, priceSelection.getStoreProjection()); addParamIfNotNull(resultingParameters, LOCALE_PROJECTION, priceSelection.getLocaleProjection()); } return resultingParameters; }

Target:
public static List<NameValuePair> getQueryParametersWithPriceSelection(@Nullable final PriceSelection priceSelection, final List<NameValuePair> currentParameters) { final List<NameValuePair> currentParametersWithoutPriceSelectionParameters = currentParameters.stream() .filter(pair -> !ALL_PARAMETERS.contains(pair.getName())) .collect(toList()); final List<NameValuePair> resultingParameters = new LinkedList<>(currentParametersWithoutPriceSelectionParameters); if (priceSelection != null && priceSelection.getPriceCurrency() != null) { addParamIfNotNull(resultingParameters, PRICE_CURRENCY, priceSelection.getPriceCurrency()); addParamIfNotNull(resultingParameters, PRICE_COUNTRY, priceSelection.getPriceCountry()); addParamIfNotNull(resultingParameters, PRICE_CUSTOMER_GROUP, priceSelection.getPriceCustomerGroup()); addParamIfNotNull(resultingParameters, PRICE_CHANNEL, priceSelection.getPriceChannel()); addParamIfNotNull(resultingParameters, STORE_PROJECTION, priceSelection.getStoreProjection()); priceSelection.getLocaleProjection().forEach(parameter -> addParamIfNotNull(resultingParameters, LOCALE_PROJECTION, parameter)); } return resultingParameters; }
Source:
public boolean start() { if (s_logger.isInfoEnabled()) { s_logger.info("Starting Alert Manager"); } return true; }

Target:
public boolean start() { if (s_logger.isInfoEnabled()) { s_logger.info("Starting Statement Manager"); } return true; }
Source:
public CleanCommand setCleanDirectories(boolean dirs) { this.directories = dirs; return this; }

Target:
public CleanCommand setCleanDirectories(boolean dirs) { directories = dirs; return this; }
Source:
public boolean onPreferenceClick(Preference preference) { String preferenceKey = preference != null ? preference.getKey() : ""; if (preferenceKey.equals(getString(R.string.pref_key_device_settings))) { return handleDevicePreferenceClick(); } else if (preferenceKey.equals(getString(R.string.pref_key_app_about))) { return handleAboutPreferenceClick(); } else if (preferenceKey.equals(getString(R.string.pref_key_oss_licenses))) { return handleOssPreferenceClick(); } else if (preference == mPrivacySettings) { return handlePrivacyClick(); } else if (preference == mWhatsNew) { if (getActivity() instanceof AppCompatActivity) { new FeatureAnnouncementDialogFragment() .show(((AppCompatActivity) getActivity()).getSupportFragmentManager(), FeatureAnnouncementDialogFragment.TAG); } else { throw new IllegalArgumentException( "Parent activity is not AppCompatActivity. FeatureAnnouncementDialogFragment must be called " + "using support fragment manager from AppCompatActivity."); } } return false; }

Target:
public boolean onPreferenceClick(Preference preference) { String preferenceKey = preference != null ? preference.getKey() : ""; if (preferenceKey.equals(getString(R.string.pref_key_device_settings))) { return handleDevicePreferenceClick(); } else if (preferenceKey.equals(getString(R.string.pref_key_app_about))) { return handleAboutPreferenceClick(); } else if (preferenceKey.equals(getString(R.string.pref_key_oss_licenses))) { return handleOssPreferenceClick(); } else if (preference == mPrivacySettings) { return handlePrivacyClick(); } else if (preference == mWhatsNew) { return handleFeatureAnnouncementClick(); } return false; }
Source:
public EEFViewDescription convert() { EEFViewDescription view = EefFactory.eINSTANCE.createEEFViewDescription(); view.setLabelExpression("aql:self.name"); for (PageDescription pageDescription : pageDescriptions) { createPage(pageDescription, view); } Set<Entry<EEFPropertyValidationRuleDescription, PropertyValidationRule>> entries = this.eefPropertyValidationRule2propertyValidationRule.entrySet(); for (Entry<EEFPropertyValidationRuleDescription, PropertyValidationRule> entry : entries) { List<WidgetDescription> widgets = entry.getValue().getTargets(); for (WidgetDescription widgetDescription : widgets) { EEFWidgetDescription eefWidgetDescription = this.widget2eefWidget.get(widgetDescription); if (eefWidgetDescription != null) { EEFPropertyValidationRuleDescription eefPropertyValidationRule = entry.getKey(); eefPropertyValidationRule.getTargets().add(eefWidgetDescription); } } } this.widget2eefWidget.clear(); this.eefPropertyValidationRule2propertyValidationRule.clear(); return view; }

Target:
public EEFViewDescription convert() { EEFViewDescription view = EefFactory.eINSTANCE.createEEFViewDescription(); view.setLabelExpression("feature:name"); for (PageDescription pageDescription : pageDescriptions) { createPage(pageDescription, view); } Set<Entry<EEFPropertyValidationRuleDescription, PropertyValidationRule>> entries = this.eefPropertyValidationRule2propertyValidationRule.entrySet(); for (Entry<EEFPropertyValidationRuleDescription, PropertyValidationRule> entry : entries) { List<WidgetDescription> widgets = entry.getValue().getTargets(); for (WidgetDescription widgetDescription : widgets) { EEFWidgetDescription eefWidgetDescription = this.widget2eefWidget.get(widgetDescription); if (eefWidgetDescription != null) { EEFPropertyValidationRuleDescription eefPropertyValidationRule = entry.getKey(); eefPropertyValidationRule.getTargets().add(eefWidgetDescription); } } } this.widget2eefWidget.clear(); this.eefPropertyValidationRule2propertyValidationRule.clear(); return view; }
Source:
public <V> V apply(InputStream stream, Type type) throws IOException { try { Gson gson = new GsonBuilder().registerTypeAdapterFactory(new ArrayAdapterFactory()).create(); return (V) gson.fromJson(Strings2.toStringAndClose(stream), type); } finally { if (stream != null) { stream.close(); } } }

Target:
public <V> V apply(InputStream stream, Type type) throws IOException { try { GsonBuilder gsonBuilder = new GsonBuilder().registerTypeAdapterFactory(new TypeAdapterFactory() { @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> tt) { return new ServerFirewallPolicyAdapter(tt); } }); Gson gson = gsonBuilder.create(); return (V) gson.fromJson(Strings2.toStringAndClose(stream), type); } finally { if (stream != null) { stream.close(); } } }
Source:
public void run() { try { startupComplete(); while(isRunning()) { configureNewConnections(); processNewResponses(); long startSelectTime = SystemTime.getInstance().milliseconds(); int ready = selector.select(300); logger.trace("Processor id selection time = ms", id, (SystemTime.getInstance().milliseconds() - startSelectTime)); if(ready > 0) { Set<SelectionKey> keys = selector.selectedKeys(); Iterator<SelectionKey> iter = keys.iterator(); while(iter.hasNext() && isRunning()) { SelectionKey key = null; try { key = iter.next(); iter.remove(); if(key.isReadable()) { int bytesRead = read(key); if(bytesRead == -1) close(key); } else if(key.isWritable()) { write(key); } else if(!key.isValid()) { close(key); } else throw new IllegalStateException("Unrecognized key state for processor thread."); } catch (EOFException e) { close(key); logger.error("closing key on EOFException {}", e); } catch (Throwable e) { logger.error("closing key on exception remote host " + ((SocketChannel) key.channel()).socket().getRemoteSocketAddress(), e); close(key); } } } } logger.debug("Closing server socket and selector."); closeAll(); selector.close(); shutdownComplete(); } catch (Exception e) { logger.error("Error while shutting down processor thread {}", e); } }

Target:
public void run() { try { startupComplete(); while (isRunning()) { configureNewConnections(); processNewResponses(); long startSelectTime = SystemTime.getInstance().milliseconds(); int ready = selector.select(300); logger.trace("Processor id selection time = ms", id, (SystemTime.getInstance().milliseconds() - startSelectTime)); if (ready > 0) { Set<SelectionKey> keys = selector.selectedKeys(); Iterator<SelectionKey> iter = keys.iterator(); while (iter.hasNext() && isRunning()) { SelectionKey key = null; try { key = iter.next(); iter.remove(); if (key.isReadable()) { read(key); } else if (key.isWritable()) { write(key); } else if (!key.isValid()) { close(key); } else { throw new IllegalStateException("Unrecognized key state for processor thread."); } } catch (EOFException e) { close(key); logger.error("closing key on EOFException {}", e); } catch (Throwable e) { logger.error("closing key on exception remote host " + ((SocketChannel) key.channel()).socket() .getRemoteSocketAddress(), e); close(key); } } } } logger.debug("Closing server socket and selector."); closeAll(); selector.close(); shutdownComplete(); } catch (Exception e) { logger.error("Error while shutting down processor thread {}", e); } }
Source:
public SpongeWireAttachmentData() { this(ImmutableMap.of(Direction.NORTH, WireAttachmentTypes.NONE, Direction.SOUTH, WireAttachmentTypes.NONE, Direction.EAST, WireAttachmentTypes.NONE, Direction.WEST, WireAttachmentTypes.NONE)); }

Target:
public SpongeWireAttachmentData() { this(SpongeWireAttachmentData.DEFAULTS); }
Source:
protected <T> ListenableFuture<T> createHttpClient(Class<T> clientClass, int serverPort) throws TTransportException, InterruptedException, ExecutionException { HostAndPort address = HostAndPort.fromParts("localhost", serverPort); ThriftClientConfig config = new ThriftClientConfig().setConnectTimeout(new Duration(1, TimeUnit.SECONDS)) .setReadTimeout(new Duration(1, TimeUnit.SECONDS)) .setWriteTimeout(new Duration(1, TimeUnit.SECONDS)); HttpClientChannel.Factory channelFactory = new HttpClientChannel.Factory("localhost:4567", "/thrift/"); return new ThriftClient<>(clientManager, clientClass, channelFactory, config, "asyncTestClient").open(address); }

Target:
protected <T> ListenableFuture<T> createHttpClient(Class<T> clientClass, int serverPort) throws TTransportException, InterruptedException, ExecutionException { HostAndPort address = HostAndPort.fromParts("localhost", serverPort); ThriftClientConfig config = new ThriftClientConfig().setConnectTimeout(new Duration(1, TimeUnit.SECONDS)) .setReadTimeout(new Duration(1, TimeUnit.SECONDS)) .setWriteTimeout(new Duration(1, TimeUnit.SECONDS)); HttpClientChannel.Factory channelFactory = new HttpClientChannel.Factory("localhost:4567", "/thrift/"); return new ThriftClient<>(clientManager, clientClass, config, "asyncTestClient", channelFactory).open(address); }
Source:
public void closeInterstitial() throws InterruptedException { boolean isMercury = false; try { isMercury = interstitialCloseButtonMercury.isDisplayed(); PageObjectLogging.log("Interstitial Mercury", "Yes", true); } catch (NoSuchElementException e) { PageObjectLogging.log("Interstitial Mercury", "No", true); } if (isMercury) { String closeButtonText = interstitialCloseButtonMercury.getText(); if (closeButtonText.length() > 0) { Integer waitTillCloseButtonAppears = Integer.parseInt(closeButtonText); PageObjectLogging.log("Wait time for close button", String.valueOf(waitTillCloseButtonAppears), true); Thread.sleep((waitTillCloseButtonAppears+2) * 1000); } } wait.forElementClickable(interstitialCloseButton); interstitialCloseButton.click(); }

Target:
public void closeInterstitial() throws InterruptedException { boolean isMercury = false; try { isMercury = interstitialCloseButtonMercury.isDisplayed(); PageObjectLogging.log("Interstitial Mercury", "Yes", true); } catch (NoSuchElementException e) { PageObjectLogging.log("Interstitial Mercury", "No", true); } if (isMercury) { String closeButtonText = interstitialCloseButtonMercury.getText(); if (closeButtonText.length() > 0) { Integer waitTillCloseButtonAppears = Integer.parseInt(closeButtonText); PageObjectLogging.log("Wait time for close button", String.valueOf(waitTillCloseButtonAppears), true); Thread.sleep((waitTillCloseButtonAppears+WAIT_BUTTON_DELAY_TOLERANCE) * 1000); } } wait.forElementClickable(interstitialCloseButton); interstitialCloseButton.click(); }
Source:
public static void main(String[] args) { if (args.length < 4) { System.out.println("Please specify your access key and voice call flow arguments"); return; } final MessageBirdService wsr = new MessageBirdServiceImpl(args[0]); final MessageBirdClient messageBirdClient = new MessageBirdClient(wsr); final VoiceCallFlowRequest voiceCallFlow = new VoiceCallFlowRequest(); voiceCallFlow.setTitle(args[1]); voiceCallFlow.setRecord(args[2]); voiceCallFlow.setSteps(args[3]); voiceCallFlow.setDefaultCall(args[4]); try { System.out.println("Creting a Voice Call Flow"); messageBirdClient.sendVoiceCallFlow(voiceCallFlow); System.out.println("Voice call flow created"); } catch (GeneralException | UnauthorizedException exception) { exception.printStackTrace(); } }

Target:
public static void main(String[] args) { if (args.length < 2) { System.out.println("Please specify your access key and voice call flow arguments"); return; } final MessageBirdService wsr = new MessageBirdServiceImpl(args[0]); final MessageBirdClient messageBirdClient = new MessageBirdClient(wsr); final VoiceCallFlowRequest voiceCallFlowRequest = new VoiceCallFlowRequest(); voiceCallFlowRequest.setTitle(args[1]); voiceCallFlowRequest.setRecord(true); VoiceStep voiceStep = new VoiceStep(); voiceCallFlowRequest.setSteps(Collections.singletonList(voiceStep)); voiceCallFlowRequest.setDefaultCall(true); try { System.out.println("Creting a Voice Call Flow"); messageBirdClient.sendVoiceCallFlow(voiceCallFlowRequest); System.out.println("Voice call flow created"); } catch (GeneralException | UnauthorizedException exception) { exception.printStackTrace(); } }
Source:
@Override public void setMessageChannel(MessageChannel channel) { checkNotNull(channel, "channel"); this.channel = channel; }

Target:
public void setMessageChannel(MessageChannel channel) { checkNotNull(channel, "channel"); this.channel = channel; }
Source:
public static void closeSession(Session session, boolean flush) { if (session != null) { if (flush) { session.flush(); } if (session.isOpen()) { session.close(); } } }

Target:
public static void closeSession(Session session, boolean flush) { if (session != null) { if (flush) { session.flush(); } if (session.isOpen()) { try { session.close(); } catch (HibernateException ex) { LOG.error("There an error while closing the hibernate-session: ", ex.getMessage(), ex); } } } }
Source:
Replica(HardwareLayout hardwareLayout, Partition partition, JSONObject jsonObject) throws JSONException { this.partition = partition; this.disk = hardwareLayout.findDisk(jsonObject.getString("hostname"), jsonObject.getInt("port"), jsonObject.getString("mountPath")); ClusterMapConfig clusterMapConfig = hardwareLayout.getClusterMapConfig(); try { ResourceStatePolicyFactory resourceStatePolicyFactory = Utils.getObj(clusterMapConfig.clusterMapResourceStatePolicyFactory, this, HardwareState.AVAILABLE, clusterMapConfig); resourceStatePolicy = resourceStatePolicyFactory.getResourceStatePolicy(); } catch (Exception e) { logger.error("Error creating resource state policy when instantiating a replica " + e); throw new IllegalStateException("Error creating resource state policy when instantiating a replica " + partition, e); } validate(); }

Target:
Replica(HardwareLayout hardwareLayout, Partition partition, JSONObject jsonObject) throws JSONException { this(partition, hardwareLayout.findDisk(jsonObject.getString("hostname"), jsonObject.getInt("port"), jsonObject.getString("mountPath")), hardwareLayout.getClusterMapConfig()); }