auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Optional<HiveBucketProperty> getBucketProperty(Map<String, Object> tableProperties) { List<String> bucketedBy = getBucketedBy(tableProperties); if (bucketedBy == null) { return Optional.empty(); } List<SortingColumn> sortedBy = getSortedBy(tableProperties); int bucketCount = (Integer) tableProperties.get(BUCKET_COUNT_PROPERTY); if ((bucketedBy.isEmpty()) && (bucketCount == 0)) { if (!sortedBy.isEmpty()) { throw new PrestoException(INVALID_TABLE_PROPERTY, format("%s may be specified only when %s is specified", SORTED_BY_PROPERTY, BUCKETED_BY_PROPERTY)); } return Optional.empty(); } if (bucketCount < 0) { throw new PrestoException(INVALID_TABLE_PROPERTY, format("%s must be greater than zero", BUCKET_COUNT_PROPERTY)); } if (bucketCount > 1_000_000) { throw new PrestoException(INVALID_TABLE_PROPERTY, format("%s should be no more than 1000000", BUCKET_COUNT_PROPERTY)); } if (bucketedBy.isEmpty() || bucketCount == 0) { throw new PrestoException(INVALID_TABLE_PROPERTY, format("%s and %s must be specified together", BUCKETED_BY_PROPERTY, BUCKET_COUNT_PROPERTY)); } return Optional.of(new HiveBucketProperty(bucketedBy, bucketCount, sortedBy)); }

Target:
public static Optional<HiveBucketProperty> getBucketProperty(Map<String, Object> tableProperties) { List<String> bucketedBy = getBucketedBy(tableProperties); List<SortingColumn> sortedBy = getSortedBy(tableProperties); int bucketCount = (Integer) tableProperties.get(BUCKET_COUNT_PROPERTY); if ((bucketedBy.isEmpty()) && (bucketCount == 0)) { if (!sortedBy.isEmpty()) { throw new PrestoException(INVALID_TABLE_PROPERTY, format("%s may be specified only when %s is specified", SORTED_BY_PROPERTY, BUCKETED_BY_PROPERTY)); } return Optional.empty(); } if (bucketCount < 0) { throw new PrestoException(INVALID_TABLE_PROPERTY, format("%s must be greater than zero", BUCKET_COUNT_PROPERTY)); } if (bucketCount > 1_000_000) { throw new PrestoException(INVALID_TABLE_PROPERTY, format("%s should be no more than 1000000", BUCKET_COUNT_PROPERTY)); } if (bucketedBy.isEmpty() || bucketCount == 0) { throw new PrestoException(INVALID_TABLE_PROPERTY, format("%s and %s must be specified together", BUCKETED_BY_PROPERTY, BUCKET_COUNT_PROPERTY)); } return Optional.of(new HiveBucketProperty(bucketedBy, bucketCount, sortedBy)); }
Source:
private void configureAuditQueue(AuditConfig auditConfig) { if (null == auditConfig) { this.auditQueue = new NoopTaskQueue(); } else { String queueName = auditConfig.getAuditQueueName(); if (null == queueName) { this.auditQueue = new NoopTaskQueue(); } else { String queueType = auditConfig.getAuditQueueType(); if (queueType.equalsIgnoreCase("RABBITMQ")) { String host = auditConfig.getRabbitmqHost(); Integer port = auditConfig.getRabbitmqPort(); String vhost = auditConfig.getRabbitmqVhost(); String exchange = auditConfig.getRabbitmqExchange(); String username = auditConfig.getRabbitmqUsername(); String password = auditConfig.getRabbitmqPassword(); log.info("Configuring Audit queue with host: {}, port: {}, vhost: {}, exchange: {}, queue: {}", host, port, vhost, exchange, queueName); this.auditQueue = new RabbitMQTaskQueue(host, port, vhost, exchange, username, password, queueName); } else { this.auditQueue = new SQSTaskQueue(queueName); } } } }

Target:
private void configureAuditQueue(AuditConfig auditConfig) { if (null == auditConfig) { this.auditQueue = new NoopTaskQueue(); } else { String queueName = auditConfig.getAuditQueueName(); if (null == queueName) { this.auditQueue = new NoopTaskQueue(); } else { QueueType queueType = auditConfig.getQueueType(); if (queueType == QueueType.RABBITMQ) { String host = auditConfig.getRabbitmqHost(); Integer port = auditConfig.getRabbitmqPort(); String vhost = auditConfig.getRabbitmqVhost(); String exchange = auditConfig.getRabbitmqExchange(); String username = auditConfig.getRabbitmqUsername(); String password = auditConfig.getRabbitmqPassword(); log.info("Configuring Audit queue with host: {}, port: {}, vhost: {}, exchange: {}, queue: {}", host, port, vhost, exchange, queueName); this.auditQueue = new RabbitMQTaskQueue(host, port, vhost, exchange, username, password, queueName); } else { this.auditQueue = new SQSTaskQueue(queueName); } } } }
Source:
private static boolean detectSSL(MultiAddress multiaddress) { return multiaddress.toString().contains("https"); }

Target:
private static boolean detectSSL(MultiAddress multiaddress) { return multiaddress.toString().contains("/https"); }
Source:
public static String fetchDataFromUri(String endpoint) { String data = null; try(DefaultHttpClient client = new DefaultHttpClient()) { HttpUriRequest req = new HttpGet(endpoint); req.addHeader("Content-Type", "text/xml"); HttpResponse resp = client.execute(req); StatusLine statusLine = resp.getStatusLine(); if (statusLine.getStatusCode() != 200) { log.error("Failed to retrieve data from " + endpoint + ". Error code " + statusLine.getStatusCode() + ". Reason: " + statusLine.getReasonPhrase()); } else { data = IOUtils.toString(resp.getEntity().getContent(), "UTF-8"); } } catch (Exception e) { log.error("Failed to retireve data from " + endpoint + ". Error: " + e.getMessage() + ". Stack Trace: " + e.getStackTrace()); } return data; }

