auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void cloneNodeContentWithProperties(final GraphCommandExecutionContext context) { final View cloneContent = getClone().getContent(); final View candidateContent = (View) getCandidate().getContent(); final Bounds contentBounds = candidateContent.getBounds(); final CloneManager cloneManager = context.getDefinitionManager().cloneManager(); final Object clonedDefinition = cloneManager.clone(candidateContent.getDefinition(), ClonePolicy.ALL); cloneContent.setBounds(contentBounds); cloneContent.setDefinition(clonedDefinition); }

Target:
void cloneNodeContentWithProperties(final GraphCommandExecutionContext context) { final View cloneContent = getClone().getContent(); final View candidateContent = (View) getCandidate().getContent(); final Bounds candidateBounds = candidateContent.getBounds(); final Bounds clonedBounds = cloneBounds(candidateBounds); final CloneManager cloneManager = context.getDefinitionManager().cloneManager(); final Object clonedDefinition = cloneManager.clone(candidateContent.getDefinition(), ClonePolicy.ALL); cloneContent.setBounds(clonedBounds); cloneContent.setDefinition(clonedDefinition); }
Source:
public ISegmentTrackerImpl(Context context, Config config) { try { this.config = config; String writeKey = config.getSegmentConfig().getSegmentWriteKey(); boolean debugging = context.getResources().getBoolean(R.bool.analytics_debug); int queueSize = context.getResources().getInteger(R.integer.analytics_queue_size); int flushInterval = context.getResources().getInteger(R.integer.analytics_flush_interval); if (writeKey != null) { logger.debug("SegmentTracker created with write key: " + writeKey); Analytics.LogLevel logLevel = Analytics.LogLevel.NONE; if (debugging) logLevel = Analytics.LogLevel.VERBOSE; analytics = new Analytics.Builder(context, writeKey) .flushQueueSize(queueSize) .flushInterval(flushInterval, TimeUnit.SECONDS) .logLevel(logLevel) .build(); } else { logger.warn("writeKey is null, Segment analytics will not work."); } } catch(RuntimeException ex) { logger.error(ex); } catch(Exception ex) { logger.error(ex); } }

Target:
public ISegmentTrackerImpl(Context context, Config config) { try { this.config = config; String writeKey = config.getSegmentConfig().getSegmentWriteKey(); boolean debugging = context.getResources().getBoolean(R.bool.analytics_debug); int queueSize = context.getResources().getInteger(R.integer.analytics_queue_size); int flushInterval = context.getResources().getInteger(R.integer.analytics_flush_interval); if (writeKey != null) { logger.debug("SegmentTracker created with write key: " + writeKey); analytics = new Analytics.Builder(context, writeKey) .flushQueueSize(queueSize) .flushInterval(flushInterval, TimeUnit.SECONDS) .logLevel(debugging ? Analytics.LogLevel.VERBOSE : Analytics.LogLevel.NONE) .build(); } else { logger.warn("writeKey is null, Segment analytics will not work."); } } catch(RuntimeException ex) { logger.error(ex); } catch(Exception ex) { logger.error(ex); } }
Source:
public void testSnapshotRemoteOnBothNodes() throws Exception { IgniteEx ig0 = startGrids(2); ig0.cluster().active(true); for (int i = 0; i < CACHE_KEYS_RANGE; i++) ig0.cache(DEFAULT_CACHE_NAME).put(i, i); CheckpointProgress cpFut = ig0.context() .cache() .context() .database() .forceCheckpoint("the next one"); cpFut.futureFor(CheckpointState.FINISHED).get(); IgniteSnapshotManager mgr0 = ig0.context() .cache() .context() .snapshotMgr(); IgniteSnapshotManager mgr1 = grid(1).context() .cache() .context() .snapshotMgr(); UUID node0 = grid(0).localNode().id(); UUID node1 = grid(1).localNode().id(); IgniteInternalFuture<?> futFrom1To0 = mgr0.createRemoteSnapshot(node1, owningParts(ig0, new HashSet<>(Collections.singletonList(CU.cacheId(DEFAULT_CACHE_NAME))), node1), (part, grp) -> {}); IgniteInternalFuture<?> futFrom0To1 = mgr1.createRemoteSnapshot(node0, owningParts(grid(1), new HashSet<>(Collections.singletonList(CU.cacheId(DEFAULT_CACHE_NAME))), node0), (part, grp) -> {}); futFrom0To1.get(); futFrom1To0.get(); }

