auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void markCleanMerges() throws MergeException { if (mergeTip == null) { return; } try { rw.reset(); rw.sort(RevSort.TOPO); rw.sort(RevSort.REVERSE, true); rw.markStart(mergeTip); for (RevCommit c : alreadyAccepted) { rw.markUninteresting(c); } CodeReviewCommit c; while ((c = (CodeReviewCommit) rw.next()) != null) { if (c.patchsetId != null) { c.statusCode = CommitMergeStatus.CLEAN_MERGE; if (branchUpdate.getRefLogIdent() == null) { setRefLogIdent(getSubmitter(c.patchsetId)); } } } } catch (IOException e) { throw new MergeException("Cannot mark clean merges", e); } }

Target:
protected final void markCleanMerges() throws MergeException { if (mergeTip == null) { return; } try { rw.reset(); rw.sort(RevSort.TOPO); rw.sort(RevSort.REVERSE, true); rw.markStart(mergeTip); for (RevCommit c : alreadyAccepted) { rw.markUninteresting(c); } CodeReviewCommit c; while ((c = (CodeReviewCommit) rw.next()) != null) { if (c.patchsetId != null) { c.statusCode = CommitMergeStatus.CLEAN_MERGE; if (branchUpdate.getRefLogIdent() == null) { setRefLogIdent(getSubmitter(c.patchsetId)); } } } } catch (IOException e) { throw new MergeException("Cannot mark clean merges", e); } }
Source:
public void open(IPath file) { File statFile = file.toFile(); BufferedReader fileReader = null; try { fileReader = new BufferedReader(new FileReader(statFile)); final StringBuilder contents = new StringBuilder(); final StringBuilder title = new StringBuilder(); String line; while ((line = fileReader.readLine()) != null) { if (title.length() == 0 && line.contains(TITLE_EXCERPT)) { title.append(line); continue; } contents.append(line); contents.append("\n"); } if (title.length() == 0) { title.append(NLS.bind(Messages.PerfEditorLauncher_stat_title, statFile.getName())); } PerfPlugin.getDefault().setStatData(new IPerfData() { @Override public String getTitle() { return title.toString(); } @Override public String getPerfData() { return contents.toString(); } }); StatView.refreshView(); } catch (FileNotFoundException e) { PerfPlugin.getDefault().openError(e, NLS.bind(Messages.PerfEditorLauncher_file_dne_error, statFile.getName())); } catch (IOException e) { PerfPlugin.getDefault().openError(e, NLS.bind(Messages.PerfEditorLauncher_file_read_error, statFile.getName())); } finally { if (fileReader != null) { try { fileReader.close(); } catch (IOException e) { PerfPlugin.getDefault().openError(e, ""); } } } }

Target:
public void open(IPath file) { File statFile = file.toFile(); BufferedReader fileReader = null; try { fileReader = new BufferedReader(new FileReader(statFile)); final StringBuilder contents = new StringBuilder(); final StringBuilder title = new StringBuilder(); String line; while ((line = fileReader.readLine()) != null) { if (title.length() == 0 && line.contains(TITLE_EXCERPT)) { title.append(line); } contents.append(line); contents.append("\n"); } if (title.length() == 0) { title.append(NLS.bind(Messages.PerfEditorLauncher_stat_title, statFile.getName())); } PerfPlugin.getDefault().setStatData(new IPerfData() { @Override public String getTitle() { return title.toString(); } @Override public String getPerfData() { return contents.toString(); } }); StatView.refreshView(); } catch (FileNotFoundException e) { PerfPlugin.getDefault().openError(e, NLS.bind(Messages.PerfEditorLauncher_file_dne_error, statFile.getName())); } catch (IOException e) { PerfPlugin.getDefault().openError(e, NLS.bind(Messages.PerfEditorLauncher_file_read_error, statFile.getName())); } finally { if (fileReader != null) { try { fileReader.close(); } catch (IOException e) { PerfPlugin.getDefault().openError(e, ""); } } } }
Source:
protected abstract void processMessage() throws Throwable; protected void sendResponse(Object response) { try { ClientMessage clientMessage = encodeResponse(response); sendClientMessage(clientMessage); } catch (Exception e) { sendClientMessage(e); } }

Target:
protected abstract void processMessage() throws Throwable; protected void sendResponse(Object response) { try { ClientMessage clientMessage = encodeResponse(response); sendClientMessage(clientMessage); } catch (Exception e) { handleProcessingFailure(e); } }
Source:
public boolean test(ICubicWorld world) { if (!super.test(world)) return false; if (world.getClass() == (Class<?>) WorldClient.class && ((World) world).getChunkProvider().getClass() != ChunkProviderClient.class) { return true; } return super.test(world) && world.getClass() != (Class<?>) WorldClient.class; }

Target:
public boolean test(ICubicWorld world) { return !allowedClientWorldClasses.contains(world.getClass()) || !allowedClientChunkProviderClasses.contains(((World) world).getChunkProvider().getClass()); }
Source:
public void allDataPointsOldSchemaTest() { final Long surveyId = 300L; final List<SurveyedLocale> allDataPoints = createDataPoints(surveyId, 20); final List<Long> deviceIds = Arrays.asList(5L, 6L); final List<Long> formIds = Arrays.asList(10L, 11L); final SurveyAssignment sa = createAssignment(surveyId, deviceIds, formIds); final DataPointServlet servlet = new DataPointServlet(); final List<SurveyedLocale> foundDataPoints = servlet.getDataPointList(surveyId, 6L); final Set<Long> allDataPointIds = getEntityIds(allDataPoints); final Set<Long> foundDataPointIds = getEntityIds(foundDataPoints); assertEquals(allDataPointIds, foundDataPointIds); }

Target:
public void allDataPointsOldSchemaTest() { final Long surveyId = randomId(); final List<SurveyedLocale> allDataPoints = createDataPoints(surveyId, 20); final List<Long> deviceIds = Arrays.asList(randomId(), randomId()); final List<Long> formIds = Arrays.asList(randomId(), randomId()); final SurveyAssignment sa = createAssignment(surveyId, deviceIds, formIds); final DataPointServlet servlet = new DataPointServlet(); final List<SurveyedLocale> foundDataPoints = servlet.getDataPointList(surveyId, deviceIds.get(0)); final Set<Long> allDataPointIds = getEntityIds(allDataPoints); final Set<Long> foundDataPointIds = getEntityIds(foundDataPoints); assertEquals(allDataPointIds, foundDataPointIds); }
Source:
public static final String getPreferenceNodeId () { return JAVA_UI_ID_PLUGIN; }