Target:
public static String fetchDataFromUri(String endpoint) { String data = null; try(CloseableHttpClient client = HttpClientBuilder.create().build()) { HttpUriRequest req = new HttpGet(endpoint); req.addHeader("Content-Type", "text/xml"); HttpResponse resp = client.execute(req); StatusLine statusLine = resp.getStatusLine(); if (statusLine.getStatusCode() != 200) { log.error("Failed to retrieve data from " + endpoint + ". Error code " + statusLine.getStatusCode() + ". Reason: " + statusLine.getReasonPhrase()); } else { data = IOUtils.toString(resp.getEntity().getContent(), "UTF-8"); } } catch (Exception e) { log.error("Failed to retireve data from " + endpoint + ". Error: " + e.getMessage() + ". Stack Trace: " + e.getStackTrace()); } return data; }
Source:
public boolean redirectProviderCanDoRainSnowIce(WorldProvider provider, Chunk chunk) { boolean canDoRainSnowIce = provider.canDoRainSnowIce(chunk); if (!canDoRainSnowIce) return canDoRainSnowIce; int updateLCG1 = this.updateLCG * 3 + 1013904223; int j2 = updateLCG1 >> 2; int j = chunk.x * 16; int k = chunk.z * 16; BlockPos blockpos1 = chunk.getPrecipitationHeight(new BlockPos(j + (j2 & 15), 0, k + (j2 >> 8 & 15))); BlockPos blockpos2 = blockpos1.down(); if (!this.isAreaLoaded(blockpos1, blockpos2)) return false; return canDoRainSnowIce; }

Target:
public boolean redirectProviderCanDoRainSnowIce(WorldProvider provider, Chunk chunk) { boolean canDoRainSnowIce = provider.canDoRainSnowIce(chunk); if (!canDoRainSnowIce) return canDoRainSnowIce; int updateLCG1 = this.updateLCG * 3 + 1013904223; int localXZAddress = updateLCG1 >> 2; int blockX = Coords.localToBlock(chunk.x, Bits.unpackUnsigned(localXZAddress, 4, 0)); int blockZ = Coords.localToBlock(chunk.z, Bits.unpackUnsigned(localXZAddress, 4, 8)); BlockPos blockpos1 = chunk.getPrecipitationHeight(new BlockPos(blockX, 0, blockZ)); BlockPos blockpos2 = blockpos1.down(); if (!this.isAreaLoaded(blockpos1, blockpos2)) return false; return canDoRainSnowIce; }
Source:
private static boolean isWithinExitFunction(RaiseStatement finallyClause) { Tree functionParent = TreeUtils.firstAncestorOfKind(finallyClause, Tree.Kind.FUNCDEF); while (functionParent != null) { FunctionDef functionDef = (FunctionDef) functionParent; if (functionDef.name().name().equals("__exit__")) { return true; } functionParent = TreeUtils.firstAncestorOfKind(functionDef, Tree.Kind.FUNCDEF); } return false; }

Target:
private static boolean isWithinExitFunction(RaiseStatement finallyClause) { return TreeUtils.firstAncestor(finallyClause, t -> t.is(Tree.Kind.FUNCDEF) && ((FunctionDef) t).name().name().equals("__exit__")) != null; }
Source:
public void deleteNonExisting() throws Exception { context.turnOffAuthorisationSystem(); MetadataSchema metadataSchema = MetadataSchemaBuilder.createMetadataSchema(context, "A name", "A namespace") .build(); Integer id = metadataSchema.getID(); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadataschemas/" + id)) .andExpect(status().isNoContent()); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadataschemas/" + id)) .andExpect(status().isNotFound()); }

Target:
public void deleteNonExisting() throws Exception { context.turnOffAuthorisationSystem(); MetadataSchema metadataSchema = MetadataSchemaBuilder.createMetadataSchema(context, "A name", "A namespace") .build(); context.restoreAuthSystemState(); Integer id = metadataSchema.getID(); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadataschemas/" + id)) .andExpect(status().isNoContent()); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadataschemas/" + id)) .andExpect(status().isNotFound()); }
Source:
public void quickRun() { EventManager eventManager = new EventManager(); try { int aEventId = eventManager.createAsync(60); System.out.println("Event [" + aEventId + "] has been created."); eventManager.start(aEventId); System.out.println("Event [" + aEventId + "] has been started."); int sEventId = eventManager.create(60); System.out.println("Event [" + sEventId + "] has been created."); eventManager.start(sEventId); System.out.println("Event [" + sEventId + "] has been started."); eventManager.status(aEventId); eventManager.status(sEventId); eventManager.cancel(aEventId); System.out.println("Event [" + aEventId + "] has been stopped."); eventManager.cancel(sEventId); System.out.println("Event [" + sEventId + "] has been stopped."); } catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException | InvalidOperationException e) { System.out.println(e.getMessage()); } }

Target:
public void quickRun() { EventManager eventManager = new EventManager(); try { int aEventId = eventManager.createAsync(60); System.out.println("Async Event [" + aEventId + "] has been created."); eventManager.start(aEventId); System.out.println("Async Event [" + aEventId + "] has been started."); int sEventId = eventManager.create(60); System.out.println("Sync Event [" + sEventId + "] has been created."); eventManager.start(sEventId); System.out.println("Sync Event [" + sEventId + "] has been started."); eventManager.status(aEventId); eventManager.status(sEventId); eventManager.cancel(aEventId); System.out.println("Async Event [" + aEventId + "] has been stopped."); eventManager.cancel(sEventId); System.out.println("Sync Event [" + sEventId + "] has been stopped."); } catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException | InvalidOperationException e) { System.out.println(e.getMessage()); } }
Source:
public EList<Widget> renderWidget(Widget w, StringBuilder sb) throws RenderException { String snippet = getSnippet("group"); snippet = StringUtils.replace(snippet, "%id%", itemUIRegistry.getWidgetId(w)); snippet = StringUtils.replace(snippet, "%icon%", escapeURLPath(itemUIRegistry.getIcon(w))); snippet = StringUtils.replace(snippet, "%label%", getLabel(w)); String style = ""; String color = itemUIRegistry.getLabelColor(w); if(color != null) style = "color:"+ color; snippet = StringUtils.replace(snippet, "%labelstyle%", style); style = ""; color = itemUIRegistry.getValueColor(w); if(color != null) style = "color:"+ color; snippet = StringUtils.replace(snippet, "%valuestyle%", style); sb.append(snippet); return null; }

