auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void write(OutputStream out) { try { IOUtils.copy(results.getInputStream(), out); } catch (IOException e) { log.warn(e.getMessage()); throw new WebApplicationException(Response.status(Status.SERVICE_UNAVAILABLE) .entity("Service Unavailable, IO Exception with Search Engine").build()); } finally { results.disconnect(); } }

Target:
public void write(OutputStream out) { try { IOUtils.copy(results.getInputStream(), out); } catch (IOException e) { log.warn(e.getMessage(), e); throw new WebApplicationException(Response.status(Status.SERVICE_UNAVAILABLE) .entity("Service Unavailable, IO Exception with Search Engine").build()); } finally { results.disconnect(); } }
Source:
public void adsTrackingOptOutFandom() { networkTrafficInterceptor.startIntercepting(); Boolean noKikimoraRequestFound = false; Boolean noKruxRequestFound = false; String url = TestAdsTrackingOptOutOasis.appendTrackingOptOutParameters(urlBuilder.getFandomUrl()); AdsFandomObject adsFandomObject = new AdsFandomObject(driver, url); try { adsFandomObject.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, TestAdsTrackingOptOutOasis.KIKIMORA_PATTERN); } catch (TimeoutException exception) { noKikimoraRequestFound = true; } try { adsFandomObject.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, TestAdsTrackingOptOutOasis.KRUX_PATTERN); } catch (TimeoutException exception) { noKruxRequestFound = true; } assertTrue(noKikimoraRequestFound); assertTrue(noKruxRequestFound); }

Target:
public void adsTrackingOptOutFandom() { networkTrafficInterceptor.startIntercepting(); Boolean noKikimoraRequestFound = false; Boolean noKruxRequestFound = false; String url = TestAdsTrackingOptOutOasis.appendTrackingOptOutParameters(urlBuilder.getFandomUrl()); AdsFandomObject adsFandomObject = new AdsFandomObject(driver, url); try { adsFandomObject.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, TestAdsTrackingOptOutOasis.KIKIMORA_PATTERN); } catch (TimeoutException exception) { noKikimoraRequestFound = true; } try { adsFandomObject.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, TestAdsTrackingOptOutOasis.KRUX_PATTERN); } catch (TimeoutException exception) { noKruxRequestFound = true; } Assertion.assertTrue( noKikimoraRequestFound, "Kikimora tracking is not disabled, request to Data Warehouse was found" ); Assertion.assertTrue( noKruxRequestFound, "Krux tracking is not disabled, request to Krux services was found" ); }
Source:
public void streamStoreTablesSupportAdditionalCleanupTasks() { Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE); String shortName = "l"; String longName = "llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch"; schema.addStreamStoreDefinition( new StreamStoreDefinitionBuilder(shortName, longName, ValueType.VAR_SIGNED_LONG) .hashRowComponents() .build()); schema.addCleanupTask(StreamTableType.HASH.getTableName(shortName), () -> (cells, tx) -> false); schema.addCleanupTask(StreamTableType.INDEX.getTableName(shortName), () -> (cells, tx) -> false); assertCleanupMetadataInSchemaSatisfies( schema, StreamTableType.VALUE.getTableName(shortName), NULL_CLEANUP_METADATA_ASSERTION); assertCleanupMetadataInSchemaSatisfies( schema, StreamTableType.HASH.getTableName(shortName), ARBITRARY_CLEANUP_METADATA_ASSERTION); assertCleanupMetadataInSchemaSatisfies( schema, StreamTableType.METADATA.getTableName(shortName), getStreamStoreMetadataAssertion(2, ValueType.VAR_SIGNED_LONG)); assertCleanupMetadataInSchemaSatisfies( schema, StreamTableType.INDEX.getTableName(shortName), ARBITRARY_CLEANUP_METADATA_ASSERTION); }

Target:
public void streamStoreTablesSupportAdditionalCleanupTasks() { Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE); String shortName = "l"; String longName = "Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch"; schema.addStreamStoreDefinition( new StreamStoreDefinitionBuilder(shortName, longName, ValueType.VAR_SIGNED_LONG) .hashRowComponents() .build()); schema.addCleanupTask(StreamTableType.HASH.getTableName(shortName), () -> (cells, tx) -> false); schema.addCleanupTask(StreamTableType.INDEX.getTableName(shortName), () -> (cells, tx) -> false); assertCleanupMetadataInSchemaSatisfies( schema, StreamTableType.VALUE.getTableName(shortName), NULL_CLEANUP_METADATA_ASSERTION); assertCleanupMetadataInSchemaSatisfies( schema, StreamTableType.HASH.getTableName(shortName), ARBITRARY_CLEANUP_METADATA_ASSERTION); assertCleanupMetadataInSchemaSatisfies( schema, StreamTableType.METADATA.getTableName(shortName), getStreamStoreMetadataAssertion(2, ValueType.VAR_SIGNED_LONG)); assertCleanupMetadataInSchemaSatisfies( schema, StreamTableType.INDEX.getTableName(shortName), ARBITRARY_CLEANUP_METADATA_ASSERTION); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_expense_item_add); dialogOptions = getResources().getStringArray(R.array.receipt_dialog_array); nameField = (EditText)findViewById(R.id.et_name); descriptionField = (EditText)findViewById(R.id.et_description); amountField = (EditText)findViewById(R.id.et_amount); dateField = (DateEditText)findViewById(R.id.et_date); categorySpinner = (Spinner)findViewById(R.id.sp_category); SpinnerUtils.configureSpinner(this, categorySpinner, R.array.categories_array); currencySpinner = (Spinner)findViewById(R.id.sp_currency); SpinnerUtils.configureSpinner(this, currencySpinner, R.array.currency_array); receiptButton = (ImageButton) findViewById(R.id.btn_receipt); receiptButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startDialog(); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_expense_item_add); dialogOptions = getResources().getStringArray(R.array.receipt_dialog_array); ActionBarUtils.showCancelDoneActionBar( this, new View.OnClickListener() { @Override public void onClick(View v) { onCancel(); } }, new View.OnClickListener() { @Override public void onClick(View v) { onDone(); } } ); nameField = (EditText)findViewById(R.id.et_name); descriptionField = (EditText)findViewById(R.id.et_description); amountField = (EditText)findViewById(R.id.et_amount); dateField = (DateEditText)findViewById(R.id.et_date); categorySpinner = (Spinner)findViewById(R.id.sp_category); SpinnerUtils.configureSpinner(this, categorySpinner, R.array.categories_array); currencySpinner = (Spinner)findViewById(R.id.sp_currency); SpinnerUtils.configureSpinner(this, currencySpinner, R.array.currency_array); receiptButton = (ImageButton) findViewById(R.id.btn_receipt); receiptButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startImagePickerDialog(); } }); }
Source:
private void statelessVmTreatment() { warnIfNotAllDisksPermitSnapshots(); if (statelessSnapshotExistsForVm() && !isVMPartOfManualPool(getVmId())) { log.errorFormat( "RunVmAsStateless - {0} - found existing vm images in stateless_vm_image_map table - skipped creating snapshots.", getVm().getName()); removeVmStatlessImages(); } else { log.infoFormat("VdcBll.RunVmCommand.RunVmAsStateless - Creating snapshot for stateless vm {0} - {1}", getVm().getName(), getVm().getId()); CreateAllSnapshotsFromVmParameters createAllSnapshotsFromVmParameters = buildCreateSnapshotParameters(); Map<String, String> values = getVmValuesForMsgResolving(); Step createSnapshotsStep = addSubStep(StepEnum.EXECUTING, StepEnum.CREATING_SNAPSHOTS, values); ExecutionContext createSnapshotsCtx = new ExecutionContext(); createSnapshotsCtx.setMonitored(true); createSnapshotsCtx.setStep(createSnapshotsStep); VdcReturnValueBase vdcReturnValue = getBackend().runInternalAction(VdcActionType.CreateAllSnapshotsFromVm, createAllSnapshotsFromVmParameters, new CommandContext(createSnapshotsCtx, getCompensationContext(), getLock())); setLock(null); setSucceeded(vdcReturnValue.getSucceeded()); if (vdcReturnValue.getSucceeded()) { getReturnValue().getTaskIdList().addAll(vdcReturnValue.getInternalTaskIdList()); VmHandler.updateDisksFromDb(getVm()); } else { if (areDisksLocked(vdcReturnValue)) { throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } getReturnValue().setFault(vdcReturnValue.getFault()); log.errorFormat("RunVmAsStateless - {0} - failed to create snapshots", getVm().getName()); } } }

