auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (courseData == null || !isCoursewareAccessible) return; final String headerImageUrl = courseData.getCourse().getCourse_image(environment.getConfig()); Glide.with(CourseDashboardFragment.this) .load(headerImageUrl) .placeholder(R.drawable.edx_map_login) .transform(new TopAnchorFillWidthTransformation(getActivity())) .into(headerImageView); courseTextName.setText(courseData.getCourse().getName()); CourseEntry course = courseData.getCourse(); courseTextDetails.setText(course.getDescription(getActivity(), true)); shareButton.setBackgroundResource(R.drawable.android_share); shareButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openShareMenu(); } }); }

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (courseData == null || !isCoursewareAccessible) return; final String headerImageUrl = courseData.getCourse().getCourse_image(environment.getConfig()); Glide.with(CourseDashboardFragment.this) .load(headerImageUrl) .placeholder(R.drawable.edx_map_login) .transform(new TopAnchorFillWidthTransformation(getActivity())) .into(headerImageView); courseTextName.setText(courseData.getCourse().getName()); CourseEntry course = courseData.getCourse(); courseTextDetails.setText(course.getDescription(getActivity(), true)); if (environment.getConfig().isShareCourseEnabled()) { shareButton.setVisibility(headerImageView.VISIBLE); shareButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openShareMenu(); } }); } }
Source:
public void preConnect( HttpURLConnection connection, @Nullable SimpleRequestEntity requestEntity) { mConnection = connection; if (isStethoEnabled()) { mInspectorRequest = new URLConnectionInspectorRequest( getStethoRequestId(), mFriendlyName, connection, requestEntity); mStethoHook.requestWillBeSent(mInspectorRequest); } }

Target:
public void preConnect( HttpURLConnection connection, @Nullable SimpleRequestEntity requestEntity) { throwIfConnection(); mConnection = connection; if (isStethoEnabled()) { mInspectorRequest = new URLConnectionInspectorRequest( getStethoRequestId(), mFriendlyName, connection, requestEntity); mStethoHook.requestWillBeSent(mInspectorRequest); } }
Source:
public void enableErasureCodingPolicy(String ecPolicyName) throws IOException { if (this.vfs == null) { super.enableErasureCodingPolicy(ecPolicyName); return; } defaultDFS.enableErasureCodingPolicy(ecPolicyName); }

Target:
public void enableErasureCodingPolicy(String ecPolicyName) throws IOException { if (this.vfs == null) { super.enableErasureCodingPolicy(ecPolicyName); return; } List<IOException> failedExceptions = new ArrayList<>(); boolean isDFSExistsInChilds = false; for (FileSystem fs : getChildFileSystems()) { if (!(fs instanceof DistributedFileSystem)) { continue; } isDFSExistsInChilds = true; DistributedFileSystem dfs = (DistributedFileSystem) fs; try { dfs.enableErasureCodingPolicy(ecPolicyName); } catch (IOException ioe) { failedExceptions.add(ioe); } } if (!isDFSExistsInChilds) { throw new UnsupportedOperationException( "No DFS available in child file systems."); } if (failedExceptions.size() > 0) { throw MultipleIOException.createIOException(failedExceptions); } }
Source:
private void loadProject(ResultSet rs, ProjectConfig config) throws SQLException, OrmException { config.getProject().setDescription(rs.getString("description")); config.getProject().setUseContributorAgreements( "Y".equals(rs.getString("use_contributor_agreements"))); final char submitType = rs.getString("submit_type").charAt(0); boolean removeSubmitType = false; final String name = rs.getString("name"); if (!name.equals("-- All Projects --") && submitType == 'M') { removeSubmitType = true; } if (!removeSubmitType) { final MergeStrategySection section = config.getMergeStrategySection("refs/*", true); switch (submitType) { case 'F': section .setSubmitType(MergeStrategySection.SubmitType.FAST_FORWARD_ONLY); break; case 'M': section .setSubmitType(MergeStrategySection.SubmitType.MERGE_IF_NECESSARY); break; case 'A': section.setSubmitType(MergeStrategySection.SubmitType.MERGE_ALWAYS); break; case 'C': section.setSubmitType(MergeStrategySection.SubmitType.CHERRY_PICK); break; default: throw new OrmException("Unsupported submit_type=" + rs.getString("submit_type") + " on project " + config.getProject().getName()); } } config.getProject().setUseSignedOffBy("Y".equals(rs.getString("use_signed_off_by"))); config.getProject().setRequireChangeID("Y".equals(rs.getString("require_change_id"))); config.getProject().setUseContentMerge("Y".equals(rs.getString("use_content_merge"))); config.getProject().setParentName(rs.getString("parent_name")); }

Target:
private void loadProject(ResultSet rs, ProjectConfig config) throws SQLException, OrmException { final Project project = config.getProject(); project.setDescription(rs.getString("description")); project.setUseContributorAgreements("Y".equals(rs .getString("use_contributor_agreements"))); final char submitType = rs.getString("submit_type").charAt(0); final String name = rs.getString("name"); if (!(!name.equals("-- All Projects --") && submitType == 'M')) { final MergeStrategySection section = config.getMergeStrategySection("refs/*", true); switch (submitType) { case 'F': section .setSubmitType(MergeStrategySection.SubmitType.FAST_FORWARD_ONLY); break; case 'M': section .setSubmitType(MergeStrategySection.SubmitType.MERGE_IF_NECESSARY); break; case 'A': section.setSubmitType(MergeStrategySection.SubmitType.MERGE_ALWAYS); break; case 'C': section.setSubmitType(MergeStrategySection.SubmitType.CHERRY_PICK); break; default: throw new OrmException("Unsupported submit_type=" + rs.getString("submit_type") + " on project " + project.getName()); } section.setUseContentMerge("Y".equals(rs.getString("use_content_merge"))); } project.setUseSignedOffBy("Y".equals(rs.getString("use_signed_off_by"))); project.setRequireChangeID("Y".equals(rs.getString("require_change_id"))); project.setParentName(rs.getString("parent_name")); }
Source:
public void signal(SignalPayload signalPayload) { runtimeService.signalEventReceived(signalPayload.getName(), signalPayload.getVariables()); eventPublisher.publishEvent(signalPayload); }