Target:
public void testSnapshotRemoteOnBothNodes() throws Exception { IgniteEx ig0 = startGrids(2); ig0.cluster().state(ClusterState.ACTIVE); for (int i = 0; i < CACHE_KEYS_RANGE; i++) ig0.cache(DEFAULT_CACHE_NAME).put(i, i); forceCheckpoint(ig0); IgniteSnapshotManager mgr0 = snp(ig0); IgniteSnapshotManager mgr1 = snp(grid(1)); UUID node0 = grid(0).localNode().id(); UUID node1 = grid(1).localNode().id(); Map<Integer, Set<Integer>> fromNode1 = owningParts(ig0, new HashSet<>(Collections.singletonList(CU.cacheId(DEFAULT_CACHE_NAME))), node1); Map<Integer, Set<Integer>> fromNode0 = owningParts(grid(1), new HashSet<>(Collections.singletonList(CU.cacheId(DEFAULT_CACHE_NAME))), node0); IgniteInternalFuture<?> futFrom1To0 = mgr0.createRemoteSnapshot(node1, fromNode1, (part, pair) -> assertTrue("Received partition has not been requested", fromNode1.get(pair.getGroupId()) .remove(pair.getPartitionId()))); IgniteInternalFuture<?> futFrom0To1 = mgr1.createRemoteSnapshot(node0, fromNode0, (part, pair) -> assertTrue("Received partition has not been requested", fromNode0.get(pair.getGroupId()) .remove(pair.getPartitionId()))); futFrom0To1.get(); futFrom1To0.get(); assertTrue("Not all of partitions have been received: " + fromNode1, fromNode1.get(CU.cacheId(DEFAULT_CACHE_NAME)).isEmpty()); assertTrue("Not all of partitions have been received: " + fromNode0, fromNode0.get(CU.cacheId(DEFAULT_CACHE_NAME)).isEmpty()); }
Source:
protected void init() { T parameters = getParameters(); super.setVmTemplateName(parameters.getName()); VmStatic parameterMasterVm = parameters.getMasterVm(); if (parameterMasterVm != null) { super.setVmId(parameterMasterVm.getId()); setVdsGroupId(parameterMasterVm.getVdsGroupId()); if (VmDeviceUtils.shouldOverrideSoundDevice(getParameters().isSoundDeviceEnabled(), getParameters().getMasterVm(), getVm().getCompatibilityVersion())) { parameters.setSoundDeviceEnabled(parameterMasterVm.getVmType() == VmType.Desktop); } if (getParameters().isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } VmHandler.updateDefaultTimeZone(parameterMasterVm); VmHandler.autoSelectUsbPolicy(getParameters().getMasterVm(), getVdsGroup()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getMasterVm(), getVdsGroup(), getParameters().getGraphicsDevices()); separateCustomProperties(parameterMasterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getVdsGroup() != null && parameterMasterVm != null) { VM vm = new VM(parameterMasterVm, new VmDynamic(), null); vm.setVdsGroupCompatibilityVersion(getVdsGroup().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getVdsGroup().getStoragePoolId()); } updateDiskInfoDestinationMap(); parameters.setUseCinderCommandCallback(!getCinderDisks().isEmpty()); }

Target:
protected void init() { T parameters = getParameters(); super.setVmTemplateName(parameters.getName()); VmStatic parameterMasterVm = parameters.getMasterVm(); if (parameterMasterVm != null) { super.setVmId(parameterMasterVm.getId()); setVdsGroupId(parameterMasterVm.getVdsGroupId()); if (VmDeviceUtils.shouldOverrideSoundDevice(getParameters().isSoundDeviceEnabled(), getParameters().getMasterVm(), getVm().getCompatibilityVersion())) { parameters.setSoundDeviceEnabled(true); } if (getParameters().isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } VmHandler.updateDefaultTimeZone(parameterMasterVm); VmHandler.autoSelectUsbPolicy(getParameters().getMasterVm(), getVdsGroup()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getMasterVm(), getVdsGroup(), getParameters().getGraphicsDevices()); separateCustomProperties(parameterMasterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getVdsGroup() != null && parameterMasterVm != null) { VM vm = new VM(parameterMasterVm, new VmDynamic(), null); vm.setVdsGroupCompatibilityVersion(getVdsGroup().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getVdsGroup().getStoragePoolId()); } updateDiskInfoDestinationMap(); parameters.setUseCinderCommandCallback(!getCinderDisks().isEmpty()); }
Source:
public void updateAdminAccess() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description - updateAdminAccess") .build(); context.restoreAuthSystemState(); BitstreamFormatRest bitstreamFormatRest = converter.fromModel(bitstreamFormat); String token = getAuthToken(admin.getEmail(), password); bitstreamFormatRest.setShortDescription("Test short UPDATED"); getClient(token).perform(put("/api/core/bitstreamformats/" + bitstreamFormat.getID()) .content(mapper.writeValueAsBytes(bitstreamFormatRest)).contentType(contentType)) .andExpect(status().isOk()); getClient().perform(get("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$.description", is(bitstreamFormatRest.getDescription()))) .andExpect(jsonPath("$.shortDescription", is(bitstreamFormatRest.getShortDescription()))) .andExpect(jsonPath("$.mimetype", is(bitstreamFormatRest.getMimetype()))) .andExpect(jsonPath("$.type", is("bitstreamformat"))) .andExpect(jsonPath("$._links.self.href", startsWith(REST_SERVER_URL))) .andExpect(jsonPath("$._links.self.href", endsWith("/api/core/bitstreamformats/" + bitstreamFormat.getID()))); }

Target:
public void updateAdminAccess() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description - updateAdminAccess") .build(); context.restoreAuthSystemState(); BitstreamFormatRest bitstreamFormatRest = converter.fromModel(bitstreamFormat); String token = getAuthToken(admin.getEmail(), password); bitstreamFormatRest.setShortDescription("Test short UPDATED"); getClient(token).perform(put("/api/core/bitstreamformats/" + bitstreamFormat.getID()) .content(mapper.writeValueAsBytes(bitstreamFormatRest)).contentType(contentType)) .andExpect(status().isOk()); getClient().perform(get("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$", Matchers.is( BitstreamFormatMatcher .matchBitstreamFormat(bitstreamFormat.getID(), bitstreamFormatRest.getMimetype(), bitstreamFormatRest.getDescription(), bitstreamFormatRest.getShortDescription()) ))); }
Source:
public static void main(String[] args) throws IOException, TimeoutException, TException, InterruptedException { FProtocolFactory protocolFactory = new FProtocolFactory(new TBinaryProtocol.Factory()); Properties properties = new Properties(); properties.put(Options.PROP_URL, Options.DEFAULT_URL); Options.Builder optionsBuilder = new Options.Builder(properties); Connection conn = Nats.connect(optionsBuilder.build()); FTransport transport = FNatsTransport.of(conn, NatsServer.SERVICE_SUBJECT); transport.open(); FStore.Client storeClient = new FStore.Client(new FServiceProvider(transport, protocolFactory)); Album album = storeClient.buyAlbum(new FContext("corr-id-1"), "ASIN-1290AIUBOA89", "ACCOUNT-12345"); System.out.println("Bought the album: " + album); storeClient.enterAlbumGiveaway(new FContext("corr-id-2"), "kevin@workiva.com", "Kevin"); transport.close(); conn.close(); }

Target:
public static void main(String[] args) throws IOException, TException, InterruptedException { FProtocolFactory protocolFactory = new FProtocolFactory(new TBinaryProtocol.Factory()); Options.Builder optionsBuilder = new Options.Builder().server(Options.DEFAULT_URL); Connection conn = Nats.connect(optionsBuilder.build()); FTransport transport = FNatsTransport.of(conn, NatsServer.SERVICE_SUBJECT); transport.open(); FStore.Client storeClient = new FStore.Client(new FServiceProvider(transport, protocolFactory)); Album album = storeClient.buyAlbum(new FContext("corr-id-1"), "ASIN-1290AIUBOA89", "ACCOUNT-12345"); System.out.println("Bought the album: " + album); storeClient.enterAlbumGiveaway(new FContext("corr-id-2"), "kevin@workiva.com", "Kevin"); transport.close(); conn.close(); }
Source:
public void test_diff_same_user_nodiff() { final UserPersistence userPersistence = new UserPersistence(); final UserHBM userHBM = new UserHBM(); final User user = new User(); userHBM.setPassword("xxx"); user.setPassword("xxx"); userHBM.setCompanyId("yyy"); user.setCompanyId("yyy"); userHBM.setEmailAddress("eee"); user.setEmailAddress("eee"); userHBM.setLayoutIds("iii"); user.setLayoutIds("iii"); userHBM.setUserId("111"); user.setUserId("111"); Assert.assertFalse(userPersistence.diff(userHBM, user)); }

Target:
public void test_diff_same_user_nodiff() { final UserPersistence userPersistence = new UserPersistence(); final UserHBM userHBM = new UserHBM(); final User user = new User(); userHBM.setPassword(TOKEN_XXX); user.setPassword(TOKEN_XXX); userHBM.setCompanyId(TOKEN_YYY); user.setCompanyId(TOKEN_YYY); userHBM.setEmailAddress(TOKEN_EEE); user.setEmailAddress(TOKEN_EEE); userHBM.setLayoutIds(TOKEN_III); user.setLayoutIds(TOKEN_III); userHBM.setUserId(TOKEN_USER_ID); user.setUserId(TOKEN_USER_ID); Assert.assertFalse(userPersistence.diff(userHBM, user)); }
Source:
private Map<String, Object> generateJsonDiskDescription(Map<String, Object> descriptionFields, String... descriptionFieldsPriority) { String diskAlias = descriptionFields.get(DISK_ALIAS).toString(); Map<String, Object> descriptionMap = new TreeMap<>(); int descriptionAvailableLength = METADATA_DESCRIPTION_MAX_LENGTH; for (int priority = 0; priority < descriptionFieldsPriority.length; ++priority) { String fieldName = descriptionFieldsPriority[priority]; String fieldValue = descriptionFields.get(fieldName).toString(); descriptionAvailableLength = addFieldToDescriptionMap(descriptionMap, diskAlias, fieldName, fieldValue, descriptionAvailableLength); if (descriptionAvailableLength <= 0) { String storedFieldValue = (String) descriptionMap.get(fieldName); String[] descriptionFieldsLeft = Arrays.copyOfRange(descriptionFieldsPriority, priority, descriptionFieldsPriority.length); String diskFieldsNames = StringUtils.join(descriptionFieldsLeft, ", ", 0, descriptionFieldsLeft.length); if (storedFieldValue == null) { auditLogFailedToStoreDiskFields(diskAlias, diskFieldsNames); } else if (storedFieldValue.length() < fieldValue.length()) { auditLogFailedToStoreEntireDiskField(diskAlias, fieldName, storedFieldValue, diskFieldsNames); } break; } } return descriptionMap; }

Target:
private Map<String, Object> generateJsonDiskDescription(Map<String, Object> descriptionFields, String... descriptionFieldsPriority) { Map<String, Object> descriptionMap = new TreeMap<>(); int descriptionAvailableLength = METADATA_DESCRIPTION_MAX_LENGTH; for (int priority = 0; priority < descriptionFieldsPriority.length; ++priority) { String fieldName = descriptionFieldsPriority[priority]; String fieldValue = descriptionFields.get(fieldName).toString(); descriptionAvailableLength = addFieldToDescriptionMap(descriptionMap, fieldName, fieldValue, descriptionAvailableLength); if (descriptionAvailableLength < 0) { String diskAlias = descriptionFields.get(DISK_ALIAS).toString(); String storedFieldValue = (String) descriptionMap.get(fieldName); String[] descriptionFieldsLeft = Arrays.copyOfRange(descriptionFieldsPriority, priority, descriptionFieldsPriority.length); String diskFieldsNames = StringUtils.join(descriptionFieldsLeft, ", ", 0, descriptionFieldsLeft.length); if (storedFieldValue == null) { auditLogFailedToStoreDiskFields(diskAlias, diskFieldsNames); } else if (storedFieldValue.length() < fieldValue.length()) { auditLogFailedToStoreEntireDiskField(diskAlias, fieldName, storedFieldValue, diskFieldsNames); } break; } } return descriptionMap; }
Source:
public void metadataImportTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = communityService.create(null, context); collectionService.create(context, community); String fileLocation = configurationService.getProperty("dspace.dir") + testProps.get("test.importcsv") .toString(); String[] args = new String[] {"metadata-import", "-f", fileLocation, "-e", eperson.getEmail(), "-s"}; TestDSpaceRunnableHandler testDSpaceRunnableHandler = new TestDSpaceRunnableHandler(); ScriptLauncher.handleScript(args, ScriptLauncher.getConfig(kernelImpl), testDSpaceRunnableHandler, kernelImpl); Item importedItem = itemService.findAll(context).next(); assertTrue( StringUtils.equals( itemService.getMetadata(importedItem, "dc", "contributor", "author", Item.ANY).get(0).getValue(), "Donald, SmithImported")); }

Target:
public void metadataImportTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = communityService.create(null, context); Collection collection = collectionService.create(context, community); context.restoreAuthSystemState(); String fileLocation = new File(testProps.get("test.importcsv").toString()).getAbsolutePath(); String[] args = new String[] {"metadata-import", "-f", fileLocation, "-e", eperson.getEmail(), "-s"}; TestDSpaceRunnableHandler testDSpaceRunnableHandler = new TestDSpaceRunnableHandler(); ScriptLauncher.handleScript(args, ScriptLauncher.getConfig(kernelImpl), testDSpaceRunnableHandler, kernelImpl); Item importedItem = itemService.findAll(context).next(); assertTrue( StringUtils.equals( itemService.getMetadata(importedItem, "dc", "contributor", "author", Item.ANY).get(0).getValue(), "Donald, SmithImported")); context.turnOffAuthorisationSystem(); itemService.delete(context, itemService.find(context, importedItem.getID())); collectionService.delete(context, collectionService.find(context, collection.getID())); communityService.delete(context, communityService.find(context, community.getID())); context.restoreAuthSystemState(); }
Source:
public void dictionaryNameProviderTestUTF8() throws Exception { TypeKey oldKey = new TypeKey("old"); File dictionaryFile = new File(TestsProperties.getJackRootDir(), "jack/tests/com/android/jack/shrob/obfuscation/nameprovider/dictionaryUTF8.txt"); DictionaryNameProvider dnp = new DictionaryNameProvider(dictionaryFile, new LowerCaseAlphabeticalNameProvider()); Assert.assertEquals("abc", dnp.getNewName(oldKey)); Assert.assertEquals("def", dnp.getNewName(oldKey)); Assert.assertEquals("ghi", dnp.getNewName(oldKey)); Assert.assertEquals("jkl", dnp.getNewName(oldKey)); Assert.assertEquals("mno", dnp.getNewName(oldKey)); Assert.assertEquals("pqr", dnp.getNewName(oldKey)); Assert.assertEquals("stu", dnp.getNewName(oldKey)); Assert.assertEquals("vw$", dnp.getNewName(oldKey)); Assert.assertEquals("xyz_", dnp.getNewName(oldKey)); Assert.assertEquals("éà", dnp.getNewName(oldKey)); Assert.assertEquals("abc", dnp.getNewName(oldKey)); Assert.assertEquals("a", dnp.getNewName(oldKey)); }

