auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testDecimal() { ToolTipString fromFloat = ToolTipString.fromDecimal(1.0f); ToolTipString fromDouble = ToolTipString.fromDecimal(1.0); ToolTipString fromInt = ToolTipString.fromDecimal(1); ToolTipString fromLong = ToolTipString.fromDecimal(1L); assertNotNull(fromFloat); assertNotNull(fromDouble); assertNotNull(fromInt); assertNotNull(fromLong); assertEquals("1", fromFloat.toString()); assertEquals("1", fromDouble.toString()); assertEquals("1", fromInt.toString()); assertEquals("1", fromLong.toString()); assertEquals("1", fromFloat.toHtmlString()); assertEquals("1", fromDouble.toHtmlString()); assertEquals("1", fromInt.toHtmlString()); assertEquals("1", fromLong.toHtmlString()); }

Target:
public void testDecimal() { ToolTipString fromFloat = ToolTipString.fromDecimal(1.0f); ToolTipString fromDouble = ToolTipString.fromDecimal(1.0); ToolTipString fromInt = ToolTipString.fromDecimal(1); ToolTipString fromLong = ToolTipString.fromDecimal(1L); assertEquals("1", fromFloat.toString()); assertEquals("1", fromDouble.toString()); assertEquals("1", fromInt.toString()); assertEquals("1", fromLong.toString()); assertEquals("1", fromFloat.toHtmlString()); assertEquals("1", fromDouble.toHtmlString()); assertEquals("1", fromInt.toHtmlString()); assertEquals("1", fromLong.toHtmlString()); }
Source:
public void search_getSearch() throws Exception { peliasWithMock.search("test", "1", "2", "1", "1", "1", "1", callback); verify(mock).getSearch(eq("test"), eq("1"), eq("2"), eq("1"), eq("1"), eq("1"), eq("1"), eq(apiKey), cb.capture()); }

Target:
public void search_getSearch() throws Exception { peliasWithMock.search("test", "1", "2", "3", "4", "5", "6", callback); verify(mock).getSearch(eq("test"), eq("1"), eq("2"), eq("3"), eq("4"), eq("5"), eq("6"), eq(apiKey), cb.capture()); }
Source:
public void testDeserializeMessage() throws Exception { Messenger messenger = new Messenger(new File("")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); String className = StringMessage.class.getCanonicalName(); String testMessage = "This is a test of the messaging system"; appendMessage(className, testMessage, baos); InputStream is = simulateSendAndReceive(baos); assertTrue(messenger.deserializeMessage(is)); IMessage message = messenger.getReceivedMessages().get(0); assertNotNull(message); assertTrue(message instanceof StringMessage); assertEquals(testMessage, ((StringMessage)message).getString()); assertEquals(0, is.available()); }

Target:
public void testDeserializeMessage() throws Exception { Messenger messenger = new Messenger(new File("")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); String className = StringMessage.class.getCanonicalName(); String testMessage = "This is a test of the messaging system"; appendMessage(className, testMessage, baos); InputStream received = simulateSendAndReceive(baos); assertTrue(messenger.deserializeMessage(received)); IMessage message = messenger.getReceivedMessages().get(0); assertNotNull(message); assertTrue(message instanceof StringMessage); assertEquals(testMessage, ((StringMessage)message).getString()); assertEquals(0, received.available()); }
Source:
public static HashMap<String, String> updateInputParamsForRelationshipTemplate(final HashMap<String, String> inputParams, final CSARID csarID, final RelationshipTemplateInstance relationshipTemplateInstance, final String neededInterface, final String neededOperation) { if (relationshipTemplateInstance != null) { ParameterHandler.LOG.debug("Operation: on RelationshipTemplate: {}", relationshipTemplateInstance, neededOperation); ParameterHandler.LOG.debug("{} inital input parameters found: {}", inputParams.size(), inputParams.toString()); final List<String> expectedParams = ParameterHandler.getExpectedInputParams(csarID, relationshipTemplateInstance.getTemplateType(), neededInterface, neededOperation); ParameterHandler.LOG.debug("Operation: expects parameters: {}", neededOperation, expectedParams.size(), expectedParams.toString()); if (!expectedParams.isEmpty()) { for (final String expectedParam : expectedParams) { ParameterHandler.LOG.debug("Expected parameter: {}", expectedParam); if (expectedParam.startsWith("SRC_")) { ParameterHandler.LOG.debug("Parameter is defined at the topology stack of the source NodeTemplate."); } else if (expectedParam.startsWith("TRG_")) { ParameterHandler.LOG.debug("Parameter is defined at the topology stack of the target NodeTemplate."); } else { ParameterHandler.LOG.debug("Parameter is defined at the RelationshipTemplate."); } } } } else { ParameterHandler.LOG.warn("Unable to update input parameters with RelationshipTemplateInstance equal to null!"); } return inputParams; }

Target:
private static HashMap<String, String> updateInputParamsForRelationshipTemplate(final HashMap<String, String> inputParams, final CSARID csarID, final RelationshipTemplateInstance relationshipTemplateInstance, final String neededInterface, final String neededOperation) { Objects.requireNonNull(relationshipTemplateInstance); LOG.debug("Updating input params for RelationshipTemplate ID: {}", relationshipTemplateInstance.getId()); LOG.debug("{} inital input parameters for operation: found: {}", inputParams.size(), neededOperation, inputParams.toString()); final Set<String> expectedParams = getExpectedInputParams(csarID, relationshipTemplateInstance.getTemplateType(), neededInterface, neededOperation); if (expectedParams.isEmpty()) { LOG.debug("No input params defined for this operation."); return inputParams; } LOG.debug("Operation: expects parameters: {}", neededOperation, expectedParams.size(), expectedParams.toString()); for (final String expectedParam : expectedParams) { LOG.debug("Expected parameter: {}", expectedParam); if (expectedParam.startsWith("SRC_")) { LOG.debug("Parameter is defined at the topology stack of the source NodeTemplate."); } else if (expectedParam.startsWith("TRG_")) { LOG.debug("Parameter is defined at the topology stack of the target NodeTemplate."); } else { LOG.debug("Parameter is defined at the RelationshipTemplate."); } } return inputParams; }
Source:
public static void populate(Cache cache, ObjectMapper mapper, Cache.NamedKey key, Iterable<Object> results) { List<Object> resultList = Lists.newArrayList(results); try { cache.put(key, mapper.writeValueAsBytes(resultList)); } catch (JsonProcessingException e) { throw Throwables.propagate(e); } }