Target:
public void signal(SignalPayload signalPayload) { eventPublisher.publishEvent(signalPayload); }
Source:
private void cancelNameNodeToken(final Token<? extends TokenIdentifier> t, String userToProxy) throws HadoopSecurityManagerException { try { getProxiedUser(userToProxy).doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { cancelToken(t); return null; } private void cancelToken(Token<?> nt) throws IOException, InterruptedException { nt.cancel(conf); } }); } catch (Exception e) { e.printStackTrace(); throw new HadoopSecurityManagerException("Failed to cancel Token. " + e.getMessage() + e.getCause()); } }

Target:
private void cancelNameNodeToken(final Token<? extends TokenIdentifier> t, String userToProxy) throws HadoopSecurityManagerException { try { getProxiedUser(userToProxy).doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { cancelToken(t); return null; } private void cancelToken(Token<?> nt) throws IOException, InterruptedException { nt.cancel(conf); } }); } catch (Exception e) { throw new HadoopSecurityManagerException("Failed to cancel token. " + e.getMessage() + e.getCause(), e); } }
Source:
public static Map<String, Integer> getScreenSizeMap(Context context) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); int orientation = context.getResources().getConfiguration().orientation; HashMap<String, Integer> screenMap = new HashMap<>(); switch (orientation) { case 1: screenMap.put("height", metrics.heightPixels); screenMap.put("width", metrics.widthPixels); break; case 2: screenMap.put("height", metrics.widthPixels); screenMap.put("width", metrics.heightPixels); } return screenMap; }

Target:
public static Map<String, Integer> getScreenSizeMap(Context context) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); int orientation = context.getResources().getConfiguration().orientation; HashMap<String, Integer> screenMap = new HashMap<>(); switch (orientation) { case Configuration.ORIENTATION_PORTRAIT: screenMap.put("height", metrics.heightPixels); screenMap.put("width", metrics.widthPixels); break; case Configuration.ORIENTATION_LANDSCAPE: screenMap.put("height", metrics.widthPixels); screenMap.put("width", metrics.heightPixels); break; } return screenMap; }
Source:
public void testSingleToken() throws Exception { Grammar.NonTerminalId ntistart = new Grammar.NonTerminalId("StartNT"); Grammar.StateId stistart = new Grammar.StateId("StartState"); Grammar.StateId stiend = new Grammar.StateId("EndState"); Grammar.NonTerminal nt1 = new Grammar.NonTerminal(ntistart, stistart, new Grammar.State.OrderingInfo(0), stiend, new Grammar.State.OrderingInfo(100)); Grammar.RegExState res = new Grammar.RegExState(new Grammar.StateId("RegExStid"), nt1, new Grammar.State.OrderingInfo(1), Pattern.compile("[a-zA-Z0-9]+"), null); nt1.entryState.next.add(res); res.next.add(nt1.exitState); ParseState ps = new ParseState("asdfAAA1"); Parser parser = new Parser(ps); Term result = parser.parse(nt1, 0); Term expected = amb(klist(amb(klist(Token.kAppOf("K", "asdfAAA1"))))); assertEquals("Single Token check: ", expected, result); }

Target:
public void testSingleToken() throws Exception { Grammar.NonTerminalId ntistart = new Grammar.NonTerminalId("StartNT"); Grammar.StateId stistart = new Grammar.StateId("StartState"); Grammar.StateId stiend = new Grammar.StateId("EndState"); Grammar.NonTerminal nt1 = new Grammar.NonTerminal(ntistart, stistart, new Grammar.State.OrderingInfo(0), stiend, new Grammar.State.OrderingInfo(100)); Grammar.RegExState res = new Grammar.RegExState(new Grammar.StateId("RegExStid"), nt1, new Grammar.State.OrderingInfo(1), Pattern.compile("[a-zA-Z0-9]+"), null); nt1.entryState.next.add(res); res.next.add(nt1.exitState); ParseState ps = new ParseState("asdfAAA1"); Parser parser = new Parser(ps); Term result = parser.parse(nt1, 0); Term expected = amb(klist(amb(klist(Token.kAppOf(KSorts.K, "asdfAAA1"))))); Assert.assertEquals("Single Token check: ", expected, result); Assert.assertEquals("Expected Nullable NTs", 2, NullabilityCheck.getReachableNullableStates(nt1).size()); }
Source:
public KieServerConnectionInfo verifiedConnectionInfo(RemoteDataSetDef def) { String name = def.getName(); String serverTemplateId = def.getServerTemplateId(); String missingConfigError = String.format(CONFIGURATION_NOT_FOUND_MESSAGE, name, serverTemplateId); String missingUrlError = String.format(MISSING_URL_MESSAGE, name, serverTemplateId); String missingAuthError = String.format(MISSING_AUTH_MESSAGE, name, serverTemplateId); KieServerConnectionInfo connectionInfo = get(name, serverTemplateId).orElseThrow(() -> new RuntimeException(missingConfigError)); if (!connectionInfo.getLocation().isPresent()) { throw new RuntimeException(missingUrlError); } if ((!connectionInfo.getUser().isPresent()) && (!connectionInfo.getToken().isPresent())) { throw new RuntimeException(missingAuthError); } return connectionInfo; }

Target:
public KieServerConnectionInfo verifiedConnectionInfo(RemoteDataSetDef def) { String name = def.getName(); String serverTemplateId = def.getServerTemplateId(); String missingConfigError = String.format(CONFIGURATION_NOT_FOUND_MESSAGE, name, serverTemplateId); String missingUrlError = String.format(MISSING_URL_MESSAGE, name, serverTemplateId); String missingAuthError = String.format(MISSING_AUTH_MESSAGE, name, serverTemplateId); KieServerConnectionInfo connectionInfo = get(name, serverTemplateId).orElseThrow(() -> new RuntimeException(missingConfigError)); if (!connectionInfo.getLocation().isPresent()) { throw new RuntimeException(missingUrlError); } if (!connectionInfo.getUser().isPresent() && !connectionInfo.getToken().isPresent()) { throw new RuntimeException(missingAuthError); } return connectionInfo; }
Source:
PRED_current_user_1(Term a1, Operation n) { arg1 = a1; cont = n; }