Target:
public static final String getPreferenceNodeId () { return PREFERENCE_NODE_ID; }
Source:
public synchronized boolean isFinished() { StageExecutionState rootStageState = rootStage.getStageExecution().getState(); return rootStageState.isDone() && !rootStageState.isFailure(); }

Target:
public boolean isFinished() { StageExecutionState rootStageState = rootStage.getStageExecution().getState(); return rootStageState.isDone() && !rootStageState.isFailure(); }
Source:
public void testGenerateKeyPairDefault() throws CredentialStoreException { String storageLocation = getStoragePathForNewFile(); String storagePassword = "cspassword"; String aliasName = "testalias"; String[] args = { "--location=" + storageLocation, "--create", "--generate-key-pair", aliasName, "--summary", "--password", storagePassword }; executeCommandAndCheckStatus(args); CredentialStore store = getCredentialStoreStorageFromExistsFile(storageLocation, storagePassword); KeyPairCredential credential = store.retrieve(aliasName, KeyPairCredential.class); KeyPair keyPair = credential.getKeyPair(); Assert.assertNotNull(keyPair); Assert.assertNotNull(keyPair.getPrivate()); Assert.assertNotNull(keyPair.getPublic()); Assert.assertEquals(Pem.RSA_ALGORITHM, keyPair.getPrivate().getAlgorithm()); Assert.assertEquals(Pem.RSA_ALGORITHM, keyPair.getPrivate().getAlgorithm()); Assert.assertEquals(new File(System.getProperty("user.home"), ".ssh"), credential.getSshDirectory()); Assert.assertEquals("known_hosts", credential.getKnownHostsFile()); }

Target:
public void testGenerateKeyPairDefault() throws CredentialStoreException { String storageLocation = getStoragePathForNewFile(); String storagePassword = "cspassword"; String aliasName = "testalias"; String[] args = { "--location=" + storageLocation, "--create", "--generate-key-pair", aliasName, "--summary", "--password", storagePassword }; executeCommandAndCheckStatus(args); CredentialStore store = getCredentialStoreStorageFromExistsFile(storageLocation, storagePassword); KeyPairCredential credential = store.retrieve(aliasName, KeyPairCredential.class); KeyPair keyPair = credential.getKeyPair(); Assert.assertNotNull(keyPair); Assert.assertNotNull(keyPair.getPrivate()); Assert.assertNotNull(keyPair.getPublic()); Assert.assertEquals(RSA_ALGORITHM, keyPair.getPrivate().getAlgorithm()); Assert.assertEquals(RSA_ALGORITHM, keyPair.getPublic().getAlgorithm()); }
Source:
private boolean checkAllRights(DocumentReference oldReference, DocumentReference newReference) { if (this.request.isDeleteSource() && !hasAccess(Right.DELETE, oldReference)) { this.logger.error("You are not allowed to delete [{}].", oldReference); return false; } else if (!hasAccess(Right.VIEW, oldReference)) { this.logger.error("You don't have sufficient permissions over the source document [{}].", oldReference); return false; } else if (!hasAccess(Right.VIEW, newReference) || !hasAccess(Right.EDIT, newReference) || (this.modelBridge.exists(newReference) && !hasAccess(Right.DELETE, newReference))) { this.logger.error("You don't have sufficient permissions over the destination document [{}].", newReference); return false; } return true; }

Target:
private boolean checkAllRights(DocumentReference oldReference, DocumentReference newReference) { if (this.request.isDeleteSource() && !hasAccess(Right.DELETE, oldReference)) { this.logger.error("You are not allowed to delete [{}].", oldReference); return false; } else if (!hasAccess(Right.VIEW, oldReference)) { this.logger.error("You don't have sufficient permissions over the source document [{}].", oldReference); return false; } else if (!hasAccess(Right.EDIT, newReference) || (this.modelBridge.exists(newReference) && !hasAccess(Right.DELETE, newReference))) { this.logger.error("You don't have sufficient permissions over the destination document [{}].", newReference); return false; } return true; }
Source:
public void updateData(@Nullable List<Object> data) { if (data == null || mRecyclerView == null) { setDataBound(false); return; } if (data.isEmpty()) { setDataBound(false); return; } if (mMapper == null) { throw new RuntimeException(this.getClass().getName() + " does not have a RecyclerViewBinderMapper set!"); } long startTime = System.currentTimeMillis(); Log.d(Constants.LOG_TAG, "BINDING DATA"); if (mAdapter == null) { SmartAdapter.MultiAdaptersCreator creator = SmartAdapter.items(new ArrayList<>(data)); mMapper.initializeMaps(creator); mAdapter = creator.into(mRecyclerView); } else { mAdapter.clearItems(); mAdapter.addItems(new ArrayList<>(data)); } if (mProgressBar != null) { mProgressBar.setVisibility(View.GONE); } mRecyclerView.setVisibility(View.VISIBLE); mNoDataBinder.unbindData(); Log.d(Constants.LOG_TAG, "BINDING COMPLETE; ELAPSED TIME: " + (System.currentTimeMillis() - startTime) + "ms"); setDataBound(true); }

Target:
public void updateData(@Nullable List<Object> data) { mList = data; if (data == null || mRecyclerView == null) { setDataBound(false); return; } if (data.isEmpty()) { setDataBound(false); return; } if (mMapper == null) { throw new RuntimeException(this.getClass().getName() + " does not have a RecyclerViewBinderMapper set!"); } if (mAdapter == null) { createAndInitializeAdapterForData(new ArrayList<>(data)); } else { mAdapter.clearItems(); mAdapter.addItems(new ArrayList<>(data)); } if (mProgressBar != null) { mProgressBar.setVisibility(View.GONE); } mRecyclerView.setVisibility(View.VISIBLE); mNoDataBinder.unbindData(); setDataBound(true); }
Source:
public synchronized List<TagDto> getAllTags() { List<TagEntity> tags = (List<TagEntity>) (entityManager.createQuery("select te from TagEntity as te")).getResultList(); List<TagDto> allTags = new ArrayList<TagDto>(); if (!tags.isEmpty()) { allTags = new ArrayList<TagDto>(); for (TagEntity tagEntity : tags) { allTags.add(new TagDto(tagEntity.getName(), tagEntity.getDescription())); } } return allTags; }

