auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk() { List<OvfEntityData> ovfEntitiesFromTar = Collections.emptyList(); List<DiskImage> ovfStoreDiskImages = new ArrayList(getAllOVFDisks()); if (!ovfStoreDiskImages.isEmpty()) { boolean entitiesRetrieved = false; while (!ovfStoreDiskImages.isEmpty()) { Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(ovfStoreDiskImages); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { if (!entitiesRetrieved) { try { VDSReturnValue retrievedByteData = runVdsCommand(VDSCommandType.RetrieveImageData, new ImageHttpAccessVDSCommandParameters(getVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond())); if (retrievedByteData.getSucceeded()) { ovfEntitiesFromTar = OvfUtils.getOvfEntities((byte[]) retrievedByteData.getReturnValue(), getParameters().getStorageDomainId()); entitiesRetrieved = true; } else { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}", ovfDisk.getId(), getParameters().getStorageDomainId()); } } catch (RuntimeException e) { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}. Error: {2}", ovfDisk.getId(), getParameters().getStorageDomainId(), e); } } ovfStoreDiskImages.remove(ovfDisk); } } if (!entitiesRetrieved) { AuditLogDirector.log(this, AuditLogType.RETRIEVE_OVF_STORE_FAILED); } } else { log.warnFormat("There are no OVF_STORE disks on storage domain id {0}", getParameters().getStorageDomainId()); } return ovfEntitiesFromTar; }

Target:
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk() { List<DiskImage> ovfStoreDiskImages = new ArrayList(getAllOVFDisks()); if (!ovfStoreDiskImages.isEmpty()) { while (!ovfStoreDiskImages.isEmpty()) { Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(ovfStoreDiskImages); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { try { VDSReturnValue retrievedByteData = runVdsCommand(VDSCommandType.RetrieveImageData, new ImageHttpAccessVDSCommandParameters(getVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond())); if (retrievedByteData.getSucceeded()) { return OvfUtils.getOvfEntities((byte[]) retrievedByteData.getReturnValue(), getParameters().getStorageDomainId()); } else { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}", ovfDisk.getId(), getParameters().getStorageDomainId()); } } catch (RuntimeException e) { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}. Error: {2}", ovfDisk.getId(), getParameters().getStorageDomainId(), e); } ovfStoreDiskImages.remove(ovfDisk); } } AuditLogDirector.log(this, AuditLogType.RETRIEVE_OVF_STORE_FAILED); } else { log.warnFormat("There are no OVF_STORE disks on storage domain id {0}", getParameters().getStorageDomainId()); } return Collections.emptyList(); }
Source:
protected String getClassProperty() { return super.getClassProperty() + ' ' + this.currentContext.getCurrentMacroBlock().getId() + "message"; }

Target:
protected String getClassProperty() { return super.getClassProperty() + ' ' + this.getDescriptor().getId().getId() + "message"; }
Source:
private void handleException(Throwable err) { Handler<Throwable> handler; synchronized (this) { if ((handler = exceptionHandler) == null) { log.error("Unhandled exception", err); return; } } handler.handle(err); }

Target:
private void handleException(Throwable err) { Handler<Throwable> handler; synchronized (this) { if ((handler = exceptionHandler) == null) { return; } } handler.handle(err); }
Source:
protected void assertIndexUsed(IgniteCache<?, ?> cache, String sql, String idx) throws IgniteCheckedException { AtomicReference<String> currPlan = new AtomicReference<>(); boolean res = GridTestUtils.waitForCondition(new PA() { @Override public boolean apply() { String plan = explainPlan(cache, sql); currPlan.set(plan); return plan.contains(idx.toLowerCase()); } }, 1_000); assertTrue("Query \"" + sql + "\" executed without usage of " + idx + ", see plan:\n\"" + currPlan.get() + "\"", res); }

Target:
protected void assertIndexUsed(IgniteCache<?, ?> cache, String sql, String idx) throws IgniteCheckedException { AtomicReference<String> currPlan = new AtomicReference<>(); boolean res = GridTestUtils.waitForCondition(() -> { String plan = explainPlan(cache, sql); currPlan.set(plan); return plan.contains(idx.toLowerCase()); }, 1_000); assertTrue("Query \"" + sql + "\" executed without usage of " + idx + ", see plan:\n\"" + currPlan.get() + "\"", res); }
Source:
public int hashCode() { int hash = 7; hash = 31 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 31 * hash + (this.javaType != null ? this.javaType.hashCode() : 0); hash = 31 * hash + (this.guid != null ? this.guid.hashCode() : 0); return hash; }

Target:
public int hashCode() { int hash = 7; hash = 31 * hash + (this.guid != null ? this.guid.hashCode() : 0); return hash; }
Source:
private void assertCanDoActionMessage(VdcBllMessages msg) { assertTrue("canDoAction failed for the wrong reason", command.getReturnValue() .getCanDoActionMessages() .contains(msg.toString())); }

Target:
private void assertCanDoActionMessage(VdcBllMessages msg) { assertTrue("canDoAction failed for the wrong reason", command.getReturnValue() .getCanDoActionMessages() .contains(msg.name())); }
Source:
public void testUnescape() { assertEquals("a\"b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\"b")).toString()); assertEquals("a\\b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\b")).toString()); assertEquals("a\\\"b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\\\\"b")).toString()); assertEquals("\\\"", VisibilityEvaluator.unescape(new ArrayByteSequence("\\\\\\\"")).toString()); assertEquals("a\\b\\c\\d", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\b\\\\c\\\\d")).toString()); try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\\b")); fail(); } catch (IllegalArgumentException e) try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\\b\\c")); fail(); } catch (IllegalArgumentException e) try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\"b\\")); fail(); } catch (IllegalArgumentException e) }