Target:
public void dictionaryNameProviderTestUTF8() throws Exception { TypeKey oldKey = new TypeKey("old"); File dictionaryFile = new File(TestsProperties.getJackRootDir(), "jack/tests/com/android/jack/shrob/obfuscation/nameprovider/dictionary-utf8.txt"); DictionaryNameProvider dnp = new DictionaryNameProvider(dictionaryFile, new LowerCaseAlphabeticalNameProvider()); Assert.assertEquals("abc", dnp.getNewName(oldKey)); Assert.assertEquals("def", dnp.getNewName(oldKey)); Assert.assertEquals("ghi", dnp.getNewName(oldKey)); Assert.assertEquals("jkl", dnp.getNewName(oldKey)); Assert.assertEquals("mno", dnp.getNewName(oldKey)); Assert.assertEquals("pqr", dnp.getNewName(oldKey)); Assert.assertEquals("stu", dnp.getNewName(oldKey)); Assert.assertEquals("vw$", dnp.getNewName(oldKey)); Assert.assertEquals("xyz_", dnp.getNewName(oldKey)); Assert.assertEquals("éà", dnp.getNewName(oldKey)); Assert.assertEquals("abc", dnp.getNewName(oldKey)); Assert.assertEquals("a", dnp.getNewName(oldKey)); }
Source:
public void testMessageCountAfterUnsubscribe() throws Exception { String topicName = "myTopic"; String groupId = "groupId"; AmqpConsumerAdapter adapter = createAdapterWithNonDurableConf(topicName, groupId, false); when(mockChannel.messageCount(anyString())).thenReturn(42L); adapter.subscribe((jsonMessage, ackHandler) -> { }); verify(mockChannel).exchangeDeclare(topicName, "fanout", false, true, null); Optional<Long> expectedAnswerWhileSubscribed = Optional.of(42L); Optional<Long> expectedAnswerWhileUnsubscribed = Optional.empty(); Optional<Long> resultWhileSubscribed = adapter.messageCount(); adapter.unsubscribe(); Optional<Long> resultWhileUnsubscribed = adapter.messageCount(); verify(mockChannel, times(1)).messageCount(anyString()); assertEquals(resultWhileSubscribed, expectedAnswerWhileSubscribed); assertEquals(resultWhileUnsubscribed, expectedAnswerWhileUnsubscribed); }