Target:
public EList<Widget> renderWidget(Widget w, StringBuilder sb) throws RenderException { String snippet = getSnippet("group"); snippet = StringUtils.replace(snippet, "%id%", itemUIRegistry.getWidgetId(w)); snippet = StringUtils.replace(snippet, "%icon%", escapeURLPath(itemUIRegistry.getIcon(w))); snippet = StringUtils.replace(snippet, "%label%", getLabel(w)); snippet = processColor(w, snippet); sb.append(snippet); return null; }
Source:
private File createLinkTextileMarkup() throws IOException { File markupFile = new File(tempFolder, "link.textile"); PrintWriter writer = new PrintWriter(new FileWriter(markupFile)); try { writer.println("\"intern-label\":#intern-label"); writer.println(); writer.println("\"extern-label\":<LINK_0>"); writer.println(); } finally { writer.close(); } return markupFile; }

Target:
private File createLinkTextileMarkup() throws IOException { File markupFile = new File(tempFolder, "link.textile"); PrintWriter writer = new PrintWriter(new FileWriter(markupFile)); try { writer.println("\"INTERN-LABEL\":#intern_label"); writer.println(); writer.println("\"*INTERN-BOLD-LABEL*\":#intern_bold_label"); writer.println(); writer.println("\"EXTERN-LABEL\":<LINK_0>"); writer.println(); } finally { writer.close(); } return markupFile; }
Source:
protected InstantOperatorInfo getInstantOpInfo() { final InstantOperatorInfo.Builder iOpInfoBuilder = InstantOperatorInfo.newBuilder(); iOpInfoBuilder.setInstantOperatorType(InstantOperatorTypeEnum.AGGREGATE_WINDOW); final List<ByteBuffer> serializedFunctionList = new ArrayList<>(); serializedFunctionList.add(ByteBuffer.wrap(SerializationUtils.serialize(updateStateFunc))); serializedFunctionList.add(ByteBuffer.wrap(SerializationUtils.serialize(produceResultFunc))); iOpInfoBuilder.setFunctions(serializedFunctionList); iOpInfoBuilder.setKeyIndex(null); return iOpInfoBuilder.build(); }

Target:
protected InstantOperatorInfo getInstantOpInfo() { final InstantOperatorInfo.Builder iOpInfoBuilder = InstantOperatorInfo.newBuilder(); iOpInfoBuilder.setInstantOperatorType(InstantOperatorTypeEnum.AGGREGATE_WINDOW); final List<ByteBuffer> serializedFunctionList = new ArrayList<>(); serializedFunctionList.add(ByteBuffer.wrap(SerializationUtils.serialize(updateStateFunc))); serializedFunctionList.add(ByteBuffer.wrap(SerializationUtils.serialize(produceResultFunc))); serializedFunctionList.add(ByteBuffer.wrap(SerializationUtils.serialize(initializeStateSup))); iOpInfoBuilder.setFunctions(serializedFunctionList); iOpInfoBuilder.setKeyIndex(null); return iOpInfoBuilder.build(); }
Source:
private static void validateMaximumValue(String key, WebService.Param definition, String value) { Integer maximumValue = definition.maximumValue(); if (maximumValue == null) { return; } int valueAsInt = parseInt(value); checkArgument(valueAsInt <= maximumValue, "'%s' parameter (value '%s') must be less than %s", key, valueAsInt, maximumValue); }

Target:
private static void validateMaximumValue(String key, WebService.Param definition, String value) { Integer maximumValue = definition.maximumValue(); if (maximumValue == null) { return; } int valueAsInt = validateAsNumeric(key, value); checkArgument(valueAsInt <= maximumValue, "'%s' value (%s) must be less than %s", key, valueAsInt, maximumValue); }
Source:
private void writeMetrics() { if (metrics.size() > 0) { try { String payload = pickleMetrics(metrics); int length = payload.length(); byte[] header = ByteBuffer.allocate(4).putInt(length).array(); socket.getOutputStream().write(header); writer.write(payload); writer.flush(); } catch (Exception e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Error writing to Graphite", e); } else { LOGGER.warn("Error writing to Graphite: {}", e.getMessage()); } } LOGGER.debug("Wrote metrics", metrics.size()); metrics.clear(); } }

Target:
private void writeMetrics() throws IOException { if (metrics.size() > 0) { try { String payload = pickleMetrics(metrics); int length = payload.length(); byte[] header = ByteBuffer.allocate(4).putInt(length).array(); socket.getOutputStream().write(header); writer.write(payload); writer.flush(); LOGGER.debug("Wrote metrics", metrics.size()); } catch (IOException e) { this.failures++; throw e; } finally { metrics.clear(); } } }
Source:
public TileEntity createNewTileEntity(World worldIn, int meta) { if (Loader.isModLoaded("ic2") && PowerSystem.EnergySystem.EU.enabled.get()) { return new TileCableEU(getStateFromMeta(meta).getValue(TYPE)); } else return new TileCable(getStateFromMeta(meta).getValue(TYPE)); }

Target:
public TileEntity createNewTileEntity(World worldIn, int meta) { if (useEUCables && Loader.isModLoaded("ic2") && PowerSystem.EnergySystem.EU.enabled.get()) { return new TileCableEU(getStateFromMeta(meta).getValue(TYPE)); } else return new TileCable(getStateFromMeta(meta).getValue(TYPE)); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); uri = Uri.parse(getString(R.string.website) + "cgi/user.pl"); uri2 = Uri.parse(getString(R.string.website) + "cgi/reset_password.pl"); customTabActivityHelper = new CustomTabActivityHelper(); customTabActivityHelper.setConnectionCallback(this); customTabActivityHelper.mayLaunchUrl(uri, null, null); signup.setEnabled(false); final SharedPreferences settings = getSharedPreferences("login", 0); String loginS = settings.getString("user", getResources().getString(R.string.txt_anonymous)); if(!loginS.equals(getResources().getString(R.string.txt_anonymous))) { new MaterialDialog.Builder(this) .title("Login") .content("Already logged in!") .neutralText(R.string.ok_button) .show(); } apiClient = new Retrofit.Builder() .baseUrl(BuildConfig.HOST) .build() .create(OpenFoodAPIService.class); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); userLoginUri = Uri.parse(getString(R.string.website) + "cgi/user.pl"); resetPasswordUri = Uri.parse(getString(R.string.website) + "cgi/reset_password.pl"); customTabActivityHelper = new CustomTabActivityHelper(); customTabActivityHelper.setConnectionCallback(this); customTabActivityHelper.mayLaunchUrl(userLoginUri, null, null); signup.setEnabled(false); final SharedPreferences settings = getSharedPreferences("login", 0); String loginS = settings.getString("user", getResources().getString(R.string.txt_anonymous)); if(!loginS.equals(getResources().getString(R.string.txt_anonymous))) { new MaterialDialog.Builder(this) .title("Login") .content("Already logged in!") .neutralText(R.string.ok_button) .show(); } apiClient = new Retrofit.Builder() .baseUrl(BuildConfig.HOST) .build() .create(OpenFoodAPIService.class); }
Source:
public ChartRange(BigDecimal minimum, BigDecimal maximum) { BigDecimal subtract = maximum.subtract(minimum); if (BigDecimal.ZERO.equals(subtract)) { fMinimum = minimum; fMaximum = minimum.add(BigDecimal.ONE); fRange = BigDecimal.ONE; } else { fMinimum = minimum; fMaximum = maximum; fRange = checkNotNull(subtract); } }

Target:
public ChartRange(BigDecimal minimum, BigDecimal maximum) { BigDecimal subtract = maximum.subtract(minimum); if (minimum.compareTo(maximum) > 0) { throw new IllegalArgumentException("ChartRange: minimum should be lower than or equal to the maximum (min: " + minimum + ", max: " + maximum + ')'); } if (BigDecimal.ZERO.equals(subtract)) { fMinimum = minimum; fMaximum = minimum.add(BigDecimal.ONE); fRange = BigDecimal.ONE; } else { fMinimum = minimum; fMaximum = maximum; fRange = checkNotNull(subtract); } }
Source:
private String rowToString() { String fields = arguments.stream() .map(ClientTypeSignatureParameter::getNamedTypeSignature) .map(parameter -> { if (parameter.getName().isPresent()) { format("%s %s", parameter.getName().get(), parameter.getTypeSignature().toString()); } return parameter.getTypeSignature().toString(); }) .collect(Collectors.joining(",")); return format("row(%s)", fields); }

Target:
private String rowToString() { String fields = arguments.stream() .map(ClientTypeSignatureParameter::getNamedTypeSignature) .map(parameter -> { if (parameter.getName().isPresent()) { return format("%s %s", parameter.getName().get(), parameter.getTypeSignature().toString()); } return parameter.getTypeSignature().toString(); }) .collect(Collectors.joining(",")); return format("row(%s)", fields); }
Source:
public boolean isWebSocketProxyDefined() { String wsConfig = (String) AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.WebSocketProxy); return wsConfig != null && !"".equals(wsConfig) && !"Off".equals(wsConfig); }

