auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void startFileWatcher() { if (startedWatcher.get()) { return; } startedWatcher.set(true); Job job = new Job("Links File Watcher") { @Override protected IStatus run(IProgressMonitor monitor) { try { final Path dir = new File(System.getProperty("user.home")).toPath(); final WatchService watcher = FileSystems.getDefault().newWatchService(); WatchKey key; try { key = dir.register(watcher, StandardWatchEventKinds.ENTRY_MODIFY); } catch (IOException ex) { OseeLog.log(EditLinksNavigateItem.class, Level.SEVERE, ex); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex); } for (;;) { try { key = watcher.take(); } catch (InterruptedException ex) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex); } for (WatchEvent<?> event : key.pollEvents()) { @SuppressWarnings("unchecked") WatchEvent<Path> ev = (WatchEvent<Path>) event; Path filename = ev.context(); for (FileChangedListener listener : listeners) { listener.fileChanged(filename.toString()); } } boolean valid = key.reset(); if (!valid) { break; } } return Status.OK_STATUS; } catch (IOException ex) { OseeLog.log(EditLinksNavigateItem.class, Level.SEVERE, ex); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex); } } }; Jobs.startJob(job); }

Target:
private static void startFileWatcher() { if (startedWatcher.get()) { return; } startedWatcher.set(true); Job job = new Job("Links File Watcher") { @Override protected IStatus run(IProgressMonitor monitor) { try { final Path dir = new File(System.getProperty("user.home")).toPath(); final WatchService watcher = FileSystems.getDefault().newWatchService(); WatchKey key = dir.register(watcher, StandardWatchEventKinds.ENTRY_MODIFY); for (;;) { try { key = watcher.take(); } catch (InterruptedException ex) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex); } for (WatchEvent<?> event : key.pollEvents()) { @SuppressWarnings("unchecked") WatchEvent<Path> ev = (WatchEvent<Path>) event; Path filename = ev.context(); for (FileChangedListener listener : listeners) { listener.fileChanged(filename.toString()); } } boolean valid = key.reset(); if (!valid) { break; } } return Status.OK_STATUS; } catch (IOException ex) { OseeLog.log(EditLinksNavigateItem.class, Level.SEVERE, ex); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex); } } }; Jobs.startJob(job); }
Source:
private CompletableFuture<RecordMetadata> produceMessage(Producer<K, V> producer, ProducerRecord<K, V> record) { CompletableFuture<RecordMetadata> future = new CompletableFuture<>(); producer.send(record, (metadata, exception) -> { if (exception == null) { future.complete(metadata); } else { future.completeExceptionally(new KafkaClientException(metadata, exception)); } }); return future; }

Target:
private CompletableFuture<RecordMetadata> produceMessage(Producer<K, V> producer, ProducerRecord<K, V> record) { CompletableFuture<RecordMetadata> future = new CompletableFuture<>(); producer.send(record, (metadata, exception) -> { if (exception == null) { future.complete(metadata); } else { future.completeExceptionally(exception); } }); return future; }
Source:
protected TreeViewer doCreateTreeViewer(Composite parentComposite, int style) { fCheckboxTreeViewer = new CheckboxTreeViewer(parentComposite, style); fCheckboxTreeViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { fObjects.put(event.getElement(), event.getChecked()); } }); treeViewer = fCheckboxTreeViewer; return treeViewer; }

Target:
protected TreeViewer doCreateTreeViewer(Composite parentComposite, int style) { fCheckboxTreeViewer = new CheckboxTreeViewer(parentComposite, style); fCheckboxTreeViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked()) { fObjects.add(event.getElement()); } else { fObjects.remove(event.getElement()); } } }); return fCheckboxTreeViewer; }
Source:
protected void showBusy(boolean busy) { MPart part = site.getModel(); int tagsListCount = part.getTags().size(); boolean containsBusyTag = part.getTags().contains(CSSConstants.CSS_BUSY_CLASS); if (busy && !containsBusyTag) { part.getTags().add(CSSConstants.CSS_BUSY_CLASS); } else if (!busy && containsBusyTag) { part.getTags().remove(CSSConstants.CSS_BUSY_CLASS); } if (part.getTags().size() != tagsListCount) { UIEvents.publishEvent(createEvent(UIEvents.UILabel.TOPIC_BUSY) .withParam(UIEvents.EventTags.ELEMENT, part) .withParam(UIEvents.EventTags.ATTNAME, UIEvents.UILifeCycle.BUSY) .withParam(UIEvents.EventTags.NEW_VALUE, busy)); } }

Target:
protected void showBusy(boolean busy) { MPart part = site.getModel(); boolean containsBusyTag = part.getTags().contains(CSSConstants.CSS_BUSY_CLASS); if (busy && !containsBusyTag) { part.getTags().add(CSSConstants.CSS_BUSY_CLASS); } else if (!busy && containsBusyTag) { part.getTags().remove(CSSConstants.CSS_BUSY_CLASS); } }
Source:
public Map<String, Metric> getMetrics() { final Map<String, Metric> gauges = new HashMap<>(); gauges.put("open", (Gauge<Long>)() -> invoke("getOpenFileDescriptorCount")); gauges.put("max", (Gauge<Long>)() -> invoke("getMaxFileDescriptorCount")); gauges.put("exception.open.NoSuchMethod", openMethodMeter); gauges.put("exception.open.IllegalAccess", openAccessMeter); gauges.put("exception.open.InvocationTarget", openTargetMeter); gauges.put("exception.max.NoSuchMethod", maxMethodMeter); gauges.put("exception.max.IllegalAccess", maxAccessMeter); gauges.put("exception.max.InvocationTarget", maxTargetMeter); return Collections.unmodifiableMap(gauges); }

Target:
public Map<String, Metric> getMetrics() { final Map<String, Metric> gauges = new HashMap<>(); gauges.put(FDTYPE.get(0), (Gauge<Long>)() -> invoke(openMethod, FDTYPE.get(0))); gauges.put(FDTYPE.get(1), (Gauge<Long>)() -> invoke(maxMethod, FDTYPE.get(1))); for (String type: FDTYPE) { for(String ex: EXCEPTION) { gauges.put(String.format("%s.%s.%s", "exception", type, ex), calls.get(type).get(ex)); } } return Collections.unmodifiableMap(gauges); }
Source:
private void loadPlugins(String[] pluginsUrls) { for (final String url : pluginsUrls) { ScriptInjector.fromUrl(url) .setWindow(ScriptInjector.TOP_WINDOW) .setCallback(new Callback<Void, Exception>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(Exception reason) { Window.alert("Failed load pluing: " + url); } }).inject(); } }

