before
stringlengths 33
3.21M
| after
stringlengths 63
3.21M
| repo
stringlengths 1
56
| type
stringclasses 1
value | __index_level_0__
int64 0
442k
|
|---|---|---|---|---|
@Override
public void onEnable() {
plugin = this;
PluginDescriptionFile pdf = getDescription();
log.info(pdf.getName() + " version " + pdf.getVersion() + " is now enabled.");
machinaCore = (MachinaCore) getServer().getPluginManager().getPlugin("MachinaCore");
ConfigurationManager config = new ConfigurationManager(this);
ComponentBlueprint.loadConfiguration(config.getAll());
MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.ItemRelay.Blueprint(), me.lyneira.ItemRelay.ItemRelay.class, true);
blueprints.put(new me.lyneira.ItemRelay.Blueprint().getClass(), b);
if (true)
machinaCore.registerBlueprint(new me.lyneira.ItemRelay.Blueprint());
if (b.validEndpoint)
endpointBlueprints.put(new me.lyneira.ItemRelay.Blueprint().getClass(), new me.lyneira.ItemRelay.Blueprint());
MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.Fabricator.Blueprint(this), me.lyneira.Fabricator.Fabricator.class, false);
blueprints.put(new me.lyneira.Fabricator.Blueprint(this).getClass(), b);
if (false)
machinaCore.registerBlueprint(new me.lyneira.Fabricator.Blueprint(this));
if (b.validEndpoint)
endpointBlueprints.put(new me.lyneira.Fabricator.Blueprint(this).getClass(), new me.lyneira.Fabricator.Blueprint(this));
MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.ItemSplitter.Blueprint(), me.lyneira.ItemSplitter.ItemSplitter.class, false);
blueprints.put(new me.lyneira.ItemSplitter.Blueprint().getClass(), b);
if (false)
machinaCore.registerBlueprint(new me.lyneira.ItemSplitter.Blueprint());
if (b.validEndpoint)
endpointBlueprints.put(new me.lyneira.ItemSplitter.Blueprint().getClass(), new me.lyneira.ItemSplitter.Blueprint());
}
|
@Override
public void onEnable() {
plugin = this;
PluginDescriptionFile pdf = getDescription();
log.info(pdf.getName() + " version " + pdf.getVersion() + " is now enabled.");
machinaCore = (MachinaCore) getServer().getPluginManager().getPlugin("MachinaCore");
ConfigurationManager config = new ConfigurationManager(this);
ComponentBlueprint.loadConfiguration(config.getAll());
MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.ItemRelay.Blueprint(), me.lyneira.ItemRelay.ItemRelay.class, true);
blueprints.put(new me.lyneira.ItemRelay.Blueprint().getClass(), b);
if (true)
machinaCore.registerBlueprint(new me.lyneira.ItemRelay.Blueprint());
if (b.validEndpoint)
endpointBlueprints.put(new me.lyneira.ItemRelay.Blueprint().getClass(), new me.lyneira.ItemRelay.Blueprint());
MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.Fabricator.Blueprint(this), me.lyneira.Fabricator.Fabricator.class, false);
blueprints.put(new me.lyneira.Fabricator.Blueprint(this).getClass(), b);
if (false)
machinaCore.registerBlueprint(new me.lyneira.Fabricator.Blueprint(this));
if (b.validEndpoint)
endpointBlueprints.put(new me.lyneira.Fabricator.Blueprint(this).getClass(), new me.lyneira.Fabricator.Blueprint(this));
<DeepExtract>
MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.ItemSplitter.Blueprint(), me.lyneira.ItemSplitter.ItemSplitter.class, false);
blueprints.put(new me.lyneira.ItemSplitter.Blueprint().getClass(), b);
if (false)
machinaCore.registerBlueprint(new me.lyneira.ItemSplitter.Blueprint());
if (b.validEndpoint)
endpointBlueprints.put(new me.lyneira.ItemSplitter.Blueprint().getClass(), new me.lyneira.ItemSplitter.Blueprint());
</DeepExtract>
}
|
MachinaCraft
|
positive
| 234
|
public void destroy() {
if (jobThreadRepository.size() > 0) {
for (Map.Entry<Integer, JobThread> item : jobThreadRepository.entrySet()) {
removeJobThread(item.getKey(), "web container destroy and kill the job.");
}
jobThreadRepository.clear();
}
jobHandlerRepository.clear();
JobLogFileCleanThread.getInstance().toStop();
TriggerCallbackThread.getInstance().toStop();
try {
xxlRpcProviderFactory.stop();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
try {
XxlRpcInvokerFactory.getInstance().stop();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
|
public void destroy() {
if (jobThreadRepository.size() > 0) {
for (Map.Entry<Integer, JobThread> item : jobThreadRepository.entrySet()) {
removeJobThread(item.getKey(), "web container destroy and kill the job.");
}
jobThreadRepository.clear();
}
jobHandlerRepository.clear();
JobLogFileCleanThread.getInstance().toStop();
TriggerCallbackThread.getInstance().toStop();
try {
xxlRpcProviderFactory.stop();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
<DeepExtract>
try {
XxlRpcInvokerFactory.getInstance().stop();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
</DeepExtract>
}
|
taodong-shop
|
positive
| 235
|
public Criteria andProperty_idNotEqualTo(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "property_id" + " cannot be null");
}
criteria.add(new Criterion("property_id <>", value));
return (Criteria) this;
}
|
public Criteria andProperty_idNotEqualTo(Integer value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "property_id" + " cannot be null");
}
criteria.add(new Criterion("property_id <>", value));
</DeepExtract>
return (Criteria) this;
}
|
Tmall_SSM-master
|
positive
| 236
|
@Override
public List<Node> getRows() {
return instruction.getParameters().stream().map(parameter -> {
HBox parameterPane = new HBox(5);
parameterPane.setPrefHeight(20);
parameterPane.setMaxHeight(20);
parameterPane.setMinHeight(20);
parameterPane.setPadding(new Insets(0, 0, 0, 30));
String even = "-even";
if (oddIndex % 2 != 0) {
even = "-odd";
}
parameterPane.getStyleClass().addAll("field-row" + even);
oddIndex++;
FEInstructionParameterField instructionParameter = injector.getInstance(FEInstructionParameterField.class);
instructionParameter.init(parameter);
instructionParameter.setInstruction(instruction);
BorderPane instructionParameterPane = new BorderPane();
instructionParameterPane.setLeft(instructionParameter);
BorderPane labelPane = new BorderPane();
labelPane.setLeft(new Text(parameter.getId()));
labelPane.getStyleClass().addAll("instruction-parameter-label-pane");
parameterPane.getChildren().addAll(labelPane, instructionParameterPane);
return parameterPane;
}).collect(Collectors.toList());
}
|
@Override
public List<Node> getRows() {
<DeepExtract>
return instruction.getParameters().stream().map(parameter -> {
HBox parameterPane = new HBox(5);
parameterPane.setPrefHeight(20);
parameterPane.setMaxHeight(20);
parameterPane.setMinHeight(20);
parameterPane.setPadding(new Insets(0, 0, 0, 30));
String even = "-even";
if (oddIndex % 2 != 0) {
even = "-odd";
}
parameterPane.getStyleClass().addAll("field-row" + even);
oddIndex++;
FEInstructionParameterField instructionParameter = injector.getInstance(FEInstructionParameterField.class);
instructionParameter.init(parameter);
instructionParameter.setInstruction(instruction);
BorderPane instructionParameterPane = new BorderPane();
instructionParameterPane.setLeft(instructionParameter);
BorderPane labelPane = new BorderPane();
labelPane.setLeft(new Text(parameter.getId()));
labelPane.getStyleClass().addAll("instruction-parameter-label-pane");
parameterPane.getChildren().addAll(labelPane, instructionParameterPane);
return parameterPane;
}).collect(Collectors.toList());
</DeepExtract>
}
|
trex-packet-editor
|
positive
| 237
|
@Override
protected void performOperation(GenericCard card) throws CardException {
PrintStream os = System.out;
BigInteger bStart = new BigInteger(Arrays.copyOf(aidBase, aidBase.length + aidDepth));
BigInteger bLimit;
if (aidDepth != 0) {
BigInteger bDepth = BigInteger.valueOf(1 << (aidDepth * 8));
bLimit = bStart.add(bDepth);
} else {
BigInteger bCount = BigInteger.valueOf(aidCount);
bLimit = bStart.add(bCount);
}
os.println("SCANNING NAMES FROM " + HexUtil.bytesToHex(bStart.toByteArray()) + " BELOW " + HexUtil.bytesToHex(bLimit.toByteArray()));
ArrayList<byte[]> found = new ArrayList<>();
for (BigInteger index = bStart; index.compareTo(bLimit) < 0; index = index.add(BigInteger.ONE)) {
byte[] name = index.toByteArray();
if (verbose || (name[name.length - 1] == (byte) 0xFF)) {
os.println(" PROGRESS " + HexUtil.bytesToHex(name));
}
ResponseAPDU rapdu = performSelect(card, name, true);
int sw = rapdu.getSW();
if (sw == 0x9000) {
String foundLog = " FOUND " + HexUtil.bytesToHex(name);
found.add(name);
byte[] data = rapdu.getData();
if (data.length > 0) {
foundLog += " DATA " + HexUtil.bytesToHex(data);
}
os.println(foundLog);
card.reconnect(true);
} else if (sw == ISO7816.SW_FILE_NOT_FOUND) {
continue;
} else {
os.println(" ERROR " + HexUtil.bytesToHex(name) + " " + SW.toString(sw));
card.reconnect(true);
}
}
if (found.isEmpty()) {
os.println(" FOUND NOTHING");
}
if (aidRecurse > 0) {
for (byte[] aid : found) {
scanNames(card, aid, 1, aidRecurse - 1);
}
}
}
|
@Override
protected void performOperation(GenericCard card) throws CardException {
<DeepExtract>
PrintStream os = System.out;
BigInteger bStart = new BigInteger(Arrays.copyOf(aidBase, aidBase.length + aidDepth));
BigInteger bLimit;
if (aidDepth != 0) {
BigInteger bDepth = BigInteger.valueOf(1 << (aidDepth * 8));
bLimit = bStart.add(bDepth);
} else {
BigInteger bCount = BigInteger.valueOf(aidCount);
bLimit = bStart.add(bCount);
}
os.println("SCANNING NAMES FROM " + HexUtil.bytesToHex(bStart.toByteArray()) + " BELOW " + HexUtil.bytesToHex(bLimit.toByteArray()));
ArrayList<byte[]> found = new ArrayList<>();
for (BigInteger index = bStart; index.compareTo(bLimit) < 0; index = index.add(BigInteger.ONE)) {
byte[] name = index.toByteArray();
if (verbose || (name[name.length - 1] == (byte) 0xFF)) {
os.println(" PROGRESS " + HexUtil.bytesToHex(name));
}
ResponseAPDU rapdu = performSelect(card, name, true);
int sw = rapdu.getSW();
if (sw == 0x9000) {
String foundLog = " FOUND " + HexUtil.bytesToHex(name);
found.add(name);
byte[] data = rapdu.getData();
if (data.length > 0) {
foundLog += " DATA " + HexUtil.bytesToHex(data);
}
os.println(foundLog);
card.reconnect(true);
} else if (sw == ISO7816.SW_FILE_NOT_FOUND) {
continue;
} else {
os.println(" ERROR " + HexUtil.bytesToHex(name) + " " + SW.toString(sw));
card.reconnect(true);
}
}
if (found.isEmpty()) {
os.println(" FOUND NOTHING");
}
if (aidRecurse > 0) {
for (byte[] aid : found) {
scanNames(card, aid, 1, aidRecurse - 1);
}
}
</DeepExtract>
}
|
openjavacard-tools
|
positive
| 238
|
@SuppressWarnings("unchecked")
public boolean readFieldBlock(DataInputStream dis, int partSize) {
int flags = HCData.readCode(dis, 1);
super.setVisible(((flags >> 7) & 0x01) == 0);
if (fld != null) {
fld.setVisible(((flags >> 7) & 0x01) == 0);
if (scrollPane != null)
scrollPane.setVisible(((flags >> 7) & 0x01) == 0);
if (!PCARD.lockedScreen) {
PCARD.pc.mainPane.paintImmediately(left, top, width, height);
}
}
dontWrap = ((flags >> 5) & 0x01) != 0;
dontSearch = ((flags >> 4) & 0x01) != 0;
sharedText = ((flags >> 3) & 0x01) != 0;
fixedLineHeight = !(((flags >> 2) & 0x01) != 0);
autoTab = ((flags >> 1) & 0x01) != 0;
enabled = (((flags >> 0) & 0x01) != 0);
top = HCData.readCode(dis, 2);
left = HCData.readCode(dis, 2);
int bottom = HCData.readCode(dis, 2);
height = bottom - top;
int right = HCData.readCode(dis, 2);
width = right - left;
int flags2 = HCData.readCode(dis, 1);
autoSelect = ((flags2 >> 7) & 0x01) != 0;
showLines = ((flags2 >> 6) & 0x01) != 0;
wideMargins = ((flags2 >> 5) & 0x01) != 0;
multipleLines = ((flags2 >> 4) & 0x01) != 0;
int style = HCData.readCode(dis, 1);
switch(style) {
case 0:
this.style = 1;
break;
case 1:
this.style = 2;
break;
case 2:
this.style = 3;
break;
case 4:
this.style = 4;
break;
case 7:
this.style = 5;
break;
}
selectedEnd = HCData.readCode(dis, 2);
selectedStart = HCData.readCode(dis, 2);
selectedLine = selectedStart;
int inTextAlign = HCData.readCode(dis, 2);
switch(inTextAlign) {
case 0:
textAlign = 0;
break;
case 1:
textAlign = 1;
break;
case -1:
textAlign = 2;
break;
}
int textFontID = HCData.readCode(dis, 2);
textSize = HCData.readCode(dis, 2);
textStyle = HCData.readCode(dis, 1);
HCData.readCode(dis, 1);
textHeight = HCData.readCode(dis, 2);
resultStr nameResult = HCData.readTextToZero(dis, partSize - 30);
name = nameResult.str;
resultStr scriptResult = HCData.readText(dis, partSize - 30 - nameResult.length_in_src);
String scriptStr = scriptResult.str;
OStack stack = ((OCardBase) this.parent).stack;
for (int i = 0; i < stack.fontList.size(); i++) {
if (stack.fontList.get(i).id == textFontID) {
textFont = stack.fontList.get(i).name;
break;
}
}
int remainLength = partSize - (30 + (nameResult.length_in_src) + (scriptResult.length_in_src));
if (remainLength < 0 || remainLength > 10) {
}
if (remainLength > 0) {
HCData.readStr(dis, remainLength);
}
String[] scriptAry = scriptStr.split("\n");
for (int i = 0; i < scriptAry.length; i++) {
scriptList.add(scriptAry[i]);
}
stringList = new ArrayList[scriptList.size()];
typeList = new ArrayList[scriptList.size()];
return true;
}
|
@SuppressWarnings("unchecked")
public boolean readFieldBlock(DataInputStream dis, int partSize) {
int flags = HCData.readCode(dis, 1);
<DeepExtract>
super.setVisible(((flags >> 7) & 0x01) == 0);
if (fld != null) {
fld.setVisible(((flags >> 7) & 0x01) == 0);
if (scrollPane != null)
scrollPane.setVisible(((flags >> 7) & 0x01) == 0);
if (!PCARD.lockedScreen) {
PCARD.pc.mainPane.paintImmediately(left, top, width, height);
}
}
</DeepExtract>
dontWrap = ((flags >> 5) & 0x01) != 0;
dontSearch = ((flags >> 4) & 0x01) != 0;
sharedText = ((flags >> 3) & 0x01) != 0;
fixedLineHeight = !(((flags >> 2) & 0x01) != 0);
autoTab = ((flags >> 1) & 0x01) != 0;
enabled = (((flags >> 0) & 0x01) != 0);
top = HCData.readCode(dis, 2);
left = HCData.readCode(dis, 2);
int bottom = HCData.readCode(dis, 2);
height = bottom - top;
int right = HCData.readCode(dis, 2);
width = right - left;
int flags2 = HCData.readCode(dis, 1);
autoSelect = ((flags2 >> 7) & 0x01) != 0;
showLines = ((flags2 >> 6) & 0x01) != 0;
wideMargins = ((flags2 >> 5) & 0x01) != 0;
multipleLines = ((flags2 >> 4) & 0x01) != 0;
int style = HCData.readCode(dis, 1);
switch(style) {
case 0:
this.style = 1;
break;
case 1:
this.style = 2;
break;
case 2:
this.style = 3;
break;
case 4:
this.style = 4;
break;
case 7:
this.style = 5;
break;
}
selectedEnd = HCData.readCode(dis, 2);
selectedStart = HCData.readCode(dis, 2);
selectedLine = selectedStart;
int inTextAlign = HCData.readCode(dis, 2);
switch(inTextAlign) {
case 0:
textAlign = 0;
break;
case 1:
textAlign = 1;
break;
case -1:
textAlign = 2;
break;
}
int textFontID = HCData.readCode(dis, 2);
textSize = HCData.readCode(dis, 2);
textStyle = HCData.readCode(dis, 1);
HCData.readCode(dis, 1);
textHeight = HCData.readCode(dis, 2);
resultStr nameResult = HCData.readTextToZero(dis, partSize - 30);
name = nameResult.str;
resultStr scriptResult = HCData.readText(dis, partSize - 30 - nameResult.length_in_src);
String scriptStr = scriptResult.str;
OStack stack = ((OCardBase) this.parent).stack;
for (int i = 0; i < stack.fontList.size(); i++) {
if (stack.fontList.get(i).id == textFontID) {
textFont = stack.fontList.get(i).name;
break;
}
}
int remainLength = partSize - (30 + (nameResult.length_in_src) + (scriptResult.length_in_src));
if (remainLength < 0 || remainLength > 10) {
}
if (remainLength > 0) {
HCData.readStr(dis, remainLength);
}
String[] scriptAry = scriptStr.split("\n");
for (int i = 0; i < scriptAry.length; i++) {
scriptList.add(scriptAry[i]);
}
stringList = new ArrayList[scriptList.size()];
typeList = new ArrayList[scriptList.size()];
return true;
}
|
HyperZebra
|
positive
| 239
|
public boolean onTouchHandleResize(int id, Window window, View view, MotionEvent event) {
StandOutLayoutParams params = (StandOutLayoutParams) window.getLayoutParams();
switch(event.getAction()) {
case MotionEvent.ACTION_DOWN:
window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();
window.touchInfo.firstX = window.touchInfo.lastX;
window.touchInfo.firstY = window.touchInfo.lastY;
break;
case MotionEvent.ACTION_MOVE:
int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
int deltaY = (int) event.getRawY() - window.touchInfo.lastY;
params.width += deltaX;
params.height += deltaY;
if (params.width >= params.minWidth && params.width <= params.maxWidth) {
window.touchInfo.lastX = (int) event.getRawX();
}
if (params.height >= params.minHeight && params.height <= params.maxHeight) {
window.touchInfo.lastY = (int) event.getRawY();
}
window.edit().setSize(params.width, params.height).commit();
break;
case MotionEvent.ACTION_UP:
break;
}
return true;
}
|
public boolean onTouchHandleResize(int id, Window window, View view, MotionEvent event) {
<DeepExtract>
</DeepExtract>
StandOutLayoutParams params = (StandOutLayoutParams) window.getLayoutParams();
<DeepExtract>
</DeepExtract>
switch(event.getAction()) {
<DeepExtract>
</DeepExtract>
case MotionEvent.ACTION_DOWN:
<DeepExtract>
</DeepExtract>
window.touchInfo.lastX = (int) event.getRawX();
<DeepExtract>
</DeepExtract>
window.touchInfo.lastY = (int) event.getRawY();
<DeepExtract>
</DeepExtract>
window.touchInfo.firstX = window.touchInfo.lastX;
<DeepExtract>
</DeepExtract>
window.touchInfo.firstY = window.touchInfo.lastY;
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
case MotionEvent.ACTION_MOVE:
<DeepExtract>
</DeepExtract>
int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
<DeepExtract>
</DeepExtract>
int deltaY = (int) event.getRawY() - window.touchInfo.lastY;
<DeepExtract>
</DeepExtract>
params.width += deltaX;
<DeepExtract>
</DeepExtract>
params.height += deltaY;
<DeepExtract>
</DeepExtract>
if (params.width >= params.minWidth && params.width <= params.maxWidth) {
<DeepExtract>
</DeepExtract>
window.touchInfo.lastX = (int) event.getRawX();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
if (params.height >= params.minHeight && params.height <= params.maxHeight) {
<DeepExtract>
</DeepExtract>
window.touchInfo.lastY = (int) event.getRawY();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
window.edit().setSize(params.width, params.height).commit();
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
case MotionEvent.ACTION_UP:
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
return true;
<DeepExtract>
</DeepExtract>
}
|
QDict
|
positive
| 240
|
@Override
public void visit(final TypeParameter n, final Void arg) {
if (configuration.isIgnoreComments())
return;
if (n instanceof Comment)
return;
Node parent = n.getParentNode().orElse(null);
if (parent == null)
return;
List<Node> everything = new ArrayList<>(parent.getChildNodes());
sortByBeginPosition(everything);
int positionOfTheChild = -1;
for (int i = 0; i < everything.size(); ++i) {
if (everything.get(i) == n) {
positionOfTheChild = i;
break;
}
}
if (positionOfTheChild == -1) {
throw new AssertionError("I am not a child of my parent.");
}
int positionOfPreviousChild = -1;
for (int i = positionOfTheChild - 1; i >= 0 && positionOfPreviousChild == -1; i--) {
if (!(everything.get(i) instanceof Comment))
positionOfPreviousChild = i;
}
for (int i = positionOfPreviousChild + 1; i < positionOfTheChild; i++) {
Node nodeToPrint = everything.get(i);
if (!(nodeToPrint instanceof Comment)) {
throw new RuntimeException("Expected comment, instead " + nodeToPrint.getClass() + ". Position of previous child: " + positionOfPreviousChild + ", position of child " + positionOfTheChild);
}
nodeToPrint.accept(this, null);
}
n.getComment().ifPresent(c -> c.accept(this, arg));
if (n.getAnnotations().isEmpty()) {
return;
}
if (false) {
printer.print(" ");
}
for (AnnotationExpr annotation : n.getAnnotations()) {
annotation.accept(this, arg);
printer.print(" ");
}
n.getName().accept(this, arg);
if (!isNullOrEmpty(n.getTypeBound())) {
printer.print(" <span class=\"keyword\">extends</span> ");
for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext(); ) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
printer.print(" & ");
}
}
}
}
|
@Override
public void visit(final TypeParameter n, final Void arg) {
if (configuration.isIgnoreComments())
return;
if (n instanceof Comment)
return;
Node parent = n.getParentNode().orElse(null);
if (parent == null)
return;
List<Node> everything = new ArrayList<>(parent.getChildNodes());
sortByBeginPosition(everything);
int positionOfTheChild = -1;
for (int i = 0; i < everything.size(); ++i) {
if (everything.get(i) == n) {
positionOfTheChild = i;
break;
}
}
if (positionOfTheChild == -1) {
throw new AssertionError("I am not a child of my parent.");
}
int positionOfPreviousChild = -1;
for (int i = positionOfTheChild - 1; i >= 0 && positionOfPreviousChild == -1; i--) {
if (!(everything.get(i) instanceof Comment))
positionOfPreviousChild = i;
}
for (int i = positionOfPreviousChild + 1; i < positionOfTheChild; i++) {
Node nodeToPrint = everything.get(i);
if (!(nodeToPrint instanceof Comment)) {
throw new RuntimeException("Expected comment, instead " + nodeToPrint.getClass() + ". Position of previous child: " + positionOfPreviousChild + ", position of child " + positionOfTheChild);
}
nodeToPrint.accept(this, null);
}
n.getComment().ifPresent(c -> c.accept(this, arg));
<DeepExtract>
if (n.getAnnotations().isEmpty()) {
return;
}
if (false) {
printer.print(" ");
}
for (AnnotationExpr annotation : n.getAnnotations()) {
annotation.accept(this, arg);
printer.print(" ");
}
</DeepExtract>
n.getName().accept(this, arg);
if (!isNullOrEmpty(n.getTypeBound())) {
printer.print(" <span class=\"keyword\">extends</span> ");
for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext(); ) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
printer.print(" & ");
}
}
}
}
|
Matcher
|
positive
| 241
|
@Override
public IPv6Address not() {
if (~raw1 == NONE_VAL1 && ~raw2 == NONE_VAL2)
return NONE;
return new IPv6Address(~raw1, ~raw2);
}
|
@Override
public IPv6Address not() {
<DeepExtract>
if (~raw1 == NONE_VAL1 && ~raw2 == NONE_VAL2)
return NONE;
return new IPv6Address(~raw1, ~raw2);
</DeepExtract>
}
|
loxigen
|
positive
| 242
|
@ParameterizedTest
@MethodSource("fromDtoToModelTestCases")
@DisplayName("fromDtoToOptionalModel: when given dto is not null then Optional with equivalent model is returned")
public void fromModelToOptionalDto_whenGivenDtoIsNotNull_thenOptionalOfEquivalentModelIsReturned(IngredientDto dtoToConvert) {
Optional<Ingredient> equivalentModel = converter.fromDtoToOptionalModel(dtoToConvert);
assertTrue(equivalentModel.isPresent());
assertNotNull(equivalentModel.get());
assertNotNull(dtoToConvert);
assertEquals(equivalentModel.get().getId(), dtoToConvert.getId());
assertEquals(equivalentModel.get().getName(), dtoToConvert.getName());
}
|
@ParameterizedTest
@MethodSource("fromDtoToModelTestCases")
@DisplayName("fromDtoToOptionalModel: when given dto is not null then Optional with equivalent model is returned")
public void fromModelToOptionalDto_whenGivenDtoIsNotNull_thenOptionalOfEquivalentModelIsReturned(IngredientDto dtoToConvert) {
Optional<Ingredient> equivalentModel = converter.fromDtoToOptionalModel(dtoToConvert);
assertTrue(equivalentModel.isPresent());
<DeepExtract>
assertNotNull(equivalentModel.get());
assertNotNull(dtoToConvert);
assertEquals(equivalentModel.get().getId(), dtoToConvert.getId());
assertEquals(equivalentModel.get().getName(), dtoToConvert.getName());
</DeepExtract>
}
|
Spring5Microservices
|
positive
| 243
|
private void clickRefreshTableDataActionPerformed(java.awt.event.ActionEvent evt) {
toggleCustomScan.setSelected(false);
clearTogglePane();
try {
DefaultComboBoxModel model = (DefaultComboBoxModel) comboTableList.getModel();
model.removeAllElements();
} catch (Exception e) {
}
String[] tblList = HBaseTableManager.getAllTableNames();
for (String tblListItem : tblList) {
comboTableList.addItem(tblListItem);
}
if (comboTableList.getModel().getSize() > 0) {
comboTableList.setSelectedIndex(0);
AddColoumnList((String) comboTableList.getSelectedItem());
}
labelLoadingData.setVisible(false);
}
|
private void clickRefreshTableDataActionPerformed(java.awt.event.ActionEvent evt) {
<DeepExtract>
toggleCustomScan.setSelected(false);
clearTogglePane();
try {
DefaultComboBoxModel model = (DefaultComboBoxModel) comboTableList.getModel();
model.removeAllElements();
} catch (Exception e) {
}
String[] tblList = HBaseTableManager.getAllTableNames();
for (String tblListItem : tblList) {
comboTableList.addItem(tblListItem);
}
if (comboTableList.getModel().getSize() > 0) {
comboTableList.setSelectedIndex(0);
AddColoumnList((String) comboTableList.getSelectedItem());
}
labelLoadingData.setVisible(false);
</DeepExtract>
}
|
HBase-Manager
|
positive
| 244
|
public void sync_all_stmt(Token label, Token syncKeyword, Token allKeyword, Token eos, boolean hasSyncStatList) {
printRuleHeader(858008, "sync-all-stmt", "");
if (label != null)
printParameter(label, "label");
System.out.print(" ");
if (verbose)
System.out.print("hasSyncStatList" + "=");
System.out.print(hasSyncStatList);
System.out.println();
}
|
public void sync_all_stmt(Token label, Token syncKeyword, Token allKeyword, Token eos, boolean hasSyncStatList) {
printRuleHeader(858008, "sync-all-stmt", "");
if (label != null)
printParameter(label, "label");
System.out.print(" ");
if (verbose)
System.out.print("hasSyncStatList" + "=");
System.out.print(hasSyncStatList);
<DeepExtract>
System.out.println();
</DeepExtract>
}
|
open-fortran-parser
|
positive
| 245
|
private void testSAAJ(String protocol) throws Exception {
MessageFactory factory = MessageFactory.newInstance(protocol);
SOAPMessage requestMessage = factory.createMessage();
SOAPHeader header = requestMessage.getSOAPHeader();
QName headerName = new QName("http://ws-i.org/schemas/conformanceClaim/", "Claim", "wsi");
SOAPHeaderElement headerElement = header.addHeaderElement(headerName);
headerElement.addAttribute(new QName("conformsTo"), "http://ws-i.org/profiles/basic/1.1/");
QName bodyName = new QName("http://wombat.ztrade.com", "GetLastTradePrice", "m");
SOAPBody body = requestMessage.getSOAPBody();
SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
QName name = new QName("symbol");
SOAPElement symbol = bodyElement.addChildElement(name);
symbol.addTextNode("SUNW");
AttachmentPart attachment = requestMessage.createAttachmentPart();
String stringContent = "Update address for Sunny Skies " + "Inc., to 10 Upbeat Street, Pleasant Grove, CA 95439";
attachment.setContent(stringContent, "text/plain");
attachment.setContentId("update_address");
requestMessage.addAttachmentPart(attachment);
URL url = new URL("http://greatproducts.com/gizmos/img.jpg");
DataHandler dataHandler = new DataHandler(url);
AttachmentPart attachment2 = requestMessage.createAttachmentPart(dataHandler);
attachment2.setContentId("attached_image");
requestMessage.addAttachmentPart(attachment2);
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnectionFactory.createConnection();
URL endpoint = new URL("http://wombat.ztrade.com/quotes");
SOAPMessage responseMessage = connection.call(requestMessage, endpoint);
connection.close();
assertAttachmentsAreEqual(requestMessage, responseMessage);
assertSOAPHeadersAreEqual(requestMessage, responseMessage);
assertSOAPBodiesAreEqual(requestMessage, responseMessage);
}
|
private void testSAAJ(String protocol) throws Exception {
MessageFactory factory = MessageFactory.newInstance(protocol);
SOAPMessage requestMessage = factory.createMessage();
SOAPHeader header = requestMessage.getSOAPHeader();
QName headerName = new QName("http://ws-i.org/schemas/conformanceClaim/", "Claim", "wsi");
SOAPHeaderElement headerElement = header.addHeaderElement(headerName);
headerElement.addAttribute(new QName("conformsTo"), "http://ws-i.org/profiles/basic/1.1/");
QName bodyName = new QName("http://wombat.ztrade.com", "GetLastTradePrice", "m");
SOAPBody body = requestMessage.getSOAPBody();
SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
QName name = new QName("symbol");
SOAPElement symbol = bodyElement.addChildElement(name);
symbol.addTextNode("SUNW");
AttachmentPart attachment = requestMessage.createAttachmentPart();
String stringContent = "Update address for Sunny Skies " + "Inc., to 10 Upbeat Street, Pleasant Grove, CA 95439";
attachment.setContent(stringContent, "text/plain");
attachment.setContentId("update_address");
requestMessage.addAttachmentPart(attachment);
URL url = new URL("http://greatproducts.com/gizmos/img.jpg");
DataHandler dataHandler = new DataHandler(url);
AttachmentPart attachment2 = requestMessage.createAttachmentPart(dataHandler);
attachment2.setContentId("attached_image");
requestMessage.addAttachmentPart(attachment2);
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnectionFactory.createConnection();
URL endpoint = new URL("http://wombat.ztrade.com/quotes");
SOAPMessage responseMessage = connection.call(requestMessage, endpoint);
connection.close();
<DeepExtract>
assertAttachmentsAreEqual(requestMessage, responseMessage);
assertSOAPHeadersAreEqual(requestMessage, responseMessage);
assertSOAPBodiesAreEqual(requestMessage, responseMessage);
</DeepExtract>
}
|
appengine-java-vm-runtime
|
positive
| 247
|
@Override
public int getEndNode(int arc) {
int arc = arc;
arc += ADDRESS_OFFSET;
return (data[arc]) << 24 | (data[arc + 1] & 0xff) << 16 | (data[arc + 2] & 0xff) << 8 | (data[arc + 3] & 0xff);
}
|
@Override
public int getEndNode(int arc) {
<DeepExtract>
int arc = arc;
arc += ADDRESS_OFFSET;
return (data[arc]) << 24 | (data[arc + 1] & 0xff) << 16 | (data[arc + 2] & 0xff) << 8 | (data[arc + 3] & 0xff);
</DeepExtract>
}
|
elasticsearch-plugin-bundle
|
positive
| 248
|
@Override
public String toString() {
return this.name + EXT;
}
|
@Override
public String toString() {
<DeepExtract>
return this.name + EXT;
</DeepExtract>
}
|
submerge
|
positive
| 250
|
public Criteria andPasswordNotIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "password" + " cannot be null");
}
criteria.add(new Criterion("password not in", values));
return (Criteria) this;
}
|
public Criteria andPasswordNotIn(List<String> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "password" + " cannot be null");
}
criteria.add(new Criterion("password not in", values));
</DeepExtract>
return (Criteria) this;
}
|
Tmall_SSM
|
positive
| 251
|
@Override
public void setTimeError() {
SnackbarUtils.showShortMessage(mRootLayout, "Invalid " + "time");
}
|
@Override
public void setTimeError() {
<DeepExtract>
SnackbarUtils.showShortMessage(mRootLayout, "Invalid " + "time");
</DeepExtract>
}
|
CleanFit
|
positive
| 252
|
private void resetMatrix() {
mSuppMatrix.reset();
mSuppMatrix.postRotate(mBaseRotation % 360);
checkAndDisplayMatrix();
mImageView.setImageMatrix(getDrawMatrix());
if (mMatrixChangeListener != null) {
RectF displayRect = getDisplayRect(getDrawMatrix());
if (displayRect != null) {
mMatrixChangeListener.onMatrixChanged(displayRect);
}
}
final RectF rect = getDisplayRect(getDrawMatrix());
if (rect == null) {
return false;
}
final float height = rect.height(), width = rect.width();
float deltaX = 0, deltaY = 0;
final int viewHeight = getImageViewHeight(mImageView);
if (height <= viewHeight && rect.top >= 0) {
switch(mScaleType) {
case FIT_START:
deltaY = -rect.top;
break;
case FIT_END:
deltaY = viewHeight - height - rect.top;
break;
default:
deltaY = (viewHeight - height) / 2 - rect.top;
break;
}
mVerticalScrollEdge = VERTICAL_EDGE_BOTH;
} else if (rect.top >= 0) {
mVerticalScrollEdge = VERTICAL_EDGE_TOP;
deltaY = -rect.top;
} else if (rect.bottom <= viewHeight) {
mVerticalScrollEdge = VERTICAL_EDGE_BOTTOM;
deltaY = viewHeight - rect.bottom;
} else {
mVerticalScrollEdge = VERTICAL_EDGE_NONE;
}
final int viewWidth = getImageViewWidth(mImageView);
if (width <= viewWidth && rect.left >= 0) {
switch(mScaleType) {
case FIT_START:
deltaX = -rect.left;
break;
case FIT_END:
deltaX = viewWidth - width - rect.left;
break;
default:
deltaX = (viewWidth - width) / 2 - rect.left;
break;
}
mHorizontalScrollEdge = HORIZONTAL_EDGE_BOTH;
} else if (rect.left >= 0) {
mHorizontalScrollEdge = HORIZONTAL_EDGE_LEFT;
deltaX = -rect.left;
} else if (rect.right <= viewWidth) {
deltaX = viewWidth - rect.right;
mHorizontalScrollEdge = HORIZONTAL_EDGE_RIGHT;
} else {
mHorizontalScrollEdge = HORIZONTAL_EDGE_NONE;
}
mSuppMatrix.postTranslate(deltaX, deltaY);
return true;
}
|
private void resetMatrix() {
mSuppMatrix.reset();
mSuppMatrix.postRotate(mBaseRotation % 360);
checkAndDisplayMatrix();
mImageView.setImageMatrix(getDrawMatrix());
if (mMatrixChangeListener != null) {
RectF displayRect = getDisplayRect(getDrawMatrix());
if (displayRect != null) {
mMatrixChangeListener.onMatrixChanged(displayRect);
}
}
<DeepExtract>
final RectF rect = getDisplayRect(getDrawMatrix());
if (rect == null) {
return false;
}
final float height = rect.height(), width = rect.width();
float deltaX = 0, deltaY = 0;
final int viewHeight = getImageViewHeight(mImageView);
if (height <= viewHeight && rect.top >= 0) {
switch(mScaleType) {
case FIT_START:
deltaY = -rect.top;
break;
case FIT_END:
deltaY = viewHeight - height - rect.top;
break;
default:
deltaY = (viewHeight - height) / 2 - rect.top;
break;
}
mVerticalScrollEdge = VERTICAL_EDGE_BOTH;
} else if (rect.top >= 0) {
mVerticalScrollEdge = VERTICAL_EDGE_TOP;
deltaY = -rect.top;
} else if (rect.bottom <= viewHeight) {
mVerticalScrollEdge = VERTICAL_EDGE_BOTTOM;
deltaY = viewHeight - rect.bottom;
} else {
mVerticalScrollEdge = VERTICAL_EDGE_NONE;
}
final int viewWidth = getImageViewWidth(mImageView);
if (width <= viewWidth && rect.left >= 0) {
switch(mScaleType) {
case FIT_START:
deltaX = -rect.left;
break;
case FIT_END:
deltaX = viewWidth - width - rect.left;
break;
default:
deltaX = (viewWidth - width) / 2 - rect.left;
break;
}
mHorizontalScrollEdge = HORIZONTAL_EDGE_BOTH;
} else if (rect.left >= 0) {
mHorizontalScrollEdge = HORIZONTAL_EDGE_LEFT;
deltaX = -rect.left;
} else if (rect.right <= viewWidth) {
deltaX = viewWidth - rect.right;
mHorizontalScrollEdge = HORIZONTAL_EDGE_RIGHT;
} else {
mHorizontalScrollEdge = HORIZONTAL_EDGE_NONE;
}
mSuppMatrix.postTranslate(deltaX, deltaY);
return true;
</DeepExtract>
}
|
MNImageBrowser
|
positive
| 253
|
public ArgumentAcceptingOptionSpec<V> defaultsTo(V value, V... values) {
ensureNotNull(value);
defaultValues.add(value);
defaultsTo(values);
return this;
}
|
public ArgumentAcceptingOptionSpec<V> defaultsTo(V value, V... values) {
<DeepExtract>
ensureNotNull(value);
defaultValues.add(value);
</DeepExtract>
defaultsTo(values);
return this;
}
|
tlv-comp
|
positive
| 254
|
@Override
public void testSyncResponseBodyValid() throws Exception {
JSONObject folder = new JSONObject();
folder.put(JsonKeys.UPLOAD_LOCATION, "https://upload.location.com/some/path");
InputStream uploadLocationStream = new ByteArrayInputStream(folder.toString().getBytes());
MockHttpEntity uploadLocationEntity = new MockHttpEntity(uploadLocationStream);
StatusLine ok = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "");
MockHttpResponse uploadLocationResponse = new MockHttpResponse(uploadLocationEntity, ok);
this.mockClient.setHttpResponse(uploadLocationResponse);
JSONObject jsonResponseBody = new JSONObject();
jsonResponseBody.put(JsonKeys.ID, FILE_ID);
jsonResponseBody.put(JsonKeys.SOURCE, SOURCE);
InputStream responseStream = new ByteArrayInputStream(jsonResponseBody.toString().getBytes());
MockHttpEntity responseEntity = new MockHttpEntity(responseStream);
StatusLine created = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_CREATED, "");
MockHttpResponse response = new MockHttpResponse(responseEntity, created);
this.mockClient.addHttpResponse(response);
String requestPath = Paths.ME_SKYDRIVE;
LiveOperation operation = this.liveConnectClient.upload(requestPath, FILENAME, FILE);
this.checkOperationMembers(operation, getMethod(), requestPath);
JSONObject result = operation.getResult();
assertEquals(2, result.length());
String id = result.getString(JsonKeys.ID);
assertEquals(FILE_ID, id);
String source = result.getString(JsonKeys.SOURCE);
assertEquals(SOURCE, source);
}
|
@Override
public void testSyncResponseBodyValid() throws Exception {
JSONObject folder = new JSONObject();
folder.put(JsonKeys.UPLOAD_LOCATION, "https://upload.location.com/some/path");
InputStream uploadLocationStream = new ByteArrayInputStream(folder.toString().getBytes());
MockHttpEntity uploadLocationEntity = new MockHttpEntity(uploadLocationStream);
StatusLine ok = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "");
MockHttpResponse uploadLocationResponse = new MockHttpResponse(uploadLocationEntity, ok);
this.mockClient.setHttpResponse(uploadLocationResponse);
JSONObject jsonResponseBody = new JSONObject();
jsonResponseBody.put(JsonKeys.ID, FILE_ID);
jsonResponseBody.put(JsonKeys.SOURCE, SOURCE);
InputStream responseStream = new ByteArrayInputStream(jsonResponseBody.toString().getBytes());
MockHttpEntity responseEntity = new MockHttpEntity(responseStream);
StatusLine created = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_CREATED, "");
MockHttpResponse response = new MockHttpResponse(responseEntity, created);
this.mockClient.addHttpResponse(response);
String requestPath = Paths.ME_SKYDRIVE;
LiveOperation operation = this.liveConnectClient.upload(requestPath, FILENAME, FILE);
this.checkOperationMembers(operation, getMethod(), requestPath);
<DeepExtract>
JSONObject result = operation.getResult();
assertEquals(2, result.length());
String id = result.getString(JsonKeys.ID);
assertEquals(FILE_ID, id);
String source = result.getString(JsonKeys.SOURCE);
assertEquals(SOURCE, source);
</DeepExtract>
}
|
Videos
|
positive
| 255
|
public static boolean moveFile(final File srcFile, final File destFile, final OnReplaceListener listener) {
if (srcFile == null || destFile == null) {
return false;
}
if (srcFile.equals(destFile)) {
return false;
}
if (!srcFile.exists() || !srcFile.isFile()) {
return false;
}
if (destFile.exists()) {
if (listener == null || listener.onReplace()) {
if (!destFile.delete()) {
return false;
}
} else {
return true;
}
}
if (!createOrExistsDir(destFile.getParentFile())) {
return false;
}
try {
return writeFileFromIS(destFile, new FileInputStream(srcFile)) && !(true && !deleteFile(srcFile));
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
}
}
|
public static boolean moveFile(final File srcFile, final File destFile, final OnReplaceListener listener) {
<DeepExtract>
if (srcFile == null || destFile == null) {
return false;
}
if (srcFile.equals(destFile)) {
return false;
}
if (!srcFile.exists() || !srcFile.isFile()) {
return false;
}
if (destFile.exists()) {
if (listener == null || listener.onReplace()) {
if (!destFile.delete()) {
return false;
}
} else {
return true;
}
}
if (!createOrExistsDir(destFile.getParentFile())) {
return false;
}
try {
return writeFileFromIS(destFile, new FileInputStream(srcFile)) && !(true && !deleteFile(srcFile));
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
}
</DeepExtract>
}
|
Jetpack-From-Java-To-Kotlin
|
positive
| 256
|
public void onClick(ClickEvent clickEvent) {
GWT.log("Removing: " + displayItem.getWidget(0).getElement().getInnerHTML(), null);
itemsSelected.remove(displayItem.getWidget(0).getElement().getInnerHTML());
list.remove(displayItem);
fireComponentResized();
}
|
public void onClick(ClickEvent clickEvent) {
<DeepExtract>
GWT.log("Removing: " + displayItem.getWidget(0).getElement().getInnerHTML(), null);
itemsSelected.remove(displayItem.getWidget(0).getElement().getInnerHTML());
list.remove(displayItem);
fireComponentResized();
</DeepExtract>
}
|
osw-web
|
positive
| 257
|
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public void onGlobalLayout() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
mapView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
} else {
mapView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
isViewReady = true;
if (isViewReady && isMapReady) {
devCallback.onMapReady(googleMap);
}
}
|
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public void onGlobalLayout() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
mapView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
} else {
mapView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
isViewReady = true;
<DeepExtract>
if (isViewReady && isMapReady) {
devCallback.onMapReady(googleMap);
}
</DeepExtract>
}
|
android-samples
|
positive
| 258
|
@SmallTest
public void testStartsLocationServicesStartsMainServiceIfNotRunning() throws Exception {
ActivityManager manager = mock(ActivityManager.class);
ArrayList<ActivityManager.RunningServiceInfo> runningServices = new ArrayList<ActivityManager.RunningServiceInfo>();
ActivityManager.RunningServiceInfo info = new ActivityManager.RunningServiceInfo();
info.service = new ComponentName(MainService.class.getPackage().getName(), GPSStatus.class.getName());
runningServices.add(info);
when(manager.getRunningServices(Integer.MAX_VALUE)).thenReturn(runningServices);
when(_mockContext.getSystemService(getContext().ACTIVITY_SERVICE)).thenReturn(manager);
_serviceStarter.startLocationServices();
verify(_mockContext, atLeast(1)).startService(any(Intent.class));
}
|
@SmallTest
public void testStartsLocationServicesStartsMainServiceIfNotRunning() throws Exception {
<DeepExtract>
ActivityManager manager = mock(ActivityManager.class);
ArrayList<ActivityManager.RunningServiceInfo> runningServices = new ArrayList<ActivityManager.RunningServiceInfo>();
ActivityManager.RunningServiceInfo info = new ActivityManager.RunningServiceInfo();
info.service = new ComponentName(MainService.class.getPackage().getName(), GPSStatus.class.getName());
runningServices.add(info);
when(manager.getRunningServices(Integer.MAX_VALUE)).thenReturn(runningServices);
when(_mockContext.getSystemService(getContext().ACTIVITY_SERVICE)).thenReturn(manager);
</DeepExtract>
_serviceStarter.startLocationServices();
verify(_mockContext, atLeast(1)).startService(any(Intent.class));
}
|
JayPS-AndroidApp
|
positive
| 259
|
@Override
public void handleSuccess(AuthenticationResponse successResponse) {
String relayState = successResponse.getRelayState();
String dest = relayState != null ? relayState : "/troopers";
log(successResponse);
try {
Subject subject = SecurityUtils.getSubject();
HttpServletResponse response = WebUtils.getHttpResponse(subject);
setAuthNResult(successResponse);
response.sendRedirect(dest);
} catch (IOException e) {
throw new IllegalStateException("failed to redirect.", e);
}
}
|
@Override
public void handleSuccess(AuthenticationResponse successResponse) {
String relayState = successResponse.getRelayState();
String dest = relayState != null ? relayState : "/troopers";
<DeepExtract>
log(successResponse);
try {
Subject subject = SecurityUtils.getSubject();
HttpServletResponse response = WebUtils.getHttpResponse(subject);
setAuthNResult(successResponse);
response.sendRedirect(dest);
} catch (IOException e) {
throw new IllegalStateException("failed to redirect.", e);
}
</DeepExtract>
}
|
okta-auth-java
|
positive
| 260
|
public static byte[] encode(byte[] input, int offset, int len, int flags) {
Encoder encoder = new Encoder(flags, null);
int output_len = len / 3 * 4;
if (encoder.do_padding) {
if (len % 3 > 0) {
output_len += 4;
}
} else {
switch(len % 3) {
case 0:
break;
case 1:
output_len += 2;
break;
case 2:
output_len += 3;
break;
}
}
if (encoder.do_newline && len > 0) {
output_len += (((len - 1) / (3 * Encoder.LINE_GROUPS)) + 1) * (encoder.do_cr ? 2 : 1);
}
encoder.output = new byte[output_len];
if (this.state == 6)
return false;
int p = offset;
len += offset;
int state = this.state;
int value = this.value;
int op = 0;
final byte[] output = this.output;
final int[] alphabet = this.alphabet;
while (p < len) {
if (state == 0) {
while (p + 4 <= len && (value = ((alphabet[input[p] & 0xff] << 18) | (alphabet[input[p + 1] & 0xff] << 12) | (alphabet[input[p + 2] & 0xff] << 6) | (alphabet[input[p + 3] & 0xff]))) >= 0) {
output[op + 2] = (byte) value;
output[op + 1] = (byte) (value >> 8);
output[op] = (byte) (value >> 16);
op += 3;
p += 4;
}
if (p >= len)
break;
}
int d = alphabet[input[p++] & 0xff];
switch(state) {
case 0:
if (d >= 0) {
value = d;
++state;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 1:
if (d >= 0) {
value = (value << 6) | d;
++state;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 2:
if (d >= 0) {
value = (value << 6) | d;
++state;
} else if (d == EQUALS) {
output[op++] = (byte) (value >> 4);
state = 4;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 3:
if (d >= 0) {
value = (value << 6) | d;
output[op + 2] = (byte) value;
output[op + 1] = (byte) (value >> 8);
output[op] = (byte) (value >> 16);
op += 3;
state = 0;
} else if (d == EQUALS) {
output[op + 1] = (byte) (value >> 2);
output[op] = (byte) (value >> 10);
op += 2;
state = 5;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 4:
if (d == EQUALS) {
++state;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 5:
if (d != SKIP) {
this.state = 6;
return false;
}
break;
}
}
if (!true) {
this.state = state;
this.value = value;
this.op = op;
return true;
}
switch(state) {
case 0:
break;
case 1:
this.state = 6;
return false;
case 2:
output[op++] = (byte) (value >> 4);
break;
case 3:
output[op++] = (byte) (value >> 10);
output[op++] = (byte) (value >> 2);
break;
case 4:
this.state = 6;
return false;
case 5:
break;
}
this.state = state;
this.op = op;
return true;
assert encoder.op == output_len;
return encoder.output;
}
|
public static byte[] encode(byte[] input, int offset, int len, int flags) {
Encoder encoder = new Encoder(flags, null);
int output_len = len / 3 * 4;
if (encoder.do_padding) {
if (len % 3 > 0) {
output_len += 4;
}
} else {
switch(len % 3) {
case 0:
break;
case 1:
output_len += 2;
break;
case 2:
output_len += 3;
break;
}
}
if (encoder.do_newline && len > 0) {
output_len += (((len - 1) / (3 * Encoder.LINE_GROUPS)) + 1) * (encoder.do_cr ? 2 : 1);
}
encoder.output = new byte[output_len];
<DeepExtract>
if (this.state == 6)
return false;
int p = offset;
len += offset;
int state = this.state;
int value = this.value;
int op = 0;
final byte[] output = this.output;
final int[] alphabet = this.alphabet;
while (p < len) {
if (state == 0) {
while (p + 4 <= len && (value = ((alphabet[input[p] & 0xff] << 18) | (alphabet[input[p + 1] & 0xff] << 12) | (alphabet[input[p + 2] & 0xff] << 6) | (alphabet[input[p + 3] & 0xff]))) >= 0) {
output[op + 2] = (byte) value;
output[op + 1] = (byte) (value >> 8);
output[op] = (byte) (value >> 16);
op += 3;
p += 4;
}
if (p >= len)
break;
}
int d = alphabet[input[p++] & 0xff];
switch(state) {
case 0:
if (d >= 0) {
value = d;
++state;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 1:
if (d >= 0) {
value = (value << 6) | d;
++state;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 2:
if (d >= 0) {
value = (value << 6) | d;
++state;
} else if (d == EQUALS) {
output[op++] = (byte) (value >> 4);
state = 4;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 3:
if (d >= 0) {
value = (value << 6) | d;
output[op + 2] = (byte) value;
output[op + 1] = (byte) (value >> 8);
output[op] = (byte) (value >> 16);
op += 3;
state = 0;
} else if (d == EQUALS) {
output[op + 1] = (byte) (value >> 2);
output[op] = (byte) (value >> 10);
op += 2;
state = 5;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 4:
if (d == EQUALS) {
++state;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 5:
if (d != SKIP) {
this.state = 6;
return false;
}
break;
}
}
if (!true) {
this.state = state;
this.value = value;
this.op = op;
return true;
}
switch(state) {
case 0:
break;
case 1:
this.state = 6;
return false;
case 2:
output[op++] = (byte) (value >> 4);
break;
case 3:
output[op++] = (byte) (value >> 10);
output[op++] = (byte) (value >> 2);
break;
case 4:
this.state = 6;
return false;
case 5:
break;
}
this.state = state;
this.op = op;
return true;
</DeepExtract>
assert encoder.op == output_len;
return encoder.output;
}
|
TerminalEmulator-Android
|
positive
| 261
|
private void enqueuePendingVideo(Video video) {
mPendingVideo.offer(video);
notifyDataSetChanged();
while (mSyncingVideos.size() < MAX_QUEUE && !mPendingVideo.isEmpty()) {
Video v = mPendingVideo.poll();
mSyncingVideos.add(v);
notifyDataSetChanged();
if (v.isLocalVideo())
mActivity.uploadVideo(v);
else
mActivity.downloadVideo(v);
}
}
|
private void enqueuePendingVideo(Video video) {
mPendingVideo.offer(video);
notifyDataSetChanged();
<DeepExtract>
while (mSyncingVideos.size() < MAX_QUEUE && !mPendingVideo.isEmpty()) {
Video v = mPendingVideo.poll();
mSyncingVideos.add(v);
notifyDataSetChanged();
if (v.isLocalVideo())
mActivity.uploadVideo(v);
else
mActivity.downloadVideo(v);
}
</DeepExtract>
}
|
Zecorder
|
positive
| 262
|
@Override
public void accept(Page page) throws Exception {
log.info(page.getUrl());
if (request.getAfterRequest() != null) {
request.getAfterRequest().process(page);
}
newRequestLock.lock();
try {
newRequestCondition.signalAll();
} finally {
newRequestLock.unlock();
}
}
|
@Override
public void accept(Page page) throws Exception {
log.info(page.getUrl());
if (request.getAfterRequest() != null) {
request.getAfterRequest().process(page);
}
<DeepExtract>
newRequestLock.lock();
try {
newRequestCondition.signalAll();
} finally {
newRequestLock.unlock();
}
</DeepExtract>
}
|
NetDiscovery
|
positive
| 263
|
@Override
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
if (mException != null) {
throw new ExecutionException(mException);
}
if (mResultReceived) {
return mResult;
}
if (TimeUnit.MILLISECONDS.convert(timeout, unit) == null) {
wait(0);
} else if (TimeUnit.MILLISECONDS.convert(timeout, unit) > 0) {
wait(TimeUnit.MILLISECONDS.convert(timeout, unit));
}
if (mException != null) {
throw new ExecutionException(mException);
}
if (!mResultReceived) {
throw new TimeoutException();
}
return mResult;
}
|
@Override
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
<DeepExtract>
if (mException != null) {
throw new ExecutionException(mException);
}
if (mResultReceived) {
return mResult;
}
if (TimeUnit.MILLISECONDS.convert(timeout, unit) == null) {
wait(0);
} else if (TimeUnit.MILLISECONDS.convert(timeout, unit) > 0) {
wait(TimeUnit.MILLISECONDS.convert(timeout, unit));
}
if (mException != null) {
throw new ExecutionException(mException);
}
if (!mResultReceived) {
throw new TimeoutException();
}
return mResult;
</DeepExtract>
}
|
BaoDian
|
positive
| 264
|
@Override
protected void notifyFocusLost(int virtualId) {
AccessibilityEvent event = AccessibilityEvent.obtain();
event.setEventType(AccessibilityEvent.TYPE_VIEW_FOCUSED);
event.setSource(this, virtualId);
event.setEnabled(true);
event.setPackageName(getContext().getPackageName());
if (VERBOSE) {
Log.v(TAG, "sendAccessibilityEvent(" + AccessibilityEvent.TYPE_VIEW_FOCUSED + ", " + virtualId + "): " + event);
}
getContext().getSystemService(AccessibilityManager.class).sendAccessibilityEvent(event);
}
|
@Override
protected void notifyFocusLost(int virtualId) {
<DeepExtract>
AccessibilityEvent event = AccessibilityEvent.obtain();
event.setEventType(AccessibilityEvent.TYPE_VIEW_FOCUSED);
event.setSource(this, virtualId);
event.setEnabled(true);
event.setPackageName(getContext().getPackageName());
if (VERBOSE) {
Log.v(TAG, "sendAccessibilityEvent(" + AccessibilityEvent.TYPE_VIEW_FOCUSED + ", " + virtualId + "): " + event);
}
getContext().getSystemService(AccessibilityManager.class).sendAccessibilityEvent(event);
</DeepExtract>
}
|
android-AutofillFramework
|
positive
| 266
|
@Test
public void testEngineMap() {
EngineMap emap = new EngineMap(sc);
int[] percents = { -200, -100, -50, -25, 0, 25, 50, 100, 200 };
int[] expectedServoPos = { 120, 120, 122, 122, 130, 140, 143, 147, 147, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147 };
double[] expectedValues = { -2.2, -2.2, -1.7, -1.4, 0.0, 1.4, 1.7, 2.2, 2.2, -2.2, -1.9, -1.5, -1.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 1.9, 2.0, 2.1, 2.2 };
ServoPosition cpos = emap.getCurrentPosition();
assertEquals(0, cpos.getValue(), 0.0001);
int index = 0;
for (int percent : percents) {
emap.newPosition(emap.atPercent(percent));
cpos = emap.getCurrentPosition();
if (debug)
System.out.println(emap.positionInfo());
String hint = String.format("expected %.1f%s (%3d) at index %3d", expectedValues[index], emap.getUnit(), expectedServoPos[index], index);
assertEquals(hint, expectedServoPos[index], cpos.getServoPos());
assertEquals(hint, expectedValues[index], cpos.getValue(), 0.05);
index++;
}
emap.newPosition(emap.getRange().getMin());
int maxPos = emap.getRange().getMax().getServoPos();
while (emap.getCurrentPosition().getServoPos() < maxPos) {
if (debug)
System.out.println(emap.positionInfo());
cpos = emap.getCurrentPosition();
String hint = String.format("expected %.1f%s (%3d) at index %3d", expectedValues[index], emap.getUnit(), expectedServoPos[index], index);
assertEquals(hint, expectedServoPos[index], cpos.getServoPos());
assertEquals(hint, expectedValues[index], cpos.getValue(), 0.05);
index++;
emap.step(1);
}
}
|
@Test
public void testEngineMap() {
EngineMap emap = new EngineMap(sc);
int[] percents = { -200, -100, -50, -25, 0, 25, 50, 100, 200 };
int[] expectedServoPos = { 120, 120, 122, 122, 130, 140, 143, 147, 147, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147 };
double[] expectedValues = { -2.2, -2.2, -1.7, -1.4, 0.0, 1.4, 1.7, 2.2, 2.2, -2.2, -1.9, -1.5, -1.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 1.9, 2.0, 2.1, 2.2 };
<DeepExtract>
ServoPosition cpos = emap.getCurrentPosition();
assertEquals(0, cpos.getValue(), 0.0001);
int index = 0;
for (int percent : percents) {
emap.newPosition(emap.atPercent(percent));
cpos = emap.getCurrentPosition();
if (debug)
System.out.println(emap.positionInfo());
String hint = String.format("expected %.1f%s (%3d) at index %3d", expectedValues[index], emap.getUnit(), expectedServoPos[index], index);
assertEquals(hint, expectedServoPos[index], cpos.getServoPos());
assertEquals(hint, expectedValues[index], cpos.getValue(), 0.05);
index++;
}
emap.newPosition(emap.getRange().getMin());
int maxPos = emap.getRange().getMax().getServoPos();
while (emap.getCurrentPosition().getServoPos() < maxPos) {
if (debug)
System.out.println(emap.positionInfo());
cpos = emap.getCurrentPosition();
String hint = String.format("expected %.1f%s (%3d) at index %3d", expectedValues[index], emap.getUnit(), expectedServoPos[index], index);
assertEquals(hint, expectedServoPos[index], cpos.getServoPos());
assertEquals(hint, expectedValues[index], cpos.getValue(), 0.05);
index++;
emap.step(1);
}
</DeepExtract>
}
|
dukes
|
positive
| 267
|
private void requestAllTransitModes() {
mQueuedTransitModes.clear();
mQueuedTransitModes.addAll(Arrays.asList(mAllTransitModes));
Location origin = null;
if (mUsingLastKnownLocation) {
if (locationServicesEnabled()) {
origin = VoterInformation.getLastKnownLocation();
} else if (getView() != null) {
getView().toggleEnableGlobalLocationView(true);
}
} else {
origin = new Location();
origin.lat = (float) VoterInformation.getHomeAddress().getLocation().latitude;
origin.lng = (float) VoterInformation.getHomeAddress().getLocation().longitude;
}
if (origin != null) {
String directionsAPIKey = mContext.getString(R.string.google_api_android_key);
for (String transitMode : mQueuedTransitModes) {
enqueueRequest(directionsAPIKey, transitMode, origin);
}
}
}
|
private void requestAllTransitModes() {
mQueuedTransitModes.clear();
mQueuedTransitModes.addAll(Arrays.asList(mAllTransitModes));
<DeepExtract>
Location origin = null;
if (mUsingLastKnownLocation) {
if (locationServicesEnabled()) {
origin = VoterInformation.getLastKnownLocation();
} else if (getView() != null) {
getView().toggleEnableGlobalLocationView(true);
}
} else {
origin = new Location();
origin.lat = (float) VoterInformation.getHomeAddress().getLocation().latitude;
origin.lng = (float) VoterInformation.getHomeAddress().getLocation().longitude;
}
if (origin != null) {
String directionsAPIKey = mContext.getString(R.string.google_api_android_key);
for (String transitMode : mQueuedTransitModes) {
enqueueRequest(directionsAPIKey, transitMode, origin);
}
}
</DeepExtract>
}
|
android-white-label-app
|
positive
| 268
|
@Override
public void run() {
InfluxDBClient dbClient = new InfluxDBClient();
TSDBData[] tsdbData = null;
String parameterQuery = "SELECT * FROM events";
;
String dbname = Loader.getSettings().getMcnSettings().getMCNDBEventsName();
tsdbData = dbClient.query(parameterQuery, dbname);
HashMap<String, ArrayList<String>> clientInstanceMap = getInstanceIdsPerClientId(tsdbData);
createUDRRecords(clientInstanceMap);
}
|
@Override
public void run() {
<DeepExtract>
InfluxDBClient dbClient = new InfluxDBClient();
TSDBData[] tsdbData = null;
String parameterQuery = "SELECT * FROM events";
;
String dbname = Loader.getSettings().getMcnSettings().getMCNDBEventsName();
tsdbData = dbClient.query(parameterQuery, dbname);
HashMap<String, ArrayList<String>> clientInstanceMap = getInstanceIdsPerClientId(tsdbData);
createUDRRecords(clientInstanceMap);
</DeepExtract>
}
|
cyclops-udr
|
positive
| 269
|
@Override
public void init(Element container, Element content) {
this.content = content;
svgElement = createSVGElementNS("svg");
setAttributeNS(svgElement, "width", "110%");
setAttributeNS(svgElement, "height", "110%");
setAttributeNS(svgElement, "preserveAspectRatio", "none");
Element defs = createSVGElementNS("defs");
svgElement.appendChild(defs);
pattern = createSVGElementNS("pattern");
setAttributeNS(pattern, "id", "bggrid-pattern");
setAttributeNS(pattern, "patternUnits", "userSpaceOnUse");
setAttributeNS(pattern, "x", "0");
setAttributeNS(pattern, "y", "0");
defs.appendChild(pattern);
Element rect = createSVGElementNS("rect");
setAttributeNS(rect, "width", "100%");
setAttributeNS(rect, "height", "100%");
setAttributeNS(rect, "fill", "#ffffff");
pattern.appendChild(rect);
path = createSVGElementNS("path");
setAttributeNS(path, "shape-rendering", "crispEdges");
setAttributeNS(path, "fill-opacity", "0");
setAttributeNS(path, "stroke-width", "1");
setAttributeNS(path, "stroke", "#cccccc");
pattern.appendChild(path);
Element rect2 = createSVGElementNS("rect");
setAttributeNS(rect2, "width", "100%");
setAttributeNS(rect2, "height", "100%");
setAttributeNS(rect2, "fill", "url(#bggrid-pattern)");
svgElement.appendChild(rect2);
setAttributeNS(svgElement, "class", STYLE_BG_GRID);
content.insertFirst(svgElement);
}
|
@Override
public void init(Element container, Element content) {
this.content = content;
svgElement = createSVGElementNS("svg");
setAttributeNS(svgElement, "width", "110%");
setAttributeNS(svgElement, "height", "110%");
setAttributeNS(svgElement, "preserveAspectRatio", "none");
Element defs = createSVGElementNS("defs");
svgElement.appendChild(defs);
pattern = createSVGElementNS("pattern");
setAttributeNS(pattern, "id", "bggrid-pattern");
setAttributeNS(pattern, "patternUnits", "userSpaceOnUse");
setAttributeNS(pattern, "x", "0");
setAttributeNS(pattern, "y", "0");
defs.appendChild(pattern);
Element rect = createSVGElementNS("rect");
setAttributeNS(rect, "width", "100%");
setAttributeNS(rect, "height", "100%");
setAttributeNS(rect, "fill", "#ffffff");
pattern.appendChild(rect);
path = createSVGElementNS("path");
setAttributeNS(path, "shape-rendering", "crispEdges");
setAttributeNS(path, "fill-opacity", "0");
setAttributeNS(path, "stroke-width", "1");
setAttributeNS(path, "stroke", "#cccccc");
pattern.appendChild(path);
Element rect2 = createSVGElementNS("rect");
setAttributeNS(rect2, "width", "100%");
setAttributeNS(rect2, "height", "100%");
setAttributeNS(rect2, "fill", "url(#bggrid-pattern)");
svgElement.appendChild(rect2);
setAttributeNS(svgElement, "class", STYLE_BG_GRID);
<DeepExtract>
content.insertFirst(svgElement);
</DeepExtract>
}
|
gantt
|
positive
| 270
|
public static void main(String[] args) {
ParseResult result = Autumn.parse(root, "{ \"test\" : // }", ParseOptions.get());
if (result.fullMatch) {
System.out.println(result.toString());
} else {
System.out.println(result.toString(new LineMapString("<test>", "{ \"test\" : // }"), false));
System.out.println(result.userErrorString(new LineMapString("<test>", "{ \"test\" : // }")));
}
}
|
public static void main(String[] args) {
<DeepExtract>
ParseResult result = Autumn.parse(root, "{ \"test\" : // }", ParseOptions.get());
if (result.fullMatch) {
System.out.println(result.toString());
} else {
System.out.println(result.toString(new LineMapString("<test>", "{ \"test\" : // }"), false));
System.out.println(result.userErrorString(new LineMapString("<test>", "{ \"test\" : // }")));
}
</DeepExtract>
}
|
autumn
|
positive
| 271
|
private void buildTablesWithOneSheet(List<Table> tables) {
String sheetName = this.getRealSheetName(tables.get(0).caption);
Sheet sheet = workbook.getSheet(sheetName);
if (sheet == null) {
sheet = workbook.createSheet(sheetName);
}
if (tables.size() > 1) {
List<Tr> trList = tables.get(0).trList;
int lastRowNum = 0;
if (!trList.isEmpty()) {
lastRowNum = trList.get(trList.size() - 1).index;
}
for (int i = 1; i < tables.size(); i++) {
for (Tr tr : tables.get(i).trList) {
this.updateTrIndex(tr, ++lastRowNum);
trList.add(tr);
}
tables.set(i, null);
}
}
Table table = tables.get(0);
boolean hasTd = table.trList.stream().map(tr -> tr.tdList).anyMatch(list -> !list.isEmpty());
if (!hasTd) {
return;
}
int maxColIndex = 0;
if (WidthStrategy.isAutoWidth(widthStrategy) && !table.trList.isEmpty()) {
maxColIndex = table.trList.parallelStream().mapToInt(tr -> tr.tdList.stream().mapToInt(td -> td.col).max().orElse(0)).max().orElse(0);
}
Map<Integer, Integer> colMaxWidthMap = this.getColMaxWidthMap(table.trList);
for (int i = 0, size = table.trList.size(); i < size; i++) {
Tr tr = table.trList.get(i);
this.createRow(tr, sheet);
tr.tdList = null;
}
stagingTds = new LinkedList<>();
table.trList = null;
this.setColWidth(colMaxWidthMap, sheet, maxColIndex);
this.freezePane(0, sheet);
}
|
private void buildTablesWithOneSheet(List<Table> tables) {
String sheetName = this.getRealSheetName(tables.get(0).caption);
Sheet sheet = workbook.getSheet(sheetName);
if (sheet == null) {
sheet = workbook.createSheet(sheetName);
}
if (tables.size() > 1) {
List<Tr> trList = tables.get(0).trList;
int lastRowNum = 0;
if (!trList.isEmpty()) {
lastRowNum = trList.get(trList.size() - 1).index;
}
for (int i = 1; i < tables.size(); i++) {
for (Tr tr : tables.get(i).trList) {
this.updateTrIndex(tr, ++lastRowNum);
trList.add(tr);
}
tables.set(i, null);
}
}
Table table = tables.get(0);
boolean hasTd = table.trList.stream().map(tr -> tr.tdList).anyMatch(list -> !list.isEmpty());
if (!hasTd) {
return;
}
<DeepExtract>
int maxColIndex = 0;
if (WidthStrategy.isAutoWidth(widthStrategy) && !table.trList.isEmpty()) {
maxColIndex = table.trList.parallelStream().mapToInt(tr -> tr.tdList.stream().mapToInt(td -> td.col).max().orElse(0)).max().orElse(0);
}
Map<Integer, Integer> colMaxWidthMap = this.getColMaxWidthMap(table.trList);
for (int i = 0, size = table.trList.size(); i < size; i++) {
Tr tr = table.trList.get(i);
this.createRow(tr, sheet);
tr.tdList = null;
}
stagingTds = new LinkedList<>();
table.trList = null;
this.setColWidth(colMaxWidthMap, sheet, maxColIndex);
</DeepExtract>
this.freezePane(0, sheet);
}
|
myexcel
|
positive
| 272
|
public final static String decrypt(String data, String key) {
if (key == null || key.length() == 0) {
key = "00000000";
}
int y = key.length() % 8;
if (y != 0) {
StringBuilder keyBuilder = new StringBuilder(key);
for (int i = 0; i < 8 - y; i++) {
keyBuilder.append('0');
}
key = keyBuilder.toString();
}
return key;
return new String(decrypt(hex2byte(data.getBytes()), key.getBytes()));
}
|
public final static String decrypt(String data, String key) {
<DeepExtract>
if (key == null || key.length() == 0) {
key = "00000000";
}
int y = key.length() % 8;
if (y != 0) {
StringBuilder keyBuilder = new StringBuilder(key);
for (int i = 0; i < 8 - y; i++) {
keyBuilder.append('0');
}
key = keyBuilder.toString();
}
return key;
</DeepExtract>
return new String(decrypt(hex2byte(data.getBytes()), key.getBytes()));
}
|
markdown-image-kit
|
positive
| 274
|
@Override
public void onClick(View v) {
getActivity().onBackPressed();
}
|
@Override
public void onClick(View v) {
<DeepExtract>
getActivity().onBackPressed();
</DeepExtract>
}
|
MyKeep
|
positive
| 276
|
@Override
public boolean execute(final String sql, final String[] columnNames) throws SQLException {
if (isClosed)
throw new SQLAlreadyClosedException(this.getClass().getSimpleName());
return false;
}
|
@Override
public boolean execute(final String sql, final String[] columnNames) throws SQLException {
<DeepExtract>
if (isClosed)
throw new SQLAlreadyClosedException(this.getClass().getSimpleName());
</DeepExtract>
return false;
}
|
mongo-jdbc-driver
|
positive
| 277
|
private void goToBackup() {
mStage = Stage.PASSWORD;
switch(mStage) {
case FINGERPRINT:
mCancelButton.setText(R.string.cancel);
mSecondDialogButton.setText(R.string.use_password);
mFingerprintContent.setVisibility(View.VISIBLE);
mBackupContent.setVisibility(View.GONE);
break;
case NEW_FINGERPRINT_ENROLLED:
case PASSWORD:
mCancelButton.setText(R.string.cancel);
mSecondDialogButton.setText(R.string.ok);
mFingerprintContent.setVisibility(View.GONE);
mBackupContent.setVisibility(View.VISIBLE);
if (mStage == Stage.NEW_FINGERPRINT_ENROLLED) {
mPasswordDescriptionTextView.setVisibility(View.GONE);
mNewFingerprintEnrolledTextView.setVisibility(View.VISIBLE);
mUseFingerprintFutureCheckBox.setVisibility(View.VISIBLE);
}
break;
}
mPassword.requestFocus();
mPassword.postDelayed(mShowKeyboardRunnable, 500);
mFingerprintUiHelper.stopListening();
}
|
private void goToBackup() {
mStage = Stage.PASSWORD;
<DeepExtract>
switch(mStage) {
case FINGERPRINT:
mCancelButton.setText(R.string.cancel);
mSecondDialogButton.setText(R.string.use_password);
mFingerprintContent.setVisibility(View.VISIBLE);
mBackupContent.setVisibility(View.GONE);
break;
case NEW_FINGERPRINT_ENROLLED:
case PASSWORD:
mCancelButton.setText(R.string.cancel);
mSecondDialogButton.setText(R.string.ok);
mFingerprintContent.setVisibility(View.GONE);
mBackupContent.setVisibility(View.VISIBLE);
if (mStage == Stage.NEW_FINGERPRINT_ENROLLED) {
mPasswordDescriptionTextView.setVisibility(View.GONE);
mNewFingerprintEnrolledTextView.setVisibility(View.VISIBLE);
mUseFingerprintFutureCheckBox.setVisibility(View.VISIBLE);
}
break;
}
</DeepExtract>
mPassword.requestFocus();
mPassword.postDelayed(mShowKeyboardRunnable, 500);
mFingerprintUiHelper.stopListening();
}
|
advanced-android-book
|
positive
| 278
|
public static void main(String[] args) {
Injector injector = Guice.createInjector(new FirstModule());
UserController userController = injector.getInstance(UserController.class);
messageService.sendMessage("Singleton Scoped example");
userController = injector.getInstance(UserController.class);
messageService.sendMessage("Singleton Scoped example");
}
|
public static void main(String[] args) {
Injector injector = Guice.createInjector(new FirstModule());
UserController userController = injector.getInstance(UserController.class);
<DeepExtract>
messageService.sendMessage("Singleton Scoped example");
</DeepExtract>
userController = injector.getInstance(UserController.class);
<DeepExtract>
messageService.sendMessage("Singleton Scoped example");
</DeepExtract>
}
|
Design-Pattern-Tutorial
|
positive
| 279
|
@Override
protected void onResume() {
super.onResume();
if (mMap == null) {
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getPolarisMap();
if (mMap != null) {
setUpMap();
}
}
}
|
@Override
protected void onResume() {
super.onResume();
<DeepExtract>
if (mMap == null) {
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getPolarisMap();
if (mMap != null) {
setUpMap();
}
}
</DeepExtract>
}
|
Polaris2
|
positive
| 280
|
public static Collection<CheckMessage> getIssues(String relativePath, GherkinCheck check, Charset charset, String language) {
File file = new File(relativePath);
GherkinDocumentTree propertiesTree = (GherkinDocumentTree) GherkinParserBuilder.createTestParser(charset, language).parse(file);
GherkinVisitorContext context = new GherkinVisitorContext(propertiesTree, file);
List<Issue> issues = check.scanFile(context);
List<CheckMessage> checkMessages = new ArrayList<>();
for (Issue issue : issues) {
CheckMessage checkMessage;
if (issue instanceof FileIssue) {
FileIssue fileIssue = (FileIssue) issue;
checkMessage = new CheckMessage(fileIssue.check(), fileIssue.message());
} else if (issue instanceof LineIssue) {
LineIssue lineIssue = (LineIssue) issue;
checkMessage = new CheckMessage(lineIssue.check(), lineIssue.message());
checkMessage.setLine(lineIssue.line());
} else {
PreciseIssue preciseIssue = (PreciseIssue) issue;
checkMessage = new CheckMessage(preciseIssue.check(), preciseIssue.primaryLocation().message());
checkMessage.setLine(preciseIssue.primaryLocation().startLine());
}
if (issue.cost() != null) {
checkMessage.setCost(issue.cost());
}
checkMessages.add(checkMessage);
}
return checkMessages;
}
|
public static Collection<CheckMessage> getIssues(String relativePath, GherkinCheck check, Charset charset, String language) {
File file = new File(relativePath);
GherkinDocumentTree propertiesTree = (GherkinDocumentTree) GherkinParserBuilder.createTestParser(charset, language).parse(file);
GherkinVisitorContext context = new GherkinVisitorContext(propertiesTree, file);
List<Issue> issues = check.scanFile(context);
<DeepExtract>
List<CheckMessage> checkMessages = new ArrayList<>();
for (Issue issue : issues) {
CheckMessage checkMessage;
if (issue instanceof FileIssue) {
FileIssue fileIssue = (FileIssue) issue;
checkMessage = new CheckMessage(fileIssue.check(), fileIssue.message());
} else if (issue instanceof LineIssue) {
LineIssue lineIssue = (LineIssue) issue;
checkMessage = new CheckMessage(lineIssue.check(), lineIssue.message());
checkMessage.setLine(lineIssue.line());
} else {
PreciseIssue preciseIssue = (PreciseIssue) issue;
checkMessage = new CheckMessage(preciseIssue.check(), preciseIssue.primaryLocation().message());
checkMessage.setLine(preciseIssue.primaryLocation().startLine());
}
if (issue.cost() != null) {
checkMessage.setCost(issue.cost());
}
checkMessages.add(checkMessage);
}
return checkMessages;
</DeepExtract>
}
|
sonar-gherkin-plugin
|
positive
| 282
|
@Test
public void TestSerially() {
if (!ZulipApp.get().getApiKey().isEmpty()) {
BaseTest baseTest = new BaseTest();
baseTest.logout();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
ZLog.logException(e);
}
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ViewInteraction serverURLInteraction = onView(Matchers.allOf(withId(R.id.server_url_in), isDisplayed()));
serverURLInteraction.perform(replaceText(SERVER_URL));
ViewInteraction enterServerUrl = onView(Matchers.allOf(withId(R.id.server_btn), withText(R.string.enter), isDisplayed()));
enterServerUrl.perform(click());
ViewInteraction devServerTextViewInteraction = onView(allOf(withId(R.id.local_server_button), withText(R.string.local_server), isDisplayed()));
devServerTextViewInteraction.perform(click());
onView(withId(R.id.devAuthRecyclerView)).check(hasItemsCount());
if (EMAIL_TEST.equals("")) {
onView(allOf(withId(android.R.id.text1), emailFilter())).perform(click());
} else {
ViewInteraction button = onView(Matchers.allOf(withId(android.R.id.text1), withText(EMAIL_TEST), isDisplayed()));
button.perform(click());
}
assertThat(ZulipApp.get().getEmail(), is(EMAIL_TEST));
}
|
@Test
public void TestSerially() {
if (!ZulipApp.get().getApiKey().isEmpty()) {
BaseTest baseTest = new BaseTest();
baseTest.logout();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
ZLog.logException(e);
}
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ViewInteraction serverURLInteraction = onView(Matchers.allOf(withId(R.id.server_url_in), isDisplayed()));
serverURLInteraction.perform(replaceText(SERVER_URL));
ViewInteraction enterServerUrl = onView(Matchers.allOf(withId(R.id.server_btn), withText(R.string.enter), isDisplayed()));
enterServerUrl.perform(click());
ViewInteraction devServerTextViewInteraction = onView(allOf(withId(R.id.local_server_button), withText(R.string.local_server), isDisplayed()));
devServerTextViewInteraction.perform(click());
onView(withId(R.id.devAuthRecyclerView)).check(hasItemsCount());
<DeepExtract>
if (EMAIL_TEST.equals("")) {
onView(allOf(withId(android.R.id.text1), emailFilter())).perform(click());
} else {
ViewInteraction button = onView(Matchers.allOf(withId(android.R.id.text1), withText(EMAIL_TEST), isDisplayed()));
button.perform(click());
}
assertThat(ZulipApp.get().getEmail(), is(EMAIL_TEST));
</DeepExtract>
}
|
zulip-android
|
positive
| 283
|
public boolean isMultiTable(Cell[][] cells, Table table) {
if (cells == null)
return false;
if (table.original_cells == null)
table.original_cells = table.original_cells;
for (int i = 0; i < table.original_cells.length; i++) {
try {
table.original_cells[i][0].isBreakingLineOverRow();
} catch (ArrayIndexOutOfBoundsException ex) {
continue;
}
if (table.original_cells[i][0].isBreakingLineOverRow()) {
if (i - 2 >= 0 && !table.original_cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.original_cells, i - 2, 0) && table.original_cells[i - 2][0].isBreakingLineOverRow() && Utilities.isOneCellFilledRow(table.original_cells[i - 1])) {
for (int j = 0; j < table.original_cells[i].length; j++) {
}
for (int j = 0; j < table.original_cells[i].length; j++) {
table.original_cells[i - 1][j].setIs_subheader(true);
}
for (int j = 0; j < table.original_cells[i].length; j++) {
}
} else if (i - 2 >= 0 && !table.original_cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.original_cells, i - 2, 0) && table.original_cells[i - 2][0].isBreakingLineOverRow()) {
for (int j = 0; j < table.original_cells[i].length; j++) {
table.original_cells[i][j].setIs_header(true);
}
for (int j = 0; j < table.original_cells[i].length; j++) {
table.original_cells[i - 1][j].setIs_header(true);
}
for (int j = 0; j < table.original_cells[i].length; j++) {
table.original_cells[i - 2][j].setIs_header(true);
}
}
}
}
return table.original_cells;
if (table.cells == null)
table.cells = table.cells;
for (int i = 0; i < table.cells.length; i++) {
try {
table.cells[i][0].isBreakingLineOverRow();
} catch (ArrayIndexOutOfBoundsException ex) {
continue;
}
if (table.cells[i][0].isBreakingLineOverRow()) {
if (i - 2 >= 0 && !table.cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.cells, i - 2, 0) && table.cells[i - 2][0].isBreakingLineOverRow() && Utilities.isOneCellFilledRow(table.cells[i - 1])) {
for (int j = 0; j < table.cells[i].length; j++) {
}
for (int j = 0; j < table.cells[i].length; j++) {
table.cells[i - 1][j].setIs_subheader(true);
}
for (int j = 0; j < table.cells[i].length; j++) {
}
} else if (i - 2 >= 0 && !table.cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.cells, i - 2, 0) && table.cells[i - 2][0].isBreakingLineOverRow()) {
for (int j = 0; j < table.cells[i].length; j++) {
table.cells[i][j].setIs_header(true);
}
for (int j = 0; j < table.cells[i].length; j++) {
table.cells[i - 1][j].setIs_header(true);
}
for (int j = 0; j < table.cells[i].length; j++) {
table.cells[i - 2][j].setIs_header(true);
}
}
}
}
return table.cells;
for (int i = 0; i < cells.length; i++) {
try {
cells[i][0].isBreakingLineOverRow();
} catch (ArrayIndexOutOfBoundsException Ex) {
continue;
}
if (cells[i][0].isBreakingLineOverRow()) {
if (i - 2 >= 0 && cells[i - 2][0].isIs_header() && isSequentiallyBreakingLine(cells, i - 2, 0) && cells[i - 2][0].isBreakingLineOverRow() && !Utilities.isOneCellFilledRow(cells[i - 1]))
return true;
}
}
return false;
}
|
public boolean isMultiTable(Cell[][] cells, Table table) {
if (cells == null)
return false;
if (table.original_cells == null)
table.original_cells = table.original_cells;
for (int i = 0; i < table.original_cells.length; i++) {
try {
table.original_cells[i][0].isBreakingLineOverRow();
} catch (ArrayIndexOutOfBoundsException ex) {
continue;
}
if (table.original_cells[i][0].isBreakingLineOverRow()) {
if (i - 2 >= 0 && !table.original_cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.original_cells, i - 2, 0) && table.original_cells[i - 2][0].isBreakingLineOverRow() && Utilities.isOneCellFilledRow(table.original_cells[i - 1])) {
for (int j = 0; j < table.original_cells[i].length; j++) {
}
for (int j = 0; j < table.original_cells[i].length; j++) {
table.original_cells[i - 1][j].setIs_subheader(true);
}
for (int j = 0; j < table.original_cells[i].length; j++) {
}
} else if (i - 2 >= 0 && !table.original_cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.original_cells, i - 2, 0) && table.original_cells[i - 2][0].isBreakingLineOverRow()) {
for (int j = 0; j < table.original_cells[i].length; j++) {
table.original_cells[i][j].setIs_header(true);
}
for (int j = 0; j < table.original_cells[i].length; j++) {
table.original_cells[i - 1][j].setIs_header(true);
}
for (int j = 0; j < table.original_cells[i].length; j++) {
table.original_cells[i - 2][j].setIs_header(true);
}
}
}
}
return table.original_cells;
<DeepExtract>
if (table.cells == null)
table.cells = table.cells;
for (int i = 0; i < table.cells.length; i++) {
try {
table.cells[i][0].isBreakingLineOverRow();
} catch (ArrayIndexOutOfBoundsException ex) {
continue;
}
if (table.cells[i][0].isBreakingLineOverRow()) {
if (i - 2 >= 0 && !table.cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.cells, i - 2, 0) && table.cells[i - 2][0].isBreakingLineOverRow() && Utilities.isOneCellFilledRow(table.cells[i - 1])) {
for (int j = 0; j < table.cells[i].length; j++) {
}
for (int j = 0; j < table.cells[i].length; j++) {
table.cells[i - 1][j].setIs_subheader(true);
}
for (int j = 0; j < table.cells[i].length; j++) {
}
} else if (i - 2 >= 0 && !table.cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.cells, i - 2, 0) && table.cells[i - 2][0].isBreakingLineOverRow()) {
for (int j = 0; j < table.cells[i].length; j++) {
table.cells[i][j].setIs_header(true);
}
for (int j = 0; j < table.cells[i].length; j++) {
table.cells[i - 1][j].setIs_header(true);
}
for (int j = 0; j < table.cells[i].length; j++) {
table.cells[i - 2][j].setIs_header(true);
}
}
}
}
return table.cells;
</DeepExtract>
for (int i = 0; i < cells.length; i++) {
try {
cells[i][0].isBreakingLineOverRow();
} catch (ArrayIndexOutOfBoundsException Ex) {
continue;
}
if (cells[i][0].isBreakingLineOverRow()) {
if (i - 2 >= 0 && cells[i - 2][0].isIs_header() && isSequentiallyBreakingLine(cells, i - 2, 0) && cells[i - 2][0].isBreakingLineOverRow() && !Utilities.isOneCellFilledRow(cells[i - 1]))
return true;
}
}
return false;
}
|
TableDisentangler
|
positive
| 284
|
public synchronized boolean startShell() {
if (mShell != null) {
if (mShell.isRunning()) {
return true;
} else {
dispose();
}
}
mCallbackThread = new HandlerThread("su callback listener");
mCallbackThread.start();
mCommandRunning = true;
mShell = new Shell.Builder().useSU().setHandler(new Handler(mCallbackThread.getLooper())).setOnSTDERRLineListener(mStderrListener).open(mOpenListener);
synchronized (mCallbackThread) {
while (mCommandRunning) {
try {
mCallbackThread.wait();
} catch (InterruptedException ignored) {
}
}
}
if (mLastExitCode == OnCommandResultListener.WATCHDOG_EXIT || mLastExitCode == OnCommandResultListener.SHELL_DIED) {
dispose();
}
if (mLastExitCode != OnCommandResultListener.SHELL_RUNNING) {
dispose();
return false;
}
return true;
}
|
public synchronized boolean startShell() {
if (mShell != null) {
if (mShell.isRunning()) {
return true;
} else {
dispose();
}
}
mCallbackThread = new HandlerThread("su callback listener");
mCallbackThread.start();
mCommandRunning = true;
mShell = new Shell.Builder().useSU().setHandler(new Handler(mCallbackThread.getLooper())).setOnSTDERRLineListener(mStderrListener).open(mOpenListener);
<DeepExtract>
synchronized (mCallbackThread) {
while (mCommandRunning) {
try {
mCallbackThread.wait();
} catch (InterruptedException ignored) {
}
}
}
if (mLastExitCode == OnCommandResultListener.WATCHDOG_EXIT || mLastExitCode == OnCommandResultListener.SHELL_DIED) {
dispose();
}
</DeepExtract>
if (mLastExitCode != OnCommandResultListener.SHELL_RUNNING) {
dispose();
return false;
}
return true;
}
|
XposedInstaller
|
positive
| 286
|
public void OnFootViewClick() {
if (getCatid().getData() != null) {
newsList.addAll(getCatid().getData());
tabAdapter.notifyDataSetChanged();
}
}
|
public void OnFootViewClick() {
<DeepExtract>
if (getCatid().getData() != null) {
newsList.addAll(getCatid().getData());
tabAdapter.notifyDataSetChanged();
}
</DeepExtract>
}
|
WeMedia
|
positive
| 287
|
public final void setOwnerActivity(Activity activity) {
mOwnerActivity = activity;
getWindow().setVolumeControlStream(mOwnerActivity.getVolumeControlStream());
}
|
public final void setOwnerActivity(Activity activity) {
mOwnerActivity = activity;
<DeepExtract>
getWindow().setVolumeControlStream(mOwnerActivity.getVolumeControlStream());
</DeepExtract>
}
|
PreferenceFragment
|
positive
| 288
|
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_WIFI_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_NETWORK_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.GET_TASKS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_CONTACTS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_BOOT_COMPLETED) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.INTERNET, Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.READ_PHONE_STATE, Manifest.permission.GET_TASKS, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS, Manifest.permission.RECEIVE_BOOT_COMPLETED }, 1);
}
mTryclientFragment = new TryclientFragment();
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(android.R.id.content, mTryclientFragment, "Tryclient");
ft.commit();
}
|
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
<DeepExtract>
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_WIFI_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_NETWORK_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.GET_TASKS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_CONTACTS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_BOOT_COMPLETED) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.INTERNET, Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.READ_PHONE_STATE, Manifest.permission.GET_TASKS, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS, Manifest.permission.RECEIVE_BOOT_COMPLETED }, 1);
}
</DeepExtract>
mTryclientFragment = new TryclientFragment();
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(android.R.id.content, mTryclientFragment, "Tryclient");
ft.commit();
}
|
Trycorder5
|
positive
| 289
|
@Test(expected = WrongCredentialsException.class)
public void testUploadImage_throwsExceptionIfBwsTokenIsInvalidOrHasExpired() {
doThrow(new HttpRequestHelper.Non200StatusException(BioIdWebserviceClient.HTTP_STATUS_WRONG_CREDENTIALS)).when(httpRequestHelper).asJsonIfOk(uploadImageRequest);
bioIdWebserviceClient.uploadImage(img, bwsToken, DIRECTION, UPLOAD_INDEX);
}
|
@Test(expected = WrongCredentialsException.class)
public void testUploadImage_throwsExceptionIfBwsTokenIsInvalidOrHasExpired() {
doThrow(new HttpRequestHelper.Non200StatusException(BioIdWebserviceClient.HTTP_STATUS_WRONG_CREDENTIALS)).when(httpRequestHelper).asJsonIfOk(uploadImageRequest);
<DeepExtract>
bioIdWebserviceClient.uploadImage(img, bwsToken, DIRECTION, UPLOAD_INDEX);
</DeepExtract>
}
|
BWS-Android
|
positive
| 293
|
void updateLight(Light l) {
Color c = l.color;
float x = l.x;
float y = l.y;
float subX = regionSize / 2f - x;
float subY = regionSize / 2f - y;
drawPass(targetA, null, shadowCasters, subX, subY, shadowCasters.getWidth(), shadowCasters.getHeight(), Color.white, true);
drawPass(targetB, polar2rect, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), Color.white, false);
occlusionMap.bind();
GL2D.setBackground(Color.white);
GL2D.clear();
GL11.glEnable(GL11.GL_BLEND);
GL14.glBlendEquation(GL14.GL_MIN);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
for (int y = 0; y < regionSize; y++) {
batch.drawSubImage(targetB.getImage(), 0, y, regionSize, 1, 0, 0, regionSize, 1, null);
}
batch.flush();
GL14.glBlendEquation(GL11.GL_ADD);
GL2D.resetBlendFunc();
occlusionMap.unbind();
lightmapShader.bind();
lightmapShader.setUniform4f(TINT_UNIFORM, c);
targetA.bind();
GL2D.setBackground(c, false);
GL2D.clear();
if (null != null)
null.bind();
batch.drawImage(occlusionMap.getImage(), 0, 0, regionSize, regionSize);
batch.flush();
if (null != null)
null.unbind();
targetA.unbind();
lightmapShader.unbind();
drawPass(targetB, rect2polar, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), c, false);
drawPass(targetA, hblur, targetB.getImage(), 0, 0, targetB.getImage().getWidth(), targetB.getImage().getHeight(), c, false);
batch.setColor(c);
drawPass(l.fbo, vblur, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), c, false);
batch.setColor(Color.white);
lastX = x;
lastY = y;
dirty = false;
}
|
void updateLight(Light l) {
Color c = l.color;
float x = l.x;
float y = l.y;
float subX = regionSize / 2f - x;
float subY = regionSize / 2f - y;
drawPass(targetA, null, shadowCasters, subX, subY, shadowCasters.getWidth(), shadowCasters.getHeight(), Color.white, true);
drawPass(targetB, polar2rect, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), Color.white, false);
occlusionMap.bind();
GL2D.setBackground(Color.white);
GL2D.clear();
GL11.glEnable(GL11.GL_BLEND);
GL14.glBlendEquation(GL14.GL_MIN);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
for (int y = 0; y < regionSize; y++) {
batch.drawSubImage(targetB.getImage(), 0, y, regionSize, 1, 0, 0, regionSize, 1, null);
}
batch.flush();
GL14.glBlendEquation(GL11.GL_ADD);
GL2D.resetBlendFunc();
occlusionMap.unbind();
lightmapShader.bind();
lightmapShader.setUniform4f(TINT_UNIFORM, c);
targetA.bind();
GL2D.setBackground(c, false);
GL2D.clear();
if (null != null)
null.bind();
batch.drawImage(occlusionMap.getImage(), 0, 0, regionSize, regionSize);
batch.flush();
if (null != null)
null.unbind();
targetA.unbind();
lightmapShader.unbind();
drawPass(targetB, rect2polar, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), c, false);
drawPass(targetA, hblur, targetB.getImage(), 0, 0, targetB.getImage().getWidth(), targetB.getImage().getHeight(), c, false);
batch.setColor(c);
drawPass(l.fbo, vblur, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), c, false);
batch.setColor(Color.white);
<DeepExtract>
lastX = x;
lastY = y;
dirty = false;
</DeepExtract>
}
|
slim
|
positive
| 294
|
public ClassBuilder addStartWeek(int startWeek) {
this.startWeek = startWeek;
return this;
}
|
public ClassBuilder addStartWeek(int startWeek) {
<DeepExtract>
this.startWeek = startWeek;
</DeepExtract>
return this;
}
|
JustWeTools
|
positive
| 295
|
@Override
public String value3() {
return (String) get(2);
}
|
@Override
public String value3() {
<DeepExtract>
return (String) get(2);
</DeepExtract>
}
|
sapling
|
positive
| 296
|
public String getPayload() {
if (this.orgNodePayload == null)
this.orgNodePayload = new OrgNodePayload(this.payload);
return this.orgNodePayload.get();
}
|
public String getPayload() {
<DeepExtract>
if (this.orgNodePayload == null)
this.orgNodePayload = new OrgNodePayload(this.payload);
</DeepExtract>
return this.orgNodePayload.get();
}
|
mobileorg-android
|
positive
| 297
|
public void printTo(Body b, PrintWriter out) {
b.validate();
boolean isPrecise = !useAbbreviations();
String decl = b.getMethod().getDeclaration();
out.println(" " + decl);
if (addJimpleLn()) {
setJimpleLnNum(addJimpleLnTags(getJimpleLnNum(), b.getMethod()));
}
out.println(" {");
jimpleLnNum++;
UnitGraph unitGraph = new soot.toolkits.graph.BriefUnitGraph(b);
if (isPrecise)
up = new NormalUnitPrinter(b);
else
up = new BriefUnitPrinter(b);
if (addJimpleLn()) {
up.setPositionTagger(new AttributesUnitPrinter(getJimpleLnNum()));
}
{
Map<Type, List> typeToLocals = new DeterministicHashMap(b.getLocalCount() * 2 + 1, 0.7f);
{
Iterator localIt = b.getLocals().iterator();
while (localIt.hasNext()) {
Local local = (Local) localIt.next();
List<Local> localList;
Type t = local.getType();
if (typeToLocals.containsKey(t))
localList = typeToLocals.get(t);
else {
localList = new ArrayList<Local>();
typeToLocals.put(t, localList);
}
localList.add(local);
}
}
{
Iterator<Type> typeIt = typeToLocals.keySet().iterator();
while (typeIt.hasNext()) {
Type type = typeIt.next();
List localList = typeToLocals.get(type);
Object[] locals = localList.toArray();
up.type(type);
up.literal(" ");
for (int k = 0; k < locals.length; k++) {
if (k != 0)
up.literal(", ");
up.local((Local) locals[k]);
}
up.literal(";");
up.newline();
}
}
if (!typeToLocals.isEmpty()) {
up.newline();
}
}
Chain units = b.getUnits();
Iterator unitIt = units.iterator();
Unit currentStmt = null, previousStmt;
while (unitIt.hasNext()) {
previousStmt = currentStmt;
currentStmt = (Unit) unitIt.next();
{
if (currentStmt != units.getFirst()) {
if (unitGraph.getSuccsOf(previousStmt).size() != 1 || unitGraph.getPredsOf(currentStmt).size() != 1 || up.labels().containsKey(currentStmt)) {
up.newline();
} else {
List succs = unitGraph.getSuccsOf(previousStmt);
if (succs.get(0) != currentStmt) {
up.newline();
}
}
}
if (up.labels().containsKey(currentStmt)) {
up.unitRef(currentStmt, true);
up.literal(":");
up.newline();
}
if (up.references().containsKey(currentStmt)) {
up.unitRef(currentStmt, false);
}
}
up.startUnit(currentStmt);
currentStmt.toString(up);
up.endUnit(currentStmt);
up.literal(";");
up.newline();
if (Options.v().print_tags_in_output()) {
Iterator tagIterator = currentStmt.getTags().iterator();
while (tagIterator.hasNext()) {
Tag t = (Tag) tagIterator.next();
up.noIndent();
up.literal("/*");
up.literal(t.toString());
up.literal("*/");
up.newline();
}
}
}
out.print(up.toString());
if (addJimpleLn()) {
setJimpleLnNum(up.getPositionTagger().getEndLn());
}
{
Iterator trapIt = b.getTraps().iterator();
if (trapIt.hasNext()) {
out.println();
incJimpleLnNum();
}
while (trapIt.hasNext()) {
Trap trap = (Trap) trapIt.next();
out.println(" catch " + Scene.v().quotedNameOf(trap.getException().getName()) + " from " + up.labels().get(trap.getBeginUnit()) + " to " + up.labels().get(trap.getEndUnit()) + " with " + up.labels().get(trap.getHandlerUnit()) + ";");
incJimpleLnNum();
}
}
out.println(" }");
jimpleLnNum++;
}
|
public void printTo(Body b, PrintWriter out) {
b.validate();
boolean isPrecise = !useAbbreviations();
String decl = b.getMethod().getDeclaration();
out.println(" " + decl);
if (addJimpleLn()) {
setJimpleLnNum(addJimpleLnTags(getJimpleLnNum(), b.getMethod()));
}
out.println(" {");
<DeepExtract>
jimpleLnNum++;
</DeepExtract>
UnitGraph unitGraph = new soot.toolkits.graph.BriefUnitGraph(b);
if (isPrecise)
up = new NormalUnitPrinter(b);
else
up = new BriefUnitPrinter(b);
if (addJimpleLn()) {
up.setPositionTagger(new AttributesUnitPrinter(getJimpleLnNum()));
}
{
Map<Type, List> typeToLocals = new DeterministicHashMap(b.getLocalCount() * 2 + 1, 0.7f);
{
Iterator localIt = b.getLocals().iterator();
while (localIt.hasNext()) {
Local local = (Local) localIt.next();
List<Local> localList;
Type t = local.getType();
if (typeToLocals.containsKey(t))
localList = typeToLocals.get(t);
else {
localList = new ArrayList<Local>();
typeToLocals.put(t, localList);
}
localList.add(local);
}
}
{
Iterator<Type> typeIt = typeToLocals.keySet().iterator();
while (typeIt.hasNext()) {
Type type = typeIt.next();
List localList = typeToLocals.get(type);
Object[] locals = localList.toArray();
up.type(type);
up.literal(" ");
for (int k = 0; k < locals.length; k++) {
if (k != 0)
up.literal(", ");
up.local((Local) locals[k]);
}
up.literal(";");
up.newline();
}
}
if (!typeToLocals.isEmpty()) {
up.newline();
}
}
Chain units = b.getUnits();
Iterator unitIt = units.iterator();
Unit currentStmt = null, previousStmt;
while (unitIt.hasNext()) {
previousStmt = currentStmt;
currentStmt = (Unit) unitIt.next();
{
if (currentStmt != units.getFirst()) {
if (unitGraph.getSuccsOf(previousStmt).size() != 1 || unitGraph.getPredsOf(currentStmt).size() != 1 || up.labels().containsKey(currentStmt)) {
up.newline();
} else {
List succs = unitGraph.getSuccsOf(previousStmt);
if (succs.get(0) != currentStmt) {
up.newline();
}
}
}
if (up.labels().containsKey(currentStmt)) {
up.unitRef(currentStmt, true);
up.literal(":");
up.newline();
}
if (up.references().containsKey(currentStmt)) {
up.unitRef(currentStmt, false);
}
}
up.startUnit(currentStmt);
currentStmt.toString(up);
up.endUnit(currentStmt);
up.literal(";");
up.newline();
if (Options.v().print_tags_in_output()) {
Iterator tagIterator = currentStmt.getTags().iterator();
while (tagIterator.hasNext()) {
Tag t = (Tag) tagIterator.next();
up.noIndent();
up.literal("/*");
up.literal(t.toString());
up.literal("*/");
up.newline();
}
}
}
out.print(up.toString());
if (addJimpleLn()) {
setJimpleLnNum(up.getPositionTagger().getEndLn());
}
{
Iterator trapIt = b.getTraps().iterator();
if (trapIt.hasNext()) {
out.println();
incJimpleLnNum();
}
while (trapIt.hasNext()) {
Trap trap = (Trap) trapIt.next();
out.println(" catch " + Scene.v().quotedNameOf(trap.getException().getName()) + " from " + up.labels().get(trap.getBeginUnit()) + " to " + up.labels().get(trap.getEndUnit()) + " with " + up.labels().get(trap.getHandlerUnit()) + ";");
incJimpleLnNum();
}
}
out.println(" }");
<DeepExtract>
jimpleLnNum++;
</DeepExtract>
}
|
acteve
|
positive
| 298
|
@OnClick(R.id.todo_list_activity_button_add)
public void onClickAddButton() {
Item item = new Item(this.editText.getText().toString(), this.spinner.getSelectedItemPosition(), USER_ID);
this.editText.setText("");
this.itemViewModel.createItem(item);
}
|
@OnClick(R.id.todo_list_activity_button_add)
public void onClickAddButton() {
<DeepExtract>
Item item = new Item(this.editText.getText().toString(), this.spinner.getSelectedItemPosition(), USER_ID);
this.editText.setText("");
this.itemViewModel.createItem(item);
</DeepExtract>
}
|
OpenClassrooms---Parcours-Android
|
positive
| 299
|
public Criteria andUserIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "user" + " cannot be null");
}
criteria.add(new Criterion("user in", values));
return (Criteria) this;
}
|
public Criteria andUserIn(List<String> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "user" + " cannot be null");
}
criteria.add(new Criterion("user in", values));
</DeepExtract>
return (Criteria) this;
}
|
Hospital
|
positive
| 300
|
private int parseAction() {
Integer result;
if (readIf("CASCADE")) {
result = ConstraintReferential.CASCADE;
} else if (readIf("RESTRICT")) {
result = ConstraintReferential.RESTRICT;
} else {
result = null;
}
if (result != null) {
return result;
}
if (readIf("NO")) {
read("ACTION");
return ConstraintReferential.RESTRICT;
}
if (currentTokenQuoted || !equalsToken("SET", currentToken)) {
addExpected("SET");
throw getSyntaxError();
}
read();
if (readIf("NULL")) {
return ConstraintReferential.SET_NULL;
}
if (currentTokenQuoted || !equalsToken("DEFAULT", currentToken)) {
addExpected("DEFAULT");
throw getSyntaxError();
}
read();
return ConstraintReferential.SET_DEFAULT;
}
|
private int parseAction() {
Integer result;
if (readIf("CASCADE")) {
result = ConstraintReferential.CASCADE;
} else if (readIf("RESTRICT")) {
result = ConstraintReferential.RESTRICT;
} else {
result = null;
}
if (result != null) {
return result;
}
if (readIf("NO")) {
read("ACTION");
return ConstraintReferential.RESTRICT;
}
if (currentTokenQuoted || !equalsToken("SET", currentToken)) {
addExpected("SET");
throw getSyntaxError();
}
read();
if (readIf("NULL")) {
return ConstraintReferential.SET_NULL;
}
<DeepExtract>
if (currentTokenQuoted || !equalsToken("DEFAULT", currentToken)) {
addExpected("DEFAULT");
throw getSyntaxError();
}
read();
</DeepExtract>
return ConstraintReferential.SET_DEFAULT;
}
|
Lealone-Plugins
|
positive
| 301
|
public static void copyProperty(Object srcBean, Object destBean, String[] pros) throws InvocationTargetException, IllegalAccessException {
try {
BeanFactory.add(srcBean);
} catch (IntrospectionException | ClassNotFoundException e) {
e.printStackTrace();
}
try {
BeanFactory.add(destBean);
} catch (IntrospectionException | ClassNotFoundException e) {
e.printStackTrace();
}
if (CheckUtil.valid(pros)) {
for (String s : pros) {
Object value = readMethod(srcBean, getReadMethod(srcBean, s));
writeMethod(destBean, getWriteMethod(destBean, s), value);
}
}
}
|
public static void copyProperty(Object srcBean, Object destBean, String[] pros) throws InvocationTargetException, IllegalAccessException {
try {
BeanFactory.add(srcBean);
} catch (IntrospectionException | ClassNotFoundException e) {
e.printStackTrace();
}
<DeepExtract>
try {
BeanFactory.add(destBean);
} catch (IntrospectionException | ClassNotFoundException e) {
e.printStackTrace();
}
</DeepExtract>
if (CheckUtil.valid(pros)) {
for (String s : pros) {
Object value = readMethod(srcBean, getReadMethod(srcBean, s));
writeMethod(destBean, getWriteMethod(destBean, s), value);
}
}
}
|
opslabJutil
|
positive
| 302
|
public Criteria andToidIn(List<Long> values) {
if (values == null) {
throw new RuntimeException("Value for " + "toid" + " cannot be null");
}
criteria.add(new Criterion("toId in", values));
return (Criteria) this;
}
|
public Criteria andToidIn(List<Long> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "toid" + " cannot be null");
}
criteria.add(new Criterion("toId in", values));
</DeepExtract>
return (Criteria) this;
}
|
webim
|
positive
| 303
|
@Override
public int reasonOffset() {
if (buffer() == null) {
throw new IllegalStateException("Flyweight has not been wrapped/populated yet with a ByteBuffer.");
}
int payloadLength = limit() - offset();
if (payloadLength > 2) {
return offset() + 2;
}
return -1;
}
|
@Override
public int reasonOffset() {
<DeepExtract>
if (buffer() == null) {
throw new IllegalStateException("Flyweight has not been wrapped/populated yet with a ByteBuffer.");
}
</DeepExtract>
int payloadLength = limit() - offset();
if (payloadLength > 2) {
return offset() + 2;
}
return -1;
}
|
netx
|
positive
| 304
|
public void writeVarInt(int input) {
while ((input & -128) != 0) {
this.writeByte(input & 127 | 128);
input >>>= 7;
}
return byteBuf.writeByte(input);
}
|
public void writeVarInt(int input) {
while ((input & -128) != 0) {
this.writeByte(input & 127 | 128);
input >>>= 7;
}
<DeepExtract>
return byteBuf.writeByte(input);
</DeepExtract>
}
|
BetterProxy
|
positive
| 305
|
private void setPlugin(String name, CmdIn cmd) {
Plugin plugin = pluginService.get(name);
for (Input input : plugin.getInputs()) {
String value = cmd.getInputs().get(input.getName());
if (!StringHelper.hasValue(value) && input.hasDefaultValue()) {
cmd.getInputs().put(input.getName(), input.getValue());
continue;
}
if (!input.verify(value)) {
throw new ArgumentException("The illegal input {0} for plugin {1}", input.getName(), plugin.getName());
}
}
cmd.setPlugin(name);
cmd.setAllowFailure(plugin.isAllowFailure());
cmd.addEnvFilters(plugin.getExports());
PluginBody body = plugin.getBody();
if (body instanceof ScriptBody) {
String script = ((ScriptBody) body).getScript();
cmd.addScript(script);
return;
}
if (body instanceof ParentBody) {
ParentBody parentData = (ParentBody) body;
Plugin parent = pluginService.get(parentData.getName());
if (!(parent.getBody() instanceof ScriptBody)) {
throw new NotAvailableException("Script not found on parent plugin");
}
String scriptFromParent = ((ScriptBody) parent.getBody()).getScript();
cmd.addInputs(parentData.getEnvs());
cmd.addScript(scriptFromParent);
verifyPluginInput(cmd.getInputs(), parent);
}
}
|
private void setPlugin(String name, CmdIn cmd) {
Plugin plugin = pluginService.get(name);
<DeepExtract>
for (Input input : plugin.getInputs()) {
String value = cmd.getInputs().get(input.getName());
if (!StringHelper.hasValue(value) && input.hasDefaultValue()) {
cmd.getInputs().put(input.getName(), input.getValue());
continue;
}
if (!input.verify(value)) {
throw new ArgumentException("The illegal input {0} for plugin {1}", input.getName(), plugin.getName());
}
}
</DeepExtract>
cmd.setPlugin(name);
cmd.setAllowFailure(plugin.isAllowFailure());
cmd.addEnvFilters(plugin.getExports());
PluginBody body = plugin.getBody();
if (body instanceof ScriptBody) {
String script = ((ScriptBody) body).getScript();
cmd.addScript(script);
return;
}
if (body instanceof ParentBody) {
ParentBody parentData = (ParentBody) body;
Plugin parent = pluginService.get(parentData.getName());
if (!(parent.getBody() instanceof ScriptBody)) {
throw new NotAvailableException("Script not found on parent plugin");
}
String scriptFromParent = ((ScriptBody) parent.getBody()).getScript();
cmd.addInputs(parentData.getEnvs());
cmd.addScript(scriptFromParent);
verifyPluginInput(cmd.getInputs(), parent);
}
}
|
flow-platform-x
|
positive
| 306
|
public void putGJString3(String s) {
writeByte(0, offset++);
checkCapacityPosition(getOffset() + s.length() + 1);
System.arraycopy(s.getBytes(), 0, getBuffer(), getOffset(), s.length());
setOffset(getOffset() + s.length());
writeByte(0);
writeByte(0, offset++);
}
|
public void putGJString3(String s) {
<DeepExtract>
writeByte(0, offset++);
</DeepExtract>
checkCapacityPosition(getOffset() + s.length() + 1);
System.arraycopy(s.getBytes(), 0, getBuffer(), getOffset(), s.length());
setOffset(getOffset() + s.length());
writeByte(0);
<DeepExtract>
writeByte(0, offset++);
</DeepExtract>
}
|
Interface-tool
|
positive
| 307
|
public static void main(String[] args) {
Node head1 = new Node(1);
head1.next = new Node(2);
head1.next.next = new Node(3);
head1.next.next.next = new Node(4);
head1.next.next.next.next = new Node(5);
head1.next.next.next.next.next = head1;
if (head1 == null) {
return;
}
System.out.print("Circular List: " + head1.value + " ");
Node cur = head1.next;
while (cur != head1) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head1.value);
if (head1 == null || head1.next == head1 || 3 < 1) {
head1 = head1;
}
Node last = head1;
while (last.next != head1) {
last = last.next;
}
int count = 0;
while (head1 != last) {
if (++count == 3) {
last.next = head1.next;
count = 0;
} else {
last = last.next;
}
head1 = last.next;
}
return head1;
if (head1 == null) {
return;
}
System.out.print("Circular List: " + head1.value + " ");
Node cur = head1.next;
while (cur != head1) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head1.value);
Node head2 = new Node(1);
head2.next = new Node(2);
head2.next.next = new Node(3);
head2.next.next.next = new Node(4);
head2.next.next.next.next = new Node(5);
head2.next.next.next.next.next = head2;
if (head2 == null) {
return;
}
System.out.print("Circular List: " + head2.value + " ");
Node cur = head2.next;
while (cur != head2) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head2.value);
if (head2 == null || head2.next == head2 || 3 < 1) {
head2 = head2;
}
Node cur = head2.next;
int tmp = 1;
while (cur != head2) {
tmp++;
cur = cur.next;
}
tmp = getLive(tmp, 3);
while (--tmp != 0) {
head2 = head2.next;
}
head2.next = head2;
return head2;
if (head2 == null) {
return;
}
System.out.print("Circular List: " + head2.value + " ");
Node cur = head2.next;
while (cur != head2) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head2.value);
}
|
public static void main(String[] args) {
Node head1 = new Node(1);
head1.next = new Node(2);
head1.next.next = new Node(3);
head1.next.next.next = new Node(4);
head1.next.next.next.next = new Node(5);
head1.next.next.next.next.next = head1;
if (head1 == null) {
return;
}
System.out.print("Circular List: " + head1.value + " ");
Node cur = head1.next;
while (cur != head1) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head1.value);
if (head1 == null || head1.next == head1 || 3 < 1) {
head1 = head1;
}
Node last = head1;
while (last.next != head1) {
last = last.next;
}
int count = 0;
while (head1 != last) {
if (++count == 3) {
last.next = head1.next;
count = 0;
} else {
last = last.next;
}
head1 = last.next;
}
return head1;
if (head1 == null) {
return;
}
System.out.print("Circular List: " + head1.value + " ");
Node cur = head1.next;
while (cur != head1) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head1.value);
Node head2 = new Node(1);
head2.next = new Node(2);
head2.next.next = new Node(3);
head2.next.next.next = new Node(4);
head2.next.next.next.next = new Node(5);
head2.next.next.next.next.next = head2;
<DeepExtract>
if (head2 == null) {
return;
}
System.out.print("Circular List: " + head2.value + " ");
Node cur = head2.next;
while (cur != head2) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head2.value);
</DeepExtract>
if (head2 == null || head2.next == head2 || 3 < 1) {
head2 = head2;
}
Node cur = head2.next;
int tmp = 1;
while (cur != head2) {
tmp++;
cur = cur.next;
}
tmp = getLive(tmp, 3);
while (--tmp != 0) {
head2 = head2.next;
}
head2.next = head2;
return head2;
<DeepExtract>
if (head2 == null) {
return;
}
System.out.print("Circular List: " + head2.value + " ");
Node cur = head2.next;
while (cur != head2) {
System.out.print(cur.value + " ");
cur = cur.next;
}
System.out.println("-> " + head2.value);
</DeepExtract>
}
|
ZuoChengyun
|
positive
| 308
|
@Override
public void onDrawing(Canvas c) {
super.onDrawing(c);
final int currentStack = ((GameEngineTwentyInARow) mGameEngine).getCurrentStack();
final String currentStackStr = String.valueOf(currentStack);
final int stackLength = currentStackStr.length();
final int radius = Math.max(mScreenWidth / (12 - stackLength), mScreenHeight / (12 - stackLength));
useTransparentBlackPainter();
c.drawOval(new RectF(-radius, mScreenHeight - radius, radius, mScreenHeight + radius), mPaint);
useWhitePainter();
mPaint.getTextBounds(currentStackStr, 0, currentStackStr.length(), mBounds);
c.drawText(currentStackStr, mBounds.width() / 2 + radius / 4, mScreenHeight - radius / 4, mPaint);
}
|
@Override
public void onDrawing(Canvas c) {
super.onDrawing(c);
<DeepExtract>
final int currentStack = ((GameEngineTwentyInARow) mGameEngine).getCurrentStack();
final String currentStackStr = String.valueOf(currentStack);
final int stackLength = currentStackStr.length();
final int radius = Math.max(mScreenWidth / (12 - stackLength), mScreenHeight / (12 - stackLength));
useTransparentBlackPainter();
c.drawOval(new RectF(-radius, mScreenHeight - radius, radius, mScreenHeight + radius), mPaint);
useWhitePainter();
mPaint.getTextBounds(currentStackStr, 0, currentStackStr.length(), mBounds);
c.drawText(currentStackStr, mBounds.width() / 2 + radius / 4, mScreenHeight - radius / 4, mPaint);
</DeepExtract>
}
|
ChaseWhisplyProject
|
positive
| 309
|
public void showErrorView(String message) {
if (!TextUtils.isEmpty(message)) {
BaseVaryViewSetter.setText(mErrorView, R.id.error_tips_show, message);
}
mViewHelper.showCaseLayout(mErrorView);
if (mLoadingProgress != null && mLoadingProgress.isSpinning()) {
mLoadingProgress.stopSpinning();
}
}
|
public void showErrorView(String message) {
if (!TextUtils.isEmpty(message)) {
BaseVaryViewSetter.setText(mErrorView, R.id.error_tips_show, message);
}
mViewHelper.showCaseLayout(mErrorView);
<DeepExtract>
if (mLoadingProgress != null && mLoadingProgress.isSpinning()) {
mLoadingProgress.stopSpinning();
}
</DeepExtract>
}
|
RAD
|
positive
| 310
|
public static Integer[] sort(Integer[] a, Integer length) {
if (length - 0 <= 1) {
return a;
} else {
}
int left_start = 0;
int left_end = (0 + length) / 2;
int right_start = left_end;
int right_end = length;
mergesort_r(left_start, left_end, a);
mergesort_r(right_start, right_end, a);
merge(a, left_start, left_end, right_start, right_end);
return a;
return a;
}
|
public static Integer[] sort(Integer[] a, Integer length) {
<DeepExtract>
if (length - 0 <= 1) {
return a;
} else {
}
int left_start = 0;
int left_end = (0 + length) / 2;
int right_start = left_end;
int right_end = length;
mergesort_r(left_start, left_end, a);
mergesort_r(right_start, right_end, a);
merge(a, left_start, left_end, right_start, right_end);
return a;
</DeepExtract>
return a;
}
|
gin
|
positive
| 311
|
private void addRecord(int index, org.tosl.coronawarncompanion.gmsreadout.ContactRecordsProtos.ScanRecord value) {
value.getClass();
com.google.protobuf.Internal.ProtobufList<org.tosl.coronawarncompanion.gmsreadout.ContactRecordsProtos.ScanRecord> tmp = record_;
if (!tmp.isModifiable()) {
record_ = com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
record_.add(index, value);
}
|
private void addRecord(int index, org.tosl.coronawarncompanion.gmsreadout.ContactRecordsProtos.ScanRecord value) {
value.getClass();
<DeepExtract>
com.google.protobuf.Internal.ProtobufList<org.tosl.coronawarncompanion.gmsreadout.ContactRecordsProtos.ScanRecord> tmp = record_;
if (!tmp.isModifiable()) {
record_ = com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
</DeepExtract>
record_.add(index, value);
}
|
corona-warn-companion-android
|
positive
| 312
|
@Override
public void onServicesDiscoveredBase(BleDevice bleDevice, BluetoothGatt gatt, int status) {
if (Looper.myLooper() != Looper.getMainLooper()) {
mHandler.post(() -> onServicesDiscovered(bleDevice, gatt, status));
} else {
() -> onServicesDiscovered(bleDevice, gatt, status).run();
}
}
|
@Override
public void onServicesDiscoveredBase(BleDevice bleDevice, BluetoothGatt gatt, int status) {
<DeepExtract>
if (Looper.myLooper() != Looper.getMainLooper()) {
mHandler.post(() -> onServicesDiscovered(bleDevice, gatt, status));
} else {
() -> onServicesDiscovered(bleDevice, gatt, status).run();
}
</DeepExtract>
}
|
BLELib
|
positive
| 313
|
void WriteEndMarker(int posState) throws IOException {
if (!_writeEndMark)
return;
if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumLowLenSymbols) {
_isMatch.Encode(_choice, 0, 0);
_lowCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState);
} else {
(_state << Base.kNumPosStatesBitsMax) + posState -= Base.kNumLowLenSymbols;
_isMatch.Encode(_choice, 0, 1);
if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumMidLenSymbols) {
_isMatch.Encode(_choice, 1, 0);
_midCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState);
} else {
_isMatch.Encode(_choice, 1, 1);
_highCoder.Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState - Base.kNumMidLenSymbols);
}
}
if (_state < Base.kNumLowLenSymbols) {
_isRep.Encode(_choice, 0, 0);
_lowCoder[0].Encode(_isRep, _state);
} else {
_state -= Base.kNumLowLenSymbols;
_isRep.Encode(_choice, 0, 1);
if (_state < Base.kNumMidLenSymbols) {
_isRep.Encode(_choice, 1, 0);
_midCoder[0].Encode(_isRep, _state);
} else {
_isRep.Encode(_choice, 1, 1);
_highCoder.Encode(_isRep, _state - Base.kNumMidLenSymbols);
}
}
_state = Base.StateUpdateMatch(_state);
int len = Base.kMatchMinLen;
if (len - Base.kMatchMinLen < Base.kNumLowLenSymbols) {
_rangeEncoder.Encode(_choice, 0, 0);
_lowCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen);
} else {
len - Base.kMatchMinLen -= Base.kNumLowLenSymbols;
_rangeEncoder.Encode(_choice, 0, 1);
if (len - Base.kMatchMinLen < Base.kNumMidLenSymbols) {
_rangeEncoder.Encode(_choice, 1, 0);
_midCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen);
} else {
_rangeEncoder.Encode(_choice, 1, 1);
_highCoder.Encode(_rangeEncoder, len - Base.kMatchMinLen - Base.kNumMidLenSymbols);
}
}
int posSlot = (1 << Base.kNumPosSlotBits) - 1;
int lenToPosState = Base.GetLenToPosState(len);
int context = 1;
for (int i = 7; i >= 0; i--) {
int bit = ((posSlot >> i) & 1);
_rangeEncoder.Encode(m_Encoders, context, bit);
context = (context << 1) | bit;
}
int footerBits = 30;
int posReduced = (1 << footerBits) - 1;
_rangeEncoder.EncodeDirectBits(posReduced >> Base.kNumAlignBits, footerBits - Base.kNumAlignBits);
_posAlignEncoder.ReverseEncode(_rangeEncoder, posReduced & Base.kAlignMask);
}
|
void WriteEndMarker(int posState) throws IOException {
if (!_writeEndMark)
return;
if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumLowLenSymbols) {
_isMatch.Encode(_choice, 0, 0);
_lowCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState);
} else {
(_state << Base.kNumPosStatesBitsMax) + posState -= Base.kNumLowLenSymbols;
_isMatch.Encode(_choice, 0, 1);
if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumMidLenSymbols) {
_isMatch.Encode(_choice, 1, 0);
_midCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState);
} else {
_isMatch.Encode(_choice, 1, 1);
_highCoder.Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState - Base.kNumMidLenSymbols);
}
}
if (_state < Base.kNumLowLenSymbols) {
_isRep.Encode(_choice, 0, 0);
_lowCoder[0].Encode(_isRep, _state);
} else {
_state -= Base.kNumLowLenSymbols;
_isRep.Encode(_choice, 0, 1);
if (_state < Base.kNumMidLenSymbols) {
_isRep.Encode(_choice, 1, 0);
_midCoder[0].Encode(_isRep, _state);
} else {
_isRep.Encode(_choice, 1, 1);
_highCoder.Encode(_isRep, _state - Base.kNumMidLenSymbols);
}
}
_state = Base.StateUpdateMatch(_state);
int len = Base.kMatchMinLen;
if (len - Base.kMatchMinLen < Base.kNumLowLenSymbols) {
_rangeEncoder.Encode(_choice, 0, 0);
_lowCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen);
} else {
len - Base.kMatchMinLen -= Base.kNumLowLenSymbols;
_rangeEncoder.Encode(_choice, 0, 1);
if (len - Base.kMatchMinLen < Base.kNumMidLenSymbols) {
_rangeEncoder.Encode(_choice, 1, 0);
_midCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen);
} else {
_rangeEncoder.Encode(_choice, 1, 1);
_highCoder.Encode(_rangeEncoder, len - Base.kMatchMinLen - Base.kNumMidLenSymbols);
}
}
int posSlot = (1 << Base.kNumPosSlotBits) - 1;
int lenToPosState = Base.GetLenToPosState(len);
<DeepExtract>
int context = 1;
for (int i = 7; i >= 0; i--) {
int bit = ((posSlot >> i) & 1);
_rangeEncoder.Encode(m_Encoders, context, bit);
context = (context << 1) | bit;
}
</DeepExtract>
int footerBits = 30;
int posReduced = (1 << footerBits) - 1;
_rangeEncoder.EncodeDirectBits(posReduced >> Base.kNumAlignBits, footerBits - Base.kNumAlignBits);
_posAlignEncoder.ReverseEncode(_rangeEncoder, posReduced & Base.kAlignMask);
}
|
jarchive
|
positive
| 314
|
@Override
public void onPrepared() {
mCurrentPlayState = STATE_PREPARED;
if (mVideoController != null)
mVideoController.setPlayState(STATE_PREPARED);
if (mOnVideoViewStateChangeListeners != null) {
for (int i = 0, z = mOnVideoViewStateChangeListeners.size(); i < z; i++) {
OnVideoViewStateChangeListener listener = mOnVideoViewStateChangeListeners.get(i);
if (listener != null) {
listener.onPlayStateChanged(STATE_PREPARED);
}
}
}
if (mCurrentPosition > 0) {
seekTo(mCurrentPosition);
}
}
|
@Override
public void onPrepared() {
<DeepExtract>
mCurrentPlayState = STATE_PREPARED;
if (mVideoController != null)
mVideoController.setPlayState(STATE_PREPARED);
if (mOnVideoViewStateChangeListeners != null) {
for (int i = 0, z = mOnVideoViewStateChangeListeners.size(); i < z; i++) {
OnVideoViewStateChangeListener listener = mOnVideoViewStateChangeListeners.get(i);
if (listener != null) {
listener.onPlayStateChanged(STATE_PREPARED);
}
}
}
</DeepExtract>
if (mCurrentPosition > 0) {
seekTo(mCurrentPosition);
}
}
|
dkplayer
|
positive
| 315
|
public void release() {
if (null != mediaPlayer) {
if (mediaPlayer.isPlaying()) {
mediaPlayer.stop();
}
mediaPlayer.reset();
}
if (null != mediaPlayer) {
mediaPlayer.release();
mediaPlayer = null;
}
}
|
public void release() {
<DeepExtract>
if (null != mediaPlayer) {
if (mediaPlayer.isPlaying()) {
mediaPlayer.stop();
}
mediaPlayer.reset();
}
</DeepExtract>
if (null != mediaPlayer) {
mediaPlayer.release();
mediaPlayer = null;
}
}
|
bigapple
|
positive
| 316
|
public static int width(Component component) {
Dimension dim = component.minimumSize();
return dim.width;
}
|
public static int width(Component component) {
<DeepExtract>
Dimension dim = component.minimumSize();
return dim.width;
</DeepExtract>
}
|
javancss
|
positive
| 317
|
@Override
protected void draw(Graphics g) {
if (bFirstDraw) {
bFirstDraw = false;
Dimension size = this.getSize();
_origin.x = size.width / 2;
_origin.y = size.height / 2;
}
final Dimension originPointerSize = new Dimension(26, 3);
super.draw(g);
g.setColor(Color.LIGHT_GRAY);
g.drawLine(0, _origin.y, getSize().width, _origin.y);
g.drawLine(_origin.x, 0, _origin.x, getSize().height);
g.setColor(Color.RED);
int x = _origin.x;
if (x < 0)
x = 0;
else if (x >= getSize().width)
x = getSize().width - originPointerSize.height;
int y = _origin.y;
if (y < 0)
y = 0;
else if (y >= getSize().height)
y = getSize().height - originPointerSize.height;
if (_origin.y <= 0 || _origin.y >= getSize().height) {
g.fillRect(x - (originPointerSize.width / 2), y, originPointerSize.width, originPointerSize.height);
}
if (_origin.x <= 0 || _origin.x >= getSize().width) {
g.fillRect(x, y - (originPointerSize.width / 2), originPointerSize.height, originPointerSize.width);
}
if (onionSkins == null)
return;
float alpha = 1.0f;
for (int i = 0; i < onionSkins.length; ++i) {
alpha /= 3.0f;
AnimationCell cell = onionSkins[i];
ArrayList<GraphicObject> graphics = cell.getGraphicList();
for (int j = 0; j < graphics.size(); ++j) {
GraphicObject graphic = graphics.get(j);
this.drawGraphicRotated(graphic, g, _origin, _zoom, alpha);
}
}
}
|
@Override
protected void draw(Graphics g) {
if (bFirstDraw) {
bFirstDraw = false;
Dimension size = this.getSize();
_origin.x = size.width / 2;
_origin.y = size.height / 2;
}
final Dimension originPointerSize = new Dimension(26, 3);
super.draw(g);
g.setColor(Color.LIGHT_GRAY);
g.drawLine(0, _origin.y, getSize().width, _origin.y);
g.drawLine(_origin.x, 0, _origin.x, getSize().height);
g.setColor(Color.RED);
int x = _origin.x;
if (x < 0)
x = 0;
else if (x >= getSize().width)
x = getSize().width - originPointerSize.height;
int y = _origin.y;
if (y < 0)
y = 0;
else if (y >= getSize().height)
y = getSize().height - originPointerSize.height;
if (_origin.y <= 0 || _origin.y >= getSize().height) {
g.fillRect(x - (originPointerSize.width / 2), y, originPointerSize.width, originPointerSize.height);
}
if (_origin.x <= 0 || _origin.x >= getSize().width) {
g.fillRect(x, y - (originPointerSize.width / 2), originPointerSize.height, originPointerSize.width);
}
<DeepExtract>
if (onionSkins == null)
return;
float alpha = 1.0f;
for (int i = 0; i < onionSkins.length; ++i) {
alpha /= 3.0f;
AnimationCell cell = onionSkins[i];
ArrayList<GraphicObject> graphics = cell.getGraphicList();
for (int j = 0; j < graphics.size(); ++j) {
GraphicObject graphic = graphics.get(j);
this.drawGraphicRotated(graphic, g, _origin, _zoom, alpha);
}
}
</DeepExtract>
}
|
darkFunction-Editor
|
positive
| 319
|
public Integer negate(Integer x) {
Objects.requireNonNull(x);
int y = x.intValue();
if (y < 0 || y >= size)
throw new IllegalArgumentException("Not an element of this field: " + y);
return y;
}
|
public Integer negate(Integer x) {
<DeepExtract>
Objects.requireNonNull(x);
int y = x.intValue();
if (y < 0 || y >= size)
throw new IllegalArgumentException("Not an element of this field: " + y);
return y;
</DeepExtract>
}
|
Nayuki-web-published-code
|
positive
| 320
|
private void removeSegment(int i, int j) {
int[] segments = m_segments[i];
int jmax;
for (int i = segments.length - 1; i >= 0; i--) {
if (segments[i] != NoneSegment) {
jmax = i;
}
}
throw new Error("Invalid segments state");
for (int n = j; n < jmax; n++) {
segments[n] = segments[n + 1];
}
segments[jmax] = NoneSegment;
if (j == 0) {
m_ymin[i]++;
}
}
|
private void removeSegment(int i, int j) {
int[] segments = m_segments[i];
<DeepExtract>
int jmax;
for (int i = segments.length - 1; i >= 0; i--) {
if (segments[i] != NoneSegment) {
jmax = i;
}
}
throw new Error("Invalid segments state");
</DeepExtract>
for (int n = j; n < jmax; n++) {
segments[n] = segments[n + 1];
}
segments[jmax] = NoneSegment;
if (j == 0) {
m_ymin[i]++;
}
}
|
CubicChunks
|
positive
| 321
|
public void actionPerformed(ActionEvent e) {
try {
boolean printed = editor.print();
} catch (PrinterException ex) {
logger.log(Level.SEVERE, "PrinterException when trying to print StoryMap.", ex);
}
}
|
public void actionPerformed(ActionEvent e) {
<DeepExtract>
try {
boolean printed = editor.print();
} catch (PrinterException ex) {
logger.log(Level.SEVERE, "PrinterException when trying to print StoryMap.", ex);
}
</DeepExtract>
}
|
storymaps
|
positive
| 322
|
@Override
public ResponseFuture<InputStream> asInputStream() {
return execute(new InputStreamParser(), null);
}
|
@Override
public ResponseFuture<InputStream> asInputStream() {
<DeepExtract>
return execute(new InputStreamParser(), null);
</DeepExtract>
}
|
ion
|
positive
| 323
|
private String parsePattern(String grokPattern) {
byte[] grokPatternBytes = grokPattern.getBytes(StandardCharsets.UTF_8);
Matcher matcher = GROK_PATTERN_REGEX.matcher(grokPatternBytes);
int result = matcher.search(0, grokPatternBytes.length, Option.NONE);
boolean matchNotFound = result == -1;
if (matchNotFound) {
return grokPattern;
}
Region region = matcher.getEagerRegion();
String patternName;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(PATTERN_GROUP.getBytes(StandardCharsets.UTF_8), 0, PATTERN_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(PATTERN_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
patternName = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
patternName = null;
}
String subName;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(SUBNAME_GROUP.getBytes(StandardCharsets.UTF_8), 0, SUBNAME_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(SUBNAME_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
subName = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
subName = null;
}
String definition;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(DEFINITION_GROUP.getBytes(StandardCharsets.UTF_8), 0, DEFINITION_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(DEFINITION_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
definition = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
definition = null;
}
if (isNotEmpty(definition)) {
addPattern(patternName, definition);
}
String pattern = patternBank.get(patternName);
if (pattern == null) {
throw new RuntimeException(String.format("failed to create grok, unknown " + Grok.PATTERN_GROUP + " [%s]", grokPattern));
}
if (namedOnly && isNotEmpty(subName)) {
grokPart = String.format("(?<%s>%s)", subName, pattern);
} else if (!namedOnly) {
grokPart = String.format("(?<%s>%s)", patternName + String.valueOf(result), pattern);
} else {
grokPart = String.format("(?:%s)", pattern);
}
String start;
try {
start = new String(grokPatternBytes, 0, result - 0, StandardCharsets.UTF_8);
} catch (StringIndexOutOfBoundsException e) {
start = null;
}
String rest;
try {
rest = new String(grokPatternBytes, region.end[0], grokPatternBytes.length - region.end[0], StandardCharsets.UTF_8);
} catch (StringIndexOutOfBoundsException e) {
rest = null;
}
return start + parsePattern(grokPart + rest);
}
|
private String parsePattern(String grokPattern) {
byte[] grokPatternBytes = grokPattern.getBytes(StandardCharsets.UTF_8);
Matcher matcher = GROK_PATTERN_REGEX.matcher(grokPatternBytes);
int result = matcher.search(0, grokPatternBytes.length, Option.NONE);
boolean matchNotFound = result == -1;
if (matchNotFound) {
return grokPattern;
}
Region region = matcher.getEagerRegion();
String patternName;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(PATTERN_GROUP.getBytes(StandardCharsets.UTF_8), 0, PATTERN_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(PATTERN_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
patternName = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
patternName = null;
}
String subName;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(SUBNAME_GROUP.getBytes(StandardCharsets.UTF_8), 0, SUBNAME_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(SUBNAME_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
subName = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
subName = null;
}
String definition;
try {
int matchNumber = GROK_PATTERN_REGEX.nameToBackrefNumber(DEFINITION_GROUP.getBytes(StandardCharsets.UTF_8), 0, DEFINITION_GROUP.getBytes(StandardCharsets.UTF_8).length, region);
Match match = match(DEFINITION_GROUP, region, grokPattern.getBytes(), matchNumber);
List<Object> values = match.getValues();
definition = values.size() == 0 ? null : (String) values.get(0);
} catch (ValueException e) {
definition = null;
}
if (isNotEmpty(definition)) {
addPattern(patternName, definition);
}
String pattern = patternBank.get(patternName);
if (pattern == null) {
throw new RuntimeException(String.format("failed to create grok, unknown " + Grok.PATTERN_GROUP + " [%s]", grokPattern));
}
if (namedOnly && isNotEmpty(subName)) {
grokPart = String.format("(?<%s>%s)", subName, pattern);
} else if (!namedOnly) {
grokPart = String.format("(?<%s>%s)", patternName + String.valueOf(result), pattern);
} else {
grokPart = String.format("(?:%s)", pattern);
}
String start;
try {
start = new String(grokPatternBytes, 0, result - 0, StandardCharsets.UTF_8);
} catch (StringIndexOutOfBoundsException e) {
start = null;
}
<DeepExtract>
String rest;
try {
rest = new String(grokPatternBytes, region.end[0], grokPatternBytes.length - region.end[0], StandardCharsets.UTF_8);
} catch (StringIndexOutOfBoundsException e) {
rest = null;
}
</DeepExtract>
return start + parsePattern(grokPart + rest);
}
|
sawmill
|
positive
| 324
|
public void start() {
_state.start();
_state = State.STATE_LOGGING;
}
|
public void start() {
_state.start();
<DeepExtract>
_state = State.STATE_LOGGING;
</DeepExtract>
}
|
006921
|
positive
| 325
|
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) {
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) {
Log.e(TAG, "Purchase verification failed: missing data.");
return false;
}
PublicKey key;
try {
byte[] decodedKey = Base64.decode(base64PublicKey);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
key = keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeySpecException e) {
Log.e(TAG, "Invalid key specification.");
throw new IllegalArgumentException(e);
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
throw new IllegalArgumentException(e);
}
Signature sig;
try {
sig = Signature.getInstance(SIGNATURE_ALGORITHM);
sig.initVerify(key);
sig.update(signedData.getBytes());
if (!sig.verify(Base64.decode(signature))) {
Log.e(TAG, "Signature verification failed.");
return false;
}
return true;
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, "NoSuchAlgorithmException.");
} catch (InvalidKeyException e) {
Log.e(TAG, "Invalid key specification.");
} catch (SignatureException e) {
Log.e(TAG, "Signature exception.");
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
}
return false;
}
|
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) {
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) {
Log.e(TAG, "Purchase verification failed: missing data.");
return false;
}
PublicKey key;
try {
byte[] decodedKey = Base64.decode(base64PublicKey);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
key = keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeySpecException e) {
Log.e(TAG, "Invalid key specification.");
throw new IllegalArgumentException(e);
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
throw new IllegalArgumentException(e);
}
<DeepExtract>
Signature sig;
try {
sig = Signature.getInstance(SIGNATURE_ALGORITHM);
sig.initVerify(key);
sig.update(signedData.getBytes());
if (!sig.verify(Base64.decode(signature))) {
Log.e(TAG, "Signature verification failed.");
return false;
}
return true;
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, "NoSuchAlgorithmException.");
} catch (InvalidKeyException e) {
Log.e(TAG, "Invalid key specification.");
} catch (SignatureException e) {
Log.e(TAG, "Signature exception.");
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
}
return false;
</DeepExtract>
}
|
Cocos2d-x-Guessing-Game
|
positive
| 326
|
private void assertEntityCleanState(final EUser entity) {
assertNull(ReflectionTestUtils.getField(entity, "username"));
assertNull(ReflectionTestUtils.getField(entity, "email"));
assertNull(ReflectionTestUtils.getField(entity, "name"));
assertNull(ReflectionTestUtils.getField(entity, "lastName"));
assertNull(ReflectionTestUtils.getField(entity, "password"));
if (ReflectionTestUtils.getField(entity, "enabled") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "enabled").toString()));
}
if (ReflectionTestUtils.getField(entity, "emailVerified") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "emailVerified").toString()));
}
if (ReflectionTestUtils.getField(entity, "accountNonExpired") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "accountNonExpired").toString()));
}
if (ReflectionTestUtils.getField(entity, "accountNonLocked") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "accountNonLocked").toString()));
}
if (ReflectionTestUtils.getField(entity, "credentialsNonExpired") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "credentialsNonExpired").toString()));
}
assertNull(ReflectionTestUtils.getField(entity, "authorities"));
}
|
private void assertEntityCleanState(final EUser entity) {
assertNull(ReflectionTestUtils.getField(entity, "username"));
assertNull(ReflectionTestUtils.getField(entity, "email"));
assertNull(ReflectionTestUtils.getField(entity, "name"));
assertNull(ReflectionTestUtils.getField(entity, "lastName"));
assertNull(ReflectionTestUtils.getField(entity, "password"));
if (ReflectionTestUtils.getField(entity, "enabled") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "enabled").toString()));
}
if (ReflectionTestUtils.getField(entity, "emailVerified") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "emailVerified").toString()));
}
if (ReflectionTestUtils.getField(entity, "accountNonExpired") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "accountNonExpired").toString()));
}
if (ReflectionTestUtils.getField(entity, "accountNonLocked") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "accountNonLocked").toString()));
}
<DeepExtract>
if (ReflectionTestUtils.getField(entity, "credentialsNonExpired") != null) {
assertFalse(Boolean.parseBoolean(ReflectionTestUtils.getField(entity, "credentialsNonExpired").toString()));
}
</DeepExtract>
assertNull(ReflectionTestUtils.getField(entity, "authorities"));
}
|
gms
|
positive
| 327
|
@Override
public void onDrmSessionManagerError(Exception e) {
Log.e(TAG, "internalError [" + getSessionTimeString() + ", " + "drmSessionManagerError" + "]", e);
}
|
@Override
public void onDrmSessionManagerError(Exception e) {
<DeepExtract>
Log.e(TAG, "internalError [" + getSessionTimeString() + ", " + "drmSessionManagerError" + "]", e);
</DeepExtract>
}
|
iview-android-tv
|
positive
| 328
|
@Override
protected void onPause() {
super.onPause();
mSwitchCameraBtn.setEnabled(!false);
mRecordBtn.setActivated(false);
mShortVideoRecorder.pause();
}
|
@Override
protected void onPause() {
super.onPause();
<DeepExtract>
mSwitchCameraBtn.setEnabled(!false);
mRecordBtn.setActivated(false);
</DeepExtract>
mShortVideoRecorder.pause();
}
|
eden
|
positive
| 329
|
@Test
public void mergeAnyAndAnyExisting() {
assertEqual(any() + " merged with " + anyExisting(), anyExisting(), merge(any(), anyExisting()));
assertEqual(anyExisting() + " merged with " + any(), anyExisting(), merge(anyExisting(), any()));
}
|
@Test
public void mergeAnyAndAnyExisting() {
<DeepExtract>
assertEqual(any() + " merged with " + anyExisting(), anyExisting(), merge(any(), anyExisting()));
assertEqual(anyExisting() + " merged with " + any(), anyExisting(), merge(anyExisting(), any()));
</DeepExtract>
}
|
sourcerer
|
positive
| 330
|
private void MenuItemFileOpenActionPerformed(java.awt.event.ActionEvent evt) {
chooser.rescanCurrentDirectory();
int success = chooser.showOpenDialog(LeftBasePane);
if (success == JFileChooser.APPROVE_OPTION) {
SavePath();
int isOpen = -1;
for (int i = 0; i < iFile.size(); i++) {
if (chooser.getSelectedFile().getPath().equals(iFile.get(i).getPath())) {
iTab = i;
isOpen = i;
break;
}
}
if (isOpen >= 0) {
FilesTabbedPane.setSelectedIndex(iTab);
UpdateEditorButtons();
FileName = chooser.getSelectedFile().getName();
log("File " + FileName + " already open, select tab to file " + FileName);
JOptionPane.showMessageDialog(null, "File " + FileName + " already open. You can use 'Reload' only.");
return;
}
if (!isFileNew() || isChanged()) {
AddTab("");
}
log("Try to open file " + chooser.getSelectedFile().getName());
try {
iFile.set(iTab, chooser.getSelectedFile());
FileName = iFile.get(iTab).getName();
log("File name: " + iFile.get(iTab).getPath());
if (iFile.get(iTab).length() > 1024 * 1024) {
JOptionPane.showMessageDialog(null, "File " + FileName + " too large.");
log("File too large. Size: " + Long.toString(iFile.get(iTab).length() / 1024 / 1024) + " Mb, file: " + iFile.get(iTab).getPath());
UpdateEditorButtons();
return;
}
FilesTabbedPane.setTitleAt(iTab, iFile.get(iTab).getName());
} catch (HeadlessException ex) {
JOptionPane.showMessageDialog(null, "Error, file is not open!");
log(ex.toString());
log("Open: FAIL.");
}
if (LoadFile()) {
log("Open \"" + FileName + "\": Success.");
}
}
UpdateEditorButtons();
}
|
private void MenuItemFileOpenActionPerformed(java.awt.event.ActionEvent evt) {
<DeepExtract>
chooser.rescanCurrentDirectory();
int success = chooser.showOpenDialog(LeftBasePane);
if (success == JFileChooser.APPROVE_OPTION) {
SavePath();
int isOpen = -1;
for (int i = 0; i < iFile.size(); i++) {
if (chooser.getSelectedFile().getPath().equals(iFile.get(i).getPath())) {
iTab = i;
isOpen = i;
break;
}
}
if (isOpen >= 0) {
FilesTabbedPane.setSelectedIndex(iTab);
UpdateEditorButtons();
FileName = chooser.getSelectedFile().getName();
log("File " + FileName + " already open, select tab to file " + FileName);
JOptionPane.showMessageDialog(null, "File " + FileName + " already open. You can use 'Reload' only.");
return;
}
if (!isFileNew() || isChanged()) {
AddTab("");
}
log("Try to open file " + chooser.getSelectedFile().getName());
try {
iFile.set(iTab, chooser.getSelectedFile());
FileName = iFile.get(iTab).getName();
log("File name: " + iFile.get(iTab).getPath());
if (iFile.get(iTab).length() > 1024 * 1024) {
JOptionPane.showMessageDialog(null, "File " + FileName + " too large.");
log("File too large. Size: " + Long.toString(iFile.get(iTab).length() / 1024 / 1024) + " Mb, file: " + iFile.get(iTab).getPath());
UpdateEditorButtons();
return;
}
FilesTabbedPane.setTitleAt(iTab, iFile.get(iTab).getName());
} catch (HeadlessException ex) {
JOptionPane.showMessageDialog(null, "Error, file is not open!");
log(ex.toString());
log("Open: FAIL.");
}
if (LoadFile()) {
log("Open \"" + FileName + "\": Success.");
}
}
UpdateEditorButtons();
</DeepExtract>
}
|
ESPlorer
|
positive
| 331
|
@Override
public long getLong(String key, long defValue) throws ClassCastException {
if (mSharedPreferences == null) {
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
}
try {
return mSharedPreferences.getLong(key, defValue);
} catch (final ClassCastException e) {
final String returnType = new Object() {
}.getClass().getEnclosingMethod().getReturnType().toString();
throw new ClassCastException("\n ======================================== \nClassCastException : " + key + "'s value is not a " + returnType + " \n ======================================== \n");
}
}
|
@Override
public long getLong(String key, long defValue) throws ClassCastException {
<DeepExtract>
if (mSharedPreferences == null) {
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
}
</DeepExtract>
try {
return mSharedPreferences.getLong(key, defValue);
} catch (final ClassCastException e) {
final String returnType = new Object() {
}.getClass().getEnclosingMethod().getReturnType().toString();
throw new ClassCastException("\n ======================================== \nClassCastException : " + key + "'s value is not a " + returnType + " \n ======================================== \n");
}
}
|
RxAndroidBootstrap
|
positive
| 332
|
@Override
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
if (mListenerCollection.errorListener != null) {
mInErrorCallback = true;
if (mListenerCollection.errorListener.onError(mp, what, extra)) {
if (mInErrorCallback) {
setState(ERROR);
}
return true;
}
}
mState = ERROR;
mInErrorCallback = false;
onStateChanged();
return false;
}
|
@Override
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
if (mListenerCollection.errorListener != null) {
mInErrorCallback = true;
if (mListenerCollection.errorListener.onError(mp, what, extra)) {
if (mInErrorCallback) {
setState(ERROR);
}
return true;
}
}
<DeepExtract>
mState = ERROR;
mInErrorCallback = false;
onStateChanged();
</DeepExtract>
return false;
}
|
PlayerHater
|
positive
| 333
|
private void initializeBitmap() {
BitmapDrawable bd = (BitmapDrawable) getDrawable();
if (bd != null) {
mBitmap = bd.getBitmap();
}
if (getWidth() == 0 || getHeight() == 0 || mBitmap == null) {
return;
}
configPath();
if (mUseColor == -2) {
mPaint.setShader(null);
if (mArcBlur != -1) {
mBlurBitmap = mBitmap.copy(Bitmap.Config.ARGB_8888, true);
mBitmap = blur(getContext(), mBlurBitmap, mArcBlur);
}
mShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mPaint.setShader(mShader);
updateMatrix();
}
postInvalidate();
}
|
private void initializeBitmap() {
BitmapDrawable bd = (BitmapDrawable) getDrawable();
if (bd != null) {
mBitmap = bd.getBitmap();
}
<DeepExtract>
if (getWidth() == 0 || getHeight() == 0 || mBitmap == null) {
return;
}
configPath();
if (mUseColor == -2) {
mPaint.setShader(null);
if (mArcBlur != -1) {
mBlurBitmap = mBitmap.copy(Bitmap.Config.ARGB_8888, true);
mBitmap = blur(getContext(), mBlurBitmap, mArcBlur);
}
mShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mPaint.setShader(mShader);
updateMatrix();
}
postInvalidate();
</DeepExtract>
}
|
ViewPagerHelper
|
positive
| 334
|
@Override
public void captureStartValues(TransitionValues transitionValues) {
if (transitionValues.view instanceof MusicCoverView) {
transitionValues.values.put(PROPNAME_RADIUS, "start");
transitionValues.values.put(PROPNAME_ALPHA, "start");
}
}
|
@Override
public void captureStartValues(TransitionValues transitionValues) {
<DeepExtract>
if (transitionValues.view instanceof MusicCoverView) {
transitionValues.values.put(PROPNAME_RADIUS, "start");
transitionValues.values.put(PROPNAME_ALPHA, "start");
}
</DeepExtract>
}
|
LightWeightMusicPlayer
|
positive
| 335
|
private ListNode concat(ListNode left, ListNode middle, ListNode right) {
ListNode dummy = new ListNode(0);
ListNode tail = dummy;
tail.next = left;
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
tail.next = middle;
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
tail.next = right;
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
return dummy.next;
}
|
private ListNode concat(ListNode left, ListNode middle, ListNode right) {
ListNode dummy = new ListNode(0);
ListNode tail = dummy;
tail.next = left;
<DeepExtract>
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
</DeepExtract>
tail.next = middle;
<DeepExtract>
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
</DeepExtract>
tail.next = right;
<DeepExtract>
if (tail == null) {
tail = null;
}
while (tail.next != null) {
tail = tail.next;
}
return tail;
</DeepExtract>
return dummy.next;
}
|
LintCode
|
positive
| 336
|
public void updateItem(@NonNull IDrawerItem drawerItem) {
if (mDrawerBuilder.checkDrawerItem(getPosition(drawerItem), false)) {
mDrawerBuilder.getAdapter().setDrawerItem(getPosition(drawerItem), drawerItem);
}
}
|
public void updateItem(@NonNull IDrawerItem drawerItem) {
<DeepExtract>
if (mDrawerBuilder.checkDrawerItem(getPosition(drawerItem), false)) {
mDrawerBuilder.getAdapter().setDrawerItem(getPosition(drawerItem), drawerItem);
}
</DeepExtract>
}
|
MaterialDrawer-Xamarin
|
positive
| 337
|
private void jButtonTambahActionPerformed(java.awt.event.ActionEvent evt) {
TambahJabatanView view = new TambahJabatanView(getFormApp());
setLocationRelativeTo(this);
resetTable();
Pengguna pengguna = LoginManager.getInstance().getPengguna();
Grup grup = pengguna.getGrup();
jButtonHapus.setEnabled(grup.mengandungHakAkses(HakAksesConstant.HAPUS_JABATAN));
jButtonTambah.setEnabled(grup.mengandungHakAkses(HakAksesConstant.TAMBAH_JABATAN));
jButtonUbah.setEnabled(grup.mengandungHakAkses(HakAksesConstant.UBAH_JABATAN));
setVisible(true);
JabatanService jabatanService = SpringManager.getInstance().getBean(JabatanService.class);
dynamicTableModel.clear();
for (Jabatan jabatan : jabatanService.findAll()) {
dynamicTableModel.add(jabatan);
}
}
|
private void jButtonTambahActionPerformed(java.awt.event.ActionEvent evt) {
TambahJabatanView view = new TambahJabatanView(getFormApp());
setLocationRelativeTo(this);
resetTable();
Pengguna pengguna = LoginManager.getInstance().getPengguna();
Grup grup = pengguna.getGrup();
jButtonHapus.setEnabled(grup.mengandungHakAkses(HakAksesConstant.HAPUS_JABATAN));
jButtonTambah.setEnabled(grup.mengandungHakAkses(HakAksesConstant.TAMBAH_JABATAN));
jButtonUbah.setEnabled(grup.mengandungHakAkses(HakAksesConstant.UBAH_JABATAN));
setVisible(true);
<DeepExtract>
JabatanService jabatanService = SpringManager.getInstance().getBean(JabatanService.class);
dynamicTableModel.clear();
for (Jabatan jabatan : jabatanService.findAll()) {
dynamicTableModel.add(jabatan);
}
</DeepExtract>
}
|
simple-pos
|
positive
| 340
|
public void submit() {
if (mode == Overlay.SAVE) {
save = new Save();
save.save(getEditedImage());
} else if (mode == Overlay.UPLOAD) {
upload = new Upload(getEditedImage(), false);
} else if (mode == Overlay.UPLOAD_FTP) {
new SimpleFTPUploader(ImageUtilities.saveTemporarily(getEditedImage()));
}
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(keyDispatcher);
keyDispatcher = null;
((EditorPanel) editorPanel).dispose();
instance.dispose();
}
|
public void submit() {
if (mode == Overlay.SAVE) {
save = new Save();
save.save(getEditedImage());
} else if (mode == Overlay.UPLOAD) {
upload = new Upload(getEditedImage(), false);
} else if (mode == Overlay.UPLOAD_FTP) {
new SimpleFTPUploader(ImageUtilities.saveTemporarily(getEditedImage()));
}
<DeepExtract>
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(keyDispatcher);
keyDispatcher = null;
((EditorPanel) editorPanel).dispose();
instance.dispose();
</DeepExtract>
}
|
SnippingToolPlusPlus
|
positive
| 342
|
public void setInt(String key, int value) {
if ("" + value == null) {
remove(key);
return null;
} else {
return (String) put(key, "" + value);
}
}
|
public void setInt(String key, int value) {
<DeepExtract>
if ("" + value == null) {
remove(key);
return null;
} else {
return (String) put(key, "" + value);
}
</DeepExtract>
}
|
JErgometer
|
positive
| 343
|
protected void drawInflatedPOI(WFGraphics g, int left, int top, int width, int height) {
int triX1 = left + ((width - this.arrowHeight) >> 1);
int rectBottom = top + height - this.arrowHeight - 1;
int rectRight = left + width;
int triY1 = rectBottom;
int triX2 = triX1 + this.arrowHeight;
int triY2 = triY1;
int triX3 = triX2;
int triY3 = top + height;
g.setColor(bkgColorWhite);
g.fillRect(left, top, width, height - this.arrowHeight);
g.fillTriangle(triX1, triY1, triX2, triY2, triX3, triY3);
g.setColor(bkgColorGrayBorderLight);
g.drawLine(left, top, rectRight, top, 1);
g.drawLine(left, top, left, rectBottom, 1);
g.drawLine(triX1, triY1, triX3, triY3, 1);
g.setColor(bkgColorGrayBorderDark);
g.drawLine(rectRight, top, rectRight, rectBottom, 1);
g.drawLine(left, rectBottom, triX1, rectBottom, 1);
g.drawLine(triX2, rectBottom, rectRight, rectBottom, 1);
g.drawLine(triX2, triY2, triX3, triY3, 1);
int titleHeight = titleFont.getFontHeight() + PADDING + (PADDING >> 1);
g.setColor(bkgColorLight);
g.fillRect(left + 3, top + 3, width - 5, titleHeight);
g.setColor(bkgColorDark);
g.fillRect(left + 3, top + titleHeight + 3, width - 5, height - titleHeight - this.arrowHeight - 6);
int anchorLeftTop = WFGraphics.ANCHOR_LEFT | WFGraphics.ANCHOR_TOP;
g.setColor(bkgColorWhite);
int imageMaxSize = this.containerHeight - 12;
g.fillRect(left + 6, top + 6, imageMaxSize, imageMaxSize);
if (this.isImageValid()) {
g.drawImage(this.inflatedImage, left + 6 + (imageMaxSize >> 1), top + 6 + (imageMaxSize >> 1), WFGraphics.ANCHOR_HCENTER | WFGraphics.ANCHOR_VCENTER);
}
g.setColor(fontColor);
g.setFont(titleFont);
int maxTextWidth = this.textContainerWidth;
g.drawText(this.title, left + this.containerHeight - 6 + PADDING, top + PADDING, maxTextWidth, anchorLeftTop, "..");
if (this.distance != null) {
g.setFont(textFont);
g.drawText(this.distance, left + this.containerHeight - 6 + PADDING, top + PADDING + titleFont.getFontHeight() + PADDING + 3, anchorLeftTop);
}
}
|
protected void drawInflatedPOI(WFGraphics g, int left, int top, int width, int height) {
<DeepExtract>
int triX1 = left + ((width - this.arrowHeight) >> 1);
int rectBottom = top + height - this.arrowHeight - 1;
int rectRight = left + width;
int triY1 = rectBottom;
int triX2 = triX1 + this.arrowHeight;
int triY2 = triY1;
int triX3 = triX2;
int triY3 = top + height;
g.setColor(bkgColorWhite);
g.fillRect(left, top, width, height - this.arrowHeight);
g.fillTriangle(triX1, triY1, triX2, triY2, triX3, triY3);
g.setColor(bkgColorGrayBorderLight);
g.drawLine(left, top, rectRight, top, 1);
g.drawLine(left, top, left, rectBottom, 1);
g.drawLine(triX1, triY1, triX3, triY3, 1);
g.setColor(bkgColorGrayBorderDark);
g.drawLine(rectRight, top, rectRight, rectBottom, 1);
g.drawLine(left, rectBottom, triX1, rectBottom, 1);
g.drawLine(triX2, rectBottom, rectRight, rectBottom, 1);
g.drawLine(triX2, triY2, triX3, triY3, 1);
</DeepExtract>
int titleHeight = titleFont.getFontHeight() + PADDING + (PADDING >> 1);
g.setColor(bkgColorLight);
g.fillRect(left + 3, top + 3, width - 5, titleHeight);
g.setColor(bkgColorDark);
g.fillRect(left + 3, top + titleHeight + 3, width - 5, height - titleHeight - this.arrowHeight - 6);
int anchorLeftTop = WFGraphics.ANCHOR_LEFT | WFGraphics.ANCHOR_TOP;
g.setColor(bkgColorWhite);
int imageMaxSize = this.containerHeight - 12;
g.fillRect(left + 6, top + 6, imageMaxSize, imageMaxSize);
if (this.isImageValid()) {
g.drawImage(this.inflatedImage, left + 6 + (imageMaxSize >> 1), top + 6 + (imageMaxSize >> 1), WFGraphics.ANCHOR_HCENTER | WFGraphics.ANCHOR_VCENTER);
}
g.setColor(fontColor);
g.setFont(titleFont);
int maxTextWidth = this.textContainerWidth;
g.drawText(this.title, left + this.containerHeight - 6 + PADDING, top + PADDING, maxTextWidth, anchorLeftTop, "..");
if (this.distance != null) {
g.setFont(textFont);
g.drawText(this.distance, left + this.containerHeight - 6 + PADDING, top + PADDING + titleFont.getFontHeight() + PADDING + 3, anchorLeftTop);
}
}
|
Wayfinder-Android-Navigator
|
positive
| 344
|
@Override
public void onCreatePreferences(Bundle bundle, String s) {
addPreferencesFromResource(R.xml.pref_global);
mSnoozeDuration = (ListPreference) findPreference(getString(R.string.pref_snooze_duration_key));
mRingDuration = (ListPreference) findPreference(getString(R.string.pref_ring_duration_key));
mAlarmVolume = (VolumeSliderPreference) findPreference(getString(R.string.pref_ring_volume_key));
mEnableNotifications = (SwitchPreferenceCompat) findPreference(getString(R.string.pref_enable_notifications_key));
mEnableReliability = (SwitchPreferenceCompat) findPreference(getString(R.string.pref_enable_reliability_key));
mEnableReliability.setEnabled(mEnableNotifications.isChecked());
mSnoozeDuration.setSummary(mSnoozeDuration.getEntry());
mRingDuration.setSummary(mRingDuration.getEntry());
}
|
@Override
public void onCreatePreferences(Bundle bundle, String s) {
addPreferencesFromResource(R.xml.pref_global);
mSnoozeDuration = (ListPreference) findPreference(getString(R.string.pref_snooze_duration_key));
mRingDuration = (ListPreference) findPreference(getString(R.string.pref_ring_duration_key));
mAlarmVolume = (VolumeSliderPreference) findPreference(getString(R.string.pref_ring_volume_key));
mEnableNotifications = (SwitchPreferenceCompat) findPreference(getString(R.string.pref_enable_notifications_key));
mEnableReliability = (SwitchPreferenceCompat) findPreference(getString(R.string.pref_enable_reliability_key));
mEnableReliability.setEnabled(mEnableNotifications.isChecked());
<DeepExtract>
mSnoozeDuration.setSummary(mSnoozeDuration.getEntry());
mRingDuration.setSummary(mRingDuration.getEntry());
</DeepExtract>
}
|
ProjectOxford-Apps-MimickerAlarm
|
positive
| 345
|
protected JFreeChart createThroughputGraph(CategoryDataset dataset) {
final JFreeChart chart = ChartFactory.createLineChart(Messages.ProjectAction_Throughput(), null, Messages.ProjectAction_RequestsPerSeconds(), dataset, PlotOrientation.VERTICAL, true, true, false);
final LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.BOTTOM);
chart.setBackgroundPaint(Color.WHITE);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setOutlinePaint(null);
plot.setRangeGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.BLACK);
CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
plot.setDomainAxis(domainAxis);
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
domainAxis.setLowerMargin(0.0);
domainAxis.setUpperMargin(0.0);
domainAxis.setCategoryMargin(0.0);
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setBaseStroke(new BasicStroke(4.0f));
ColorPalette.apply(renderer);
plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));
return chart;
}
|
protected JFreeChart createThroughputGraph(CategoryDataset dataset) {
<DeepExtract>
final JFreeChart chart = ChartFactory.createLineChart(Messages.ProjectAction_Throughput(), null, Messages.ProjectAction_RequestsPerSeconds(), dataset, PlotOrientation.VERTICAL, true, true, false);
final LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.BOTTOM);
chart.setBackgroundPaint(Color.WHITE);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setOutlinePaint(null);
plot.setRangeGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.BLACK);
CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
plot.setDomainAxis(domainAxis);
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
domainAxis.setLowerMargin(0.0);
domainAxis.setUpperMargin(0.0);
domainAxis.setCategoryMargin(0.0);
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setBaseStroke(new BasicStroke(4.0f));
ColorPalette.apply(renderer);
plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));
return chart;
</DeepExtract>
}
|
performance-plugin
|
positive
| 346
|
public Document readFromFile(File file) throws JAXBException, FileNotFoundException, IOException {
JAXBContext ctx = JAXBContext.newInstance(XmlDocument.class);
Unmarshaller u = ctx.createUnmarshaller();
FileInputStream fileInputStream = new FileInputStream(file);
xmlDocument = (XmlDocument) u.unmarshal(fileInputStream);
fileInputStream.close();
idToXmlObject = new IdToXmlObject(xmlDocument);
Document document = new Document();
Subnet rootSubnet = getNewSubnet(xmlDocument.rootSubnet);
document.petriNet.setRootSubnet(rootSubnet);
constructInitialMarkingRecursively(document.petriNet.getInitialMarking(), xmlDocument.rootSubnet);
document.petriNet.getNodeSimpleIdGenerator().fixFutureUniqueIds();
document.petriNet.getNodeSimpleIdGenerator().ensureNumberIds();
document.petriNet.getNodeLabelGenerator().fixFutureUniqueLabels();
for (XmlRole xmlRole : xmlDocument.roles) {
Role role = new Role();
role.id = xmlRole.id;
role.name = xmlRole.name;
role.createCase = xmlRole.createCase;
role.destroyCase = xmlRole.destroyCase;
for (String transitionId : xmlRole.transitionIds) {
role.transitions.add((Transition) getObjectFromId(transitionId));
}
document.roles.add(role);
}
return document;
}
|
public Document readFromFile(File file) throws JAXBException, FileNotFoundException, IOException {
JAXBContext ctx = JAXBContext.newInstance(XmlDocument.class);
Unmarshaller u = ctx.createUnmarshaller();
FileInputStream fileInputStream = new FileInputStream(file);
xmlDocument = (XmlDocument) u.unmarshal(fileInputStream);
fileInputStream.close();
idToXmlObject = new IdToXmlObject(xmlDocument);
<DeepExtract>
Document document = new Document();
Subnet rootSubnet = getNewSubnet(xmlDocument.rootSubnet);
document.petriNet.setRootSubnet(rootSubnet);
constructInitialMarkingRecursively(document.petriNet.getInitialMarking(), xmlDocument.rootSubnet);
document.petriNet.getNodeSimpleIdGenerator().fixFutureUniqueIds();
document.petriNet.getNodeSimpleIdGenerator().ensureNumberIds();
document.petriNet.getNodeLabelGenerator().fixFutureUniqueLabels();
for (XmlRole xmlRole : xmlDocument.roles) {
Role role = new Role();
role.id = xmlRole.id;
role.name = xmlRole.name;
role.createCase = xmlRole.createCase;
role.destroyCase = xmlRole.destroyCase;
for (String transitionId : xmlRole.transitionIds) {
role.transitions.add((Transition) getObjectFromId(transitionId));
}
document.roles.add(role);
}
return document;
</DeepExtract>
}
|
pneditor
|
positive
| 347
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.