auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private RestTemplate createRestTemplate(String login, String password, String hostname, HttpClientBuilder builder, int port, String protocol) { final HttpClient client = createHttpClient(login, password, hostname, port, protocol, builder); final UriPrefixingClientHttpRequestFactory factory = new UriPrefixingClientHttpRequestFactory( new HttpComponentsClientHttpRequestFactory(client), hostname, port, protocol); final RestTemplate restTemplate = new RestTemplate(factory); restTemplate.setInterceptors(Arrays.<ClientHttpRequestInterceptor>asList( new HeaderSettingRequestInterceptor(singletonMap("Accept", getAcceptHeaderValue())))); final List<HttpMessageConverter<?>> partConverters = new ArrayList<>(); partConverters.add(new ByteArrayHttpMessageConverter()); final StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(); stringHttpMessageConverter.setWriteAcceptCharset(false); partConverters.add(stringHttpMessageConverter); partConverters.add(new ResourceHttpMessageConverter()); partConverters.add(new MappingJackson2HttpMessageConverter()); final FormHttpMessageConverter formHttpMessageConverter = new FormHttpMessageConverter(); formHttpMessageConverter.setPartConverters(partConverters); final List<HttpMessageConverter<?>> messageConverters = new ArrayList<>(); messageConverters.add(new ByteArrayHttpMessageConverter()); messageConverters.add(new StringHttpMessageConverter()); messageConverters.add(new ResourceHttpMessageConverter()); messageConverters.add(formHttpMessageConverter); messageConverters.add(new MappingJackson2HttpMessageConverter()); restTemplate.setMessageConverters(messageConverters); restTemplate.setErrorHandler(new ResponseErrorHandler(messageConverters)); return restTemplate; }

Target:
private RestTemplate createRestTemplate(String login, String password, String hostname, HttpClientBuilder builder, int port, String protocol) { final HttpClient client = createHttpClient(login, password, hostname, port, protocol, builder); final UriPrefixingClientHttpRequestFactory factory = new UriPrefixingClientHttpRequestFactory( new HttpComponentsClientHttpRequestFactory(client), hostname, port, protocol); final RestTemplate restTemplate = new RestTemplate(factory); restTemplate.setInterceptors(Arrays.<ClientHttpRequestInterceptor>asList( new HeaderSettingRequestInterceptor(singletonMap("Accept", getAcceptHeaderValue())))); restTemplate.setErrorHandler(new ResponseErrorHandler(restTemplate.getMessageConverters())); return restTemplate; }
Source:
public void testMappingWithEmptyList() { final String deviceIdentification = "nr1"; final GprsOperationModeType gprsOperationModeType = GprsOperationModeType.ALWAYS_ON; final ConfigurationFlags configurationFlags = new ConfigurationFlagsBuilder().withEmptyList().build(); final ConfigurationObject configurationObject = new ConfigurationObject(gprsOperationModeType, configurationFlags); final SetConfigurationObjectRequestData setConfigurationObjectRequestData = new SetConfigurationObjectRequestData( configurationObject); final SetConfigurationObjectRequest setConfigurationObjectRequest = new SetConfigurationObjectRequest( deviceIdentification, setConfigurationObjectRequestData); final SetConfigurationObjectRequestDto setConfigurationObjectRequestDto = this.configurationMapper.map( setConfigurationObjectRequest, SetConfigurationObjectRequestDto.class); assertNotNull(setConfigurationObjectRequestDto); assertEquals(deviceIdentification, setConfigurationObjectRequestDto.getDeviceIdentification()); final ConfigurationObjectDto configurationObjectDto = setConfigurationObjectRequestDto .getSetConfigurationObjectRequestData().getConfigurationObject(); assertNotNull(configurationObjectDto); assertEquals(configurationFlags.getConfigurationFlag().isEmpty(), configurationObjectDto .getConfigurationFlags().getConfigurationFlag().isEmpty()); }

Target:
public void testMappingWithEmptyList() { final String deviceIdentification = "nr1"; final GprsOperationModeType gprsOperationModeType = GprsOperationModeType.ALWAYS_ON; final ConfigurationFlags configurationFlags = new ConfigurationFlags(new ArrayList<ConfigurationFlag>()); final ConfigurationObject configurationObject = new ConfigurationObject(gprsOperationModeType, configurationFlags); final SetConfigurationObjectRequestData setConfigurationObjectRequestData = new SetConfigurationObjectRequestData( configurationObject); final SetConfigurationObjectRequest setConfigurationObjectRequest = new SetConfigurationObjectRequest( deviceIdentification, setConfigurationObjectRequestData); final SetConfigurationObjectRequestDto setConfigurationObjectRequestDto = this.configurationMapper.map( setConfigurationObjectRequest, SetConfigurationObjectRequestDto.class); assertNotNull(setConfigurationObjectRequestDto); assertEquals(deviceIdentification, setConfigurationObjectRequestDto.getDeviceIdentification()); final ConfigurationObjectDto configurationObjectDto = setConfigurationObjectRequestDto .getSetConfigurationObjectRequestData().getConfigurationObject(); assertNotNull(configurationObjectDto); assertTrue(configurationObjectDto.getConfigurationFlags().getConfigurationFlag().isEmpty()); }
Source:
public Set<String> loadBatchOfStoredGeocodes(final boolean detailedOnly, final Geopoint coords, final CacheType cacheType, final int listId) { if (cacheType == null) { throw new IllegalArgumentException("cacheType must not be null"); } init(); Set<String> geocodes = new HashSet<String>(); StringBuilder specifySql = new StringBuilder(); if (listId != StoredList.ALL_LIST_ID) { specifySql.append("reason = "); specifySql.append(Math.max(listId, 1)); } else { specifySql.append("reason >= "); specifySql.append(StoredList.STANDARD_LIST_ID); } if (detailedOnly) { specifySql.append(" and detailed = 1 "); } if (cacheType != CacheType.ALL) { specifySql.append("and type = \""); specifySql.append(cacheType.id); specifySql.append('"'); } try { Cursor cursor; if (coords != null) { cursor = databaseRO.query( dbTableCaches, new String[] { "geocode", "(abs(latitude-" + String.format((Locale) null, "%.6f", coords.getLatitude()) + ") + abs(longitude-" + String.format((Locale) null, "%.6f", coords.getLongitude()) + ")) as dif" }, specifySql.toString(), null, null, null, "dif", null); } else { cursor = databaseRO.query( dbTableCaches, new String[] { "geocode" }, specifySql.toString(), null, null, null, "geocode"); } if (cursor.moveToFirst()) { final int index = cursor.getColumnIndex("geocode"); do { geocodes.add(cursor.getString(index)); } while (cursor.moveToNext()); } cursor.close(); } catch (Exception e) { Log.e("cgData.loadBatchOfStoredGeocodes: " + e.toString()); } return geocodes; }