Target:
private void loadPlugins(String[] pluginsUrls) { for (final String url : pluginsUrls) { ScriptInjector.fromUrl(url) .setWindow(ScriptInjector.TOP_WINDOW) .setCallback(new Callback<Void, Exception>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(Exception reason) { new ErrorDialog("Failed load pluing: " + url).show(); } }).inject(); } }
Source:
public BootSequence getSequence() { StringBuilder str = new StringBuilder(""); for (EntityModel a : getItems()) { if (a.getIsChangable()) { BootSequence bs = (BootSequence) a.getEntity(); str.append(bs.toString()); } } return !str.equals("") ? BootSequence.valueOf(str.toString()) : null; }

Target:
public BootSequence getSequence() { StringBuilder str = new StringBuilder(); for (EntityModel a : getItems()) { if (a.getIsChangable()) { BootSequence bs = (BootSequence) a.getEntity(); str.append(bs.toString()); } } return !str.equals("") ? BootSequence.valueOf(str.toString()) : null; }
Source:
protected void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID, DiskImage diskImage) { VM vm = vmDao.getVmsWithPlugInfo(diskImage.getId()).stream(). map(pair -> pair.getFirst()). findFirst().get(); setQcowCompat(diskImage.getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, vm.getRunOnVds()); }

Target:
protected void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID, DiskImage diskImage) { VM vm = vmDao.getVmsWithPlugInfo(diskImage.getId()).stream(). map(Pair::getFirst). findFirst().get(); setQcowCompat(diskImage.getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, vm.getRunOnVds()); }
Source:
private ChaosType pickChaosType(CloudClient cloudClient, String instanceId) { Random random = new Random(); List<ChaosType> applicable = Lists.newArrayList(); for (ChaosType chaosType : allChaosTypes) { if (chaosType.canApply(cloudClient, instanceId)) { applicable.add(chaosType); } } if (applicable.isEmpty()) { return null; } int index = random.nextInt(applicable.size()); return applicable.get(index); }

Target:
private ChaosType pickChaosType(CloudClient cloudClient, String instanceId) { Random random = new Random(); SshConfig sshConfig = new SshConfig(cfg); ChaosInstance instance = new ChaosInstance(cloudClient, instanceId, sshConfig); List<ChaosType> applicable = Lists.newArrayList(); for (ChaosType chaosType : allChaosTypes) { if (chaosType.isEnabled() && chaosType.canApply(instance)) { applicable.add(chaosType); } } if (applicable.isEmpty()) { return null; } int index = random.nextInt(applicable.size()); return applicable.get(index); }
Source:
public CryptByteBuffer(CryptByteBufferType type, SecretKey key, IvParameterSpec iv) throws InvalidKeyException, InvalidAlgorithmParameterException{ if(iv != null && type.ivSize == -1){ throw new UnsupportedTypeException(type, "This type does not take an IV."); } else if(iv != null){ this.iv = iv; } else if(type.ivSize != -1){ genIV(); } this.type = type; this.key = key; try{ if(type.cipherName == "RIJNDAEL"){ blockCipher = new Rijndael(type.keyType.keySize, type.blockSize); blockCipher.initialize(key.getEncoded()); if(type == CryptByteBufferType.RijndaelPCFB){ encryptPCFB = PCFBMode.create(blockCipher, this.iv.getIV()); decryptPCFB = PCFBMode.create(blockCipher, this.iv.getIV()); } } else{ encryptCipher = Cipher.getInstance(type.algName); decryptCipher = Cipher.getInstance(type.algName); encryptCipher.init(Cipher.ENCRYPT_MODE, this.key, this.iv); decryptCipher.init(Cipher.DECRYPT_MODE, this.key, this.iv); } }catch (UnsupportedCipherException e) { e.printStackTrace(); Logger.error(CryptByteBuffer.class, "Internal error; please report:", e); } catch (GeneralSecurityException e) { e.printStackTrace(); Logger.error(CryptByteBuffer.class, "Internal error; please report:", e); } }