Target:
public boolean isWebSocketProxyDefined() { String wsConfig = (String) AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.WebSocketProxy); return wsConfig != null && !"".equals(wsConfig) && !"Off".equalsIgnoreCase(wsConfig); }
Source:
MethodInvocationTree getTree() { return tree; }

Target:
public MethodInvocationTree getTree() { return tree; }
Source:
public String getAsCommaSeparatedList(final List<String> headers) { Assert.requireNonNull(headers, "headers"); StringBuilder values = new StringBuilder(""); if (null != headers && headers.size() > 0) { for (int i = 0; i < headers.size(); i++) { values.append(headers.get(i)); if (i < headers.size() - 1) { values.append(","); } } } return values.toString(); }

Target:
public String getAsCommaSeparatedList(final List<String> headers) { Assert.requireNonNull(headers, "headers"); StringBuilder values = new StringBuilder(""); if (headers.size() > 0) { for (int i = 0; i < headers.size(); i++) { values.append(headers.get(i)); if (i < headers.size() - 1) { values.append(","); } } } return values.toString(); }
Source:
public void readerOpened(BlockReader reader, BlockStoreLocation location) { Preconditions.checkState(locationValid(location)); mStreamsPerLocation.compute(location, (k, v) -> { Set<Object> streamList = v; if (streamList == null) { streamList = new ConcurrentHashSet<>(); } streamList.add(reader); return streamList; }); }

Target:
public void readerOpened(BlockReader reader, BlockStoreLocation location) { streamOpened(reader, location); }
Source:
public File newFolder(String folder) throws IOException, IllegalArgumentException { return newFolder(new String[]{folder}); }

Target:
public File newFolder(String folder) throws IOException { return newFolder(new String[]{folder}); }
Source:
public JsonNode getSavedSearch(Mediator m, ClientIdentification clid, String searchName, String entity, String version) { LOGGER.debug("Loading {}:{}:{}",searchName,entity,version); ObjectNode doc=null; String loadVersion; if(version==null) { LOGGER.debug("{} version is null, attempting to find default version for entity",entity); EntityMetadata md=m.metadata.getEntityMetadata(entity,null); if(md==null) throw Error.get(CrudConstants.ERR_UNKNOWN_ENTITY,entity+":"+version); loadVersion=md.getVersion().getValue(); LOGGER.debug("Loading {}:{}:{}",searchName,entity,loadVersion); } else { loadVersion=version; } Key key=new Key(searchName,entity,loadVersion); LOGGER.debug("Lookup {}",key); doc=cache.getIfPresent(key); if(doc==null) { key=new Key(searchName,entity,null); LOGGER.debug("Lookup {}",key); doc=cache.getIfPresent(key); } if(doc==null) { LOGGER.debug("Loading from DB",searchName); JsonNode node=retrieveFromDB(m,clid,searchName,entity,loadVersion); if(node instanceof ObjectNode) { LOGGER.debug("Loaded a single search"); doc=(ObjectNode)node; store(doc); } else if(node instanceof ArrayNode) { LOGGER.debug("Loaded an array of searches"); store((ArrayNode)node); doc=findDocForVersion((ArrayNode)node,loadVersion); } if(doc!=null) { store(doc); } } return doc; }