Target:
public Set<String> loadBatchOfStoredGeocodes(final boolean detailedOnly, final Geopoint coords, final CacheType cacheType, final int listId) { if (cacheType == null) { throw new IllegalArgumentException("cacheType must not be null"); } init(); Set<String> geocodes = new HashSet<String>(); StringBuilder specifySql = new StringBuilder(); if (listId != StoredList.STANDARD_LIST_ID || !Settings.getStoredListShowsAll()) { specifySql.append("reason = "); specifySql.append(Math.max(listId, 1)); } else { specifySql.append("reason >= "); specifySql.append(StoredList.STANDARD_LIST_ID); } if (detailedOnly) { specifySql.append(" and detailed = 1 "); } if (cacheType != CacheType.ALL) { specifySql.append(" and type = \""); specifySql.append(cacheType.id); specifySql.append('"'); } try { Cursor cursor; if (coords != null) { cursor = databaseRO.query( dbTableCaches, new String[] { "geocode", "(abs(latitude-" + String.format((Locale) null, "%.6f", coords.getLatitude()) + ") + abs(longitude-" + String.format((Locale) null, "%.6f", coords.getLongitude()) + ")) as dif" }, specifySql.toString(), null, null, null, "dif", null); } else { cursor = databaseRO.query( dbTableCaches, new String[] { "geocode" }, specifySql.toString(), null, null, null, "geocode"); } if (cursor.moveToFirst()) { final int index = cursor.getColumnIndex("geocode"); do { geocodes.add(cursor.getString(index)); } while (cursor.moveToNext()); } cursor.close(); } catch (Exception e) { Log.e("cgData.loadBatchOfStoredGeocodes: " + e.toString()); } return geocodes; }
Source:
public synchronized void startRecordingCounters() { requireNotDisposed(); if (_monitorThread != null && _monitorThread.isAlive()) { _logger.info("Request to start system monitoring aborted as it is already running."); } else { _logger.info("Starting system monitor thread."); _checkAlertExistence(true); _monitorThread = new MonitorThread("system-monitor"); _monitorThread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { _logger.error("Uncaught exception occurred while pushing monitor counters for {}. Reason: {}", HOSTNAME, e.getMessage()); t.interrupt(); } }); _monitorThread.start(); _logger.info("System monitor thread started."); if (Boolean.valueOf(_sysConfig.getValue(com.salesforce.dva.argus.system.SystemConfiguration.Property.DATA_LAG_MONITOR_ENABLED))) { _dataLagMonitorThread = new DataLagMonitor(_sysConfig, _metricService, _mailService); _dataLagMonitorThread.start(); } } }

Target:
public synchronized void startRecordingCounters() { requireNotDisposed(); if (_monitorThread != null && _monitorThread.isAlive()) { _logger.info("Request to start system monitoring aborted as it is already running."); } else { _logger.info("Starting system monitor thread."); _checkAlertExistence(true); _monitorThread = new MonitorThread("system-monitor"); _monitorThread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { _logger.error("Uncaught exception occurred while pushing monitor counters for {}. Reason: {}", HOSTNAME, e.getMessage()); t.interrupt(); } }); _monitorThread.start(); _logger.info("System monitor thread started."); if (Boolean.valueOf(_sysConfig.getValue(com.salesforce.dva.argus.system.SystemConfiguration.Property.DATA_LAG_MONITOR_ENABLED))) { _logger.info("Starting data lag monitor thread."); _dataLagMonitorThread = new DataLagMonitor(_sysConfig, _metricService, _mailService); _dataLagMonitorThread.start(); _logger.info("Data lag monitor thread started."); } } }
Source:
public boolean validate() { getGeoRepSession().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); getFrequency().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); getHour().validateSelectedItem( new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, 24) } ); getMins().validateSelectedItem( new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, 60) } ); boolean ret = getGeoRepSession().getIsValid() && getFrequency().getIsValid(); if (!getFrequency().getSelectedItem().equals(Frequency.NONE)) { return ret && getHour().getIsValid() && getMins().getIsValid(); } return ret; }

Target:
public boolean validate() { getGeoRepSession().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); getFrequency().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); getHour().validateSelectedItem( new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, MAX_HOUR) } ); getMins().validateSelectedItem( new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, MAX_MINUTE) } ); boolean ret = getGeoRepSession().getIsValid() && getFrequency().getIsValid(); if (!getFrequency().getSelectedItem().equals(Frequency.NONE)) { return ret && getHour().getIsValid() && getMins().getIsValid(); } return ret; }
Source:
public void shiftingInstanceSerialization() throws ClassNotFoundException { Serializer<Serializable> s = new CompactJavaSerializer(null); System.out.println(Arrays.toString(Foo_W.class.getDeclaredClasses())); System.out.println(Foo_W.c.getClass().getEnclosingClass()); ClassLoader wLoader = createClassNameRewritingLoader(Foo_W.class); ClassLoader rLoader = createClassNameRewritingLoader(Foo_R.class); Class<?> wClass = wLoader.loadClass(newClassName(Foo_W.class)); Class<?> rClass = rLoader.loadClass(newClassName(Foo_R.class)); Object[] wInstances = wClass.getEnumConstants(); Object[] rInstances = rClass.getEnumConstants(); pushTccl(rLoader); try { for (int i = 0; i < wInstances.length; i++) { Assert.assertThat(s.read(s.serialize((Serializable) wInstances[i])), IsSame.sameInstance(rInstances[i])); } } finally { popTccl(); } }

