id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
16,001 | int start = provider.getCraftingGridStart(entityPlayer, container, id);
int size = provider.getCraftingGridSize(entityPlayer, container, id);
for (int i = start; i < start + size; i++) {
int slotIndex = container.inventorySlots.get(i).getSlotIndex();
ItemStack itemStack = craftMatrix.getStackInSlot(slotIndex);
<BUG>if (itemStack != null && itemStack.stackSize > biggestSlotSize) {
biggestSlotStack = itemStack;
biggestSlotSize = itemStack.stackSize;
}</BUG>
}
| if (!itemStack.func_190926_b() && itemStack.func_190916_E() > biggestSlotSize) {
biggestSlotSize = itemStack.func_190916_E();
|
16,002 | if (craftStack.isItemEqual(itemStack) && ItemStack.areItemStackTagsEqual(craftStack, itemStack)) {
int spaceLeft = Math.min(craftMatrix.getInventoryStackLimit(), craftStack.getMaxStackSize()) - craftStack.stackSize;
</BUG>
if (spaceLeft > 0) {
<BUG>ItemStack splitStack = itemStack.splitStack(Math.min(spaceLeft, itemStack.stackSize));
craftStack.stackSize += splitStack.stackSize;
if (itemStack.stackSize <= 0) {
return null;</BUG>
}
| int spaceLeft = Math.min(craftMatrix.getInventoryStackLimit(), craftStack.getMaxStackSize()) - craftStack.func_190916_E();
ItemStack splitStack = itemStack.splitStack(Math.min(spaceLeft, itemStack.func_190916_E()));
craftStack.func_190917_f(splitStack.func_190916_E());
if (itemStack.func_190916_E() <= 0) {
return null;
|
16,003 | return false;
}
int start = provider.getCraftingGridStart(entityPlayer, container, id);
int size = provider.getCraftingGridSize(entityPlayer, container, id);
ItemStack itemStack = sourceSlot.getStack();
<BUG>if (itemStack == null) {
return false;</BUG>
}
int firstEmptySlot = -1;
for (int i = start; i < start + size; i++) {
| if (itemStack.func_190926_b()) {
|
16,004 | }
int firstEmptySlot = -1;
for (int i = start; i < start + size; i++) {
int slotIndex = container.inventorySlots.get(i).getSlotIndex();
ItemStack craftStack = craftMatrix.getStackInSlot(slotIndex);
<BUG>if (craftStack != null) {
if (craftStack.isItemEqual(itemStack) && ItemStack.areItemStackTagsEqual(craftStack, itemStack)) {
int spaceLeft = Math.min(craftMatrix.getInventoryStackLimit(), craftStack.getMaxStackSize()) - craftStack.stackSize;
</BUG>
if (spaceLeft > 0) {
| if (itemStack.func_190916_E() <= 0) {
return null;
return itemStack;
|
16,005 | if (craftStack.isItemEqual(itemStack) && ItemStack.areItemStackTagsEqual(craftStack, itemStack)) {
int spaceLeft = Math.min(craftMatrix.getInventoryStackLimit(), craftStack.getMaxStackSize()) - craftStack.stackSize;
</BUG>
if (spaceLeft > 0) {
<BUG>ItemStack splitStack = itemStack.splitStack(Math.min(spaceLeft, itemStack.stackSize));
craftStack.stackSize += splitStack.stackSize;
if (itemStack.stackSize <= 0) {
return true;</BUG>
}
| int spaceLeft = Math.min(craftMatrix.getInventoryStackLimit(), craftStack.getMaxStackSize()) - craftStack.func_190916_E();
ItemStack splitStack = itemStack.splitStack(Math.min(spaceLeft, itemStack.func_190916_E()));
craftStack.func_190917_f(splitStack.func_190916_E());
if (itemStack.func_190916_E() <= 0) {
return true;
|
16,006 | }
} else if (firstEmptySlot == -1) {
firstEmptySlot = slotIndex;
}
}
<BUG>if (itemStack.stackSize > 0 && firstEmptySlot != -1) {
ItemStack transferStack = itemStack.splitStack(Math.min(itemStack.stackSize, craftMatrix.getInventoryStackLimit()));
</BUG>
craftMatrix.setInventorySlotContents(firstEmptySlot, transferStack);
| if (itemStack.func_190916_E() > 0 && firstEmptySlot != -1) {
ItemStack transferStack = itemStack.splitStack(Math.min(itemStack.func_190916_E(), craftMatrix.getInventoryStackLimit()));
|
16,007 | projQs.forEach(surveyQuestionService::create);
} catch (Exception e) {
e.printStackTrace();
}
}
<BUG>private static SurveyTemplate mkAppSurvey(Long ownerId) {
SurveyTemplate appSurvey = ImmutableSurveyTemplate.builder()
.name("App Survey")</BUG>
.description("Questions about your application")
| private static SurveyTemplateChangeCommand mkAppSurvey() {
return ImmutableSurveyTemplateChangeCommand.builder()
.name("App Survey")
|
16,008 | .builder()
.questionText("Is your app accessible via a browser")
.helpText("IE11, Chrome, FFox etc")
.isMandatory(true)
.fieldType(SurveyQuestionFieldType.BOOLEAN)
<BUG>.surveyTemplateId(templateId)
.build(),</BUG>
ImmutableSurveyQuestion
.builder()
.questionText("What percentage of your code base has tests")
| .position(1)
.build(),
|
16,009 | .questionText("What percentage of your code base has tests")
.helpText("Approximation is fine (0-100)")
.isMandatory(true)
.allowComment(true)
.surveyTemplateId(templateId)
<BUG>.fieldType(SurveyQuestionFieldType.NUMBER)
.build(),</BUG>
ImmutableSurveyQuestion
.builder()
.questionText("What is the primary goal for the next release")
| .position(2)
.build(),
|
16,010 | package com.khartec.waltz.data.survey;
import com.khartec.waltz.model.EntityKind;
import com.khartec.waltz.model.survey.ImmutableSurveyTemplate;
<BUG>import com.khartec.waltz.model.survey.SurveyTemplate;
import com.khartec.waltz.model.survey.SurveyTemplateStatus;</BUG>
import com.khartec.waltz.schema.tables.records.SurveyTemplateRecord;
import org.jooq.DSLContext;
import org.jooq.Record;
| import com.khartec.waltz.model.survey.SurveyTemplateChangeCommand;
import com.khartec.waltz.model.survey.SurveyTemplateStatus;
|
16,011 | import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
<BUG>import static com.khartec.waltz.common.Checks.checkNotNull;
import static com.khartec.waltz.schema.Tables.SURVEY_INSTANCE;</BUG>
import static com.khartec.waltz.schema.Tables.SURVEY_RUN;
import static com.khartec.waltz.schema.tables.SurveyQuestion.SURVEY_QUESTION;
@Repository
| import static com.khartec.waltz.common.Checks.checkTrue;
import static com.khartec.waltz.schema.Tables.SURVEY_INSTANCE;
|
16,012 | 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 {
|
16,013 | 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));
|
16,014 | } 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()
|
16,015 |
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));
|
16,016 | 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));
|
16,017 | 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 {
|
16,018 | 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);
|
16,019 | }else if(programsSelected.size() == 1){
lytProgsPanel.setVisibility(View.VISIBLE);
lytProg2MAHAdsExtDlg.setVisibility(View.GONE);
prog1 = programsSelected.get(0);
((TextView)view.findViewById(R.id.tvProg1NameMAHAdsExtDlg)).setText(prog1.getName());
<BUG>if (prog1.getImg() != null && !prog1.getImg().trim().isEmpty()) {
((SmartImageView)view.findViewById(R.id.ivProg1ImgMAHAds)).setImageUrl(MAHAdsController.urlRootOnServer + prog1.getImg());
}
AngledLinearLayout prog1LytNewText = (AngledLinearLayout)view.findViewById(R.id.lytProg1NewText);</BUG>
if(prog1.isNewPrgram()){
| Picasso.with(view.getContext())
.load(MAHAdsController.urlRootOnServer + prog1.getImg())
.placeholder(R.drawable.img_place_holder_normal)
.error(R.drawable.img_not_found)
.into((ImageView) view.findViewById(R.id.ivProg1ImgMAHAds));
AngledLinearLayout prog1LytNewText = (AngledLinearLayout)view.findViewById(R.id.lytProg1NewText);
|
16,020 | import javax.annotation.CheckForNull;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;
<BUG>import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.security.AccessControlManager;</BUG>
import javax.jcr.security.AccessControlPolicy;
import javax.jcr.security.Privilege;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
| import javax.jcr.security.AccessControlEntry;
import javax.jcr.security.AccessControlManager;
|
16,021 | import static org.netbeans.jpa.modeler.core.widget.InheritanceStateType.SINGLETON;
import org.netbeans.jpa.modeler.core.widget.attribute.base.IdAttributeWidget;
import org.netbeans.jpa.modeler.core.widget.flow.GeneralizationFlowWidget;
import org.netbeans.jpa.modeler.core.widget.flow.relation.RelationFlowWidget;
import org.netbeans.jpa.modeler.properties.PropertiesHandler;
<BUG>import static org.netbeans.jpa.modeler.properties.PropertiesHandler.getCacheableProperty;
import static org.netbeans.jpa.modeler.properties.PropertiesHandler.getEntityDisplayProperty;</BUG>
import org.netbeans.jpa.modeler.rules.entity.EntityValidator;
import org.netbeans.jpa.modeler.spec.Entity;
import org.netbeans.jpa.modeler.specification.model.scene.JPAModelerScene;
| import static org.netbeans.jpa.modeler.properties.PropertiesHandler.getConvertProperties;
import static org.netbeans.jpa.modeler.properties.PropertiesHandler.getEntityDisplayProperty;
|
16,022 | import static org.netbeans.jpa.modeler.specification.model.util.JPAModelerUtil.MICRO_DB;
import org.netbeans.modeler.core.ModelerFile;
import org.netbeans.modeler.specification.model.document.property.ElementPropertySet;
import org.netbeans.modeler.widget.node.info.NodeWidgetInfo;
import org.netbeans.jpa.modeler.spec.extend.InheritanceHandler;
<BUG>import static org.netbeans.jpa.modeler.properties.PropertiesHandler.getInheritanceProperty;
import static org.netbeans.modeler.widget.node.IWidgetStateHandler.StateType.ERROR;</BUG>
import org.netbeans.modeler.widget.properties.handler.PropertyVisibilityHandler;
public class EntityWidget extends PrimaryKeyContainerWidget<Entity> {
private Boolean abstractEntity;
| import org.netbeans.jpa.modeler.spec.ManagedClass;
import static org.netbeans.modeler.widget.node.IWidgetStateHandler.StateType.ERROR;
|
16,023 | private Boolean abstractEntity;
private Set<RelationFlowWidget> unidirectionalRelationFlowWidget = new HashSet<>();
public EntityWidget(JPAModelerScene scene, NodeWidgetInfo nodeWidgetInfo) {
super(scene, nodeWidgetInfo);
this.addPropertyChangeListener("abstract", (input) -> setImage(getIcon()));
<BUG>PropertyVisibilityHandler<String> overridePropertyHandler = (PropertyVisibilityHandler<String>) () -> {
InheritanceStateType inheritanceState = this.getInheritanceState(true);</BUG>
return inheritanceState == InheritanceStateType.BRANCH || inheritanceState == InheritanceStateType.LEAF;
};
this.addPropertyVisibilityHandler("AttributeOverrides", overridePropertyHandler);
| PropertyVisibilityHandler overridePropertyHandler = () -> {
InheritanceStateType inheritanceState = this.getInheritanceState(true);
|
16,024 | x = 0;
}
NODE_WIDGET_SELECT_PROVIDER.select(widget, null, false);
modelerFile.getModelerScene().getView().scrollRectToVisible(new Rectangle(x, y, widget.getBounds().width, widget.getBounds().height));
JPAFileActionListener.open(modelerFile);
<BUG>});
menuItemList.add(getPropertyMenu());</BUG>
return menuItemList;
}
public void removeColumnWidget(ColumnWidget key) {
| menuItemList.add(drive);
menuItemList.add(getPropertyMenu());
|
16,025 | } catch (NoSuchMethodException | NoSuchFieldException ex) {
this.getModelerScene().getModelerFile().handleException(ex);;
}
}
getJaxbVarTypeProperty(set, this, (JaxbVariableTypeHandler) this.getBaseElementSpec());
<BUG>set.put("BASIC_PROP", getCustomAnnoation(this.getModelerScene(), this.getBaseElementSpec().getAnnotation()));
set.put("BASIC_PROP", getAttributeSnippet(this.getModelerScene(), this.getBaseElementSpec().getSnippets()));
</BUG>
this.addPropertyChangeListener("name", (PropertyChangeListener<String>) (String value) -> {
| set.put("ATTR_PROP", getCustomAnnoation(this.getModelerScene(), this.getBaseElementSpec().getAnnotation()));
set.put("ATTR_PROP", getAttributeSnippet(this.getModelerScene(), this.getBaseElementSpec().getSnippets()));
|
16,026 | public void setAttributeTooltip() {
this.setToolTipText(this.getBaseElementSpec().getDataTypeLabel());
}
public PersistenceClassWidget getClassWidget() {
return (PersistenceClassWidget) this.getPNodeWidget();
<BUG>}
protected void createMapKeyPropertySet(ElementPropertySet set){
Attribute attribute = this.getBaseElementSpec();
if(!(attribute instanceof MapKeyHandler)){
throw new IllegalStateException("BaseElementSpec does not implements MapKeyHandler");
}
MapKeyHandler mapKeyHandler = (MapKeyHandler)attribute;
PropertyVisibilityHandler mapKeyVisibilityHandler = () -> {</BUG>
if(attribute instanceof CollectionTypeHandler){
| public static PropertyVisibilityHandler getMapKeyVisibilityHandler(Attribute attribute){
return () -> {
|
16,027 | package org.netbeans.jpa.modeler.core.widget.attribute.base;
import java.awt.Image;
<BUG>import org.netbeans.jpa.modeler.properties.PropertiesHandler;
import org.netbeans.jpa.modeler.spec.Basic;
import org.netbeans.jpa.modeler.spec.extend.FetchTypeHandler;
</BUG>
import org.netbeans.jpa.modeler.specification.model.scene.JPAModelerScene;
| import static org.netbeans.jpa.modeler.properties.PropertiesHandler.getConvertProperty;
import static org.netbeans.jpa.modeler.properties.PropertiesHandler.getFetchTypeProperty;
import org.netbeans.jpa.modeler.spec.extend.ConvertHandler;
|
16,028 | super(scene, nodeWidget, pinWidgetInfo);
this.setImage(getIcon());
}
@Override
public void createPropertySet(ElementPropertySet set) {
<BUG>super.createPropertySet(set);
set.put("BASIC_PROP", PropertiesHandler.getFetchTypeProperty(this.getModelerScene(), (FetchTypeHandler) this.getBaseElementSpec()));
</BUG>
}
@Override
| set.put("JPA_PROP", getConvertProperty(this, this.getModelerScene(), this.getBaseElementSpec()));
set.put("JPA_PROP", getFetchTypeProperty(this.getModelerScene(), this.getBaseElementSpec()));
|
16,029 | setMappedSuperclasses(new ArrayList<>());
List<EmbeddableAccessor> embeddableAccessors = new ArrayList<>();
embeddableAccessors.addAll(mappings.getEmbeddable().stream().map(EmbeddableSpecAccessor::getInstance).collect(toList()));
embeddableAccessors.addAll(mappings.getDefaultClass().stream().map(DefaultClassSpecAccessor::getInstance).collect(toList()));
setEmbeddables(embeddableAccessors);
<BUG>setMixedConverters(new ArrayList<>());
setConverters(new ArrayList<>());</BUG>
setTypeConverters(new ArrayList<>());
setObjectTypeConverters(new ArrayList<>());
setSerializedConverters(new ArrayList<>());
| setMixedConverters(mappings.getConverter().stream().map(Converter::getAccessor).collect(toList()));
setConverters(new ArrayList<>());
|
16,030 | if (getProject().hasMappedSuperclass(mappedSuperclassClass)) {
getProject().getMappedSuperclassAccessor(mappedSuperclassClass).merge(mappedSuperclass);
} else {
getProject().addMappedSuperclass(mappedSuperclass);
}
<BUG>}
for (ConverterAccessor converterAccessor : getConverterAccessors()) {</BUG>
MetadataClass converterClass = getMetadataClass(getPackageQualifiedClassName(converterAccessor.getClassName()), false);
converterAccessor.initXMLObject(converterClass, this);
if (getProject().hasConverterAccessor(converterClass)) {
| mappings.getConverter().stream().forEach(convert -> createConverterClass(convert, classLoader));
for (ConverterAccessor converterAccessor : getConverterAccessors()) {
|
16,031 | databaseLogin.setPassword(connection.getPassword());
databaseLogin.setDriverClass(connection.getDriverClass());
}
session = new DatabaseSessionImpl(databaseLogin);
JPAMMetadataProcessor processor = new JPAMMetadataProcessor(session, dynamicClassLoader, true, false, true, true, false, null, null);
<BUG>XMLEntityMappings mapping = new DBEntityMappings(entityMapping);
</BUG>
JPAMPersistenceUnitProcessor.processORMetadata(mapping, processor, true, Mode.ALL);
processor.setClassLoader(dynamicClassLoader);
processor.createDynamicClasses();
| XMLEntityMappings mapping = new DBEntityMappings(entityMapping, dynamicClassLoader);
|
16,032 | public MetaEntityProcessor() {
super(MetaEntity.class);
}
public boolean process(TypeSpec.Builder builder, RoundContext context) {
if (MetaScopeProcessor.scopeEntities == null)
<BUG>throw new IllegalStateException("MetaInjectProcessor must follow after MetaScopeProcessor");
TypeElement element = (TypeElement) context.elements().iterator().next();</BUG>
if (element.getKind() != ElementKind.CLASS)
return false;
ClassName elementClassName = ClassName.get(element);
| throw new IllegalStateException("MetaScopeProcessor hasn't been run");
if(context.round() == 1)
return true;
TypeElement element = (TypeElement) context.elements().iterator().next();
|
16,033 | ClassName entityScopeClassName = ClassName.get(scopeElement);
ClassName implOfClassName = ClassName.get(entityScopeClassName.packageName(),
entityScopeClassName.simpleName() + JetaProcessor.METACODE_CLASS_POSTFIX + "." +
MetacodeUtils.getMetaNameOf(env.getElementUtils(), ofTypeStr, "_MetaEntity"));
TypeSpec.Builder implBuilder = TypeSpec.classBuilder("MetaEntityImpl")
<BUG>.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
</BUG>
.addSuperinterface(implOfClassName)
.addMethod(MethodSpec.methodBuilder("getEntityClass")
.addAnnotation(Override.class)
| .addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
16,034 | addProcessor(new SingletonProcessor());
addProcessor(new MultitonProcessor());
addProcessor(new ImplementationProcessor());
addProcessor(new MetaScopeProcessor());
addProcessor(new MetaInjectProcessor());
<BUG>addProcessor(new MetaEntityProcessor());
</BUG>
String addProcessors = properties.getProperty("processors.add");
if (addProcessors != null) {
for (String addProcessor : addProcessors.split(",")) {
| addProcessor(new MetaModuleProcessor());
|
16,035 | }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
<BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh")
.in(() -> task1)</BUG>
.in(() -> task2)
.process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\"")));
}
| return Task.named("exec", "/bin/sh").ofType(Exec.Result.class)
.in(() -> task1)
|
16,036 | return args;
}
static class MyTask {
static final int PLUS = 10;
static Task<String> create(String parameter) {
<BUG>return Task.ofType(String.class).named("MyTask", parameter)
.in(() -> Adder.create(parameter.length(), PLUS))</BUG>
.in(() -> Fib.create(parameter.length()))
.process((sum, fib) -> something(parameter, sum, fib));
}
| return Task.named("MyTask", parameter).ofType(String.class)
.in(() -> Adder.create(parameter.length(), PLUS))
|
16,037 | final String instanceField = "from instance";
final TaskContext context = TaskContext.inmem();
final AwaitingConsumer<String> val = new AwaitingConsumer<>();
@Test
public void shouldJavaUtilSerialize() throws Exception {
<BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39)
.process(() -> 9999L);
Task<String> task2 = Task.ofType(String.class).named("Baz", 40)
.in(() -> task1)</BUG>
.ins(() -> singletonList(task1))
| Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class)
Task<String> task2 = Task.named("Baz", 40).ofType(String.class)
.in(() -> task1)
|
16,038 | assertEquals(des.id().name(), "Baz");
assertEquals(val.awaitAndGet(), "[9999] hello 10004");
}
@Test(expected = NotSerializableException.class)
public void shouldNotSerializeWithInstanceFieldReference() throws Exception {
<BUG>Task<String> task = Task.ofType(String.class).named("WithRef")
.process(() -> instanceField + " causes an outer reference");</BUG>
serialize(task);
}
@Test
| Task<String> task = Task.named("WithRef").ofType(String.class)
.process(() -> instanceField + " causes an outer reference");
|
16,039 | serialize(task);
}
@Test
public void shouldSerializeWithLocalReference() throws Exception {
String local = instanceField;
<BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef")
.process(() -> local + " won't cause an outer reference");</BUG>
serialize(task);
Task<String> des = deserialize();
context.evaluate(des).consume(val);
| Task<String> task = Task.named("WithLocalRef").ofType(String.class)
.process(() -> local + " won't cause an outer reference");
|
16,040 | }
@RootTask
public static Task<String> standardArgs(int first, String second) {
firstInt = first;
secondString = second;
<BUG>return Task.ofType(String.class).named("StandardArgs", first, second)
.process(() -> second + " " + first * 100);</BUG>
}
@Test
public void shouldParseFlags() throws Exception {
| return Task.named("StandardArgs", first, second).ofType(String.class)
.process(() -> second + " " + first * 100);
|
16,041 | assertThat(parsedEnum, is(CustomEnum.BAR));
}
@RootTask
public static Task<String> enums(CustomEnum enm) {
parsedEnum = enm;
<BUG>return Task.ofType(String.class).named("Enums", enm)
.process(enm::toString);</BUG>
}
@Test
public void shouldParseCustomTypes() throws Exception {
| return Task.named("Enums", enm).ofType(String.class)
.process(enm::toString);
|
16,042 | assertThat(parsedType.content, is("blarg parsed for you!"));
}
@RootTask
public static Task<String> customType(CustomType myType) {
parsedType = myType;
<BUG>return Task.ofType(String.class).named("Types", myType.content)
.process(() -> myType.content);</BUG>
}
public enum CustomEnum {
BAR
| return Task.named("Types", myType.content).ofType(String.class)
.process(() -> myType.content);
|
16,043 | TaskContext taskContext = TaskContext.inmem();
TaskContext.Value<Long> value = taskContext.evaluate(fib92);
value.consume(f92 -> System.out.println("fib(92) = " + f92));
}
static Task<Long> create(long n) {
<BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n);
</BUG>
if (n < 2) {
return fib
.process(() -> n);
| TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
|
16,044 | arrayProperty.setItems(innerType);
p = arrayProperty;
} else {
p = propertyFromTypedObject(param);
if (p == null) {
<BUG>System.out.println(String.format(
"WARNING! No property detected for parameter '%s' (%s)! Falling back to string!",</BUG>
param.getName(), param.getParamType()));
p = new StringProperty();
}
| LOGGER.warn(String.format(
"WARNING! No property detected for parameter '%s' (%s)! Falling back to string!",
|
16,045 | Property output = null;
if ("array".equals(type)) {
ArrayProperty am = new ArrayProperty();
Items items = obj.getItems();
if (items == null) {
<BUG>System.out.println("Error! Missing array type for property! Assuming `object` -- please fix your spec");
</BUG>
items = new Items();
items.setType("object");
}
| LOGGER.error("Error! Missing array type for property! Assuming `object` -- please fix your spec");
|
16,046 | for (io.swagger.models.apideclaration.Operation op : ops) {
Operation operation = convertOperation(tag, op, apiDeclaration);
if (op.getMethod() != null) {
path.set(op.getMethod().toString().toLowerCase(), operation);
} else {
<BUG>System.out.println("skipping operation with missing method:\n" + Json.pretty(op));
</BUG>
}
}
}
| LOGGER.info("skipping operation with missing method:\n" + Json.pretty(op));
|
16,047 | fileContents = fileContents.replaceAll("\\.json", ".yaml");
final JsonNode jsonNode = DeserializationUtils.deserializeIntoTree(fileContents, next.toString());
final String yamlOutput = Yaml.mapper().writerWithDefaultPrettyPrinter().writeValueAsString(jsonNode);
final String relativePath = "./" + next.toString().replace(inputDirectory.toString(), "").replace(".json", ".yaml");
final Path outputFile = outputDirectory.resolve(relativePath).normalize();
<BUG>System.out.println(outputFile);
final File file = outputFile.toAbsolutePath().toFile();</BUG>
FileUtils.forceMkdir(outputFile.getParent().toFile());
FileUtils.write(file, yamlOutput);
} catch (IOException e) {
| LOGGER.debug("output file: " + outputFile);
final File file = outputFile.toAbsolutePath().toFile();
|
16,048 | if(inputStream == null) {
inputStream = ClassLoader.getSystemResourceAsStream(location);
}
if(inputStream != null) {
try {
<BUG>final String result = IOUtils.toString(inputStream);
return result;</BUG>
} catch (IOException e) {
throw new RuntimeException("Could not read " + location + " from the classpath", e);
| inputStream = ClasspathHelper.class.getClassLoader().getResourceAsStream(location);
return IOUtils.toString(inputStream);
|
16,049 | import mockit.Injectable;
import mockit.StrictExpectations;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
<BUG>import static org.testng.Assert.assertEquals;
public class ExternalRefProcessorTest {</BUG>
@Injectable
ResolverCache cache;
@Injectable
| import static org.testng.AssertJUnit.assertTrue;
public class ExternalRefProcessorTest {
|
16,050 | import static org.testng.Assert.assertEquals;
public class PathUtilTest {
@Test
public void testGetParentDirectoryOfFile() throws Exception {
final String actualResult = PathUtils.getParentDirectoryOfFile("src/test/resources/parent.json").toString();
<BUG>final String execptedResult = Paths.get("src/test/resources").toAbsolutePath().toString();
assertEquals(actualResult, execptedResult);
</BUG>
}
| final String expectedResult = Paths.get("src/test/resources").toAbsolutePath().toString();
assertEquals(actualResult, expectedResult);
|
16,051 | return output;
}
}
@Override
public Swagger read(String location, List<AuthorizationValue> auths) throws IOException {
<BUG>System.out.println("reading from " + location);
try {</BUG>
String data;
location = location.replaceAll("\\\\","/");
if (location.toLowerCase().startsWith("http")) {
| LOGGER.info("reading from " + location);
try {
|
16,052 | package io.swagger.parser.util;
<BUG>import io.swagger.models.auth.AuthorizationValue;
import java.io.BufferedReader;</BUG>
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
| import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.*;
import java.io.BufferedReader;
|
16,053 | import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
<BUG>import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class RemoteUrl {
private static final String TRUST_ALL = String.format("%s.trustAll", RemoteUrl.class.getName());</BUG>
private static final ConnectionConfigurator CONNECTION_CONFIGURATOR = createConnectionConfigurator();
| static Logger LOGGER = LoggerFactory.getLogger(RemoteUrl.class);
private static final String TRUST_ALL = String.format("%s.trustAll", RemoteUrl.class.getName());
|
16,054 | private static final String ACCEPT_HEADER_VALUE = "application/json, application/yaml, */*";
private static final String USER_AGENT_HEADER_VALUE = "Apache-HttpClient/Swagger";
private static ConnectionConfigurator createConnectionConfigurator() {
if (Boolean.parseBoolean(System.getProperty(TRUST_ALL))) {
try {
<BUG>final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {</BUG>
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
| final TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
|
16,055 | }
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
<BUG>} };
final SSLContext sc = SSLContext.getInstance("SSL");</BUG>
sc.init(null, trustAllCerts, new java.security.SecureRandom());
final SSLSocketFactory sf = sc.getSocketFactory();
final HostnameVerifier trustAllNames = new HostnameVerifier() {
| }};
final SSLContext sc = SSLContext.getInstance("SSL");
|
16,056 | final GL gl = GLContext.getCurrentGL();
if (!transform.isIdentity()) {
synchronized (_transformMatrix) {
transform.getGLApplyMatrix(_transformBuffer);
final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord();
<BUG>JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_MODELVIEW);
gl.getGL2().glPushMatrix();
gl.getGL2().glMultMatrixf(_transformBuffer);
return true;</BUG>
}
| _backgroundColor.set(c);
gl.glClearColor(_backgroundColor.getRed(), _backgroundColor.getGreen(), _backgroundColor.getBlue(),
_backgroundColor.getAlpha());
|
16,057 | return false;
}
public void undoTransforms(final ReadOnlyTransform transform) {
final GL gl = GLContext.getCurrentGL();
final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord();
<BUG>JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_MODELVIEW);
gl.getGL2().glPopMatrix();
}</BUG>
public void setupVertexData(final FloatBufferData vertexBufferData) {
| protected void postdrawGeometry(final Mesh g) {
public void flushGraphics() {
|
16,058 | final FloatBuffer vertexBuffer = vertexBufferData != null ? vertexBufferData.getBuffer() : null;
if (vertexBuffer == null) {
gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
} else {
gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
<BUG>vertexBuffer.rewind();
gl.getGL2().glVertexPointer(vertexBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, vertexBuffer);
}</BUG>
}
| if (gl.isGL2ES1()) {
gl.getGL2ES1().glVertexPointer(vertexBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, vertexBuffer);
|
16,059 | final FloatBuffer normalBuffer = normalBufferData != null ? normalBufferData.getBuffer() : null;
if (normalBuffer == null) {
gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
} else {
gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
<BUG>normalBuffer.rewind();
gl.getGL2().glNormalPointer(GL.GL_FLOAT, 0, normalBuffer);
}</BUG>
}
| if (gl.isGL2ES1()) {
gl.getGL2ES1().glNormalPointer(GL.GL_FLOAT, 0, normalBuffer);
|
16,060 | final FloatBuffer colorBuffer = colorBufferData != null ? colorBufferData.getBuffer() : null;
if (colorBuffer == null) {
gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
} else {
gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY);
<BUG>colorBuffer.rewind();
gl.getGL2().glColorPointer(colorBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, colorBuffer);
}</BUG>
}
| if (gl.isGL2ES1()) {
gl.getGL2ES1().glColorPointer(colorBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, colorBuffer);
|
16,061 | final FloatBuffer fogBuffer = fogBufferData != null ? fogBufferData.getBuffer() : null;
if (fogBuffer == null) {
gl.getGL2GL3().glDisableClientState(GL2.GL_FOG_COORDINATE_ARRAY);
} else {
gl.getGL2GL3().glEnableClientState(GL2.GL_FOG_COORDINATE_ARRAY);
<BUG>fogBuffer.rewind();
gl.getGL2().glFogCoordPointer(GL.GL_FLOAT, 0, fogBuffer);
}</BUG>
}
public void setupTextureData(final List<FloatBufferData> textureCoords) {
| if (gl.isGL2()) {
|
16,062 | final RenderContext context = ContextManager.getCurrentContext();
final RendererRecord rendRecord = context.getRendererRecord();
final int vboID = setupVBO(data, context);
if (vboID != 0) {
gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
<BUG>JoglRendererUtil.setBoundVBO(rendRecord, vboID);
gl.getGL2().glVertexPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0);
} else {</BUG>
gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
| if (gl.isGL2ES1()) {
gl.getGL2ES1().glVertexPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0);
|
16,063 | final RenderContext context = ContextManager.getCurrentContext();
final RendererRecord rendRecord = context.getRendererRecord();
final int vboID = setupVBO(data, context);
if (vboID != 0) {
gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
<BUG>JoglRendererUtil.setBoundVBO(rendRecord, vboID);
gl.getGL2().glNormalPointer(GL.GL_FLOAT, 0, 0);
} else {</BUG>
gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
| gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
if (gl.isGL2ES1()) {
gl.getGL2ES1().glVertexPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0);
|
16,064 | final RenderContext context = ContextManager.getCurrentContext();
final RendererRecord rendRecord = context.getRendererRecord();
final int vboID = setupVBO(data, context);
if (vboID != 0) {
gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY);
<BUG>JoglRendererUtil.setBoundVBO(rendRecord, vboID);
gl.getGL2().glColorPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0);
} else {</BUG>
gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
| gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
if (gl.isGL2ES1()) {
gl.getGL2ES1().glVertexPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0);
|
16,065 | final FloatBufferData textureBufferData = textureCoords.get(i);
updateVBO(textureBufferData, rendRecord, vboID, offsetBytes);
if (!valid || !wasOn) {
enabledTextures |= (2 << i);
gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY);
<BUG>}
gl.getGL2().glTexCoordPointer(textureBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0,
offsetBytes);
offsetBytes += textureBufferData.getBufferLimit() * 4;</BUG>
}
| [DELETED] |
16,066 | gl.glEnable(GL2ES1.GL_CLIP_PLANE0 + planeIndex);
record.planeEnabled[planeIndex] = true;</BUG>
}
record.buf.rewind();
record.buf.put(state.getPlaneEquations(planeIndex));
<BUG>record.buf.flip();
gl.getGL2().glClipPlane(GL2ES1.GL_CLIP_PLANE0 + planeIndex, record.buf);
} else {
if (!record.isValid() || record.planeEnabled[planeIndex]) {
gl.glDisable(GL2ES1.GL_CLIP_PLANE0 + planeIndex);
record.planeEnabled[planeIndex] = false;</BUG>
}
| record.planeEnabled[planeIndex] = true;
if (gl.isGL2ES1()) {
|
16,067 | import org.xwiki.job.script.JobScriptService;
import org.xwiki.model.EntityType;
import org.xwiki.model.reference.DocumentReference;
import org.xwiki.model.reference.EntityReference;
import org.xwiki.model.reference.EntityReferenceProvider;
<BUG>import org.xwiki.model.reference.SpaceReference;
import org.xwiki.refactoring.job.EntityJobStatus;</BUG>
import org.xwiki.refactoring.job.EntityRequest;
import org.xwiki.refactoring.job.MoveRequest;
import org.xwiki.refactoring.job.RefactoringJobs;
| import org.xwiki.refactoring.job.CreateRequest;
import org.xwiki.refactoring.job.EntityJobStatus;
|
16,068 | import com.xpn.xwiki.api.Document;
import com.xpn.xwiki.doc.XWikiDocument;
import com.xpn.xwiki.doc.XWikiLock;
public class SaveAction extends PreviewAction
{
<BUG>public static final String ACTION_NAME = "save";
public SaveAction()</BUG>
{
this.waitForXWikiInitialization = true;
}
| protected static final String ASYNC_PARAM = "async";
public SaveAction()
|
16,069 | public boolean save(XWikiContext context) throws XWikiException
{
XWiki xwiki = context.getWiki();
XWikiRequest request = context.getRequest();
XWikiDocument doc = context.getDoc();
<BUG>XWikiForm form = context.getForm();
</BUG>
int sectionNumber = 0;
if (request.getParameter("section") != null && xwiki.hasSectionEdit(context)) {
sectionNumber = Integer.parseInt(request.getParameter("section"));
| EditForm form = (EditForm) context.getForm();
|
16,070 | int sectionNumber = 0;
if (request.getParameter("section") != null && xwiki.hasSectionEdit(context)) {
sectionNumber = Integer.parseInt(request.getParameter("section"));
}
doc = doc.clone();
<BUG>String language = ((EditForm) form).getLanguage();
XWikiDocument tdoc;</BUG>
if (doc.isNew() || (language == null) || (language.equals("")) || (language.equals("default"))
|| (language.equals(doc.getDefaultLanguage()))) {
tdoc = doc;
| String language = form.getLanguage();
XWikiDocument tdoc;
|
16,071 | doc.setDefaultLocale(LocaleUtils
.toLocale(context.getWiki().getLanguagePreference(context), Locale.ROOT));
}
}
try {
<BUG>tdoc.readFromTemplate(((EditForm) form).getTemplate(), context);
} catch (XWikiException e) {</BUG>
if (e.getCode() == XWikiException.ERROR_XWIKI_APP_DOCUMENT_NOT_EMPTY) {
context.put("exception", e);
return true;
| tdoc.readFromTemplate(form.getTemplate(), context);
} catch (XWikiException e) {
|
16,072 | return true;
}
}
if (sectionNumber != 0) {
XWikiDocument sectionDoc = tdoc.clone();
<BUG>sectionDoc.readFromForm((EditForm) form, context);
String sectionContent = sectionDoc.getContent() + "\n";</BUG>
String content = tdoc.updateDocumentSection(sectionNumber, sectionContent);
tdoc.setContent(content);
tdoc.setComment(sectionDoc.getComment());
| sectionDoc.readFromForm(form, context);
String sectionContent = sectionDoc.getContent() + "\n";
|
16,073 | String content = tdoc.updateDocumentSection(sectionNumber, sectionContent);
tdoc.setContent(content);
tdoc.setComment(sectionDoc.getComment());
tdoc.setMinorEdit(sectionDoc.isMinorEdit());
} else {
<BUG>tdoc.readFromForm((EditForm) form, context);
}</BUG>
String username = context.getUser();
tdoc.setAuthor(username);
if (tdoc.isNew()) {
| tdoc.readFromForm(form, context);
}
|
16,074 | import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.IndexColorModel;
import java.awt.image.RenderedImage;
import java.awt.image.SampleModel;
<BUG>import java.awt.image.WritableRaster;
import java.util.List;</BUG>
import java.util.Map;
import java.util.Vector;
import javax.media.jai.GeometricOpImage;
| import java.util.ArrayList;
import java.util.List;
|
16,075 | super(vectorize(sources), layoutHelper(sources, layout), config, false, null, null);
if (transforms != null) {
if (transforms.size() != sources.size()) {
throw new IllegalArgumentException("Wrong Transformations number");
}
<BUG>this.transforms = transforms;
} else {</BUG>
throw new IllegalArgumentException("No Transformation has been set");
}
int numSrcs = sources.size();
| this.transformObj = optimize(transforms); // optimize transformations
} else {
|
16,076 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
}
return false;
}
<BUG>if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
return false;
Calendar now = Calendar.getInstance();</BUG>
String filename = String.format(
| if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
Calendar now = Calendar.getInstance();
|
16,077 | now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,
now.get(Calendar.DAY_OF_MONTH), now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE), now.get(Calendar.SECOND));
targetFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/MagiskManager/" + filename);
if ((!targetFile.getParentFile().exists() && !targetFile.getParentFile().mkdirs())
<BUG>|| (targetFile.exists() && !targetFile.delete()))
return false;
List<String> in = Utils.readFile(MAGISK_LOG);</BUG>
if (Utils.isValidShellResponse(in)) {
| || (targetFile.exists() && !targetFile.delete())) {
}
List<String> in = Utils.readFile(MAGISK_LOG);
|
16,078 | lastFilter = newText;
appAdapter.filter(newText);
return false;
}
};
<BUG>if (getApplication().magiskHideDone.isTriggered)
onTrigger(getApplication().magiskHideDone);
return view;</BUG>
}
| if (getApplication().magiskHideDone.isTriggered) {
return view;
|
16,079 | import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.CountDownTimer;
<BUG>import android.support.annotation.Nullable;
import android.support.v7.widget.CardView;</BUG>
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
| import android.support.design.widget.Snackbar;
import android.support.v7.widget.CardView;
|
16,080 | import android.widget.CheckBox;
import android.widget.Spinner;
import android.widget.TextView;
import com.topjohnwu.magisk.asyncs.ProcessMagiskZip;
import com.topjohnwu.magisk.components.AlertDialogBuilder;
<BUG>import com.topjohnwu.magisk.components.Fragment;
import com.topjohnwu.magisk.receivers.DownloadReceiver;</BUG>
import com.topjohnwu.magisk.utils.CallbackEvent;
import com.topjohnwu.magisk.utils.Shell;
import com.topjohnwu.magisk.utils.Utils;
| import com.topjohnwu.magisk.components.SnackbarMaker;
import com.topjohnwu.magisk.receivers.DownloadReceiver;
|
16,081 | }
String filename = "Magisk-v" + getApplication().remoteMagiskVersion + ".zip";
</BUG>
new AlertDialogBuilder(getActivity())
.setTitle(getString(R.string.repo_install_title, getString(R.string.magisk)))
.setMessage(getString(R.string.repo_install_msg, filename))
.setCancelable(true)
<BUG>.setPositiveButton(R.string.install, (dialogInterface, i) -> Utils.dlAndReceive(
getActivity(),</BUG>
new DownloadReceiver() {
| })
.setNegativeButton(R.string.no_thanks, null)
.show();
|
16,082 | @Override
public void onTick(long millisUntilFinished) {
progress.setMessage(getString(R.string.reboot_countdown, millisUntilFinished / 1000));
}
@Override
public void onFinish() {
progress.setMessage(getString(R.string.reboot_countdown, 0));
<BUG>Shell.su(true, "cp -af " + uninstaller + " /cache/" + UNINSTALLER,
</BUG>
"reboot");
| public void onStart() {
super.onStart();
getActivity().setTitle(R.string.install);
magiskManager.blockDetectionDone.register(this);
|
16,083 | items.add(0, getString(R.string.auto_detect, getApplication().bootBlock));
ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(),</BUG>
android.R.layout.simple_spinner_item, items);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
toAutoDetect();
}
<BUG>private void toAutoDetect() {
if (getApplication().bootBlock != null) {
spinner.setSelection(0);
}</BUG>
}
| @Override
public void onStart() {
super.onStart();
getActivity().setTitle(R.string.install);
magiskManager.blockDetectionDone.register(this);
|
16,084 | import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
public class DependencyConvergenceReport
extends AbstractProjectInfoReport
<BUG>{
private List reactorProjects;
private static final int PERCENTAGE = 100;</BUG>
public String getOutputName()
{
| private static final int PERCENTAGE = 100;
private static final List SUPPORTED_FONT_FAMILY_NAMES = Arrays.asList( GraphicsEnvironment
.getLocalGraphicsEnvironment().getAvailableFontFamilyNames() );
|
16,085 | sink.section1();
sink.sectionTitle1();
sink.text( getI18nString( locale, "title" ) );
sink.sectionTitle1_();
Map dependencyMap = getDependencyMap();
<BUG>generateLegend( locale, sink );
generateStats( locale, sink, dependencyMap );
generateConvergence( locale, sink, dependencyMap );
sink.section1_();</BUG>
sink.body_();
| sink.lineBreak();
sink.section1_();
|
16,086 | Iterator it = artifactMap.keySet().iterator();
while ( it.hasNext() )
{
String version = (String) it.next();
sink.tableRow();
<BUG>sink.tableCell();
sink.text( version );</BUG>
sink.tableCell_();
sink.tableCell();
generateVersionDetails( sink, artifactMap, version );
| sink.tableCell( String.valueOf( cellWidth ) + "px" );
sink.text( version );
|
16,087 | sink.tableCell();
sink.text( getI18nString( locale, "legend.shared" ) );
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
<BUG>sink.tableCell();
iconError( sink );</BUG>
sink.tableCell_();
sink.tableCell();
sink.text( getI18nString( locale, "legend.different" ) );
| sink.tableCell( "15px" ); // according /images/icon_error_sml.gif
iconError( sink );
|
16,088 | sink.tableCaption();
sink.text( getI18nString( locale, "stats.caption" ) );
sink.tableCaption_();</BUG>
sink.tableRow();
<BUG>sink.tableHeaderCell();
sink.text( getI18nString( locale, "stats.subprojects" ) + ":" );
sink.tableHeaderCell_();</BUG>
sink.tableCell();
sink.text( String.valueOf( reactorProjects.size() ) );
sink.tableCell_();
| sink.bold();
sink.bold_();
sink.tableCaption_();
sink.tableHeaderCell( headerCellWidth );
sink.text( getI18nString( locale, "stats.subprojects" ) );
sink.tableHeaderCell_();
|
16,089 | sink.tableCell();
sink.text( String.valueOf( reactorProjects.size() ) );
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
<BUG>sink.tableHeaderCell();
sink.text( getI18nString( locale, "stats.dependencies" ) + ":" );
sink.tableHeaderCell_();</BUG>
sink.tableCell();
sink.text( String.valueOf( depCount ) );
| sink.tableHeaderCell( headerCellWidth );
sink.text( getI18nString( locale, "stats.dependencies" ) );
sink.tableHeaderCell_();
|
16,090 | sink.text( String.valueOf( convergence ) + "%" );
sink.bold_();
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
<BUG>sink.tableHeaderCell();
sink.text( getI18nString( locale, "stats.readyrelease" ) + ":" );
sink.tableHeaderCell_();</BUG>
sink.tableCell();
if ( convergence >= PERCENTAGE && snapshotCount <= 0 )
| sink.tableHeaderCell( headerCellWidth );
sink.text( getI18nString( locale, "stats.readyrelease" ) );
sink.tableHeaderCell_();
|
16,091 | {
ReverseDependencyLink p1 = (ReverseDependencyLink) o1;
ReverseDependencyLink p2 = (ReverseDependencyLink) o2;
return p1.getProject().getId().compareTo( p2.getProject().getId() );
}
<BUG>else
{</BUG>
return 0;
}
}
| iconError( sink );
|
16,092 | import org.hibernate.cache.CacheProvider;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.dialect.Dialect;
<BUG>import org.hibernate.engine.FilterDefinition;
import org.hibernate.event.EventListeners;</BUG>
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
import org.hibernate.transaction.JTATransactionFactory;
import org.springframework.beans.BeanUtils;
| import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.event.EventListeners;
|
16,093 | logger.info("Updating database schema for Hibernate SessionFactory");
DataSource dataSource = getDataSource();
if (dataSource != null) {
configTimeDataSourceHolder.set(dataSource);
}
<BUG>try {
HibernateTemplate hibernateTemplate = new HibernateTemplate(getSessionFactory());
</BUG>
hibernateTemplate.setFlushMode(HibernateTemplate.FLUSH_NEVER);
hibernateTemplate.execute(
| SessionFactory sessionFactory = getSessionFactory();
final Dialect dialect = ((SessionFactoryImplementor) sessionFactory).getDialect();
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
|
16,094 | import java.util.List;
import java.util.Map;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.ValidationException;
import org.opennms.core.utils.ConfigFileConstants;
<BUG>import org.opennms.core.xml.CastorUtils;
</BUG>
import org.opennms.netmgt.config.opennmsDataSources.DataSourceConfiguration;
import org.opennms.netmgt.config.opennmsDataSources.JdbcDataSource;
import org.slf4j.Logger;
| import org.opennms.core.xml.JaxbUtils;
|
16,095 | package org.opennms.core.db;
import java.io.File;
<BUG>import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.ValidationException;
import org.opennms.core.xml.CastorUtils;
</BUG>
import org.opennms.netmgt.config.opennmsDataSources.ConnectionPool;
| import java.io.InputStreamReader;
import java.io.Reader;
import org.opennms.core.xml.JaxbUtils;
|
16,096 | package org.mule.extension.http.internal.listener;
import static org.mule.extension.http.api.HttpStreamingType.ALWAYS;
<BUG>import static org.mule.extension.http.api.HttpStreamingType.AUTO;
import static org.mule.runtime.module.http.api.HttpConstants.HttpStatus.getReasonPhraseForStatusCode;</BUG>
import static org.mule.runtime.module.http.api.HttpHeaders.Names.CONTENT_LENGTH;
import static org.mule.runtime.module.http.api.HttpHeaders.Names.CONTENT_TYPE;
import static org.mule.runtime.module.http.api.HttpHeaders.Names.TRANSFER_ENCODING;
| import static org.mule.runtime.api.metadata.DataType.BYTE_ARRAY;
import static org.mule.runtime.api.metadata.DataType.OBJECT;
import static org.mule.runtime.module.http.api.HttpConstants.HttpStatus.getReasonPhraseForStatusCode;
|
16,097 | throws MessagingException {
if (logger.isDebugEnabled()) {
logger.debug("Message contains attachments. Ignoring payload and trying to generate multipart response.");
}
final MultipartHttpEntity multipartEntity;
<BUG>try {
multipartEntity = new MultipartHttpEntity(HttpPartDataSource.createFrom(parts));
</BUG>
return new ByteArrayHttpEntity(HttpMultipartEncoder.createMultipartContent(multipartEntity, contentType));
} catch (Exception e) {
| Transformer objectToByteArray = muleContext.getRegistry().lookupTransformer(OBJECT, BYTE_ARRAY);
multipartEntity = new MultipartHttpEntity(HttpPartDataSource.createFrom(partPayload, objectToByteArray));
|
16,098 | @Optional
private Function<Event, String> reasonPhrase;
@Parameter
@Optional
private Function<Event, Map> headersRef;
<BUG>@Parameter
@Optional
private Function<Event, List> partsRef;</BUG>
public Integer getStatusCode(Event event) {
return statusCode != null ? statusCode.apply(event) : null;
| private Function<Event, Integer> statusCode;
|
16,099 | package org.mule.extension.http.api;
<BUG>import static org.mule.runtime.core.config.i18n.I18nMessageFactory.createStaticMessage;
import static org.mule.runtime.core.util.IOUtils.toDataHandler;
import org.mule.runtime.core.api.MuleRuntimeException;</BUG>
import org.mule.runtime.extension.api.annotation.Parameter;
import org.mule.runtime.extension.api.annotation.param.Optional;
| [DELETED] |
16,100 | import org.jfree.chart.event.PlotChangeEvent;
import org.jfree.chart.event.PlotChangeListener;
import org.jfree.chart.renderer.xy.XYItemRenderer;
import org.jfree.chart.util.ParamChecks;
import org.jfree.chart.util.ShadowGenerator;
<BUG>import org.jfree.data.Range;
import org.jfree.ui.RectangleEdge;</BUG>
import org.jfree.ui.RectangleInsets;
import org.jfree.util.ObjectUtilities;
public class CombinedDomainXYPlot extends XYPlot
| import org.jfree.data.general.DatasetChangeEvent;
import org.jfree.data.xy.XYDataset;
import org.jfree.ui.RectangleEdge;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.