Target:
private void statelessVmTreatment() { warnIfNotAllDisksPermitSnapshots(); if (statelessSnapshotExistsForVm()) { log.errorFormat( "RunVmAsStateless - {0} - found existing vm images in stateless_vm_image_map table - skipped creating snapshots.", getVm().getName()); removeVmStatlessImages(); } else { log.infoFormat("VdcBll.RunVmCommand.RunVmAsStateless - Creating snapshot for stateless vm {0} - {1}", getVm().getName(), getVm().getId()); CreateAllSnapshotsFromVmParameters createAllSnapshotsFromVmParameters = buildCreateSnapshotParameters(); Map<String, String> values = getVmValuesForMsgResolving(); Step createSnapshotsStep = addSubStep(StepEnum.EXECUTING, StepEnum.CREATING_SNAPSHOTS, values); ExecutionContext createSnapshotsCtx = new ExecutionContext(); createSnapshotsCtx.setMonitored(true); createSnapshotsCtx.setStep(createSnapshotsStep); VdcReturnValueBase vdcReturnValue = getBackend().runInternalAction(VdcActionType.CreateAllSnapshotsFromVm, createAllSnapshotsFromVmParameters, new CommandContext(createSnapshotsCtx, getCompensationContext(), getLock())); setLock(null); setSucceeded(vdcReturnValue.getSucceeded()); if (vdcReturnValue.getSucceeded()) { getReturnValue().getTaskIdList().addAll(vdcReturnValue.getInternalTaskIdList()); VmHandler.updateDisksFromDb(getVm()); } else { if (areDisksLocked(vdcReturnValue)) { throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } getReturnValue().setFault(vdcReturnValue.getFault()); log.errorFormat("RunVmAsStateless - {0} - failed to create snapshots", getVm().getName()); } } }
Source:
private InstanceConfig createInstanceConfig(int nodeNum) { String ipPrefix = "127.0." + subnet + "."; String seedIp = ipPrefix + "1"; String ipAddress = ipPrefix + nodeNum; long token = tokenSupplier.token(nodeNum); NetworkTopology topology = NetworkTopology.build(ipPrefix, BROADCAST_PORT, nodeIdTopology); InstanceConfig config = InstanceConfig.generate(nodeNum, ipAddress, topology, root, String.valueOf(token), seedIp); if (configUpdater != null) configUpdater.accept(config); return config; }

Target:
private InstanceConfig createInstanceConfig(int nodeNum) { String ipPrefix = "127.0." + subnet + "."; String seedIp = ipPrefix + "1"; String ipAddress = ipPrefix + nodeNum; long token = tokenSupplier.token(nodeNum); NetworkTopology topology = NetworkTopology.build(ipPrefix, broadcastPort, nodeIdTopology); InstanceConfig config = InstanceConfig.generate(nodeNum, ipAddress, topology, root, String.valueOf(token), seedIp); if (configUpdater != null) configUpdater.accept(config); return config; }
Source:
private Topology createConnectedStateStoreTopology(final String storeName) { final StoreBuilder<KeyValueStore<String, String>> storeBuilder = Stores.keyValueStoreBuilder(Stores.inMemoryKeyValueStore(storeName), Serdes.String(), Serdes.String()); return topology .addSource("source", STRING_DESERIALIZER, STRING_DESERIALIZER, INPUT_TOPIC_1) .addProcessor("processor", defineWithStores(new StatefulProcessor(storeName), Collections.singleton(storeBuilder)), "source") .addSink("counts", OUTPUT_TOPIC_1, "processor"); }