Target:
public List<TagDto> getAllTags() { List<TagEntity> tags = (List<TagEntity>) (entityManager.createQuery("select te from TagEntity as te")).getResultList(); List<TagDto> allTags = new ArrayList<TagDto>(); if (!tags.isEmpty()) { for (TagEntity tagEntity : tags) { allTags.add(new TagDto(tagEntity.getName(), tagEntity.getDescription())); } } return allTags; }
Source:
private static String validateTableName(String tableName) { return validateName(tableName, "Table"); }

Target:
static String validateTableName(String tableName) { return validateName(tableName, "Table"); }
Source:
protected Object getValueInternal(ProgressListener listener) throws Exception { Object getCoverage = null; InputReferenceType ref = input.getReference(); if (ref.getMethod() == MethodType.POST_LITERAL) { getCoverage = ref.getBody(); } else { String version = getVersion(ref.getHref()); KvpRequestReader reader; if (version.equals("1.0.0") || version.equals("1.0")) { reader = (KvpRequestReader) context.getBean("wcs100GetCoverageRequestReader"); } else if(version.equals("2.0.1") ){ reader = (KvpRequestReader) context.getBean("wcs20getCoverageKvpParser"); } else { reader = (KvpRequestReader) context.getBean("wcs111GetCoverageRequestReader"); } getCoverage = kvpParse(ref.getHref(), reader); } if (getCoverage instanceof GetCoverageType) { WebCoverageService111 wcs = (WebCoverageService111) context .getBean("wcs111ServiceTarget"); return wcs.getCoverage((net.opengis.wcs11.GetCoverageType) getCoverage)[0]; } else if (getCoverage instanceof net.opengis.wcs10.GetCoverageType) { WebCoverageService100 wcs = (WebCoverageService100) context .getBean("wcs100ServiceTarget"); return wcs.getCoverage((net.opengis.wcs10.GetCoverageType) getCoverage)[0]; } else if (getCoverage instanceof net.opengis.wcs20.GetCoverageType) { WebCoverageService20 wcs = (WebCoverageService20) context .getBean("wcs20ServiceTarget"); return wcs.getCoverage((net.opengis.wcs20.GetCoverageType) getCoverage); } else { throw new WPSException("Unrecognized request type " + getCoverage); } }

Target:
protected Object getValueInternal(ProgressListener listener) throws Exception { Object getCoverage = null; InputReferenceType ref = input.getReference(); if (ref.getMethod() == MethodType.POST_LITERAL) { getCoverage = ref.getBody(); } else { String version = getVersion(ref.getHref()); KvpRequestReader reader; if ("1.0.0".equals(version) || "1.0".equals(version)) { reader = (KvpRequestReader) context.getBean("wcs100GetCoverageRequestReader"); } else if ("2.0.1".equals(version) || "2.0.0".equals(version)) { reader = (KvpRequestReader) context.getBean("wcs20getCoverageKvpParser"); } else { reader = (KvpRequestReader) context.getBean("wcs111GetCoverageRequestReader"); } getCoverage = kvpParse(ref.getHref(), reader); } if (getCoverage instanceof GetCoverageType) { WebCoverageService111 wcs = (WebCoverageService111) context .getBean("wcs111ServiceTarget"); return wcs.getCoverage((net.opengis.wcs11.GetCoverageType) getCoverage)[0]; } else if (getCoverage instanceof net.opengis.wcs10.GetCoverageType) { WebCoverageService100 wcs = (WebCoverageService100) context .getBean("wcs100ServiceTarget"); return wcs.getCoverage((net.opengis.wcs10.GetCoverageType) getCoverage)[0]; } else if (getCoverage instanceof net.opengis.wcs20.GetCoverageType) { WebCoverageService20 wcs = (WebCoverageService20) context .getBean("wcs20ServiceTarget"); return wcs.getCoverage((net.opengis.wcs20.GetCoverageType) getCoverage); } else { throw new WPSException("Unrecognized request type " + getCoverage); } }
Source:
private void runPatchMetadataTests(EPerson asUser, int expectedStatus) throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context).withEmail("user@test.com").build(); String token = getAuthToken(asUser.getEmail(), password); new MetadataPatchSuite().runWith(getClient(token), "/api/eperson/epersons/" + ePerson.getID(), expectedStatus); }

Target:
private void runPatchMetadataTests(EPerson asUser, int expectedStatus) throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context).withEmail("user@test.com").build(); context.restoreAuthSystemState(); String token = getAuthToken(asUser.getEmail(), password); new MetadataPatchSuite().runWith(getClient(token), "/api/eperson/epersons/" + ePerson.getID(), expectedStatus); }
Source:
public HookResult call() throws Exception { HookResult result = null; StringBuilder output = new StringBuilder(); try { final List<String> argv = new ArrayList<String>(1 + args.size()); argv.add(hook.getAbsolutePath()); argv.addAll(args); final ProcessBuilder pb = new ProcessBuilder(argv); pb.redirectErrorStream(true); if (repo != null) { pb.directory(repo.getDirectory()); final Map<String, String> env = pb.environment(); env.put("GIT_DIR", repo.getDirectory().getAbsolutePath()); } Process ps = pb.start(); ps.getOutputStream().close(); BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream())); try { String line = br.readLine(); while (line != null) { output.append(line); line = br.readLine(); if(line != null) { output.append(System.getProperty("line.separator")); } } } finally { try { br.close(); } catch (IOException closeErr) { } ps.waitFor(); result = new HookResult(ps.exitValue(), output.toString()); } } catch (Throwable err) { log.error("Error running hook " + hook.getAbsolutePath(), err); } finally { if (repo != null) { repo.close(); } } return result; }