Target:
public void testUnescape() { assertEquals("a\"b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\"b")).toString()); assertEquals("a\\b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\b")).toString()); assertEquals("a\\\"b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\\\\"b")).toString()); assertEquals("\\\"", VisibilityEvaluator.unescape(new ArrayByteSequence("\\\\\\\"")).toString()); assertEquals("a\\b\\c\\d", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\b\\\\c\\\\d")).toString()); try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\\b")); fail("Expected failure to unescape invalid escape sequence"); } catch (IllegalArgumentException e) try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\\b\\c")); fail("Expected failure to unescape invalid escape sequence"); } catch (IllegalArgumentException e) try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\"b\\")); fail("Expected failure to unescape invalid escape sequence"); } catch (IllegalArgumentException e) }
Source:
public StatsManagerTest() throws IOException, StoreException { tempDir = StoreTestUtils.createTempDirectory("nodeStatsDir-" + UtilsTest.getRandomString(10)); outputFileString = (new File(tempDir.getAbsolutePath(), "stats_output.json")).getAbsolutePath(); long[][] testData1 = new long[][]{{100, 200, 300}, {100}, {200, 300}}; long[][] testData2 = new long[][]{{10}, {50}}; long[][] testData3 = new long[][]{{1000}, {200}, {300}, {10, 20, 30, 40, 50}}; List<StatsSnapshot> statsSnapshots = new ArrayList<>(); statsSnapshots.add(generateStatsSnapshot(testData1)); statsSnapshots.add(generateStatsSnapshot(testData2)); statsSnapshots.add(generateStatsSnapshot(testData3)); storeMap = new HashMap<>(); MetricRegistry registry = new MetricRegistry(); StorageManagerMetrics metrics = new StorageManagerMetrics(registry); for (int i = 0; i < 3; i++) { PartitionId id = new Partition(i, PartitionState.READ_WRITE, 1024 * 1024 * 1024); Store store = new MockBlobStore(UtilsTest.getRandomString(10), metrics, new MockBlobStoreStats(statsSnapshots.get(i))); storeMap.put(id, store); } storeMap.put(new Partition(1000, PartitionState.READ_WRITE, 1024 * 1024 * 1024), null); StorageManager storageManager = new MockStorageManager(storeMap); Properties properties = new Properties(); properties.put("stats.output.file.path", outputFileString); StatsManagerConfig config = new StatsManagerConfig(new VerifiableProperties(properties)); statsManager = new StatsManager(storageManager, new ArrayList<>(storeMap.keySet()), new MetricRegistry(), config, SystemTime.getInstance()); }

Target:
public StatsManagerTest() throws IOException, StoreException { tempDir = StoreTestUtils.createTempDirectory("nodeStatsDir-" + UtilsTest.getRandomString(10)); outputFileString = (new File(tempDir.getAbsolutePath(), "stats_output.json")).getAbsolutePath(); storeMap = new HashMap<>(); preAggregatedSnapshot = generateRandomSnapshot(); Pair<StatsSnapshot, StatsSnapshot> baseSliceAndNewSlice = new Pair<>(preAggregatedSnapshot, null); for (int i = 0; i < 2; i++) { baseSliceAndNewSlice = decomposeSnapshot(baseSliceAndNewSlice.getFirst()); storeMap.put(new Partition(i, PartitionState.READ_WRITE, CAPACITY), new MockBlobStore(new MockBlobStoreStats(baseSliceAndNewSlice.getSecond(), false))); } storeMap.put(new Partition(2, PartitionState.READ_WRITE, CAPACITY), new MockBlobStore(new MockBlobStoreStats(baseSliceAndNewSlice.getFirst(), false))); StorageManager storageManager = new MockStorageManager(storeMap); Properties properties = new Properties(); properties.put("stats.output.file.path", outputFileString); config = new StatsManagerConfig(new VerifiableProperties(properties)); statsManager = new StatsManager(storageManager, new ArrayList<>(storeMap.keySet()), new MetricRegistry(), config, new MockTime()); }
Source:
public void addPatientCorrelationPLQ(PatientLocationQueryResponseType plqRecords, AssertionType assertion) { if (plqRecords == null) { LOG.warn("PLQRecords was null"); } try { PatientCorrelationPLQHelper.addPatientCorrelationPLQRecords(plqRecords); } catch (final Exception ex) { LOG.error("Error calling addPatientCorrelation: {}", ex.getMessage(), ex); } }

Target:
public void addPatientCorrelationPLQ(PatientLocationQueryResponseType plqRecords, AssertionType assertion) { if (plqRecords == null) { LOG.warn("PLQRecords was null"); return; } PatientCorrelationPLQHelper.addPatientCorrelationPLQRecords(plqRecords); }
Source:
public void start() { stopAt = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(MAX_PROCESSING_TIME); }

Target:
public void start() { stopAtNs = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(MAX_PROCESSING_TIME); }
Source:
public void onAlarmDeleted(OnmsAlarm alarm) { final Integer alarmId = alarm.getId(); final String reductionKey = alarm.getReductionKey(); forEachListener(l -> l.handleDeletedAlarm(alarmId, reductionKey)); }

Target:
public void onAlarmDeleted(OnmsAlarm alarm) { forEachListener(l -> l.handleDeletedAlarm(alarm.getId(), alarm.getReductionKey())); }
Source:
protected Set<SubscriptionEventListener> getInterestedListeners(String event) { final Set<SubscriptionEventListener> listeners; synchronized (lock) { final Set<SubscriptionEventListener> sharedListeners = eventNameToListenerMap.get(event); if (sharedListeners != null) { listeners = new HashSet<SubscriptionEventListener>(sharedListeners); } else { listeners = null; } } return listeners; }

Target:
protected Set<SubscriptionEventListener> getInterestedListeners(String event) { synchronized (lock) { final Set<SubscriptionEventListener> sharedListeners = eventNameToListenerMap.get(event); if (sharedListeners == null) { return null; } return new HashSet<>(sharedListeners); } }
Source:
public File getDirectory() { if (tmpdir == null) { tmpdir = getTemporaryDirectory(); if (tmpdir == null) { tmpdir = createDirInsideApplication(); } } return tmpdir.toFile(); }

Target:
public File getDirectory() { if (tmpdir == null) { tmpdir = getTemporaryDirectory(); } if (tmpdir == null) { tmpdir = createDirInsideApplication(); } return tmpdir.toFile(); }
Source:
private String getMappedAuth3dsResult(StripeNotificationType type) { switch (type) { case SOURCE_CHARGEABLE: return Auth3dsDetails.Auth3dsResult.AUTHORISED.toString(); case SOURCE_CANCELED: return Auth3dsDetails.Auth3dsResult.CANCELED.toString(); case SOURCE_FAILED: return Auth3dsDetails.Auth3dsResult.DECLINED.toString(); default: Auth3dsDetails.Auth3dsResult.ERROR.toString(); } return Auth3dsDetails.Auth3dsResult.ERROR.toString(); }