Target:
public JsonNode getSavedSearch(Mediator m, ClientIdentification clid, String searchName, String entity, String version) { LOGGER.debug("Loading {}:{}:{}",searchName,entity,version); ObjectNode doc=null; String loadVersion; if(version==null) { LOGGER.debug("{} version is null, attempting to find default version for entity",entity); EntityMetadata md=m.metadata.getEntityMetadata(entity,null); if(md==null) throw Error.get(CrudConstants.ERR_UNKNOWN_ENTITY,entity+":"+version); loadVersion=md.getVersion().getValue(); LOGGER.debug("Loading {}:{}:{}",searchName,entity,loadVersion); } else { loadVersion=version; } Key key=new Key(searchName,entity,loadVersion); LOGGER.debug("Lookup {}",key); doc=cache.getIfPresent(key); if(doc==null) { key=new Key(searchName,entity,null); LOGGER.debug("Lookup {}",key); doc=cache.getIfPresent(key); } if(doc==null) { LOGGER.debug("Loading from DB",searchName); JsonNode node=getSavedSearchFromDB(m,clid,searchName,entity,loadVersion); if(node instanceof ObjectNode) { LOGGER.debug("Loaded a single search"); doc=(ObjectNode)node; store(doc); } else if(node instanceof ArrayNode) { LOGGER.debug("Loaded an array of searches"); store((ArrayNode)node); doc=findDocForVersion((ArrayNode)node,loadVersion); } if(doc!=null) { store(doc); } } return doc; }
Source:
private StorageManager getCacheBackedDao(IotasConfiguration iotasConfiguration) { StorageProviderConfiguration storageProviderConfiguration = iotasConfiguration.getStorageProviderConfiguration(); final String providerType = storageProviderConfiguration.getType(); final StorageManager dao = providerType.equalsIgnoreCase("jdbc") ? JdbcStorageManager.createStorageManager(storageProviderConfiguration.getProperties()) : new InMemoryStorageManager(); final CacheBuilder cacheBuilder = getGuavaCacheBuilder(); final Cache<StorableKey, Storable> cache = getCache(dao, cacheBuilder); final StorageWriter storageWriter = getStorageWriter(dao); return doGetCacheBackedDao(cache, storageWriter); }

Target:
private StorageManager getCacheBackedDao(IotasConfiguration iotasConfiguration) { StorageProviderConfiguration storageProviderConfiguration = iotasConfiguration.getStorageProviderConfiguration(); final String providerType = storageProviderConfiguration.getType(); final StorageManager dao = providerType.equalsIgnoreCase(JDBC) ? JdbcStorageManager.createStorageManager(storageProviderConfiguration.getProperties()) : new InMemoryStorageManager(); final CacheBuilder cacheBuilder = getGuavaCacheBuilder(); final Cache<StorableKey, Storable> cache = getCache(dao, cacheBuilder); final StorageWriter storageWriter = getStorageWriter(dao); return doGetCacheBackedDao(cache, storageWriter); }
Source:
public void set(TypedHistogram value) { if (value instanceof GroupedTypedHistogram) { if (typedHistogram != null) { size -= typedHistogram.getEstimatedSize(); } typedHistogram = value; } else { throw new IllegalArgumentException(String.format("only class %s supported, passed %s", GroupedTypedHistogram.class, typedHistogram.getClass())); } size += typedHistogram.getEstimatedSize(); }

Target:
public void set(TypedHistogram value) { checkArgument(value instanceof GroupedTypedHistogram, "only class %s supported, passed %s", GroupedTypedHistogram.class, typedHistogram.getClass()); requireNonNull(typedHistogram != null, "this.typedHistogram should always be non-null"); size -= typedHistogram.getEstimatedSize(); size += value.getEstimatedSize(); typedHistogram = value; }
Source:
public void updatePeriodicBinResults(TransactionBase tx, VisibilityBindingSet bs, PeriodicQueryMetadata metadata) throws Exception { Set<Long> binIds = getBinEndTimes(metadata, bs); for(Long id: binIds) { QueryBindingSet binnedBs = new QueryBindingSet(bs); binnedBs.addBinding(IncrementalUpdateConstants.PERIODIC_BIN_ID, vf.createLiteral(id)); VisibilityBindingSet visibilityBindingSet = new VisibilityBindingSet(binnedBs, bs.getVisibility()); Bytes periodicBsBytes = BS_SERDE.serialize(visibilityBindingSet); final Bytes resultRow = getRowKey(metadata.getNodeId(), metadata.getVariableOrder(), visibilityBindingSet); Column col = FluoQueryColumns.PERIODIC_QUERY_BINDING_SET; tx.set(resultRow, col, periodicBsBytes); } }

Target:
public void updatePeriodicBinResults(TransactionBase tx, VisibilityBindingSet bs, PeriodicQueryMetadata metadata) throws Exception { Set<Long> binIds = getBinEndTimes(metadata, bs); for(Long id: binIds) { QueryBindingSet binnedBs = new QueryBindingSet(bs); binnedBs.addBinding(IncrementalUpdateConstants.PERIODIC_BIN_ID, vf.createLiteral(id)); VisibilityBindingSet visibilityBindingSet = new VisibilityBindingSet(binnedBs, bs.getVisibility()); Bytes periodicBsBytes = BS_SERDE.serialize(visibilityBindingSet); final Bytes resultRow = makeRowKey(metadata.getNodeId(), metadata.getVariableOrder(), visibilityBindingSet); Column col = FluoQueryColumns.PERIODIC_QUERY_BINDING_SET; tx.set(resultRow, col, periodicBsBytes); } }
Source:
public ArrayList<PixelWeight> getPixelWeights (Geometry geometry) { return getPixelWeights(geometry, false, null); }

Target:
public List<PixelWeight> getPixelWeights (Geometry geometry) { return getPixelWeights(geometry, false); }
Source:
protected MapSqlParameterSource createFullParametersMapper(Provider<?> entity) { MapSqlParameterSource mapper = createBaseProviderParametersMapper(entity); String tenantName = null; String pluginType = null; if (entity.getAdditionalProperties() != null) { switch (entity.getType()) { case OPENSTACK_NETWORK: OpenstackNetworkProviderProperties networkProperties = (OpenstackNetworkProviderProperties) entity.getAdditionalProperties(); tenantName = networkProperties.getTenantName(); pluginType = networkProperties.getPluginType().name(); break; case OPENSTACK_IMAGE: OpenstackImageProviderProperties imageProperties = (OpenstackImageProviderProperties) entity.getAdditionalProperties(); tenantName = imageProperties.getTenantName(); break; default: break; } } mapper.addValue("tenant_name", tenantName); mapper.addValue("plugin_type", pluginType); return mapper; }