Target:
public static void populate(Cache cache, ObjectMapper mapper, Cache.NamedKey key, Iterable<Object> results) { try { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try (JsonGenerator gen = mapper.getFactory().createGenerator(bytes)) { for (Object result : results) { gen.writeObject(result); } } cache.put(key, bytes.toByteArray()); } catch (IOException e) { throw Throwables.propagate(e); } }
Source:
private void doBucketProbing() throws IOException { int bucketProbe = getConf() .getInt(S3A_BUCKET_PROBE, S3A_BUCKET_PROBE_DEFAULT); Preconditions.checkArgument(bucketProbe >= 0, "Value of " + S3A_BUCKET_PROBE + " should be >= 0"); String endPoint = getConf().getTrimmed(ENDPOINT, ""); if (!endPoint.isEmpty() && LOG.isDebugEnabled()) { LOG.debug("Bucket endpoint : {}", InetAddress.getByName(endPoint).toString()); } switch (bucketProbe) { case 0: LOG.debug("skipping check for bucket existence"); break; case 1: verifyBucketExists(); break; case 2: verifyBucketExistsV2(); break; default: LOG.warn("Unknown bucket probe option {}: {}; falling back to check #2", S3A_BUCKET_PROBE, bucketProbe); verifyBucketExistsV2(); break; } }

Target:
private void doBucketProbing() throws IOException { int bucketProbe = getConf() .getInt(S3A_BUCKET_PROBE, S3A_BUCKET_PROBE_DEFAULT); Preconditions.checkArgument(bucketProbe >= 0, "Value of " + S3A_BUCKET_PROBE + " should be >= 0"); switch (bucketProbe) { case 0: LOG.debug("skipping check for bucket existence"); break; case 1: logDnsLookup(getConf()); verifyBucketExists(); break; case 2: logDnsLookup(getConf()); verifyBucketExistsV2(); break; default: LOG.warn("Unknown bucket probe option {}: {}; falling back to check #2", S3A_BUCKET_PROBE, bucketProbe); verifyBucketExistsV2(); break; } }
Source:
public void exceptionWhileExecutingJob(String nextJobId, Throwable t) { if(t instanceof OptimisticLockingException && !isDebugEnabled()) { logWarn( "006", "Exception while closing command context: To see the full stacktrace set logging level to WARNING.", t.getClass().getSimpleName()); } else { logWarn( "006", "Exception while executing job {}: ", nextJobId, t); } }

Target:
public void exceptionWhileExecutingJob(String nextJobId, Throwable t) { if(t instanceof OptimisticLockingException && !isDebugEnabled()) { logWarn( "006", "Exception while executing job {}: {}. To see the full stacktrace set logging level to DEBUG.", nextJobId, t.getClass().getSimpleName()); } else { logWarn( "006", "Exception while executing job {}: ", nextJobId, t); } }
Source:
static synchronized Iterable<TerminalInfoView> getViews() { return new ArrayList<TerminalInfoView>(views); }

Target:
private static synchronized Iterable<TerminalInfoView> getViews() { return new ArrayList<TerminalInfoView>(views); }
Source:
public void testLoadMetadataResources() throws IOException { ZkKeyBuilder keyBuilder = Mockito.mock(ZkKeyBuilder.class); ZkClient mockZkClient = Mockito.mock(ZkClient.class); when(keyBuilder.getJobModelVersionBarrierPrefix()).thenReturn(TEST_BARRIER_ROOT); ZkUtils zkUtils = Mockito.mock(ZkUtils.class); when(zkUtils.getKeyBuilder()).thenReturn(keyBuilder); when(zkUtils.getZkClient()).thenReturn(mockZkClient); when(zkUtils.getJobModel(TEST_JOB_MODEL_VERSION)).thenReturn(jobModel); StartpointManager mockStartpointManager = Mockito.mock(StartpointManager.class); ZkJobCoordinator zkJobCoordinator = Mockito.spy(new ZkJobCoordinator("TEST_PROCESSOR_ID", config, new NoOpMetricsRegistry(), zkUtils)); doReturn(mockStartpointManager).when(zkJobCoordinator).createStartpointManager(any(CoordinatorStreamStore.class)); doReturn(mock(CoordinatorStreamStore.class)).when(zkJobCoordinator).createCoordinatorStreamStore(); doReturn(mock(MetadataResourceUtil.class)).when(zkJobCoordinator).createMetadataResourceUtil(any(JobModel.class)); verifyZeroInteractions(mockStartpointManager); zkJobCoordinator.loadMetadataResources(jobModel); verify(mockStartpointManager).start(); verify(mockStartpointManager).fanOut(any()); verify(mockStartpointManager).stop(); }

Target:
public void testLoadMetadataResources() throws IOException { ZkKeyBuilder keyBuilder = Mockito.mock(ZkKeyBuilder.class); ZkClient mockZkClient = Mockito.mock(ZkClient.class); when(keyBuilder.getJobModelVersionBarrierPrefix()).thenReturn(TEST_BARRIER_ROOT); ZkUtils zkUtils = Mockito.mock(ZkUtils.class); when(zkUtils.getKeyBuilder()).thenReturn(keyBuilder); when(zkUtils.getZkClient()).thenReturn(mockZkClient); when(zkUtils.getJobModel(TEST_JOB_MODEL_VERSION)).thenReturn(jobModel); StartpointManager mockStartpointManager = Mockito.mock(StartpointManager.class); ZkJobCoordinator zkJobCoordinator = Mockito.spy(new ZkJobCoordinator("TEST_PROCESSOR_ID", config, new NoOpMetricsRegistry(), zkUtils)); doReturn(mockStartpointManager).when(zkJobCoordinator).createStartpointManager(any(CoordinatorStreamStore.class)); doReturn(mock(CoordinatorStreamStore.class)).when(zkJobCoordinator).createCoordinatorStreamStore(); MetadataResourceUtil mockMetadataResourceUtil = mock(MetadataResourceUtil.class); doReturn(mockMetadataResourceUtil).when(zkJobCoordinator).createMetadataResourceUtil(any(JobModel.class)); verifyZeroInteractions(mockStartpointManager); zkJobCoordinator.loadMetadataResources(jobModel); verify(mockMetadataResourceUtil).createResources(); verify(mockStartpointManager).start(); verify(mockStartpointManager).fanOut(any()); verify(mockStartpointManager).stop(); }
Source:
public MailboxExecutorImpl(@Nonnull TaskMailbox mailbox, int priority, StreamTaskActionExecutor actionExecutor, MailboxProcessor mailboxProcessor) { this.mailbox = (TaskMailboxImpl) mailbox; this.priority = priority; this.actionExecutor = Preconditions.checkNotNull(actionExecutor); this.mailboxProcessor = mailboxProcessor; }