Target:
private String getMappedAuth3dsResult(StripeNotificationType type) { switch (type) { case SOURCE_CHARGEABLE: return Auth3dsDetails.Auth3dsResult.AUTHORISED.toString(); case SOURCE_CANCELED: return Auth3dsDetails.Auth3dsResult.CANCELED.toString(); case SOURCE_FAILED: return Auth3dsDetails.Auth3dsResult.DECLINED.toString(); default: return Auth3dsDetails.Auth3dsResult.ERROR.toString(); } }
Source:
private void loadVncData(HasConsoleModel model, KeyMaker keyMaker) { if (!(model.getDefaultConsoleModel() instanceof VncConsoleModel)) { return; } model.setSelectedProtocol(ConsoleProtocol.VNC); asVncConsoleModel(model).setVncImplementation(VncConsoleModel.ClientConsoleMode .valueOf(clientStorage.getLocalItem(keyMaker.make(VNC_CLIENT_MODE)))); }

Target:
private void loadVncData(HasConsoleModel model, KeyMaker keyMaker) { if (!(model.getDefaultConsoleModel() instanceof VncConsoleModel)) { return; } model.setSelectedProtocol(ConsoleProtocol.VNC); try { asVncConsoleModel(model).setVncImplementation(VncConsoleModel.ClientConsoleMode .valueOf(clientStorage.getLocalItem(keyMaker.make(VNC_CLIENT_MODE)))); } catch (Exception e) { } }
Source:
BitMappedTrie<T> boxed() { return map(identity()); }

Target:
private BitMappedTrie<T> boxed() { return map(identity()); }
Source:
private WFSTCompletionLookup build(final IndexReader indexReader, final String field) throws IOException { WFSTInputIterator iterator = new WFSTInputIterator( new LuceneDictionary(indexReader, field).getEntryIterator(), indexReader, field, getSearchCounts(field)); WFSTCompletionLookup lookup = createWFST(); lookup.build(iterator); if (iterator.termLengthAccumulator > 0) { double averageLength = (double) iterator.termLengthAccumulator / lookup.getCount(); averageLengths.put(field, averageLength); } return lookup; }

Target:
private WFSTCompletionLookup build(final IndexReader indexReader, final String field) throws IOException { WFSTInputIterator iterator = new WFSTInputIterator( new LuceneDictionary(indexReader, field).getEntryIterator(), indexReader, field, getSearchCounts(field)); WFSTCompletionLookup lookup = createWFST(); lookup.build(iterator); if (lookup.getCount() > 0) { double averageLength = (double) iterator.termLengthAccumulator / lookup.getCount(); averageLengths.put(field, averageLength); } return lookup; }
Source:
public void invalidAccountTokenWithKubernetesApiMode() { Map<String, Comparable> properties = new HashMap<String, Comparable>(); properties.put(SERVICE_DNS.key(), null); properties.put(KUBERNETES_CA_CERTIFICATE.key(), TEST_CA_CERTIFICATE); new KubernetesConfig(properties); }

Target:
public void invalidAccountTokenWithKubernetesApiMode() { Map<String, Comparable> properties = new HashMap<String, Comparable>(); properties.put(KUBERNETES_CA_CERTIFICATE.key(), TEST_CA_CERTIFICATE); new KubernetesConfig(properties); }
Source:
private boolean correctStorageDomainFormat() { storage_pool storagePool = getStoragePool(); StorageFormatType storageFormat = getStorageDomain().getStorageFormat(); StorageType storageType = getStorageDomain().getstorage_type(); StorageDomainType storageDomainType = getStorageDomain().getstorage_domain_type(); boolean isBlockStorage = storageType == StorageType.ISCSI || storageType == StorageType.FCP; boolean isDataStorageDomain = storageDomainType == StorageDomainType.Data; Set<StorageFormatType> supportedStorageFormats; if (storagePool != null) { supportedStorageFormats = getSupportedStorageFormatSet(storagePool.getcompatibility_version()); } else { storage_pool vdsStoragePool = getStoragePoolDAO().get(getVds().getstorage_pool_id()); if (vdsStoragePool == null) { return false; } supportedStorageFormats = getSupportedStorageFormatSet(vdsStoragePool.getcompatibility_version()); } if (!supportedStorageFormats.contains(storageFormat)) { return false; } if (storageFormat == StorageFormatType.V1 && isBlockStorage && storagePool == null) { return false; } if (storageFormat == StorageFormatType.V2 && (!isBlockStorage || !isDataStorageDomain)) { return false; } if (storageFormat == StorageFormatType.V3 && !isDataStorageDomain) { return false; } return true; }

Target:
private boolean correctStorageDomainFormat() { storage_pool targetStoragePool = getStoragePool(); StorageFormatType storageFormat = getStorageDomain().getStorageFormat(); StorageType storageType = getStorageDomain().getstorage_type(); StorageDomainType storageDomainType = getStorageDomain().getstorage_domain_type(); Set<StorageFormatType> supportedStorageFormats; if (targetStoragePool == null) { targetStoragePool = getStoragePoolDAO().get(getVds().getstorage_pool_id()); if (targetStoragePool == null) { return false; } } supportedStorageFormats = getSupportedStorageFormatSet(targetStoragePool.getcompatibility_version()); if (!supportedStorageFormats.contains(storageFormat)) { return false; } boolean isBlockStorage = storageType == StorageType.ISCSI || storageType == StorageType.FCP; boolean isDataStorageDomain = storageDomainType == StorageDomainType.Data; if (storageFormat == StorageFormatType.V2 && (!isBlockStorage || !isDataStorageDomain)) { return false; } if (storageFormat == StorageFormatType.V3 && !isDataStorageDomain) { return false; } return true; }
Source:
private void verifyMBean(StandardMBean mBean) { assertThat(mBean, is( either(instanceOf(MyService.class)) .or(instanceOf(MyService2.class)))); if (mBean instanceof MyService) { assertThat(((MyService) mBean).say("you"), is(equalTo("Hello you"))); verify(service, times(1)).say("you"); } else { assertThat(((MyService2) mBean).say("you"), is(equalTo("Hello you"))); } }

Target:
private void verifyMBean(StandardMBean mBean) { assertThat(mBean, is( either(instanceOf(MyService.class)) .or(instanceOf(MyService2.class)))); assertThat(mBean.getMBeanInterface().getName(), is( either(equalTo(MyService.class.getName() + "MBean")) .or(equalTo(MyService.class.getName() + "2MBean")))); if (mBean instanceof MyService) { assertThat(((MyService) mBean).say("you"), is(equalTo("Hello you"))); verify(service, times(1)).say("you"); } else { assertThat(((MyService2) mBean).say("you"), is(equalTo("Hello you"))); } }
Source:
public List<LocationListener> getListeners() { List<LocationListener> listeners = new ArrayList<>(); for (LocationEngine engine : engineListeners.keySet()) { listeners.addAll(engineListeners.get(engine)); } return listeners; }