Target:
public void shiftingInstanceSerialization() throws ClassNotFoundException { Serializer<Serializable> s = new CompactJavaSerializer(null); ClassLoader wLoader = createClassNameRewritingLoader(Foo_W.class); ClassLoader rLoader = createClassNameRewritingLoader(Foo_R.class); Class<?> wClass = wLoader.loadClass(newClassName(Foo_W.class)); Class<?> rClass = rLoader.loadClass(newClassName(Foo_R.class)); Object[] wInstances = wClass.getEnumConstants(); Object[] rInstances = rClass.getEnumConstants(); pushTccl(rLoader); try { for (int i = 0; i < wInstances.length; i++) { Assert.assertThat(s.read(s.serialize((Serializable) wInstances[i])), IsSame.sameInstance(rInstances[i])); } } finally { popTccl(); } }
Source:
public int decompress(byte[] b, int off, int len) throws IOException { ByteBuffer encodedBuffer = ByteBuffer.allocate(len - off); while (partialOutputByteBuffer != null && partialOutputByteBuffer.hasRemaining() && encodedBuffer.hasRemaining()) { encodedBuffer.put(partialOutputByteBuffer.get()); } encodeCharBufferIntoByteBuffer(encodedBuffer); if (decodedCharBuffer.remaining() > 0 && encodedBuffer.remaining() > 0) { encodePartialCharacter(encodedBuffer); } encodedBuffer.flip(); encodedBuffer.get(b, off, Math.min(encodedBuffer.remaining(), len)); return encodedBuffer.position(); }

Target:
public int decompress(byte[] b, int off, int len) throws IOException { ByteBuffer encodedBuffer = ByteBuffer.wrap(b, off, len); while (partialOutputByteBuffer != null && partialOutputByteBuffer.hasRemaining() && encodedBuffer.hasRemaining()) { encodedBuffer.put(partialOutputByteBuffer.get()); } encodeCharBufferIntoByteBuffer(encodedBuffer); if (decodedCharBuffer.remaining() > 0 && encodedBuffer.remaining() > 0 && encodedBuffer.position() - off == 0) { encodePartialCharIntoByteBuffer(encodedBuffer); } return encodedBuffer.position() - off; }
Source:
private void checkDoesNotReinit(ClientConfiguration ccfg) { ReliableChannel rc = new ReliableChannel(chFactory, ccfg, null); rc.initConnection(); List<ReliableChannel.ClientChannelHolder> originalChannels = rc.getChannelHolders(); rc.initChannelHolders(true); List<ReliableChannel.ClientChannelHolder> newChannels = rc.getChannelHolders(); assertSame(originalChannels, newChannels); IntStream.range(0, 3).forEach(i -> { assertSame(originalChannels.get(i), newChannels.get(i)); assertFalse(originalChannels.get(i).isClosed()); }); assertEquals(3, newChannels.size()); }

Target:
private void checkDoesNotReinit(ClientConfiguration ccfg) { ReliableChannel rc = new ReliableChannel(chFactory, ccfg, null); rc.channelsInit(); List<ReliableChannel.ClientChannelHolder> originalChannels = rc.getChannelHolders(); List<ReliableChannel.ClientChannelHolder> copyOriginalChannels = new ArrayList<>(originalChannels); rc.initChannelHolders(); List<ReliableChannel.ClientChannelHolder> newChannels = rc.getChannelHolders(); assertSame(originalChannels, newChannels); for (int i = 0; i < 3; ++i) { assertSame(copyOriginalChannels.get(i), newChannels.get(i)); assertFalse(copyOriginalChannels.get(i).isClosed()); } assertEquals(3, newChannels.size()); }
Source:
private void configureManagementNetwork(HostSetupNetworksParameters parameters) { ActionReturnValue retVal = getBackend().runInternalAction(ActionType.HostSetupNetworks, parameters, cloneContextAndDetachFromParent()); boolean skipCommit = parameters.isCommitOnSuccess() && isSkipCommitNetworkChangesSupported(host); if (retVal.getSucceeded() && !skipCommit) { retVal = getBackend().runInternalAction(ActionType.CommitNetworkChanges, new VdsActionParameters(parameters.getVdsId()), cloneContextAndDetachFromParent()); if (!retVal.getSucceeded()) { auditLogDirector.log(createEvent(), AuditLogType.PERSIST_NETWORK_FAILED_FOR_MANAGEMENT_NETWORK); throw new NetworkConfiguratorException(MANAGEMENT_NETWORK_CONFIG_ERR); } } else { auditLogDirector.log(createEvent(), AuditLogType.SETUP_NETWORK_FAILED_FOR_MANAGEMENT_NETWORK_CONFIGURATION); throw new NetworkConfiguratorException(MANAGEMENT_NETWORK_CONFIG_ERR); } }

Target:
private void configureManagementNetwork(HostSetupNetworksParameters parameters) { ActionReturnValue retVal = getBackend().runInternalAction(ActionType.HostSetupNetworks, parameters, cloneContextAndDetachFromParent()); boolean skipCommit = parameters.isCommitOnSuccess() && isSkipCommitNetworkChangesSupported(host); if (retVal.getSucceeded() && !skipCommit) { retVal = getBackend().runInternalAction(ActionType.CommitNetworkChanges, new VdsActionParameters(parameters.getVdsId()), cloneContextAndDetachFromParent()); if (!retVal.getSucceeded()) { auditLogDirector.log(createEvent(), AuditLogType.PERSIST_NETWORK_FAILED_FOR_MANAGEMENT_NETWORK); throw new NetworkConfiguratorException(MANAGEMENT_NETWORK_CONFIG_ERR); } } else if (!retVal.getSucceeded()) { auditLogDirector.log(createEvent(), AuditLogType.SETUP_NETWORK_FAILED_FOR_MANAGEMENT_NETWORK_CONFIGURATION); throw new NetworkConfiguratorException(MANAGEMENT_NETWORK_CONFIG_ERR); } }
Source:
public void test_startActionSingleSyncWithIUnderstandShouldStartService() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()); prefs.edit().putBoolean("i_understand", true).commit(); ShadowActivity shadowActivity = Robolectric.shadowOf(activity); SyncingService.startActionSingleSync(activity.getApplicationContext(), 2); Intent syncingService = shadowActivity.getNextStartedService(); assertThat(ShadowToast.shownToastCount(), is(0)); assertThat(syncingService.getAction(), is("com.nightscout.android.dexcom.action.SYNC")); assertThat(syncingService.getExtras().getInt("com.nightscout.android.dexcom.extra.SYNC_PERIOD"), is(2)); }