Target:
private Topology createConnectedStateStoreTopology(final String storeName) { final StoreBuilder<KeyValueStore<String, String>> storeBuilder = Stores.keyValueStoreBuilder(Stores.inMemoryKeyValueStore(storeName), Serdes.String(), Serdes.String()); return topology .addSource("source", STRING_DESERIALIZER, STRING_DESERIALIZER, INPUT_TOPIC_1) .addProcessor("processor", defineWithStores(() -> new StatefulProcessor(storeName), Collections.singleton(storeBuilder)), "source") .addSink("counts", OUTPUT_TOPIC_1, "processor"); }
Source:
public List<Component> getPipelines() { try { LOG.fine("Getting pipelines!"); List<Component> components = new ArrayList<Component>(); if (componentSpecs != null) { for (ComponentSpec componentSpec : componentSpecs) { AbstractProject firstJob = ProjectUtil.getProject(componentSpec.getFirstJob(), getOwnerItemGroup()); AbstractProject lastJob = ProjectUtil.getProject(componentSpec.getLastJob(), getOwnerItemGroup()); if (firstJob != null) { components.add(getComponent(componentSpec.getName(), firstJob, lastJob, showAggregatedPipeline, (componentSpecs.indexOf(componentSpec) + 1))); } else { throw new PipelineException("Could not find project: " + componentSpec.getFirstJob()); } } } if (regexpFirstJobs != null) { for (RegExpSpec regexp : regexpFirstJobs) { Map<String, AbstractProject> matches = ProjectUtil.getProjects(regexp.getRegexp()); int i=0; for (Map.Entry<String, AbstractProject> entry : matches.entrySet()) { components.add(getComponent(entry.getKey(), entry.getValue(), null, showAggregatedPipeline, (i + 1))); i++; } } } if (getSorting() != null && !getSorting().equals(NONE_SORTER)) { ComponentComparatorDescriptor comparatorDescriptor = ComponentComparator.all().find(sorting); if (comparatorDescriptor != null) { Collections.sort(components, comparatorDescriptor.createInstance()); } } LOG.fine("Returning: " + components); error = null; return components; } catch (PipelineException e) { error = e.getMessage(); return new ArrayList<Component>(); } }

Target:
public List<Component> getPipelines() { try { LOG.fine("Getting pipelines!"); List<Component> components = new ArrayList<Component>(); if (componentSpecs != null) { for (ComponentSpec componentSpec : componentSpecs) { AbstractProject firstJob = ProjectUtil.getProject(componentSpec.getFirstJob(), getOwnerItemGroup()); AbstractProject lastJob = ProjectUtil.getProject(componentSpec.getLastJob(), getOwnerItemGroup()); if (firstJob != null) { components.add(getComponent(componentSpec.getName(), firstJob, lastJob, showAggregatedPipeline, (componentSpecs.indexOf(componentSpec) + 1))); } else { throw new PipelineException("Could not find project: " + componentSpec.getFirstJob()); } } } if (regexpFirstJobs != null) { for (RegExpSpec regexp : regexpFirstJobs) { Map<String, AbstractProject> matches = ProjectUtil.getProjects(regexp.getRegexp()); int index = 1; for (Map.Entry<String, AbstractProject> entry : matches.entrySet()) { components.add(getComponent(entry.getKey(), entry.getValue(), null, showAggregatedPipeline, index)); index++; } } } if (getSorting() != null && !getSorting().equals(NONE_SORTER)) { ComponentComparatorDescriptor comparatorDescriptor = ComponentComparator.all().find(sorting); if (comparatorDescriptor != null) { Collections.sort(components, comparatorDescriptor.createInstance()); } } LOG.fine("Returning: " + components); error = null; return components; } catch (PipelineException e) { error = e.getMessage(); return new ArrayList<Component>(); } }
Source:
public static Expression avg(@NonNull Expression expression) { if(expression == null) { throw new IllegalArgumentException("expression is null"); } return new Expression.FunctionExpression("AVG()", Arrays.asList(expression)); }

Target:
public static Expression avg(@NonNull Expression expression) { if (expression == null) { throw new IllegalArgumentException("expression is null."); } return new Expression.FunctionExpression("AVG()", Arrays.asList(expression)); }
Source:
public Boolean getLiveMergeSupport() { return this.mVdsDynamic.getLiveMergeSupport(); }

Target:
public boolean getLiveMergeSupport() { return this.mVdsDynamic.getLiveMergeSupport(); }
Source:
public void testLongNotification() throws IOException { Notification notification = longNotification(); try { curationApiAdmin.createNotification(notification); } catch (ApiException e) { assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), e.getCode()); } Notification updateNotification = curationApiAdmin.createNotification(testNotification()); long id = updateNotification.getId(); notification.setId(id); try { curationApiAdmin.updateNotification(id, notification); } catch (ApiException e) { assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), e.getCode()); } String message = testingPostgres.runSelectStatement(String.format("select message from notification where id = '%s'", id), String.class); assertEquals(updateNotification.getMessage(), message); }

Target:
public void testLongNotification() throws IOException { Notification notification = longNotification(1024); Notification result = curationApiAdmin.createNotification(notification); assertNotNull(result); notification = longNotification(1025); try { curationApiAdmin.createNotification(notification); fail("create should fail since message is too long"); } catch (ApiException e) { assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), e.getCode()); } Notification updateNotification = curationApiAdmin.createNotification(testNotification()); long id = updateNotification.getId(); notification.setId(id); try { curationApiAdmin.updateNotification(id, notification); fail("update should fail since update notification is too long"); } catch (ApiException e) { assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), e.getCode()); } String message = testingPostgres.runSelectStatement(String.format("select message from notification where id = '%s'", id), String.class); assertEquals(updateNotification.getMessage(), message); }
Source:
public void initialize(Context context, MediationAdRequest adRequest, String unused, MediationRewardedVideoAdListener listener, Bundle serverParameters, Bundle networkExtras) { String[] placements = networkExtras.getStringArray(VungleExtrasBuilder.EXTRA_ALL_PLACEMENTS); if (placements == null || placements.length == 0) { Log.e(TAG, "Placements should be specified!"); if (listener != null) listener.onInitializationFailed(VungleAdapter.this, 0); return; } mMediationRewardedVideoAdListener = listener; String appId = serverParameters.getString("appid"); mVunglePub = VungleManager.getInstance(appId, placements, context); mVunglePub.addListener(ID, vungleListener); if (mVunglePub.isInitialized()) { mInitialized = true; mMediationRewardedVideoAdListener.onInitializationSucceeded(VungleAdapter.this); } else { vungleListener.setWaitingInit(true); mVunglePub.init(); } }