Target:
List<LocationListener> getListeners() { List<LocationListener> listeners = new ArrayList<>(); for (LocationEngine engine : engineListeners.keySet()) { listeners.addAll(engineListeners.get(engine)); } return listeners; }
Source:
public void testAbuseFilterTriggerWarn() { PageTitle title = new PageTitle(null, "User:Yuvipandaaaaaaaa", TEST_WIKI_SITE); for (int i = 0; i < 2; ++i) { String wikitext = "Testing Abusefilter by simply editing this page. Triggering rule 94" + "at " + System.nanoTime(); service.edit(TEST_WIKI_SITE, title, DEFAULT_SECTION_ID, wikitext, ANONYMOUS_TOKEN, DEFAULT_SUMMARY, false, null, null, new Edit.Callback() { @Override public void success(@NonNull EditingResult result) { if (!(result instanceof SuccessEditResult)) { assertThat(result, instanceOf(AbuseFilterEditResult.class)); assertThat(((AbuseFilterEditResult) result).getType(), is(AbuseFilterEditResult.TYPE_WARNING)); } } @Override public void failure(@NonNull Throwable caught) { throw new RuntimeException(caught); } }); } }

Target:
public void testAbuseFilterTriggerWarn() { PageTitle title = new PageTitle(null, "User:Yuvipandaaaaaaaa", TEST_WIKI_SITE); for (int i = 0; i < 2; ++i) { String wikitext = "Testing Abusefilter by simply editing this page. Triggering rule 94" + "at " + System.nanoTime(); final TestLatch latch = new TestLatch(); client.request(TEST_WIKI_SITE, title, DEFAULT_SECTION_ID, wikitext, ANONYMOUS_TOKEN, DEFAULT_SUMMARY, false, null, null, new EditClient.Callback() { @Override public void success(@NonNull Call<Edit> call, @NonNull EditingResult result) { if (!(result instanceof SuccessEditResult)) { assertThat(result, instanceOf(AbuseFilterEditResult.class)); assertThat(((AbuseFilterEditResult) result).getType(), is(AbuseFilterEditResult.TYPE_ERROR)); } latch.countDown(); } @Override public void failure(@NonNull Call<Edit> call, @NonNull Throwable caught) { throw new RuntimeException(caught); } }); latch.await(); } }
Source:
public void removeCustomizedViews(String stateType, List<String> resourceNames) { for (String resourceName : resourceNames) { _customizedViewCacheMap.get(stateType).getCustomizedViewCache() .deletePropertyByName(resourceName); } }

Target:
public void removeCustomizedViews(String stateType, List<String> resourceNames) { if (!_customizedViewCacheMap.containsKey(stateType)) { logger.warn(String.format("The customized state type : %s is not in the cache", stateType)); return; } for (String resourceName : resourceNames) { _customizedViewCacheMap.get(stateType).getCustomizedViewCache() .deletePropertyByName(resourceName); } }
Source:
public Object[] next() { if (m_count < m_objects.length) { return m_objects[m_count++]; } else { throw new NoSuchElementException(); } }

Target:
public Object[] next() { if (m_count >= m_objects.length) { throw new NoSuchElementException(); } return m_objects[m_count++]; }
Source:
private void initializeMetadata() { try { final Map<TopicPartition, OffsetAndMetadata> offsetsAndMetadata = consumer.committed(partitions).entrySet().stream() .filter(e -> e.getValue() != null) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); initializeTaskTime(offsetsAndMetadata); } catch (final TimeoutException e) { log.warn("Encountered while trying to fetch committed offsets, will retry initializing the metadata in the next loop." + "\nConsider overwriting consumer config `default.api.timeout.ms` to a larger value to avoid timeout errors"); throw e; } catch (final KafkaException e) { throw new StreamsException(format("task [%s] Failed to initialize offsets for %s", id, partitions), e); } }

Target:
private void initializeMetadata() { try { final Map<TopicPartition, OffsetAndMetadata> offsetsAndMetadata = consumer.committed(partitions).entrySet().stream() .filter(e -> e.getValue() != null) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); initializeTaskTime(offsetsAndMetadata); } catch (final TimeoutException e) { log.warn("Encountered while trying to fetch committed offsets, will retry initializing the metadata in the next loop." + "\nConsider overwriting consumer config to a larger value to avoid timeout errors", ConsumerConfig.DEFAULT_API_TIMEOUT_MS_CONFIG); throw e; } catch (final KafkaException e) { throw new StreamsException(format("task [%s] Failed to initialize offsets for %s", id, partitions), e); } }
Source:
public void init() throws ConfigurationResourceException { final ServiceConfiguration config = serviceConfiguration.get(); for (Service service : config.getServices()) { final String name = service.getName().split("=")[1]; this.daemonList.add(new DaemonInfo(name, ignoreList.contains(name), service.isEnabled(), service.isReloadable() )); } }

Target:
public void init() throws ConfigurationResourceException { final ServiceConfiguration config = serviceConfiguration.get(); for (Service service : config.getServices()) { final String name = service.getName().split("=")[1]; daemonList.add(new DaemonInfo(name, ignoreList.contains(name), service.isEnabled(), service.isReloadable() )); } }
Source:
protected Map<Key<?>, ?> getValues(ItemStack dataHolder) { if (!dataHolder.hasTagCompound()) { return Maps.newHashMap(); } Map<Key<?>, Boolean> map = Maps.newHashMap(); int flag = dataHolder.getTagCompound().getInteger(NbtDataUtil.ITEM_HIDE_FLAGS); if (flag - 32 >= 0) { map.put(Keys.HIDE_MISCELLANEOUS, true); flag -= 32; } else { map.put(Keys.HIDE_MISCELLANEOUS, false); } if (flag - 16 >= 0) { map.put(Keys.HIDE_CAN_PLACE, true); flag -= 16; } else { map.put(Keys.HIDE_CAN_PLACE, false); } if (flag - 8 >= 0) { map.put(Keys.HIDE_CAN_DESTROY, true); flag -= 8; } else { map.put(Keys.HIDE_CAN_DESTROY, false); } if (flag - 4 >= 0) { map.put(Keys.HIDE_UNBREAKABLE, true); flag -= 4; } else { map.put(Keys.HIDE_UNBREAKABLE, false); } if (flag - 2 >= 0) { map.put(Keys.HIDE_ATTRIBUTES, true); flag -= 2; } else { map.put(Keys.HIDE_ATTRIBUTES, false); } if (flag - 1 >= 0) { map.put(Keys.HIDE_ENCHANTMENTS, true); } else { map.put(Keys.HIDE_ENCHANTMENTS, false); } return map; }