Target:
public HookResult call() throws Exception { return super.runHook(); }
Source:
private OSDisk createOSDisk(Image image) { OsFamily osFamily = image.getOperatingSystem().getFamily(); String osType = osFamily == OsFamily.WINDOWS ? "Windows" : "Linux"; return OSDisk.builder() .osType(osType) .caching(DataDisk.CachingTypes.READ_WRITE.toString()) .createOption("FromImage") .managedDiskParameters(ManagedDiskParameters.create(null, ManagedDiskParameters.StorageAccountTypes.STANDARD_LRS.toString())) .build(); }

Target:
private OSDisk createOSDisk(Image image) { OsFamily osFamily = image.getOperatingSystem().getFamily(); String osType = osFamily == OsFamily.WINDOWS ? "Windows" : "Linux"; return OSDisk.builder() .osType(osType) .caching(DataDisk.CachingTypes.READ_WRITE.toString()) .createOption(CreationData.CreateOptions.FROM_IMAGE.toString()) .managedDiskParameters(ManagedDiskParameters.create(null, ManagedDiskParameters.StorageAccountTypes.STANDARD_LRS.toString())) .build(); }
Source:
protected void endScope() { if (this != CURRENT_SCOPE.get().peek()) { throw new IllegalStateException( "Incorrectly trying to end another Scope then which the calling process is contained in." ); } CURRENT_SCOPE.get().pop(); if (CURRENT_SCOPE.get().isEmpty()) { logger.debug("Clearing out ThreadLocal current Scope, as no Scopes are present"); CURRENT_SCOPE.remove(); } }

Target:
protected void endScope() { Deque<Scope> scopes = CURRENT_SCOPE.get(); if (this != scopes.peek()) { throw new IllegalStateException( "Incorrectly trying to end another Scope then which the calling process is contained in." ); } scopes.pop(); if (scopes.isEmpty()) { logger.debug("Clearing out ThreadLocal current Scope, as no Scopes are present"); CURRENT_SCOPE.remove(); } }
Source:
public void testNoOfflineMessageIfNotLoggedIn() throws IOException, InterruptedException { System.out.println("testNoOfflineMessageIfNotLoggedIn"); TestClient client2 = createTestClient(); client2.disconnect(); Thread.sleep(1000); assertNoMessage(client1); }

Target:
public void testNoOfflineMessageIfNotLoggedIn() throws IOException, InterruptedException { shutdown(); class TestServer extends Server { private CountDownLatch latch; @Override public void onDisconnected(ClientIO client) { super.onDisconnected(client); if (latch != null) { latch.countDown(); } } public void setLatch(CountDownLatch latch) { this.latch = latch; } } CountDownLatch disconnectionLatch = new CountDownLatch(1); startServer(new TestServer()); ((TestServer) server).setLatch(disconnectionLatch); TestClient client2 = createTestClient(); client2.disconnect(); disconnectionLatch.await(); assertNoMessage(client1); }
Source:
public Handler buildHandler(Class<?> sqlObjectType, Method method) { return (obj, m, args, handle) -> { return "foo"; }; }

Target:
public Handler buildHandler(Class<?> sqlObjectType, Method method) { return (obj, m, args, handle) -> "foo"; }
Source:
private ListenableFuture<List<DataSource>> syncDataSources() { ListenableFuture<List<DataSource>> future = exec.submit(() -> { List<DataSource> dataSources1 = controller.getSleuthKitCase().getDataSources(); synchronized (dataSourcesViewable) { dataSourcesViewable.clear(); dataSourcesViewable.put(null, controller.hasTooManyFiles(null)); for (DataSource ds : dataSources1) { dataSourcesViewable.put(ds, controller.hasTooManyFiles(ds)); } } return dataSources1; }); Futures.addCallback(future, new FutureCallback<List<DataSource>>() { @Override public void onSuccess(List<DataSource> result) { List<Optional<DataSource>> newDataSources = new ArrayList<>(); newDataSources.add(Optional.empty()); result.forEach(dataSource -> newDataSources.add(Optional.of(dataSource))); dataSources.setAll(newDataSources); } @Override public void onFailure(Throwable t) { logger.log(Level.SEVERE, "Unable to get datasources for current case.", t); } }, Platform::runLater); return future; }

Target:
private ListenableFuture<List<DataSource>> syncDataSources() { ListenableFuture<List<DataSource>> future = exec.submit(() -> { List<DataSource> dataSourcesInCase = controller.getSleuthKitCase().getDataSources(); synchronized (dataSourcesViewable) { dataSourcesViewable.clear(); dataSourcesViewable.put(null, controller.hasTooManyFiles(null)); for (DataSource ds : dataSourcesInCase) { dataSourcesViewable.put(ds, controller.hasTooManyFiles(ds)); } } return dataSourcesInCase; }); Futures.addCallback(future, new FutureCallback<List<DataSource>>() { @Override public void onSuccess(List<DataSource> result) { List<Optional<DataSource>> newDataSources = new ArrayList<>(); newDataSources.add(Optional.empty()); result.forEach(dataSource -> newDataSources.add(Optional.of(dataSource))); dataSources.setAll(newDataSources); } @Override public void onFailure(Throwable t) { logger.log(Level.SEVERE, "Unable to get datasources for current case.", t); } }, Platform::runLater); return future; }
Source:
private Retrofit createRetrofit() { String baseUrl = SEApiConstants.API_BASE_URL + (SEApiConstants.BASE_API_PATH); return new Retrofit.Builder() .baseUrl(baseUrl) .client(createOkHttpClient()) .addConverterFactory(GsonConverterFactory.create(gson)) .build(); }

Target:
private Retrofit createRetrofit() { String baseUrl = SEApiConstants.API_BASE_URL + SEApiConstants.BASE_API_PATH; return new Retrofit.Builder() .baseUrl(baseUrl) .client(createOkHttpClient()) .addConverterFactory(GsonConverterFactory.create(gson)) .build(); }
Source:
public String describeFlow(Flow flow) { String result; try { FlowConfiguration configuration = flow.getFlowConfiguration(); flow.getName(); FlowMetaDataImpl flowMetaData = new FlowMetaDataImpl(); flowMetaData.setName(flow.getName()); flowMetaData.setConsumer(describeFlowElement(flowMetaData, configuration.getConsumerFlowElement())); if(flow instanceof ConfiguredResource) { flowMetaData.setConfigurationId(((ConfiguredResource) flow).getConfiguredResourceId()); } ObjectMapper mapper = new ObjectMapper(); result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(flowMetaData); } catch (Exception e) { throw new RuntimeException("Exception has occurred creating flow meta data json!", e); } return result; }