Target:
public MailboxExecutorImpl(@Nonnull TaskMailbox mailbox, int priority, StreamTaskActionExecutor actionExecutor, MailboxProcessor mailboxProcessor) { this.mailbox = mailbox; this.priority = priority; this.actionExecutor = Preconditions.checkNotNull(actionExecutor); this.mailboxProcessor = mailboxProcessor; }
Source:
public EntityRef createEntityWithoutLifecycleEvents(Iterable<Component> components) { EntityRef entity = create(); String prefabName = null; BlockUri blockUri = null; for (Component component : components) { if (component instanceof EntityInfoComponent) { EntityInfoComponent comp = (EntityInfoComponent) component; prefabName = comp.parentPrefab; if (blockUri != null) break; } else if (component instanceof BlockComponent) { BlockComponent comp = (BlockComponent) component; blockUri = comp.getBlock().getBlockFamily().getURI(); if (prefabName != null) break; } } EntityBeingGenerated event = new EntityBeingGenerated(prefabName, blockUri, components); eventSystem.send(entity, event); components = event.getResultComponents(); for (Component c : components) { store.put(entity.getId(), c); } return entity; }

Target:
public EntityRef createEntityWithoutLifecycleEvents(Iterable<Component> components) { EntityRef entity = createAndSendEvent(components); return entity; }
Source:
public static AtlasDbDialogueServiceProvider create( Refreshable<ServerListConfig> timeLockServerListConfig, DialogueClients.ReloadingFactory baseFactory, UserAgent userAgent) { UserAgent versionedAgent = userAgent.addAgent(AtlasDbRemotingConstants.ATLASDB_HTTP_CLIENT_AGENT); Refreshable<Map<String, RemoteServiceConfiguration>> timeLockRemoteConfigurations = timeLockServerListConfig .map(serverListConfig -> ImmutableMap.of( TIMELOCK_SHORT_TIMEOUT, createRemoteServiceConfiguration(versionedAgent, serverListConfig, false), TIMELOCK_LONG_TIMEOUT, createRemoteServiceConfiguration(versionedAgent, serverListConfig, true))); DialogueClients.ReloadingFactory reloadingFactory = decorateForFailoverServices(baseFactory, timeLockRemoteConfigurations).withUserAgent(versionedAgent); return new AtlasDbDialogueServiceProvider(reloadingFactory); }

Target:
public static AtlasDbDialogueServiceProvider create( Refreshable<ServerListConfig> timeLockServerListConfig, DialogueClients.ReloadingFactory baseFactory, UserAgent userAgent) { UserAgent versionedAgent = userAgent.addAgent(AtlasDbRemotingConstants.ATLASDB_HTTP_CLIENT_AGENT); Refreshable<Map<String, RemoteServiceConfiguration>> timeLockRemoteConfigurations = timeLockServerListConfig .map(serverListConfig -> getServiceConfigurations(versionedAgent, serverListConfig)); DialogueClients.ReloadingFactory reloadingFactory = decorateForFailoverServices(baseFactory, timeLockRemoteConfigurations).withUserAgent(versionedAgent); return new AtlasDbDialogueServiceProvider(reloadingFactory); }
Source:
public static MailMessage formatMessage(long userId, Event event, Position position) { Device device = Context.getIdentityManager().getDeviceById(event.getDeviceId()); VelocityContext velocityContext = new VelocityContext(); velocityContext.put("device", device); velocityContext.put("event", event); if (position != null) { velocityContext.put("position", position); velocityContext.put("speedUnits", ReportUtils.getSpeedUnit(userId)); } if (event.getGeofenceId() != 0) { velocityContext.put("geofence", Context.getGeofenceManager().getGeofence(event.getGeofenceId())); } Template template = null; try { template = Context.getVelocityEngine().getTemplate(event.getType() + ".vm"); } catch (ResourceNotFoundException error) { Log.warning(error); } if (template == null) { template = Context.getVelocityEngine().getTemplate("unknown.vm"); } StringWriter writer = new StringWriter(); template.merge(velocityContext, writer); String subject = (String) velocityContext.get("subject"); return new MailMessage(subject, writer.toString()); }

Target:
public static MailMessage formatMessage(long userId, Event event, Position position) { Device device = Context.getIdentityManager().getDeviceById(event.getDeviceId()); VelocityContext velocityContext = new VelocityContext(); velocityContext.put("device", device); velocityContext.put("event", event); if (position != null) { velocityContext.put("position", position); velocityContext.put("speedUnits", ReportUtils.getSpeedUnit(userId)); } if (event.getGeofenceId() != 0) { velocityContext.put("geofence", Context.getGeofenceManager().getGeofence(event.getGeofenceId())); } Template template = null; try { template = Context.getVelocityEngine().getTemplate(event.getType() + ".vm"); } catch (ResourceNotFoundException error) { Log.warning(error); template = Context.getVelocityEngine().getTemplate("unknown.vm"); } StringWriter writer = new StringWriter(); template.merge(velocityContext, writer); String subject = (String) velocityContext.get("subject"); return new MailMessage(subject, writer.toString()); }
Source:
public Date parseInput(FlagContext context) throws InvalidFlagFormat { String input = context.getUserInput(); if("now".equalsIgnoreCase(input)) { return new Date(); } else if("none".equalsIgnoreCase(input)) { return null; } else { DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault()); try { return format.parse(input); } catch (ParseException ignored) { String pattern = format instanceof SimpleDateFormat ? ((SimpleDateFormat) format).toLocalizedPattern() : format.format(new Date()); throw new InvalidFlagFormat("Expected input in format: " + pattern); } } }