Target:
protected Map<Key<?>, ?> getValues(ItemStack dataHolder) { if (!dataHolder.hasTagCompound()) { return Maps.newHashMap(); } Map<Key<?>, Boolean> map = Maps.newHashMap(); int flag = dataHolder.getTagCompound().getInteger(NbtDataUtil.ITEM_HIDE_FLAGS); if ((flag & DataConstants.HIDE_MISCELLANEOUS_FLAG) != 0) { map.put(Keys.HIDE_MISCELLANEOUS, true); } else { map.put(Keys.HIDE_MISCELLANEOUS, false); } if ((flag & DataConstants.HIDE_CAN_PLACE_FLAG) != 0) { map.put(Keys.HIDE_CAN_PLACE, true); } else { map.put(Keys.HIDE_CAN_PLACE, false); } if ((flag & DataConstants.HIDE_CAN_DESTROY_FLAG) != 0) { map.put(Keys.HIDE_CAN_DESTROY, true); } else { map.put(Keys.HIDE_CAN_DESTROY, false); } if ((flag & DataConstants.HIDE_UNBREAKABLE_FLAG) != 0) { map.put(Keys.HIDE_UNBREAKABLE, true); } else { map.put(Keys.HIDE_UNBREAKABLE, false); } if ((flag & DataConstants.HIDE_ATTRIBUTES_FLAG) != 0) { map.put(Keys.HIDE_ATTRIBUTES, true); } else { map.put(Keys.HIDE_ATTRIBUTES, false); } if ((flag & DataConstants.HIDE_ENCHANTMENTS_FLAG) != 0) { map.put(Keys.HIDE_ENCHANTMENTS, true); } else { map.put(Keys.HIDE_ENCHANTMENTS, false); } return map; }
Source:
public Plot(String title, String yaxis, String group, String numBuilds, String csvFileName, String style, boolean useDescr, boolean keepRecords, boolean exclZero, boolean logarithmic, String yaxisMinimum, String yaxisMaximum, String description) { this.title = title; this.yaxis = yaxis; this.group = group; this.numBuilds = numBuilds; this.description = description; this.csvFileName = csvFileName; this.style = style; this.useDescr = useDescr; this.keepRecords = keepRecords; this.exclZero = exclZero; this.logarithmic = logarithmic; this.yaxisMinimum = yaxisMinimum; this.yaxisMaximum = yaxisMaximum; }

Target:
public Plot(String title, String yaxis, String group, String numBuilds, String csvFileName, String style, boolean useDescr, boolean keepRecords, boolean exclZero, boolean logarithmic, String yaxisMinimum, String yaxisMaximum, String description) { this.title = title; this.yaxis = yaxis; this.group = group; this.numBuilds = numBuilds; this.csvFileName = csvFileName; this.style = style; this.useDescr = useDescr; this.keepRecords = keepRecords; this.exclZero = exclZero; this.logarithmic = logarithmic; this.yaxisMinimum = yaxisMinimum; this.yaxisMaximum = yaxisMaximum; this.description = description; }
Source:
public void start() { try { final ReviewDb db = schema.open(); try { final CurrentSchemaVersion sVer = getSchemaVersion(db); final int eVer = version.get().getVersionNbr(); if (sVer == null) { throw new ProvisionException("Schema not yet initialized." + " Run init to initialize the schema:\n" + "$ java -jar gerrit.war init -d " + site.site_path.getAbsolutePath()); } if (sVer.versionNbr != eVer) { throw new ProvisionException("Unsupported schema version " + sVer.versionNbr + "; expected schema version " + eVer + ". Run init to upgrade:\n" + "$ java -jar gerrit.war init -d " + site.site_path.getAbsolutePath()); } } finally { db.close(); } } catch (OrmException e) { throw new ProvisionException("Cannot read schema_version", e); } }

Target:
public void start() { try { final ReviewDb db = schema.open(); try { final CurrentSchemaVersion currentVer = getSchemaVersion(db); final int expectedVer = version.get().getVersionNbr(); if (currentVer == null) { throw new ProvisionException("Schema not yet initialized." + " Run init to initialize the schema:\n" + "$ java -jar gerrit.war init -d " + site.site_path.getAbsolutePath()); } if (currentVer.versionNbr < expectedVer) { throw new ProvisionException("Unsupported schema version " + currentVer.versionNbr + "; expected schema version " + expectedVer + ". Run init to upgrade:\n" + "$ java -jar gerrit.war init -d " + site.site_path.getAbsolutePath()); } else if (currentVer.versionNbr > expectedVer) { throw new ProvisionException("Unsupported schema version " + currentVer.versionNbr + "; expected schema version " + expectedVer + ". Downgrade is not supported."); } } finally { db.close(); } } catch (OrmException e) { throw new ProvisionException("Cannot read schema_version", e); } }
Source:
public Set<AccountGroup.Id> getOwners() { if (!localOwners.isEmpty()) { return localOwners; } else { final ProjectState parent = projectCache.get(project.getParent()); return parent.getOwners(); } }

Target:
public Set<AccountGroup.Id> getOwners() { if (!localOwners.isEmpty() || isSpecialWildProject() || project.getParent() == null) { return localOwners; } final ProjectState parent = projectCache.get(project.getParent()); if (parent != null) { return parent.getOwners(); } return Collections.emptySet(); }
Source:
public boolean shouldWait() { if (resultSet == null) { resultSet = new ReadResultSetImpl<>(minSize, maxSize, getNodeEngine().getSerializationService(), filter); sequence = startSequence; } RingbufferContainer ringbuffer = getRingBufferContainer(); sequence = ringbuffer.clampReadSequenceToBounds(sequence); if (minSize == 0) { if (!ringbuffer.shouldWait(sequence)) { readMany(ringbuffer); } return false; } if (resultSet.isMinSizeReached()) { return false; } if (sequence == ringbuffer.tailSequence() + 1) { return true; } readMany(ringbuffer); return !resultSet.isMinSizeReached(); }