Target:
public String describeFlow(Flow flow) { String result; try { FlowConfiguration configuration = flow.getFlowConfiguration(); FlowMetaDataImpl flowMetaData = new FlowMetaDataImpl(); flowMetaData.setName(flow.getName()); flowMetaData.setConsumer(describeFlowElement(flowMetaData, configuration.getConsumerFlowElement())); if(flow instanceof ConfiguredResource) { flowMetaData.setConfigurationId(((ConfiguredResource) flow).getConfiguredResourceId()); } result = this.mapper.writerWithDefaultPrettyPrinter().writeValueAsString(flowMetaData); } catch (Exception e) { throw new RuntimeException("Exception has occurred creating flow meta data json!", e); } return result; }
Source:
public Aggregation getAggregations() { if (jsonObject != null) { JsonObject aggregationsMap; if (jsonObject.has("aggregations")) { aggregationsMap = (JsonObject) jsonObject.get("aggregations"); } else if (jsonObject.has("aggs")) { aggregationsMap = (JsonObject) jsonObject.get("aggs"); } else { return new Aggregation("aggs", new JsonObject()); } return new Aggregation("aggs", aggregationsMap); } return new Aggregation("aggs", new JsonObject()); }

Target:
public Aggregation getAggregations() { final String rootAggrgationName = "aggs"; if (jsonObject == null) return new Aggregation(rootAggrgationName, new JsonObject()); if (jsonObject.has("aggregations")) return new Aggregation(rootAggrgationName, jsonObject.getAsJsonObject("aggregations")); if (jsonObject.has("aggs")) return new Aggregation(rootAggrgationName, jsonObject.getAsJsonObject("aggs")); return new Aggregation(rootAggrgationName, new JsonObject()); }
Source:
private Socket enableTLSOnSocket(final Socket socket) { if ((socket instanceof SSLSocket)) { ((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"}); } return socket; }

Target:
private Socket enableTLSOnSocket(final Socket socket) { if (socket instanceof SSLSocket) { ((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"}); } return socket; }
Source:
Decorator(String container, EnvVars envHost, String ws, String toolName, VersionNumber dockerVersion) { this.container = container; this.envHost = Util.mapToEnv(envHost); this.ws = ws; this.toolName = toolName; this.hasEnv = dockerVersion.isOlderThan(new VersionNumber("1.13.0")); this.hasWorkdir = !dockerVersion.isOlderThan(new VersionNumber("17.12")); }

Target:
Decorator(String container, EnvVars envHost, String ws, String toolName, VersionNumber dockerVersion) { this.container = container; this.envHost = Util.mapToEnv(envHost); this.ws = ws; this.toolName = toolName; this.hasEnv = dockerVersion != null && dockerVersion.compareTo(new VersionNumber("1.13.0")) >= 0; this.hasWorkdir = dockerVersion != null && dockerVersion.compareTo(new VersionNumber("17.12")) >= 0; }
Source:
protected boolean pageValid() { setErrorMessage(null); if (!isNameValid(nametext.getText().trim())) { return false; } if (resolvingError) { setErrorMessage(WizardMessages.TargetBasedApiBaselineWizardPage_SomeTargetsCouldNotBeResolved); } if(targetsViewer.getCheckedElements().length != 1) { setErrorMessage(WizardMessages.ApiProfileWizardPage_select_target); reloadbutton.setEnabled(false); return false; } if (fProfile != null) { if (fProfile.getApiComponents().length == 0) { setErrorMessage(WizardMessages.ApiProfileWizardPage_2); return false; } IStatus status = fProfile.getExecutionEnvironmentStatus(); if (status.getSeverity() == IStatus.ERROR) { setErrorMessage(status.getMessage()); return false; } ITargetDefinition selected = getSelectedTargetDefinition(); if (selected != null && !ApiModelFactory.isUpToDateWithTarget(fProfile, selected)) { setErrorMessage(WizardMessages.ApiProfileWizardPage_location_needs_reset); return false; } } else { setErrorMessage(WizardMessages.ApiProfileWizardPage_location_needs_reset); return false; } return true; }

Target:
protected boolean pageValid() { setErrorMessage(null); if (!isNameValid(nametext.getText().trim())) { return false; } if(targetsViewer.getCheckedElements().length != 1) { setErrorMessage(WizardMessages.ApiProfileWizardPage_select_target); reloadbutton.setEnabled(false); return false; } if (fProfile != null) { if (fProfile.getApiComponents().length == 0) { setErrorMessage(WizardMessages.ApiProfileWizardPage_2); return false; } IStatus status = fProfile.getExecutionEnvironmentStatus(); if (status.getSeverity() == IStatus.ERROR) { setErrorMessage(status.getMessage()); return false; } ITargetDefinition selected = getSelectedTargetDefinition(); if (selected != null && !ApiModelFactory.isUpToDateWithTarget(fProfile, selected)) { setErrorMessage(WizardMessages.ApiProfileWizardPage_location_needs_reset); return false; } } else { setErrorMessage(WizardMessages.ApiProfileWizardPage_location_needs_reset); return false; } return true; }
Source:
private void loadConstants(ServletContext servletContext) { WebConstants.BUILD_TIMESTAMP = servletContext.getInitParameter("build.timestamp"); WebConstants.WEBAPP_NAME = getContextPath(servletContext); WebConstants.MODULE_REPOSITORY_URL = servletContext.getInitParameter("module.repository.url"); }

Target:
private void loadConstants(ServletContext servletContext) { WebConstants.BUILD_TIMESTAMP = servletContext.getInitParameter("build.timestamp"); WebConstants.WEBAPP_NAME = getContextPath(servletContext); WebConstants.MODULE_REPOSITORY_URL = servletContext.getInitParameter("module.repository.url"); if (!"openmrs".equalsIgnoreCase(WebConstants.WEBAPP_NAME)) { OpenmrsConstants.KEY_OPENMRS_APPLICATION_DATA_DIRECTORY = WebConstants.WEBAPP_NAME + "_APPLICATION_DATA_DIRECTORY"; } }
Source:
public boolean supports(Class c) { return CohortMembership.class.isAssignableFrom(c); }

Target:
public boolean supports(Class c) { return Cohort.class.isAssignableFrom(c); }
Source:
public Optional<String> namespace() { return Optional.of("H2 namespace"); }

Target:
public Optional<String> namespace() { return Optional.empty(); }
Source:
private void getOrCreateFirewalls(GoogleComputeEngineTemplateOptions templateOptions, Network network, FirewallTagNamingConvention naming) { String projectName = userProject.get(); Set<AtomicReference<Operation>> operations = Sets.newHashSet(); for (Integer port : templateOptions.getInboundPorts()) { String name = naming.name(port); ImmutableSet<Firewall.Rule> rules = ImmutableSet.of(Firewall.Rule.permitTcpRule(port), Firewall.Rule.permitUdpRule(port)); FirewallOptions firewallOptions = new FirewallOptions() .name(name) .network(network.getSelfLink()) .allowedRules(rules) .sourceTags(templateOptions.getTags()) .sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, EXTERIOR_RANGE)) .targetTags(ImmutableSet.of(name)); Firewall firewall = api.getFirewallApiForProject(projectName).get(firewallOptions.getName()); if (firewall == null) { AtomicReference<Operation> operation = new AtomicReference<Operation>(api.getFirewallApiForProject(projectName).createInNetwork( firewallOptions.getName(), network.getSelfLink(), firewallOptions)); operations.add(operation); } } for (AtomicReference<Operation> operation : operations) { retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, MILLISECONDS).apply(operation); checkState(!operation.get().getHttpError().isPresent(),"Could not create firewall, operation failed" + operation); } }

Target:
private void getOrCreateFirewalls(GoogleComputeEngineTemplateOptions templateOptions, Network network, FirewallTagNamingConvention naming) { String projectName = userProject.get(); FirewallApi firewallApi = api.getFirewallApiForProject(projectName); Set<AtomicReference<Operation>> operations = Sets.newHashSet(); for (Integer port : templateOptions.getInboundPorts()) { String name = naming.name(port); Firewall firewall = firewallApi.get(name); if (firewall == null) { ImmutableSet<Firewall.Rule> rules = ImmutableSet.of(Firewall.Rule.permitTcpRule(port), Firewall.Rule.permitUdpRule(port)); FirewallOptions firewallOptions = new FirewallOptions() .name(name) .network(network.getSelfLink()) .allowedRules(rules) .sourceTags(templateOptions.getTags()) .sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, EXTERIOR_RANGE)) .targetTags(ImmutableSet.of(name)); AtomicReference<Operation> operation = new AtomicReference<Operation>(firewallApi.createInNetwork( firewallOptions.getName(), network.getSelfLink(), firewallOptions)); operations.add(operation); } } for (AtomicReference<Operation> operation : operations) { retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, MILLISECONDS).apply(operation); checkState(!operation.get().getHttpError().isPresent(),"Could not create firewall, operation failed" + operation); } }
Source:
public void reconnect(int clientID, String clientName) throws RemoteException { amountOfPingsReceived++; try { if (!connectedPlayers.containsKey(clientID)) { connectedPlayers.put(clientID, (ClientInterface) Naming.lookup(clientName)); } } catch (NotBoundException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } }

Target:
public void reconnect(int clientID, String clientName) throws RemoteException { clientAmountOfMessagesReceived++; try { if (!connectedPlayers.containsKey(clientID)) { connectedPlayers.put(clientID, (ClientInterface) Naming.lookup(clientName)); } } catch (NotBoundException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } }
Source:
private boolean validateStorage() { List<DiskImage> vmDisksList = getSnappableVmDisks(); vmDisksList = ImagesHandler.getDisksDummiesForStorageAllocations(vmDisksList); List<DiskImage> allDisks = new ArrayList<>(vmDisksList); List<DiskImage> memoryDisksList = null; if (getParameters().isSaveMemory()) { memoryDisksList = MemoryUtils.createDiskDummies(getVm().getTotalMemorySizeInBytes(), MemoryUtils.METADATA_SIZE_IN_BYTES); if (Guid.Empty.equals(getStorageDomainIdForVmMemory(memoryDisksList))) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_NO_SUITABLE_DOMAIN_FOUND); } allDisks.addAll(memoryDisksList); } MultipleStorageDomainsValidator sdValidator = createMultipleStorageDomainsValidator(allDisks); if (!validate(sdValidator.allDomainsExistAndActive()) || !validate(sdValidator.allDomainsWithinThresholds()) || !validateCinder()) { return false; } if (memoryDisksList == null) { return validate(sdValidator.allDomainsHaveSpaceForNewDisks(vmDisksList)); } return validate(sdValidator.allDomainsHaveSpaceForAllDisks(vmDisksList, memoryDisksList)); }