Target:
public PRED_current_user_1(Term a1, Operation n) { arg1 = a1; cont = n; }
Source:
private void setPluginConfigValues(ProjectConfig projectConfig, Map<String, Map<String, String>> pluginConfigValues) throws BadRequestException { for (Entry<String, Map<String, String>> e : pluginConfigValues.entrySet()) { String pluginName = e.getKey(); PluginConfig cfg = projectConfig.getPluginConfig(pluginName); for (Entry<String, String> v : e.getValue().entrySet()) { ProjectConfigEntry projectConfigEntry = pluginConfigEntries.get(pluginName, v.getKey()); if (projectConfigEntry != null) { if (!isValidParameterName(v.getKey())) { log.warn(String.format( "Parameter name '%s' must match '^[a-zA-Z0-9]+[a-zA-Z0-9-]*$'", v.getKey())); continue; } if (v.getValue() == null) { cfg.unset(v.getKey()); } else { cfg.setString(v.getKey(), v.getValue()); } } else { throw new BadRequestException(String.format( "The config parameter '%s' of plugin '%s' does not exist.", v.getKey(), pluginName)); } } } }

Target:
private void setPluginConfigValues(ProjectConfig projectConfig, Map<String, Map<String, String>> pluginConfigValues) throws BadRequestException { for (Entry<String, Map<String, String>> e : pluginConfigValues.entrySet()) { String pluginName = e.getKey(); PluginConfig cfg = projectConfig.getPluginConfig(pluginName); for (Entry<String, String> v : e.getValue().entrySet()) { ProjectConfigEntry projectConfigEntry = pluginConfigEntries.get(pluginName, v.getKey()); if (projectConfigEntry != null) { if (!isValidParameterName(v.getKey())) { log.warn(String.format( "Parameter name '%s' must match '^[a-zA-Z0-9]+[a-zA-Z0-9-]*$'", v.getKey())); continue; } if (v.getValue() != null) { cfg.setString(v.getKey(), v.getValue()); } else { cfg.unset(v.getKey()); } } else { throw new BadRequestException(String.format( "The config parameter '%s' of plugin '%s' does not exist.", v.getKey(), pluginName)); } } } }
Source:
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { FilterCreaturePermanent filter = StaticFilters.FILTER_PERMANENT_CREATURE.copy(); filter.add(new ControllerIdPredicate(source.getControllerId())); game.addPowerInsteadOfToughnessForDamageLethalityFilter(source.getSourceId(), filter); return true; }

Target:
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { FilterCreaturePermanent filter = StaticFilters.FILTER_PERMANENT_CREATURE.copy(); filter.add(new ControllerIdPredicate(source.getControllerId())); game.getState().addPowerInsteadOfToughnessForDamageLethalityFilter(source.getSourceId(), filter); return true; }
Source:
public String toString() { return "DiscoverSpringRestnnotatedClasses"; }

Target:
public String toString() { return "DiscoverSpringRestServicesRuleProvider"; }
Source:
public void run() { final QueuedRequest firstRequest = messageStore.retrieveFirst(endpoint); if (firstRequest != null) { try { final DownlinkRequest<LwM2mResponse> downlinkRequest = firstRequest.getDownlinkRequest(); LOG.debug("Sending request: {}", downlinkRequest); final Client client = clientRegistry.get(firstRequest.getEndpoint()); if (client == null) { LOG.debug("Client not registered anymore: {}", firstRequest.getEndpoint(), downlinkRequest); } else { requestSender.send(client, downlinkRequest, new ResponseCallback<LwM2mResponse>() { @Override public void onResponse(LwM2mResponse response) { LOG.debug("request sent successfully: {}", downlinkRequest); processResponse(firstRequest, response); } }, new ErrorCallback() { @Override public void onError(Exception e) { LOG.debug("exception on sending the request: {}", downlinkRequest, e); if (e instanceof TimeoutException) { timeout(client); } else { processException(firstRequest, e); } } }); } } catch (RuntimeException e) { processException(firstRequest, e); } } else { LOG.debug("No more requests to send to client {}", endpoint); clientStatusTracker.stopClientReceiving(endpoint); } }