Target:
public void test_startActionSingleSyncWithIUnderstandShouldStartService() { prefs.setIUnderstand(true); SyncingService.startActionSingleSync(activity.getApplicationContext(), 2); Intent syncingService = shadowActivity.getNextStartedService(); assertThat(ShadowToast.shownToastCount(), is(0)); assertThat(syncingService.getAction(), is("com.nightscout.android.dexcom.action.SYNC")); assertThat(syncingService.getExtras() .getInt("com.nightscout.android.dexcom.extra.SYNC_PERIOD"), is(2)); }
Source:
public static String createFunctionJsonString(CharSequence functionName, Object... args) { return "{\"" + "func\":" + wrapAndEscape(functionName) + "," + "\"args\":[" + Arrays.stream(args) .map(RemoteFunctionCallUtils::wrapAndEscape) .collect(Collectors.joining(",")) + "]" + "}"; }

Target:
public static String createFunctionJsonString(CharSequence functionName, Object... args) { return new JSONObject().put("func", functionName).put("args", new JSONArray(args)).toString(); }
Source:
public ContainerContext(ServletContext context, WeldManager manager) { if (context == null) { throw WeldServletLogger.LOG.nullServletContext(); } this.servletContext = context; if (manager == null) { manager = (WeldManager) context.getAttribute(WeldServletLifecycle.BEAN_MANAGER_ATTRIBUTE_NAME); } this.manager = manager; }

Target:
public ContainerContext(ServletContext context, WeldManager manager) { Preconditions.checkArgumentNotNull(context, "servlet context"); this.servletContext = context; if (manager == null) { manager = (WeldManager) context.getAttribute(WeldServletLifecycle.BEAN_MANAGER_ATTRIBUTE_NAME); } this.manager = manager; }
Source:
protected void doAsyncAddEntry(final PendingAddOp op, final ByteBuf data, final AddCallback cb, final Object ctx) { if (op.entryId < 0 ) { super.doAsyncAddEntry(op, data, cb, ctx); return; } if (throttler != null) { throttler.acquire(); } final long currentLength; boolean wasClosed = false; synchronized (this) { if (metadata.isClosed()) { wasClosed = true; currentLength = 0; } else { currentLength = addToLength(length); pendingAddOps.add(op); } } if (wasClosed) { try { bk.mainWorkerPool.submit(new SafeRunnable() { @Override public void safeRun() { LOG.warn("Attempt to add to closed ledger: {}", ledgerId); cb.addComplete(BKException.Code.LedgerClosedException, LedgerHandleAdv.this, op.getEntryId(), ctx); } @Override public String toString() { return String.format("AsyncAddEntryToClosedLedger(lid=%d)", ledgerId); } }); } catch (RejectedExecutionException e) { cb.addComplete(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandleAdv.this, op.getEntryId(), ctx); } return; } try { bk.mainWorkerPool.submit(new SafeRunnable() { @Override public void safeRun() { ByteBuf toSend = macManager.computeDigestAndPackageForSending(op.getEntryId(), lastAddConfirmed, currentLength, data); try { op.initiate(toSend, toSend.readableBytes()); } finally { toSend.release(); } } }); } catch (RejectedExecutionException e) { cb.addComplete(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandleAdv.this, op.getEntryId(), ctx); } }

Target:
protected void doAsyncAddEntry(final PendingAddOp op, final ByteBuf data, final AddCallback cb, final Object ctx) { if (throttler != null) { throttler.acquire(); } final long currentLength; boolean wasClosed = false; synchronized (this) { if (metadata.isClosed()) { wasClosed = true; currentLength = 0; } else { currentLength = addToLength(length); pendingAddOps.add(op); } } if (wasClosed) { try { bk.mainWorkerPool.submit(new SafeRunnable() { @Override public void safeRun() { LOG.warn("Attempt to add to closed ledger: {}", ledgerId); cb.addComplete(BKException.Code.LedgerClosedException, LedgerHandleAdv.this, op.getEntryId(), ctx); } @Override public String toString() { return String.format("AsyncAddEntryToClosedLedger(lid=%d)", ledgerId); } }); } catch (RejectedExecutionException e) { cb.addComplete(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandleAdv.this, op.getEntryId(), ctx); } return; } try { bk.mainWorkerPool.submit(new SafeRunnable() { @Override public void safeRun() { ByteBuf toSend = macManager.computeDigestAndPackageForSending(op.getEntryId(), lastAddConfirmed, currentLength, data); try { op.initiate(toSend, toSend.readableBytes()); } finally { toSend.release(); } } }); } catch (RejectedExecutionException e) { cb.addComplete(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandleAdv.this, op.getEntryId(), ctx); } }
Source:
public FirmwareBuilder(ThingTypeUID thingTypeUID, String firmwareVersion) { Objects.requireNonNull(thingTypeUID, "Thing type UID must not be null."); if (firmwareVersion == null || firmwareVersion.isEmpty()) { throw new IllegalArgumentException("Firmware version must not be null or empty."); } this.version = firmwareVersion; this.thingTypeUID = thingTypeUID; }

Target:
private FirmwareBuilder(ThingTypeUID thingTypeUID, String firmwareVersion) { checkNotNull(thingTypeUID, "ThingTypeUID"); this.thingTypeUID = thingTypeUID; checkNotNullOrEmpty(firmwareVersion, "Firmware version"); this.version = firmwareVersion; this.properties = new HashMap<>(); }
Source:
public static void assertWarnings(QueryRunner queryRunner, Session session, @Language("SQL") String sql, List<WarningCode> expectedWarnings) { Set<WarningCode> warnings = queryRunner.execute(session, sql).getWarnings().stream() .map(PrestoWarning::getWarningCode) .collect(toImmutableSet()); for (WarningCode warningCode : expectedWarnings) { if (!warnings.contains(warningCode)) { fail("Expected warning: " + warningCode); } } }