Target:
public void initialize(Context context, MediationAdRequest adRequest, String unused, MediationRewardedVideoAdListener listener, Bundle serverParameters, Bundle networkExtras) { String[] placements; if (networkExtras != null) { placements = networkExtras.getStringArray(VungleExtrasBuilder.EXTRA_ALL_PLACEMENTS); if (placements == null || placements.length == 0) { Log.e(TAG, "Placements should be specified!"); if (listener != null) listener.onInitializationFailed(VungleAdapter.this, AdRequest.ERROR_CODE_INVALID_REQUEST); return; } } else { Log.e(TAG, "networkExtras is null."); if (listener != null) listener.onInitializationFailed(VungleAdapter.this, AdRequest.ERROR_CODE_INVALID_REQUEST); return; } mMediationRewardedVideoAdListener = listener; String appId = serverParameters.getString("appid"); mVungleManager = VungleManager.getInstance(appId, placements); mVungleManager.addListener(ID, vungleListener); if (mVungleManager.isInitialized()) { mInitialized = true; mMediationRewardedVideoAdListener.onInitializationSucceeded(VungleAdapter.this); } else { vungleListener.setWaitingInit(true); mVungleManager.init(context); } }
Source:
public ResponseEntity<String> updateCategory(@PathVariable("id") Long id, @RequestBody Category category){ Category oldCategory = categoryDao.findOne(id); if(oldCategory == null){ return new ResponseEntity<String>("Category not found", HttpStatus.NOT_FOUND); } category.setId(id); category.setUser(oldCategory.getUser()); categoryDao.save(category); return new ResponseEntity<String>("Category updated", HttpStatus.NO_CONTENT); }

Target:
public ResponseEntity<String> updateCategory(@PathVariable("id") Long id, @RequestBody Category category){ Category oldCategory = categoryDao.findOne(id); if(oldCategory == null){ return new ResponseEntity<String>("Category not found", HttpStatus.NOT_FOUND); } category.setId(id); String currentUsername = ControllerUtil.getCurrentLoggedUsername(); category.setUser(appUserDao.findByUsername(currentUsername)); categoryDao.save(category); return new ResponseEntity<String>("Category updated", HttpStatus.NO_CONTENT); }
Source:
public void setUp() { when(vmDao.get(vm.getId())).thenReturn(vm); Cluster cluster = new Cluster(); cluster.setCpuName("Intel Conroe Family"); cluster.setArchitecture(ArchitectureType.x86_64); cluster.setId(vm.getClusterId()); cluster.setStoragePoolId(vm.getStoragePoolId()); cluster.setCompatibilityVersion(Version.getLast()); when(clusterDao.get(vm.getClusterId())).thenReturn(cluster); mockOsRepository(); doNothing().when(cmd).separateCustomProperties(any(VmStatic.class)); doReturn(getDisksList(vm.getStoragePoolId())).when(cmd).getVmDisksFromDB(); doReturn(vmDeviceUtils).when(cmd).getVmDeviceUtils(); mcr.mockConfigValue(ConfigValues.VmPriorityMaxValue, 100); cmd.init(); }

Target:
public void setUp() { when(vmDao.get(vm.getId())).thenReturn(vm); Cluster cluster = new Cluster(); cluster.setCpuName("Intel Conroe Family"); cluster.setArchitecture(ArchitectureType.x86_64); cluster.setId(vm.getClusterId()); cluster.setStoragePoolId(vm.getStoragePoolId()); cluster.setCompatibilityVersion(Version.getLast()); when(clusterDao.get(vm.getClusterId())).thenReturn(cluster); mockOsRepository(); doNothing().when(cmd).separateCustomProperties(any(VmStatic.class)); doReturn(getDisksList(vm.getStoragePoolId())).when(cmd).getVmDisksFromDB(); doReturn(vmDeviceUtils).when(cmd).getVmDeviceUtils(); cmd.init(); }
Source:
public void removeEventHandler(EventHandler eventHandler) { if (eventHandler != null && eventHandlers != null && eventHandlers.contains(eventHandler)) { List<String> tempSubsList = new ArrayList<String>(); int index = -1; EventHandler intEventHandler = null; boolean subscribedEventsChanged = false; for (int i = 0; i < eventHandlers.size(); i++) { intEventHandler = eventHandlers.get(i); if (intEventHandler.getUID().equals(eventHandler.getUID())) { index = i; } else { tempSubsList.addAll(intEventHandler.getSupportetEvents()); } } if (index != -1) { intEventHandler = eventHandlers.remove(index); for (String eventName : intEventHandler.getSupportetEvents()) { if (!tempSubsList.contains(eventName)) { subscribedEvents.remove(eventName); subscribedEventsChanged = true; } } } if (subscribedEventsChanged) { restartListener(); } } }

Target:
public void removeEventHandler(EventHandler eventHandler) { if (eventHandler != null && eventHandlers.contains(eventHandler)) { List<String> tempSubsList = new ArrayList<String>(); int index = -1; EventHandler intEventHandler = null; boolean subscribedEventsChanged = false; for (int i = 0; i < eventHandlers.size(); i++) { intEventHandler = eventHandlers.get(i); if (intEventHandler.getUID().equals(eventHandler.getUID())) { index = i; } else { tempSubsList.addAll(intEventHandler.getSupportedEvents()); } } if (index != -1) { intEventHandler = eventHandlers.remove(index); for (String eventName : intEventHandler.getSupportedEvents()) { if (!tempSubsList.contains(eventName)) { subscribedEvents.remove(eventName); subscribedEventsChanged = true; } } } if (subscribedEventsChanged) { restartListener(); } } }
Source:
public ExponentialBackoffRetry(long baseSleepTimeMs) { if (baseSleepTimeMs > 10000){ this.baseSleepTimeMs = 10000; } else { this.baseSleepTimeMs = baseSleepTimeMs; } }

Target:
public ExponentialBackoffRetry(long baseSleepTimeMs) { this.baseSleepTimeMs = Math.min(10000, baseSleepTimeMs); }
Source:
public InputRawSupplierColumnSelectorStrategy makeColumnSelectorStrategy( ColumnCapabilities capabilities, ColumnValueSelector selector ) { ValueType type = capabilities.getType(); switch(type) { case STRING: return new StringInputRawSupplierColumnSelectorStrategy(); case LONG: return new LongInputRawSupplierColumnSelectorStrategy(); case FLOAT: return new FloatInputRawSupplierColumnSelectorStrategy(); case DOUBLE: return new DoubleInputRawSupplierColumnSelectorStrategy(); default: throw new IAE("Cannot create query type helper from invalid type [%s]", type); } }