Target:
private boolean validateStorage() { List<DiskImage> vmDisksList = getDisksListForChecks(); vmDisksList = ImagesHandler.getDisksDummiesForStorageAllocations(vmDisksList); List<DiskImage> allDisks = new ArrayList<>(vmDisksList); List<DiskImage> memoryDisksList = null; if (getParameters().isSaveMemory()) { memoryDisksList = MemoryUtils.createDiskDummies(getVm().getTotalMemorySizeInBytes(), MemoryUtils.METADATA_SIZE_IN_BYTES); if (Guid.Empty.equals(getStorageDomainIdForVmMemory(memoryDisksList))) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_NO_SUITABLE_DOMAIN_FOUND); } allDisks.addAll(memoryDisksList); } MultipleStorageDomainsValidator sdValidator = createMultipleStorageDomainsValidator(allDisks); if (!validate(sdValidator.allDomainsExistAndActive()) || !validate(sdValidator.allDomainsWithinThresholds()) || !validateCinder()) { return false; } if (memoryDisksList == null) { return validate(sdValidator.allDomainsHaveSpaceForNewDisks(vmDisksList)); } return validate(sdValidator.allDomainsHaveSpaceForAllDisks(vmDisksList, memoryDisksList)); }
Source:
private void handleCaptureRetry(ChargeCaptureMessage captureMessage) throws QueueException { ChargeEntity charge = chargeDao.findByExternalId(captureMessage.getChargeId()) .orElseThrow(() -> new QueueException("Invalid message on capture retry " + captureMessage.getChargeId())); boolean shouldRetry = chargeDao.countCaptureRetriesForCharge(charge.getId()) >= maximumCaptureRetries; if (shouldRetry) { captureQueue.scheduleMessageForRetry(captureMessage); } else { cardCaptureService.markChargeAsCaptureError(captureMessage.getChargeId()); captureQueue.markMessageAsProcessed(captureMessage); } }