Target:
public CryptByteBuffer(CryptByteBufferType type, SecretKey key, IvParameterSpec iv) throws InvalidKeyException, InvalidAlgorithmParameterException{ if(iv != null && !type.hasIV()){ throw new UnsupportedTypeException(type, "This type does not take an IV."); } else if(iv != null){ this.iv = iv; } else if(type.hasIV()){ genIV(); } this.type = type; this.key = key; try{ if(type.cipherName.equals("RIJNDAEL")){ blockCipher = new Rijndael(type.keyType.keySize, type.blockSize); blockCipher.initialize(key.getEncoded()); if(type == CryptByteBufferType.RijndaelPCFB){ encryptPCFB = PCFBMode.create(blockCipher, this.iv.getIV()); decryptPCFB = PCFBMode.create(blockCipher, this.iv.getIV()); } } else{ encryptCipher = Cipher.getInstance(type.algName); decryptCipher = Cipher.getInstance(type.algName); encryptCipher.init(Cipher.ENCRYPT_MODE, this.key, this.iv); decryptCipher.init(Cipher.DECRYPT_MODE, this.key, this.iv); } }catch (UnsupportedCipherException | GeneralSecurityException e) { e.printStackTrace(); Logger.error(CryptByteBuffer.class, "Internal error; please report:", e); } }
Source:
private String buildDayOfWeek() { Time t = new Time(mTimeZone); t.set(mMilliTime); long julianDay = Time.getJulianDay(mMilliTime, t.gmtoff); String dayOfWeek; mStringBuilder.setLength(0); if (julianDay == mTodayJulianDay) { dayOfWeek = mContext.getString(R.string.agenda_today, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else if (julianDay == mTodayJulianDay - 1) { dayOfWeek = mContext.getString(R.string.agenda_yesterday, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else if (julianDay == mTodayJulianDay + 1) { dayOfWeek = mContext.getString(R.string.agenda_tomorrow, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else { dayOfWeek = DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString(); } String[] split = dayOfWeek.toLowerCase().split(" "); StringBuilder sb = new StringBuilder(); for (String word : split) { sb.append(word.substring(0, 1).toUpperCase() + word.substring(1)); sb.append(" "); } dayOfWeek = sb.toString(); return dayOfWeek; }

Target:
private String buildDayOfWeek() { Time t = new Time(mTimeZone); t.set(mMilliTime); long julianDay = Time.getJulianDay(mMilliTime, t.gmtoff); String dayOfWeek; mStringBuilder.setLength(0); if (julianDay == mTodayJulianDay) { dayOfWeek = mContext.getString(R.string.agenda_today, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else if (julianDay == mTodayJulianDay - 1) { dayOfWeek = mContext.getString(R.string.agenda_yesterday, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else if (julianDay == mTodayJulianDay + 1) { dayOfWeek = mContext.getString(R.string.agenda_tomorrow, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else { dayOfWeek = DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString(); } return dayOfWeek; }
Source:
private OnHeapValueHolder<V> internalGet(final K key, final boolean updateAccess) throws CacheAccessException { getObserver.begin(); StoreEventSink<K, V> eventSink = null; try { OnHeapValueHolder<V> mapping = getQuiet(key); if (mapping == null) { getObserver.end(StoreOperationOutcomes.GetOutcome.MISS); return null; } if (updateAccess) { eventSink = storeEventDispatcher.eventSink(); mapping = setAccessTimeAndExpiryThenReturnMapping(key, mapping, timeSource.getTimeMillis(), eventSink); storeEventDispatcher.releaseEventSink(eventSink); } if (mapping != null) { getObserver.end(StoreOperationOutcomes.GetOutcome.HIT); } else { getObserver.end(StoreOperationOutcomes.GetOutcome.MISS); } return mapping; } catch (RuntimeException re) { if (eventSink != null) { storeEventDispatcher.releaseEventSinkAfterFailure(eventSink, re); } handleRuntimeException(re); return null; } }

Target:
private OnHeapValueHolder<V> internalGet(final K key, final boolean updateAccess) throws CacheAccessException { getObserver.begin(); try { OnHeapValueHolder<V> mapping = getQuiet(key); if (mapping == null) { getObserver.end(StoreOperationOutcomes.GetOutcome.MISS); return null; } if (updateAccess) { setAccessTimeAndExpiryThenReturnMappingOutsideLock(key, mapping, timeSource.getTimeMillis()); } getObserver.end(StoreOperationOutcomes.GetOutcome.HIT); return mapping; } catch (RuntimeException re) { handleRuntimeException(re); return null; } }
Source:
protected TrackingCall(Call<RequestT, ResponseT> delegate, Integer id, Set<Integer> outstandingRequests) { super(delegate); this.id = id; this.outstandingRequests = outstandingRequests; outstandingRequests.add(id); }

Target:
protected TrackingCall(Call<RequestT, ResponseT> delegate, Integer id, Set<Integer> outstandingRequests) { super(delegate); outstandingRequests.add(id); this.id = id; this.outstandingRequests = outstandingRequests; }
Source:
protected boolean canDoAction() { VmValidator vmValidator = createVmValidator(); SnapshotsValidator snapshotValidator = createSnapshotValidator(); StoragePoolValidator spValidator = createStoragePoolValidator(); if (!(validateVM(vmValidator) && validate(spValidator.isUp()) && validate(vmValidator.vmNotIlegal()) && validate(vmValidator.vmNotLocked()) && validate(snapshotValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotValidator.vmNotInPreview(getVmId())) && validate(vmValidator.vmNotDuringMigration()) && validate(vmValidator.vmNotRunningStateless()))) { return false; } List<DiskImage> disksList = getDisksList(); if (disksList.size() > 0) { MultipleStorageDomainsValidator sdValidator = createMultipleStorageDomainsValidator(disksList); DiskImagesValidator diskImagesValidator = createDiskImageValidator(disksList); if (!(validate(diskImagesValidator.diskImagesNotLocked()) && validate(diskImagesValidator.diskImagesNotIllegal()) && validate(sdValidator.allDomainsExistAndActive()) && validate(sdValidator.allDomainsWithinThresholds()))) { return false; } } if (getStorageDomainId().equals(Guid.Empty)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_SUITABLE_DOMAIN_FOUND); } return true; }

Target:
protected boolean canDoAction() { VmValidator vmValidator = createVmValidator(); SnapshotsValidator snapshotValidator = createSnapshotValidator(); StoragePoolValidator spValidator = createStoragePoolValidator(); if (!(validateVM(vmValidator) && validate(spValidator.isUp()) && validate(vmValidator.vmNotIlegal()) && validate(vmValidator.vmNotLocked()) && validate(snapshotValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotValidator.vmNotInPreview(getVmId())) && validate(vmValidator.vmNotDuringMigration()) && validate(vmValidator.vmNotRunningStateless()))) { return false; } List<DiskImage> disksList = getDisksList(); if (disksList.size() > 0) { MultipleStorageDomainsValidator sdValidator = createMultipleStorageDomainsValidator(disksList); DiskImagesValidator diskImagesValidator = createDiskImageValidator(disksList); if (!(validate(diskImagesValidator.diskImagesNotLocked()) && validate(diskImagesValidator.diskImagesNotIllegal()) && validate(sdValidator.allDomainsExistAndActive()) && validate(sdValidator.allDomainsWithinThresholds()))) { return false; } } if (getParameters().isSaveMemory() && Guid.Empty.equals(getStorageDomainIdForVmMemory())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_SUITABLE_DOMAIN_FOUND); } return true; }
Source:
private void handleOnEscape() { if (getText().equals(previousText)) { onCancel.run(); } else { revertEdit(); } }

Target:
private void handleOnEscape() { if (getText().equals(previousText)) { onCancel.run(); } else if (suggestions.isShowing()){ suggestions.hide(); } else { revertEdit(); } }
Source:
public List<InputRow> parseBatch(Map<String, Object> theMap) { final List<String> dimensions = !this.dimensions.isEmpty() ? this.dimensions : Lists.newArrayList( Sets.difference( theMap.keySet(), parseSpec.getDimensionsSpec() .getDimensionExclusions() ) ); final DateTime timestamp; try { timestamp = parseSpec.getTimestampSpec().extractTimestamp(theMap); if (timestamp == null) { final String input = theMap.toString(); throw new NullPointerException( StringUtils.format( "Null timestamp in input: %s", input.length() < 100 ? input : input.substring(0, 100) + "..." ) ); } } catch (Exception e) { throw new ParseException(e, "Unparseable timestamp found! Event: %s", theMap); } return ImmutableList.of(new MapBasedInputRow(timestamp.getMillis(), dimensions, theMap)); }

Target:
public List<InputRow> parseBatch(Map<String, Object> theMap) { final List<String> dimensions; if (!this.dimensions.isEmpty()) { dimensions = this.dimensions; } else { dimensions = Lists.newArrayList( Sets.difference(theMap.keySet(), parseSpec.getDimensionsSpec().getDimensionExclusions()) ); } final DateTime timestamp; try { timestamp = parseSpec.getTimestampSpec().extractTimestamp(theMap); if (timestamp == null) { final String input = theMap.toString(); throw new NullPointerException( StringUtils.format( "Null timestamp in input: %s", input.length() < 100 ? input : input.substring(0, 100) + "..." ) ); } } catch (Exception e) { throw new ParseException(e, "Unparseable timestamp found! Event: %s", theMap); } return ImmutableList.of(new MapBasedInputRow(timestamp, dimensions, theMap)); }
Source:
public String getMappedType(final String requestName, final String argName) { if (containsArgument(requestName, argName)) { return typeMapper.get(requestName).get(argName); } else { LOG.error("Could not map type for: " + requestName + ", " + argName); } return null; }

Target:
public String getMappedType(final String requestName, final String argName) { return ds3TypeMapper.getMappedType(requestName, argName); }
Source:
public CPPASTQualifiedName copy(CopyStyle style) { CPPASTQualifiedName copy = new CPPASTQualifiedName(); if (fLastName != null) copy.addName(fLastName.copy(style)); for (ICPPASTNameSpecifier nameSpecifier : getQualifier()) copy.addNameSpecifier(nameSpecifier == null ? null : nameSpecifier.copy(style)); copy.setFullyQualified(fIsFullyQualified); copy.setOffsetAndLength(this); if (style == CopyStyle.withLocations) { copy.setCopyLocation(this); } return copy; }

Target:
public CPPASTQualifiedName copy(CopyStyle style) { CPPASTQualifiedName copy = new CPPASTQualifiedName(); if (fLastName != null) copy.addName(fLastName.copy(style)); for (ICPPASTNameSpecifier nameSpecifier : getQualifier()) { copy.addNameSpecifier(nameSpecifier == null ? null : nameSpecifier.copy(style)); } copy.setFullyQualified(fIsFullyQualified); copy.setOffsetAndLength(this); if (style == CopyStyle.withLocations) { copy.setCopyLocation(this); } return copy; }
Source:
long grabLocksAndRun(SweepLocks locks) throws InterruptedException { boolean sweptSuccessfully = false; try { if (isSweepEnabled.get()) { locks.lockOrRefresh(); if (locks.haveLocks()) { sweptSuccessfully = runOnce(); } else { log.warn("Skipping sweep because sweep is running elsewhere."); } } else { log.info("Skipping sweep because it is currently disabled."); } } catch (InsufficientConsistencyException e) { log.warn("Could not sweep because not all nodes of the database are online.", e); } catch (RuntimeException e) { sweepMetrics.sweepError(); if (checkAndRepairTableDrop()) { log.error("The table being swept by the background sweeper was dropped, moving on..."); } else { SweepBatchConfig lastBatchConfig = getAdjustedBatchConfig(); log.error("The background sweep job failed unexpectedly with batch config {}" + ". Attempting to continue with a lower batch size...", SafeArg.of("", lastBatchConfig), e); batchSizeMultiplier = Math.max(batchSizeMultiplier / 2, 1.5 / lastBatchConfig.candidateBatchSize()); } } if (sweptSuccessfully) { batchSizeMultiplier = Math.min(1.0, batchSizeMultiplier * 1.01); return sweepPauseMillis.get(); } else { return 20 * (1000 + sweepPauseMillis.get()); } }

Target:
long grabLocksAndRun(SweepLocks locks) throws InterruptedException { boolean sweptSuccessfully = false; try { if (isSweepEnabled.get()) { locks.lockOrRefresh(); if (locks.haveLocks()) { sweptSuccessfully = runOnce(); } else { log.debug("Skipping sweep because sweep is running elsewhere."); } } else { log.debug("Skipping sweep because it is currently disabled."); } } catch (InsufficientConsistencyException e) { log.warn("Could not sweep because not all nodes of the database are online.", e); } catch (RuntimeException e) { sweepMetrics.sweepError(); if (checkAndRepairTableDrop()) { log.info("The table being swept by the background sweeper was dropped, moving on..."); } else { SweepBatchConfig lastBatchConfig = getAdjustedBatchConfig(); log.warn("The background sweep job failed unexpectedly with batch config {}." + " Attempting to continue with a lower batch size...", SafeArg.of("cell batch size", lastBatchConfig), e); batchSizeMultiplier = Math.max(batchSizeMultiplier / 2, 1.5 / lastBatchConfig.candidateBatchSize()); } } if (sweptSuccessfully) { batchSizeMultiplier = Math.min(1.0, batchSizeMultiplier * 1.01); return sweepPauseMillis.get(); } else { return 20 * (1000 + sweepPauseMillis.get()); } }
Source:
public static InspectorModulesProvider defaultInspectorModulesProvider(final Context context) { return new InspectorModulesProvider() { @Override public Iterable<ChromeDevtoolsDomain> get() { ArrayList<ChromeDevtoolsDomain> modules = new ArrayList<ChromeDevtoolsDomain>(); modules.add(new Console()); modules.add(new CSS()); modules.add(new Debugger()); if (Build.VERSION.SDK_INT >= AndroidDOMConstants.MIN_API_LEVEL) { modules.add(new DOM(new AndroidDOMProviderFactory((Application)context.getApplicationContext()))); } modules.add(new DOMStorage(context)); modules.add(new HeapProfiler()); modules.add(new Inspector()); modules.add(new Network(context, DefaultAsyncPrettyPrinterRegistry.getInstance())); modules.add(new Page(context)); modules.add(new Profiler()); modules.add(new Runtime()); modules.add(new Worker()); if (Build.VERSION.SDK_INT >= DatabaseConstants.MIN_API_LEVEL) { modules.add(new Database(context, new DefaultDatabaseFilesProvider(context))); } return modules; } }; }

Target:
public static InspectorModulesProvider defaultInspectorModulesProvider(final Context context) { return new InspectorModulesProvider() { @Override public Iterable<ChromeDevtoolsDomain> get() { return new DefaultInspectorModulesBuilder(context).finish(); } }; }
Source:
public static void moveToList(final Collection<Geocache> caches, final int listId) { if (caches.isEmpty()) { return; } final AbstractList list = AbstractList.getListById(listId); if (list == null) { return; } if (!list.isConcrete()) { return; } init(); final SQLiteStatement add = PreparedStatement.ADD_TO_LIST.getStatement(); final SQLiteStatement remove = PreparedStatement.REMOVE_FROM_ALL_LISTS.getStatement(); database.beginTransaction(); try { for (final Geocache cache : caches) { remove.bindString(1, cache.getGeocode()); remove.execute(); add.bindLong(1, listId); add.bindString(2, cache.getGeocode()); add.execute(); cache.getLists().add(listId); } database.setTransactionSuccessful(); } finally { database.endTransaction(); } }

Target:
public static void moveToList(final Collection<Geocache> caches, final int listId) { if (caches.isEmpty()) { Log.e("No cache was passed to moveToList"); return; } final AbstractList list = AbstractList.getListById(listId); if (list == null) { Log.e("Target list with id " + list + " does not exist in moveToList"); return; } if (!list.isConcrete()) { return; } init(); final SQLiteStatement add = PreparedStatement.ADD_TO_LIST.getStatement(); final SQLiteStatement remove = PreparedStatement.REMOVE_FROM_ALL_LISTS.getStatement(); database.beginTransaction(); try { for (final Geocache cache : caches) { remove.bindString(1, cache.getGeocode()); remove.execute(); add.bindLong(1, listId); add.bindString(2, cache.getGeocode()); add.execute(); cache.getLists().add(listId); } database.setTransactionSuccessful(); } finally { database.endTransaction(); } }
Source:
public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TocTreeNodeLayer other = (TocTreeNodeLayer) obj; if (this.layer != other.layer && (this.layer == null || !this.layer.equals(other.layer))) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (obj instanceof TocTreeNodeLayer) { final TocTreeNodeLayer other = (TocTreeNodeLayer) obj; return this.layer != null && this.layer.equals(other.layer); } else { return false; } }
Source:
public static void beforeClass() throws TmfTraceException { fTrace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null); fProvider = new TmfEventTableDataProvider(fTrace); TmfSignalManager.deregister(fTrace); }

Target:
public static void beforeClass() throws TmfTraceException { fTrace.dispose(); fTrace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null); fProvider = new TmfEventTableDataProvider(fTrace); TmfSignalManager.deregister(fTrace); }
Source:
public AssetDto createAsset(String resourceType, MultipartFile file, String group, List<String> categories) { BaseResourceDataBean resourceFile = new BaseResourceDataBean(); validateMimeType(resourceType, file.getContentType()); try { resourceFile.setInputStream(file.getInputStream()); resourceFile.setFileSize(file.getBytes().length / 1000); resourceFile.setFileName(file.getOriginalFilename()); resourceFile.setMimeType(file.getContentType()); resourceFile.setDescr(file.getOriginalFilename()); resourceFile.setMainGroup(group); resourceFile.setResourceType(resourceType); resourceFile.setCategories(categories.stream() .map(code -> categoryManager.getCategory(code)).collect(Collectors.toList())); ResourceInterface resource = resourceManager.addResource(resourceFile); return convertResourceToDto(resourceType, resourceManager.loadResource(resource.getId())); } catch (ApsSystemException e) { throw new RestServerError("Error saving new resource", e); } catch (IOException e) { throw new RestServerError("Error reading resource stream", e); } }

Target:
public AssetDto createAsset(String resourceType, MultipartFile file, String group, List<String> categories) { BaseResourceDataBean resourceFile = new BaseResourceDataBean(); validateMimeType(resourceType, file.getContentType()); try { resourceFile.setInputStream(file.getInputStream()); resourceFile.setFileSize(file.getBytes().length / 1000); resourceFile.setFileName(file.getOriginalFilename()); resourceFile.setMimeType(file.getContentType()); resourceFile.setDescr(file.getOriginalFilename()); resourceFile.setMainGroup(group); resourceFile.setResourceType(resourceType); resourceFile.setCategories(categories.stream() .map(code -> categoryManager.getCategory(code)).collect(Collectors.toList())); ResourceInterface resource = resourceManager.addResource(resourceFile); return convertResourceToDto(resourceType, resourceManager.loadResource(resource.getId())); } catch (ApsSystemException e) { throw new RestServerError("plugins.jacms.resources.resourceManager.error.list", e); } catch (IOException e) { log.error("Error reading file input stream", e); throw new RestServerError("plugins.jacms.resources.image.errorReadingStream", e); } }
Source:
protected void configureCommitLogBackups() { if (!config.isBackingUpCommitLogs()) return; Properties props = new Properties(); props.put("archive_command", config.getCommitLogBackupArchiveCmd()); props.put("restore_command", config.getCommitLogBackupRestoreCmd()); props.put("restore_directories", config.getCommitLogBackupRestoreFromDirs()); props.put("restore_point_in_time", config.getCommitLogBackupRestorePointInTime()); try (FileOutputStream fos = new FileOutputStream(new File(config.getCommitLogBackupPropsFile()))) { props.store(fos, "cassandra commit log archive props, as written by priam"); } catch (IOException e) { logger.error("Could not store commitlog_archiving.properties", e); } }

Target:
protected void configureCommitLogBackups() throws IOException { if (!config.isBackingUpCommitLogs()) return; Properties props = new Properties(); props.put("archive_command", config.getCommitLogBackupArchiveCmd()); props.put("restore_command", config.getCommitLogBackupRestoreCmd()); props.put("restore_directories", config.getCommitLogBackupRestoreFromDirs()); props.put("restore_point_in_time", config.getCommitLogBackupRestorePointInTime()); try (FileOutputStream fos = new FileOutputStream(new File(config.getCommitLogBackupPropsFile()))) { props.store(fos, "cassandra commit log archive props, as written by priam"); } catch (IOException e) { logger.error("Could not store commitlog_archiving.properties", e); throw e; } }
Source:
public void bulkWrite() throws IOException { try (BufferedMutator bufferedMutator = connection.getBufferedMutator(TableName.valueOf(BENCHMARK_WRITE_TABLE))) { String rowPrefix = getRowPrefix(jobConfig.cellsPerRow, jobConfig.cellSize); byte[] cellValue = getRandomBytes(jobConfig.cellSize); ImmutableList.Builder<Put> putBuilder = ImmutableList.builderWithExpectedSize(ROWS_PER_BATCH); long currentTimestamp = System.currentTimeMillis(); for (int rowInd = 0, sendBatchInd = 0; rowInd < jobConfig.totalRows; rowInd++, sendBatchInd++) { Put put = new Put(Bytes.toBytes(rowPrefix + String.format(SUFFIX_FMT, rowInd))); for (int cellInd = 0; cellInd < jobConfig.cellsPerRow; cellInd++) { put.addColumn( COL_FAMILY, Bytes.toBytes("qualifier-" + String.format(SUFFIX_FMT, cellInd)), currentTimestamp, cellValue); } putBuilder.add(put); if (sendBatchInd % ROWS_PER_BATCH == 0 || rowInd == (jobConfig.totalRows - 1)) { bufferedMutator.mutate(putBuilder.build()); bufferedMutator.flush(); putBuilder = ImmutableList.builderWithExpectedSize(ROWS_PER_BATCH); } } } }

Target:
public void bulkWrite() throws IOException { try (BufferedMutator bufferedMutator = connection.getBufferedMutator(TableName.valueOf(BENCHMARK_WRITE_TABLE))) { for (int rowInd = 0; rowInd < 100; rowInd++) { Put put = new Put( Bytes.toBytes(MUTATE_ROW_PREFIX + String.format("%06d", getRandomInt(1_000_000)))); for (int cellInd = 0; cellInd < rowShapeParams.cellsPerRow; cellInd++) { put.addColumn( COL_FAMILY, Bytes.toBytes("qualifier-" + String.format("%06d", cellInd)), SAMPLE_TIMESTAMP, getRandomBytes(rowShapeParams.cellSize)); } bufferedMutator.mutate(put); } } }
Source:
public ListBoxModel doFillInheritFromItems(@QueryParameter("cloud") String cloudName) { cloudName = Util.fixEmpty(cloudName); ListBoxModel result = new ListBoxModel(); result.add("-- Default inheritance --", "<default>"); result.add("-- Disable inheritance --", " "); Cloud cloud; if (cloudName == null) { cloud = Jenkins.get().clouds.get(KubernetesCloud.class); } else { cloud = Jenkins.get().getCloud(cloudName); } if (cloud instanceof KubernetesCloud) { List<PodTemplate> templates = ((KubernetesCloud) cloud).getTemplates(); result.addAll(templates.stream() .filter(template -> StringUtils.isNotEmpty(template.getName())) .map(PodTemplate::getName) .map(ListBoxModel.Option::new) .collect(Collectors.toList())); } return result; }

Target:
public ListBoxModel doFillInheritFromItems(@QueryParameter("cloud") String cloudName) { cloudName = Util.fixEmpty(cloudName); ListBoxModel result = new ListBoxModel(); result.add("—Default inheritance—", "<default>"); result.add("—Disable inheritance—", " "); Cloud cloud; if (cloudName == null) { cloud = Jenkins.get().clouds.get(KubernetesCloud.class); } else { cloud = Jenkins.get().getCloud(cloudName); } if (cloud instanceof KubernetesCloud) { List<PodTemplate> templates = ((KubernetesCloud) cloud).getTemplates(); result.addAll(templates.stream() .filter(template -> StringUtils.isNotEmpty(template.getName())) .map(PodTemplate::getName) .map(ListBoxModel.Option::new) .collect(Collectors.toList())); } return result; }
Source:
private ICompletionProposal[] getProbeVariableCompletions(IDocument document, int offset, String prefix){ String probe = getProbe(document, offset); String[] completionData = stpMetadataSingleton.getProbeVariableCompletions(probe, prefix); if(completionData[0].equals(STPMetadataSingleton.NO_MATCHES[0])) return NO_COMPLETIONS; ICompletionProposal[] result = new ICompletionProposal[completionData.length]; int prefixLength = prefix.length(); for (int i = 0; i < completionData.length; i++){ int endIndex = completionData[i].indexOf(':'); result[i] = new CompletionProposal( completionData[i].substring(prefixLength, endIndex), offset, 0, endIndex - prefixLength, null, completionData[i] + " - variable", null, null); } return result; }

Target:
private ICompletionProposal[] getProbeVariableCompletions(IDocument document, int offset, String prefix){ String probe = getProbe(document, offset); String[] completionData = stpMetadataSingleton.getProbeVariableCompletions(probe, prefix); ICompletionProposal[] result = new ICompletionProposal[completionData.length]; int prefixLength = prefix.length(); for (int i = 0; i < completionData.length; i++){ int endIndex = completionData[i].indexOf(':'); result[i] = new CompletionProposal( completionData[i].substring(prefixLength, endIndex), offset, 0, endIndex - prefixLength, null, completionData[i] + " - variable", null, null); } return result; }
Source:
private ProjectAnalysisImpl createProjectAnalysis(CeTask.Status status) { Long analysisDate = getAnalysisDate(); AnalysisImpl analysis = null; if (analysisDate != null) { analysis = new AnalysisImpl(analysisMetadataHolder.getUuid(), analysisDate); } return new ProjectAnalysisImpl( new CeTaskImpl(this.ceTask.getUuid(), status), createProject(this.ceTask), analysis, analysisDate == null ? system2.now() : analysisDate, ScannerContextImpl.from(reportReader.readContextProperties()), status == SUCCESS ? createQualityGate() : null, createBranch()); }

Target:
private ProjectAnalysisImpl createProjectAnalysis(CeTask.Status status) { return new ProjectAnalysisImpl( new CeTaskImpl(this.ceTask.getUuid(), status), createProject(this.ceTask), getAnalysis().orElse(null), getAnalysis().map(a -> a.getDate().getTime()).orElse(system2.now()), ScannerContextImpl.from(reportReader.readContextProperties()), status == SUCCESS ? createQualityGate() : null, createBranch()); }
Source:
private void validateLabelTemplate() { if (labelTemplate == null) { addError("labelTemplate", BLANK_LABEL_TEMPLATE_ERROR_MESSAGE); return; } if (XmlUtils.doesNotMatchUsingXsdRegex(LABEL_TEMPLATE_FORMAT_REGEX, labelTemplate)) { addError("labelTemplate", LABEL_TEMPLATE_ERROR_MESSAGE); return; } if (validateLabelTemplateTruncation(labelTemplate)) { addError("labelTemplate", String.format("Length of zero not allowed on label %s defined on pipeline %s.", labelTemplate, name)); return; } Set<String> templateVariables = getTemplateVariables(); List<String> materialNames = allowedTemplateVariables(); for (final String templateVariable : templateVariables) { if (!CollectionUtils.exists(materialNames, withNameSameAs(templateVariable))) { addError("labelTemplate", String.format(ERR_TEMPLATE, name(), templateVariable)); } } }

Target:
private void validateLabelTemplate() { if (StringUtil.isBlank(labelTemplate)) { addError("labelTemplate", BLANK_LABEL_TEMPLATE_ERROR_MESSAGE); return; } if (XmlUtils.doesNotMatchUsingXsdRegex(LABEL_TEMPLATE_FORMAT_REGEX, labelTemplate)) { addError("labelTemplate", LABEL_TEMPLATE_ERROR_MESSAGE); return; } if (validateLabelTemplateTruncation(labelTemplate)) { addError("labelTemplate", String.format("Length of zero not allowed on label %s defined on pipeline %s.", labelTemplate, name)); return; } Set<String> templateVariables = getTemplateVariables(); List<String> materialNames = allowedTemplateVariables(); for (final String templateVariable : templateVariables) { if (!CollectionUtils.exists(materialNames, withNameSameAs(templateVariable))) { addError("labelTemplate", String.format(ERR_TEMPLATE, name(), templateVariable)); } } }
Source:
public void configuredTwoLabels() { PlatformLabelerNodeProperty nodeProperty = new PlatformLabelerNodeProperty(); LabelConfig labelConfig = new LabelConfig(); labelConfig.setArchitectureName(false); labelConfig.setArchitectureNameVersion(false); labelConfig.setName(false); labelConfig.setNameVersion(false); nodeProperty.setLabelConfig(labelConfig); r.jenkins.getNodeProperties().add(nodeProperty); nodeLabelCache.onConfigurationChange(); Set<LabelAtom> labelsAfter = computer.getNode().getAssignedLabels(); System.err.println(labelsAfter); assertThat(nodeLabelCache.getLabelsForNode(computer.getNode()).size(), is(2)); assertThat(labelsAfter.size(), is(3)); }

Target:
public void configuredTwoLabels() { PlatformLabelerNodeProperty nodeProperty = new PlatformLabelerNodeProperty(); LabelConfig labelConfig = new LabelConfig(); labelConfig.setArchitectureName(false); labelConfig.setArchitectureNameVersion(false); labelConfig.setName(false); labelConfig.setNameVersion(false); nodeProperty.setLabelConfig(labelConfig); r.jenkins.getNodeProperties().add(nodeProperty); nodeLabelCache.onConfigurationChange(); Collection<LabelAtom> expected = new HashSet<>(); expected.add(r.jenkins.getLabelAtom("master")); expected.add(r.jenkins.getLabelAtom(platformDetails.getArchitecture())); expected.add(r.jenkins.getLabelAtom(platformDetails.getVersion())); Set<LabelAtom> labelsAfter = computer.getNode().getAssignedLabels(); assertEquals(expected, labelsAfter); }
Source:
public Builder withService(String serviceName, Object service) { Object existing = serviceProviders.put(serviceName, service); if (existing != null) { throw new IllegalArgumentException( format("New scope \"%s\" already bound to service %s, cannot be rebound to %s", name, existing, service)); } return this; }

Target:
public Builder withService(String serviceName, Object service) { if (service instanceof Scoped) { throw new IllegalArgumentException(String.format( "For service %s, %s must not be an instance of %s, use \"withScopedService\" instead.", serviceName, service, Scoped.class.getSimpleName())); } return doWithService(serviceName, service); }
Source:
public void describeTo(final Description description) { this.matcher.describeTo( description.appendText("MkAnswer body matching: ") ); }

Target:
public void describeTo(final Description description) { this.matcher.describeTo( description.appendText("MkAnswer body bytes matching: ") ); }
Source:
private List<Object> getStereotypeIconsFromProfile(Stereotype appliedStereotype) { List<Object> images = new ArrayList<Object>(); Resource eResource = appliedStereotype.eResource(); if (eResource != null) { ResourceSet resourceSet = eResource.getResourceSet(); if (resourceSet != null) { URIConverter uriConverter = resourceSet.getURIConverter(); URI normalizedURI = uriConverter.normalize(eResource.getURI()); for (org.eclipse.uml2.uml.Image icon : appliedStereotype.getIcons()) { String location = icon.getLocation(); if (!UML2Util.isEmpty(location)) { URI uri = URI.createURI(location).resolve(normalizedURI); URL url; try { url = new URL(uriConverter.normalize(uri).toString()); url.openStream().close(); images.add(url); } catch (MalformedURLException e) { UMLCompareEditPlugin.getPlugin().getLog().log( new Status(IStatus.WARNING, "org.eclipse.emf.compare.uml2.edit", UMLCompareEditPlugin.INSTANCE.getString( "Unable_To_Retreive_Icon_Error_Message", new Object[] {location }), e)); } catch (IOException e) { UMLCompareEditPlugin.getPlugin().getLog().log( new Status(IStatus.WARNING, "org.eclipse.emf.compare.uml2.edit", UMLCompareEditPlugin.INSTANCE.getString( "Unable_To_Retreive_Icon_Error_Message", new Object[] {location }), e)); } } else { } } } } if (images.isEmpty()) { return null; } return images; }

Target:
private List<Object> getStereotypeIconsFromProfile(Stereotype appliedStereotype) { List<Object> images = new ArrayList<Object>(); for (org.eclipse.uml2.uml.Image icon : appliedStereotype.getIcons()) { String location = icon.getLocation(); if (!UML2Util.isEmpty(location)) { Object img = getIconFromLocation(icon.eResource(), location); if (img != null) { images.add(img); } } else { } } if (images.isEmpty()) { images = null; } return images; }
Source:
public SkuDetails(JSONObject source) throws JSONException { String responseType = source.optString(Constants.RESPONSE_TYPE); if (responseType == null) { responseType = Constants.PRODUCT_TYPE_MANAGED; } productId = source.optString(Constants.RESPONSE_PRODUCT_ID); title = source.optString(Constants.RESPONSE_TITLE); description = source.optString(Constants.RESPONSE_DESCRIPTION); isSubscription = responseType.equalsIgnoreCase(Constants.PRODUCT_TYPE_SUBSCRIPTION); currency = source.optString(Constants.RESPONSE_PRICE_CURRENCY); priceLong = source.optLong(Constants.RESPONSE_PRICE_MICROS); priceValue = priceLong / 1000000d; priceText = source.optString(Constants.RESPONSE_PRICE); subscriptionPeriod = parsePeriod(source.optString(Constants.RESPONSE_SUBSCRIPTION_PERIOD, null)); subscriptionFreeTrialPeriod = parsePeriod(source.optString(Constants.RESPONSE_FREE_TRIAL_PERIOD, null)); introductoryPriceLong = source.optLong(Constants.RESPONSE_INTRODUCTORY_PRICE_MICROS); introductoryPriceValue = introductoryPriceLong / 1000000d; introductoryPriceText = source.optString(Constants.RESPONSE_INTRODUCTORY_PRICE, null); introductoryPricePeriod = parsePeriod(source.optString(Constants.RESPONSE_INTRODUCTORY_PRICE_PERIOD, null)); introductoryPriceCycles = source.optInt(Constants.RESPONSE_INTRODUCTORY_PRICE_CYCLES); }

Target:
public SkuDetails(JSONObject source) throws JSONException { String responseType = source.optString(Constants.RESPONSE_TYPE); if (responseType == null) { responseType = Constants.PRODUCT_TYPE_MANAGED; } productId = source.optString(Constants.RESPONSE_PRODUCT_ID); title = source.optString(Constants.RESPONSE_TITLE); description = source.optString(Constants.RESPONSE_DESCRIPTION); isSubscription = responseType.equalsIgnoreCase(Constants.PRODUCT_TYPE_SUBSCRIPTION); currency = source.optString(Constants.RESPONSE_PRICE_CURRENCY); priceLong = source.optLong(Constants.RESPONSE_PRICE_MICROS); priceValue = priceLong / 1000000d; priceText = source.optString(Constants.RESPONSE_PRICE); subscriptionPeriod = parsePeriod(source.optString(Constants.RESPONSE_SUBSCRIPTION_PERIOD, "P")); subscriptionFreeTrialPeriod = parsePeriod(source.optString(Constants.RESPONSE_FREE_TRIAL_PERIOD, "P")); haveTrialPeriod = subscriptionFreeTrialPeriod.toStandardSeconds().getSeconds() != 0; introductoryPriceLong = source.optLong(Constants.RESPONSE_INTRODUCTORY_PRICE_MICROS); introductoryPriceValue = introductoryPriceLong / 1000000d; introductoryPriceText = source.optString(Constants.RESPONSE_INTRODUCTORY_PRICE, null); introductoryPricePeriod = parsePeriod(source.optString(Constants.RESPONSE_INTRODUCTORY_PRICE_PERIOD, "P")); haveIntroductoryPeriod = introductoryPricePeriod.toStandardSeconds().getSeconds() != 0; introductoryPriceCycles = source.optInt(Constants.RESPONSE_INTRODUCTORY_PRICE_CYCLES); }
Source:
public TrustAllSocket() { TrustManager[] trustAllCerts = new TrustManager[] {new X509ExtendedTrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } @Override public void checkClientTrusted(X509Certificate[] arg0, String arg1, Socket arg2) throws CertificateException { } @Override public void checkClientTrusted(X509Certificate[] arg0, String arg1, SSLEngine arg2) throws CertificateException { } @Override public void checkServerTrusted(X509Certificate[] arg0, String arg1, Socket arg2) throws CertificateException { } @Override public void checkServerTrusted(X509Certificate[] arg0, String arg1, SSLEngine arg2) throws CertificateException { } }}; SSLContext ctx = null; try { ctx = SSLContext.getInstance("TLS"); } catch (NoSuchAlgorithmException e1) { e1.printStackTrace(); } try { ctx.init(null, trustAllCerts, new java.security.SecureRandom()); } catch (KeyManagementException e) { e.printStackTrace(); } sf = ctx.getSocketFactory(); }

Target:
public TrustAllSocket() throws NoSuchAlgorithmException, KeyManagementException { TrustManager[] trustAllCerts = new TrustManager[] {new X509ExtendedTrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } @Override public void checkClientTrusted(X509Certificate[] arg0, String arg1, Socket arg2) throws CertificateException { } @Override public void checkClientTrusted(X509Certificate[] arg0, String arg1, SSLEngine arg2) throws CertificateException { } @Override public void checkServerTrusted(X509Certificate[] arg0, String arg1, Socket arg2) throws CertificateException { } @Override public void checkServerTrusted(X509Certificate[] arg0, String arg1, SSLEngine arg2) throws CertificateException { } }}; SSLContext ctx = null; ctx = SSLContext.getInstance("TLS"); ctx.init(null, trustAllCerts, new java.security.SecureRandom()); sf = ctx.getSocketFactory(); }