Target:
protected MapSqlParameterSource createFullParametersMapper(Provider<?> entity) { MapSqlParameterSource mapper = createBaseProviderParametersMapper(entity); String tenantName = null; String pluginType = null; if (entity.getAdditionalProperties() != null) { switch (entity.getType()) { case OPENSTACK_NETWORK: OpenstackNetworkProviderProperties networkProperties = (OpenstackNetworkProviderProperties) entity.getAdditionalProperties(); tenantName = networkProperties.getTenantName(); pluginType = networkProperties.getPluginType(); break; case OPENSTACK_IMAGE: OpenstackImageProviderProperties imageProperties = (OpenstackImageProviderProperties) entity.getAdditionalProperties(); tenantName = imageProperties.getTenantName(); break; default: break; } } mapper.addValue("tenant_name", tenantName); mapper.addValue("plugin_type", pluginType); return mapper; }
Source:
public SourceRoot parse(String startPackage, JavaParser javaParser, Callback callback) throws IOException { assertNotNull(startPackage); assertNotNull(javaParser); assertNotNull(callback); Log.info("Parsing package \"%s\"", startPackage); final Path path = packageAbsolutePath(root, startPackage); class AsynchronousParse extends RecursiveAction { private static final long serialVersionUID = 1L; private final Path path; public AsynchronousParse(Path path) { this.path = path; } @Override protected void compute() { final List<AsynchronousParse> walks = new ArrayList<>(); try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (!dir.equals(AsynchronousParse.this.path)) { AsynchronousParse w = new AsynchronousParse(dir); w.fork(); walks.add(w); return FileVisitResult.SKIP_SUBTREE; } else { return FileVisitResult.CONTINUE; } } @Override public FileVisitResult visitFile(Path absolutePath, BasicFileAttributes attrs) throws IOException { if (!attrs.isDirectory() && absolutePath.toString().endsWith(".java")) { Path localPath = root.relativize(absolutePath); Log.trace("Parsing %s", localPath); final ParseResult<CompilationUnit> result = new JavaParser( SourceRoot.this.javaParser.getParserConfiguration()).parse(COMPILATION_UNIT, provider(absolutePath)); result.getResult().ifPresent(cu -> cu.setStorage(absolutePath)); if (callback.process(localPath, absolutePath, result) == SAVE) { if (result.getResult().isPresent()) { save(result.getResult().get(), path); } } } return FileVisitResult.CONTINUE; } }); } catch (IOException e) { Log.error(e); } for (AsynchronousParse w : walks) { w.join(); } } } AsynchronousParse w = new AsynchronousParse(path); ForkJoinPool p = new ForkJoinPool(); p.invoke(w); return this; }

Target:
public SourceRoot parse(String startPackage, JavaParser javaParser, Callback callback) throws IOException { assertNotNull(startPackage); assertNotNull(javaParser); assertNotNull(callback); Log.info("Parsing package \"%s\"", startPackage); final Path path = packageAbsolutePath(root, startPackage); Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path absolutePath, BasicFileAttributes attrs) throws IOException { if (!attrs.isDirectory() && absolutePath.toString().endsWith(".java")) { Path localPath = root.relativize(absolutePath); Log.trace("Parsing %s", localPath); final ParseResult<CompilationUnit> result = javaParser.parse(COMPILATION_UNIT, provider(absolutePath)); result.getResult().ifPresent(cu -> cu.setStorage(absolutePath)); if (callback.process(localPath, absolutePath, result) == SAVE) { if (result.getResult().isPresent()) { save(result.getResult().get(), path); } } } return FileVisitResult.CONTINUE; } }); return this; }
Source:
public Integer getLimit() { return _limit; }

Target:
public Optional<Integer> getLimit() { return _limit; }
Source:
private void copyFileInJarToOutput( JarFile jar, ZipEntry fileInJar ) throws MojoFailureException { String fullPath = fileInJar.getName(); String relativePath = fullPath .substring(fullPath.toLowerCase(Locale.ENGLISH) .indexOf(sourceDirectory.toLowerCase(Locale.ENGLISH)) + sourceDirectory.length()); File target = new File(outputDirectory, relativePath); try { if (target.exists()) { if (clobber) { getLog().info(String.format( "File %s already exists and clobber is set; overwriting.", target.getName() )); File tempFile = File.createTempFile(fullPath, null); FileUtils.copyInputStreamToFile( jar.getInputStream(fileInJar), tempFile ); if (!FileUtils.contentEquals(tempFile, target)) { FileUtils.forceDelete(target); FileUtils.moveFile(tempFile, target); } else { tempFile.delete(); } } else { getLog().info(String.format( "File %s already exists and clobber is not set; skipping.", target.getName() )); } } else { FileUtils.copyInputStreamToFile( jar.getInputStream(fileInJar), target ); } } catch (IOException e) { throw new MojoFailureException( "Failed to copy file " + fileInJar.getName() ); } }

Target:
private void copyFileInJarToOutput( JarFile jar, ZipEntry fileInJar ) throws MojoFailureException { String fullPath = fileInJar.getName(); String relativePath = fullPath .substring(fullPath.toLowerCase(Locale.ENGLISH) .indexOf(sourceDirectory.toLowerCase(Locale.ENGLISH)) + sourceDirectory.length()); File target = new File(outputDirectory, relativePath); try { copyRespectingClobber(jar.getInputStream(fileInJar), target); } catch (IOException e) { throw new MojoFailureException( "Failed to copy file " + fileInJar.getName() ); } }
Source:
public NGuid getStorageDomainId() { List<DiskImage> images = getDiskImageDao().getAllSnapshotsForVmSnapshot(sourceSnapshotId); return (!images.isEmpty()) ? ImagesHandler.getStorageDomainId(images.get(0)) : Guid.Empty; }

Target:
public NGuid getStorageDomainId() { if (storageDomainId == null) { List<DiskImage> images = getDiskImageDao().getAllSnapshotsForVmSnapshot(sourceSnapshotId); storageDomainId = (!images.isEmpty()) ? ImagesHandler.getStorageDomainId(images.get(0)) : Guid.Empty; } return storageDomainId; }
Source:
private void collectPluginCapabilities(Map<String, CapabilityInfo> output) { for (String pluginName : pluginCapabilities.plugins()) { for (Map.Entry<String, Provider<CapabilityDefinition>> entry : pluginCapabilities.byPlugin(pluginName).entrySet()) { if (isPluginNameSane(pluginName)) { String id = String.format("%s-%s", pluginName, entry.getKey()); output.put(id, new CapabilityInfo( id, entry.getValue().get().getDescription())); } else { log.warn(String.format("Plugin name is not sane: <%s> " + "dropping plugin owned capability %s; " + "consider to change the plugin file name.", pluginName, entry.getKey())); } } } }