Target:
public void testMessageCountAfterUnsubscribe() throws Exception { String topicName = "myTopic"; String groupId = "groupId"; AmqpConsumerAdapter adapter = createAdapterWithNonDurableConf(topicName, groupId, false); when(mockChannel.messageCount(anyString())).thenReturn(42L); adapter.subscribe((jsonMessage, ackHandler) -> { }); verify(mockChannel).exchangeDeclare(topicName, "fanout", false, true, null); Optional<Long> expectedAnswerWhileSubscribed = Optional.of(42L); Optional<Long> expectedAnswerWhileUnsubscribed = Optional.empty(); Optional<Long> resultWhileSubscribed = adapter.messageCount(); adapter.unsubscribe(); Optional<Long> resultWhileUnsubscribed = adapter.messageCount(); verify(mockChannel, times(1)).messageCount(anyString()); assertEquals(expectedAnswerWhileSubscribed, resultWhileSubscribed); assertEquals(expectedAnswerWhileUnsubscribed, resultWhileUnsubscribed); }
Source:
public ProjectCode makePlaceHolder(String id, String name) { ProjectCode projectCode = new ProjectCode(); projectCode.setUuid(id); projectCode.setCodeName(name); projectCode.setCodeValue(name); projectCode.setCodeGroup(name); return projectCode; }

Target:
public ProjectCode makePlaceHolder(String id, String name) { ProjectCode projectCode = new ProjectCode(); projectCode.setUuid(id); projectCode.setCodeName(id); projectCode.setCodeValue(name); projectCode.setCodeGroup(name); return projectCode; }
Source:
protected Object[] parameterValues() { String partitions = String.format("{%s, %s}", Arrays.toString(p0.getNodes()), Arrays.toString(p1.getNodes())); return concat(super.parameterValues(), partitions); }

Target:
protected Object[] parameterValues() { return concat(super.parameterValues(), description); }
Source:
public void start() throws Exception { logger.trace("Starting Dmx transmitter ..."); transmitter = new DmxTransmitter(this); transmitter.setTransmitRefresh(transmitRefreshMs); transmitterTimer = new Timer(true); transmitterTimer.schedule(transmitter, 0, TRANSMIT_FREQUENCY_MS); logger.trace("Dmx transmitter started."); }

Target:
public void start() throws Exception { logger.trace("Starting Dmx transmitter ..."); transmitter = new DmxTransmitter(this); transmitterTimer = new Timer(true); transmitterTimer.schedule(transmitter, 0, TRANSMIT_FREQUENCY_MS); logger.trace("Dmx transmitter started."); }
Source:
public void testPrepareStitchPoints() { final int expectedAmountJumpPoints = 2; EmbroideryList points = new EmbroideryList(); points.add(new PointF(0, 0)); points.add(new PointF(1000, 1000)); ArrayList<DSTFileGenerator.StitchPoint> stitchPoints = fileGenerator.prepareStitchPoints(points); assertEquals(points.size() + expectedAmountJumpPoints, stitchPoints.size()); int index = 0; for (int i = 0; i < stitchPoints.size(); i++) { if (i > 0) { assertTrue(Math.abs(stitchPoints.get(i - 1).point.x - stitchPoints.get(i).point.x) < DSTFileGenerator .MAXDISTANCE); assertTrue(Math.abs(stitchPoints.get(i - 1).point.y - stitchPoints.get(i).point.y) < DSTFileGenerator .MAXDISTANCE); } if (!stitchPoints.get(i).jump) { PointF point = (PointF) points.get(index); assertEquals(stitchPoints.get(i).point.x, point.x * DSTFileGenerator.STITCHPOINTUNITFACTOR); assertEquals(stitchPoints.get(i).point.y, point.y * DSTFileGenerator.STITCHPOINTUNITFACTOR); index += 1; } } }