Target:
public Instant parseInput(FlagContext context) throws InvalidFlagFormat { String input = context.getUserInput(); if("now".equalsIgnoreCase(input)) { return Instant.now(); } else { try { return Instant.from(FORMATTER.parse(input)); } catch(DateTimeParseException ignored) { throw new InvalidFlagFormat("Expected 'now' or ISO 8601 formatted input."); } } }
Source:
protected void executeCommand() { List<ActionParametersBase> params = hosts.stream() .filter(host -> host.getInterfaces().stream() .anyMatch(hostIf -> !hostIf.getNetworkImplementationDetails().isInSync())) .map(host -> new VdsActionParameters(host.getId())) .collect(Collectors.toList()); runInternalMultipleActions(ActionType.SyncAllHostNetworks, params); setSucceeded(true); }

Target:
protected void executeCommand() { List<ActionParametersBase> params = vdsIds.stream() .map(VdsActionParameters::new) .collect(Collectors.toList()); runInternalMultipleActions(ActionType.SyncAllHostNetworks, params); setSucceeded(true); }
Source:
public void testOwnerPurge() { try { Connection c = null; Statement stmt = null; try { c = DriverManager.getConnection("jdbc:sqlite:test.db"); SqlHelper.dropTable(c, "TFLedger"); SqlHelper.createTable(c, "TFLedger", new Ledger()); SqlHelper.insertToTable(c, "TFLedger", l); ResultSet rs = SqlHelper.selectFromTable(c, "TFLedger", new String[]{"entity-id"}, new String[]{"ledger_entity_id"}, new Ledger()); byte[] caseBytes = rs.getBytes("commcare_sql_record"); DataInputStream is = new DataInputStream(new ByteArrayInputStream(caseBytes)); Ledger readLedger = new Ledger(); try { PrototypeFactory lPrototypeFactory = new PrototypeFactory(); lPrototypeFactory.addClass(Ledger.class); readLedger.readExternal(is, lPrototypeFactory); } catch(Exception e){ System.out.println("e: " + e); e.printStackTrace(); } c.close(); } catch ( Exception e ) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); } } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception " + e.getMessage()); } }

Target:
public void testOwnerPurge() { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String databaseName = ("test.db"); try { connection = DriverManager.getConnection("jdbc:sqlite:" + databaseName); SqlHelper.dropTable(connection, "TFLedger"); SqlHelper.createTable(connection, "TFLedger", new Ledger()); SqlHelper.insertToTable(connection, "TFLedger", l); preparedStatement = SqlHelper.prepareTableSelectStatement(connection, "TFLedger", new String[]{"entity-id"}, new String[]{"ledger_entity_id"}, new Ledger()); if (preparedStatement == null) { fail("failed to prepare table select query"); } resultSet = preparedStatement.executeQuery(); byte[] caseBytes = resultSet.getBytes("commcare_sql_record"); DataInputStream is = new DataInputStream(new ByteArrayInputStream(caseBytes)); Ledger readLedger = new Ledger(); PrototypeFactory lPrototypeFactory = new PrototypeFactory(); lPrototypeFactory.addClass(Ledger.class); readLedger.readExternal(is, lPrototypeFactory); } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception " + e.getMessage()); } finally{ try { if(preparedStatement != null) { preparedStatement.close(); } if(connection != null) { connection.close(); } if(resultSet != null){ resultSet.close(); } File databaseFile = new File(databaseName); if(databaseFile.exists()){ databaseFile.delete(); } } catch (SQLException e1) { e1.printStackTrace(); } } }
Source:
public int handlesSelection(ISelection selection) { int result = 0; Object sel = SelectionUtils.getSelectedObject(selection); if (sel instanceof GdbLaunch || sel instanceof GDBProcess || sel instanceof IDMVMContext) { result = 2; } updateDebugViewListener(); return result; }

Target:
public int handlesSelection(ISelection selection) { int result = 0; Object sel = SelectionUtils.getSelectedObject(selection); if (sel instanceof GdbLaunch || sel instanceof GDBProcess || sel instanceof IDMVMContext) { result = 10; } updateDebugViewListener(); return result; }
Source:
public List<E> findAllWhereFieldEquals(String fieldName, Object fieldEntity, Criterion... criterion) { final boolean isField = EntityUtil.isField(entityClass, fieldName, true); if (!isField) { String errorMsg = String.format( "There is no field '%s' in the type '%s'", fieldName, entityClass.getName() ); throw new IllegalArgumentException(errorMsg); } Criteria criteria = createDistinctRootEntityCriteria(criterion); criteria.add(Restrictions.eq(fieldName, fieldEntity)); return (List<E>) criteria.list(); }

Target:
public List<E> findAllWhereFieldEquals(String fieldName, Object fieldEntity, Criterion... criterion) { Class<?> fieldEntityType = null; if(fieldEntity != null) { fieldEntityType = fieldEntity.getClass(); } final boolean isField = EntityUtil.isField(entityClass, fieldName, fieldEntityType, true); if (!isField) { String errorMsg = String.format( "There is no field '%s' in the type '%s' that accepts instances of '%s'", fieldName, entityClass.getName(), fieldEntityType.getName() ); throw new IllegalArgumentException(errorMsg); } Criteria criteria = createDistinctRootEntityCriteria(criterion); if(fieldEntity == null) { criteria.add(Restrictions.isNull(fieldName)); } else { criteria.add(Restrictions.eq(fieldName, fieldEntity)); } return (List<E>) criteria.list(); }
Source:
public void testNoCredentialId() { assertNull(this.action.createCredentials(requestContext, getCredentials(), null)); }

Target:
public void testNoCredentialId() { this.action.createCredentials(requestContext, getCredentials(), null); }
Source:
public void should_parse_virtual_metadata() { KeyspaceMetadata km=session().getCluster().getMetadata().getKeyspace("system_views"); assertThat(km.getTables().size() >= 2); assertThat(km.isVirtual()).isTrue(); assertThat(km.getTable("clients")).isNotNull(); assertThat(km.isDurableWrites()).isFalse(); assertThat(km.getName()).isEqualTo("system_views"); assertThat(km.getUserTypes().size()).isEqualTo(0); assertThat(km.getFunctions().size()).isEqualTo(0); assertThat(km.getMaterializedViews().size()).isEqualTo(0); assertThat(km.getAggregates().size()).isEqualTo(0); assertThat(km.asCQLQuery()).isEqualTo(" "); TableMetadata tm = km.getTable("clients"); assertThat(tm).isNotNull(); assertThat(tm.getName()).isEqualTo("clients"); assertThat(tm.isVirtual()).isTrue(); assertThat(tm.getColumns().size()).isEqualTo(12); assertThat(tm.getIndexes().size()).isEqualTo(0); assertThat(tm.getViews().size()).isEqualTo(0); assertThat(tm.getClusteringColumns().size()).isEqualTo(0); assertThat(tm.getClusteringOrder().size()).isEqualTo(0); assertThat(tm.getId()).isEqualTo( new UUID(0L, 0L)); assertThat(tm.getOptions()).isNull(); assertThat(tm.getKeyspace()).isEqualTo(km); assertThat(tm.asCQLQuery()).isEqualTo(" "); ColumnMetadata cm = tm.getColumn("driver_name"); assertThat(cm).isNotNull(); assertThat(cm.getParent()).isEqualTo(tm); assertThat(cm.getType()).isEqualTo(DataType.text()); assertThat(cm.getName()).isEqualTo("driver_name"); }

Target:
public void should_parse_virtual_metadata() { KeyspaceMetadata km = session().getCluster().getMetadata().getKeyspace("system_views"); assertThat(km.getTables().size() >= 2); assertThat(km.isVirtual()).isTrue(); assertThat(km.isDurableWrites()).isFalse(); assertThat(km.getName()).isEqualTo("system_views"); assertThat(km.getUserTypes().size()).isEqualTo(0); assertThat(km.getFunctions().size()).isEqualTo(0); assertThat(km.getMaterializedViews().size()).isEqualTo(0); assertThat(km.getAggregates().size()).isEqualTo(0); assertThat(km.asCQLQuery()).isEqualTo(" "); TableMetadata tm = km.getTable("clients"); assertThat(tm).isNotNull(); assertThat(tm.getName()).isEqualTo("clients"); assertThat(tm.isVirtual()).isTrue(); assertThat(tm.getColumns().size()).isEqualTo(12); assertThat(tm.getIndexes().size()).isEqualTo(0); assertThat(tm.getViews().size()).isEqualTo(0); assertThat(tm.getClusteringColumns().size()).isEqualTo(0); assertThat(tm.getClusteringOrder().size()).isEqualTo(0); assertThat(tm.getId()).isEqualTo(new UUID(0L, 0L)); assertThat(tm.getOptions()).isNull(); assertThat(tm.getKeyspace()).isEqualTo(km); assertThat(tm.asCQLQuery()).isEqualTo(" "); ColumnMetadata cm = tm.getColumn("driver_name"); assertThat(cm).isNotNull(); assertThat(cm.getParent()).isEqualTo(tm); assertThat(cm.getType()).isEqualTo(DataType.text()); assertThat(cm.getName()).isEqualTo("driver_name"); }
Source:
protected void executeQueryCommand() { Set<Guid> haveInvalidAncestor = new HashSet<>(); Function<Guid, DiskImage> getAncestor = (Guid imageId) -> { DiskImage ancestor = diskImageDao.getAncestor(imageId, getUserID(), getParameters().isFiltered()); if (ancestor == null) { haveInvalidAncestor.add(imageId); } return ancestor; }; Map<Guid, DiskImage> haveValidAncestor = getParameters().getIds().stream() .map(guid -> new Pair<>(guid, getAncestor.apply(guid))) .filter(pair -> pair.getSecond() != null) .collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)); if (!haveInvalidAncestor.isEmpty()) { log.warn("Ancestor is missing for the following guid(s): {}", StringUtils.join(haveInvalidAncestor, ',')); } getQueryReturnValue().setReturnValue(haveValidAncestor); }