Target:
public InputRawSupplierColumnSelectorStrategy makeColumnSelectorStrategy( ColumnCapabilities capabilities, ColumnValueSelector selector ) { ValueType type = capabilities.getType(); switch(type) { case STRING: return new StringInputRawSupplierColumnSelectorStrategy(); case LONG: return (InputRawSupplierColumnSelectorStrategy<LongColumnSelector>) columnSelector -> columnSelector::get; case FLOAT: return (InputRawSupplierColumnSelectorStrategy<FloatColumnSelector>) columnSelector -> columnSelector::get; case DOUBLE: return (InputRawSupplierColumnSelectorStrategy<DoubleColumnSelector>) columnSelector -> columnSelector::get; default: throw new IAE("Cannot create query type helper from invalid type [%s]", type); } }
Source:
protected HdfsSinkConnectorConfig(Map<String, String> props) { this(CONFIG_DEF, props); }

Target:
public HdfsSinkConnectorConfig(Map<String, String> props) { this(CONFIG_DEF, addDefaults(props)); }
Source:
FluxToMessageChannelResultAdapter fluxToMessageChannelResultAdapter() { return new FluxToMessageChannelResultAdapter(); }

Target:
public FluxToMessageChannelResultAdapter fluxToMessageChannelResultAdapter() { return new FluxToMessageChannelResultAdapter(); }
Source:
Collection<Session> getSessions() { final Collection<Session> closedSessions = listeningSessions.values().stream() .flatMap(sessions -> sessions.values().stream()) .filter(session -> !session.isOpen()) .collect(Collectors.toSet()); closedSessions.forEach(this::removeSession); return listeningSessions.values().stream() .flatMap(sessions -> sessions.values().stream()) .collect(Collectors.toSet()); }

Target:
Collection<Session> getSessions() { final Collection<Session> closedSessions = listeningSessions.values().stream() .flatMap(sessions -> sessions.values().stream()) .filter(Predicate.not(Session::isOpen)) .collect(Collectors.toSet()); closedSessions.forEach(this::removeSession); return listeningSessions.values().stream() .flatMap(sessions -> sessions.values().stream()) .collect(Collectors.toSet()); }
Source:
public void testInstrumentationWithAdvancedOpt() { CompilerOptions options = createCompilerOptions(); String blahExtern = lines( " ", " ", "let ist_arr;" ); externs = ImmutableList.of( new TestExternsBuilder() .addArray() .addAlert() .addExtra( blahExtern) .buildExternsFile("externs")); String source = lines("function foo (x) {", "if(x) { alert(x+5); }", "} foo(true); foo(false);"); String expected = lines( "function a(b) {", getInstrumentCodeLine("G"),";", "b ? (", getInstrumentCodeLine("C"),",alert(b+5)) : ", getInstrumentCodeLine("E"),";", "}", "a(!0);" , "a(!1);"); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); test(options, source, instrumentCodeExpected.concat(expected)); }

Target:
public void testInstrumentationWithAdvancedOpt() { CompilerOptions options = createCompilerOptions(); String blahExtern = lines( " ", " ", "let ist_arr;"); externs = ImmutableList.of( new TestExternsBuilder() .addArray() .addAlert() .addExtra(blahExtern) .buildExternsFile("externs")); String source = lines( "function foo (x) {", " if(x) { " , " alert(x+5); ", " }", "} ", "foo(true); foo(false);"); String expected = lines( "function a(b) {", getInstrumentCodeLine("G"), ";", "b ? (", getInstrumentCodeLine("C"), ", alert(b+5)) : ", getInstrumentCodeLine("E"), ";", "}", "a(!0);", "a(!1);"); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); test(options, source, instrumentCodeExpected.concat(expected)); }
Source:
public void onMatch(RelOptRuleCall call) { LogicalWatermarkAssigner watermarkAssigner = call.rel(0); LogicalTableScan scan = call.rel(1); FlinkContext context = (FlinkContext) call.getPlanner().getContext(); TableConfig config = context.getTableConfig(); GeneratedWatermarkGenerator generatedWatermarkGenerator = WatermarkGeneratorCodeGenerator.generateWatermarkGenerator( config, FlinkTypeFactory.toLogicalRowType(scan.getRowType()), watermarkAssigner.watermarkExpr(), "context"); Configuration configuration = context.getTableConfig().getConfiguration(); WatermarkGeneratorSupplier<RowData> supplier = new DefaultWatermarkGeneratorSupplier(configuration, generatedWatermarkGenerator); String digest = String.format("watermark=[%s]", watermarkAssigner.watermarkExpr()); WatermarkStrategy<RowData> watermarkStrategy = WatermarkStrategy.forGenerator(supplier); Duration idleTimeout = configuration.get(ExecutionConfigOptions.TABLE_EXEC_SOURCE_IDLE_TIMEOUT); if (!idleTimeout.isZero() && !idleTimeout.isNegative()) { watermarkStrategy.withIdleness(idleTimeout); digest = String.format("%s idletimeout=[%s]", digest, idleTimeout.toMillis()); } TableSourceTable tableSourceTable = scan.getTable().unwrap(TableSourceTable.class); DynamicTableSource newDynamicTableSource = tableSourceTable.tableSource().copy(); ((SupportsWatermarkPushDown) newDynamicTableSource).applyWatermark(watermarkStrategy); TableSourceTable newTableSourceTable = tableSourceTable.copy( newDynamicTableSource, watermarkAssigner.getRowType(), new String[]{digest}); LogicalTableScan newScan = new LogicalTableScan( scan.getCluster(), scan.getTraitSet(), scan.getHints(), newTableSourceTable); call.transformTo(newScan); }

Target:
public void onMatch(RelOptRuleCall call) { FlinkLogicalWatermarkAssigner watermarkAssigner = call.rel(0); FlinkLogicalTableSourceScan scan = call.rel(1); FlinkContext context = (FlinkContext) call.getPlanner().getContext(); FlinkLogicalTableSourceScan newScan = getNewScan(watermarkAssigner, watermarkAssigner.watermarkExpr(), scan, context.getTableConfig(), true); call.transformTo(newScan); }
Source:
public void testSensitivityAtConstantDepth(final double expected, final File metricsFile, final double alleleFraction, final int depth, final int sampleSize, final double tolerance) throws Exception { final MetricsFile Metrics = new MetricsFile(); Metrics.read(new FileReader(metricsFile)); final List<Histogram<Integer>> histograms = Metrics.getAllHistograms(); final Histogram<Integer> qualityHistogram = histograms.get(1); for (int i = 0;i < 3;i++) { double result = TheoreticalSensitivity.sensitivityAtConstantDepth(depth, qualityHistogram, 3, sampleSize, alleleFraction, i); Assert.assertEquals(result, expected, tolerance); } }