Target:
public void testPrepareStitchPoints() { final DSTFileGenerator.StitchPoint[] expectedStitchpoints = new DSTFileGenerator.StitchPoint[]{ new DSTFileGenerator.StitchPoint(new PointF(0, 0)), new DSTFileGenerator.StitchPoint(new PointF(0, 0), true), new DSTFileGenerator.StitchPoint(new PointF(100, 100), true), new DSTFileGenerator.StitchPoint(new PointF(200, 200))}; EmbroideryList points = new EmbroideryList(); points.add(new PointF(0, 0)); points.add(new PointF(100, 100)); ArrayList<DSTFileGenerator.StitchPoint> stitchPoints = fileGenerator.prepareStitchPoints(points); assertArrayEquals(expectedStitchpoints, stitchPoints.toArray()); }
Source:
public void testRequestWithReply() throws Exception { defaultInboundGateway.start(); sendChannel.send(new GenericMessage<String>("test1")); Assert.assertEquals("test1".toUpperCase(), outputChannel.receive().getPayload()); defaultInboundGateway.stop(); }

Target:
public void testRequestWithReply() throws Exception { sendChannel.send(new GenericMessage<String>("test1")); Assert.assertEquals("test1".toUpperCase(), outputChannel.receive(10000).getPayload()); }
Source:
public Lock obtain(Object lockKey) { Assert.isInstanceOf(String.class, lockKey); String path = (String) lockKey; RedisLock lock; synchronized (this.locks) { lock = this.locks.get(path); if (lock == null) { lock = new RedisLock(path); this.locks.put(path, lock); } } return lock; }

Target:
public Lock obtain(Object lockKey) { Assert.isInstanceOf(String.class, lockKey); String path = (String) lockKey; return this.locks.computeIfAbsent(path, RedisLock::new); }
Source:
private void assertOutput(Collection<Page> pages, FluoClient client) throws Exception { JavaRDD<Page> pagesRDD = sc.parallelize(new ArrayList<>(pages)); Assert.assertEquals(pages.size(), pagesRDD.count()); IndexStats stats = new IndexStats(sc); JavaPairRDD<RowColumn, Bytes> accumuloIndex = IndexUtil.createAccumuloIndex(stats, pagesRDD); JavaPairRDD<RowColumn, Bytes> fluoIndex = IndexUtil.createFluoIndex(accumuloIndex, 5).sortByKey(); boolean foundDiff = false; foundDiff |= diffAccumuloTable(accumuloIndex.collect()); foundDiff |= diffFluoTable(client, fluoIndex.collect()); if (foundDiff) { printFluoTable(client); printAccumuloTable(); printRDD(accumuloIndex.collect()); printRDD(fluoIndex.collect()); } Assert.assertFalse(foundDiff); }

Target:
private void assertOutput(Collection<Page> pages, FluoClient client) throws Exception { JavaRDD<Page> pagesRDD = sc.parallelize(new ArrayList<>(pages)); Assert.assertEquals(pages.size(), pagesRDD.count()); IndexStats stats = new IndexStats(sc); JavaPairRDD<RowColumn, Bytes> accumuloIndex = IndexUtil.createAccumuloIndex(stats, pagesRDD); JavaPairRDD<RowColumn, Bytes> fluoIndex = IndexUtil.createFluoIndex(accumuloIndex, FluoApp.NUM_BUCKETS); boolean foundDiff = false; foundDiff |= diffAccumuloTable(accumuloIndex.collect()); foundDiff |= diffFluoTable(client, fluoIndex.collect()); if (foundDiff) { printFluoTable(client); printAccumuloTable(); printRDD(accumuloIndex.collect()); printRDD(fluoIndex.collect()); } Assert.assertFalse(foundDiff); }
Source:
public CompositeIOException(String message, @NonNull List<IOException> exceptions) { super(message); if (exceptions.size() > EXCEPTION_LIMIT) { this.exceptions = new ArrayList<>(exceptions.subList(0, EXCEPTION_LIMIT)); this.exceptions.add(new ExceptionLimitReached(exceptions.size() - EXCEPTION_LIMIT)); } else { this.exceptions = exceptions; } this.exceptions.forEach(this::addSuppressed); }

Target:
public CompositeIOException(String message, @NonNull List<IOException> exceptions) { super(message + getDiscardedExceptionsMessage(exceptions)); if (exceptions.size() > EXCEPTION_LIMIT) { this.exceptions = new ArrayList<>(exceptions.subList(0, EXCEPTION_LIMIT)); } else { this.exceptions = exceptions; } this.exceptions.forEach(this::addSuppressed); }
Source:
public BasicBatchInformation(int batchSize, Task task, Column column ) { Preconditions.checkNotNull(task); Preconditions.checkNotNull(column); this.batchSize = batchSize; this.task = task; this.column = column; }

Target:
public BasicBatchInformation(int batchSize, Task task, Column column ) { this.task = Preconditions.checkNotNull(task); this.column = Preconditions.checkNotNull(column); Preconditions.checkArgument(batchSize > 0); this.batchSize = batchSize; }
Source:
private void addSystemWideContainerSettings(String workspaceId, boolean isDev, CheServiceImpl composeService) throws IOException { List<String> portsToExpose; List<String> volumes; Map<String, String> env; if (isDev) { portsToExpose = devMachinePortsToExpose; volumes = new ArrayList<>(devMachineSystemVolumes.size() + 1); volumes.addAll(devMachineSystemVolumes); String projectFolderVolume = format("%s:%s", workspaceFolderPathProvider.getPath(workspaceId), projectFolderPath); if (volumeOptions != null && !volumeOptions.isEmpty()) { projectFolderVolume = projectFolderVolume + ":" + volumeOptions; } volumes.add(SystemInfo.isWindows() ? escapePath(projectFolderVolume) : projectFolderVolume); env = new HashMap<>(devMachineEnvVariables); env.put(DockerInstanceRuntimeInfo.CHE_WORKSPACE_ID, workspaceId); env.put(DockerInstanceRuntimeInfo.USER_TOKEN, getUserToken(workspaceId)); } else { portsToExpose = commonMachinePortsToExpose; env = commonMachineEnvVariables; volumes = commonMachineSystemVolumes; } composeService.getExpose().addAll(portsToExpose); composeService.getEnvironment().putAll(env); composeService.getVolumes().addAll(volumes); composeService.getNetworks().addAll(additionalNetworks); }

