id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
8,401
public void appends_0em1_1e0_2e1_3e2_4e3_5e4_0e5_non_idempotent() { final String stream = generateStreamName(); List<EventData> events = range(0, 6).mapToObj(i -> newTestEvent()).collect(toList()); TransactionalWriter writer = newTransactionalWriter(stream); assertEquals(5, writer.startTransaction(ExpectedVersion.of(-1)).write(events).commit().nextExpectedVersion); <BUG>assertEquals(6, writer.startTransaction(ExpectedVersion.of(5)).write(asList(events.get(0))).commit().nextExpectedVersion); assertEquals(events.size() + 1, size(stream));</BUG> } @Test public void appends_0em1_1e0_2e1_3e2_4e3_5e4_0e6_wev() {
assertEquals(6, writer.startTransaction(ExpectedVersion.of(5)).write(events.get(0)).commit().nextExpectedVersion); assertEquals(events.size() + 1, size(stream));
8,402
public void appends_0em1_0e0_non_idempotent() { final String stream = generateStreamName(); List<EventData> events = range(0, 1).mapToObj(i -> newTestEvent()).collect(toList()); TransactionalWriter writer = newTransactionalWriter(stream); assertEquals(0, writer.startTransaction(ExpectedVersion.of(-1)).write(events).commit().nextExpectedVersion); <BUG>assertEquals(1, writer.startTransaction(ExpectedVersion.of(0)).write(asList(events.get(0))).commit().nextExpectedVersion); assertEquals(events.size() + 1, size(stream));</BUG> } @Test public void appends_0em1_0any_idempotent() {
assertEquals(1, writer.startTransaction(ExpectedVersion.of(0)).write(events.get(0)).commit().nextExpectedVersion); assertEquals(events.size() + 1, size(stream));
8,403
public void appends_0em1_0any_idempotent() { final String stream = generateStreamName(); List<EventData> events = range(0, 1).mapToObj(i -> newTestEvent()).collect(toList()); TransactionalWriter writer = newTransactionalWriter(stream); assertEquals(0, writer.startTransaction(ExpectedVersion.of(-1)).write(events).commit().nextExpectedVersion); <BUG>assertEquals(0, writer.startTransaction(ExpectedVersion.any()).write(asList(events.get(0))).commit().nextExpectedVersion); assertEquals(events.size(), size(stream));</BUG> } @Test public void appends_0em1_0em1_idempotent() {
assertEquals(0, writer.startTransaction(ExpectedVersion.any()).write(events.get(0)).commit().nextExpectedVersion); assertEquals(events.size(), size(stream));
8,404
public void appends_0em1_0em1_idempotent() { final String stream = generateStreamName(); List<EventData> events = range(0, 1).mapToObj(i -> newTestEvent()).collect(toList()); TransactionalWriter writer = newTransactionalWriter(stream); assertEquals(0, writer.startTransaction(ExpectedVersion.of(-1)).write(events).commit().nextExpectedVersion); <BUG>assertEquals(0, writer.startTransaction(ExpectedVersion.of(-1)).write(asList(events.get(0))).commit().nextExpectedVersion); assertEquals(events.size(), size(stream));</BUG> } @Test public void appends_0em1_1e0_2e1_1any_1any_idempotent() {
assertEquals(0, writer.startTransaction(ExpectedVersion.of(-1)).write(events.get(0)).commit().nextExpectedVersion); assertEquals(events.size(), size(stream));
8,405
final String stream = generateStreamName(); List<EventData> events = range(0, 3).mapToObj(i -> newTestEvent()).collect(toList()); TransactionalWriter writer = newTransactionalWriter(stream); assertEquals(2, writer.startTransaction(ExpectedVersion.of(-1)).write(events).commit().nextExpectedVersion); assertEquals(0, writer.startTransaction(ExpectedVersion.any()) <BUG>.write(asList(events.get(0))) .write(asList(events.get(0))) .commit().nextExpectedVersion);</BUG> assertEquals(events.size(), size(stream)); }
List<EventData> events = range(0, 1).mapToObj(i -> newTestEvent()).collect(toList()); assertEquals(0, writer.startTransaction(ExpectedVersion.of(-1)).write(events).commit().nextExpectedVersion); assertEquals(0, writer.startTransaction(ExpectedVersion.of(-1)).write(events.get(0)).commit().nextExpectedVersion);
8,406
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.util.Progressable; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AFileSystem extends FileSystem {</BUG> private URI uri; private Path workingDir; private AmazonS3Client s3;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AFileSystem extends FileSystem {
8,407
public void initialize(URI name, Configuration conf) throws IOException { super.initialize(name, conf); uri = URI.create(name.getScheme() + "://" + name.getAuthority()); workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri, this.getWorkingDirectory()); <BUG>String accessKey = conf.get(ACCESS_KEY, null); String secretKey = conf.get(SECRET_KEY, null); </BUG> String userInfo = name.getUserInfo();
String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null)); String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
8,408
} else { accessKey = userInfo; } } AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain( <BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey), new InstanceProfileCredentialsProvider(), new S3AAnonymousAWSCredentialsProvider() );</BUG> bucket = name.getHost();
new BasicAWSCredentialsProvider(accessKey, secretKey), new AnonymousAWSCredentialsProvider()
8,409
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)); </BUG> s3 = new AmazonS3Client(credentials, awsConf); <BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS); partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (partSize < 5 * 1024 * 1024) {
new InstanceProfileCredentialsProvider(), new AnonymousAWSCredentialsProvider() bucket = name.getHost(); ClientConfiguration awsConf = new ClientConfiguration(); awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS))); awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP); awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES))); awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT))); maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS)); partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE)); partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
8,410
cannedACL = null; } if (!s3.doesBucketExist(bucket)) { throw new IOException("Bucket " + bucket + " does not exist"); } <BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART); long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE); </BUG> if (purgeExistingMultipart) {
boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART)); long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
8,411
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AOutputStream extends OutputStream {</BUG> private OutputStream backupStream; private File backupFile; private boolean closed;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AOutputStream extends OutputStream {
8,412
this.client = client; this.progress = progress; this.fs = fs; this.cannedACL = cannedACL; this.statistics = statistics; <BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (conf.get(BUFFER_DIR, null) != null) {
partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
8,413
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.DigestOutputStream; import java.security.MessageDigest; <BUG>import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.List;</BUG> public final class PatchUtils {
import java.text.DateFormat; import java.util.Date; import java.util.List;
8,414
package org.jboss.as.patching.runner; <BUG>import org.jboss.as.boot.DirectoryStructure; import org.jboss.as.patching.LocalPatchInfo;</BUG> import org.jboss.as.patching.PatchInfo; import org.jboss.as.patching.PatchLogger; import org.jboss.as.patching.PatchMessages;
import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp; import org.jboss.as.patching.CommonAttributes; import org.jboss.as.patching.LocalPatchInfo;
8,415
private static final String PATH_DELIMITER = "/"; public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT; enum Element { ADDED_BUNDLE("added-bundle"), ADDED_MISC_CONTENT("added-misc-content"), <BUG>ADDED_MODULE("added-module"), BUNDLES("bundles"),</BUG> CUMULATIVE("cumulative"), DESCRIPTION("description"), MISC_FILES("misc-files"),
APPLIES_TO_VERSION("applies-to-version"), BUNDLES("bundles"),
8,416
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { <BUG>case APPLIES_TO_VERSION: builder.addAppliesTo(value); break;</BUG> case RESULTING_VERSION: if(type == Patch.PatchType.CUMULATIVE) {
[DELETED]
8,417
final StringBuilder path = new StringBuilder(); for(final String p : item.getPath()) { path.append(p).append(PATH_DELIMITER); } path.append(item.getName()); <BUG>writer.writeAttribute(Attribute.PATH.name, path.toString()); if(type != ModificationType.REMOVE) {</BUG> writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash())); } if(type != ModificationType.ADD) {
if (item.isDirectory()) { writer.writeAttribute(Attribute.DIRECTORY.name, "true"); if(type != ModificationType.REMOVE) {
8,418
package org.jboss.as.patching; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.patching.runner.PatchingException; import org.jboss.logging.Messages; import org.jboss.logging.annotations.Message; <BUG>import org.jboss.logging.annotations.MessageBundle; import java.io.IOException;</BUG> import java.util.List; @MessageBundle(projectCode = "JBAS") public interface PatchMessages {
import org.jboss.logging.annotations.Cause; import java.io.IOException;
8,419
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.DigestOutputStream; import java.security.MessageDigest; <BUG>import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.List;</BUG> public final class PatchUtils {
import java.text.DateFormat; import java.util.Date; import java.util.List;
8,420
package org.jboss.as.patching.runner; <BUG>import org.jboss.as.boot.DirectoryStructure; import org.jboss.as.patching.LocalPatchInfo;</BUG> import org.jboss.as.patching.PatchInfo; import org.jboss.as.patching.PatchLogger; import org.jboss.as.patching.PatchMessages;
import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp; import org.jboss.as.patching.CommonAttributes; import org.jboss.as.patching.LocalPatchInfo;
8,421
private static final String PATH_DELIMITER = "/"; public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT; enum Element { ADDED_BUNDLE("added-bundle"), ADDED_MISC_CONTENT("added-misc-content"), <BUG>ADDED_MODULE("added-module"), BUNDLES("bundles"),</BUG> CUMULATIVE("cumulative"), DESCRIPTION("description"), MISC_FILES("misc-files"),
APPLIES_TO_VERSION("applies-to-version"), BUNDLES("bundles"),
8,422
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { <BUG>case APPLIES_TO_VERSION: builder.addAppliesTo(value); break;</BUG> case RESULTING_VERSION: if(type == Patch.PatchType.CUMULATIVE) {
[DELETED]
8,423
final StringBuilder path = new StringBuilder(); for(final String p : item.getPath()) { path.append(p).append(PATH_DELIMITER); } path.append(item.getName()); <BUG>writer.writeAttribute(Attribute.PATH.name, path.toString()); if(type != ModificationType.REMOVE) {</BUG> writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash())); } if(type != ModificationType.ADD) {
if (item.isDirectory()) { writer.writeAttribute(Attribute.DIRECTORY.name, "true"); if(type != ModificationType.REMOVE) {
8,424
package org.jboss.as.patching; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.patching.runner.PatchingException; import org.jboss.logging.Messages; import org.jboss.logging.annotations.Message; <BUG>import org.jboss.logging.annotations.MessageBundle; import java.io.IOException;</BUG> import java.util.List; @MessageBundle(projectCode = "JBAS") public interface PatchMessages {
import org.jboss.logging.annotations.Cause; import java.io.IOException;
8,425
package freenet.crypt; import java.math.BigInteger; import net.i2p.util.NativeBigInteger; import freenet.support.HexUtil; import freenet.support.Logger; <BUG>import freenet.support.Logger.LogLevel; public class DiffieHellmanLightContext extends KeyAgreementSchemeContext { public final NativeBigInteger myExponent; public final NativeBigInteger myExponential; public DSASignature signature = null; public final long lifetime = System.currentTimeMillis();</BUG> @Override
static { Logger.registerClass(DiffieHellmanLightContext.class); } private static volatile boolean logMINOR; public final DHGroup group;
8,426
NativeBigInteger[] params = getParams(); long time2 = System.currentTimeMillis(); if((time2 - time1) > 300) { Logger.error(null, "DiffieHellman.generateLightContext(): time2 is more than 300ms after time1 ("+(time2 - time1)+ ')'); } <BUG>return new DiffieHellmanLightContext(params[0], params[1]); </BUG> } public static NativeBigInteger[] getParams() { synchronized (precalcBuffer) {
return new DiffieHellmanLightContext(group, params[0], params[1]);
8,427
final HttpRequest incomingRequest, final EntityDetails entityDetails, final ResponseChannel responseChannel) throws HttpException, IOException { synchronized (exchangeState) { System.out.println("[client->proxy] " + exchangeState.id + " " + <BUG>incomingRequest.getMethod() + " " + incomingRequest.getPath()); </BUG> exchangeState.request = incomingRequest; exchangeState.inputEnd = entityDetails == null; exchangeState.responseMessageChannel = responseChannel;
incomingRequest.getMethod() + " " + incomingRequest.getRequestUri());
8,428
if (!HOP_BY_HOP.contains(header.getName().toLowerCase(Locale.ROOT))) { outgoingRequest.addHeader(header); } } System.out.println("[proxy->origin] " + exchangeState.id + " " + <BUG>outgoingRequest.getMethod() + " " + outgoingRequest.getPath()); </BUG> channel.sendRequest( outgoingRequest, !exchangeState.inputEnd ? new LazyEntityDetails(outgoingRequest) : null);
outgoingRequest.getMethod() + " " + outgoingRequest.getRequestUri());
8,429
import java.io.IOException; import org.apache.hc.core5.http.ClassicHttpRequest; import org.apache.hc.core5.http.ConnectionClosedException; import org.apache.hc.core5.http.HttpException; import org.apache.hc.core5.http.HttpRequestFactory; <BUG>import org.apache.hc.core5.http.HttpVersion; import org.apache.hc.core5.http.ProtocolVersion; import org.apache.hc.core5.http.UnsupportedHttpVersionException;</BUG> import org.apache.hc.core5.http.config.H1Config; import org.apache.hc.core5.http.message.LineParser;
[DELETED]
8,430
import org.apache.hc.core5.http.ClassicHttpRequest; import org.apache.hc.core5.http.ClassicHttpResponse; import org.apache.hc.core5.http.ContentLengthStrategy; import org.apache.hc.core5.http.HttpEntity; import org.apache.hc.core5.http.HttpException; <BUG>import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.LengthRequiredException; import org.apache.hc.core5.http.config.H1Config;</BUG> import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy; import org.apache.hc.core5.http.io.HttpClientConnection;
import org.apache.hc.core5.http.HttpVersion; import org.apache.hc.core5.http.ProtocolVersion; import org.apache.hc.core5.http.UnsupportedHttpVersionException; import org.apache.hc.core5.http.config.H1Config;
8,431
import org.apache.hc.core5.http.ClassicHttpRequest; import org.apache.hc.core5.http.ClassicHttpResponse; import org.apache.hc.core5.http.ContentLengthStrategy; import org.apache.hc.core5.http.HttpEntity; import org.apache.hc.core5.http.HttpException; <BUG>import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.config.H1Config;</BUG> import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy; import org.apache.hc.core5.http.io.HttpMessageParser; import org.apache.hc.core5.http.io.HttpMessageParserFactory;
import org.apache.hc.core5.http.HttpVersion; import org.apache.hc.core5.http.ProtocolVersion; import org.apache.hc.core5.http.UnsupportedHttpVersionException; import org.apache.hc.core5.http.config.H1Config;
8,432
super.bind(socket); } @Override public ClassicHttpRequest receiveRequestHeader() throws HttpException, IOException { final SocketHolder socketHolder = ensureOpen(); <BUG>final ClassicHttpRequest request = this.requestParser.parse(this.inbuffer, socketHolder.getInputStream()); this.version = request.getVersion(); </BUG> onRequestReceived(request); incrementRequestCount();
final ProtocolVersion transportVersion = request.getVersion(); if (transportVersion != null && transportVersion.greaterEquals(HttpVersion.HTTP_2)) { throw new UnsupportedHttpVersionException("Unsupported version: " + transportVersion); this.version = transportVersion;
8,433
import org.apache.hc.core5.http.HttpConnection; import org.apache.hc.core5.http.HttpException; import org.apache.hc.core5.http.HttpHeaders; import org.apache.hc.core5.http.HttpRequest; import org.apache.hc.core5.http.HttpResponse; <BUG>import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.ProtocolException; import org.apache.hc.core5.http.ProtocolVersion; import org.apache.hc.core5.http.config.H1Config;</BUG> import org.apache.hc.core5.http.impl.LazyEntityDetails;
import org.apache.hc.core5.http.HttpVersion; import org.apache.hc.core5.http.UnsupportedHttpVersionException; import org.apache.hc.core5.http.config.H1Config;
8,434
if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) { return new ListBoxModel(); }</BUG> return new StandardListBoxModel() <BUG>.withEmptySelection() .withAll(lookupCredentials( StringCredentials.class, Jenkins.getInstance(), ACL.SYSTEM, fromUri(defaultIfBlank(apiUrl, GITHUB_URL)).build()) );</BUG> }
return new StandardListBoxModel().includeCurrentValue(credentialsId); .includeEmptyValue() .includeMatchingAs(ACL.SYSTEM, fromUri(defaultIfBlank(apiUrl, GITHUB_URL)).build(), CredentialsMatchers.always()
8,435
import jenkins.model.Jenkins; import org.jenkinsci.plugins.plaincredentials.StringCredentials; import org.kohsuke.stapler.DataBoundConstructor; import javax.annotation.Nullable; import java.util.Collections; <BUG>import static com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials; public class HookSecretConfig extends AbstractDescribableImpl<HookSecretConfig> {</BUG> private String credentialsId; @DataBoundConstructor public HookSecretConfig(String credentialsId) {
import org.kohsuke.stapler.QueryParameter; public class HookSecretConfig extends AbstractDescribableImpl<HookSecretConfig> {
8,436
public class AnySilentChest implements IAnySilentChest { public boolean IsAnyChestNeeded(Player p, int x, int y, int z) { BlockPosition position = new BlockPosition(x, y, z); EntityPlayer player = ((CraftPlayer) p).getHandle(); World world = player.world; <BUG>BlockChest chest = (BlockChest) Block.getByName("chest"); if (topBlocking(world, position)) {</BUG> return true; } for (EnumDirection direction : EnumDirectionList.HORIZONTAL) {
BlockChest chest = (BlockChest) (((BlockChest) world.getType(position).getBlock()).b == 1 ? Block.getByName("trapped_chest") : Block.getByName("chest")); if (topBlocking(world, position)) {
8,437
import io.swagger.config.ScannerFactory; import io.swagger.config.SwaggerConfig; import io.swagger.models.Swagger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; <BUG>import javax.servlet.ServletConfig; public class SwaggerContextService {</BUG> private static Logger LOGGER = LoggerFactory.getLogger(SwaggerContextService.class); public static final String CONFIG_ID_KEY = "swagger.config.id"; public static final String CONFIG_ID_PREFIX = CONFIG_ID_KEY + ".";
import org.apache.commons.lang3.StringUtils; public class SwaggerContextService {
8,438
public static final String CONFIG_ID_PREFIX = CONFIG_ID_KEY + "."; public static final String CONFIG_ID_DEFAULT = CONFIG_ID_PREFIX + "default"; public static final String SCANNER_ID_KEY = "swagger.scanner.id"; public static final String SCANNER_ID_PREFIX = SCANNER_ID_KEY + "."; public static final String SCANNER_ID_DEFAULT = SCANNER_ID_PREFIX + "default"; <BUG>public static final String CONTEXT_ID_KEY = "swagger.context.id"; private ServletConfig sc;</BUG> private String configId; private SwaggerConfig swaggerConfig; private String scannerId;
public static final String USE_PATH_BASED_CONFIG = "swagger.use.path.based.config"; private ServletConfig sc;
8,439
swaggerConfig.configure(swagger); } else { LOGGER.debug("no configurator"); } } <BUG>new SwaggerContextService().withServletConfig(sc).updateSwagger(swagger); }</BUG> } if (SwaggerContextService.isScannerIdInitParamDefined(sc)) { initializedScanner.put(sc.getServletName() + "_" + SwaggerContextService.getScannerIdFromInitParam(sc), true);
new SwaggerContextService() .withServletConfig(sc) .withBasePath(getBasePath(uriInfo))
8,440
.withConfigId(configId) .withScannerId(scannerId) .withContextId(contextId) .withServletConfig(servletConfig) .withSwaggerConfig(this) <BUG>.withScanner(this) .initConfig()</BUG> .initScanner(); } public void setScan() {
.withBasePath(getBasePath()) .withPathBasedConfig(isUsePathBasedConfig()) .initConfig()
8,441
static final String STATIC_LINKER_EXE = "lib.exe"; private final File compilerExe; private final File linkerExe; private final File staticLinkerExe; private final Factory<ExecAction> execActionFactory; <BUG>public VisualCppToolChain(OperatingSystem operatingSystem, Factory<ExecAction> execActionFactory) { this(operatingSystem.findInPath(COMPILER_EXE), operatingSystem.findInPath(LINKER_EXE), operatingSystem.findInPath(STATIC_LINKER_EXE), execActionFactory); } protected VisualCppToolChain(File compilerExe, File linkerExe, File staticLinkerExe, Factory<ExecAction> execActionFactory) { this.compilerExe = compilerExe; this.linkerExe = linkerExe; this.staticLinkerExe = staticLinkerExe;</BUG> this.execActionFactory = execActionFactory;
super(operatingSystem); this.compilerExe = operatingSystem.findInPath(COMPILER_EXE); this.linkerExe = operatingSystem.findInPath(LINKER_EXE); this.staticLinkerExe = operatingSystem.findInPath(STATIC_LINKER_EXE);
8,442
return "Visual C++"; } @Override protected void checkAvailable(ToolChainAvailability availability) { availability.mustExist(COMPILER_EXE, compilerExe); <BUG>availability.mustExist(LINKER_EXE, linkerExe); }</BUG> public <T extends BinaryCompileSpec> Compiler<T> createCompiler(Class<T> specType) { checkAvailable(); if (CppCompileSpec.class.isAssignableFrom(specType)) {
public String getSharedLibraryLinkFileName(String libraryName) { return getSharedLibraryName(libraryName).replaceFirst("\\.dll$", ".lib");
8,443
package org.gradle.nativecode.base.internal; import org.gradle.internal.os.OperatingSystem; <BUG>public abstract class AbstractToolChain implements ToolChainInternal { private ToolChainAvailability availability; public ToolChainAvailability getAvailability() {</BUG> if (availability == null) { availability = new ToolChainAvailability();
private final OperatingSystem operatingSystem; protected AbstractToolChain(OperatingSystem operatingSystem) { this.operatingSystem = operatingSystem; } public ToolChainAvailability getAvailability() {
8,444
package org.gradle.nativecode.base.internal; import org.gradle.api.Action; import org.gradle.api.internal.DefaultNamedDomainObjectSet; <BUG>import org.gradle.api.internal.tasks.compile.Compiler; import org.gradle.internal.reflect.Instantiator;</BUG> import org.gradle.nativecode.base.ToolChain; import org.gradle.nativecode.base.ToolChainRegistry; import java.util.ArrayList;
import org.gradle.internal.os.OperatingSystem; import org.gradle.internal.reflect.Instantiator;
8,445
public String toString() { return String.format("shared library '%s'", library.getName()); } public String getOutputFileName() { return getToolChain().getSharedLibraryName(getComponent().getBaseName()); <BUG>} public NativeDependencySet getAsNativeDependencySet() {</BUG> return new NativeDependencySet() { public FileCollection getIncludeRoots() { return library.getHeaders();
private File getLinkFile() { return new File(getToolChain().getSharedLibraryLinkFileName(getOutputFile().getPath())); public NativeDependencySet getAsNativeDependencySet() {
8,446
if (connect(isProducer)) { break; } } catch (InvalidSelectorException e) { throw new ConnectionException( <BUG>"Connection to JMS failed. Invalid message selector"); } catch (JMSException | NamingException e) { logger.log(LogLevel.ERROR, "RECONNECTION_EXCEPTION", </BUG> new Object[] { e.toString() });
Messages.getString("CONNECTION_TO_JMS_FAILED_INVALID_MSG_SELECTOR")); //$NON-NLS-1$ logger.log(LogLevel.ERROR, "RECONNECTION_EXCEPTION", //$NON-NLS-1$
8,447
private synchronized void createConnectionNoRetry() throws ConnectionException { if (!isConnectValid()) { try { connect(isProducer); } catch (JMSException e) { <BUG>logger.log(LogLevel.ERROR, "Connection to JMS failed", new Object[] { e.toString() }); throw new ConnectionException( "Connection to JMS failed. Did not try to reconnect as the policy is reconnection policy does not apply here."); }</BUG> }
logger.log(LogLevel.ERROR, "CONNECTION_TO_JMS_FAILED", new Object[] { e.toString() }); //$NON-NLS-1$ Messages.getString("CONNECTION_TO_JMS_FAILED_NO_RECONNECT_AS_RECONNECT_POLICY_DOES_NOT_APPLY")); //$NON-NLS-1$
8,448
boolean res = false; int count = 0; do { try { if(count > 0) { <BUG>logger.log(LogLevel.INFO, "ATTEMPT_TO_RESEND_MESSAGE", new Object[] { count }); </BUG> Thread.sleep(messageRetryDelay); } synchronized (getSession()) {
logger.log(LogLevel.INFO, "ATTEMPT_TO_RESEND_MESSAGE", new Object[] { count }); //$NON-NLS-1$
8,449
getProducer().send(message); res = true; } } catch (JMSException e) { <BUG>logger.log(LogLevel.WARN, "ERROR_DURING_SEND", new Object[] { e.toString() }); logger.log(LogLevel.INFO, "ATTEMPT_TO_RECONNECT"); </BUG> setConnect(null);
logger.log(LogLevel.WARN, "ERROR_DURING_SEND", new Object[] { e.toString() }); //$NON-NLS-1$ logger.log(LogLevel.INFO, "ATTEMPT_TO_RECONNECT"); //$NON-NLS-1$
8,450
import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import com.ibm.streams.operator.Attribute; import com.ibm.streams.operator.StreamSchema; import com.ibm.streams.operator.Type; <BUG>import com.ibm.streams.operator.Type.MetaType; class ConnectionDocumentParser {</BUG> private static final Set<String> supportedSPLTypes = new HashSet<String>(Arrays.asList("int8", "uint8", "int16", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ "uint16", "int32", "uint32", "int64", "float32", "float64", "boolean", "blob", "rstring", "uint64", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ "decimal32", "decimal64", "decimal128", "ustring", "timestamp", "xml")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
import com.ibm.streamsx.messaging.jms.Messages; class ConnectionDocumentParser {
8,451
return msgClass; } private void convertProviderURLPath(File applicationDir) throws ParseConnectionDocumentException { if(!isAMQ()) { if(this.providerURL == null || this.providerURL.trim().length() == 0) { <BUG>throw new ParseConnectionDocumentException("A value must be specified for provider_url attribute in connection document"); }</BUG> try { URL url = new URL(providerURL); if("file".equalsIgnoreCase(url.getProtocol())) { //$NON-NLS-1$
throw new ParseConnectionDocumentException(Messages.getString("PROVIDER_URL_MUST_BE_SPECIFIED_IN_CONN_DOC")); //$NON-NLS-1$
8,452
URL absProviderURL = new URL(url.getProtocol(), url.getHost(), applicationDir.getAbsolutePath() + File.separator + path); this.providerURL = absProviderURL.toExternalForm(); } } } catch (MalformedURLException e) { <BUG>throw new ParseConnectionDocumentException("Invalid provider_url value detected: " + e.getMessage()); }</BUG> } } public void parseAndValidateConnectionDocument(String connectionDocument, String connection, String access,
throw new ParseConnectionDocumentException(Messages.getString("INVALID_PROVIDER_URL", e.getMessage())); //$NON-NLS-1$
8,453
for (int j = 0; j < accessSpecChildNodes.getLength(); j++) { if (accessSpecChildNodes.item(j).getNodeName().equals("destination")) { //$NON-NLS-1$ destIndex = j; } else if (accessSpecChildNodes.item(j).getNodeName().equals("uses_connection")) { //$NON-NLS-1$ if (!connection.equals(accessSpecChildNodes.item(j).getAttributes().getNamedItem("connection") //$NON-NLS-1$ <BUG>.getNodeValue())) { throw new ParseConnectionDocumentException("The value of the connection parameter " + connection + " is not the same as the connection used by access element " + access + " as mentioned in the uses_connection element in connections document");</BUG> }
throw new ParseConnectionDocumentException(Messages.getString("VALUE_OF_CONNECTION_PARAM_NOT_THE_SAME_AS_CONN_USED_BY_ACCESS_ELEMENT", connection, access )); //$NON-NLS-1$
8,454
nativeSchema = access_specification.item(i).getChildNodes().item(nativeSchemaIndex); } break; } } <BUG>if (!accessFound) { throw new ParseConnectionDocumentException("The value of the access parameter " + access + " is not found in the connections document");</BUG> } return nativeSchema;
throw new ParseConnectionDocumentException(Messages.getString("VALUE_OF_ACCESS_PARAM_NOT_FOUND_IN_CONN_DOC", access )); //$NON-NLS-1$
8,455
nativeAttrLength = Integer.parseInt((attrList.item(i).getAttributes().getNamedItem("length") //$NON-NLS-1$ .getNodeValue())); } if ((msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22) && ((streamSchema.getAttribute(nativeAttrName) != null) && (streamSchema <BUG>.getAttribute(nativeAttrName).getType().getMetaType() == Type.MetaType.BLOB))) { throw new ParseConnectionDocumentException(" Blob data type is not supported for message class " + msgClass);</BUG> } Iterator<NativeSchema> it = nativeSchemaObjects.iterator();
throw new ParseConnectionDocumentException(Messages.getString("BLOB_NOT_SUPPORTED_FOR_MSG_CLASS", msgClass)); //$NON-NLS-1$
8,456
throw new ParseConnectionDocumentException(" Blob data type is not supported for message class " + msgClass);</BUG> } Iterator<NativeSchema> it = nativeSchemaObjects.iterator(); while (it.hasNext()) { <BUG>if (it.next().getName().equals(nativeAttrName)) { throw new ParseConnectionDocumentException("Parameter name: " + nativeAttrName + " is appearing more than once In native schema file");</BUG> } }
nativeAttrLength = Integer.parseInt((attrList.item(i).getAttributes().getNamedItem("length") //$NON-NLS-1$ .getNodeValue())); if ((msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22) && ((streamSchema.getAttribute(nativeAttrName) != null) && (streamSchema .getAttribute(nativeAttrName).getType().getMetaType() == Type.MetaType.BLOB))) { throw new ParseConnectionDocumentException(Messages.getString("BLOB_NOT_SUPPORTED_FOR_MSG_CLASS", msgClass)); //$NON-NLS-1$ throw new ParseConnectionDocumentException(Messages.getString("PARAMETER_NOT_UNIQUE_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
8,457
if (msgClass == MessageClass.text) { typesWithLength = new HashSet<String>(Arrays.asList("Bytes")); //$NON-NLS-1$ } Set<String> typesWithoutLength = new HashSet<String>(Arrays.asList("Byte", "Short", "Int", "Long", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ "Float", "Double", "Boolean")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ <BUG>if (typesWithoutLength.contains(nativeAttrType) && nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) { throw new ParseConnectionDocumentException("Length attribute should not be present for parameter: " + nativeAttrName + " In native schema file");</BUG> } if ((nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA)
throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
8,458
if ((nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) && (msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22 || msgClass == MessageClass.xml) && (streamSchema.getAttribute(nativeAttrName) != null) && (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.RSTRING) && (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.USTRING) <BUG>&& (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.BLOB)) { throw new ParseConnectionDocumentException("Length attribute should not be present for parameter: " + nativeAttrName + " In native schema file");</BUG> } if (streamSchema.getAttribute(nativeAttrName) != null) {
throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
8,459
if (streamSchema.getAttribute(nativeAttrName) != null) { MetaType metaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType(); if (metaType == Type.MetaType.DECIMAL32 || metaType == Type.MetaType.DECIMAL64 || metaType == Type.MetaType.DECIMAL128 || metaType == Type.MetaType.TIMESTAMP) { if (nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) { <BUG>throw new ParseConnectionDocumentException( "Length attribute should not be present for parameter: " + nativeAttrName + " with type " + metaType + " in native schema file.");</BUG> } if (msgClass == MessageClass.bytes) {
Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_WITH_TYPE_IN_NATIVE_SCHEMA", nativeAttrName, metaType )); //$NON-NLS-1$
8,460
nativeAttrLength = -4; } } } if (typesWithLength.contains(nativeAttrType)) { <BUG>if (nativeAttrLength == LENGTH_ABSENT_IN_NATIVE_SCHEMA && msgClass == MessageClass.bytes) { throw new ParseConnectionDocumentException("Length attribute should be present for parameter: " + nativeAttrName + " In native schema file for message class bytes");</BUG> } if ((nativeAttrLength < 0) && nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) {
throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA_FOR_MSG_CLASS_BYTES", nativeAttrName )); //$NON-NLS-1$
8,461
if (streamSchema.getAttribute(nativeAttrName) != null) { streamAttrName = streamSchema.getAttribute(nativeAttrName).getName(); streamAttrMetaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType(); if ((msgClass == MessageClass.stream || msgClass == MessageClass.map) && !mapSPLToNativeSchemaDataTypesForOtherMsgClass.get(streamAttrMetaType.getLanguageType()) <BUG>.equals(nativeAttrType)) { throw new ParseConnectionDocumentException("Attribute Name: " + nativeAttrName + " with type:" + nativeAttrType + " in the native schema cannot be mapped with attribute: " + streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG> }
throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$
8,462
+ nativeAttrType + " in the native schema cannot be mapped with attribute: " + streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG> } else if (msgClass == MessageClass.bytes && !mapSPLToNativeSchemaDataTypesForBytes.get(streamAttrMetaType.getLanguageType()).equals( <BUG>nativeAttrType)) { throw new ParseConnectionDocumentException("Attribute Name: " + nativeAttrName + " with type:" + nativeAttrType + " in the native schema cannot be mapped with attribute: " + streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG> }
if (streamSchema.getAttribute(nativeAttrName) != null) { streamAttrName = streamSchema.getAttribute(nativeAttrName).getName(); streamAttrMetaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType(); if ((msgClass == MessageClass.stream || msgClass == MessageClass.map) && !mapSPLToNativeSchemaDataTypesForOtherMsgClass.get(streamAttrMetaType.getLanguageType()) .equals(nativeAttrType)) { throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$ throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$
8,463
package com.ibm.streamsx.messaging.i18n; import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; public class Messages { <BUG>private static final String BUNDLE_NAME = "com.ibm.streamsx.messaging.mqtt.MQTTMessages"; //$NON-NLS-1$ </BUG> private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle .getBundle(BUNDLE_NAME); private Messages() {
private static final String BUNDLE_NAME = "com.ibm.streamsx.messaging.i18n.CommonMessages"; //$NON-NLS-1$
8,464
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
8,465
final int lineStride = dst.getScanlineStride(); final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final byte[][] data = dst.getByteDataArrays(); final float[] warpData = new float[2 * dstWidth]; <BUG>int lineOffset = 0; if (ctable == null) { // source does not have IndexColorModel if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset;
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
8,466
pixelOffset += pixelStride; } // COLS LOOP } // ROWS LOOP } } else {// source has IndexColorModel <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
} else if (caseB) { for (int h = 0; h < dstHeight; h++) {
8,467
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
8,468
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
8,469
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
8,470
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
8,471
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
8,472
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final int[][] data = dst.getIntDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
8,473
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
8,474
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final float[][] data = dst.getFloatDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
8,475
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
8,476
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final double[][] data = dst.getDoubleDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
8,477
} @Test @Ignore public void testKScanner() throws Exception { KieServices ks = KieServices.Factory.get(); KieFactory kf = KieFactory.Factory.get(); <BUG>KieJar kJar1 = createKieJar(kf, "rule1", "rule2"); </BUG> KieContainer kieContainer = ks.getKieContainer(kf.newGav("org.kie", "scanner-test", "1.0-SNAPSHOT")); MavenRepository repository = new MavenRepository(); repository.deployArtifact("org.kie", "scanner-test", "1.0-SNAPSHOT", ((InternalKieJar)kJar1).asFile(), kPom);
@After public void tearDown() throws Exception { this.fileManager.tearDown(); KieJar kJar1 = createKieJar(ks, kf, "rule1", "rule2");
8,478
"</project>"; File pomFile = fileManager.newFile("pom.xml"); fileManager.write(pomFile, pom); return pomFile; } <BUG>private KieJar createKieJar(KieFactory kf, String... rules) throws IOException { </BUG> KieFileSystem kfs = kf.newKieFileSystem(); for (String rule : rules) { String file = "org/test/" + rule + ".drl";
private KieJar createKieJar(KieServices ks, KieFactory kf, String... rules) throws IOException {
8,479
.setEventProcessingMode( EventProcessingOption.STREAM ); KieSessionModel ksession1 = kieBaseModel1.newKieSessionModel("KSession1") .setType( "stateful" ) .setClockType( ClockTypeOption.get("realtime") ); kfs.write(KieContainer.KPROJECT_JAR_PATH, kproj.toXML()); <BUG>KieBuilder kieBuilder = kf.newKieBuilder(kfs); assertTrue(kieBuilder.build().isEmpty()); </BUG> return kieBuilder.getKieJar();
KieBuilder kieBuilder = ks.newKieBuilder(kfs); assertTrue(kieBuilder.build().getInsertedMessages().isEmpty());
8,480
assertEquals(results.length, list.size()); for (Object result : results) { assertTrue( list.contains( result ) ); } } <BUG>private KieJar createKieJarWithClass(KieFactory kf, int value, int factor) throws IOException { </BUG> KieFileSystem kieFileSystem = kf.newKieFileSystem(); KieProject kproj = kf.newKieProject() .setGroupArtifactVersion(kf.newGav("org.kie", "scanner-test", "1.0-SNAPSHOT"));
private KieJar createKieJarWithClass(KieServices ks, KieFactory kf, int value, int factor) throws IOException {
8,481
.setClockType( ClockTypeOption.get("realtime") ); kieFileSystem .write(KieContainer.KPROJECT_JAR_PATH, kproj.toXML()) .write("src/kbases/" + kieBaseModel1.getName() + "/rule1.drl", createDRLForJavaSource(value)) .write("org/kie/test/Bean.java", createJavaSource(factor)); <BUG>KieBuilder kieBuilder = kf.newKieBuilder(kieFileSystem); assertTrue(kieBuilder.build().isEmpty()); </BUG> return kieBuilder.getKieJar();
KieBuilder kieBuilder = ks.newKieBuilder(kieFileSystem); assertTrue(kieBuilder.build().getInsertedMessages().isEmpty());
8,482
if ( bytes == null ) { bytes = srcMfs.getBytes( KieContainer.KPROJECT_JAR_PATH ); } if ( bytes != null ) { try { <BUG>return ( KieProjectImpl ) KieProjectImpl.fromXML( new ByteArrayInputStream( bytes ) ); } catch ( Exception e) {</BUG> invalidKieProject = true; messages.add( new MessageImpl( idGenerator++, Level.ERROR,
return KieProjectImpl.fromXML( new ByteArrayInputStream( bytes ) ); } catch ( Exception e) {
8,483
public PomModel getPomModel() { pomXml = srcMfs.getBytes( "pom.xml" ); if ( pomXml == null) { return null; } <BUG>PomModel pomModel = MinimalPomParser.parse( "pom.xml", new ByteArrayInputStream( pomXml ) ); return pomModel;</BUG> } public void writePomAndKProject() {
return MinimalPomParser.parse( "pom.xml", new ByteArrayInputStream( pomXml ) );
8,484
public EditorCell createConstantCell(EditorContext context, SNode node, String text) { EditorCell_Constant editorCell = EditorCell_Constant.create(context, node, text, false); editorCell.setSelectable(true); editorCell.setDrawBorder(false); editorCell.setEditable(true); <BUG>editorCell.setDefaultText(""); </BUG> editorCell.setDrawBrackets(false); editorCell.setBracketsColor(Color.black); editorCell.getTextLine().setTextColor(Color.lightGray);
editorCell.setDefaultText("<abstract concept>");
8,485
processSubtyping(rhsRepresentator, lhsRepresentator); return; } else if (SubtypingManager.getInstance().isStrictSubtype(lhsRepresentator, rhsRepresentator)) { processSubtyping(lhsRepresentator, rhsRepresentator); return; <BUG>} }</BUG> } if (!compareNodes(rhsRepresentator.getNodeWrapper(), lhsRepresentator.getNodeWrapper())) { String error = "incompatible types: " + rhsRepresentator + " and " + lhsRepresentator; //todo more friendly error representation
[DELETED]
8,486
import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import org.robolectric.RobolectricGradleTestRunner; import org.robolectric.annotation.Config; import static com.google.common.truth.Truth.assertThat; <BUG>import static com.nextfaze.poweradapters.DividerAdapterBuilder.EmptyPolicy.*; import static org.mockito.Mockito.verify;</BUG> import static org.mockito.Mockito.verifyNoMoreInteractions; @RunWith(RobolectricGradleTestRunner.class) @Config(constants = BuildConfig.class, sdk = 21)
import static com.nextfaze.poweradapters.FakeAdapter.NotificationType.COARSE; import static org.mockito.Mockito.verify;
8,487
throw new IllegalArgumentException("no \"type\" parameter found from metaData: " + m_metaData); } switch (type) { case ServiceDependency: <BUG>dp = createServiceDependency(b, dm, false, instanceBound); break; case TemporalServiceDependency: dp = createServiceDependency(b, dm, true, instanceBound); break;</BUG> case ConfigurationDependency:
dp = createServiceDependency(b, dm, instanceBound);
8,488
dp = createResourceDependency(dm, instanceBound); break; } return dp; } <BUG>private Dependency createServiceDependency(Bundle b, DependencyManager dm, boolean temporal, boolean instanceBound)</BUG> throws ClassNotFoundException {
private Dependency createServiceDependency(Bundle b, DependencyManager dm, boolean instanceBound)
8,489
Class<?> serviceClass = b.loadClass(service); String serviceFilter = m_metaData.getString(Params.filter, null); String defaultServiceImpl = m_metaData.getString(Params.defaultImpl, null); Class<?> defaultServiceImplClass = (defaultServiceImpl != null) ? b.loadClass(defaultServiceImpl) : null; <BUG>String added = m_metaData.getString(Params.added, null); String changed = temporal ? null : m_metaData.getString(Params.changed, null); String removed = temporal ? null : m_metaData.getString(Params.removed, null); </BUG> String autoConfigField = m_metaData.getString(Params.autoConfig, null);
long timeout = m_metaData.getLong(Params.timeout, -1L); String changed = timeout != -1 ? null : m_metaData.getString(Params.changed, null); String removed = timeout != -1 ? null : m_metaData.getString(Params.removed, null);
8,490
sd.setCallbacks(added, changed, removed); if (autoConfigField != null) { sd.setAutoConfig(autoConfigField); } <BUG>if (temporal) { if (timeout != null) { ((TemporalServiceDependency) sd).setTimeout(Long.parseLong(timeout)); }</BUG> sd.setRequired(true);
[DELETED]
8,491
}</BUG> else if (annotation.getName().equals(A_CONFIGURATION_DEPENDENCY)) { parseConfigurationDependencyAnnotation(annotation); <BUG>} else if (annotation.getName().equals(A_TEMPORAL_SERVICE_DEPENDENCY)) { parseServiceDependencyAnnotation(annotation, true);</BUG> } else if (annotation.getName().equals(A_BUNDLE_DEPENDENCY))
Patterns.parseMethod(m_method, m_descriptor, Patterns.COMPOSITION); m_compositionMethod = m_method; else if (annotation.getName().equals(A_SERVICE_DEP)) parseServiceDependencyAnnotation(annotation);
8,492
if (m_compositionMethod != null) { writer.put(EntryParam.composition, m_compositionMethod); } } <BUG>private void parseServiceDependencyAnnotation(Annotation annotation, boolean temporal) { EntryWriter writer = new EntryWriter(temporal ? EntryType.TemporalServiceDependency : EntryType.ServiceDependency);</BUG> m_writers.add(writer);
private void parseServiceDependencyAnnotation(Annotation annotation) EntryWriter writer = new EntryWriter(EntryType.ServiceDependency);
8,493
public interface MetaData extends Cloneable { String getString(Params key); String getString(Params key, String def); int getInt(Params key); <BUG>int getInt(Params key, int def); String[] getStrings(Params key);</BUG> String[] getStrings(Params key, String[] def); Dictionary<String, Object> getDictionary(Params key, Dictionary<String, Object> def); void setString(Params key, String value);
long getLong(Params key); long getLong(Params key, long def); String[] getStrings(Params key);
8,494
PsiField[] fields = getFields(); PsiMethod[] methods = getMethods(); PsiClass[] classes = getInnerClasses(); int count = (docComment != null ? 1 : 0) <BUG>+ (modifierList != null ? 1 : 0) + (name != null ? 1 : 0) + (extendsList != null ? 1 : 0) + (implementsList != null ? 1 : 0) + fields.length</BUG> + methods.length
+ 1 // modifierList + 1 // name + 1 // extends list + 1 // implementsList + fields.length
8,495
offset += fields.length; System.arraycopy(methods, 0, children, offset, methods.length); offset += methods.length; System.arraycopy(classes, 0, children, offset, classes.length); return children; <BUG>} public PsiIdentifier getNameIdentifier() {</BUG> synchronized (PsiLock.LOCK) { if (myNameIdentifier == null) { String qName = getQualifiedName();
@NotNull public PsiIdentifier getNameIdentifier() {
8,496
if (myName == null) { String qName = getQualifiedName(); myName = PsiNameHelper.getShortClassName(qName); } return myName; <BUG>} public PsiTypeParameterList getTypeParameterList() {</BUG> synchronized (PsiLock.LOCK) { if (myTypeParameters == null) { long repositoryId = getRepositoryId();
@NotNull public PsiTypeParameterList getTypeParameterList() {
8,497
return PsiImplUtil.hasTypeParameters(this); } public PsiElement setName(String name) throws IncorrectOperationException { SharedPsiElementImplUtil.setName(getNameIdentifier(), name); return this; <BUG>} public String getQualifiedName() {</BUG> synchronized (PsiLock.LOCK) { if (myQualifiedName == null) { long repositoryId = getRepositoryId();
@NotNull public String getQualifiedName() {
8,498
return myModifierList; } } public boolean hasModifierProperty(String name) { return getModifierList().hasModifierProperty(name); <BUG>} public PsiReferenceList getExtendsList() {</BUG> synchronized (PsiLock.LOCK) { if (myExtendsList == null) { long repositoryId = getRepositoryId();
@NotNull public PsiReferenceList getExtendsList() {
8,499
ClassView classView = getRepositoryManager().getClassView(); return classView.getModifiers(repositoryId); } } } <BUG>public void appendMirrorText(final int indentLevel, final StringBuffer buffer) { </BUG> ClsDocCommentImpl docComment = (ClsDocCommentImpl)getDocComment(); if (docComment != null) { docComment.appendMirrorText(indentLevel, buffer);
public void appendMirrorText(final int indentLevel, final @NonNls StringBuffer buffer) {
8,500
ClsClassImpl parentClass = (ClsClassImpl)parent; PsiClass parentSourceMirror = parentClass.getSourceMirrorClass(); if (parentSourceMirror == null) return null; PsiClass[] innerClasses = parentSourceMirror.getInnerClasses(); for (PsiClass innerClass : innerClasses) { <BUG>if (innerClass.getName().equals(getName())) return innerClass; </BUG> } } return null;
if (name.equals(innerClass.getName())) return innerClass;