Target:
private static void assertWarnings(QueryRunner queryRunner, Session session, @Language("SQL") String sql, List<WarningCode> expectedWarnings) { Set<WarningCode> warnings = queryRunner.execute(session, sql).getWarnings().stream() .map(PrestoWarning::getWarningCode) .collect(toImmutableSet()); for (WarningCode warningCode : expectedWarnings) { if (!warnings.contains(warningCode)) { fail("Expected warning: " + warningCode); } } }
Source:
public List<GeoFence> getWithinAlerts() throws GeoLocationBasedServiceException { Registry registry = getGovernanceRegistry(); String registryPath = GeoServices.REGISTRY_PATH_FOR_ALERTS + GeoServices.ALERT_TYPE_WITHIN + "/"; Resource resource; try { resource = registry.get(registryPath); } catch (RegistryException e) { log.error("Error while reading the registry path: " + registryPath); return null; } try { List<GeoFence> fences = new ArrayList<>(); if (resource != null) { Object contentObj = resource.getContent(); if (contentObj instanceof String[]) { String[] content = (String[]) contentObj; for (String res : content) { Resource childRes = registry.get(res); Properties props = childRes.getProperties(); GeoFence geoFence = new GeoFence(); InputStream inputStream = childRes.getContentStream(); StringWriter writer = new StringWriter(); IOUtils.copy(inputStream, writer, "UTF-8"); geoFence.setGeoJson(writer.toString()); List queryNameObj = (List) props.get(GeoServices.QUERY_NAME); geoFence.setQueryName(queryNameObj != null ? queryNameObj.get(0).toString() : null); List areaNameObj = (List) props.get(GeoServices.AREA_NAME); geoFence.setAreaName(areaNameObj != null ? areaNameObj.get(0).toString() : null); geoFence.setCreatedTime(childRes.getCreatedTime().getTime()); fences.add(geoFence); } } } return fences; } catch (RegistryException | IOException e) { throw new GeoLocationBasedServiceException( "Error occurred while getting the geo alerts" , e); } }

Target:
public List<GeoFence> getWithinAlerts() throws GeoLocationBasedServiceException { Registry registry = getGovernanceRegistry(); String registryPath = GeoServices.REGISTRY_PATH_FOR_ALERTS + GeoServices.ALERT_TYPE_WITHIN + "/"; Resource resource; try { resource = registry.get(registryPath); } catch (RegistryException e) { log.error("Error while reading the registry path: " + registryPath); return Collections.emptyList(); } try { List<GeoFence> fences = new ArrayList<>(); if (resource != null) { Object contentObj = resource.getContent(); if (contentObj instanceof String[]) { String[] content = (String[]) contentObj; for (String res : content) { Resource childRes = registry.get(res); Properties props = childRes.getProperties(); GeoFence geoFence = new GeoFence(); InputStream inputStream = childRes.getContentStream(); StringWriter writer = new StringWriter(); IOUtils.copy(inputStream, writer, "UTF-8"); geoFence.setGeoJson(writer.toString()); List queryNameObj = (List) props.get(GeoServices.QUERY_NAME); geoFence.setQueryName(queryNameObj != null ? queryNameObj.get(0).toString() : null); List areaNameObj = (List) props.get(GeoServices.AREA_NAME); geoFence.setAreaName(areaNameObj != null ? areaNameObj.get(0).toString() : null); geoFence.setCreatedTime(childRes.getCreatedTime().getTime()); fences.add(geoFence); } } } return fences; } catch (RegistryException | IOException e) { throw new GeoLocationBasedServiceException( "Error occurred while getting the geo alerts" , e); } }
Source:
public static void removePmFromDrafts(PrivateMessage pm) { info("Start to remove PM from drafts folder"); mainPage.openPrivateMessages(); info("Opening drafts folder"); pmPage.clickOpenDrafts(); removePm(pm); }

Target:
public static void removePmFromDrafts(PrivateMessage pm) { info("Start to remove PM from drafts folder"); mainPage.openPrivateMessages(); pmPage.clickOpenDrafts(); removePm(pm); }
Source:
public KafkaProducer(Map<String, Object> configs, Serializer<K> keySerializer, Serializer<V> valueSerializer) { this(new ProducerConfig(ProducerConfig.addSerializerToConfig(configs, keySerializer, valueSerializer)), keySerializer, valueSerializer, null, null, null, Time.SYSTEM); }

Target:
public KafkaProducer(Map<String, Object> configs, Serializer<K> keySerializer, Serializer<V> valueSerializer) { this(configs, keySerializer, valueSerializer, null, null, null, Time.SYSTEM); }
Source:
protected void onSave() { if (hasUnsavedChanges()){ super.onSave(); } else { Window.alert(CommonConstants.INSTANCE.NoChangesSinceLastSave()); } }

Target:
protected void onSave() { if (hasUnsavedChanges()){ super.onSave(); } else { final String message = CommonConstants.INSTANCE.NoChangesSinceLastSave(); log(Level.INFO, message); presenter.getView().showMessage(message); } }
Source:
public static PsiElement searchInImports(HaxeFileModel file, String name) { HaxeImportModel importModel = file.getImportModels().stream() .filter(model -> { PsiElement exposedItem = model.exposeByName(name); return exposedItem != null; }) .findFirst().orElse(null); if (importModel != null) { return importModel.exposeByName(name); } return null; }

Target:
public static PsiElement searchInImports(HaxeFileModel file, String name) { HaxeImportModel importModel = StreamUtil.reverse(file.getImportModels().stream()) .filter(model -> { PsiElement exposedItem = model.exposeByName(name); return exposedItem != null; }) .findFirst().orElse(null); if (importModel != null) { return importModel.exposeByName(name); } return null; }
Source:
private CellProcessor[] getProcessor(List<Field> fields) { CellProcessor[] processor = new CellProcessor[fields.size()]; int fieldCount = 0; for (Field field : fields) { if (field.getType() == FieldType.DATE) { String format = field.getConstraints().get(DelimitedSchema.getDateFormat()) == null ? null : (String)field.getConstraints().get(DelimitedSchema.getDateFormat()); processor[fieldCount++] = new Optional(new FmtDate(format == null ? "dd/MM/yyyy" : format)); } else { processor[fieldCount++] = new Optional(); } } return processor; }