Target:
private void addSystemWideContainerSettings(String workspaceId, boolean isDev, CheServiceImpl composeService) throws IOException { List<String> portsToExpose; List<String> volumes; Map<String, String> env; if (isDev) { portsToExpose = devMachinePortsToExpose; volumes = devMachineSystemVolumes; env = new HashMap<>(devMachineEnvVariables); env.put(DockerInstanceRuntimeInfo.CHE_WORKSPACE_ID, workspaceId); env.put(DockerInstanceRuntimeInfo.USER_TOKEN, getUserToken(workspaceId)); } else { portsToExpose = commonMachinePortsToExpose; env = commonMachineEnvVariables; volumes = commonMachineSystemVolumes; } composeService.getExpose().addAll(portsToExpose); composeService.getEnvironment().putAll(env); composeService.getVolumes().addAll(volumes); composeService.getNetworks().addAll(additionalNetworks); }
Source:
protected NonNullList<ItemStack> harvestBlock(World world, BlockPos pos) { NonNullList<ItemStack> harvested = NonNullList.create(); if (PluginIC2.rubberWood != null && ItemStackUtil.equals(world.getBlockState(pos).getBlock(), PluginIC2.rubberWood)) { harvested.add(PluginIC2.resin.copy()); } else if (PluginTechReborn.RUBBER_WOOD != null && ItemStackUtil.equals(world.getBlockState(pos).getBlock(), PluginTechReborn.RUBBER_WOOD)) { harvested.add(PluginTechReborn.sap.copy()); } PacketFXSignal packet = new PacketFXSignal(PacketFXSignal.VisualFXType.BLOCK_BREAK, PacketFXSignal.SoundFXType.BLOCK_BREAK, pos, blockState); NetworkUtil.sendNetworkPacket(packet, pos, world); world.setBlockState(pos, replantState, Constants.FLAG_BLOCK_SYNC); return harvested; }

Target:
protected NonNullList<ItemStack> harvestBlock(World world, BlockPos pos) { NonNullList<ItemStack> harvested = NonNullList.create(); Block harvestBlock = world.getBlockState(pos).getBlock(); if (PluginIC2.rubberWood != null && ItemStackUtil.equals(harvestBlock, PluginIC2.rubberWood)) { harvested.add(PluginIC2.resin.copy()); } else if (PluginTechReborn.RUBBER_WOOD != null && ItemStackUtil.equals(harvestBlock, PluginTechReborn.RUBBER_WOOD)) { harvested.add(PluginTechReborn.sap.copy()); } PacketFXSignal packet = new PacketFXSignal(PacketFXSignal.VisualFXType.BLOCK_BREAK, PacketFXSignal.SoundFXType.BLOCK_BREAK, pos, blockState); NetworkUtil.sendNetworkPacket(packet, pos, world); world.setBlockState(pos, replantState, Constants.FLAG_BLOCK_SYNC); return harvested; }
Source:
public <T> void put(final String dataType, final long id, final T value) { if (!router.isLocal(id)) { LOG.log(Level.INFO, "This id is not local: {0}", id); return; } readWriteLock.writeLock().lock(); try { if (!dataMap.containsKey(dataType)) { dataMap.put(dataType, new TreeMap<Long, Object>()); } dataMap.get(dataType).put(id, value); } finally { readWriteLock.writeLock().unlock(); } }

Target:
public <T> void put(final String dataType, final long id, final T value) { if (!router.isLocal(id)) { LOG.log(Level.WARNING, "This id is not local: {0}", id); return; } readWriteLock.writeLock().lock(); try { if (!dataMap.containsKey(dataType)) { dataMap.put(dataType, new TreeMap<Long, Object>()); } dataMap.get(dataType).put(id, value); } finally { readWriteLock.writeLock().unlock(); } }
Source:
public static boolean saveNote(Note note, boolean shouldUpdate) { getDb().beginTransaction(); boolean saved = false; try { if (!shouldUpdate && NotificationsTable.getNoteById(note.getId()) != null) { return false; } saved = putNote(note); getDb().setTransactionSuccessful(); } finally { getDb().endTransaction(); } return saved; }

Target:
public static boolean saveNote(Note note, boolean shouldUpdate) { getDb().beginTransaction(); boolean saved = false; try { if (!shouldUpdate && isNoteAvailable(note.getId())) { return false; } saved = putNote(note); getDb().setTransactionSuccessful(); } finally { getDb().endTransaction(); } return saved; }
Source:
private void checkParameters(List<String> geneIds, String species, String assembly, Integer bufferValue) throws IllegalArgumentException { List<String> filteredGeneIds = geneIds.stream().filter(geneId -> geneId.isEmpty() == false). collect(Collectors.toList()); geneIds.clear(); geneIds.addAll(filteredGeneIds); if (geneIds.size() == 0) { throw new IllegalArgumentException("Please specify geneIds"); } if (species.isEmpty()) { throw new IllegalArgumentException("Please specify a species"); } if (assembly.isEmpty()) { throw new IllegalArgumentException("Please specify an assembly"); } if (bufferValue < 0) { throw new IllegalArgumentException("Pleas specify a non-negative integer value for buffer"); } }

Target:
private void checkParameters(List<String> geneIds, String species, String assembly, Integer bufferValue) throws IllegalArgumentException { List<String> filteredGeneIds = geneIds.stream().filter(geneId -> geneId.isEmpty() == false). collect(Collectors.toList()); geneIds.clear(); geneIds.addAll(filteredGeneIds); if (geneIds.isEmpty()) { throw new IllegalArgumentException("Please specify geneIds"); } if (species.isEmpty()) { throw new IllegalArgumentException("Please specify a species"); } if (assembly.isEmpty()) { throw new IllegalArgumentException("Please specify an assembly"); } if (bufferValue < 0) { throw new IllegalArgumentException("Pleas specify a non-negative integer value for buffer"); } }
Source:
public long getRecentlyPlayedCutoffTimeMillis() { return getCutoffTimeMillis(LAST_PLAYED_CUTOFF); }

Target:
public long getRecentlyPlayedCutoffTimeMillis() { return getCutoffTimeMillis(RECENTLY_PLAYED_CUTOFF); }
Source:
public String createSubscription(SitemapSubscriptionCallback callback) { if (callbacks.size() >= maxSubscriptions) { logger.debug("No new subscription delivered as limit ({}) is already reached", maxSubscriptions); return null; } String subscriptionId = UUID.randomUUID().toString(); callbacks.put(subscriptionId, callback); logger.debug("Created new subscription with id ({} active subscriptions for a max of {})", subscriptionId, callbacks.size(), maxSubscriptions); return subscriptionId; }

Target:
public String createSubscription(SitemapSubscriptionCallback callback) { if (maxSubscriptions >= 0 && callbacks.size() >= maxSubscriptions) { logger.debug("No new subscription delivered as limit ({}) is already reached", maxSubscriptions); return null; } String subscriptionId = UUID.randomUUID().toString(); callbacks.put(subscriptionId, callback); logger.debug("Created new subscription with id ({} active subscriptions for a max of {})", subscriptionId, callbacks.size(), maxSubscriptions); return subscriptionId; }
Source:
Integer safeGet(String key) { if (containsKey(key)) { return get(key); } else { System.out.println(key + " unknown"); return get("UNK"); } }