Target:
public boolean shouldWait() { if (resultSet == null) { resultSet = new ReadResultSetImpl<>(minSize, maxSize, getNodeEngine().getSerializationService(), filter); sequence = startSequence; } RingbufferContainer ringbuffer = getRingBufferContainer(); sequence = ringbuffer.clampReadSequenceToBounds(sequence); if (minSize == 0) { if (sequence < ringbuffer.tailSequence() + 1) { readMany(ringbuffer); } return false; } if (resultSet.isMinSizeReached()) { return false; } if (sequence == ringbuffer.tailSequence() + 1) { return true; } readMany(ringbuffer); return !resultSet.isMinSizeReached(); }
Source:
private void restore(Bundle savedInstanceState) { if (player == null) { if (savedInstanceState != null && savedInstanceState.containsKey("player")) { player = (IPlayer) savedInstanceState.get("player"); } else { player = new Player(); } } if (savedInstanceState != null && savedInstanceState.containsKey("isMessageDisplayed")) { if (savedInstanceState.getBoolean("isMessageDisplayed")) { showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED); } } if (savedInstanceState != null) { isPrepared = savedInstanceState.getBoolean("isPrepared"); isAutoPlayDone = savedInstanceState.getBoolean("isAutoPlayDone"); } reAttachPlayEventListener(); }

Target:
private void restore(Bundle savedInstanceState) { if (savedInstanceState != null) { player = (IPlayer) savedInstanceState.get(KEY_PLAYER); isPrepared = savedInstanceState.getBoolean(KEY_PREPARED); isAutoPlayDone = savedInstanceState.getBoolean(KEY_AUTOPLAY_DONE); transcript = (TranscriptModel) savedInstanceState.get(KEY_TRANSCRIPT); if (savedInstanceState.getBoolean(KEY_MESSAGE_DISPLAYED)) { showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED); } } else { player = new Player(); } }
Source:
private boolean checkPresentOrNullable(Invocation invocation, String paramKey, int argIndex, Object arg) { if (arg == null && !Reflection2.getInvokableParameters(invocation.getInvokable()).get(argIndex).isAnnotationPresent(Nullable.class)) throw new NullPointerException(format("param{%s} for invocation %s.%s", paramKey, invocation.getInvokable() .getOwnerType().getRawType().getSimpleName(), invocation.getInvokable().getName())); return true; }

Target:
private boolean checkPresentOrNullable(Invocation invocation, String paramKey, int argIndex, Object arg) { if (arg == null && !getInvokableParameters(invocation.getInvokable()).get(argIndex).isAnnotationPresent(Nullable.class)) throw new NullPointerException(format("param{%s} for invocation %s.%s", paramKey, invocation.getInvokable() .getOwnerType().getRawType().getSimpleName(), invocation.getInvokable().getName())); return true; }
Source:
private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (isNullVector.length < requiredVectorLength) { isNullVector = new boolean[requiredVectorLength]; inDictionaryVector = new boolean[requiredVectorLength]; systemMemoryContext.setBytes(requiredVectorLength * 9); } }

Target:
private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (isNullVector.length < requiredVectorLength) { isNullVector = new boolean[requiredVectorLength]; inDictionaryVector = new boolean[requiredVectorLength]; systemMemoryContext.setBytes(getRetainedSizeInBytes()); } }
Source:
public boolean presentationVisible() { CheckBox lastCheckBox = checkBoxes_.get(checkBoxes_.size() - 1); return StringUtil.equals(lastCheckBox.getText(), "Presentation") && lastCheckBox.isVisible(); }

Target:
public boolean presentationVisible() { if (checkBoxes_.size() <= 0) return false; CheckBox lastCheckBox = checkBoxes_.get(checkBoxes_.size() - 1); return StringUtil.equals(lastCheckBox.getText(), "Presentation") && lastCheckBox.isVisible(); }
Source:
public void setMsqMinSelectableChoices(int qnNumber, int value) { assertTrue(isMsqMinSelectableChoicesEnabled(qnNumber)); WebElement inputBox = getMsqMinSelectableChoicesBox(qnNumber); JavascriptExecutor exec = (JavascriptExecutor) browser.driver; String id = inputBox.getAttribute("id"); exec.executeScript(String.format("$('#%s').val(%d);$('#%s').change();", id, value, id)); }

Target:
public void setMsqMinSelectableChoices(int qnNumber, int value) { assertTrue(isMsqMinSelectableChoicesEnabled(qnNumber)); WebElement inputBox = getMsqMinSelectableChoicesBox(qnNumber); String id = inputBox.getAttribute("id"); executeScript(String.format("$('#%s').val(%d);$('#%s').change();", id, value, id)); }
Source:
private void retrieveDescriptor(String connectorType) { Filter filter; try { filter = serviceUtils.makeFilter(ConnectorProvider.class, String.format("(connector=%s)", connectorType)); } catch (InvalidSyntaxException e) { throw new IllegalArgumentException(e); } ConnectorProvider connectorProvider = serviceUtils.getOsgiServiceProxy(filter, ConnectorProvider.class); descriptor = connectorProvider.getDescriptor(); }

Target:
private void retrieveDescriptor(String connectorType) { Filter filter = serviceUtils.makeFilter(ConnectorProvider.class, String.format("(%s=%s)", Constants.CONNECTOR_KEY, connectorType)); ConnectorProvider connectorProvider = serviceUtils.getOsgiServiceProxy(filter, ConnectorProvider.class); descriptor = connectorProvider.getDescriptor(); }
Source:
public static void testGetClientMultiTenant() throws MambuApiException { System.out.println("\nIn testGetClientMultiTenant"); MambuAPIServiceFactory serviceFactory = DemoUtil.getAPIServiceFactory(); ClientsService clientService = serviceFactory.getClientService(); Client myClient = clientService.getClient(demoClient.getEncodedKey()); System.out.println("Client Service by ID Ok, ID=" + myClient.getId()); MambuAPIServiceFactory serviceFactory2 = MambuAPIServiceFactory.getFactory( "non-existing-subdomain.sandbox.mambu.com", "non-existing-user", "non-existing-password"); ClientsService clientService2 = serviceFactory2.getClientService(); try { clientService2.getClient(demoClient.getEncodedKey()); System.out.println("Client Service by ID NOT Ok"); } catch (MambuApiException e) { System.out.println("Client Service by ID Ok, invalid subdomain"); } myClient = clientService.getClient(demoClient.getEncodedKey()); System.out.println("Client Service by ID still Ok, ID=" + myClient.getId()); }