Target:
protected void executeQueryCommand() { Set<Guid> haveInvalidAncestor = new HashSet<>(); Function<Guid, DiskImage> getAncestor = (Guid imageId) -> { DiskImage ancestor = diskImageDao.getAncestor(imageId, getUserID(), getParameters().isFiltered()); if (ancestor == null) { haveInvalidAncestor.add(imageId); } return ancestor; }; Map<Guid, DiskImage> haveValidAncestor = getParameters().getIds().stream() .map(guid -> new Pair<>(guid, getAncestor.apply(guid))) .filter(pair -> pair.getSecond() != null) .collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)); if (!haveInvalidAncestor.isEmpty()) { log.warn("Ancestor is missing for the following image id(s): {}", StringUtils.join(haveInvalidAncestor, ',')); } getQueryReturnValue().setReturnValue(haveValidAncestor); }
Source:
public double computeFor(ASTAnyTypeDeclaration node, MetricOptions options) { JavaOperationSigMask mask = new JavaOperationSigMask(); mask.restrictRolesTo(Role.METHOD, Role.STATIC); mask.restrictVisibilitiesTo(Visibility.PUBLIC); int functionalMethods = countMatchingOpSigs(node, mask); mask.coverAllRoles(); int totalPublicMethods = countMatchingOpSigs(node, mask); return functionalMethods / (totalPublicMethods + 1.); }

Target:
public double computeFor(ASTAnyTypeDeclaration node, MetricOptions options) { JavaOperationSigMask mask = new JavaOperationSigMask(); mask.forbid(Role.CONSTRUCTOR, Role.GETTER_OR_SETTER); mask.restrictVisibilitiesTo(Visibility.PUBLIC); int functionalMethods = countMatchingOpSigs(node, mask); mask.coverAllRoles(); int totalPublicMethods = countMatchingOpSigs(node, mask); return functionalMethods / (double) totalPublicMethods; }
Source:
public static void inputBigint(StatisticalDigestState state, long value, long weight, double accuracy) { checkArgument(accuracy > 0 && accuracy < 1, "Percentile accuracy must be exclusively between 0 and 1, was %s", accuracy); checkArgument(weight > 0, "Weight must be positive, was %s", weight); StatisticalDigest digest = getOrCreateQuantileDigest(state, accuracy); state.addMemoryUsage(-digest.estimatedInMemorySizeInBytes()); digest.add(value, weight); state.addMemoryUsage(digest.estimatedInMemorySizeInBytes()); }