Target:
public void testSensitivityAtConstantDepth(final double expected, final File metricsFile, final double alleleFraction, final int depth, final int sampleSize, final double tolerance) throws Exception { final MetricsFile metrics = new MetricsFile(); try (final FileReader metricsFileReader = new FileReader(metricsFile)) { metrics.read(metricsFileReader); } final List<Histogram<Integer>> histograms = metrics.getAllHistograms(); final Histogram<Integer> qualityHistogram = histograms.get(1); for (int i = 0;i < 3;i++) { double result = TheoreticalSensitivity.sensitivityAtConstantDepth(depth, qualityHistogram, 3, sampleSize, alleleFraction, i); Assert.assertEquals(result, expected, tolerance); } }
Source:
public void validateDestinationDomainValid() { DiskImage disk = new DiskImage(); initializeCommand(disk, VmEntityType.VM); disk.getStorageIds().add(destStorageId); initSrcStorageDomain(); initDestStorageDomain(StorageType.NFS); command.getParameters().setStorageDomainId(destStorageId); command.setStorageDomainId(destStorageId); command.getStorageDomain().setId(destStorageId); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_DESTINATION_STORAGE_DOMAIN_IS_NOT_VALID); }

Target:
public void validateDestinationDomainValid() { DiskImage disk = new DiskImage(); initializeCommand(disk, VmEntityType.VM); disk.getStorageIds().add(destStorageId); initSrcStorageDomain(); initDestStorageDomain(StorageType.NFS); command.getParameters().setStorageDomainId(destStorageId); command.setStorageDomainId(destStorageId); command.getStorageDomain().setId(destStorageId); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_DESTINATION_STORAGE_DOMAIN_ALREADY_CONTAINS_THE_DISK); }
Source:
private HttpRequest signForTemporaryAccess(HttpRequest request, long timeInSeconds) { final String expiration = String.valueOf(System.currentTimeMillis()/1000 + timeInSeconds); HttpRequest req = request.toBuilder().replaceHeader(HttpHeaders.DATE, expiration).build(); final String signature = authSigner.sign(authSigner.createStringToSign(req)); req = req.toBuilder() .addQueryParam("Signature", signature) .addQueryParam(HttpHeaders.EXPIRES, expiration) .addQueryParam("AWSAccessKeyId", identity) .build(); return req; }

Target:
private HttpRequest signForTemporaryAccess(HttpRequest request, long timeInSeconds) { String dateString = request.getFirstHeaderOrNull(HttpHeaders.DATE); if (dateString == null) { dateString = timeStampProvider.get(); } Date date = dateService.rfc1123DateParse(dateString); String expiration = String.valueOf(TimeUnit.MILLISECONDS.toSeconds(date.getTime()) + timeInSeconds); HttpRequest.Builder<?> builder = request.toBuilder().replaceHeader(HttpHeaders.DATE, expiration); final String signature = authSigner.sign(authSigner.createStringToSign(builder.build())); return builder.addQueryParam("Signature", signature) .addQueryParam(HttpHeaders.EXPIRES, expiration) .addQueryParam("AWSAccessKeyId", identity) .build(); }
Source:
private String getKeyForLRUCache(Uri contentUri) { String[] split = contentUri.toString().split("/"); return split[split.length-1]; }

Target:
private String getKeyForLRUCache(Uri contentUri) { return contentUri.getLastPathSegment(); }
Source:
private FireHydrant makeNewCurrIndex(long minTimestamp, DataSchema schema) { final IncrementalIndexSchema indexSchema = new IncrementalIndexSchema.Builder() .withMinTimestamp(minTimestamp) .withQueryGranularity(schema.getGranularitySpec().getQueryGranularity()) .withDimensionsSpec(schema.getParser()) .withMetrics(schema.getAggregators()) .build(); final IncrementalIndex newIndex = new OnheapIncrementalIndex( indexSchema, config.getMaxRowsInMemory() ); final FireHydrant old; synchronized (hydrantLock) { old = currHydrant; int newCount = 0; int numHydrants = hydrants.size(); if (numHydrants > 0) { FireHydrant lastHydrant = hydrants.get(numHydrants - 1); newCount = lastHydrant.getCount() + 1; if(!indexSchema.getDimensionsSpec().hasCustomDimensions()) { if (lastHydrant.hasSwapped()) { QueryableIndex oldIndex = lastHydrant.getSegment().asQueryableIndex(); newIndex.loadDimensionIterable(oldIndex.getAvailableDimensions()); } else { IncrementalIndex oldIndex = lastHydrant.getIndex(); newIndex.loadDimensionOrder(oldIndex.getDimensionOrder()); } } } currHydrant = new FireHydrant(newIndex, newCount, getSegment().getIdentifier()); hydrants.add(currHydrant); } return old; }

Target:
private FireHydrant makeNewCurrIndex(long minTimestamp, DataSchema schema) { final IncrementalIndexSchema indexSchema = new IncrementalIndexSchema.Builder() .withMinTimestamp(minTimestamp) .withQueryGranularity(schema.getGranularitySpec().getQueryGranularity()) .withDimensionsSpec(schema.getParser()) .withMetrics(schema.getAggregators()) .build(); final IncrementalIndex newIndex = new OnheapIncrementalIndex( indexSchema, config.getMaxRowsInMemory() ); final FireHydrant old; synchronized (hydrantLock) { old = currHydrant; int newCount = 0; int numHydrants = hydrants.size(); if (numHydrants > 0) { FireHydrant lastHydrant = hydrants.get(numHydrants - 1); newCount = lastHydrant.getCount() + 1; if (!indexSchema.getDimensionsSpec().hasCustomDimensions()) { if (lastHydrant.hasSwapped()) { QueryableIndex oldIndex = lastHydrant.getSegment().asQueryableIndex(); for (String dim : oldIndex.getAvailableDimensions()) { dimOrder.add(dim); } } else { IncrementalIndex oldIndex = lastHydrant.getIndex(); dimOrder.addAll(oldIndex.getDimensionOrder()); } newIndex.loadDimensionIterable(dimOrder); } } currHydrant = new FireHydrant(newIndex, newCount, getSegment().getIdentifier()); hydrants.add(currHydrant); } return old; }
Source:
@Inject public StatusResource(KeywhizConfig keywhizConfig, Environment environment) { this.environment = environment; Duration cacheExpiry = keywhizConfig.getStatusCacheExpiry(); cachedResult = CacheBuilder.newBuilder() .maximumSize(1) .expireAfterWrite(cacheExpiry.toMillis(), TimeUnit.MILLISECONDS) .build( new CacheLoader<HealthCheckRegistry, SortedMap<String, HealthCheck.Result>>() { public SortedMap<String, HealthCheck.Result> load(HealthCheckRegistry checks) { return checks.runHealthChecks(); } }); }