Target:
private void handleCaptureRetry(ChargeCaptureMessage captureMessage) throws QueueException { int numberOfChargeRetries = chargeDao.countCaptureRetriesForChargeExternalId(captureMessage.getChargeId()); boolean shouldRetry = numberOfChargeRetries <= maximumCaptureRetries; if (shouldRetry) { captureQueue.scheduleMessageForRetry(captureMessage); } else { cardCaptureService.markChargeAsCaptureError(captureMessage.getChargeId()); captureQueue.markMessageAsProcessed(captureMessage); } }
Source:
public void fail(Tuple input) { if(stormIdName != null && input.contains(stormIdName)) { String stormId = input.getStringByField(stormIdName); Monitor.getMonitor().endLatency(pair(input), boltService, stormIdName, stormId, new Throwable(boltService + " failed to process tuple") ); } else { Monitor.getMonitor().endLatency(pair(input), boltService, new Throwable(boltService + " failed to process tuple")); } super.fail(input); }

Target:
public void fail(Tuple input) { if(stormIdName.isPresent() && input.contains(stormIdName.get())) { String stormId = input.getStringByField(stormIdName.get()); Monitor.getMonitor().endLatency(pair(input), boltService, stormIdName.get(), stormId, new Throwable(boltService + " failed to process tuple") ); } else { Monitor.getMonitor().endLatency(pair(input), boltService, new Throwable(boltService + " failed to process tuple")); } super.fail(input); }
Source:
public View getView(final String name) throws CmdLineException { ViewGroup group = Jenkins.getActiveInstance(); View view = null; final StringTokenizer tok = new StringTokenizer(name, "/"); while(tok.hasMoreTokens()) { String viewName = tok.nextToken(); view = group.getView(viewName); if (view == null) throw new IllegalArgumentException(String.format( "No view named %s inside view %s", viewName, group.getDisplayName() )); view.checkPermission(View.READ); if (view instanceof ViewGroup) { group = (ViewGroup) view; } else if (tok.hasMoreTokens()) { throw new IllegalStateException(view.getViewName() + " view can not contain views"); } } return view; }

Target:
public View getView(final String name) { ViewGroup group = Jenkins.getActiveInstance(); View view = null; final StringTokenizer tok = new StringTokenizer(name, "/"); while(tok.hasMoreTokens()) { String viewName = tok.nextToken(); view = group.getView(viewName); if (view == null) throw new IllegalArgumentException(String.format( "No view named %s inside view %s", viewName, group.getDisplayName() )); view.checkPermission(View.READ); if (view instanceof ViewGroup) { group = (ViewGroup) view; } else if (tok.hasMoreTokens()) { throw new IllegalStateException(view.getViewName() + " view can not contain views"); } } return view; }
Source:
private ImmutableList<ProducerRecord<DivolteIdentifier,AvroRecordBuffer>> sendBatch(final List<ProducerRecord<DivolteIdentifier, AvroRecordBuffer>> batch) throws InterruptedException { final List<Future<RecordMetadata>> sendResults = batch.stream() .map(producer::send) .collect(Collectors.toList()); final ImmutableList.Builder<ProducerRecord<DivolteIdentifier, AvroRecordBuffer>> remaining = ImmutableList.builder(); final int batchSize = batch.size(); for (int i = 0; i < batchSize; ++i) { final Future<RecordMetadata> result = sendResults.get(i); try { final RecordMetadata metadata = result.get(); if (logger.isTraceEnabled()) { final ProducerRecord<DivolteIdentifier, AvroRecordBuffer> record = batch.get(i); logger.trace("Finished sending event (partyId={}) to Kafka: topic/partition/offset = {}/{}/{}", record.value(), metadata.topic(), metadata.partition(), metadata.offset()); } } catch (final ExecutionException e) { final Throwable cause = e.getCause(); final ProducerRecord<DivolteIdentifier, AvroRecordBuffer> record = batch.get(i); if (cause instanceof RetriableException) { if (logger.isDebugEnabled()) { logger.debug("Transient error sending event (partyId=" + record.key() + ") to Kafka. Will retry.", cause); } remaining.add(record); } else { logger.error("Error sending event (partyId=" + record.key() + ") to Kafka. Abandoning batch.", cause); } } } return remaining.build(); }

Target:
private ImmutableList<ProducerRecord<DivolteIdentifier,AvroRecordBuffer>> sendBatch(final List<ProducerRecord<DivolteIdentifier, AvroRecordBuffer>> batch) throws InterruptedException { final List<Future<RecordMetadata>> sendResults = batch.stream() .map(producer::send) .collect(Collectors.toList()); final ImmutableList.Builder<ProducerRecord<DivolteIdentifier, AvroRecordBuffer>> remaining = ImmutableList.builder(); final int batchSize = batch.size(); for (int i = 0; i < batchSize; ++i) { final Future<RecordMetadata> result = sendResults.get(i); try { final RecordMetadata metadata = result.get(); if (logger.isDebugEnabled()) { final ProducerRecord<DivolteIdentifier, AvroRecordBuffer> record = batch.get(i); logger.debug("Finished sending event (partyId={}) to Kafka: topic/partition/offset = {}/{}/{}", record.value(), metadata.topic(), metadata.partition(), metadata.offset()); } } catch (final ExecutionException e) { final Throwable cause = e.getCause(); final ProducerRecord<DivolteIdentifier, AvroRecordBuffer> record = batch.get(i); if (cause instanceof RetriableException) { if (logger.isDebugEnabled()) { logger.debug("Transient error sending event (partyId=" + record.key() + ") to Kafka. Will retry.", cause); } remaining.add(record); } else { logger.error("Error sending event (partyId=" + record.key() + ") to Kafka. Abandoning batch.", cause); } } } return remaining.build(); }
Source:
public Element build(final CallbackProperties properties) throws SAMLAssertionBuilderException { LOG.debug("SamlCallbackHandler.createHOKSAMLAssertion20()"); Element signedAssertion = null; try { Assertion assertion; assertion = OpenSAML2ComponentBuilder.getInstance().createAssertion(); final String aID = createAssertionId(); LOG.debug("Assertion ID: {}", aID); assertion.setID(aID); final DateTime issueInstant = new DateTime(); assertion.setIssueInstant(issueInstant); assertion.setIssuer(createIssuer(properties)); final X509Certificate certificate = certificateManager.getDefaultCertificate(); final PublicKey publicKey = certificateManager.getDefaultPublicKey(); final Subject subject = createSubject(properties, certificate, publicKey); assertion.setSubject(subject); final Subject evidenceSubject = createEvidenceSubject(properties, certificate, publicKey); assertion.getStatements().addAll(createAttributeStatements(properties, evidenceSubject)); final PrivateKey privateKey = certificateManager.getDefaultPrivateKey(); signedAssertion = sign(assertion, certificate, privateKey, publicKey); } catch (final SAMLAssertionBuilderException ex) { LOG.error("Unable to create HOK Assertion: {}", ex.getLocalizedMessage()); throw ex; } catch (final Exception ex) { LOG.error("Unable to create HOK Assertion: {}", ex.getLocalizedMessage()); } LOG.debug("SamlCallbackHandler.createHOKSAMLAssertion20() -- End"); return signedAssertion; }