Target:
private void collectPluginCapabilities(Map<String, CapabilityInfo> output) { for (String pluginName : pluginCapabilities.plugins()) { for (Map.Entry<String, Provider<CapabilityDefinition>> entry : pluginCapabilities.byPlugin(pluginName).entrySet()) { if (isPluginNameSane(pluginName)) { String id = String.format("%s-%s", pluginName, entry.getKey()); output.put(id, new CapabilityInfo( id, entry.getValue().get().getDescription())); } else { log.warn(String.format("Plugin name is not sane: <%s> " + "dropping plugin owned capability %s; " + "consider changing the plugin filename.", pluginName, entry.getKey())); } } } }
Source:
private LogicalNode createCartesianProduct(PlanContext context, LogicalNode left, LogicalNode right) throws TajoException { LogicalPlan plan = context.plan; QueryBlock block = context.queryBlock; Schema merged = SchemaUtil.merge(left.getOutSchema(), right.getOutSchema()); JoinNode join = plan.createNode(JoinNode.class); join.init(JoinType.CROSS, left, right); join.setInSchema(merged); block.addJoinType(join.getJoinType()); EvalNode evalNode; List<String> newlyEvaluatedExprs = new ArrayList<>(); for (Iterator<NamedExpr> it = block.namedExprsMgr.getIteratorForUnevaluatedExprs(); it.hasNext();) { NamedExpr namedExpr = it.next(); try { evalNode = exprAnnotator.createEvalNode(context, namedExpr.getExpr(), NameResolvingMode.LEGACY); if (EvalTreeUtil.findDistinctAggFunction(evalNode).size() == 0 && EvalTreeUtil.findWindowFunction(evalNode).size() == 0) { block.namedExprsMgr.markAsEvaluated(namedExpr.getAlias(), evalNode); newlyEvaluatedExprs.add(namedExpr.getAlias()); } } catch (UndefinedColumnException ve) } List<Target> targets = new ArrayList<>(); targets.addAll(PlannerUtil.schemaToTargets(merged)); for (String newAddedExpr : newlyEvaluatedExprs) { targets.add(block.namedExprsMgr.getTarget(newAddedExpr, true)); } join.setTargets(targets); return join; }

Target:
private LogicalNode createCartesianProduct(PlanContext context, LogicalNode left, LogicalNode right) throws TajoException { LogicalPlan plan = context.plan; QueryBlock block = context.queryBlock; Schema merged = SchemaUtil.merge(left.getOutSchema(), right.getOutSchema()); JoinNode join = plan.createNode(JoinNode.class); join.init(JoinType.CROSS, left, right); join.setInSchema(merged); block.addJoinType(join.getJoinType()); EvalNode evalNode; List<String> newlyEvaluatedExprs = new ArrayList<>(); for (Iterator<NamedExpr> it = block.namedExprsMgr.getIteratorForUnevaluatedExprs(); it.hasNext();) { NamedExpr namedExpr = it.next(); try { evalNode = exprAnnotator.createEvalNode(context, namedExpr.getExpr(), NameResolvingMode.LEGACY); if (EvalTreeUtil.findDistinctAggFunction(evalNode).size() == 0 && EvalTreeUtil.findWindowFunction(evalNode).size() == 0) { block.namedExprsMgr.markAsEvaluated(namedExpr.getAlias(), evalNode); newlyEvaluatedExprs.add(namedExpr.getAlias()); } } catch (UndefinedColumnException ve) } List<Target> targets = new ArrayList<>(PlannerUtil.schemaToTargets(merged)); for (String newAddedExpr : newlyEvaluatedExprs) { targets.add(block.namedExprsMgr.getTarget(newAddedExpr, true)); } join.setTargets(targets); return join; }
Source:
private Obs saveObsNotDirty(Obs obs, String changeMessage) { if(!obs.isObsGrouping()){ return obs; } ObsService os = Context.getObsService(); for (Obs o : obs.getGroupMembers(true)) { if (o.getId() == null) { os.saveObs(o, null); } else { os.saveObs(o, changeMessage); } } Context.refreshEntity(obs); return obs; }

Target:
private Obs saveObsNotDirty(Obs obs, String changeMessage) { if(!obs.isObsGrouping()){ return obs; } ObsService os = Context.getObsService(); boolean refreshNeeded = false; for (Obs o : obs.getGroupMembers(true)) { if (o.getId() == null) { os.saveObs(o, null); } else { Obs newObs = os.saveObs(o, changeMessage); refreshNeeded = !newObs.equals(o) || refreshNeeded; } } if(refreshNeeded) { Context.refreshEntity(obs); } return obs; }
Source:
private void processZoneFile(IngestJobContext context, Content dataSource, AbstractFile zoneFile, Collection<BlackboardArtifact> sourceArtifacts, Collection<BlackboardArtifact> downloadArtifacts, Set<Long> knownPathIDs) throws TskCoreException { ZoneIdentifierInfo zoneInfo = null; try { zoneInfo = new ZoneIdentifierInfo(zoneFile); } catch (IOException ex) { String message = String.format("Unable to parse temporary File for %s", zoneFile.getName()); LOG.log(Level.WARNING, message, ex); } if (zoneInfo == null) { return; } AbstractFile downloadFile = getDownloadFile(dataSource, zoneFile); if (downloadFile != null) { if (!knownPathIDs.contains(downloadFile.getDataSourceObjectId())) { BlackboardArtifact downloadbba = createDownloadArtifact(zoneFile, zoneInfo); if (downloadbba != null) { downloadArtifacts.add(downloadbba); } } if (downloadFile.getArtifactsCount(TSK_DOWNLOAD_SOURCE) == 0) { BlackboardArtifact sourcebba = createDownloadSourceArtifact(downloadFile, zoneInfo); if (sourcebba != null) { sourceArtifacts.add(sourcebba); } } } }

Target:
private void processZoneFile(IngestJobContext context, Content dataSource, AbstractFile zoneFile, Collection<BlackboardArtifact> sourceArtifacts, Collection<BlackboardArtifact> downloadArtifacts, Set<Long> knownPathIDs) throws TskCoreException { ZoneIdentifierInfo zoneInfo = null; try { zoneInfo = new ZoneIdentifierInfo(zoneFile); } catch (IOException ex) { String message = String.format("Unable to parse temporary File for %s", zoneFile.getName()); LOG.log(Level.WARNING, message, ex); } if (zoneInfo == null) { return; } AbstractFile downloadFile = getDownloadFile(dataSource, zoneFile); if (downloadFile != null) { if (!knownPathIDs.contains(downloadFile.getDataSourceObjectId())) { BlackboardArtifact downloadBba = createDownloadArtifact(zoneFile, zoneInfo); if (downloadBba != null) { downloadArtifacts.add(downloadBba); } } if (downloadFile.getArtifactsCount(TSK_DOWNLOAD_SOURCE) == 0) { BlackboardArtifact sourceBba = createDownloadSourceArtifact(downloadFile, zoneInfo); if (sourceBba != null) { sourceArtifacts.add(sourceBba); } } } }
Source:
public String[] getTypeNames() { return typeNames; }

