_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q176800 | AwsUtils.performAmazonActionWithRetry | test | public static <T> T performAmazonActionWithRetry(String actionLabel, Supplier<T> action, int retryLimit, int durationInMillis) {
int retryCount = 0;
do {
try {
return action.get();
} catch (LimitExceededException | ProvisionedThroughputExceededException | KMSThrot... | java | {
"resource": ""
} |
q176801 | AwsUtils.tryAmazonAction | test | public static <T> Optional<T> tryAmazonAction(String actionLabel, Supplier<T> action, AtomicLong durationBetweenRequests) {
try {
return of(action.get());
} catch (LimitExceededException | ProvisionedThroughputExceededException | KMSThrottlingException e) {
int durationRandomModi... | java | {
"resource": ""
} |
q176802 | AwsS3Utils.checkBucketIsAccessible | test | static String checkBucketIsAccessible(AmazonS3 amazonS3, String bucketName) {
HeadBucketRequest headBucketRequest = new HeadBucketRequest(bucketName);
try {
amazonS3.headBucket(headBucketRequest);
} catch (AmazonServiceException e) {
throw new AwsS3Exception("Bucket is no... | java | {
"resource": ""
} |
q176803 | StorePersistence.loadStores | test | Optional<BigInteger> loadStores(Function<String, EntityStores> entityStoresByStoreName,
BiFunction<SerializableSnapshot, String, SerializableSnapshot> snapshotPostProcessor) {
Optional<BigInteger> latestSnapshotTxId;
try {
latestSnapshotTxId = m_snapshotSt... | java | {
"resource": ""
} |
q176804 | DefaultWildcardStreamLocator.triggerWildcardExpander | test | void triggerWildcardExpander(final Collection<File> allFiles, final WildcardContext wildcardContext)
throws IOException {
LOG.debug("wildcard resources: {}", allFiles);
if (allFiles.isEmpty()) {
final String message = String.format("No resource found for wildcard: %s", wildcardContext.getWildcar... | java | {
"resource": ""
} |
q176805 | StringUtils.replace | test | private static String replace(final String inString, final String oldPattern,
final String newPattern) {
if (!hasLength(inString) || !hasLength(oldPattern) || newPattern == null) {
return inString;
}
final StringBuffer sbuf = new StringBuffer();
// output StringBuffer we'll build up
int ... | java | {
"resource": ""
} |
q176806 | StringUtils.deleteAny | test | private static String deleteAny(final String inString,
final String charsToDelete) {
if (!hasLength(inString) || !hasLength(charsToDelete)) {
return inString;
}
final StringBuffer out = new StringBuffer();
for (int i = 0; i < inString.length(); i++) {
final char c = inString.charAt(i);... | java | {
"resource": ""
} |
q176807 | LintReport.addReport | test | public LintReport<T> addReport(final ResourceLintReport<T> resourceLintReport) {
Validate.notNull(resourceLintReport);
reports.add(resourceLintReport);
return this;
} | java | {
"resource": ""
} |
q176808 | ConfigurableWroManagerFactory.updatePropertiesWithConfiguration | test | private void updatePropertiesWithConfiguration(final Properties props, final String key) {
final FilterConfig filterConfig = Context.get().getFilterConfig();
// first, retrieve value from init-param for backward compatibility
final String valuesAsString = filterConfig.getInitParameter(key);
if (valuesAs... | java | {
"resource": ""
} |
q176809 | ConfigurableWroManagerFactory.getConfigProperties | test | private Properties getConfigProperties() {
if (configProperties == null) {
configProperties = newConfigProperties();
if (additionalConfigProperties != null) {
configProperties.putAll(additionalConfigProperties);
}
}
return configProperties;
} | java | {
"resource": ""
} |
q176810 | SmartWroModelFactory.createAutoDetectedStream | test | private InputStream createAutoDetectedStream(final String defaultFileName)
throws IOException {
try {
Validate.notNull(wroFile, "Cannot call this method if wroFile is null!");
if (autoDetectWroFile) {
final File file = new File(wroFile.getParentFile(), defaultFileName);
LOG.d... | java | {
"resource": ""
} |
q176811 | DefaultProcessorProvider.toPostProcessors | test | private Map<String, ResourcePostProcessor> toPostProcessors(
final Map<String, ResourcePreProcessor> preProcessorsMap) {
final Map<String, ResourcePostProcessor> map = new HashMap<String, ResourcePostProcessor>();
for (final Entry<String, ResourcePreProcessor> entry : preProcessorsMap.entrySet()) {
... | java | {
"resource": ""
} |
q176812 | AbstractJsTemplateCompiler.compile | test | public String compile(final String content, final String optionalArgument) {
final RhinoScriptBuilder builder = initScriptBuilder();
final String argStr = createArgStr(optionalArgument) + createArgStr(getArguments());
final String compileScript =
String.format("%s(%s%s);", getCompileCommand(), WroUtil... | java | {
"resource": ""
} |
q176813 | WroConfiguration.reloadCacheWithNewValue | test | private void reloadCacheWithNewValue(final Long newValue) {
final long newValueAsPrimitive = newValue == null ? getCacheUpdatePeriod() : newValue;
LOG.debug("invoking {} listeners", cacheUpdatePeriodListeners.size());
for (final PropertyChangeListener listener : cacheUpdatePeriodListeners) {
final Pro... | java | {
"resource": ""
} |
q176814 | WroConfiguration.reloadModelWithNewValue | test | private void reloadModelWithNewValue(final Long newValue) {
final long newValueAsPrimitive = newValue == null ? getModelUpdatePeriod() : newValue;
for (final PropertyChangeListener listener : modelUpdatePeriodListeners) {
final PropertyChangeEvent event = new PropertyChangeEvent(this, "model", getModelUpd... | java | {
"resource": ""
} |
q176815 | DispatcherStreamLocator.getWrappedServletRequest | test | private ServletRequest getWrappedServletRequest(final HttpServletRequest request, final String location) {
final HttpServletRequest wrappedRequest = new HttpServletRequestWrapper(request) {
@Override
public String getRequestURI() {
return getContextPath() + location;
}
@Overr... | java | {
"resource": ""
} |
q176816 | Transformers.baseNameSuffixTransformer | test | public static Transformer<String> baseNameSuffixTransformer(final String suffix) {
return new Transformer<String>() {
public String transform(final String input) {
final String baseName = FilenameUtils.getBaseName(input);
final String extension = FilenameUtils.getExtension(input);
... | java | {
"resource": ""
} |
q176817 | RedirectedStreamServletResponseWrapper.onError | test | private void onError(final int sc, final String msg) {
LOG.debug("Error detected with code: {} and message: {}", sc, msg);
final OutputStream emptyStream = new ByteArrayOutputStream();
printWriter = new PrintWriter(emptyStream);
servletOutputStream = new DelegatingServletOutputStream(emptyStream);
} | java | {
"resource": ""
} |
q176818 | RedirectedStreamServletResponseWrapper.sendRedirect | test | @Override
public void sendRedirect(final String location)
throws IOException {
try {
LOG.debug("redirecting to: {}", location);
final InputStream is = externalResourceLocator.locate(location);
IOUtils.copy(is, servletOutputStream);
is.close();
servletOutputStream.close();
}... | java | {
"resource": ""
} |
q176819 | WildcardExpanderModelTransformer.processResource | test | private void processResource(final Group group, final Resource resource) {
final UriLocator uriLocator = locatorFactory.getInstance(resource.getUri());
if (uriLocator instanceof WildcardUriLocatorSupport) {
final WildcardStreamLocator wildcardStreamLocator = ((WildcardUriLocatorSupport) uriLocator).getWi... | java | {
"resource": ""
} |
q176820 | WildcardExpanderModelTransformer.createExpanderHandler | test | public Function<Collection<File>, Void> createExpanderHandler(final Group group, final Resource resource,
final String baseNameFolder) {
LOG.debug("createExpanderHandler using baseNameFolder: {}\n for resource {}", baseNameFolder, resource);
return new Function<Collection<File>, Void>() {
public Voi... | java | {
"resource": ""
} |
q176821 | AbstractUriLocatorFactory.locate | test | public final InputStream locate(final String uri)
throws IOException {
final UriLocator uriLocator = getInstance(uri);
if (uriLocator == null) {
throw new WroRuntimeException("No locator is capable of handling uri: " + uri);
}
LOG.debug("[OK] locating {} using locator: {}", uri, uriLocator.get... | java | {
"resource": ""
} |
q176822 | WroFilter.createConfiguration | test | private WroConfiguration createConfiguration() {
// Extract config from servletContext (if already configured)
// TODO use a named helper
final WroConfiguration configAttribute = ServletContextAttributeHelper.create(filterConfig).getWroConfiguration();
if (configAttribute != null) {
setConfigurati... | java | {
"resource": ""
} |
q176823 | WroFilter.registerChangeListeners | test | private void registerChangeListeners() {
wroConfiguration.registerCacheUpdatePeriodChangeListener(new PropertyChangeListener() {
public void propertyChange(final PropertyChangeEvent event) {
// reset cache headers when any property is changed in order to avoid browser caching
headersConfigurer... | java | {
"resource": ""
} |
q176824 | WroFilter.processRequest | test | private void processRequest(final HttpServletRequest request, final HttpServletResponse response)
throws ServletException, IOException {
setResponseHeaders(response);
// process the uri using manager
wroManagerFactory.create().process();
} | java | {
"resource": ""
} |
q176825 | WroFilter.setConfiguration | test | public final void setConfiguration(final WroConfiguration config) {
notNull(config);
wroConfigurationFactory = new ObjectFactory<WroConfiguration>() {
public WroConfiguration create() {
return config;
}
};
} | java | {
"resource": ""
} |
q176826 | WroModel.identifyDuplicateGroupNames | test | private void identifyDuplicateGroupNames(final Collection<Group> groups) {
LOG.debug("identifyDuplicateGroupNames");
final List<String> groupNames = new ArrayList<String>();
for (final Group group : groups) {
if (groupNames.contains(group.getName())) {
throw new WroRuntimeException("Duplicate ... | java | {
"resource": ""
} |
q176827 | WroModel.merge | test | public void merge(final WroModel importedModel) {
Validate.notNull(importedModel, "imported model cannot be null!");
LOG.debug("merging importedModel: {}", importedModel);
for (final String groupName : new WroModelInspector(importedModel).getGroupNames()) {
if (new WroModelInspector(this).getGroupName... | java | {
"resource": ""
} |
q176828 | InjectableUriLocatorFactoryDecorator.locate | test | public InputStream locate(final String uri)
throws IOException {
final UriLocator locator = getInstance(uri);
if (locator == null) {
return getDecoratedObject().locate(uri);
}
return locator.locate(uri);
} | java | {
"resource": ""
} |
q176829 | GroupsProcessor.applyPostProcessors | test | private String applyPostProcessors(final CacheKey cacheKey, final String content)
throws IOException {
final Collection<ResourcePostProcessor> processors = processorsFactory.getPostProcessors();
LOG.debug("appying post processors: {}", processors);
if (processors.isEmpty()) {
return content;
... | java | {
"resource": ""
} |
q176830 | GroupsProcessor.decorateProcessor | test | private synchronized ProcessorDecorator decorateProcessor(final ResourcePostProcessor processor,
final boolean minimize) {
final ProcessorDecorator decorated = new DefaultProcessorDecorator(processor, minimize) {
@Override
public void process(final Resource resource, final Reader reader, final Wri... | java | {
"resource": ""
} |
q176831 | AbstractProcessorsFilter.doProcess | test | private void doProcess(final String requestUri, final Reader reader, final Writer writer)
throws IOException {
Reader input = reader;
Writer output = null;
LOG.debug("processing resource: {}", requestUri);
try {
final StopWatch stopWatch = new StopWatch();
final Injector injector = Inj... | java | {
"resource": ""
} |
q176832 | OptionsBuilder.splitOptions | test | public String[] splitOptions(final String optionAsString) {
return optionAsString == null ? ArrayUtils.EMPTY_STRING_ARRAY : optionAsString.split("(?ims),(?![^\\[\\]]*\\])");
} | java | {
"resource": ""
} |
q176833 | RegexpProperties.load | test | public Properties load(final InputStream inputStream) throws IOException {
Validate.notNull(inputStream);
final String rawContent = IOUtils.toString(inputStream, CharEncoding.UTF_8);
parseProperties(rawContent.replaceAll(REGEX_COMMENTS, ""));
return this.properties;
} | java | {
"resource": ""
} |
q176834 | RegexpProperties.parseProperties | test | private void parseProperties(final String propertiesAsString) {
//should work also \r?\n
final String[] propertyEntries = propertiesAsString.split("\\r?\\n");
for (final String entry : propertyEntries) {
readPropertyEntry(entry);
}
} | java | {
"resource": ""
} |
q176835 | AbstractWro4jMojo.createCustomManagerFactory | test | private WroManagerFactory createCustomManagerFactory()
throws MojoExecutionException {
WroManagerFactory factory = null;
try {
final Class<?> wroManagerFactoryClass = Thread.currentThread().getContextClassLoader().loadClass(
wroManagerFactory.trim());
factory = (WroManagerFactory) wr... | java | {
"resource": ""
} |
q176836 | AbstractWro4jMojo.persistResourceFingerprints | test | private void persistResourceFingerprints(final List<String> groupNames) {
final WroModelInspector modelInspector = new WroModelInspector(getModel());
for (final String groupName : groupNames) {
final Group group = modelInspector.getGroupByName(groupName);
if (group != null) {
for (final Reso... | java | {
"resource": ""
} |
q176837 | AbstractWro4jMojo.isTargetGroup | test | private boolean isTargetGroup(final Group group) {
notNull(group);
final String targetGroups = getTargetGroups();
// null, means all groups are target groups
return targetGroups == null || targetGroups.contains(group.getName());
} | java | {
"resource": ""
} |
q176838 | AbstractWro4jMojo.extendPluginClasspath | test | protected final void extendPluginClasspath()
throws MojoExecutionException {
// this code is inspired from http://teleal.org/weblog/Extending%20the%20Maven%20plugin%20classpath.html
final List<String> classpathElements = new ArrayList<String>();
try {
classpathElements.addAll(mavenProject.getRun... | java | {
"resource": ""
} |
q176839 | AbstractWroModelFactory.getModelResourceAsStream | test | protected InputStream getModelResourceAsStream()
throws IOException {
final ServletContext servletContext = context.getServletContext();
// Don't allow NPE, throw a more detailed exception
if (servletContext == null) {
throw new WroRuntimeException(
"No servletContext is availabl... | java | {
"resource": ""
} |
q176840 | DefaultWroManagerFactory.initFactory | test | private WroManagerFactory initFactory(final Properties properties) {
WroManagerFactory factory = null;
final String wroManagerClassName = properties.getProperty(ConfigConstants.managerFactoryClassName.name());
if (StringUtils.isEmpty(wroManagerClassName)) {
// If no context param was specified we retu... | java | {
"resource": ""
} |
q176841 | ModelTransformerFactory.setTransformers | test | public ModelTransformerFactory setTransformers(final List<Transformer<WroModel>> modelTransformers) {
Validate.notNull(modelTransformers);
this.modelTransformers = modelTransformers;
return this;
} | java | {
"resource": ""
} |
q176842 | EmberJs.compile | test | @Override
public String compile(final String content, final String name) {
final String precompiledFunction = super.compile(content, "");
return String.format("(function() {Ember.TEMPLATES[%s] = Ember.Handlebars.template(%s)})();", name, precompiledFunction);
} | java | {
"resource": ""
} |
q176843 | PreProcessorExecutor.processAndMerge | test | public String processAndMerge(final List<Resource> resources, final boolean minimize)
throws IOException {
return processAndMerge(resources, ProcessingCriteria.create(ProcessingType.ALL, minimize));
} | java | {
"resource": ""
} |
q176844 | PreProcessorExecutor.processAndMerge | test | public String processAndMerge(final List<Resource> resources, final ProcessingCriteria criteria)
throws IOException {
notNull(criteria);
LOG.debug("criteria: {}", criteria);
callbackRegistry.onBeforeMerge();
try {
notNull(resources);
LOG.debug("process and merge resources: {}", resourc... | java | {
"resource": ""
} |
q176845 | PreProcessorExecutor.runInParallel | test | private String runInParallel(final List<Resource> resources, final ProcessingCriteria criteria)
throws IOException {
LOG.debug("Running preProcessing in Parallel");
final StringBuffer result = new StringBuffer();
final List<Callable<String>> callables = new ArrayList<Callable<String>>();
for (fina... | java | {
"resource": ""
} |
q176846 | PreProcessorExecutor.applyPreProcessors | test | private String applyPreProcessors(final Resource resource, final ProcessingCriteria criteria)
throws IOException {
final Collection<ResourcePreProcessor> processors = processorsFactory.getPreProcessors();
LOG.debug("applying preProcessors: {}", processors);
String resourceContent = null;
try {
... | java | {
"resource": ""
} |
q176847 | PreProcessorExecutor.decoratePreProcessor | test | private synchronized ResourcePreProcessor decoratePreProcessor(final ResourcePreProcessor processor,
final ProcessingCriteria criteria) {
final ResourcePreProcessor decorated = new DefaultProcessorDecorator(processor, criteria) {
@Override
public void process(final Resource resource, final Reader ... | java | {
"resource": ""
} |
q176848 | BuildContextHolder.persist | test | public void persist() {
OutputStream os = null;
try {
os = new FileOutputStream(fallbackStorageFile);
fallbackStorage.store(os, "Generated");
LOG.debug("fallback storage written to {}", fallbackStorageFile);
} catch (final IOException e) {
LOG.warn("Cannot persist fallback storage: {... | java | {
"resource": ""
} |
q176849 | Injector.getAllFields | test | private Collection<Field> getAllFields(final Object object) {
final Collection<Field> fields = new ArrayList<Field>();
fields.addAll(Arrays.asList(object.getClass().getDeclaredFields()));
// inspect super classes
Class<?> superClass = object.getClass().getSuperclass();
while (superClass != null... | java | {
"resource": ""
} |
q176850 | ImageUrlRewriter.rewrite | test | public String rewrite(final String cssUri, final String imageUrl) {
notNull(cssUri);
notNull(imageUrl);
if (StringUtils.isEmpty(imageUrl)) {
return imageUrl;
}
if (ServletContextUriLocator.isValid(cssUri)) {
if (ServletContextUriLocator.isValid(imageUrl)) {
return prependContext... | java | {
"resource": ""
} |
q176851 | ImageUrlRewriter.computeNewImageLocation | test | private String computeNewImageLocation(final String cssUri, final String imageUrl) {
LOG.debug("cssUri: {}, imageUrl {}", cssUri, imageUrl);
final String cleanImageUrl = cleanImageUrl(imageUrl);
// TODO move to ServletContextUriLocator as a helper method?
// for the following input: /a/b/c/1.css => /a/b... | java | {
"resource": ""
} |
q176852 | BaseWroManagerFactory.addModelTransformer | test | public BaseWroManagerFactory addModelTransformer(final Transformer<WroModel> modelTransformer) {
if (modelTransformers == null) {
modelTransformers = new ArrayList<Transformer<WroModel>>();
}
this.modelTransformers.add(modelTransformer);
return this;
} | java | {
"resource": ""
} |
q176853 | ResourceBundleProcessor.serveProcessedBundle | test | public void serveProcessedBundle()
throws IOException {
final WroConfiguration configuration = context.getConfig();
final HttpServletRequest request = context.getRequest();
final HttpServletResponse response = context.getResponse();
OutputStream os = null;
try {
final CacheKey cacheKey... | java | {
"resource": ""
} |
q176854 | ResourceBundleProcessor.initAggregatedFolderPath | test | private void initAggregatedFolderPath(final HttpServletRequest request, final ResourceType type) {
if (ResourceType.CSS == type && context.getAggregatedFolderPath() == null) {
final String requestUri = request.getRequestURI();
final String cssFolder = StringUtils.removeEnd(requestUri, FilenameUtils.getN... | java | {
"resource": ""
} |
q176855 | CssVariablesProcessor.extractVariables | test | private Map<String, String> extractVariables(final String variablesBody) {
final Map<String, String> map = new HashMap<String, String>();
final Matcher m = PATTERN_VARIABLES_BODY.matcher(variablesBody);
LOG.debug("parsing variables body");
while (m.find()) {
final String key = m.group(1);
... | java | {
"resource": ""
} |
q176856 | CssVariablesProcessor.parseCss | test | private String parseCss(final String css) {
// map containing variables & their values
final Map<String, String> map = new HashMap<String, String>();
final StringBuffer sb = new StringBuffer();
final Matcher m = PATTERN_VARIABLES_DEFINITION.matcher(css);
while (m.find()) {
final String v... | java | {
"resource": ""
} |
q176857 | CssVariablesProcessor.replaceVariables | test | private String replaceVariables(final String css, final Map<String, String> variables) {
final StringBuffer sb = new StringBuffer();
final Matcher m = PATTERN_VARIABLE_HOLDER.matcher(css);
while (m.find()) {
final String oldMatch = m.group();
final String variableName = m.group(1);
f... | java | {
"resource": ""
} |
q176858 | ProcessorDecorator.toPreProcessor | test | private static ResourcePreProcessor toPreProcessor(final ResourcePostProcessor postProcessor) {
return new AbstractProcessorDecoratorSupport<ResourcePostProcessor>(postProcessor) {
public void process(final Resource resource, final Reader reader, final Writer writer)
throws IOException {
pos... | java | {
"resource": ""
} |
q176859 | ProcessorDecorator.isEligible | test | public final boolean isEligible(final boolean minimize, final ResourceType searchedType) {
Validate.notNull(searchedType);
final SupportedResourceType supportedType = getSupportedResourceType();
final boolean isTypeSatisfied = supportedType == null
|| (supportedType != null && searchedType == suppo... | java | {
"resource": ""
} |
q176860 | GzipFilter.doGzipResponse | test | private void doGzipResponse(final HttpServletRequest req, final HttpServletResponse response, final FilterChain chain)
throws IOException, ServletException {
LOG.debug("Applying gzip on resource: " + req.getRequestURI());
response.setHeader(HttpHeader.CONTENT_ENCODING.toString(), "gzip");
final ByteAr... | java | {
"resource": ""
} |
q176861 | PathPatternProcessorDecorator.include | test | public static PathPatternProcessorDecorator include(final Object processor, final String... patterns) {
return new PathPatternProcessorDecorator(processor, true, patterns);
} | java | {
"resource": ""
} |
q176862 | PathPatternProcessorDecorator.exclude | test | public static PathPatternProcessorDecorator exclude(final Object processor, final String... patterns) {
return new PathPatternProcessorDecorator(processor, false, patterns);
} | java | {
"resource": ""
} |
q176863 | ResourceChangeHandler.create | test | public static ResourceChangeHandler create(final WroManagerFactory managerFactory, final Log log) {
notNull(managerFactory, "WroManagerFactory was not set");
notNull(log, "Log was not set");
return new ResourceChangeHandler().setManagerFactory(managerFactory).setLog(log);
} | java | {
"resource": ""
} |
q176864 | ResourceChangeHandler.remember | test | public void remember(final Resource resource) {
final WroManager manager = getManagerFactory().create();
final HashStrategy hashStrategy = manager.getHashStrategy();
final UriLocatorFactory locatorFactory = manager.getUriLocatorFactory();
if (rememberedSet.contains(resource.getUri())) {
// only c... | java | {
"resource": ""
} |
q176865 | ResourceChangeHandler.forEachCssImportApply | test | private void forEachCssImportApply(final Function<String, ChangeStatus> func, final Resource resource, final Reader reader)
throws IOException {
final ResourcePreProcessor processor = createCssImportProcessor(func);
InjectorBuilder.create(getManagerFactory()).build().inject(processor);
processor.proce... | java | {
"resource": ""
} |
q176866 | ResourceLintReport.filter | test | private List<T> filter(final Collection<T> collection) {
final List<T> nullFreeList = new ArrayList<T>();
if (collection != null) {
for (final T item : collection) {
if (item != null) {
nullFreeList.add(item);
}
}
}
return nullFreeList;
} | java | {
"resource": ""
} |
q176867 | DefaultGroupExtractor.isMinimized | test | public boolean isMinimized(final HttpServletRequest request) {
Validate.notNull(request);
final String minimizeAsString = request.getParameter(PARAM_MINIMIZE);
return !(Context.get().getConfig().isDebug() && "false".equalsIgnoreCase(minimizeAsString));
} | java | {
"resource": ""
} |
q176868 | AbstractCssImportPreProcessor.findImportedResources | test | private List<Resource> findImportedResources(final String resourceUri, final String cssContent)
throws IOException {
// it should be sorted
final List<Resource> imports = new ArrayList<Resource>();
final String css = cssContent;
final List<String> foundImports = findImports(css);
for (final Stri... | java | {
"resource": ""
} |
q176869 | AbstractCssImportPreProcessor.computeAbsoluteUrl | test | private String computeAbsoluteUrl(final String relativeResourceUri, final String importUrl) {
final String folder = WroUtil.getFullPath(relativeResourceUri);
// remove '../' & normalize the path.
return StringUtils.cleanPath(folder + importUrl);
} | java | {
"resource": ""
} |
q176870 | AbstractConfigurableMultipleStrategy.createItemsAsString | test | public static String createItemsAsString(final String... items) {
final StringBuffer sb = new StringBuffer();
for (int i = 0; i < items.length; i++) {
sb.append(items[i]);
if (i < items.length - 1) {
sb.append(TOKEN_DELIMITER);
}
}
return sb.toString();
} | java | {
"resource": ""
} |
q176871 | AbstractConfigurableMultipleStrategy.getAliasList | test | private List<String> getAliasList(final String aliasCsv) {
LOG.debug("configured aliases: {}", aliasCsv);
final List<String> list = new ArrayList<String>();
if (!StringUtils.isEmpty(aliasCsv)) {
final String[] tokens = aliasCsv.split(TOKEN_DELIMITER);
for (final String token : tokens) {
... | java | {
"resource": ""
} |
q176872 | RhinoScriptBuilder.createContext | test | private ScriptableObject createContext(final ScriptableObject initialScope) {
final Context context = getContext();
context.setOptimizationLevel(-1);
// TODO redirect errors from System.err to LOG.error()
context.setErrorReporter(new ToolErrorReporter(false));
context.setLanguageVersion(Context... | java | {
"resource": ""
} |
q176873 | RhinoScriptBuilder.evaluate | test | public Object evaluate(final Reader reader, final String sourceName)
throws IOException {
notNull(reader);
try {
return evaluate(IOUtils.toString(reader), sourceName);
} finally {
reader.close();
}
} | java | {
"resource": ""
} |
q176874 | RhinoScriptBuilder.evaluate | test | public Object evaluate(final String script, final String sourceName) {
notNull(script);
// make sure we have a context associated with current thread
try {
return getContext().evaluateString(scope, script, sourceName, 1, null);
} catch (final RhinoException e) {
final String message = ... | java | {
"resource": ""
} |
q176875 | WroManager.process | test | public final void process()
throws IOException {
// reschedule cache & model updates
final WroConfiguration config = Context.get().getConfig();
cacheSchedulerHelper.scheduleWithPeriod(config.getCacheUpdatePeriod());
modelSchedulerHelper.scheduleWithPeriod(config.getModelUpdatePeriod());
resour... | java | {
"resource": ""
} |
q176876 | ResourceWatcherRequestHandler.isHandlerRequest | test | private boolean isHandlerRequest(final HttpServletRequest request) {
String apiHandlerValue = request.getParameter(PATH_API);
return PATH_HANDLER.equals(apiHandlerValue) && retrieveCacheKey(request) != null;
} | java | {
"resource": ""
} |
q176877 | ResourceWatcherRequestHandler.createHandlerRequestPath | test | public static String createHandlerRequestPath(final CacheKey cacheKey, final HttpServletRequest request) {
final String handlerQueryPath = getRequestHandlerPath(cacheKey.getGroupName(), cacheKey.getType());
return request.getServletPath() + handlerQueryPath;
} | java | {
"resource": ""
} |
q176878 | Wro4jMojo.rename | test | private String rename(final String group, final InputStream input)
throws Exception {
try {
final String newName = getManagerFactory().create().getNamingStrategy().rename(group, input);
groupNames.setProperty(group, newName);
return newName;
} catch (final IOException e) {
throw ne... | java | {
"resource": ""
} |
q176879 | Wro4jMojo.computeDestinationFolder | test | private File computeDestinationFolder(final ResourceType resourceType)
throws MojoExecutionException {
File folder = destinationFolder;
if (resourceType == ResourceType.JS) {
if (jsDestinationFolder != null) {
folder = jsDestinationFolder;
}
}
if (resourceType == ResourceType.C... | java | {
"resource": ""
} |
q176880 | Wro4jMojo.processGroup | test | private void processGroup(final String group, final File parentFoder)
throws Exception {
ByteArrayOutputStream resultOutputStream = null;
InputStream resultInputStream = null;
try {
getLog().info("processing group: " + group);
// mock request
final HttpServletRequest request = Mocki... | java | {
"resource": ""
} |
q176881 | ResourceChangeDetector.checkChangeForGroup | test | public boolean checkChangeForGroup(final String uri, final String groupName) throws IOException {
notNull(uri);
notNull(groupName);
LOG.debug("group={}, uri={}", groupName, uri);
final ResourceChangeInfo resourceInfo = changeInfoMap.get(uri);
if (resourceInfo.isCheckRequiredForGroup(groupName)) {
... | java | {
"resource": ""
} |
q176882 | StandaloneServletContextUriLocator.locate | test | @Override
public InputStream locate(final String uri)
throws IOException {
validState(standaloneContext != null, "Locator was not initialized properly. StandaloneContext missing.");
Exception lastException = null;
final String[] contextFolders = standaloneContext.getContextFolders();
for(final ... | java | {
"resource": ""
} |
q176883 | ObjectPoolHelper.createObjectPool | test | private GenericObjectPool<T> createObjectPool(final ObjectFactory<T> objectFactory) {
final GenericObjectPool<T> pool = newObjectPool(objectFactory);
notNull(pool);
return pool;
} | java | {
"resource": ""
} |
q176884 | JarWildcardStreamLocator.locateStream | test | @Override
public InputStream locateStream(final String uri, final File folder)
throws IOException {
notNull(folder);
final File jarPath = getJarFile(folder);
if (isSupported(jarPath)) {
return locateStreamFromJar(uri, jarPath);
}
return super.locateStream(uri, folder);
} | java | {
"resource": ""
} |
q176885 | JarWildcardStreamLocator.open | test | JarFile open(final File jarFile) throws IOException {
isTrue(jarFile.exists(), "The JAR file must exists.");
return new JarFile(jarFile);
} | java | {
"resource": ""
} |
q176886 | WebjarsUriLocator.extractPath | test | private String extractPath(final String uri) {
return DefaultWildcardStreamLocator.stripQueryPath(uri.replace(PREFIX, StringUtils.EMPTY));
} | java | {
"resource": ""
} |
q176887 | DefaultCacheKeyFactory.isMinimized | test | private boolean isMinimized(final HttpServletRequest request) {
return context.getConfig().isMinimizeEnabled() ? groupExtractor.isMinimized(request) : false;
} | java | {
"resource": ""
} |
q176888 | SimpleUriLocatorFactory.addLocator | test | public final SimpleUriLocatorFactory addLocator(final UriLocator... locators) {
for (final UriLocator locator : locators) {
uriLocators.add(locator);
}
return this;
} | java | {
"resource": ""
} |
q176889 | DefaultWroModelFactoryDecorator.decorate | test | public static WroModelFactory decorate(final WroModelFactory decorated,
final List<Transformer<WroModel>> modelTransformers) {
return decorated instanceof DefaultWroModelFactoryDecorator ? decorated : new DefaultWroModelFactoryDecorator(
decorated, modelTransformers);
} | java | {
"resource": ""
} |
q176890 | RubySassEngine.addRequire | test | public void addRequire(final String require) {
if (require != null && require.trim().length() > 0) {
requires.add(require.trim());
}
} | java | {
"resource": ""
} |
q176891 | RubySassEngine.process | test | public String process(final String content) {
if (isEmpty(content)) {
return StringUtils.EMPTY;
}
try {
synchronized(this) {
return engineInitializer.get().eval(buildUpdateScript(content)).toString();
}
} catch (final ScriptException e) {
throw new WroRuntimeException(e.g... | java | {
"resource": ""
} |
q176892 | ProgressIndicator.logSummary | test | public void logSummary() {
final String message = totalFoundErrors == 0 ? "No lint errors found." : String.format(
"Found %s errors in %s files.", totalFoundErrors, totalResourcesWithErrors);
log.info("----------------------------------------");
log.info(String.format("Total resources: %s", totalRes... | java | {
"resource": ""
} |
q176893 | ProgressIndicator.onProcessingResource | test | public synchronized void onProcessingResource(final Resource resource) {
totalResources++;
log.debug("processing resource: " + resource.getUri());
if (isLogRequired()) {
log.info("Processed until now: " + getTotalResources() + ". Last processed: " + resource.getUri());
updateLastInvocation();
... | java | {
"resource": ""
} |
q176894 | AbstractSynchronizedCacheStrategyDecorator.getLockForKey | test | private ReadWriteLock getLockForKey(final K key) {
final ReadWriteLock lock = locks.putIfAbsent(key, new ReentrantReadWriteLock());
return lock == null ? locks.get(key) : lock;
} | java | {
"resource": ""
} |
q176895 | NodeLessCssProcessor.createProcess | test | private Process createProcess(final File sourceFile)
throws IOException {
notNull(sourceFile);
final String[] commandLine = getCommandLine(sourceFile.getPath());
LOG.debug("CommandLine arguments: {}", Arrays.asList(commandLine));
return new ProcessBuilder(commandLine).redirectErrorStream(true).sta... | java | {
"resource": ""
} |
q176896 | Selector.parseProperties | test | private Property[] parseProperties(final String contents) {
final String[] parts = contents.split(";");
final List<Property> resultsAsList = new ArrayList<Property>();
for (String part : parts) {
try {
// ignore empty parts
if (!StringUtils.isEmpty(part.trim())) {
... | java | {
"resource": ""
} |
q176897 | StopWatch.getTaskInfo | test | public TaskInfo[] getTaskInfo() {
if (!this.keepTaskList) {
throw new UnsupportedOperationException("Task info is not being kept!");
}
return (TaskInfo[])this.taskList.toArray(new TaskInfo[this.taskList.size()]);
} | java | {
"resource": ""
} |
q176898 | TypeScriptCompiler.getCompilationCommand | test | private String getCompilationCommand(final String input) {
return String.format("compilerWrapper.compile(%s, %s)", WroUtil.toJSMultiLineString(input),
ecmaScriptVersion);
} | java | {
"resource": ""
} |
q176899 | ResponseHeadersConfigurer.parseHeader | test | private void parseHeader(final String header) {
LOG.debug("parseHeader: {}", header);
final String headerName = header.substring(0, header.indexOf(":"));
if (!headersMap.containsKey(headerName)) {
final String value = header.substring(header.indexOf(":") + 1);
headersMap.put(headerName, StringUt... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.