Target:
private CellProcessor[] getProcessor(List<Field> fields) { CellProcessor[] processor = new CellProcessor[fields.size()]; int fieldCount = 0; for (Field field : fields) { if (field.getType() == FieldType.DATE) { String format = field.getConstraints().get(DelimitedSchema.DATE_FORMAT) == null ? null : (String)field.getConstraints().get(DelimitedSchema.DATE_FORMAT); processor[fieldCount++] = new Optional(new FmtDate(format == null ? "dd/MM/yyyy" : format)); } else { processor[fieldCount++] = new Optional(); } } return processor; }
Source:
public ATCommand(String command, String parameter) { this.command = command; this.parameter = parameter.getBytes(); }

Target:
public ATCommand(String command, String parameter) { if (command == null) throw new NullPointerException("Command cannot be null."); this.command = command; if (parameter != null) this.parameter = parameter.getBytes(); }
Source:
public Analyzer getBean(Map<String, String> initProperties, String fullPrefix, SenseiPluginRegistry pluginRegistry) { Analyzer defaultAnalyzer = pluginRegistry.getBeanByFullPrefix(fullPrefix + ".default", Analyzer.class); if (defaultAnalyzer == null) { defaultAnalyzer = new KeywordAnalyzer(); } String[] fields = MapUtils.getString(initProperties, "fields", "").split(" *, *"); Map<String, Analyzer> analyzers = new HashMap<String, Analyzer>(); for (String field: fields) { String analyzerPrefix = fullPrefix + ".fields." + field; Analyzer analyzer = pluginRegistry.getBeanByFullPrefix(analyzerPrefix, Analyzer.class); analyzers.put(field, analyzer); } return new PerFieldAnalyzerWrapper(defaultAnalyzer, analyzers); }

Target:
public Analyzer getBean(Map<String, String> initProperties, String fullPrefix, SenseiPluginRegistry pluginRegistry) { Analyzer defaultAnalyzer = pluginRegistry.getBeanByFullPrefix(fullPrefix + ".default", Analyzer.class); if (defaultAnalyzer == null) { defaultAnalyzer = new StandardAnalyzer(Version.LUCENE_35); } String[] fields = MapUtils.getString(initProperties, "fields", "").split("\\s*,\\s*"); Map<String, Analyzer> analyzers = new HashMap<String, Analyzer>(); for (String field: fields) { String analyzerPrefix = fullPrefix + ".fields." + field; Analyzer analyzer = pluginRegistry.getBeanByFullPrefix(analyzerPrefix, Analyzer.class); analyzers.put(field, analyzer); } return new PerFieldAnalyzerWrapper(defaultAnalyzer, analyzers); }
Source:
public Page getOutput() { if (lookupSource == null) { return null; } Counter lookupPositionsConsidered = new Counter(); if (probe != null) { while (true) { if (operatorContext.getDriverContext().getAbortSignal().isAborted()) { break; } if (probe.getPosition() >= 0) { if (!joinCurrentPosition(lookupPositionsConsidered)) { break; } if (!currentProbePositionProducedRow) { currentProbePositionProducedRow = true; if (!outerJoinCurrentPosition()) { break; } } } currentProbePositionProducedRow = false; if (!advanceProbePosition()) { break; } statisticsCounter.recordProbe(joinSourcePositions); joinSourcePositions = 0; } } if (pageBuilder.isFull() || (finishing && !pageBuilder.isEmpty() && probe == null)) { Page page = pageBuilder.build(); pageBuilder.reset(); return page; } return null; }

Target:
public Page getOutput() { if (lookupSource == null) { return null; } DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); if (probe != null) { while (!yieldSignal.isSet()) { if (probe.getPosition() >= 0) { if (!joinCurrentPosition(yieldSignal)) { break; } if (!currentProbePositionProducedRow) { currentProbePositionProducedRow = true; if (!outerJoinCurrentPosition()) { break; } } } currentProbePositionProducedRow = false; if (!advanceProbePosition()) { break; } statisticsCounter.recordProbe(joinSourcePositions); joinSourcePositions = 0; } } if (pageBuilder.isFull() || (finishing && !pageBuilder.isEmpty() && probe == null)) { Page page = pageBuilder.build(); pageBuilder.reset(); return page; } return null; }
Source:
public Page appendColumn(Block block) { requireNonNull(block, "block is null"); if (positionCount != block.getPositionCount()) { throw new IllegalArgumentException("Block does not have same position count"); } Block[] newBlocks = new Block[blocks.length + 1]; System.arraycopy(blocks, 0, newBlocks, 0, blocks.length); newBlocks[blocks.length] = block; return new Page(newBlocks); }

Target:
public Page appendColumn(Block block) { requireNonNull(block, "block is null"); if (positionCount != block.getPositionCount()) { throw new IllegalArgumentException("Block does not have same position count"); } Block[] newBlocks = Arrays.copyOf(blocks, blocks.length + 1); newBlocks[blocks.length] = block; return new Page(newBlocks); }
Source:
public void standbyShouldNotPerformRestoreAtStartup() throws Exception { final int numMessages = 10; final int key = 1; final Semaphore semaphore = new Semaphore(0); final StreamsBuilder builder = new StreamsBuilder(); builder .table(INPUT_TOPIC_NAME, Consumed.with(Serdes.Integer(), Serdes.Integer()), Materialized.<Integer, Integer, KeyValueStore<Bytes, byte[]>>as(TABLE_NAME) .withCachingDisabled()) .toStream() .peek((k, v) -> semaphore.release()); final KafkaStreams kafkaStreams1 = createKafkaStreams(builder, streamsConfiguration()); final KafkaStreams kafkaStreams2 = createKafkaStreams(builder, streamsConfiguration()); final List<KafkaStreams> kafkaStreamsList = Arrays.asList(kafkaStreams1, kafkaStreams2); produceValueRange(key, 0, 10); final AtomicLong restoreStartOffset = new AtomicLong(-1); kafkaStreamsList.forEach(kafkaStreams -> { kafkaStreams.setGlobalStateRestoreListener(createTrackingRestoreListener(restoreStartOffset, new AtomicLong())); }); startApplicationAndWaitUntilRunning(kafkaStreamsList, 60 * 1000); assertThat(semaphore.tryAcquire(numMessages, 60, TimeUnit.SECONDS), is(equalTo(true))); assertThat(restoreStartOffset.get(), is(equalTo(-1L))); }

Target:
public void standbyShouldNotPerformRestoreAtStartup() throws Exception { final int numMessages = 10; final int key = 1; final Semaphore semaphore = new Semaphore(0); final StreamsBuilder builder = new StreamsBuilder(); builder .table(INPUT_TOPIC_NAME, Consumed.with(Serdes.Integer(), Serdes.Integer()), Materialized.<Integer, Integer, KeyValueStore<Bytes, byte[]>>as(TABLE_NAME) .withCachingDisabled()) .toStream() .peek((k, v) -> semaphore.release()); final KafkaStreams kafkaStreams1 = createKafkaStreams(builder, streamsConfiguration()); final KafkaStreams kafkaStreams2 = createKafkaStreams(builder, streamsConfiguration()); final List<KafkaStreams> kafkaStreamsList = Arrays.asList(kafkaStreams1, kafkaStreams2); produceValueRange(key, 0, 10); final AtomicLong restoreStartOffset = new AtomicLong(-1); kafkaStreamsList.forEach(kafkaStreams -> { kafkaStreams.setGlobalStateRestoreListener(createTrackingRestoreListener(restoreStartOffset, new AtomicLong())); }); startApplicationAndWaitUntilRunning(kafkaStreamsList, Duration.ofSeconds(60)); assertThat(semaphore.tryAcquire(numMessages, 60, TimeUnit.SECONDS), is(equalTo(true))); assertThat(restoreStartOffset.get(), is(equalTo(-1L))); }
Source:
public GlusterServersListReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); Object[] temp = (Object[]) innerMap.get(GLUSTER_HOSTS); if (temp != null) { for (int i = 0; i < temp.length; i++) { hostsList.add(prepareHostsEntity((Map<String, Object>) temp[i])); } } }

Target:
public GlusterServersListReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); Set<GlusterServerInfo> glusterServers = new HashSet<GlusterServerInfo>(); Object[] serversArr = (Object[]) innerMap.get(GLUSTER_HOSTS); if (serversArr != null) { for (int i = 0; i < serversArr.length; i++) { glusterServers.add(prepareHostsEntity((Map<String, Object>) serversArr[i])); } } setServer(glusterServers); }
Source:
public List<TopMenu.MenuEntry> apply(ConfigResource resource) { List<TopMenu.MenuEntry> entries = Lists.newArrayList(); if (returnAllMenusEnabled) { entries.addAll(gerritTopMenus.getTopMenuBar(true, currentProject)); } for (TopMenu extension : extensions) { entries.addAll(extension.getEntries()); } return entries; }

Target:
public List<TopMenu.MenuEntry> apply(ConfigResource resource) { List<TopMenu.MenuEntry> entries = Lists.newArrayList(); if (returnAllMenusEnabled) { entries.addAll(topMenusProvider.get().getTopMenuBar(true, currentProject)); } for (TopMenu extension : extensions) { entries.addAll(extension.getEntries()); } return entries; }
Source:
public GaviNestWarden(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{R}{W}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.SHAMAN); this.power = new MageInt(2); this.toughness = new MageInt(5); Effect effect = new CyclingZeroCostEffect(filter); effect.setText("You may pay {0} rather than pay the cycling cost of the first card you cycle each turn."); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect), new GaviNestWardenWatcher()); Ability ability = new DrawSecondCardTriggeredAbility(new CreateTokenEffect(new DinosaurCatToken()), false); this.addAbility(ability); }

Target:
public GaviNestWarden(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{R}{W}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.SHAMAN); this.power = new MageInt(2); this.toughness = new MageInt(5); Effect effect = new CyclingZeroCostEffect(); this.addAbility(new SimpleStaticAbility(effect), new GaviNestWardenWatcher()); Ability ability = new DrawSecondCardTriggeredAbility(new CreateTokenEffect(new DinosaurCatToken()), false); this.addAbility(ability); }
Source:
public void setValues(double limit, double consumedByOthers, double consumedByUser) { int othersConsumptionPercent = (int) Math.round(consumedByOthers * 100 / limit); int userConsumptionPercent = (int) Math.round(consumedByUser * 100 / limit); double free = limit - consumedByOthers - consumedByUser; switch (getType()) { case STORAGE: String freeStorage = free == 0 ? "0" : diskSizeRenderer.render(free); setTitle(constants.freeStorage() + freeStorage); break; case CPU: setTitle(messages.quotaFreeCpus((int) free)); break; case MEM: String freeMem = free > 4096 ? diskSizeRenderer.render(free/1024) : (int) free + "MB"; setTitle(constants.freeMemory() + freeMem); break; } if (limit == UNLIMITED) { setUnlimited(); } else if (consumedByOthers + consumedByUser == 0) { setZeroValue(); } else if (consumedByOthers + consumedByUser > limit) { switch (getType()) { case STORAGE: setExceeded(messages.exceedingStorage(othersConsumptionPercent + userConsumptionPercent - 100, -free)); break; case CPU: setExceeded(messages.exceedingCpus(othersConsumptionPercent + userConsumptionPercent - 100, (int) -free)); break; case MEM: String freeMem = free < -4096 ? diskSizeRenderer.render(-free/1024) : (int) -free + "MB"; setExceeded(messages.exceedingMem(othersConsumptionPercent + userConsumptionPercent - 100, freeMem)); break; } } else { percentageBarA.setStyleName(style.percentageBarA()); percentageLabelA.setStyleName(style.percentageLabelBlack()); percentageBarB.setVisible(true); setValueA(othersConsumptionPercent); setValueB(userConsumptionPercent); setBars(); } }

Target:
public void setValues(double limit, double consumedByOthers, double consumedByUser) { int othersConsumptionPercent = (int) Math.round(consumedByOthers * 100 / limit); int userConsumptionPercent = (int) Math.round(consumedByUser * 100 / limit); double free = limit - consumedByOthers - consumedByUser; setTitleInternal(free); if (limit == UNLIMITED) { setUnlimited(); } else if (consumedByOthers + consumedByUser == 0) { setZeroValue(); } else if (consumedByOthers + consumedByUser > limit) { switch (getType()) { case STORAGE: setExceeded(messages.exceedingStorage(othersConsumptionPercent + userConsumptionPercent - 100, -free)); break; case CPU: setExceeded(messages.exceedingCpus(othersConsumptionPercent + userConsumptionPercent - 100, (int) -free)); break; case MEM: String freeMem = free < (-MB_GB_THRESHOLD * GIGA) ? diskSizeRenderer.render(-free/GIGA) : (int) -free + "MB"; setExceeded(messages.exceedingMem(othersConsumptionPercent + userConsumptionPercent - 100, freeMem)); break; } } else { percentageBarA.setStyleName(style.percentageBarA()); percentageLabelA.setStyleName(style.percentageLabelBlack()); percentageBarB.setVisible(true); setValueA(othersConsumptionPercent); setValueB(userConsumptionPercent); setBars(); } }
Source:
public StripeFooter(List<Stream> streams, List<ColumnEncoding> columnEncodings, List<Slice> stripeEncryptionGroups) { this.streams = ImmutableList.copyOf(requireNonNull(streams, "streams is null")); this.columnEncodings = ImmutableList.copyOf(requireNonNull(columnEncodings, "columnEncodings is null")); this.stripeEncryptionGroups = requireNonNull(stripeEncryptionGroups, "stripeEncryptionGroups is null"); }

Target:
public StripeFooter(List<Stream> streams, List<ColumnEncoding> columnEncodings, List<Slice> stripeEncryptionGroups) { this.streams = ImmutableList.copyOf(requireNonNull(streams, "streams is null")); this.columnEncodings = ImmutableList.copyOf(requireNonNull(columnEncodings, "columnEncodings is null")); this.stripeEncryptionGroups = ImmutableList.copyOf(requireNonNull(stripeEncryptionGroups, "stripeEncryptionGroups is null")); }
Source:
public boolean execute() { final boolean[] result = new boolean[1]; Display display = Display.getCurrent(); BusyIndicator.showWhile(display, () -> result[0] = doExecute()); return result[0]; }

Target:
public boolean execute() { final boolean[] result = new boolean[1]; Display display = Display.getDefault(); BusyIndicator.showWhile(display, () -> result[0] = doExecute()); return result[0]; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.multiple_apps_limit_view); boolean installAttemptCameFromAppManager = getIntent().getBooleanExtra(AppManagerActivity.KEY_LAUNCH_FROM_MANAGER, false); Button toManagerButton = (Button)findViewById(R.id.back_to_manager_button); if (installAttemptCameFromAppManager) { toManagerButton.setText("Back to App Manager"); toManagerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setResult(RESULT_OK); finish(); } }); } else { toManagerButton.setText("Go to App Manager"); toManagerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(MultipleAppsLimitWarningActivity.this, AppManagerActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); } }); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.multiple_apps_limit_view); boolean installAttemptCameFromAppManager = getIntent() .getBooleanExtra(AppManagerActivity.KEY_LAUNCH_FROM_MANAGER, false); setupUI(installAttemptCameFromAppManager); }
Source:
public void tryStartWorkspace() { final WorkspaceConfigDto workspaceConfigDto = factory.getWorkspace(); if (workspaceConfigDto == null) { notificationManager.showError("Workspace config is not defined"); } getWorkspaceToStart().then(startWorkspace()).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError arg) throws OperationException { Log.error(getClass(), arg.getMessage()); } }); }

Target:
public void tryStartWorkspace() { final WorkspaceConfigDto workspaceConfigDto = factory.getWorkspace(); if (workspaceConfigDto == null) { notificationManager.showError(locale.workspaceConfigUndefined()); return; } getWorkspaceToStart().then(startWorkspace()).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError arg) throws OperationException { Log.error(getClass(), arg.getMessage()); } }); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Quantity quantity = (Quantity) o; return getNormalizedValue(this) .toBigInteger() .equals(getNormalizedValue(quantity).toBigInteger()); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Quantity quantity = (Quantity) o; return getAmountInBytes(this) .toBigInteger() .equals(getAmountInBytes(quantity).toBigInteger()); }
Source:
SolrInputDocument toDoc(Question q) { SolrInputDocument doc = new SolrInputDocument(); doc.addField("id", q.getId()); doc.addField("title", q.getTitle()); doc.addField("tags", Lists.transform(q.getTags(), new Function<Tag, String>() { @Nullable @Override public String apply(@Nullable Tag tag) { return tag.getName(); } })); doc.addField("type", Question.class.getCanonicalName()); return doc; }

Target:
private SolrInputDocument toDoc(Question q) { SolrInputDocument doc = new SolrInputDocument(); doc.addField("id", q.getId()); doc.addField("title", q.getTitle()); doc.addField("tags", Lists.transform(q.getTags(), new Function<Tag, String>() { @Nullable @Override public String apply(@Nullable Tag tag) { return tag.getName(); } })); doc.addField("type", Question.class.getCanonicalName()); return doc; }
Source:
public Map<KOut, List<VOut>> removeLRUEntry() { Map<KOut, List<VOut>> lrus = new HashMap<KOut, List<VOut>>(1); synchronized (this) { Iterator<KOut> iterator = store.keySet().iterator(); if (iterator.hasNext()){ KOut out = iterator.next(); List<VOut> list = store.remove(out); lrus.put(out, list); emitCount.addAndGet(list.size() * -1); } } return lrus; }

Target:
public Map<KOut, List<VOut>> removeLRUEntry() { Map<KOut, List<VOut>> lrus = Collections.emptyMap(); synchronized (this) { Iterator<KOut> iterator = store.keySet().iterator(); if (iterator.hasNext()){ KOut out = iterator.next(); List<VOut> list = store.remove(out); lrus = Collections.singletonMap(out, list); emitCount.addAndGet(-list.size()); } } return lrus; }