Target:
@Inject public StatusResource(KeywhizConfig keywhizConfig, Environment environment) { Duration cacheExpiry = keywhizConfig.getStatusCacheExpiry(); memoizedCheck = Suppliers.memoizeWithExpiration(() -> environment.healthChecks().runHealthChecks(), cacheExpiry.toMillis(), TimeUnit.MILLISECONDS); }
Source:
private static void fillChecksFromAnnotationPackage() { NAME_TO_FULL_MODULE_NAME.put("AnnotationLocationCheck", "com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck"); NAME_TO_FULL_MODULE_NAME.put("AnnotationUseStyleCheck", "com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck"); NAME_TO_FULL_MODULE_NAME.put("MissingDeprecatedCheck", "com.puppycrawl.tools.checkstyle.checks.annotation.MissingDeprecatedCheck"); NAME_TO_FULL_MODULE_NAME.put("MissingOverrideCheck", "com.puppycrawl.tools.checkstyle.checks.annotation.MissingOverrideCheck"); NAME_TO_FULL_MODULE_NAME.put("PackageAnnotationCheck", "com.puppycrawl.tools.checkstyle.checks.annotation.PackageAnnotationCheck"); NAME_TO_FULL_MODULE_NAME.put("SuppressWarningsCheck", "com.puppycrawl.tools.checkstyle.checks.annotation.SuppressWarningsCheck"); }

Target:
private static void fillChecksFromAnnotationPackage() { NAME_TO_FULL_MODULE_NAME.put("AnnotationLocationCheck", BASE_PACKAGE + ".checks.annotation.AnnotationLocationCheck"); NAME_TO_FULL_MODULE_NAME.put("AnnotationUseStyleCheck", BASE_PACKAGE + ".checks.annotation.AnnotationUseStyleCheck"); NAME_TO_FULL_MODULE_NAME.put("MissingDeprecatedCheck", BASE_PACKAGE + ".checks.annotation.MissingDeprecatedCheck"); NAME_TO_FULL_MODULE_NAME.put("MissingOverrideCheck", BASE_PACKAGE + ".checks.annotation.MissingOverrideCheck"); NAME_TO_FULL_MODULE_NAME.put("PackageAnnotationCheck", BASE_PACKAGE + ".checks.annotation.PackageAnnotationCheck"); NAME_TO_FULL_MODULE_NAME.put("SuppressWarningsCheck", BASE_PACKAGE + ".checks.annotation.SuppressWarningsCheck"); }
Source:
public boolean isEmpty() { return getPrimary() == null && getCountry() == null && getFormatted() == null && getLocality() == null && getPostalcode() == null && getRegion() == null && getStreetaddress() == null && getType() == null; }

Target:
public boolean isEmpty() { return getPrimary() == null && Strings.isNullOrEmpty(getCountry()) && Strings.isNullOrEmpty(getFormatted()) && Strings.isNullOrEmpty(getLocality()) && Strings.isNullOrEmpty(getPostalcode()) && Strings.isNullOrEmpty(getRegion()) && Strings.isNullOrEmpty(getStreetaddress()) && Strings.isNullOrEmpty(getType()); }
Source:
private void doOperation( ThrowingConsumer<Suspendable,Throwable> operation, String description ) { ErrorHandler.certainOperations( description, suspendables.stream() .map( (Function<Suspendable,ErrorHandler.ThrowingRunnable>) suspendable -> () -> operation.accept( suspendable ) ) .toArray( ErrorHandler.ThrowingRunnable[]::new ) ); }

Target:
private void doOperation( ThrowingConsumer<Suspendable,Throwable> operation, String description ) { ErrorHandler.runAll( description, suspendables.stream() .map( (Function<Suspendable,ErrorHandler.ThrowingRunnable>) suspendable -> () -> operation.accept( suspendable ) ) .toArray( ErrorHandler.ThrowingRunnable[]::new ) ); }
Source:
public static BlobHttpHeaders extractHttpHeaders(List<FileAttribute<?>> fileAttributes, ClientLogger logger) { BlobHttpHeaders headers = new BlobHttpHeaders(); for (Iterator<FileAttribute<?>> it = fileAttributes.iterator(); it.hasNext();) { FileAttribute<?> attr = it.next(); boolean propertyFound = true; switch (attr.name()) { case "Content-Type": headers.setContentType(attr.value().toString()); break; case "Content-Language": headers.setContentLanguage(attr.value().toString()); break; case "Content-Disposition": headers.setContentDisposition(attr.value().toString()); break; case "Content-Encoding": headers.setContentEncoding(attr.value().toString()); break; case "Content-MD5": if ((attr.value() instanceof byte[])) { headers.setContentMd5((byte[]) attr.value()); } else { throw Utility.logError(logger, new UnsupportedOperationException("Content-MD5 attribute must be a byte[]")); } break; case "Cache-Control": headers.setCacheControl(attr.value().toString()); break; default: propertyFound = false; break; } if (propertyFound) { it.remove(); } } return headers; }