Target:
Integer safeGet(String key) { if (containsKey(key)) { return get(key); } else { return get("UNK"); } }
Source:
public void autoGC(ProgressMonitor monitor) { boolean background = monitor instanceof NullProgressMonitor && gcAutoDetach(); File gcLog = new File(getDirectory(), "gc.log"); final LockFile lck = new LockFile(gcLog); try { if (!lck.lock()) { return; } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } try { FileTime lastModified = Files.getLastModifiedTime(gcLog.toPath()); if (lastModified.toInstant().compareTo(getLogExpiry()) < 0) { try { if (!background) { String oldError = new String(Files.readAllBytes(gcLog.toPath())); throw new JGitInternalException("A previous GC run reported an error: " + oldError + "\nAutomatic gc will fail until the file " + gcLog + " is removed"); } } finally { lck.unlock(); } return; } } catch (NoSuchFileException e) { } catch (IOException | ParseException e) { throw new JGitInternalException(e.getMessage(), e); } Runnable gcTask = () -> { try { GC gc = new GC(this); gc.setPackConfig(new PackConfig(this)); gc.setProgressMonitor(monitor); gc.setAuto(true); gc.gc(); lck.unlock(); gcLog.delete(); } catch (IOException | ParseException e) { if (background) { try { lck.write(e.getMessage().getBytes()); lck.commit(); } catch (IOException e2) { e2.addSuppressed(e); LOG.error(e2.getMessage(), e); lck.unlock(); } } else { throw new JGitInternalException(e.getMessage(), e); } } }; if (background) { Thread thread = new Thread(gcTask); thread.start(); } else { gcTask.run(); } }

Target:
public void autoGC(ProgressMonitor monitor) { GcLog gcLog = new GcLog(this); boolean background = monitor instanceof NullProgressMonitor && shouldAutoDetach(); if (gcLog.lock(background)) { return; } Runnable gcTask = () -> { try { GC gc = new GC(this); gc.setPackConfig(new PackConfig(this)); gc.setProgressMonitor(monitor); gc.setAuto(true); gc.gc(); gcLog.cleanUp(); } catch (IOException | ParseException e) { if (background) { try { gcLog.write(e.getMessage().getBytes()); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); gcLog.write(sw.toString().getBytes(StandardCharsets.UTF_8)); gcLog.commit(); } catch (IOException e2) { e2.addSuppressed(e); LOG.error(e2.getMessage(), e2); } } else { throw new JGitInternalException(e.getMessage(), e); } } finally { gcLog.unlock(); } }; if (background) { Thread thread = new Thread(gcTask); thread.start(); } else { gcTask.run(); } }
Source:
void setUp() { boundedContext = BlackBoxBoundedContext.singletenant() .with(new DotSpace()); }

Target:
void setUp() { boundedContext = BlackBoxBoundedContext .newInstance() .with(new DotSpace()); }
Source:
private void processWeakCounterConfiguration(XMLExtendedStreamWriter writer, ModelNode weakConfiguration) throws XMLStreamException { writer.writeStartElement(Element.WEAK_COUNTER.getLocalName()); this.writeRequired(writer, Attribute.NAME, weakConfiguration, ModelKeys.NAME); this.writeRequired(writer, Attribute.INITIAL_VALUE, weakConfiguration, ModelKeys.INITIAL_VALUE); this.writeRequired(writer, Attribute.STORAGE, weakConfiguration, ModelKeys.STORAGE); this.writeOptional(writer, Attribute.CONCURRENCY_LEVEL, weakConfiguration, ModelKeys.CONCURRENCY_LEVEL); writer.writeEndElement(); }

Target:
private void processWeakCounterConfiguration(XMLExtendedStreamWriter writer, ModelNode weakConfiguration) throws XMLStreamException { writer.writeStartElement(Element.WEAK_COUNTER.getLocalName()); this.writeRequired(writer, Attribute.NAME, weakConfiguration, ModelKeys.NAME); this.writeOptional(writer, Attribute.INITIAL_VALUE, weakConfiguration, ModelKeys.INITIAL_VALUE); this.writeOptional(writer, Attribute.STORAGE, weakConfiguration, ModelKeys.STORAGE); this.writeOptional(writer, Attribute.CONCURRENCY_LEVEL, weakConfiguration, ModelKeys.CONCURRENCY_LEVEL); writer.writeEndElement(); }
Source:
synchronized List<IngestModuleError> process(FileIngestTask task) { List<IngestModuleError> errors = new ArrayList<>(); if (!this.job.isCancelled()) { AbstractFile file = task.getFile(); for (PipelineModule module : this.modules) { try { FileIngestPipeline.ingestManager.setIngestTaskProgress(task, module.getDisplayName()); this.job.setCurrentFileIngestModule(module.getDisplayName(), task.getFile().getName()); module.process(file); } catch (Throwable ex) { errors.add(new IngestModuleError(module.getDisplayName(), ex)); String msg = ex.getMessage(); if (msg == null) { msg = ex.toString(); } MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "FileIngestPipeline.moduleError.title.text", module.getDisplayName()), msg); } if (this.job.isCancelled()) { break; } } try{ file.save(Case.getCurrentCase().getSleuthkitCase()); } catch (TskCoreException ex){ Logger.getLogger(FileIngestPipeline.class.getName()).log(Level.SEVERE, "Failed to save data", ex); } file.close(); if (!this.job.isCancelled()) { IngestManager.getInstance().fireFileIngestDone(file); } } FileIngestPipeline.ingestManager.setIngestTaskProgressCompleted(task); return errors; }

Target:
synchronized List<IngestModuleError> process(FileIngestTask task) { List<IngestModuleError> errors = new ArrayList<>(); if (!this.job.isCancelled()) { AbstractFile file = task.getFile(); for (PipelineModule module : this.modules) { try { FileIngestPipeline.ingestManager.setIngestTaskProgress(task, module.getDisplayName()); this.job.setCurrentFileIngestModule(module.getDisplayName(), task.getFile().getName()); module.process(file); } catch (Throwable ex) { errors.add(new IngestModuleError(module.getDisplayName(), ex)); String msg = ex.getMessage(); if (msg == null) { msg = ex.toString(); } MessageNotifyUtil.Notify.error(NbBundle.getMessage(this.getClass(), "FileIngestPipeline.moduleError.title.text", module.getDisplayName()), msg); } if (this.job.isCancelled()) { break; } } if (!this.job.isCancelled()) { try{ file.save(Case.getCurrentCase().getSleuthkitCase()); } catch (TskCoreException ex){ Logger.getLogger(FileIngestPipeline.class.getName()).log(Level.SEVERE, "Failed to save data for file " + file.getId(), ex); } IngestManager.getInstance().fireFileIngestDone(file); } file.close(); } FileIngestPipeline.ingestManager.setIngestTaskProgressCompleted(task); return errors; }
Source:
public void clearAllStores(AccessMode mode) { runnableWithReadLockAndAvailabilityCheck(() -> { Consumer<CacheWriter> clearWriter = writer -> { if (writer instanceof AdvancedCacheWriter) { if (mode.canPerform(getStoreConfig(writer))) { ((AdvancedCacheWriter) writer).clear(); } } }; nonTxWriters.forEach(clearWriter); txWriters.forEach(clearWriter); }); }