Target:
public String[] getTypeNames() { return Arrays.copyOf(typeNames, typeNames.length); }
Source:
public void givenServerHeaderWithVulnerableAndSafeOpenSSLVersionsThenAlertRaised() throws IOException { String firstVersion = "openssl/1.0.1"; HttpMessage msg = createMsg(String.format("Apache-Coyote/1.1 (%s)", firstVersion)); setServerHeader(msg, String.format("Apache-Coyote/1.1 (%s)", SAFE_OPENSSL_VERSION)); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised.size(), is(1)); assertAlertAttributes(alertsRaised.get(0), firstVersion); }

Target:
public void givenServerHeaderWithVulnerableAndSafeOpenSSLVersionsThenAlertRaised() throws IOException { String vulnerableVersion = "openssl/1.0.1"; HttpMessage msg = createMsg(String.format("Apache-Coyote/1.1 (%s)", vulnerableVersion)); addServerHeader(msg, String.format("Apache-Coyote/1.1 (%s)", SAFE_OPENSSL_VERSION)); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised.size(), is(1)); assertAlertAttributes(alertsRaised.get(0), vulnerableVersion); }
Source:
public void clear() { for (Counter counter : arrays) { int[] array = counter.array; Arrays.fill(array, 0); } offset = 0; }

Target:
public void clear() { for (Counter counter : arrays) { final int[] array = counter.array; Arrays.fill(array, 0); } offset = 0; }
Source:
public static void destroy(Entity e) { if (isManaged(e)) { if (e instanceof Startable) Entities.invokeEffector((EntityLocal)e, e, Startable.STOP); if (e instanceof AbstractEntity) ((AbstractEntity)e).destroy(); unmanage(e); } }

Target:
public static void destroy(Entity e) { if (isManaged(e)) { if (e instanceof Startable) Entities.invokeEffector((EntityLocal)e, e, Startable.STOP).getUnchecked(); if (e instanceof AbstractEntity) ((AbstractEntity)e).destroy(); unmanage(e); } }
Source:
public static ColumnValueSelector makeColumnValueSelectorWithDoubleDefault( final ColumnSelectorFactory metricFactory, final ExprMacroTable macroTable, final String fieldName, final String fieldExpression, final double nullValue ) { if (fieldName != null && fieldExpression == null) { return metricFactory.makeColumnValueSelector(fieldName); } if (fieldName == null && fieldExpression != null) { final Expr expr = Parser.parse(fieldExpression, macroTable); final ColumnValueSelector<ExprEval> baseSelector = ExpressionSelectors.makeExprEvalSelector(metricFactory, expr); class ExpressionDoubleColumnSelector implements DoubleColumnSelector { @Override public double getDouble() { final ExprEval exprEval = baseSelector.getObject(); return exprEval.isNumericNull() ? nullValue : exprEval.asDouble(); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("baseSelector", baseSelector); } @Override public boolean isNull() { final ExprEval exprEval = baseSelector.getObject(); return exprEval == null || exprEval.isNumericNull(); } } return new ExpressionDoubleColumnSelector(); } throw new IllegalArgumentException("Must have a valid, non-null fieldName or expression"); }

Target:
public static BaseDoubleColumnValueSelector makeColumnValueSelectorWithDoubleDefault( final ColumnSelectorFactory metricFactory, final ExprMacroTable macroTable, final String fieldName, final String fieldExpression, final double nullValue ) { if (fieldName != null && fieldExpression == null) { return metricFactory.makeColumnValueSelector(fieldName); } if (fieldName == null && fieldExpression != null) { final Expr expr = Parser.parse(fieldExpression, macroTable); final ColumnValueSelector<ExprEval> baseSelector = ExpressionSelectors.makeExprEvalSelector(metricFactory, expr); class ExpressionDoubleColumnSelector implements DoubleColumnSelector { @Override public double getDouble() { final ExprEval exprEval = baseSelector.getObject(); return exprEval.isNumericNull() ? nullValue : exprEval.asDouble(); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("baseSelector", baseSelector); } @Override public boolean isNull() { final ExprEval exprEval = baseSelector.getObject(); return exprEval == null || exprEval.isNumericNull(); } } return new ExpressionDoubleColumnSelector(); } throw new IllegalArgumentException("Must have a valid, non-null fieldName or expression"); }
Source:
public <T> List<T> getServices(Class<T> clazz) { checkNonNullArgument(clazz, "Service Class instance cannot be null"); try { ServiceReference<?>[] refs = getBundleContext().getServiceReferences(clazz.getName(), null); return Stream.of(refs) .map(r -> getBundleContext().getService(r)) .filter(clazz::isInstance) .map(clazz::cast) .collect(Collectors.toList()); } catch (InvalidSyntaxException e) { throw Exceptions.duck(e); } }

Target:
public <T> List<T> getServices(Class<T> clazz) { requireNonNull(clazz, "Service Class instance cannot be null"); try { ServiceReference[] refs = getBundleContext().getAllServiceReferences(clazz.getName(), null); if (refs == null) { return Collections.emptyList(); } return Stream.of(refs) .map(r -> getBundleContext().getService(r)) .filter(clazz::isInstance) .map(clazz::cast) .collect(Collectors.toList()); } catch (InvalidSyntaxException e) { throw Exceptions.duck(e); } }
Source:
public void registerRequirements(Set<CapabilityReferenceRecorder> requirements) { writeLock.lock(); try { if (requirements == null) { this.requirements = null; } else if (requirements.isEmpty()) { this.requirements = Collections.emptySet(); } else { for (CapabilityReferenceRecorder requirement : requirements) { requirement.setRegistrationAddress(getPathAddress()); } this.requirements = Collections.unmodifiableSet(new HashSet<>(requirements)); } } finally { writeLock.unlock(); } }

Target:
public void registerRequirements(Set<CapabilityReferenceRecorder> requirements) { writeLock.lock(); try { if (requirements == null || requirements.isEmpty()) { this.requirements = Collections.emptySet(); } else { this.requirements = Collections.unmodifiableSet(new HashSet<>(requirements)); } } finally { writeLock.unlock(); } }