Target:
public static void testGetClientMultiTenant() throws MambuApiException { System.out.println("\nIn testGetClientMultiTenant"); MambuAPIServiceFactory serviceFactory = DemoUtil.getAPIServiceFactory(); ClientsService clientService = serviceFactory.getClientService(); Client myClient = clientService.getClient(demoClient.getEncodedKey()); System.out.println("Client Service by ID Ok, ID=" + myClient.getId()); MambuAPIServiceFactory serviceFactory2 = MambuAPIServiceFactory.getFactory( "non-existing-subdomain.sandbox.mambu.com", "non-existing-user", "non-existing-password"); ClientsService clientService2 = serviceFactory2.getClientService(); try { clientService2.getClient(demoClient.getEncodedKey()); System.out.println("Client Service by ID NOT Ok, should have thrown an exception"); } catch (MambuApiException e) { System.out .println("Client Service by ID Ok, an exception was caught as expected due to an invalid subdomain"); } myClient = clientService.getClient(demoClient.getEncodedKey()); System.out.println("Client Service by ID still Ok, ID=" + myClient.getId()); MambuAPIServiceFactory serviceFactory3 = DemoUtil.getAPIServiceFactory(true); ClientsService clientService3 = serviceFactory3.getClientService(); myClient = clientService3.getClient(demoClient2.getEncodedKey()); System.out.println("Client Service by ID Ok, ID=" + myClient.getId()); String otherClientId = myClient.getId(); myClient = clientService.getClient(demoClient.getEncodedKey()); if (otherClientId.equals(myClient.getId())) { System.out.println("Client Service by ID *NOT* Ok since both clients have same ID, ID=" + myClient.getId()); } else { System.out.println("Client Service by ID Ok since different ID, ID=" + myClient.getId()); } }
Source:
public DruidRequestBody( @JsonProperty("query") String query, @JsonProperty("resultFormat") String resultFormat, @JsonProperty("queryHeader") boolean queryHeader) { requireNonNull(query); this.query = query; this.resultFormat = resultFormat; this.queryHeader = queryHeader; }

Target:
public DruidRequestBody( @JsonProperty("query") String query, @JsonProperty("resultFormat") String resultFormat, @JsonProperty("queryHeader") boolean queryHeader) { this.query = requireNonNull(query); this.resultFormat = requireNonNull(resultFormat); this.queryHeader = queryHeader; }
Source:
void handleFragmentTaskMessage(FragmentTaskMessage message) { boolean shortcutRead = message.isReadOnly() && m_defaultConsistencyReadLevel.hasShortcutRead(); FragmentTaskMessage msg = message; long newSpHandle; if (m_isLeader) { msg = new FragmentTaskMessage(message.getInitiatorHSId(), message.getCoordinatorHSId(), message); if (!shortcutRead) { TxnEgo ego = advanceTxnEgo(); newSpHandle = ego.getTxnId(); } else { newSpHandle = getMaxTaskedSpHandle(); } msg.setSpHandle(newSpHandle); if (msg.getInitiateTask() != null) { msg.getInitiateTask().setSpHandle(newSpHandle); msg.setStateForDurability(msg.getInitiateTask(), msg.getInvolvedPartitions()); } if (m_sendToHSIds.length > 0 && (!shortcutRead || msg.isSysProcTask())) { FragmentTaskMessage replmsg = new FragmentTaskMessage(m_mailbox.getHSId(), m_mailbox.getHSId(), msg); m_mailbox.send(m_sendToHSIds, replmsg); DuplicateCounter counter; if (message.getFragmentTaskType() != FragmentTaskMessage.SYS_PROC_PER_SITE) { counter = new DuplicateCounter( msg.getCoordinatorHSId(), msg.getTxnId(), m_replicaHSIds, message); } else { counter = new SysProcDuplicateCounter( msg.getCoordinatorHSId(), msg.getTxnId(), m_replicaHSIds, message); } safeAddToDuplicateCounterMap(new DuplicateCounterKey(message.getTxnId(), newSpHandle), counter); } } else { newSpHandle = msg.getSpHandle(); setMaxSeenTxnId(newSpHandle); } Iv2Trace.logFragmentTaskMessage(message, m_mailbox.getHSId(), newSpHandle, false); doLocalFragmentOffer(msg); }

Target:
void handleFragmentTaskMessage(FragmentTaskMessage message) { FragmentTaskMessage msg = message; long newSpHandle; if (m_isLeader) { msg = new FragmentTaskMessage(message.getInitiatorHSId(), message.getCoordinatorHSId(), message); if (!message.isReadOnly()) { TxnEgo ego = advanceTxnEgo(); newSpHandle = ego.getTxnId(); } else { newSpHandle = getMaxTaskedSpHandle(); } msg.setSpHandle(newSpHandle); if (msg.getInitiateTask() != null) { msg.getInitiateTask().setSpHandle(newSpHandle); msg.setStateForDurability(msg.getInitiateTask(), msg.getInvolvedPartitions()); } if (m_sendToHSIds.length > 0 && (!message.isReadOnly() || msg.isSysProcTask())) { FragmentTaskMessage replmsg = new FragmentTaskMessage(m_mailbox.getHSId(), m_mailbox.getHSId(), msg); m_mailbox.send(m_sendToHSIds, replmsg); DuplicateCounter counter; if (message.getFragmentTaskType() != FragmentTaskMessage.SYS_PROC_PER_SITE) { counter = new DuplicateCounter( msg.getCoordinatorHSId(), msg.getTxnId(), m_replicaHSIds, message); } else { counter = new SysProcDuplicateCounter( msg.getCoordinatorHSId(), msg.getTxnId(), m_replicaHSIds, message); } safeAddToDuplicateCounterMap(new DuplicateCounterKey(message.getTxnId(), newSpHandle), counter); } } else { newSpHandle = msg.getSpHandle(); setMaxSeenTxnId(newSpHandle); } Iv2Trace.logFragmentTaskMessage(message, m_mailbox.getHSId(), newSpHandle, false); doLocalFragmentOffer(msg); }
Source:
public void executeTaskWithNullDefinitionCreatesDefinitionIfConfigured() { initializeSuccessfulRegistry(appRegistry); when(this.taskLauncher.launch(any())).thenReturn("0"); taskExecutionService.executeTask("demo", new HashMap<>(), new LinkedList<>()); }