Target:
public static BlobHttpHeaders extractHttpHeaders(List<FileAttribute<?>> fileAttributes, ClientLogger logger) { BlobHttpHeaders headers = new BlobHttpHeaders(); for (Iterator<FileAttribute<?>> it = fileAttributes.iterator(); it.hasNext();) { FileAttribute<?> attr = it.next(); boolean propertyFound = true; switch (attr.name()) { case AzureFileSystemProvider.CONTENT_TYPE: headers.setContentType(attr.value().toString()); break; case AzureFileSystemProvider.CONTENT_LANGUAGE: headers.setContentLanguage(attr.value().toString()); break; case AzureFileSystemProvider.CONTENT_DISPOSITION: headers.setContentDisposition(attr.value().toString()); break; case AzureFileSystemProvider.CONTENT_ENCODING: headers.setContentEncoding(attr.value().toString()); break; case AzureFileSystemProvider.CONTENT_MD5: if ((attr.value() instanceof byte[])) { headers.setContentMd5((byte[]) attr.value()); } else { throw Utility.logError(logger, new UnsupportedOperationException("Content-MD5 attribute must be a byte[]")); } break; case AzureFileSystemProvider.CACHE_CONTROL: headers.setCacheControl(attr.value().toString()); break; default: propertyFound = false; break; } if (propertyFound) { it.remove(); } } return headers; }
Source:
private void fetchAppUpdateInfo() { mAppUpdateManager.getAppUpdateInfo() .addOnSuccessListener(info -> { mAppUpdateInfo = info; mUpdateAvailability = info.updateAvailability(); mInstallStatus = info.installStatus(); Logger.log(TAG, "fetchAppUpdateInfo|success with UpdateAvailability : " + mUpdateAvailability + ", and InstallStatus : " + mInstallStatus); publishStatus(); }) .addOnFailureListener(exception -> { mAppUpdateInfo = null; mUpdateAvailability = UpdateAvailability.UNKNOWN; mInstallStatus = InstallStatus.UNKNOWN; Logger.log(TAG, "fetchAppUpdateInfo|failed with : " + exception.getMessage()); publishStatus(); }); }

Target:
private void fetchAppUpdateInfo() { mAppUpdateManager.getAppUpdateInfo() .addOnSuccessListener(info -> { mAppUpdateInfo = info; mUpdateAvailability = info.updateAvailability(); mInstallStatus = info.installStatus(); publishStatus(); }) .addOnFailureListener(exception -> { mAppUpdateInfo = null; mUpdateAvailability = UpdateAvailability.UNKNOWN; mInstallStatus = InstallStatus.UNKNOWN; Logger.log(TAG, "fetchAppUpdateInfo|failed with : " + exception.getMessage()); publishStatus(); }); }
Source:
protected void setOverrideExcludePatterns(String excludePatterns) { if (excludedPatterns != null && excludedPatterns.size() > 0) { LOG.warn("Overriding excluded patterns with [{}], be aware that this affects all instances and safety of your application!", excludedPatterns, excludePatterns); } else { LOG.debug("Overriding excluded patterns with [{}], be aware that this affects all instances and safety of your application!", excludedPatterns, excludePatterns); } excludedPatterns = new HashSet<Pattern>(); for (String pattern : TextParseUtil.commaDelimitedStringToSet(excludePatterns)) { excludedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE)); } }

Target:
protected void setOverrideExcludePatterns(String excludePatterns) { if (excludedPatterns != null && excludedPatterns.size() > 0) { LOG.warn("Overriding excluded patterns with [{}], be aware that this affects all instances and safety of your application!", excludedPatterns, excludePatterns); } else { LOG.debug("Overriding excluded patterns with [{}]", excludePatterns); } excludedPatterns = new HashSet<Pattern>(); for (String pattern : TextParseUtil.commaDelimitedStringToSet(excludePatterns)) { excludedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE)); } }
Source:
private static void loadPayload() { patterns = defaultPatterns; for (String line : getJsFunctionPayloads().get()) { patterns.add(Pattern.compile("\\b" + line + "\\b", Pattern.CASE_INSENSITIVE)); } }

Target:
private static void loadPayload() { patterns = new ArrayList<>(defaultPatterns); for (String line : getJsFunctionPayloads().get()) { addPattern(line, patterns); } }
Source:
public void handleRequireAccessOnDependentTable(String request, String userName, TableName dependentTable, String requestTable, Set<Action> requireAccess, Set<Action> accessExists) throws IOException { if (!isStrictMode) { AUDITLOG.warn("Strict mode is not enabled, so " + request + " is allowed but User:" + userName + " will not have following access " + requireAccess + " to the existing dependent physical table " + dependentTable); return; } Set<Action> unionSet = new HashSet<Action>(); unionSet.addAll(requireAccess); unionSet.addAll(accessExists); AUDITLOG.info(request + ": Automatically granting access to index table during creation of view:" + requestTable + authString(userName, dependentTable, requireAccess)); grantPermissions(userName, dependentTable.getName(), unionSet.toArray(new Action[0])); }

Target:
public void handleRequireAccessOnDependentTable(String request, String userName, TableName dependentTable, String requestTable, Set<Action> requireAccess, Set<Action> accessExists) throws IOException { Set<Action> unionSet = new HashSet<Action>(); unionSet.addAll(requireAccess); unionSet.addAll(accessExists); AUDITLOG.info(request + ": Automatically granting access to index table during creation of view:" + requestTable + authString(userName, dependentTable, requireAccess)); grantPermissions(userName, dependentTable.getName(), unionSet.toArray(new Action[0])); }
Source:
public Response getRouteCsv( @QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds, @QueryParam("from") String from, @QueryParam("to") String to) throws SQLException { return Response.ok(Route.getCsv(getUserId(), deviceIds, groupIds, JsonConverter.parseDate(from), JsonConverter.parseDate(to))) .header("Content-Disposition", "attachment; filename=route.csv") .build(); }

Target:
public Response getRouteCsv( @QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds, @QueryParam("from") String from, @QueryParam("to") String to) throws SQLException { return Response.ok(Route.getCsv(getUserId(), deviceIds, groupIds, JsonConverter.parseDate(from), JsonConverter.parseDate(to))) .header(HttpHeaders.CONTENT_DISPOSITION, CONTENT_DISPOSITION_VALUE) .build(); }
Source:
public void equalityTest() { DateTimeType dt1 = new DateTimeType(Calendar.getInstance()); DateTimeType dt2 = DateTimeType.valueOf(dt1.toString()); assertTrue(dt1.toString().equals(dt2.toString())); assertTrue(dt1.equals(dt2)); assertTrue(dt1.getCalendar().equals(dt2.getCalendar())); assertTrue(dt1.equals(dt2)); }

Target:
public void equalityTest() { DateTimeType dt1 = new DateTimeType(Calendar.getInstance()); DateTimeType dt2 = DateTimeType.valueOf(dt1.toFullString()); assertTrue(dt1.toString().equals(dt2.toString())); assertTrue(dt1.equals(dt2)); assertTrue(dt1.getCalendar().equals(dt2.getCalendar())); assertTrue(dt1.equals(dt2)); }