Target:
public Element build(final CallbackProperties properties) throws SAMLAssertionBuilderException { LOG.debug("SamlCallbackHandler.createHOKSAMLAssertion20()"); Element signedAssertion = null; try { Assertion assertion; assertion = OpenSAML2ComponentBuilder.getInstance().createAssertion(); final String aID = createAssertionId(); LOG.debug("Assertion ID: {}", aID); assertion.setID(aID); final DateTime issueInstant = new DateTime(); assertion.setIssueInstant(issueInstant); assertion.setIssuer(createIssuer(properties)); final X509Certificate certificate = certificateManager.getDefaultCertificate(); final PublicKey publicKey = certificateManager.getDefaultPublicKey(); final Subject subject = createSubject(properties, certificate, publicKey); assertion.setSubject(subject); final Subject evidenceSubject = createEvidenceSubject(properties, certificate, publicKey); assertion.getStatements().addAll(createAttributeStatements(properties, evidenceSubject)); final PrivateKey privateKey = certificateManager.getDefaultPrivateKey(); signedAssertion = sign(assertion, certificate, privateKey, publicKey); } catch (final SAMLComponentBuilderException ex) { LOG.error("Unable to create HOK Assertion: {}", ex.getLocalizedMessage()); throw new SAMLAssertionBuilderException(ex.getLocalizedMessage(), ex); } catch (final CertificateManagerException ex) { LOG.error("Unable to create HOK Assertion: {}", ex.getLocalizedMessage()); throw new SAMLAssertionBuilderException(ex.getLocalizedMessage(), ex); } LOG.debug("SamlCallbackHandler.createHOKSAMLAssertion20() -- End"); return signedAssertion; }
Source:
public GroupRest getAdminGroup(@Nullable HttpServletRequest request, UUID collectionId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Collection collection = collectionService.find(context, collectionId); if (collection == null) { throw new ResourceNotFoundException("No such collection: " + collectionId); } Group administrators = collection.getAdministrators(); if (!authorizeService.isAdmin(context) && !authorizeService.authorizeActionBoolean(context, collection, Constants.ADMIN, true)) { throw new AccessDeniedException("The current user was not allowed to retrieve the AdminGroup for" + " collection: " + collectionId); } if (administrators == null) { return null; } return converter.toRest(administrators, projection); } catch (SQLException e) { throw new RuntimeException(e); } }

Target:
public GroupRest getAdminGroup(@Nullable HttpServletRequest request, UUID collectionId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Collection collection = collectionService.find(context, collectionId); if (collection == null) { throw new ResourceNotFoundException("No such collection: " + collectionId); } try { AuthorizeUtil.authorizeManageAdminGroup(context, collection); } catch (AuthorizeException e) { throw new AccessDeniedException("The current user was not allowed to retrieve the AdminGroup for" + " collection: " + collectionId); } Group administrators = collection.getAdministrators(); if (administrators == null) { return null; } return converter.toRest(administrators, projection); } catch (SQLException e) { throw new RuntimeException(e); } }
Source:
private void refreshClusterHeavyWeightData(VDSGroup cluster) { VDS upServer = getClusterUtils().getRandomUpServer(cluster.getId()); if (upServer == null) { log.debug("No server UP in cluster '{}'. Can't refresh it's data at this point.", cluster.getName()); return; } for (GlusterVolumeEntity volume : getVolumeDao().getByClusterId(cluster.getId())) { log.debug("Refreshing brick statuses for volume '{}' of cluster '{}'", volume.getName(), cluster.getName()); if (volume.isOnline()) { acquireLock(cluster.getId()); try { refreshVolumeDetails(upServer, volume); } catch (Exception e) { log.error("Error while refreshing brick statuses for volume '{}' of cluster '{}': {}", volume.getName(), cluster.getName(), e.getMessage()); log.debug("Exception", e); } finally { releaseLock(cluster.getId()); } runVdsCommand(VDSCommandType.OverrideGlusterVolumeSnapshotSchedule, new GlusterVolumeActionVDSParameters(upServer.getId(), volume.getName(), false)); } } }

Target:
private void refreshClusterHeavyWeightData(VDSGroup cluster) { VDS upServer = getClusterUtils().getRandomUpServer(cluster.getId()); if (upServer == null) { log.debug("No server UP in cluster '{}'. Can't refresh it's data at this point.", cluster.getName()); return; } for (GlusterVolumeEntity volume : getVolumeDao().getByClusterId(cluster.getId())) { log.debug("Refreshing brick statuses for volume '{}' of cluster '{}'", volume.getName(), cluster.getName()); if (volume.isOnline()) { acquireLock(cluster.getId()); try { refreshVolumeDetails(upServer, volume); } catch (Exception e) { log.error("Error while refreshing brick statuses for volume '{}' of cluster '{}': {}", volume.getName(), cluster.getName(), e.getMessage()); log.debug("Exception", e); } finally { releaseLock(cluster.getId()); } } } }