Target:
public void run() { try { executeAction(); } catch (Exception e) { LOG.info("error while executing runnable", e); throw new RuntimeException(e); } }
Source:
public R get() { R entry = queue.poll(); if (entry == null) { if (completed.get()) { if (exception != null) { throw exception; } else if ((entry = queue.poll()) != null) { if (consumer != null) { consumer.accept(entry); } return entry; } return null; } nextLock.lock(); try { boolean interrupted = false; while ((entry = queue.poll()) == null && !completed.get() && (entry = queue.poll()) == null) { try { nextCondition.await(100, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { interrupted = true; } } if (entry == null) { if (exception != null) { throw exception; } return null; } else if (interrupted) { Thread.currentThread().interrupt(); } } finally { nextLock.unlock(); } } if (consumer != null && entry != null) { consumer.accept(entry); } return entry; }

Target:
public R get() { R entry = queue.poll(); if (entry == null) { if (completed.get()) { if (exception != null) { throw exception; } else if ((entry = queue.poll()) != null) { if (consumer != null) { consumer.accept(entry); } return entry; } return null; } nextLock.lock(); try { boolean interrupted = false; while (!completed.get()) { if ((entry = queue.poll()) != null) { break; } try { nextCondition.await(100, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { interrupted = true; } } if (entry == null) { entry = queue.poll(); if (entry == null) { if (exception != null) { throw exception; } return null; } } else if (interrupted) { Thread.currentThread().interrupt(); } } finally { nextLock.unlock(); } } if (consumer != null && entry != null) { consumer.accept(entry); } return entry; }
Source:
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<Cell> results) throws IOException { Transaction tx = getFromOperation(get); if (tx != null) { projectFamilyDeletes(get); get.setMaxVersions(); get.setTimeRange(0, TxUtils.getMaxVisibleTimestamp(tx)); Filter newFilter = Filters.combine(getTransactionFilter(tx, ScanType.USER_SCAN), get.getFilter()); get.setFilter(newFilter); } }

Target:
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<Cell> results) throws IOException { Transaction tx = getFromOperation(get); if (tx != null) { projectFamilyDeletes(get); get.setMaxVersions(); get.setTimeRange(TxUtils.getOldestVisibleTimestamp(ttlByFamily, tx, readNonTxnData), TxUtils.getMaxVisibleTimestamp(tx)); Filter newFilter = Filters.combine(getTransactionFilter(tx, ScanType.USER_SCAN), get.getFilter()); get.setFilter(newFilter); } }
Source:
private ClassLoader loadBundlesJars(OSGiBundleConfig bundleConfig) { String bundlesJarsPath = bundleConfig.getBundlesJarsPath(); if (bundlesJarsPath == null) { return getClassLoader(); } JarClassLoader jcl = new JarClassLoader(); jcl.add(bundlesJarsPath + "/"); return new OSGiClassLoader(jcl, getClassLoader()); }

Target:
private ClassLoader loadBundlesJars(OSGiBundleConfig bundleConfig) { String bundlesJarsPath = bundleConfig.getBundlesJarsPath(); if (bundlesJarsPath == null) { return getPlatformClassLoader(); } JarClassLoader jcl = new JarClassLoader(); jcl.add(bundlesJarsPath + "/"); return new OSGiClassLoader(jcl, getPlatformClassLoader()); }
Source:
public ChargeEntityFixture withWalletType(WalletType walletType) { WalletType walletType1 = walletType; return this; }

Target:
public ChargeEntityFixture withWalletType(WalletType walletType) { this.walletType = walletType; return this; }
Source:
public Rules rules() { try { return new RestRules( URI.create( new JdkRequest(UriBuilder.fromUri(this.home).build()) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .assertXPath("/page/links/link[@rel='rules']") .xml() .xpath("/page/links/link[@rel='rules']/@href") .get(0) ), this.token ); } catch (IOException ex) { throw new IllegalStateException(ex); } }

Target:
public Rules rules() { try { return new RestRules( URI.create( new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .assertXPath("/page/links/link[@rel='rules']") .xml() .xpath("/page/links/link[@rel='rules']/@href") .get(0) ), this.token ); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
public HandleResolver() { handleResolvers.put(REMOTE_CONNECTOR_ID.toString(), new MaterializedHandleResolver(new RemoteHandleResolver())); handleResolvers.put("$system", new MaterializedHandleResolver(new SystemHandleResolver())); handleResolvers.put("$info_schema", new MaterializedHandleResolver(new InformationSchemaHandleResolver())); handleResolvers.put("$empty", new MaterializedHandleResolver(new EmptySplitHandleResolver())); functionHandleResolvers.put("static", new MaterializedFunctionHandleResolver(new StaticFunctionNamespaceHandleResolver())); }

Target:
public HandleResolver() { handleResolvers.put(REMOTE_CONNECTOR_ID.toString(), new MaterializedHandleResolver(new RemoteHandleResolver())); handleResolvers.put("$system", new MaterializedHandleResolver(new SystemHandleResolver())); handleResolvers.put("$info_schema", new MaterializedHandleResolver(new InformationSchemaHandleResolver())); handleResolvers.put("$empty", new MaterializedHandleResolver(new EmptySplitHandleResolver())); functionHandleResolvers.put("$static", new MaterializedFunctionHandleResolver(new StaticFunctionNamespaceHandleResolver())); }
Source:
public String getNoTargetLabelContent(){ SelectionTarget target = this.model.getSelectionTarget(); switch(target){ case TASK_TARGET: return "No task selected"; case JOB_TARGET: return "No job selected"; default: return ""; } }

Target:
public String getNoTargetLabelContent(){ SelectionTarget target = this.model.getSelectionTarget(); return target.noSelectionLabel; }
Source:
public void testWhenAnyFirstError() { final Exception error = new RuntimeException("This task failed."); runTaskTest(new Callable<Task<?>>() { @Override public Task<?> call() throws Exception { final ArrayList<Task<Void>> tasks = new ArrayList<Task<Void>>(); final Task<Void> firstToCompleteError = Task.callInBackground(new Callable<Void>() { @Override public Void call() throws Exception { Thread.sleep(50); throw error; } }); tasks.addAll(launchTasksWithRandomCompletions(10)); tasks.add(firstToCompleteError); return Task.whenAny(tasks).continueWith(new Continuation<Task<?>, Object>() { @Override public Object then(Task<Task<?>> task) throws Exception { assertTrue(task.isCompleted()); assertFalse(task.isFaulted()); assertFalse(task.isCancelled()); assertEquals(task.getResult(), firstToCompleteError); assertTrue(task.getResult().isCompleted()); assertFalse(task.getResult().isCancelled()); assertTrue(task.getResult().isFaulted()); return null; } }); } }); }

Target:
public void testWhenAnyFirstError() { final Exception error = new RuntimeException("This task failed."); runTaskTest(new Callable<Task<?>>() { @Override public Task<?> call() throws Exception { final ArrayList<Task<?>> tasks = new ArrayList<>(); final Task<String> firstToCompleteError = Task.callInBackground(new Callable<String>() { @Override public String call() throws Exception { Thread.sleep(50); throw error; } }); tasks.addAll(launchTasksWithRandomCompletions(5)); tasks.add(firstToCompleteError); tasks.addAll(launchTasksWithRandomCompletions(5)); return Task.whenAny(tasks).continueWith(new Continuation<Task<?>, Object>() { @Override public Object then(Task<Task<?>> task) throws Exception { assertTrue(task.isCompleted()); assertFalse(task.isFaulted()); assertFalse(task.isCancelled()); assertEquals(firstToCompleteError, task.getResult()); assertTrue(task.getResult().isCompleted()); assertFalse(task.getResult().isCancelled()); assertTrue(task.getResult().isFaulted()); assertEquals(error, task.getResult().getError()); return null; } }); } }); }
Source:
public boolean tryLock(long timeValue, TimeUnit timeUnit, Object owner) { synchronized (this.lock) { if (owner.equals(this.owner)) { lockCount++; return true; } else if (this.owner == null) { this.owner = owner; lockCount ++; return true; } else { long endTime = System.currentTimeMillis() + timeUnit.toMillis(timeValue); while (this.owner != null && System.currentTimeMillis() < endTime) { try { waiters++; try { lock.wait(endTime - System.currentTimeMillis()); } finally { waiters--; } } catch (InterruptedException e) { throw new RuntimeException(e); } } if(this.owner == null) { this.owner = owner; lockCount++; return true; } else { return false; } } } }

Target:
public boolean tryLock(long timeValue, TimeUnit timeUnit, Object owner) { Assert.checkNotNullParam("owner", owner); synchronized (this.lock) { if (Objects.equals(owner, this.owner)) { lockCount++; return true; } else if (this.owner == null) { this.owner = owner; lockCount ++; return true; } else { long endTime = System.currentTimeMillis() + timeUnit.toMillis(timeValue); while (this.owner != null && System.currentTimeMillis() < endTime) { try { waiters++; try { lock.wait(endTime - System.currentTimeMillis()); } finally { waiters--; } } catch (InterruptedException e) { throw new RuntimeException(e); } } if(this.owner == null) { this.owner = owner; lockCount++; return true; } else { return false; } } } }
Source:
public void testUsingIteratorButPartitionOccursAfterRetrievingRemoteValues() throws InterruptedException, TimeoutException, ExecutionException { Cache<MagicKey, String> cache0 = cache(0); cache0.put(new MagicKey(cache(1), cache(2)), "not-local"); cache0.put(new MagicKey(cache(0), cache(1)), "local"); CheckPoint iteratorCP = new CheckPoint(); iteratorCP.triggerForever(Mocks.BEFORE_RELEASE); iteratorCP.triggerForever(Mocks.AFTER_RELEASE); blockUntilPublisherComplete(iteratorCP, cache0); try (CloseableIterator<?> iterator = Closeables.iterator(cache0.entrySet().stream())) { assertTrue(iterator.hasNext()); iteratorCP.awaitStrict(Mocks.AFTER_INVOCATION, 10, TimeUnit.SECONDS); CheckPoint partitionCP = new CheckPoint(); blockNotifierPartitionStatusChanged(partitionCP, cache0); splitCluster(new int[]{0, 1}, new int[]{2, 3}); partitionCP.triggerForever(Mocks.BEFORE_RELEASE); partitionCP.triggerForever(Mocks.AFTER_RELEASE); while (iterator.hasNext()) { iterator.next(); } } }

Target:
public void testUsingIteratorButPartitionOccursAfterRetrievingRemoteValues() throws InterruptedException, TimeoutException, ExecutionException { Cache<MagicKey, String> cache0 = cache(0); cache0.put(new MagicKey(cache(1), cache(2)), "not-local"); cache0.put(new MagicKey(cache(0), cache(1)), "local"); CheckPoint iteratorCP = new CheckPoint(); registerBlockingPublisher(iteratorCP, cache0); iteratorCP.triggerForever(Mocks.BEFORE_RELEASE); iteratorCP.triggerForever(Mocks.AFTER_RELEASE); try (CloseableIterator<?> iterator = Closeables.iterator(cache0.entrySet().stream())) { assertTrue(iterator.hasNext()); iteratorCP.awaitStrict(Mocks.AFTER_INVOCATION, 10, TimeUnit.SECONDS); CheckPoint partitionCP = new CheckPoint(); registerBlockingCacheNotifierOnDegradedMode(partitionCP, cache0); splitCluster(new int[]{0, 1}, new int[]{2, 3}); partitionCP.triggerForever(Mocks.BEFORE_RELEASE); partitionCP.triggerForever(Mocks.AFTER_RELEASE); while (iterator.hasNext()) { iterator.next(); } } }
Source:
public static StoragePool map(DataCenter model, StoragePool template) { StoragePool entity = template != null ? template : new StoragePool(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setdescription(model.getDescription()); } if (model.isSetComment()) { entity.setComment(model.getComment()); } if (model.isSetLocal()) { entity.setIsLocal(model.isLocal()); } if (model.isSetStorageFormat()) { entity.setStoragePoolFormatType(StorageFormatMapper.map(model.getStorageFormat(), null)); } if (model.isSetVersion() && model.getVersion().getMajor() != null && model.getVersion().getMinor() != null) { entity.setCompatibilityVersion(VersionMapper.map(model.getVersion())); } if (model.isSetMacPool()) { MacPool macPool = model.getMacPool(); if (macPool.isSetId()) { entity.setMacPoolId(GuidUtils.asGuid(macPool.getId())); } else if (macPool.isSetName()) { entity.setMacPoolId(null); } } if (model.isSetQuotaMode()) { entity.setQuotaEnforcementType(map(model.getQuotaMode())); } return entity; }

Target:
public static StoragePool map(DataCenter model, StoragePool template) { StoragePool entity = template != null ? template : new StoragePool(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setdescription(model.getDescription()); } if (model.isSetComment()) { entity.setComment(model.getComment()); } if (model.isSetLocal()) { entity.setIsLocal(model.isLocal()); } if (model.isSetStorageFormat()) { entity.setStoragePoolFormatType(StorageFormatMapper.map(model.getStorageFormat(), null)); } if (model.isSetVersion() && model.getVersion().getMajor() != null && model.getVersion().getMinor() != null) { entity.setCompatibilityVersion(VersionMapper.map(model.getVersion())); } if (model.isSetMacPool() && model.getMacPool().isSetId()) { entity.setMacPoolId(GuidUtils.asGuid(model.getMacPool().getId())); } if (model.isSetQuotaMode()) { entity.setQuotaEnforcementType(map(model.getQuotaMode())); } return entity; }
Source:
protected int parseInt(String fieldName) { JsonNode field = getJson().findValue(fieldName); if (field == null || field.isNull()) { return 0; } return field.asInt(); }

Target:
protected int parseInt(String fieldName) { JsonNode field = getJson().get(fieldName); if (field == null || field.isNull()) { return 0; } return field.asInt(); }
Source:
private DemoAdapter() { for (int i = 0; i < 80; i++) { mItems.add(getItemText(i)); } }

Target:
private DemoAdapter() { for (int i = 0; i < sSize; i++) { mItems.add("Item " + i); } }
Source:
WorkerErrantRecordReporter workerErrantRecordReporter() { return workerErrantRecordReporter; }

Target:
protected WorkerErrantRecordReporter workerErrantRecordReporter() { return workerErrantRecordReporter; }
Source:
public String[] getLocations() throws IOException { }

Target:
public String[] getLocations() throws IOException { return locations; }
Source:
public DataTypeListItem getItem() { return this.item; }

Target:
public DataTypeListItem getItem() { return item; }
Source:
private void updateActionAvailability() { if (getSelectedItems() == null || getSelectedItems().size() == 0) { getEnableHookCommand().setIsExecutionAllowed(false); getDisableHookCommand().setIsExecutionAllowed(false); return; } getEnableHookCommand().setIsExecutionAllowed(true); getDisableHookCommand().setIsExecutionAllowed(true); for (Object item : getSelectedItems()) { GlusterHookEntity hook = (GlusterHookEntity) item; if (hook.getStatus() == GlusterHookStatus.ENABLED) { getEnableHookCommand().setIsExecutionAllowed(false); } else if (hook.getStatus() == GlusterHookStatus.DISABLED) { getDisableHookCommand().setIsExecutionAllowed(false); } if (!getEnableHookCommand().getIsExecutionAllowed() && !getDisableHookCommand().getIsExecutionAllowed()) { break; } } }

Target:
private void updateActionAvailability() { boolean allowEnable = true; boolean allowDisable = true; if (getSelectedItems() == null || getSelectedItems().size() == 0) { allowEnable = false; allowDisable = false; } else { for (Object item : getSelectedItems()) { GlusterHookEntity hook = (GlusterHookEntity) item; if (hook.getStatus() == GlusterHookStatus.ENABLED) { allowEnable = false; } else if (hook.getStatus() == GlusterHookStatus.DISABLED) { allowDisable = false; } if (!allowEnable && !allowDisable) { break; } } } getEnableHookCommand().setIsExecutionAllowed(allowEnable); getDisableHookCommand().setIsExecutionAllowed(allowDisable); }
Source:
private static void doAppendEscapedLiteral(Appendable sbuf, String value, boolean standardConformingStrings) throws SQLException { try { if (standardConformingStrings) { for (char ch : value.toCharArray()) { if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\'') { sbuf.append('\''); } sbuf.append(ch); } } else { for (char ch : value.toCharArray()) { if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\\' || ch == '\'') { sbuf.append(ch); } sbuf.append(ch); } } } catch (IOException e) { throw new PSQLException(GT.tr("No IOException expected from StringBuffer or StringBuilder"), PSQLState.UNEXPECTED_ERROR, e); } }

Target:
private static void doAppendEscapedLiteral(Appendable sbuf, String value, boolean standardConformingStrings) throws SQLException { try { if (standardConformingStrings) { for (int i = 0; i < value.length(); ++i) { char ch = value.charAt(i); if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\'') { sbuf.append('\''); } sbuf.append(ch); } } else { for (int i = 0; i < value.length(); ++i) { char ch = value.charAt(i); if (ch == '\0') { throw new PSQLException(GT.tr("Zero bytes may not occur in string parameters."), PSQLState.INVALID_PARAMETER_VALUE); } if (ch == '\\' || ch == '\'') { sbuf.append(ch); } sbuf.append(ch); } } } catch (IOException e) { throw new PSQLException(GT.tr("No IOException expected from StringBuffer or StringBuilder"), PSQLState.UNEXPECTED_ERROR, e); } }
Source:
public synchronized void manage(ManagedBean mBean, String name) { if (mBeanServer != null) { ManagementUtils.register(mBeanServer, mBean, mBean.getType(), name); } mbeans.put(new Key(mBean, name), mBean); }

Target:
public synchronized void manage(ManagedBean mBean, String name) { if (mBeanServer.isPresent()) { ManagementUtils.register(mBeanServer.get(), mBean, mBean.getType(), name); } mbeans.put(new Key(mBean, name), mBean); }
Source:
public void handleError(Throwable throwable, CarbonMessage carbonMessage, CarbonCallback carbonCallback) { if (carbonCallback != null) { carbonMessage .setProperty(JMSConstants.JMS_MESSAGE_DELIVERY_STATUS, JMSConstants.JMS_MESSAGE_DELIVERY_ERROR); carbonCallback.done(carbonMessage); } else { if (throwable instanceof RuntimeException) { handleError((RuntimeException) throwable); } } }

Target:
public void handleError(Throwable throwable, CarbonMessage carbonMessage, CarbonCallback carbonCallback) { if (carbonCallback != null) { carbonMessage .setProperty(JMSConstants.JMS_MESSAGE_DELIVERY_STATUS, JMSConstants.JMS_MESSAGE_DELIVERY_ERROR); carbonCallback.done(carbonMessage); } else { throw (RuntimeException) throwable; } }
Source:
public BatchingRegistryImpl() { notificationSources.switchMap( new Func1<Observable<ChangeNotification<T>>, Observable<Boolean>>() { @Override public Observable<Boolean> call(Observable<ChangeNotification<T>> notifications) { return notifications.map(new Func1<ChangeNotification<T>, Boolean>() { @Override public Boolean call(ChangeNotification<T> notification) { if (notification instanceof StreamStateNotification) { StreamStateNotification<T> stateNotification = (StreamStateNotification<T>) notification; interestsBufferingState.put(stateNotification.getInterest(), stateNotification.getBufferingState()); return true; } return null; } }).filter(new Func1<Boolean, Boolean>() { @Override public Boolean call(Boolean value) { return value != null; } }).materialize().flatMap(new Func1<Notification<Boolean>, Observable<Boolean>>() { @Override public Observable<Boolean> call(Notification<Boolean> materialized) { switch (materialized.getKind()) { case OnNext: return Observable.just(materialized.getValue()); case OnError: if (logger.isDebugEnabled()) { logger.debug("Swallowed observable error", materialized.getThrowable()); } } for(Interest<T> i: interestsBufferingState.keySet()) { interestsBufferingState.put(i, BufferingState.FinishBuffering); } return Observable.just(false); } }).doOnCompleted(new Action0() { @Override public void call() { interestsBufferingState.clear(); } }); } } ).subscribe(updatesSubject); }

Target:
public BatchingRegistryImpl() { notificationSources.switchMap( new Func1<Observable<ChangeNotification<T>>, Observable<Boolean>>() { @Override public Observable<Boolean> call(Observable<ChangeNotification<T>> notifications) { return notifications .filter(ChangeNotifications.streamStateFilter()) .map(new Func1<ChangeNotification<T>, Boolean>() { @Override public Boolean call(ChangeNotification<T> notification) { StreamStateNotification<T> stateNotification = (StreamStateNotification<T>) notification; interestsBufferingState.put(stateNotification.getInterest(), stateNotification.getBufferState()); return true; } }).materialize().map(new Func1<Notification<Boolean>, Boolean>() { @Override public Boolean call(Notification<Boolean> materialized) { switch (materialized.getKind()) { case OnNext: return materialized.getValue(); case OnCompleted: break; case OnError: if (logger.isDebugEnabled()) { logger.debug("Swallowed observable error", materialized.getThrowable()); } break; } for (Interest<T> i : interestsBufferingState.keySet()) { interestsBufferingState.put(i, BufferState.BufferEnd); } return false; } }).doOnTerminate(new Action0() { @Override public void call() { interestsBufferingState.clear(); } }); } } ).subscribe(updatesSubject); }
Source:
public static ClusterBasedJobCoordinator createFromMetadataStore(Config metadataStoreConfig) { MetricsRegistryMap metrics = new MetricsRegistryMap(); CoordinatorStreamStore coordinatorStreamStore = new CoordinatorStreamStore(metadataStoreConfig, metrics); coordinatorStreamStore.init(); Config config = CoordinatorStreamUtil.readConfigFromCoordinatorStream(coordinatorStreamStore); return new ClusterBasedJobCoordinator(metrics, coordinatorStreamStore, config); }

Target:
static ClusterBasedJobCoordinator createFromMetadataStore(Config metadataStoreConfig) { MetricsRegistryMap metrics = new MetricsRegistryMap(); CoordinatorStreamStore coordinatorStreamStore = new CoordinatorStreamStore(metadataStoreConfig, metrics); coordinatorStreamStore.init(); Config config = CoordinatorStreamUtil.readConfigFromCoordinatorStream(coordinatorStreamStore); return new ClusterBasedJobCoordinator(metrics, coordinatorStreamStore, config); }
Source:
public Object setValue(Object value) { this.value = value; return oldValue; }

Target:
public Object setValue(Object value) { Object prev = this.value; this.value = value; return prev; }
Source:
private void initConfigurationResolver() { if (!requiresConfig.get()) { configurationResolver = (event, stopping) -> empty(); return; } findConfigurationProvider().ifPresent(configurationProvider::set); Optional<ConfigurationInstance> staticConfiguration = getStaticConfiguration(); if (staticConfiguration.isPresent()) { configurationResolver = (event, stopping) -> staticConfiguration; return; } if (isConfigurationSpecified()) { configurationResolver = (event, stopping) -> { if (stopping) { return configurationProvider.get().getIfPresent(event); } else { ConfigurationInstance instance = configurationProvider.get().get(event); if (instance == null) { throw new IllegalModelDefinitionException(format( "Root component '%s' contains a reference to config '%s' but it doesn't exists", getLocation().getRootContainerName(), configurationProvider)); } return of(instance); } }; } else { configurationResolver = (event, stopping) -> extensionManager.getConfiguration(extensionModel, componentModel, event); } }

Target:
private void initConfigurationResolver() { if (!requiresConfig.get()) { configurationResolver = event -> empty(); return; } findConfigurationProvider().ifPresent(configurationProvider::set); Optional<ConfigurationInstance> staticConfiguration = getStaticConfiguration(); if (staticConfiguration.isPresent()) { configurationResolver = event -> staticConfiguration; return; } if (isConfigurationSpecified()) { configurationResolver = event -> { ConfigurationInstance instance = configurationProvider.get().get(event); if (instance == null) { throw new IllegalModelDefinitionException(format( "Root component '%s' contains a reference to config '%s' but it doesn't exists", getLocation().getRootContainerName(), configurationProvider)); } return of(instance); }; } else { configurationResolver = event -> extensionManager.getConfiguration(extensionModel, componentModel, event); } }
Source:
public static boolean isBound(UseCase useCase) { checkInitialized(); Collection<UseCaseGroupLifecycleController> controllers = sCameraX.mUseCaseGroupRepository.getUseCaseGroups(); for (UseCaseGroupLifecycleController controller : controllers) { UseCaseGroup useCaseGroup = controller.getUseCaseGroup(); if (useCaseGroup.contains(useCase)) { return true; } } return false; }

Target:
public static boolean isBound(UseCase useCase) { CameraX cameraX = checkInitialized(); Collection<UseCaseGroupLifecycleController> controllers = cameraX.mUseCaseGroupRepository.getUseCaseGroups(); for (UseCaseGroupLifecycleController controller : controllers) { UseCaseGroup useCaseGroup = controller.getUseCaseGroup(); if (useCaseGroup.contains(useCase)) { return true; } } return false; }
Source:
public static String getRefDescription(Ref ref) { String name = ref.getName(); if (name.equals(Constants.HEAD)) { if (ref.isSymbolic()) return UIText.GitLabelProvider_RefDescriptionHeadSymbolic; else return UIText.GitLabelProvider_RefDescriptionHead; } else if (name.equals(Constants.ORIG_HEAD)) return UIText.GitLabelProvider_RefDescriptionOrigHead; else if (name.equals(Constants.FETCH_HEAD)) { return UIText.GitLabelProvider_RefDescriptionFetchHead; } else return ""; }

Target:
public static String getRefDescription(Ref ref) { String name = ref.getName(); if (name.equals(Constants.HEAD)) { if (ref.isSymbolic()) return UIText.GitLabelProvider_RefDescriptionHeadSymbolic; else return UIText.GitLabelProvider_RefDescriptionHead; } else if (name.equals(Constants.ORIG_HEAD)) return UIText.GitLabelProvider_RefDescriptionOrigHead; else if (name.equals(Constants.FETCH_HEAD)) return UIText.GitLabelProvider_RefDescriptionFetchHead; else if (name.equals(Constants.R_STASH)) return UIText.GitLabelProvider_RefDescriptionStash; else return null; }
Source:
public static Comparator<Row> createComparator(InputColumn<?> column, final int columnIndex) { final Class<?> dataType = column.getDataType(); final boolean isNumber = dataType != null && ReflectionUtils.isNumber(dataType); final boolean isDate = dataType != null && ReflectionUtils.isDate(dataType); return new Comparator<Row>() { @Override public int compare(Row row1, Row row2) { final Comparable<?> value1 = getComparableValue(row1, columnIndex, isNumber, isDate); final Comparable<?> value2 = getComparableValue(row2, columnIndex, isNumber, isDate); int comparableResult = CompareUtils.compareUnbound(value1, value2); if (comparableResult != 0) { return comparableResult; } else { int numberOfSelectItems = row1.getSelectItems().length; for (int i = 0; i < numberOfSelectItems; i++) { final String rowValue1 = (String) row1.getValue(i); final String rowValue2 = (String) row2.getValue(i); final String rowValue1LowerCased = rowValue1.toLowerCase(); final String rowValue2LowerCased = rowValue2.toLowerCase(); if (CompareUtils.compare(rowValue1LowerCased, rowValue2LowerCased) == 0) { continue; } else { return CompareUtils.compare(rowValue1LowerCased, rowValue2LowerCased); } } } return comparableResult; } }; }

Target:
public static Comparator<Row> createComparator(InputColumn<?> column, final int columnIndex) { final Class<?> dataType = column.getDataType(); final boolean isNumber = dataType != null && ReflectionUtils.isNumber(dataType); final boolean isDate = dataType != null && ReflectionUtils.isDate(dataType); return new Comparator<Row>() { @Override public int compare(Row row1, Row row2) { final Comparable<?> value1 = getComparableValue(row1, columnIndex, isNumber, isDate); final Comparable<?> value2 = getComparableValue(row2, columnIndex, isNumber, isDate); int comparableResult = CompareUtils.compareUnbound(value1, value2); if (comparableResult != 0) { return comparableResult; } else { int numberOfSelectItems = row1.getSelectItems().length; for (int i = 0; i < numberOfSelectItems; i++) { final String rowValue1 = (String) row1.getValue(i); final String rowValue2 = (String) row2.getValue(i); final int compareResult = rowValue1.compareToIgnoreCase(rowValue2); if (compareResult == 0) { continue; } else { return compareResult; } } } return comparableResult; } }; }
Source:
private ImageioClient getImageioClient() { if (imageioClient == null) { imageioClient = new ImageioClient(getImageioUnixSocketPath().toString()); } return imageioClient; }

Target:
private ImageioClient getImageioClient() { if (imageioClient == null) { imageioClient = new ImageioClient(getImageioUnixSocketPath().toString()); } return new ImageioClient(getImageioUnixSocketPath().toString()); }
Source:
public HttpClientConnector(URI uri) { super(HostAndPort.fromParts(uri.getHost(), uri.getPort())); if (uri.getScheme().compareTo("http") != 0 && uri.getScheme().compareTo("https") != 0) { throw new IllegalArgumentException("HTTP connector only connects to HTTP/HTTPS URIs"); } this.endpointUri = uri; }

Target:
public HttpClientConnector(URI uri) { super(HostAndPort.fromParts(checkNotNull(uri).getHost(), checkNotNull(uri).getPort())); checkArgument(uri.isAbsolute() && !uri.isOpaque(), "HttpClientConnector requires an absolute URI with a path"); checkArgument(uri.getScheme().compareTo("http") != 0 && uri.getScheme().compareTo("https") != 0, "HttpClientConnector only connects to HTTP/HTTPS URIs"); this.endpointUri = uri; }
Source:
public List<ResponseInfo> sendAndPoll(List<RequestInfo> requestInfos) { List<ResponseInfo> responseInfoList = new ArrayList<ResponseInfo>(); for (RequestInfo requestInfo : requestInfos) { pendingRequests.add(new RequestMetadata(time.milliseconds(), requestInfo, null)); } List<NetworkSend> sends = prepareSends(responseInfoList); try { selector.poll(POLL_TIMEOUT_MS, sends); handleSelectorEvents(responseInfoList); } catch (IOException e) { logger.error("Received exception while polling the selector", e); } return responseInfoList; }

Target:
public List<ResponseInfo> sendAndPoll(List<RequestInfo> requestInfos) throws IOException { if (closed) { throw new IllegalStateException("The NetworkClient is closed."); } List<ResponseInfo> responseInfoList = new ArrayList<ResponseInfo>(); for (RequestInfo requestInfo : requestInfos) { pendingRequests.add(new RequestMetadata(time.milliseconds(), requestInfo)); } List<NetworkSend> sends = prepareSends(responseInfoList); selector.poll(POLL_TIMEOUT_MS, sends); handleSelectorEvents(responseInfoList); return responseInfoList; }
Source:
protected List<DiskImage> getVmDisksFromDb() { VM vmFromConfiguration = getVmFromConfiguration(); if (vmFromConfiguration == null) { return Collections.emptyList(); } List<DiskImage> disksFromDb = DisksFilter.filterImageDisks(vmFromConfiguration.getDiskMap().values(), ONLY_SNAPABLE, ONLY_ACTIVE); disksFromDb.addAll(DisksFilter.filterCinderDisks(getVm().getDiskMap().values(), ONLY_PLUGGED)); return disksFromDb; }

Target:
protected List<DiskImage> getVmDisksFromDb() { VM vmFromConfiguration = getVmFromConfiguration(); if (vmFromConfiguration == null) { log.debug("No VM configuration found for snapshot id '{}'", getParameters().getSnapshotId()); return Collections.emptyList(); } List<DiskImage> disksFromDb = DisksFilter.filterImageDisks(vmFromConfiguration.getDiskMap().values(), ONLY_SNAPABLE, ONLY_ACTIVE); disksFromDb.addAll(DisksFilter.filterCinderDisks(getVm().getDiskMap().values(), ONLY_PLUGGED)); return disksFromDb; }