Target:
public void clearAllStores(AccessMode mode) { storesMutex.readLock().lock(); try { checkStoreAvailability(); Consumer<CacheWriter> clearWriter = writer -> { if (writer instanceof AdvancedCacheWriter) { if (mode.canPerform(getStoreConfig(writer))) { ((AdvancedCacheWriter) writer).clear(); } } }; nonTxWriters.forEach(clearWriter); txWriters.forEach(clearWriter); } finally { storesMutex.readLock().unlock(); } }
Source:
public void shouldDelegateToStatusOnPermanentlyRedirectToControllerInstance() throws Exception { Status status = mockResult(Status.class); result.permanentlyRedirectTo(new RandomController()); verify(status).movedPermanentlyTo(RandomController.class); verify(messages).assertAbsenceOfErrors(); }

Target:
public void shouldDelegateToStatusOnPermanentlyRedirectToControllerInstance() throws Exception { Status status = mockResult(Status.class); result.permanentlyRedirectTo(new RandomController()); verify(status).movedPermanentlyTo(RandomController.class); }
Source:
public void process(final HashMap<String, String> json) { LOG.debug("Try to index " + json.get(Properties.ID.getName()) + " in ES type " + json.get(Properties.TYPE.getName()) + " Source:" + json.get(Properties.GRAPH.getName())); updateRequest = new UpdateRequest(indexName, json.get(Properties.TYPE.getName()), json.get(Properties.ID.getName())); updateRequest.doc(json.get(Properties.GRAPH.getName())); updateRequest.docAsUpsert(true); if (json.containsKey(Properties.PARENT.getName())) { updateRequest.parent(json.get(Properties.PARENT.getName())); } if (json.get(Properties.ID.getName()).startsWith("HT018786244")) { System.out.println(); } bulkRequest.add(updateRequest); docs++; while (docs > bulkSize && retries > 0) { try { bulkRequest.execute().actionGet(); docs = 0; bulkRequest = client.prepareBulk(); bulkRequest.setRefresh(false); break; } catch (final NoNodeAvailableException e) { retries--; try { Thread.sleep(10000); } catch (final InterruptedException x) { x.printStackTrace(); } LOG.warn("Retry indexing record" + json.get(Properties.ID.getName()) + ":" + e.getMessage() + " (" + retries + " more retries)"); } } }

Target:
public void process(final HashMap<String, String> json) { LOG.debug("Try to index " + json.get(Properties.ID.getName()) + " in ES type " + json.get(Properties.TYPE.getName()) + " Source:" + json.get(Properties.GRAPH.getName())); updateRequest = new UpdateRequest(indexName, json.get(Properties.TYPE.getName()), json.get(Properties.ID.getName())); updateRequest.doc(json.get(Properties.GRAPH.getName())); updateRequest.docAsUpsert(true); if (json.containsKey(Properties.PARENT.getName())) { updateRequest.parent(json.get(Properties.PARENT.getName())); } bulkRequest.add(updateRequest); docs++; while (docs > bulkSize && retries > 0) { try { bulkRequest.execute().actionGet(); docs = 0; bulkRequest = client.prepareBulk(); bulkRequest.setRefresh(false); break; } catch (final NoNodeAvailableException e) { retries--; try { Thread.sleep(10000); } catch (final InterruptedException x) { x.printStackTrace(); } LOG.warn("Retry indexing record" + json.get(Properties.ID.getName()) + ":" + e.getMessage() + " (" + retries + " more retries)"); } } }
Source:
public void dispose() { phone.mCM.unregisterForRUIMReady(this); phone.mCM.unregisterForOffOrNotAvailable( this); phone.mCM.unSetOnIccRefresh(this); this.removeCallbacksAndMessages(null); this.recordsLoadedRegistrants = null; this.phone = null; }

Target:
public void dispose() { phone.mCM.unregisterForRUIMReady(this); phone.mCM.unregisterForOffOrNotAvailable( this); phone.mCM.unSetOnIccRefresh(this); }
Source:
public void refreshVdsRunTimeInfo() { boolean isVdsUpOrGoingToMaintenance = vds.getStatus() == VDSStatus.Up || vds.getStatus() == VDSStatus.PreparingForMaintenance || vds.getStatus() == VDSStatus.Error || vds.getStatus() == VDSStatus.NonOperational; try { if (isVdsUpOrGoingToMaintenance) { if (vdsManager.isTimeToRefreshStatistics() || vds.getStatus() == VDSStatus.PreparingForMaintenance) { refreshVdsStats(isVdsUpOrGoingToMaintenance); } else { refreshVdsRunTimeInfo(isVdsUpOrGoingToMaintenance); } } else { refreshCapabilities(); } } catch (VDSRecoveringException e) { handleVDSRecoveringException(vds, e); } catch (ClassCastException cce) { handleClassCastException(cce); } catch (Throwable t) { log.error("Failure to refresh host '{}' runtime info: {}", vds.getName(), t.getMessage()); log.debug("Exception", t); throw t; } }

Target:
public void refreshVdsRunTimeInfo() { try { boolean isVdsUpOrGoingToMaintenance = vds.getStatus() == VDSStatus.Up || vds.getStatus() == VDSStatus.PreparingForMaintenance || vds.getStatus() == VDSStatus.Error || vds.getStatus() == VDSStatus.NonOperational; if (isVdsUpOrGoingToMaintenance) { if (vdsManager.isTimeToRefreshStatistics() || vds.getStatus() == VDSStatus.PreparingForMaintenance) { refreshVdsStats(isVdsUpOrGoingToMaintenance); } else { refreshVdsRunTimeInfo(isVdsUpOrGoingToMaintenance); } } else { refreshCapabilities(); } } catch (VDSRecoveringException e) { handleVDSRecoveringException(vds, e); } catch (ClassCastException cce) { handleClassCastException(cce); } catch (Throwable t) { log.error("Failure to refresh host '{}' runtime info: {}", vds.getName(), t.getMessage()); log.debug("Exception", t); throw t; } }