Target:
public void executeTaskWithNullDefinitionCreatesDefinitionIfConfigured() { initializeSuccessfulRegistry(appRegistry); when(this.taskLauncher.launch(any())).thenReturn("0"); taskExecutionService.executeTask("demo", new HashMap<>(), new LinkedList<>()); assertNotNull(taskDefinitionRepository.findByTaskName("demo")); }
Source:
public void testValidWildmatch1() throws Exception { createFiles("a", "dir/x", "dir/sub1/x", "dir/sub2/x/y"); writeTrashFile(".gitattributes", "**dir"); assertSameAsCGit(); }

Target:
public void testValidWildmatch1() throws Exception { createFiles("a", "dir/x", "dir/sub1/x", "dir/sub2/x/y"); writeTrashFile(".gitattributes", "**dir bar\n"); assertSameAsCGit(); }
Source:
protected String doInBackground(String... params) { String path = params[0]; File downloadedImages = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + "/" + Uri.parse(path).getLastPathSegment()); int total = 0; int count = 0; try { URL url = new URL(path); URLConnection urlConnection = url.openConnection(); urlConnection.connect(); imageLength = urlConnection.getContentLength(); boolean isFileCreated = downloadedImages.exists(); InputStream inputStream = new BufferedInputStream(url.openStream(), 8192); byte[] data = new byte[1024]; OutputStream outputStream = new FileOutputStream(downloadedImages); if (!isFileCreated) { isFileCreated = downloadedImages.createNewFile(); } while ((count = inputStream.read(data)) != -1) { total = total + count; outputStream.write(data, 0, count); calculatedProgress = (int) total * 100 / imageLength; publishProgress(total); } inputStream.close(); outputStream.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return String.valueOf(downloadedImages); }

Target:
protected String doInBackground(String... params) { String path = params[0]; File downloadedImages = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + "/" + Uri.parse(path).getLastPathSegment()); int total = 0; int count = 0; try { URL url = new URL(path); URLConnection urlConnection = url.openConnection(); urlConnection.connect(); imageLength = urlConnection.getContentLength(); boolean isFileCreated = downloadedImages.exists(); InputStream inputStream = new BufferedInputStream(url.openStream(), 8192); byte[] data = new byte[1024]; OutputStream outputStream = new FileOutputStream(downloadedImages); if (!isFileCreated) { isFileCreated = downloadedImages.createNewFile(); } while ((count = inputStream.read(data)) != -1) { total = total + count; outputStream.write(data, 0, count); calculatedProgress = (int) total * 100 / imageLength; publishProgress(total); } inputStream.close(); outputStream.close(); } catch (MalformedURLException e) { ZLog.logException(e); } catch (IOException e) { ZLog.logException(e); } return String.valueOf(downloadedImages); }
Source:
private boolean createPropertiesTable() { Statement sta; try { sta = conn.createStatement(); String payload = "CREATE TABLE PROPERTIES (Name VARCHAR(100), Type VARCHAR(20), Value VARCHAR(50))"; int count = sta.executeUpdate(payload); return true; } catch (SQLException e) { log.warn("Could not create the properties table! Properties will not be saved!!"); log.warn(e.toString()); e.printStackTrace(); } return false; }

Target:
private boolean createPropertiesTable() { Statement sta; try { sta = conn.createStatement(); String payload = "CREATE TABLE PROPERTIES (Name VARCHAR(100), Type VARCHAR(20), Value VARCHAR(50), UNIQUE (Name))"; int count = sta.executeUpdate(payload); return true; } catch (SQLException e) { log.warn("Could not create the properties table! Properties will not be saved!!"); log.warn(e.toString()); e.printStackTrace(); } return false; }
Source:
public Iterator<String> getGcCandidates(DataLevel level, String continuePoint) { if (level == DataLevel.ROOT) { byte[] json = context.getZooCache() .get(context.getZooKeeperRoot() + RootTable.ZROOT_TABLET_GC_CANDIDATES); Stream<String> candidates = RootGcCandidates.fromJson(json).stream().sorted(); if (continuePoint != null && !continuePoint.isEmpty()) { candidates = candidates.dropWhile(candidate -> candidate.compareTo(continuePoint) <= 0); } return candidates.iterator(); } else if (level == DataLevel.METADATA || level == DataLevel.USER) { Range range = MetadataSchema.DeletesSection.getRange(); if (continuePoint != null && !continuePoint.isEmpty()) { String continueRow = MetadataSchema.DeletesSection.getRowPrefix() + SortSkew.getCode(continuePoint) + continuePoint; range = new Range(new Key(continueRow).followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()); } Scanner scanner; try { scanner = context.createScanner(level.metaTable(), Authorizations.EMPTY); } catch (TableNotFoundException e) { throw new RuntimeException(e); } scanner.setRange(range); return Iterators.transform(scanner.iterator(), entry -> entry.getKey().getRow().toString().substring(getDeletePrefixLength())); } else { throw new IllegalArgumentException(); } }

Target:
public Iterator<String> getGcCandidates(DataLevel level, String continuePoint) { if (level == DataLevel.ROOT) { byte[] json = context.getZooCache() .get(context.getZooKeeperRoot() + RootTable.ZROOT_TABLET_GC_CANDIDATES); Stream<String> candidates = RootGcCandidates.fromJson(json).stream().sorted(); if (continuePoint != null && !continuePoint.isEmpty()) { candidates = candidates.dropWhile(candidate -> candidate.compareTo(continuePoint) <= 0); } return candidates.iterator(); } else if (level == DataLevel.METADATA || level == DataLevel.USER) { Range range = MetadataSchema.DeletesSection.getRange(); if (continuePoint != null && !continuePoint.isEmpty()) { String continueRow = MetadataSchema.DeletesSection.encodeRow(continuePoint); range = new Range(new Key(continueRow).followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()); } Scanner scanner; try { scanner = context.createScanner(level.metaTable(), Authorizations.EMPTY); } catch (TableNotFoundException e) { throw new RuntimeException(e); } scanner.setRange(range); return Iterators.transform(scanner.iterator(), entry -> MetadataSchema.DeletesSection.decodeRow(entry.getKey().getRow().toString())); } else { throw new IllegalArgumentException(); } }