| Chunk |
|---|
| Conflicting content |
|---|
import org.slf4j.Logger; import org.slf4j.LoggerFactory; <<<<<<< HEAD ======= import ro.isdc.wro.WroRuntimeException; >>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6 import ro.isdc.wro.config.ReadOnlyContext; import ro.isdc.wro.model.group.Inject; import ro.isdc.wro.model.resource.Resource; |
| Solution content |
|---|
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ro.isdc.wro.config.ReadOnlyContext; import ro.isdc.wro.model.group.Inject; import ro.isdc.wro.model.resource.Resource; |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
import ro.isdc.wro.model.resource.Resource; import ro.isdc.wro.model.resource.ResourceType; import ro.isdc.wro.model.resource.SupportedResourceType; <<<<<<< HEAD import ro.isdc.wro.model.resource.locator.support.UrlResourceLocator; import ro.isdc.wro.model.resource.processor.ResourceProcessor; ======= import ro.isdc.wro.model.resource.locator.UrlUriLocator; import ro.isdc.wro.model.resource.processor.ImportAware; import ro.isdc.wro.model.resource.processor.ResourcePostProcessor; import ro.isdc.wro.model.resource.processor.ResourcePreProcessor; >>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6 import ro.isdc.wro.model.resource.processor.support.DataUriGenerator; import ro.isdc.wro.util.WroUtil; |
| Solution content |
|---|
import ro.isdc.wro.model.resource.Resource; import ro.isdc.wro.model.resource.ResourceType; import ro.isdc.wro.model.resource.SupportedResourceType; import ro.isdc.wro.model.resource.locator.support.UrlResourceLocator; import ro.isdc.wro.model.resource.processor.ResourceProcessor; import ro.isdc.wro.model.resource.processor.support.DataUriGenerator; import ro.isdc.wro.util.WroUtil; |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
/** * A processor responsible for rewriting url's from inside the css resources. <<<<<<< HEAD * ======= * >>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6 * @author Alex Objelean * @created Created on 9 May, 2010 */ |
| Solution content |
|---|
/** * A processor responsible for rewriting url's from inside the css resources. * * @author Alex Objelean * @created Created on 9 May, 2010 */ |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
*/
@SupportedResourceType(ResourceType.CSS)
public abstract class AbstractCssUrlRewritingProcessor
<<<<<<< HEAD
implements ResourceProcessor {
=======
implements ResourcePreProcessor, ResourcePostProcessor, ImportAware {
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
private static final Logger LOG = LoggerFactory.getLogger(AbstractCssUrlRewritingProcessor.class);
/**
* Compiled pattern. |
| Solution content |
|---|
*/
@SupportedResourceType(ResourceType.CSS)
public abstract class AbstractCssUrlRewritingProcessor
implements ResourceProcessor {
private static final Logger LOG = LoggerFactory.getLogger(AbstractCssUrlRewritingProcessor.class);
/**
* Compiled pattern. |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Other |
| Chunk |
|---|
| Conflicting content |
|---|
*
/**
* Compiled pattern.
*/
<<<<<<< HEAD
private static final Pattern PATTERN = Pattern.compile(WroUtil.loadRegexpWithKey("cssUrlRewrite"));
@Inject
private ReadOnlyContext context;
/**
* Parse the css content and transform found url's.
*
=======
private final Pattern PATTERN;
public AbstractCssUrlRewritingProcessor() {
PATTERN = Pattern.compile(getPattern());
}
@Inject
private ReadOnlyContext context;
/**
* {@inheritDoc}
*/
public void process(final Reader reader, final Writer writer)
throws IOException {
throw new WroRuntimeException("This processor: " + getClass().getSimpleName() + " cannot work as a postProcessor!");
}
/**
* Parse the css content and transform found url's.
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
* @param cssContent
* to parse.
* @param cssUri |
| Solution content |
|---|
/**
* Compiled pattern.
*/
private final Pattern PATTERN;
public AbstractCssUrlRewritingProcessor() {
PATTERN = Pattern.compile(getPattern());
}
@Inject
private ReadOnlyContext context;
/**
* Parse the css content and transform found url's.
*
* @param cssContent
* to parse.
* @param cssUri |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Comment |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
final Matcher matcher = PATTERN.matcher(cssContent);
final StringBuffer sb = new StringBuffer();
while (matcher.find()) {
<<<<<<< HEAD
// index of the group containing entire declaration (Ex: background: url(/path/to/image.png);)
final int declarationIndex = 1;
/**
* index of the group containing an url inside a declaration of this form:
*
* |
| Solution content |
|---|
final Matcher matcher = PATTERN.matcher(cssContent);
final StringBuffer sb = new StringBuffer();
while (matcher.find()) {
final int urlIndexA = getUrlIndexA();
final int urlIndexB = getUrlIndexB();
final String originalDeclaration = matcher.group(getDeclarationGroupIndex());
final String groupA = matcher.group(urlIndexA);
final String originalUrl = groupA != null ? groupA : matcher.group(urlIndexB);
LOG.debug("urlGroup: {}", originalUrl);
Validate.notNull(originalUrl);
if (isReplaceNeeded(originalUrl)) {
//the originalUrl is cleaned to be sure that quotes are removed
final String modifiedUrl = replaceImageUrl(cssUri.trim(), cleanImageUrl(originalUrl));
LOG.debug("replaced old Url: [{}] with: [{}].", originalUrl, modifiedUrl);
/** |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
matcher.appendTail(sb);
return sb.toString();
}
<<<<<<< HEAD
=======
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
/**
* {@inheritDoc}
*/ |
| Solution content |
|---|
matcher.appendTail(sb);
return sb.toString();
}
/**
* {@inheritDoc}
*/ |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
*/
public final void process(final Resource resource, final Reader reader, final Writer writer)
throws IOException {
<<<<<<< HEAD
Validate.notNull(resource, "Resource cannot be null! Probably you are using this processor as a Post-Processor and it is intended to be used as a Pre-Processor only!");
=======
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
LOG.debug("Applying {} processor", getClass().getSimpleName());
try {
final String cssUri = resource.getUri(); |
| Solution content |
|---|
*/
public final void process(final Resource resource, final Reader reader, final Writer writer)
throws IOException {
Validate.notNull(resource, "Resource cannot be null! Probably you are using this processor as a Post-Processor and it is intended to be used as a Pre-Processor only!");
LOG.debug("Applying {} processor", getClass().getSimpleName());
try {
final String cssUri = resource.getUri(); |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
writer.close();
}
}
<<<<<<< HEAD
=======
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
/**
* Invoked when the process operation is completed. Useful to invoke some post processing logic or for custom logging.
*/ |
| Solution content |
|---|
writer.close();
}
}
/**
* Invoked when the process operation is completed. Useful to invoke some post processing logic or for custom logging.
*/ |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
**/ protected void onProcessCompleted() { } <<<<<<< HEAD /** * Invoked to replace the entire css declaration. * * An example of css declaration: *
* background: url(/image.png);
* Useful when the css declaration should be changed. The use-case is:
* {@link FallbackCssDataUriProcessor}.
*
=======
/**
* Invoked to replace the entire css declaration.
*
* An example of css declaration:
*
* |
| Solution content |
|---|
* @param originalDeclaration
*/
protected void onProcessCompleted() {
}
/**
* Invoked to replace the entire css declaration.
*
* An example of css declaration:
*
* |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
protected String replaceDeclaration(final String originalDeclaration, final String modifiedDeclaration) {
return modifiedDeclaration;
}
<<<<<<< HEAD
/**
* Invoked when an url is replaced. Useful if you need to do something with newly replaced url.
*
=======
/**
* Invoked when an url is replaced. Useful if you need to do something with newly replaced url.
*
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
* @param replacedUrl
* the newly computed url created as a result of url rewriting.
*/ |
| Solution content |
|---|
protected String replaceDeclaration(final String originalDeclaration, final String modifiedDeclaration) {
return modifiedDeclaration;
}
/**
* Invoked when an url is replaced. Useful if you need to do something with newly replaced url.
*
* @param replacedUrl
* the newly computed url created as a result of url rewriting.
*/ |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
* @param cssUri
*/
protected void onUrlReplaced(final String replacedUrl) {
}
<<<<<<< HEAD
/**
* Replace provided url with the new url if needed.
*
=======
/**
* Replace provided url with the new url if needed.
*
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
* Uri of the parsed css.
* @param imageUrl |
| Solution content |
|---|
*/
protected void onUrlReplaced(final String replacedUrl) {
}
/**
* Replace provided url with the new url if needed.
*
* @param cssUri
* Uri of the parsed css.
* @param imageUrl |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
* @return replaced url. */ protected abstract String replaceImageUrl(final String cssUri, final String imageUrl); <<<<<<< HEAD /** * Cleans the image url by triming result and removing \' or \" characters if such exists. * ======= /** * Cleans the image url by triming result and removing \' or \" characters if such exists. * >>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6 * @param imageUrl * to clean. * @return cleaned image URL. |
| Solution content |
|---|
* @return replaced url. */ protected abstract String replaceImageUrl(final String cssUri, final String imageUrl); /** * Cleans the image url by triming result and removing \' or \" characters if such exists. * * @param imageUrl * to clean. * @return cleaned image URL. |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
protected final String cleanImageUrl(final String imageUrl) {
return imageUrl.replace('\'', ' ').replace('\"', ' ').trim();
}
<<<<<<< HEAD
/**
* Check if url must be replaced or not.
*
=======
/**
* Check if url must be replaced or not. The replacement is not needed if the url of the image is absolute (can be
* resolved by urlResourceLocator) or if the url is a data uri (base64 encoded value).
*
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
* @param url
* to check.
* @return true if url needs to be replaced or remain unchanged. |
| Solution content |
|---|
protected final String cleanImageUrl(final String imageUrl) {
return imageUrl.replace('\'', ' ').replace('\"', ' ').trim();
}
/**
* Check if url must be replaced or not. The replacement is not needed if the url of the image is absolute (can be
* resolved by urlResourceLocator) or if the url is a data uri (base64 encoded value).
*
* @param url
* to check.
* @return true if url needs to be replaced or remain unchanged. |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
/**
* @return true if url needs to be replaced or remain unchanged.
*/
protected boolean isReplaceNeeded(final String url) {
<<<<<<< HEAD
// The replacement is not needed if the url of the image is absolute (can be
// resolved by urlResourceLocator) or if the url is a data uri (base64 encoded value).
return !(DataUriGenerator.isDataUri(url.trim()) || UrlResourceLocator.isValid(url));
}
/**
* This method has protected modifier in order to be accessed by unit test class.
*
=======
return !(UrlUriLocator.isValid(url) || DataUriGenerator.isDataUri(url.trim()));
}
* This method has protected modifier in order to be accessed by unit test class.
*
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
* @return urlPrefix value.
* @VisibleForTesting
*/ |
| Solution content |
|---|
* @return true if url needs to be replaced or remain unchanged.
*/
protected boolean isReplaceNeeded(final String url) {
return !(DataUriGenerator.isDataUri(url.trim()) || UrlResourceLocator.isValid(url));
}
/**
* This method has protected modifier in order to be accessed by unit test class.
*
* @return urlPrefix value.
* @VisibleForTesting
*/ |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Comment |
| Method invocation |
| Return statement |
| Chunk |
|---|
| Conflicting content |
|---|
final String requestURI = context.getRequest().getRequestURI();
return FilenameUtils.getFullPath(requestURI) + getProxyResourcePath();
}
<<<<<<< HEAD
=======
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
/**
* @return the part of the url used to identify a proxy resource.
*/ |
| Solution content |
|---|
final String requestURI = context.getRequest().getRequestURI();
return FilenameUtils.getFullPath(requestURI) + getProxyResourcePath();
}
/**
* @return the part of the url used to identify a proxy resource.
*/ |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
private String getProxyResourcePath() {
return String.format("%s?%s=", PATH_RESOURCES, PARAM_RESOURCE_ID);
}
<<<<<<< HEAD
=======
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
/**
* @param url
* of the resource to check. |
| Solution content |
|---|
private String getProxyResourcePath() {
return String.format("%s?%s=", PATH_RESOURCES, PARAM_RESOURCE_ID);
}
/**
* @param url
* of the resource to check. |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
* {@inheritDoc}
*/
public boolean isImportAware() {
<<<<<<< HEAD
//We want this processor to be applied when processing resources referred with @import directive
return true;
}
=======
// We want this processor to be applied when processing resources referred with @import directive
return true;
}
/**
* @return the string representation of the pattern used to match url's inside the css.
*/
protected String getPattern() {
return WroUtil.loadRegexpWithKey("cssUrlRewrite");
}
/**
* @return index of the group containing entire declaration (Ex: background: url(/path/to/image.png);)
*/
protected int getDeclarationGroupIndex() {
return 0;
}
/**
* index of the group containing an url inside a declaration of this form:
*
* |
| Solution content |
|---|
*/
* {@inheritDoc}
*/
public boolean isImportAware() {
// We want this processor to be applied when processing resources referred with @import directive
return true;
}
/**
* @return the string representation of the pattern used to match url's inside the css.
*/
protected String getPattern() {
return WroUtil.loadRegexpWithKey("cssUrlRewrite");
}
/**
* @return index of the group containing entire declaration (Ex: background: url(/path/to/image.png);)
*/
protected int getDeclarationGroupIndex() {
return 0;
}
/**
* index of the group containing an url inside a declaration of this form:
*
* |
| File |
|---|
| AbstractCssUrlRewritingProcessor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method declaration |
| Return statement |
| Chunk |
|---|
| Conflicting content |
|---|
}
/**
<<<<<<< HEAD
* Creates process responsible for running lessc shell command by reading the file content from the sourceFilePath
=======
* {@inheritDoc}
*/
@Override
public void process(final Reader reader, final Writer writer)
throws IOException {
process(null, reader, writer);
}
/**
* Creates process responsible for running tsc shell command by reading the file content from the sourceFilePath
>>>>>>> fa02d0ea11f24b11ec93c9ca09e74970499ec5b6
*
* @param sourceFile
* the source path of the file from where the tsc will read the typescript file. |
| Solution content |
|---|
} /** * Creates process responsible for running tsc shell command by reading the file content from the sourceFilePath * * @param sourceFile * the source path of the file from where the tsc will read the typescript file. |
| File |
|---|
| TypeScriptProcessor.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |