id
int64 1
49k
| buggy
stringlengths 34
37.5k
| fixed
stringlengths 2
37k
|
---|---|---|
801 | addTextSimple(stream, textConfig, textX, nextLineY, "");
return nextLineY;
}
try {
<BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText);
</BUG>
float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]);
if (!underline) {
addTextSimple(stream, textConfig, x, nextLineY, split[0]);
} else {
| String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
|
802 | public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
try {
stream.setFont(textConfig.getFont(), textConfig.getFontSize());
stream.setNonStrokingColor(textConfig.getColor());
stream.beginText();
<BUG>stream.newLineAtOffset(textX, textY);
stream.showText(text);</BUG>
} catch (Exception e) {
LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage());
}
| stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY));
stream.showText(text);
|
803 | public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
addTextSimple(stream, textConfig, textX, textY, text);
try {
float lineOffset = textConfig.getFontSize() / 8F;
stream.setStrokingColor(textConfig.getColor());
<BUG>stream.setLineWidth(0.5F);
stream.drawLine(textX, textY - lineOffset, textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
</BUG>
stream.stroke();
} catch (IOException e) {
| stream.moveTo(textX, textY - lineOffset);
stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
|
804 | list.add(text.length());
return list;
}
public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) {
String endPart = "";
<BUG>String shortenedText = text;
List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
if (breakSplitted.size() > 1) {</BUG>
String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0));
StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
| List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
if (breakSplitted.size() > 1) {
|
805 | package cc.catalysts.boot.report.pdf.elements;
import org.apache.pdfbox.pdmodel.PDDocument;
<BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import java.io.IOException;</BUG>
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
| import org.apache.pdfbox.pdmodel.PDPageContentStream;
import java.io.IOException;
|
806 | @Test
public void testProperties() throws IOException, ParserConfigurationException, SAXException, ConfigurationException
{
IEndpointSnitch snitch = new PropertyFileSnitch();
TokenMetadata metadata = new TokenMetadata();
<BUG>createDummyTokens(metadata);
</BUG>
Map<String, String> configOptions = new HashMap<String, String>();
configOptions.put("DC1", "3");
configOptions.put("DC2", "2");
| createDummyTokens(metadata, true);
|
807 | public static Token firstToken(final ArrayList<Token> ring, Token start)
{
return ring.get(firstTokenIndex(ring, start, false));
}
public static Iterator<Token> ringIterator(final ArrayList<Token> ring, Token start, boolean includeMin)
<BUG>{
final boolean insertMin = (includeMin && !ring.get(0).equals(StorageService.getPartitioner().getMinimumToken())) ? true : false;</BUG>
final int startIndex = firstTokenIndex(ring, start, insertMin);
return new AbstractIterator<Token>()
{
| if (ring.isEmpty())
return includeMin ? Iterators.singletonIterator(StorageService.getPartitioner().getMinimumToken())
: Iterators.<Token>emptyIterator();
final boolean insertMin = (includeMin && !ring.get(0).equals(StorageService.getPartitioner().getMinimumToken())) ? true : false;
|
808 | timeWarp = new OwnLabel(getFormattedTimeWrap(), skin, "warp");
timeWarp.setName("time warp");
Container wrapWrapper = new Container(timeWarp);
wrapWrapper.width(60f * GlobalConf.SCALE_FACTOR);
wrapWrapper.align(Align.center);
<BUG>VerticalGroup timeGroup = new VerticalGroup().align(Align.left).space(3 * GlobalConf.SCALE_FACTOR).padTop(3 * GlobalConf.SCALE_FACTOR);
</BUG>
HorizontalGroup dateGroup = new HorizontalGroup();
dateGroup.space(4 * GlobalConf.SCALE_FACTOR);
dateGroup.addActor(date);
| VerticalGroup timeGroup = new VerticalGroup().align(Align.left).columnAlign(Align.left).space(3 * GlobalConf.SCALE_FACTOR).padTop(3 * GlobalConf.SCALE_FACTOR);
|
809 | focusListScrollPane.setFadeScrollBars(false);
focusListScrollPane.setScrollingDisabled(true, false);
focusListScrollPane.setHeight(tree ? 200 * GlobalConf.SCALE_FACTOR : 100 * GlobalConf.SCALE_FACTOR);
focusListScrollPane.setWidth(160);
}
<BUG>VerticalGroup objectsGroup = new VerticalGroup().align(Align.left).space(3 * GlobalConf.SCALE_FACTOR);
</BUG>
objectsGroup.addActor(searchBox);
if (focusListScrollPane != null) {
objectsGroup.addActor(focusListScrollPane);
| VerticalGroup objectsGroup = new VerticalGroup().align(Align.left).columnAlign(Align.left).space(3 * GlobalConf.SCALE_FACTOR);
|
810 | headerGroup.addActor(expandIcon);
headerGroup.addActor(detachIcon);
addActor(headerGroup);
expandIcon.setChecked(expanded);
}
<BUG>public void expand() {
</BUG>
if (!expandIcon.isChecked()) {
expandIcon.setChecked(true);
}
| public void expandPane() {
|
811 | </BUG>
if (!expandIcon.isChecked()) {
expandIcon.setChecked(true);
}
}
<BUG>public void collapse() {
</BUG>
if (expandIcon.isChecked()) {
expandIcon.setChecked(false);
}
| headerGroup.addActor(expandIcon);
headerGroup.addActor(detachIcon);
addActor(headerGroup);
expandIcon.setChecked(expanded);
public void expandPane() {
public void collapsePane() {
|
812 | });
playstop.addListener(new TextTooltip(txt("gui.tooltip.playstop"), skin));
TimeComponent timeComponent = new TimeComponent(skin, ui);
timeComponent.initialize();
CollapsiblePane time = new CollapsiblePane(ui, txt("gui.time"), timeComponent.getActor(), skin, true, playstop);
<BUG>time.align(Align.left);
mainActors.add(time);</BUG>
panes.put(timeComponent.getClass().getSimpleName(), time);
if (Constants.desktop) {
recCamera = new OwnImageButton(skin, "rec");
| time.align(Align.left).columnAlign(Align.left);
mainActors.add(time);
|
813 | panes.put(visualEffectsComponent.getClass().getSimpleName(), visualEffects);
ObjectsComponent objectsComponent = new ObjectsComponent(skin, ui);
objectsComponent.setSceneGraph(sg);
objectsComponent.initialize();
CollapsiblePane objects = new CollapsiblePane(ui, txt("gui.objects"), objectsComponent.getActor(), skin, false);
<BUG>objects.align(Align.left);
mainActors.add(objects);</BUG>
panes.put(objectsComponent.getClass().getSimpleName(), objects);
GaiaComponent gaiaComponent = new GaiaComponent(skin, ui);
gaiaComponent.initialize();
| objects.align(Align.left).columnAlign(Align.left);
mainActors.add(objects);
|
814 | if (Constants.desktop) {
MusicComponent musicComponent = new MusicComponent(skin, ui);
musicComponent.initialize();
Actor[] musicActors = MusicActorsManager.getMusicActors() != null ? MusicActorsManager.getMusicActors().getActors(skin) : null;
CollapsiblePane music = new CollapsiblePane(ui, txt("gui.music"), musicComponent.getActor(), skin, true, musicActors);
<BUG>music.align(Align.left);
mainActors.add(music);</BUG>
panes.put(musicComponent.getClass().getSimpleName(), music);
}
Button switchWebgl = new OwnTextButton(txt("gui.webgl.back"), skin, "link");
| music.align(Align.left).columnAlign(Align.left);
mainActors.add(music);
|
815 | 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 {
|
816 | 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));
|
817 | } 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()
|
818 |
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));
|
819 | 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));
|
820 | 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 {
|
821 | 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);
|
822 | public class RewriteHandlerTest extends AbstractRuleTestCase
{
private RewriteHandler _handler;
private RewritePatternRule _rule1;
private RewritePatternRule _rule2;
<BUG>private RewritePatternRule _rule3;
@Before</BUG>
public void init() throws Exception
{
_handler=new RewriteHandler();
| private RewriteRegexRule _rule4;
@Before
|
823 | _rule2 = new RewritePatternRule();
_rule2.setPattern("/bbb/*");
_rule2.setReplacement("/ccc");
_rule3 = new RewritePatternRule();
_rule3.setPattern("/ccc/*");
<BUG>_rule3.setReplacement("/ddd");
_handler.setRules(new Rule[]{_rule1,_rule2,_rule3});
</BUG>
start(false);
}
| _rule4 = new RewriteRegexRule();
_rule4.setRegex("/xxx/(.*)");
_rule4.setReplacement("/$1/zzz");
_handler.setRules(new Rule[]{_rule1,_rule2,_rule3,_rule4});
|
824 | package org.eclipse.jetty.rewrite.handler;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<BUG>import org.eclipse.jetty.http.PathMap;
import org.eclipse.jetty.util.URIUtil;
public class RewritePatternRule extends PatternRule
</BUG>
{
| import org.eclipse.jetty.server.Request;
public class RewritePatternRule extends PatternRule implements Rule.ApplyURI
|
825 | package org.eclipse.jetty.rewrite.handler;
import java.io.IOException;
import java.util.regex.Matcher;
import javax.servlet.http.HttpServletRequest;
<BUG>import javax.servlet.http.HttpServletResponse;
public class RewriteRegexRule extends RegexRule
</BUG>
{
private String _replacement;
| import org.eclipse.jetty.server.Request;
public class RewriteRegexRule extends RegexRule implements Rule.ApplyURI
|
826 | package org.eclipse.jetty.rewrite.handler;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
<BUG>import javax.servlet.http.HttpServletResponse;
public abstract class Rule
{
protected boolean _terminating;</BUG>
protected boolean _handling;
| import org.eclipse.jetty.server.Request;
public interface ApplyURI
void applyURI(Request request, String oldTarget, String newTarget) throws IOException;
}
protected boolean _terminating;
|
827 | package com.liferay.dynamic.data.mapping.form.evaluator.functions;
<BUG>import com.liferay.dynamic.data.mapping.expression.DDMExpressionFunction;
import com.liferay.portal.kernel.util.Validator;</BUG>
import org.osgi.service.component.annotations.Component;
@Component(
immediate = true, property = "ddm.form.evaluator.function.name=concat",
| import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.Validator;
|
828 | )
public class SumFunction implements DDMExpressionFunction {
@Override
public Object evaluate(Object... parameters) {
if (parameters.length < 2) {
<BUG>throw new IllegalArgumentException(
String.format(
"Expected at least 2 parameters, received %d",
parameters.length));</BUG>
}
| "Two or more parameters are expected");
|
829 | service = DDMExpressionFunction.class
)
public class IsEmailAddressFunction implements DDMExpressionFunction {
@Override
public Object evaluate(Object... parameters) {
<BUG>if (parameters.length != 1) {
throw new IllegalArgumentException(
String.format(
"Expected 1 parameters, received %d", parameters.length));</BUG>
}
| throw new IllegalArgumentException("One parameter is expected");
|
830 | service = DDMExpressionFunction.class
)
public class IsURLFunction implements DDMExpressionFunction {
@Override
public Object evaluate(Object... parameters) {
<BUG>if (parameters.length != 1) {
throw new IllegalArgumentException(
String.format(
"Expected 1 parameters, received %d", parameters.length));</BUG>
}
| throw new IllegalArgumentException("One parameter is expected");
|
831 | import org.opencms.search.CmsSearch;
import org.opencms.search.CmsSearchParameters;
import org.opencms.search.CmsSearchResult;
import org.opencms.search.fields.CmsSearchField;
import org.opencms.util.CmsStringUtil;
<BUG>import org.opencms.workplace.CmsWorkplace;
import org.opencms.workplace.CmsWorkplaceMessages;
import java.io.IOException;</BUG>
import java.util.ArrayList;
import java.util.Collections;
| import org.opencms.workplace.CmsWorkplaceManager;
import org.opencms.workplace.explorer.CmsExplorerTypeSettings;
import java.io.IOException;
|
832 | protected enum JsonKeys {
CATEGORIES("categories"),
CONTENTTYPES("contenttypes"),
ERRORS("errors"),
GALLERIES("galleries"),
<BUG>GALLERYTYPEID("gallerytypeid"),
LEVEL("level"),</BUG>
MATCHESPERPAGE("matchesperpage"),
PAGE("page"),
PATH("path"),
| INFO("info"),
LEVEL("level"),
|
833 | private List<Integer> allFeatures;
private boolean isContinuousEnabled = false;
private int existingTreeSize = 0;
@SuppressWarnings("unused")
private int checkpointInterval;
<BUG>private Path checkpointOutput;
private Configuration conf;</BUG>
private DTMasterParams cpMasterParams;
private int maxBatchSplitSize = 16;
private List<TreeNode> trees;
| private Configuration conf;
|
834 | private Double convergenceThreshold = Double.valueOf(0.0);
private Integer numTrainEpochs = Integer.valueOf(100);
private Integer epochsPerIteration = Integer.valueOf(1);
private Boolean sampleNegOnly = Boolean.FALSE;
private Boolean trainOnDisk = Boolean.FALSE;
<BUG>private Boolean fixInitInput = Boolean.FALSE;
private Boolean isContinuous = Boolean.FALSE;</BUG>
private Boolean isCrossOver = Boolean.FALSE;
private Integer workerThreadCount = 4;
private Double upSampleWeight = Double.valueOf(1d);
| private Boolean stratifiedSample = Boolean.FALSE;
private Boolean isContinuous = Boolean.FALSE;
|
835 | private boolean gbdtSampleWithReplacement = false;
private int trainerId = 0;
private boolean isOneVsAll = false;
private ExecutorService threadPool;
private int workerThreadCount;
<BUG>protected boolean isCrossValidation = false;
</BUG>
private boolean isContinuousEnabled;
private Map<Integer, Map<String, Integer>> columnCategoryIndexMapping;
private Path checkpointOutput;
| protected boolean isManualValidation = false;
|
836 | this.learningRate = Double.valueOf(validParams.get(NNTrainer.LEARNING_RATE).toString());
Object swrObj = validParams.get("GBTSampleWithReplacement");
if(swrObj != null) {
this.gbdtSampleWithReplacement = Boolean.TRUE.toString().equalsIgnoreCase(swrObj.toString());
}
<BUG>}
if(this.isRF || (this.isGBDT && this.gbdtSampleWithReplacement)) {
this.rng = new PoissonDistribution[treeNum];
for(int i = 0; i < treeNum; i++) {
this.rng[i] = new PoissonDistribution(this.modelConfig.getTrain().getBaggingSampleRate());
}
}</BUG>
this.checkpointOutput = new Path(context.getProps().getProperty(
| this.isStratifiedSampling = this.modelConfig.getTrain().getStratifiedSample();
|
837 | Set<Entry<Integer, TreeNode>> treeNodeEntrySet = todoNodes.entrySet();
Iterator<Entry<Integer, TreeNode>> treeNodeIterator = treeNodeEntrySet.iterator();
int roundNodeNumer = treeNodeEntrySet.size() / this.workerThreadCount;
int modeNodeNumber = treeNodeEntrySet.size() % this.workerThreadCount;
int realThreadCount = 0;
<BUG>LOG.info("while todo size {}", todoNodes.size());
</BUG>
for(int i = 0; i < this.workerThreadCount; i++) {
final Map<Integer, TreeNode> localTodoNodes = new HashMap<Integer, TreeNode>();
final Map<Integer, NodeStats> localStatistics = new HashMap<Integer, DTWorkerParams.NodeStats>();
| LOG.debug("while todo size {}", todoNodes.size());
|
838 | Entry<Integer, TreeNode> tmpTreeNode = treeNodeIterator.next();
localTodoNodes.put(tmpTreeNode.getKey(), tmpTreeNode.getValue());
localStatistics.put(tmpTreeNode.getKey(), statistics.get(tmpTreeNode.getKey()));
modeNodeNumber -= 1;
}
<BUG>LOG.info("thread {} todo size {} stats size {} ", i, localTodoNodes.size(), localStatistics.size());
</BUG>
if(localTodoNodes.size() == 0) {
continue;
}
| if(modeNodeNumber > 0) {
LOG.info("Thread {} todo size {} stats size {} ", i, localTodoNodes.size(), localStatistics.size());
|
839 | this.trainingData.append(data);
} else {</BUG>
this.validationData.append(data);
<BUG>}
} else {
if(random.nextDouble() >= validationRate) {
this.trainingData.append(data);
} else {
this.validationData.append(data);
}
}
} else {
this.trainingData.append(data);</BUG>
}
| if(isPositive(data.label)) {
this.positiveTrainCount += 1L;
this.negativeTrainCount += 1L;
|
840 | } finally {
org.apache.commons.io.IOUtils.closeQuietly(stream);
}
return trees;
}
<BUG>private float[] sampleWeights() {
float[] sampleWeights;
if(this.treeNum == 1 || (this.isGBDT && !this.gbdtSampleWithReplacement)) {</BUG>
sampleWeights = new float[1];
| private float[] sampleWeights(float label) {
float[] sampleWeights = null;
double sampleRate = modelConfig.getTrain().getSampleNegOnly() ? 1d : modelConfig.getTrain()
.getBaggingSampleRate();
int classValue = (int) (label + 0.01f);
if(this.treeNum == 1 || (this.isGBDT && !this.gbdtSampleWithReplacement)) {
|
841 | private final Map<VEventType, VEventHandlerElement> eventHandlers;
public VNode(Class<? extends Node> nodeClass,
Map<String, VProperty> properties,
Map<VEventType, VEventHandlerElement> eventHandlers) {
this.nodeClass = Objects.requireNonNull(nodeClass, "Type must not be null");
<BUG>this.properties = properties == null ? HashMap.empty() : properties;
this.eventHandlers = eventHandlers == null ? HashMap.empty() : eventHandlers;
}</BUG>
public Class<? extends Node> getNodeClass() {
return nodeClass;
| this.properties = Objects.requireNonNull(properties, "Properties must not be null");
this.eventHandlers = Objects.requireNonNull(eventHandlers, "EventHandlers must not be null");
}
|
842 | import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import org.apache.commons.lang3.StringUtils;
public class Log {
<BUG>private final static String FEHLER = "Fehler(" + Const.PROGRAMMNAME + "): ";
private static class Error {</BUG>
String cl = "";
int nr = 0;
int count = 0;
| public final static String LILNE = "################################################################################";
private static class Error {
|
843 | sysLog("ImportOLD: " + Config.importOld);
if (Config.nurSenderLaden != null) {
sysLog("Nur Sender laden: " + StringUtils.join(Config.nurSenderLaden, ','));
}
sysLog("");
<BUG>sysLog("##################################################################################");
}</BUG>
public static synchronized void endMsg() {
sysLog("");
sysLog("");
| [DELETED] |
844 | strEx = " ";
}
retList.add(strEx + e.cl + " Fehlernummer: " + e.nr + " Anzahl: " + e.count);
}
}
<BUG>retList.add("##################################################################################");
return retList;</BUG>
}
public static synchronized void errorLog(int fehlerNummer, Exception ex) {
fehlermeldung_(fehlerNummer, ex, new String[]{});
| retList.add(LILNE);
return retList;
|
845 | public final static int VON_NR = 0;
public final static String NACH = "nach";
public final static int NACH_NR = 1;
public final static String[] COLUMN_NAMES = {VON, NACH};
public static final int MAX_ELEM = 2;
<BUG>public LinkedList<String[]> list = new LinkedList<>();
public void init() {
</BUG>
list.clear();
| public static LinkedList<String[]> list = new LinkedList<>();
public static void init() {
|
846 | public void init() {
</BUG>
list.clear();
list.add(new String[]{" ", "_"});
}
<BUG>public String replace(String strCheck, boolean pfad) {
</BUG>
Iterator<String[]> it = list.iterator();
while (it.hasNext()) {
String[] strReplace = it.next();
| public final static int VON_NR = 0;
public final static String NACH = "nach";
public final static int NACH_NR = 1;
public final static String[] COLUMN_NAMES = {VON, NACH};
public static final int MAX_ELEM = 2;
public static LinkedList<String[]> list = new LinkedList<>();
public static void init() {
public static String replace(String strCheck, boolean pfad) {
|
847 | package org.exoplatform.calendar.service.impl;
import java.util.ArrayList;
<BUG>import java.util.HashMap;
import java.util.List;</BUG>
import java.util.Map;
import org.exoplatform.calendar.service.CalendarHandler;
import org.exoplatform.calendar.service.EventHandler;
| import java.util.LinkedList;
import java.util.List;
|
848 | public int getSize() throws Exception {
return events.size();
}
@Override
public Event[] load(int offset, int limit) throws Exception, IllegalArgumentException {
<BUG>return Utils.subList(events, offset, limit).toArray(new Event[limit]);
}</BUG>
};
}
private org.exoplatform.calendar.service.EventQuery buildEvenQuery(EventQuery query) {
| return Utils.subArray(events.toArray(new Event[getSize()]), offset, limit);
|
849 | import org.apache.sling.jcr.resource.JcrResourceConstants;
import org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl;
import org.apache.sling.jcr.resource.internal.helper.MapEntries;
import org.apache.sling.jcr.resource.internal.helper.Mapping;
import org.apache.sling.performance.annotation.PerformanceTestSuite;
<BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG>
import org.junit.runner.RunWith;
| import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
|
850 | @PerformanceTestSuite
public ParameterizedTestList testPerformance() throws Exception {
Helper helper = new Helper();
ParameterizedTestList testCenter = new ParameterizedTestList();
testCenter.setTestSuiteTitle("jcr.resource-2.0.10");
<BUG>testCenter.addTestObject(new ResolveNonExistingWith1000VanityPathTest(helper));
testCenter.addTestObject(new ResolveNonExistingWith5000VanityPathTest(helper));
testCenter.addTestObject(new ResolveNonExistingWith10000VanityPathTest(helper));
testCenter.addTestObject(new ResolveNonExistingWith1000AliasTest(helper));
testCenter.addTestObject(new ResolveNonExistingWith5000AliasTest(helper));
testCenter.addTestObject(new ResolveNonExistingWith10000AliasTest(helper));
</BUG>
return testCenter;
| testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith1000VanityPathTest",helper, 100, 10));
testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith5000VanityPathTest",helper, 100, 50));
testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith10000VanityPathTest",helper, 100, 100));
testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWithManyAliasTest",helper, 1000));
testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith5000AliasTest",helper, 5000));
testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith10000AliasTest",helper, 10000));
|
851 | package org.apache.sling.performance;
<BUG>import static org.mockito.Mockito.*;
import javax.jcr.NamespaceRegistry;</BUG>
import javax.jcr.Session;
import junitx.util.PrivateAccessor;
| import static org.mockito.Mockito.when;
import static org.mockito.Mockito.mock;
import javax.jcr.NamespaceRegistry;
|
852 | import org.apache.sling.jcr.resource.JcrResourceConstants;
import org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl;
import org.apache.sling.jcr.resource.internal.helper.MapEntries;
import org.apache.sling.jcr.resource.internal.helper.Mapping;
import org.apache.sling.performance.annotation.PerformanceTestSuite;
<BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG>
import org.junit.runner.RunWith;
| import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
|
853 | import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.jcr.api.SlingRepository;
import org.apache.sling.jcr.resource.JcrResourceConstants;
import org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory;
import org.apache.sling.performance.annotation.PerformanceTestSuite;
<BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG>
import org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator;
| import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
|
854 | @PerformanceTestSuite
public ParameterizedTestList testPerformance() throws Exception {
Helper helper = new Helper();
ParameterizedTestList testCenter = new ParameterizedTestList();
testCenter.setTestSuiteTitle("jcr.resource-2.2.0");
<BUG>testCenter.addTestObject(new ResolveNonExistingWith1000VanityPathTest(helper));
testCenter.addTestObject(new ResolveNonExistingWith5000VanityPathTest(helper));
testCenter.addTestObject(new ResolveNonExistingWith10000VanityPathTest(helper));
testCenter.addTestObject(new ResolveNonExistingWith1000AliasTest(helper));
testCenter.addTestObject(new ResolveNonExistingWith5000AliasTest(helper));
testCenter.addTestObject(new ResolveNonExistingWith10000AliasTest(helper));
</BUG>
return testCenter;
| testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith1000VanityPathTest",helper, 100, 10));
testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith5000VanityPathTest",helper, 100, 50));
testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith10000VanityPathTest",helper, 100, 100));
testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith1000AliasTest",helper, 1000));
testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith5000AliasTest",helper, 5000));
testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith10000AliasTest",helper, 10000));
|
855 | public ReportElement getBase() {
return base;
}
@Override
public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException {
<BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo);
PDPageContentStream pageStream = new PDPageContentStream(document, currPage, true, false);
</BUG>
base.print(document, pageStream, pageNo, x, y, width);
pageStream.close();
| PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo);
PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
|
856 | public PdfTextStyle(String config) {
Assert.hasText(config);
String[] split = config.split(",");
Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000");
fontSize = Integer.parseInt(split[0]);
<BUG>font = resolveStandard14Name(split[1]);
color = new Color(Integer.valueOf(split[2].substring(1), 16));</BUG>
}
public int getFontSize() {
return fontSize;
| font = getFont(split[1]);
color = new Color(Integer.valueOf(split[2].substring(1), 16));
|
857 | package cc.catalysts.boot.report.pdf.elements;
import cc.catalysts.boot.report.pdf.config.PdfTextStyle;
import cc.catalysts.boot.report.pdf.utils.ReportAlignType;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
<BUG>import org.apache.pdfbox.pdmodel.font.PDFont;
import org.slf4j.Logger;</BUG>
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.io.IOException;
| import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.apache.pdfbox.util.Matrix;
import org.slf4j.Logger;
|
858 | addTextSimple(stream, textConfig, textX, nextLineY, "");
return nextLineY;
}
try {
<BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText);
</BUG>
float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]);
if (!underline) {
addTextSimple(stream, textConfig, x, nextLineY, split[0]);
} else {
| String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
|
859 | public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
try {
stream.setFont(textConfig.getFont(), textConfig.getFontSize());
stream.setNonStrokingColor(textConfig.getColor());
stream.beginText();
<BUG>stream.newLineAtOffset(textX, textY);
stream.showText(text);</BUG>
} catch (Exception e) {
LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage());
}
| stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY));
stream.showText(text);
|
860 | public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
addTextSimple(stream, textConfig, textX, textY, text);
try {
float lineOffset = textConfig.getFontSize() / 8F;
stream.setStrokingColor(textConfig.getColor());
<BUG>stream.setLineWidth(0.5F);
stream.drawLine(textX, textY - lineOffset, textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
</BUG>
stream.stroke();
} catch (IOException e) {
| stream.moveTo(textX, textY - lineOffset);
stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
|
861 | list.add(text.length());
return list;
}
public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) {
String endPart = "";
<BUG>String shortenedText = text;
List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
if (breakSplitted.size() > 1) {</BUG>
String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0));
StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
| List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
if (breakSplitted.size() > 1) {
|
862 | package cc.catalysts.boot.report.pdf.elements;
import org.apache.pdfbox.pdmodel.PDDocument;
<BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import java.io.IOException;</BUG>
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
| import org.apache.pdfbox.pdmodel.PDPageContentStream;
import java.io.IOException;
|
863 | } catch (Exception e) {
throw new GroovyBugError(e);
}
}
private static final MethodType GENERAL_INVOKER_SIGNATURE = MethodType.methodType(Object.class, Object.class, Object[].class);
<BUG>private static final MethodType INVOKE_METHOD_SIGNATURE = MethodType.methodType(Object.class, String.class, Object[].class);
</BUG>
private static final MethodType O2O = MethodType.methodType(Object.class, Object.class);
private static final MethodHandle UNWRAP_METHOD, TO_STRING, TO_BYTE, TO_BIGINT, SAME_MC, IS_NULL, IS_NOT_NULL;
static {
| private static final MethodType INVOKE_METHOD_SIGNATURE = MethodType.methodType(Object.class, Class.class, Object.class, String.class, Object[].class, boolean.class, boolean.class);
|
864 | bindTo(sender).
bindTo(name).
asCollector(Object[].class, type.parameterCount()-1).
asType(type);
return mh;
<BUG>}
private static MetaClass getMetaClass(Object receiver) {</BUG>
if (receiver == null) {
return NullObject.getNullObject().getMetaClass();
} else if (receiver instanceof GroovyObject) {
| private static Class getClass(Object x) {
if (x instanceof Class) return (Class) x;
return x.getClass();
private static MetaClass getMetaClass(Object receiver) {
|
865 | if (receiver == null) {
return NullObject.getNullObject().getMetaClass();
} else if (receiver instanceof GroovyObject) {
return ((GroovyObject) receiver).getMetaClass();
} else {
<BUG>return InvokerHelper.getMetaClass(receiver);
}</BUG>
}
private static class CallInfo {
public Object[] args;
| return GroovySystem.getMetaClassRegistry().getMetaClass(getClass(receiver));
|
866 | private static void chooseMethod(MetaClass mc, CallInfo ci) {
if (mc instanceof MetaClassImpl) {
MetaClassImpl mci = (MetaClassImpl) mc;
Object receiver = ci.args[0];
if (receiver==null) receiver = NullObject.getNullObject();
<BUG>ci.method = mci.getMethodWithCaching(receiver.getClass(), ci.methodName, removeRealReceiver(ci.args), false);
</BUG>
}
}
private static void setMetaClassCallHandleIfNedded(MetaClass mc, CallInfo ci) {
| ci.method = mci.getMethodWithCaching(getClass(receiver), ci.methodName, removeRealReceiver(ci.args), false);
|
867 | ci.useMetaClass = true;
ci.handle = LOOKUP.findVirtual(mc.getClass(), "invokeMethod", INVOKE_METHOD_SIGNATURE);
} catch (Exception e) {
throw new GroovyBugError(e);
}
<BUG>ci.handle = ci.handle.bindTo(mc).
asCollector(Object[].class, ci.targetType.parameterCount()-2);
</BUG>
}
| ci.handle = ci.handle.bindTo(mc).bindTo(ci.sender);
ci.handle = MethodHandles.insertArguments(ci.handle, ci.handle.type().parameterCount()-2, true, false);
ci.handle = MethodHandles.insertArguments(ci.handle, 1, ci.methodName);
ci.handle = ci.handle.asCollector(Object[].class, ci.targetType.parameterCount()-2);
|
868 | CallbackHandler callbackHandler = stsProperties.getCallbackHandler();
RequestData requestData = new RequestData();
requestData.setSigVerCrypto(sigCrypto);
WSSConfig wssConfig = WSSConfig.getNewInstance();
requestData.setWssConfig(wssConfig);
<BUG>requestData.setCallbackHandler(callbackHandler);
WSDocInfo docInfo = new WSDocInfo(((Element)tokenToRenew.getToken()).getOwnerDocument());
assertion.parseSubject(
new WSSSAMLKeyInfoProcessor(requestData, docInfo), sigCrypto, callbackHandler
);</BUG>
SAMLKeyInfo keyInfo = assertion.getSubjectKeyInfo();
| requestData.setWsDocInfo(docInfo);
new WSSSAMLKeyInfoProcessor(requestData), sigCrypto, callbackHandler
|
869 | KeyInfo keyInfo = signature.getKeyInfo();
if (keyInfo != null) {
try {
samlKeyInfo =
SAMLUtil.getCredentialFromKeyInfo(
<BUG>keyInfo.getDOM(), new WSSSAMLKeyInfoProcessor(requestData, new WSDocInfo(doc)), sigCrypto
);</BUG>
} catch (WSSecurityException ex) {
LOG.log(Level.FINE, "Error in getting KeyInfo from SAML Response: " + ex.getMessage(), ex);
throw ex;
| keyInfo.getDOM(), new WSSSAMLKeyInfoProcessor(requestData), sigCrypto
|
870 | LOG.fine("No KeyInfo supplied in the SAMLResponse assertion signature");
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity");
}
assertion.verifySignature(samlKeyInfo);
assertion.parseSubject(
<BUG>new WSSSAMLKeyInfoProcessor(requestData, new WSDocInfo(doc)),
requestData.getSigVerCrypto(),</BUG>
requestData.getCallbackHandler()
);
} catch (WSSecurityException e) {
| new WSSSAMLKeyInfoProcessor(requestData),
requestData.getSigVerCrypto(),
|
871 | WSSConfig wssConfig = WSSConfig.getNewInstance();
requestData.setWssConfig(wssConfig);
requestData.setCallbackHandler(callbackHandler);
requestData.setMsgContext(tokenParameters.getMessageContext());
requestData.setSubjectCertConstraints(certConstraints.getCompiledSubjectContraints());
<BUG>WSDocInfo docInfo = new WSDocInfo(validateTargetElement.getOwnerDocument());
</BUG>
Signature sig = assertion.getSignature();
KeyInfo keyInfo = sig.getKeyInfo();
SAMLKeyInfo samlKeyInfo =
| requestData.setWsDocInfo(new WSDocInfo(validateTargetElement.getOwnerDocument()));
|
872 | EncryptedKeyProcessor processor = new EncryptedKeyProcessor();
Element entropyElement = (Element)entropyObject;
RequestData requestData = new RequestData();
requestData.setDecCrypto(stsProperties.getSignatureCrypto());
requestData.setCallbackHandler(stsProperties.getCallbackHandler());
<BUG>requestData.setWssConfig(WSSConfig.getNewInstance());
try {
List<WSSecurityEngineResult> results =
processor.handleToken(
entropyElement, requestData, new WSDocInfo(entropyElement.getOwnerDocument())
);</BUG>
Entropy entropy = new Entropy();
| requestData.setWsDocInfo(new WSDocInfo(entropyElement.getOwnerDocument()));
processor.handleToken(entropyElement, requestData);
|
873 | WSDocInfo docInfo = new WSDocInfo(child.getOwnerDocument());
RequestData data = new RequestData();
data.setWssConfig(WSSConfig.getNewInstance());
data.setDecCrypto(createCrypto(true));
data.setCallbackHandler(createHandler());
<BUG>List<WSSecurityEngineResult> result =
proc.handleToken(child, data, docInfo);
return</BUG>
(byte[])result.get(0).get(
WSSecurityEngineResult.TAG_SECRET
| data.setWsDocInfo(docInfo);
List<WSSecurityEngineResult> result = proc.handleToken(child, data);
return
|
874 | RequestData requestData = new RequestData();
CallbackHandler callbackHandler = new CommonCallbackHandler();
requestData.setCallbackHandler(callbackHandler);
Crypto crypto = CryptoFactory.getInstance("clientKeystore.properties",
this.getClass().getClassLoader());
<BUG>requestData.setSigVerCrypto(crypto);
Processor processor = new SAMLTokenProcessor();
return processor.handleToken(
token.getToken(), requestData, new WSDocInfo(token.getToken().getOwnerDocument())
);</BUG>
}
| requestData.setWsDocInfo(new WSDocInfo(token.getToken().getOwnerDocument()));
return processor.handleToken(token.getToken(), requestData);
|
875 | } else if (!keyInfoMustBeAvailable) {
samlKeyInfo = createKeyInfoFromDefaultAlias(data.getSigVerCrypto());
}
assertion.verifySignature(samlKeyInfo);
assertion.parseSubject(
<BUG>new WSSSAMLKeyInfoProcessor(data, null), data.getSigVerCrypto(),
data.getCallbackHandler()</BUG>
);
} else if (getTLSCertificates(message) == null) {
throwFault("Assertion must be signed", null);
| new WSSSAMLKeyInfoProcessor(data), data.getSigVerCrypto(),
data.getCallbackHandler()
|
876 | requestData.setDisableBSPEnforcement(true);
CallbackHandler callbackHandler = new org.apache.cxf.systest.sts.common.CommonCallbackHandler();
requestData.setCallbackHandler(callbackHandler);
Crypto crypto = CryptoFactory.getInstance("serviceKeystore.properties");
requestData.setDecCrypto(crypto);
<BUG>requestData.setSigVerCrypto(crypto);
Processor processor = new SAMLTokenProcessor();
return processor.handleToken(
assertionElement, requestData, new WSDocInfo(assertionElement.getOwnerDocument())
);</BUG>
}
| requestData.setWsDocInfo(new WSDocInfo(assertionElement.getOwnerDocument()));
return processor.handleToken(assertionElement, requestData);
|
877 | requestData.setDisableBSPEnforcement(true);
CallbackHandler callbackHandler = new org.apache.cxf.systest.sts.common.CommonCallbackHandler();
requestData.setCallbackHandler(callbackHandler);
Crypto crypto = CryptoFactory.getInstance("serviceKeystore.properties");
requestData.setDecCrypto(crypto);
<BUG>requestData.setSigVerCrypto(crypto);
Processor processor = new SAMLTokenProcessor();
return processor.handleToken(
token.getToken(), requestData, new WSDocInfo(token.getToken().getOwnerDocument())
);</BUG>
}
| requestData.setWsDocInfo(new WSDocInfo(token.getToken().getOwnerDocument()));
return processor.handleToken(token.getToken(), requestData);
|
878 | }
@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)
|
879 | 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))
|
880 | 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)
|
881 | 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");
|
882 | 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");
|
883 | }
@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);
|
884 | 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);
|
885 | 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);
|
886 | 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);
|
887 | DESC {
@Override
public String toString() {
return "desc";
}
<BUG>};
private static final SortOrder PROTOTYPE = ASC;
</BUG>
@Override
public SortOrder readFrom(StreamInput in) throws IOException {
| public static final SortOrder DEFAULT = DESC;
private static final SortOrder PROTOTYPE = DEFAULT;
|
888 | GeoDistance geoDistance = GeoDistance.DEFAULT;
boolean reverse = false;
MultiValueMode sortMode = null;
NestedInnerQueryParseSupport nestedHelper = null;
final boolean indexCreatedBeforeV2_0 = context.indexShard().getIndexSettings().getIndexVersionCreated().before(Version.V_2_0_0);
<BUG>boolean coerce = GeoDistanceSortBuilder.DEFAULT_COERCE;
boolean ignoreMalformed = GeoDistanceSortBuilder.DEFAULT_IGNORE_MALFORMED;
XContentParser.Token token;</BUG>
String currentName = parser.currentName();
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
| boolean coerce = false;
boolean ignoreMalformed = false;
XContentParser.Token token;
|
889 | String currentName = parser.currentName();
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentName = parser.currentName();
} else if (token == XContentParser.Token.START_ARRAY) {
<BUG>GeoDistanceSortBuilder.parseGeoPoints(parser, geoPoints);
fieldName = currentName;</BUG>
} else if (token == XContentParser.Token.START_OBJECT) {
if ("nested_filter".equals(currentName) || "nestedFilter".equals(currentName)) {
if (nestedHelper == null) {
| fieldName = currentName;
|
890 | if (temp == MultiValueMode.SUM) {
throw new IllegalArgumentException("sort_mode [sum] isn't supported for sorting by geo distance");
}</BUG>
this.sortMode = sortMode;
return this;
<BUG>}
public String sortMode() {
return this.sortMode;</BUG>
}
public GeoDistanceSortBuilder setNestedFilter(QueryBuilder nestedFilter) {
| @Override
public GeoDistanceSortBuilder order(SortOrder order) {
this.order = order;
@Override
public SortBuilder missing(Object missing) {
public GeoDistanceSortBuilder sortMode(String sortMode) {
|
891 | builder.field("unit", unit);
builder.field("distance_type", geoDistance.name().toLowerCase(Locale.ROOT));
if (order == SortOrder.DESC) {</BUG>
builder.field("reverse", true);
<BUG>} else {
builder.field("reverse", false);</BUG>
}
if (sortMode != null) {
builder.field("mode", sortMode);
}
| if (geoDistance != null) {
if (order == SortOrder.DESC) {
|
892 | if (Build.VERSION.SDK_INT >= 11)
{
llLauncher.setOnDragListener (new LauncherDragListener (this.apps));
lalTrash.setOnDragListener (new TrashDragListener (this.apps));
}
<BUG>this.startLauncherService (false);
this.apps.addRunningApps (this.chameleonicBgColour);</BUG>
if (this.openDashWhenReady)
this.openDash ();
}
| SharedPreferences prefs = this.getSharedPreferences ("prefs", MODE_PRIVATE);
if (prefs.getBoolean ("launcher_running_show", true))
this.apps.addRunningApps (this.chameleonicBgColour);
|
893 | topic.setLocked(Boolean.FALSE);
topic.setDraft(forum.getDraft());
LOG.debug("createDiscussionForumTopic executed");
return topic;
}
<BUG>public void saveDiscussionForumTopic(DiscussionTopic topic) {
boolean isNew = topic.getId() == null;</BUG>
if (topic.getMutable() == null) {
topic.setMutable(Boolean.FALSE);
}
| saveDiscussionForumTopic(topic, false);
public void saveDiscussionForumTopic(DiscussionTopic topic, boolean parentForumDraftStatus) {
boolean isNew = topic.getId() == null;
|
894 | topic.setModifiedBy(getCurrentUser());
if (topic.getId() == null) {
DiscussionForum discussionForum =
(DiscussionForum) getForumByIdWithTopics(topic.getBaseForum().getId());
discussionForum.addTopic(topic);
<BUG>saveDiscussionForum(discussionForum);
</BUG>
} else {
getHibernateTemplate().saveOrUpdate(topic);
}
| saveDiscussionForum(discussionForum, parentForumDraftStatus);
|
895 | public PrivateForum createPrivateForum(String title);
public void savePrivateForum(PrivateForum forum);
public void saveDiscussionForum(DiscussionForum forum);
public void saveDiscussionForum(DiscussionForum forum, boolean draft);
public DiscussionTopic createDiscussionForumTopic(DiscussionForum forum);
<BUG>public void saveDiscussionForumTopic(DiscussionTopic topic);
public PrivateTopic createPrivateForumTopic(String title, boolean forumIsParent, boolean topicIsMutable, String userId, Long parentId);</BUG>
public void savePrivateForumTopic(PrivateTopic topic);
public void deletePrivateForumTopic(PrivateTopic topic);
public OpenTopic createOpenForumTopic(OpenForum forum);
| public void saveDiscussionForumTopic(DiscussionTopic topic, boolean parentForumDraftStatus);
public PrivateTopic createPrivateForumTopic(String title, boolean forumIsParent, boolean topicIsMutable, String userId, Long parentId);
|
896 | import org.sakaiproject.entity.api.EntityTransferrer;
import org.sakaiproject.entity.api.HttpAccess;
import org.sakaiproject.entity.api.Reference;
import org.sakaiproject.entity.api.ResourceProperties;
import org.sakaiproject.entity.cover.EntityManager;
<BUG>import org.sakaiproject.exception.IdUnusedException;
import org.sakaiproject.content.cover.ContentHostingService;</BUG>
import org.sakaiproject.content.api.ContentResource;
import org.sakaiproject.site.api.Site;
import org.sakaiproject.site.cover.SiteService;
| import org.sakaiproject.component.cover.ServerConfigurationService;
import org.sakaiproject.content.cover.ContentHostingService;
|
897 | Attachment newAttachment = copyAttachment(thisAttach.getAttachmentId());
if (newTopic != null && newAttachment != null)
newTopic.addAttachment(newAttachment);
}
}
<BUG>forumManager.saveDiscussionForumTopic(newTopic);
}</BUG>
}
}
}
| if (newForum != null && newAttachment != null)
newForum.addAttachment(newAttachment);
|
898 | }
}
if(!hasTopic)
{
Area area = areaManager.getDiscusionArea();
<BUG>dfForum.setArea(area);
dfForum.setDraft(new Boolean("false"));
forumManager.saveDiscussionForum(dfForum, false);
}</BUG>
hasTopic = true;
| [DELETED] |
899 | {
super.preInit();
minecraftbyexample.mbe70_configuration.StartupClientOnly.preInitClientOnly();
minecraftbyexample.mbe01_block_simple.StartupClientOnly.preInitClientOnly();
minecraftbyexample.mbe02_block_partial.StartupClientOnly.preInitClientOnly();
<BUG>minecraftbyexample.mbe03_block_variants.StartupClientOnly.preInitClientOnly();
minecraftbyexample.mbe08_creative_tab.StartupClientOnly.preInitClientOnly();</BUG>
minecraftbyexample.mbe10_item_simple.StartupClientOnly.preInitClientOnly();
minecraftbyexample.mbe11_item_variants.StartupClientOnly.preInitClientOnly();
minecraftbyexample.mbe12_item_nbt_animate.StartupClientOnly.preInitClientOnly();
| public void preInit()
minecraftbyexample.mbe06_redstone.StartupClientOnly.preInitClientOnly();
minecraftbyexample.mbe08_creative_tab.StartupClientOnly.preInitClientOnly();
|
900 | public void preInit()
{
minecraftbyexample.mbe70_configuration.StartupCommon.preInitCommon();
minecraftbyexample.mbe01_block_simple.StartupCommon.preInitCommon();
minecraftbyexample.mbe02_block_partial.StartupCommon.preInitCommon();
<BUG>minecraftbyexample.mbe03_block_variants.StartupCommon.preInitCommon();
minecraftbyexample.mbe08_creative_tab.StartupCommon.preInitCommon();</BUG>
minecraftbyexample.mbe10_item_simple.StartupCommon.preInitCommon();
minecraftbyexample.mbe11_item_variants.StartupCommon.preInitCommon();
minecraftbyexample.mbe12_item_nbt_animate.StartupCommon.preInitCommon();
| minecraftbyexample.mbe06_redstone.StartupCommon.preInitCommon();
minecraftbyexample.mbe08_creative_tab.StartupCommon.preInitCommon();
|