Target:
public static void inputBigint(StatisticalDigestState state, long value, long weight, double accuracy) { StatisticalDigest digest = getOrCreateQuantileDigest(state, verifyAccuracy(accuracy)); state.addMemoryUsage(-digest.estimatedInMemorySizeInBytes()); digest.add(value, verifyWeight(weight)); state.addMemoryUsage(digest.estimatedInMemorySizeInBytes()); }
Source:
public int postEventsFromFile(String file) { try { BufferedReader reader = new BufferedReader( new InputStreamReader( EventReceiverFirehoseTestClient.class.getResourceAsStream( file ) ) ); String s; Collection<Map<String, Object>> events = new ArrayList<Map<String, Object>>(); int totalEventsPosted = 0; while ((s = reader.readLine()) != null) { events.add( (Map<String, Object>) this.jsonMapper.readValue( s, new TypeReference<Map<String, Object>>() { } ) ); ObjectMapper mapper = (totalEventsPosted % 2 == 0) ? jsonMapper : smileMapper; String mediaType = (totalEventsPosted % 2 == 0) ? MediaType.APPLICATION_JSON : SmileMediaTypes.APPLICATION_JACKSON_SMILE; int eventsPosted = postEvents(events, mapper, mediaType); if (eventsPosted != 1) { throw new ISE("Unable to send events to Indexing Service"); } totalEventsPosted += eventsPosted; events = new ArrayList<Map<String, Object>>(); } return totalEventsPosted; } catch (Exception e) { throw Throwables.propagate(e); } }

Target:
public int postEventsFromFile(String file) { try ( BufferedReader reader = new BufferedReader( new InputStreamReader( EventReceiverFirehoseTestClient.class.getResourceAsStream( file ) ) ); ) { String s; Collection<Map<String, Object>> events = new ArrayList<Map<String, Object>>(); int totalEventsPosted = 0; while ((s = reader.readLine()) != null) { events.add( (Map<String, Object>) this.jsonMapper.readValue( s, new TypeReference<Map<String, Object>>() { } ) ); ObjectMapper mapper = (totalEventsPosted % 2 == 0) ? jsonMapper : smileMapper; String mediaType = (totalEventsPosted % 2 == 0) ? MediaType.APPLICATION_JSON : SmileMediaTypes.APPLICATION_JACKSON_SMILE; totalEventsPosted += postEvents(events, mapper, mediaType); ; events = new ArrayList<>(); } if (totalEventsPosted != events.size()) { throw new ISE("All events not posted, expected : %d actual : %d", events.size(), totalEventsPosted); } return totalEventsPosted; } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
public Event updateDeviceState(long deviceId) { DeviceState deviceState = Context.getDeviceManager().getDeviceState(deviceId); if (deviceState == null || deviceState.getMotionState() == null) { return null; } Event result = null; Boolean oldMotion = deviceState.getMotionState(); long currentTime = new Date().getTime(); boolean newMotion = !oldMotion; Position potentialPosition = deviceState.getMotionPosition(); if (potentialPosition != null) { long potentialTime = potentialPosition.getFixTime().getTime() + (newMotion ? tripsConfig.getMinimalTripDuration() : tripsConfig.getMinimalParkingDuration()); if (potentialTime <= currentTime) { String eventType = newMotion ? Event.TYPE_DEVICE_MOVING : Event.TYPE_DEVICE_STOPPED; result = new Event(eventType, potentialPosition.getDeviceId(), potentialPosition.getId()); deviceState.setMotionState(newMotion); deviceState.setMotionPosition(null); } } return result; }

Target:
public Event updateDeviceState(long deviceId) { DeviceState deviceState = Context.getDeviceManager().getDeviceState(deviceId); if (deviceState == null || deviceState.getMotionState() == null) { return null; } Event result = null; Boolean oldMotion = deviceState.getMotionState(); long currentTime = System.currentTimeMillis(); boolean newMotion = !oldMotion; Position motionPosition = deviceState.getMotionPosition(); if (motionPosition != null) { long motionTime = motionPosition.getFixTime().getTime() + (newMotion ? tripsConfig.getMinimalTripDuration() : tripsConfig.getMinimalParkingDuration()); if (motionTime <= currentTime) { String eventType = newMotion ? Event.TYPE_DEVICE_MOVING : Event.TYPE_DEVICE_STOPPED; result = new Event(eventType, motionPosition.getDeviceId(), motionPosition.getId()); deviceState.setMotionState(newMotion); deviceState.setMotionPosition(null); } } return result; }
Source:
public static DescriptorMap register(DescriptorMap map) { Class<?> supportFragmentClass = FragmentApi.tryGetSupportFragmentClass(); if (supportFragmentClass != null) { LogUtil.i("Registering support Fragment descriptor"); map.register(supportFragmentClass, sInstance); } Class<?> fragmentClass = FragmentApi.tryGetFragmentClass(); if (fragmentClass != null) { LogUtil.i("Registering Fragment descriptor"); map.register(fragmentClass, sInstance); } return map; }

Target:
public static DescriptorMap register(DescriptorMap map) { Class<?> supportFragmentClass = FragmentApi.tryGetSupportFragmentClass(); if (supportFragmentClass != null) { LogUtil.d("Registering support Fragment descriptor"); map.register(supportFragmentClass, new FragmentDescriptor()); } Class<?> fragmentClass = FragmentApi.tryGetFragmentClass(); if (fragmentClass != null) { LogUtil.d("Registering Fragment descriptor"); map.register(fragmentClass, new FragmentDescriptor()); } return map; }
Source:
public void generateTargetFile(MotechEvent event) { LOGGER.debug(event.toString()); if(Boolean.valueOf(settingsFacade.getProperty(generateJhFile))) { LOGGER.info("boolean:"+Boolean.valueOf(settingsFacade.getProperty(generateJhFile))); TargetFileNotification[] tfn = generateObdFiles(); if (tfn != null) { ScpHelper scpHelper = new ScpHelper(settingsFacade); for(TargetFileNotification t: tfn) { try { scpHelper.scpObdToRemote(t.getFileName()); } catch (ExecException e) { String error = String.format("Error copying target file %s: %s", t.getFileName(), e.getMessage()); LOGGER.error(error,e); fileAuditRecordDataService.create(new FileAuditRecord( FileType.TARGET_FILE, t.getFileName(), false, error, null, null )); alert(t.getFileName(), "targetFileName", error); return; } sendNotificationRequest(t); } } } else { TargetFileNotification tfn = generateTargetFile(); if (tfn != null) { ScpHelper scpHelper = new ScpHelper(settingsFacade); try { scpHelper.scpObdToRemote(tfn.getFileName()); } catch (ExecException e) { String error = String.format("Error copying target file %s: %s", tfn.getFileName(), e.getMessage()); LOGGER.error(error,e); fileAuditRecordDataService.create(new FileAuditRecord( FileType.TARGET_FILE, tfn.getFileName(), false, error, null, null )); alert(tfn.getFileName(), "targetFileName", error); return; } sendNotificationRequest(tfn); } } }

Target:
public void generateTargetFile(MotechEvent event) { LOGGER.debug(event.toString()); HashMap<String, TargetFileNotification> tfn = generateTargetFile(Boolean.valueOf(settingsFacade.getProperty(generateJhFile))); if (tfn != null) { ScpHelper scpHelper = new ScpHelper(settingsFacade); for(TargetFileNotification t: tfn.values()) { try { scpHelper.scpObdToRemote(t.getFileName()); } catch (ExecException e) { String error = String.format("Error copying target file %s: %s", t.getFileName(), e.getMessage()); LOGGER.error(error,e); fileAuditRecordDataService.create(new FileAuditRecord( FileType.TARGET_FILE, t.getFileName(), false, error, null, null )); alert(t.getFileName(), "targetFileName", error); return; } sendNotificationRequest(t); } } }
Source:
protected void removeDetachedView(@NonNull View child, boolean animate) { if ((animate && child.getAnimation() != null) || (mTransitioningFragmentViews != null && mTransitioningFragmentViews.contains(child))) { addDisappearingFragmentView(child); } super.removeDetachedView(child, animate); }

Target:
protected void removeDetachedView(@NonNull View child, boolean animate) { if (child != mHoldView) { if (animate) { addDisappearingFragmentView(child); } super.removeDetachedView(child, animate); } }
Source:
public void restorePreMothballInfo(Unit unit, Campaign campaign) { if (tech != null) { unit.setTech(tech); } for (Person driver : drivers) { if (driver.getStatus().isActive() && driver.getUnit() == null) { unit.addDriver(driver); } } for (Person gunner : gunners) { if (gunner.getStatus().isActive() && ((gunner.getUnit() == null) || (gunner.getUnit() == unit))) { unit.addGunner(gunner); } } for (Person crew : vesselCrew) { if (crew.getStatus().isActive() && crew.getUnit() == null) { unit.addVesselCrew(crew); } } if (techOfficer != null && techOfficer.getStatus().isActive() && techOfficer.getUnit() == null) { unit.setTechOfficer(techOfficer); } if (navigator != null && navigator.getStatus().isActive() && navigator.getUnit() == null) { unit.setNavigator(navigator); } if (campaign.getForce(forceID) != null) { campaign.addUnitToForce(unit, forceID); } unit.resetEngineer(); }

Target:
public void restorePreMothballInfo(Unit unit, Campaign campaign) { if (tech != null) { unit.setTech(tech); } for (Person driver : drivers) { if (driver.getStatus().isActive() && (driver.getUnit() == null)) { unit.addDriver(driver); } } for (Person gunner : gunners) { if (gunner.getStatus().isActive() && ((gunner.getUnit() == null) || (gunner.getUnit() == unit))) { unit.addGunner(gunner); } } for (Person crew : vesselCrew) { if (crew.getStatus().isActive() && (crew.getUnit() == null)) { unit.addVesselCrew(crew); } } if ((techOfficer != null) && (techOfficer.getStatus().isActive()) && (techOfficer.getUnit() == null)) { unit.setTechOfficer(techOfficer); } if ((navigator != null) && (navigator.getStatus().isActive()) && (navigator.getUnit() == null)) { unit.setNavigator(navigator); } if (campaign.getForce(forceID) != null) { campaign.addUnitToForce(unit, forceID); } unit.resetEngineer(); }
Source:
private ICoreEndpointService getEndpointService() { BundleContext ctx = Activator.ctx; try { ServiceReference<?>[] refs = ctx.getAllServiceReferences(ICoreEndpointService.class.getName(), null); if (refs != null) { for (ServiceReference<?> ref : refs) { ICoreEndpointService plugin = (ICoreEndpointService) ctx.getService(ref); return plugin; } } } catch (InvalidSyntaxException e) { e.printStackTrace(); return null; } return null; }

Target:
private ICoreEndpointService getEndpointService() { BundleContext ctx = Activator.ctx; try { ServiceReference<?>[] refs = ctx.getAllServiceReferences(ICoreEndpointService.class.getName(), null); if (refs != null) { for (ServiceReference<?> ref : refs) { ICoreEndpointService plugin = (ICoreEndpointService) ctx.getService(ref); return plugin; } } } catch (InvalidSyntaxException e) { LOG.error("Couldn't fetch ICoreEndpointService instance", e); } return null; }
Source:
private Set<String> parseFileNames(String input) { Set<String> names = new HashSet<>(); names.addAll(Stream.of(input.split(",")).map(String::trim).collect(Collectors.toList())); return names; }

Target:
private static Set<String> parseFileNames(String input) { Set<String> names = new HashSet<>(); names.addAll(Stream.of(input.split(",")).map(String::trim).collect(Collectors.toList())); return names; }
Source:
public void run() { listBox = new ChosenValueListBox<CarBrand>(getRenderer(), new ProvidesKey<CarBrand>() { @Override public Object getKey(final CarBrand item) { return item == null ? null : item.name(); } }, options); final List<CarBrand> acceptableValues = Lists.newArrayList(CarBrand.values()); if (addNullValue) { acceptableValues.add(0, null); } listBox.setAcceptableValues(acceptableValues); if (!listBox.isAccepted(CarBrand.AUDI)) { throw new AssertionError("Audi is acceptable value"); } RootPanel.get().add(listBox); }

Target:
public void run() { listBox = new ChosenValueListBox<CarBrand>(RENDERER, new ProvidesKey<CarBrand>() { @Override public Object getKey(final CarBrand item) { return item == null ? null : item.name(); } }, options); final List<CarBrand> acceptableValues = Lists.newArrayList(CarBrand.values()); listBox.setAcceptableValues(acceptableValues); if (!listBox.isAccepted(CarBrand.AUDI)) { throw new AssertionError("Audi is acceptable value"); } RootPanel.get().add(listBox); }
Source:
private int applyBinaryOperation( final int firstValue, final String operationDescription, final int secondValue) { switch (operationDescription) { case "plus": return firstValue + secondValue; case "minus": return firstValue - secondValue; case "multiplied by": return firstValue * secondValue; case "divided by": return firstValue / secondValue; case "raised to the power": return (int) Math.pow(firstValue, secondValue); default: throw new IllegalArgumentException("This branch should never be executed."); } }

Target:
private int applyBinaryOperation( final int firstValue, final String operationDescription, final int secondValue) { switch (operationDescription) { case "plus": return firstValue + secondValue; case "minus": return firstValue - secondValue; case "multiplied by": return firstValue * secondValue; case "divided by": return firstValue / secondValue; default: throw new IllegalArgumentException("This branch should never be executed."); } }
Source:
AffinityResourceDefinition(PathElement path) { super(path, UndertowExtension.getResolver(Constants.HANDLER, Constants.AFFINITY, path.getValue()), new ReloadRequiredAddStepHandler(), new ReloadRequiredRemoveStepHandler()); }

Target:
AffinityResourceDefinition(PathElement path) { super(path, UndertowExtension.getResolver(Constants.HANDLER, Constants.AFFINITY, path.getValue())); }
Source:
public static void refreshTreeSelection(TreeViewer viewer, int offset, IDocument document) { ITreeContentProvider contentProvider = (ITreeContentProvider) viewer.getContentProvider(); Object[] objects = contentProvider.getElements(null); SymbolInformation bestSymbol = null; int level = 0; while (objects != null && objects.length > 0) { SymbolInformation nextChild = null; for (Object object : objects) { if (object instanceof SymbolInformation) { SymbolInformation symbol = (SymbolInformation) object; if (isOffsetInSymbolRange(offset, symbol, document)) { nextChild = symbol; objects = contentProvider.getChildren(symbol); break; } } } if (nextChild == null) break; level++; bestSymbol = nextChild; } if (bestSymbol != null) { final int finalLevel = level; final SymbolInformation finalBestSymbol = bestSymbol; Display.getDefault().asyncExec(() -> { viewer.expandToLevel(finalLevel); viewer.setSelection(new StructuredSelection(finalBestSymbol), true); }); } }

Target:
public static void refreshTreeSelection(TreeViewer viewer, int offset, IDocument document) { ITreeContentProvider contentProvider = (ITreeContentProvider) viewer.getContentProvider(); Object[] objects = contentProvider.getElements(null); SymbolInformation bestSymbol = null; int level = 0; while (objects != null && objects.length > 0) { SymbolInformation nextChild = null; for (Object object : objects) { SymbolInformation symbol = object instanceof SymbolInformation ? (SymbolInformation) object : Adapters.adapt(object, SymbolInformation.class); if (symbol != null) { if (isOffsetInSymbolRange(offset, symbol, document)) { nextChild = symbol; objects = contentProvider.getChildren(symbol); break; } } } if (nextChild == null) break; level++; bestSymbol = nextChild; } if (bestSymbol != null) { final int finalLevel = level; final SymbolInformation finalBestSymbol = bestSymbol; Display.getDefault().asyncExec(() -> { viewer.expandToLevel(finalLevel); viewer.setSelection(new StructuredSelection(finalBestSymbol), true); }); } }
Source:
private void loginToStore(String userName, String password) throws Exception { setKeyStoreProperties(); apiStoreClient = new APIStoreRestClient(storeURL); apiStoreClient.login(userName, password); }

Target:
private void loginToStore(String userName, String password) throws Exception { apiStoreClient = new APIStoreRestClient(storeURL); apiStoreClient.login(userName, password); }
Source:
static void verifyCanContinueOnException(CosmosException ex) { if (ex == null) { return; } if (ex instanceof PartitionKeyRangeGoneException) { throw ex; } if (ex instanceof PartitionKeyRangeIsSplittingException) { throw ex; } if (ex instanceof PartitionIsMigratingException) { throw ex; } String value = ex.getResponseHeaders().get(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE); if (Strings.isNullOrWhiteSpace(value)) { return; } Integer result = Integers.tryParse(value); if (result != null && result == 1) { throw ex; } return; }

Target:
static void verifyCanContinueOnException(CosmosException ex) { if (ex instanceof PartitionKeyRangeGoneException) { throw ex; } if (ex instanceof PartitionKeyRangeIsSplittingException) { throw ex; } if (ex instanceof PartitionIsMigratingException) { throw ex; } String value = ex.getResponseHeaders().get(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE); if (Strings.isNullOrWhiteSpace(value)) { return; } Integer result = Integers.tryParse(value); if (result != null && result == 1) { throw ex; } return; }
Source:
private Show(String name) { this.name = name; }

Target:
Show(String name) { this.name = name; }
Source:
private void handleDestroyStoragePoolCommand() { try { runVdsCommand(VDSCommandType.DestroyStoragePool, new IrsBaseVDSCommandParameters(getStoragePool().getId())); } catch (VdcBLLException e) { try { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { runVdsCommand(VDSCommandType.SpmStopOnIrs, new SpmStopOnIrsVDSCommandParameters(getStoragePool().getId())); return null; } }); } catch (Exception e1) { log.error("Failed destroy storage pool with id '{}' and after that failed to stop spm because of {}", getStoragePoolId(), e1.getMessage()); log.debug("Exception", e1); } throw e; } }

Target:
private void handleDestroyStoragePoolCommand() { try { runVdsCommand(VDSCommandType.DestroyStoragePool, new IrsBaseVDSCommandParameters(getStoragePool().getId())); } catch (VdcBLLException e) { try { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { runVdsCommand(VDSCommandType.SpmStopOnIrs, new SpmStopOnIrsVDSCommandParameters(getStoragePool().getId())); return null; } }); } catch (Exception e1) { log.error("Failed destroy storage pool with id '{}' and after that failed to stop spm: {}", getStoragePoolId(), e1.getMessage()); log.debug("Exception", e1); } throw e; } }