code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public BusItineraryHalt insertBusHaltAfter(BusItineraryHalt afterHalt, UUID id, String name, BusItineraryHaltType type) {
assert afterHalt != null;
assert this.contains(afterHalt);
if (this.getValidBusHaltCount() + this.getInvalidBusHaltCount() == 1) {
return this.addBusHalt(id, name, type);
}
int haltIndex = -1;
int indexAfter = -1;
if (!afterHalt.isValidPrimitive()) {
haltIndex = ListUtil.indexOf(this.invalidHalts, INVALID_HALT_COMPARATOR, afterHalt);
assert haltIndex != -1;
indexAfter = this.invalidHalts.get(haltIndex).getInvalidListIndex();
} else {
haltIndex = ListUtil.indexOf(this.validHalts, VALID_HALT_COMPARATOR, afterHalt);
assert haltIndex != -1;
indexAfter = this.validHalts.get(haltIndex).getInvalidListIndex();
}
BusItineraryHalt temp;
//decal insertion id invalid halts
for (int i = haltIndex + 1; i < this.invalidHalts.size(); ++i) {
temp = this.invalidHalts.get(i);
if (temp.getInvalidListIndex() >= indexAfter + 1) {
temp.setInvalidListIndex(temp.getInvalidListIndex() + 1);
}
}
//decal insertion id valid halts
final Iterator<BusItineraryHalt> it = this.validHalts.iterator();
while (it.hasNext()) {
temp = it.next();
if (temp.getInvalidListIndex() >= indexAfter + 1) {
temp.setInvalidListIndex(temp.getInvalidListIndex() + 1);
}
}
return this.addBusHalt(id, name, type, indexAfter + 1);
} } | public class class_name {
public BusItineraryHalt insertBusHaltAfter(BusItineraryHalt afterHalt, UUID id, String name, BusItineraryHaltType type) {
assert afterHalt != null;
assert this.contains(afterHalt);
if (this.getValidBusHaltCount() + this.getInvalidBusHaltCount() == 1) {
return this.addBusHalt(id, name, type); // depends on control dependency: [if], data = [none]
}
int haltIndex = -1;
int indexAfter = -1;
if (!afterHalt.isValidPrimitive()) {
haltIndex = ListUtil.indexOf(this.invalidHalts, INVALID_HALT_COMPARATOR, afterHalt); // depends on control dependency: [if], data = [none]
assert haltIndex != -1;
indexAfter = this.invalidHalts.get(haltIndex).getInvalidListIndex(); // depends on control dependency: [if], data = [none]
} else {
haltIndex = ListUtil.indexOf(this.validHalts, VALID_HALT_COMPARATOR, afterHalt); // depends on control dependency: [if], data = [none]
assert haltIndex != -1;
indexAfter = this.validHalts.get(haltIndex).getInvalidListIndex(); // depends on control dependency: [if], data = [none]
}
BusItineraryHalt temp;
//decal insertion id invalid halts
for (int i = haltIndex + 1; i < this.invalidHalts.size(); ++i) {
temp = this.invalidHalts.get(i); // depends on control dependency: [for], data = [i]
if (temp.getInvalidListIndex() >= indexAfter + 1) {
temp.setInvalidListIndex(temp.getInvalidListIndex() + 1); // depends on control dependency: [if], data = [(temp.getInvalidListIndex()]
}
}
//decal insertion id valid halts
final Iterator<BusItineraryHalt> it = this.validHalts.iterator();
while (it.hasNext()) {
temp = it.next(); // depends on control dependency: [while], data = [none]
if (temp.getInvalidListIndex() >= indexAfter + 1) {
temp.setInvalidListIndex(temp.getInvalidListIndex() + 1); // depends on control dependency: [if], data = [(temp.getInvalidListIndex()]
}
}
return this.addBusHalt(id, name, type, indexAfter + 1);
} } |
public class class_name {
public String next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
String token = tokenizer.next();
// Determine whether the next token to return could be the start of a
// recognized compound token
CompoundTokens compounds = compoundTokens.get(token);
// Determine how many tokens are needed at most and see if any grouping
// exists
if (compounds != null) {
List<String> nextTokens = tokenizer.peek(compounds.maxTokens());
Duple<Integer,String> compound = compounds.findMatch(nextTokens);
if (compound != null) {
// shift off the number of extra tokens in the compound
for (int i = 0; i < compound.x; ++i)
tokenizer.next();
return compound.y;
}
else return token;
}
// If there was no possibility of grouping this token, then return it by
// itself
return token;
} } | public class class_name {
public String next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
String token = tokenizer.next();
// Determine whether the next token to return could be the start of a
// recognized compound token
CompoundTokens compounds = compoundTokens.get(token);
// Determine how many tokens are needed at most and see if any grouping
// exists
if (compounds != null) {
List<String> nextTokens = tokenizer.peek(compounds.maxTokens());
Duple<Integer,String> compound = compounds.findMatch(nextTokens);
if (compound != null) {
// shift off the number of extra tokens in the compound
for (int i = 0; i < compound.x; ++i)
tokenizer.next();
return compound.y; // depends on control dependency: [if], data = [none]
}
else return token;
}
// If there was no possibility of grouping this token, then return it by
// itself
return token;
} } |
public class class_name {
public void redraw() {
shapes.clear();
if (container != null) {
container.setTranslation(0, 0);
container.clear();
try {
tentativeMoveLine = new Path(-5, -5);
tentativeMoveLine.lineTo(-5, -5);
ShapeStyle style = styleProvider.getEdgeTentativeMoveStyle();
GeomajasImpl.getInstance().getGfxUtil().applyStyle(tentativeMoveLine, style);
container.add(tentativeMoveLine);
draw();
} catch (GeometryIndexNotFoundException e) {
// Happens when creating new geometries...can't render points that don't exist yet.
}
}
} } | public class class_name {
public void redraw() {
shapes.clear();
if (container != null) {
container.setTranslation(0, 0); // depends on control dependency: [if], data = [none]
container.clear(); // depends on control dependency: [if], data = [none]
try {
tentativeMoveLine = new Path(-5, -5); // depends on control dependency: [try], data = [none]
tentativeMoveLine.lineTo(-5, -5); // depends on control dependency: [try], data = [none]
ShapeStyle style = styleProvider.getEdgeTentativeMoveStyle();
GeomajasImpl.getInstance().getGfxUtil().applyStyle(tentativeMoveLine, style); // depends on control dependency: [try], data = [none]
container.add(tentativeMoveLine); // depends on control dependency: [try], data = [none]
draw(); // depends on control dependency: [try], data = [none]
} catch (GeometryIndexNotFoundException e) {
// Happens when creating new geometries...can't render points that don't exist yet.
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public <P>JsonModelBuilder<T> add(JsonPropertyBuilderCreator<T>... creators) {
for (JsonPropertyBuilderCreator<T> creator : creators) {
addSub(creator.<P> get());
}
return this;
} } | public class class_name {
public <P>JsonModelBuilder<T> add(JsonPropertyBuilderCreator<T>... creators) {
for (JsonPropertyBuilderCreator<T> creator : creators) {
addSub(creator.<P> get()); // depends on control dependency: [for], data = [creator]
}
return this;
} } |
public class class_name {
@GuardedBy("evictionLock")
void increaseWindow() {
if (mainProtectedMaximum() == 0) {
return;
}
long quota = Math.min(adjustment(), mainProtectedMaximum());
setMainProtectedMaximum(mainProtectedMaximum() - quota);
setWindowMaximum(windowMaximum() + quota);
demoteFromMainProtected();
for (int i = 0; i < QUEUE_TRANSFER_THRESHOLD; i++) {
Node<K, V> candidate = accessOrderProbationDeque().peek();
boolean probation = true;
if ((candidate == null) || (quota < candidate.getPolicyWeight())) {
candidate = accessOrderProtectedDeque().peek();
probation = false;
}
if (candidate == null) {
break;
}
int weight = candidate.getPolicyWeight();
if (quota < weight) {
break;
}
quota -= weight;
if (probation) {
accessOrderProbationDeque().remove(candidate);
} else {
setMainProtectedWeightedSize(mainProtectedWeightedSize() - weight);
accessOrderProtectedDeque().remove(candidate);
}
setWindowWeightedSize(windowWeightedSize() + weight);
accessOrderWindowDeque().add(candidate);
candidate.makeWindow();
}
setMainProtectedMaximum(mainProtectedMaximum() + quota);
setWindowMaximum(windowMaximum() - quota);
setAdjustment(quota);
} } | public class class_name {
@GuardedBy("evictionLock")
void increaseWindow() {
if (mainProtectedMaximum() == 0) {
return; // depends on control dependency: [if], data = [none]
}
long quota = Math.min(adjustment(), mainProtectedMaximum());
setMainProtectedMaximum(mainProtectedMaximum() - quota);
setWindowMaximum(windowMaximum() + quota);
demoteFromMainProtected();
for (int i = 0; i < QUEUE_TRANSFER_THRESHOLD; i++) {
Node<K, V> candidate = accessOrderProbationDeque().peek();
boolean probation = true;
if ((candidate == null) || (quota < candidate.getPolicyWeight())) {
candidate = accessOrderProtectedDeque().peek(); // depends on control dependency: [if], data = [none]
probation = false; // depends on control dependency: [if], data = [none]
}
if (candidate == null) {
break;
}
int weight = candidate.getPolicyWeight();
if (quota < weight) {
break;
}
quota -= weight; // depends on control dependency: [for], data = [none]
if (probation) {
accessOrderProbationDeque().remove(candidate); // depends on control dependency: [if], data = [none]
} else {
setMainProtectedWeightedSize(mainProtectedWeightedSize() - weight); // depends on control dependency: [if], data = [none]
accessOrderProtectedDeque().remove(candidate); // depends on control dependency: [if], data = [none]
}
setWindowWeightedSize(windowWeightedSize() + weight); // depends on control dependency: [for], data = [none]
accessOrderWindowDeque().add(candidate); // depends on control dependency: [for], data = [none]
candidate.makeWindow(); // depends on control dependency: [for], data = [none]
}
setMainProtectedMaximum(mainProtectedMaximum() + quota);
setWindowMaximum(windowMaximum() - quota);
setAdjustment(quota);
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void addPrivateFieldsAccessors(ClassNode node) {
Set<ASTNode> accessedFields = (Set<ASTNode>) node.getNodeMetaData(StaticTypesMarker.PV_FIELDS_ACCESS);
if (accessedFields==null) return;
Map<String, MethodNode> privateConstantAccessors = (Map<String, MethodNode>) node.getNodeMetaData(PRIVATE_FIELDS_ACCESSORS);
if (privateConstantAccessors!=null) {
// already added
return;
}
int acc = -1;
privateConstantAccessors = new HashMap<String, MethodNode>();
final int access = Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC;
for (FieldNode fieldNode : node.getFields()) {
if (accessedFields.contains(fieldNode)) {
acc++;
Parameter param = new Parameter(node.getPlainNodeReference(), "$that");
Expression receiver = fieldNode.isStatic()?new ClassExpression(node):new VariableExpression(param);
Statement stmt = new ExpressionStatement(new PropertyExpression(
receiver,
fieldNode.getName()
));
MethodNode accessor = node.addMethod("pfaccess$"+acc, access, fieldNode.getOriginType(), new Parameter[]{param}, ClassNode.EMPTY_ARRAY, stmt);
privateConstantAccessors.put(fieldNode.getName(), accessor);
}
}
node.setNodeMetaData(PRIVATE_FIELDS_ACCESSORS, privateConstantAccessors);
} } | public class class_name {
@SuppressWarnings("unchecked")
private void addPrivateFieldsAccessors(ClassNode node) {
Set<ASTNode> accessedFields = (Set<ASTNode>) node.getNodeMetaData(StaticTypesMarker.PV_FIELDS_ACCESS);
if (accessedFields==null) return;
Map<String, MethodNode> privateConstantAccessors = (Map<String, MethodNode>) node.getNodeMetaData(PRIVATE_FIELDS_ACCESSORS);
if (privateConstantAccessors!=null) {
// already added
return; // depends on control dependency: [if], data = [none]
}
int acc = -1;
privateConstantAccessors = new HashMap<String, MethodNode>();
final int access = Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC;
for (FieldNode fieldNode : node.getFields()) {
if (accessedFields.contains(fieldNode)) {
acc++; // depends on control dependency: [if], data = [none]
Parameter param = new Parameter(node.getPlainNodeReference(), "$that");
Expression receiver = fieldNode.isStatic()?new ClassExpression(node):new VariableExpression(param);
Statement stmt = new ExpressionStatement(new PropertyExpression(
receiver,
fieldNode.getName()
));
MethodNode accessor = node.addMethod("pfaccess$"+acc, access, fieldNode.getOriginType(), new Parameter[]{param}, ClassNode.EMPTY_ARRAY, stmt);
privateConstantAccessors.put(fieldNode.getName(), accessor); // depends on control dependency: [if], data = [none]
}
}
node.setNodeMetaData(PRIVATE_FIELDS_ACCESSORS, privateConstantAccessors);
} } |
public class class_name {
public void setEscapingDirectives(
SoyNode node, Context context, List<EscapingMode> escapingModes) {
Preconditions.checkArgument(
(node instanceof PrintNode)
|| (node instanceof CallNode)
|| (node instanceof MsgFallbackGroupNode),
"Escaping directives may only be set for {print}, {msg}, or {call} nodes");
if (escapingModes != null) {
nodeToEscapingModes.put(node, ImmutableList.copyOf(escapingModes));
}
nodeToContext.put(node, context);
} } | public class class_name {
public void setEscapingDirectives(
SoyNode node, Context context, List<EscapingMode> escapingModes) {
Preconditions.checkArgument(
(node instanceof PrintNode)
|| (node instanceof CallNode)
|| (node instanceof MsgFallbackGroupNode),
"Escaping directives may only be set for {print}, {msg}, or {call} nodes");
if (escapingModes != null) {
nodeToEscapingModes.put(node, ImmutableList.copyOf(escapingModes)); // depends on control dependency: [if], data = [(escapingModes]
}
nodeToContext.put(node, context);
} } |
public class class_name {
private SocketChannel accept() throws IOException
{
// The situation where connection cannot be accepted due to insufficient
// resources is considered valid and treated by ignoring the connection.
// Accept one connection and deal with different failure modes.
assert (fd != null);
SocketChannel sock = fd.accept();
if (!options.tcpAcceptFilters.isEmpty()) {
boolean matched = false;
for (TcpAddress.TcpAddressMask am : options.tcpAcceptFilters) {
if (am.matchAddress(address.address())) {
matched = true;
break;
}
}
if (!matched) {
try {
sock.close();
}
catch (IOException e) {
}
return null;
}
}
if (options.tos != 0) {
TcpUtils.setIpTypeOfService(sock, options.tos);
}
// Set the socket buffer limits for the underlying socket.
if (options.sndbuf != 0) {
TcpUtils.setTcpSendBuffer(sock, options.sndbuf);
}
if (options.rcvbuf != 0) {
TcpUtils.setTcpReceiveBuffer(sock, options.rcvbuf);
}
if (!isWindows) {
TcpUtils.setReuseAddress(sock, true);
}
return sock;
} } | public class class_name {
private SocketChannel accept() throws IOException
{
// The situation where connection cannot be accepted due to insufficient
// resources is considered valid and treated by ignoring the connection.
// Accept one connection and deal with different failure modes.
assert (fd != null);
SocketChannel sock = fd.accept();
if (!options.tcpAcceptFilters.isEmpty()) {
boolean matched = false;
for (TcpAddress.TcpAddressMask am : options.tcpAcceptFilters) {
if (am.matchAddress(address.address())) {
matched = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!matched) {
try {
sock.close(); // depends on control dependency: [try], data = [none]
}
catch (IOException e) {
} // depends on control dependency: [catch], data = [none]
return null;
}
}
if (options.tos != 0) {
TcpUtils.setIpTypeOfService(sock, options.tos);
}
// Set the socket buffer limits for the underlying socket.
if (options.sndbuf != 0) {
TcpUtils.setTcpSendBuffer(sock, options.sndbuf);
}
if (options.rcvbuf != 0) {
TcpUtils.setTcpReceiveBuffer(sock, options.rcvbuf);
}
if (!isWindows) {
TcpUtils.setReuseAddress(sock, true);
}
return sock;
} } |
public class class_name {
public static List toList( JSONArray jsonArray, JsonConfig jsonConfig ) {
if( jsonArray.size() == 0 ){
return new ArrayList();
}
Class objectClass = jsonConfig.getRootClass();
Map classMap = jsonConfig.getClassMap();
List list = new ArrayList();
int size = jsonArray.size();
for( int i = 0; i < size; i++ ){
Object value = jsonArray.get( i );
if( JSONUtils.isNull( value ) ){
list.add( null );
}else{
Class type = value.getClass();
if( JSONArray.class.isAssignableFrom( type ) ){
list.add( toList( (JSONArray) value, objectClass, classMap ) );
}else if( String.class.isAssignableFrom( type )
|| Boolean.class.isAssignableFrom( type ) || JSONUtils.isNumber( type )
|| Character.class.isAssignableFrom( type )
|| JSONFunction.class.isAssignableFrom( type ) ){
if( objectClass != null && !objectClass.isAssignableFrom( type ) ){
value = JSONUtils.getMorpherRegistry()
.morph( objectClass, value );
}
list.add( value );
}else{
if( objectClass != null ){
JsonConfig jsc = jsonConfig.copy();
jsc.setRootClass( objectClass );
jsc.setClassMap( classMap );
list.add( JSONObject.toBean( (JSONObject) value, jsc ) );
}else{
list.add( JSONObject.toBean( (JSONObject) value ) );
}
}
}
}
return list;
} } | public class class_name {
public static List toList( JSONArray jsonArray, JsonConfig jsonConfig ) {
if( jsonArray.size() == 0 ){
return new ArrayList(); // depends on control dependency: [if], data = [none]
}
Class objectClass = jsonConfig.getRootClass();
Map classMap = jsonConfig.getClassMap();
List list = new ArrayList();
int size = jsonArray.size();
for( int i = 0; i < size; i++ ){
Object value = jsonArray.get( i );
if( JSONUtils.isNull( value ) ){
list.add( null ); // depends on control dependency: [if], data = [none]
}else{
Class type = value.getClass();
if( JSONArray.class.isAssignableFrom( type ) ){
list.add( toList( (JSONArray) value, objectClass, classMap ) ); // depends on control dependency: [if], data = [none]
}else if( String.class.isAssignableFrom( type )
|| Boolean.class.isAssignableFrom( type ) || JSONUtils.isNumber( type )
|| Character.class.isAssignableFrom( type )
|| JSONFunction.class.isAssignableFrom( type ) ){
if( objectClass != null && !objectClass.isAssignableFrom( type ) ){
value = JSONUtils.getMorpherRegistry()
.morph( objectClass, value ); // depends on control dependency: [if], data = [none]
}
list.add( value ); // depends on control dependency: [if], data = [none]
}else{
if( objectClass != null ){
JsonConfig jsc = jsonConfig.copy();
jsc.setRootClass( objectClass ); // depends on control dependency: [if], data = [( objectClass]
jsc.setClassMap( classMap ); // depends on control dependency: [if], data = [none]
list.add( JSONObject.toBean( (JSONObject) value, jsc ) ); // depends on control dependency: [if], data = [none]
}else{
list.add( JSONObject.toBean( (JSONObject) value ) ); // depends on control dependency: [if], data = [none]
}
}
}
}
return list;
} } |
public class class_name {
private void checkTime() {
if (!isValidTime()) {
m_time.setErrorMessageWidth((m_popup.getOffsetWidth() - 32) + Unit.PX.toString());
m_time.setErrorMessage(Messages.get().key(Messages.ERR_DATEBOX_INVALID_TIME_FORMAT_0));
} else {
m_time.setErrorMessage(null);
}
updateCloseBehavior();
} } | public class class_name {
private void checkTime() {
if (!isValidTime()) {
m_time.setErrorMessageWidth((m_popup.getOffsetWidth() - 32) + Unit.PX.toString()); // depends on control dependency: [if], data = [none]
m_time.setErrorMessage(Messages.get().key(Messages.ERR_DATEBOX_INVALID_TIME_FORMAT_0)); // depends on control dependency: [if], data = [none]
} else {
m_time.setErrorMessage(null); // depends on control dependency: [if], data = [none]
}
updateCloseBehavior();
} } |
public class class_name {
public T head() {
int index = iter.nextIndex();
if (index >= list.size()) {
throw new NoSuchElementException();
} else {
return list.get(index);
}
} } | public class class_name {
public T head() {
int index = iter.nextIndex();
if (index >= list.size()) {
throw new NoSuchElementException();
} else {
return list.get(index); // depends on control dependency: [if], data = [(index]
}
} } |
public class class_name {
public void init(JavacTask task, String[] args, boolean addTaskListener) {
env = new Env();
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.equals(XMSGS_OPTION)) {
env.messages.setOptions(null);
} else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) {
env.messages.setOptions(arg.substring(arg.indexOf(":") + 1));
} else if (arg.matches(XIMPLICIT_HEADERS + "[1-6]")) {
char ch = arg.charAt(arg.length() - 1);
env.setImplicitHeaders(Character.digit(ch, 10));
} else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) {
env.setCustomTags(arg.substring(arg.indexOf(":") + 1));
} else
throw new IllegalArgumentException(arg);
}
env.init(task);
checker = new Checker(env);
if (addTaskListener) {
final DeclScanner ds = new DeclScanner() {
@Override
void visitDecl(Tree tree, Name name) {
TreePath p = getCurrentPath();
DocCommentTree dc = env.trees.getDocCommentTree(p);
checker.scan(dc, p);
}
};
TaskListener tl = new TaskListener() {
@Override
public void started(TaskEvent e) {
switch (e.getKind()) {
case ANALYZE:
CompilationUnitTree tree;
while ((tree = todo.poll()) != null)
ds.scan(tree, null);
break;
}
}
@Override
public void finished(TaskEvent e) {
switch (e.getKind()) {
case PARSE:
todo.add(e.getCompilationUnit());
break;
}
}
Queue<CompilationUnitTree> todo = new LinkedList<CompilationUnitTree>();
};
task.addTaskListener(tl);
}
} } | public class class_name {
public void init(JavacTask task, String[] args, boolean addTaskListener) {
env = new Env();
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.equals(XMSGS_OPTION)) {
env.messages.setOptions(null); // depends on control dependency: [if], data = [none]
} else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) {
env.messages.setOptions(arg.substring(arg.indexOf(":") + 1)); // depends on control dependency: [if], data = [none]
} else if (arg.matches(XIMPLICIT_HEADERS + "[1-6]")) {
char ch = arg.charAt(arg.length() - 1);
env.setImplicitHeaders(Character.digit(ch, 10)); // depends on control dependency: [if], data = [none]
} else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) {
env.setCustomTags(arg.substring(arg.indexOf(":") + 1)); // depends on control dependency: [if], data = [none]
} else
throw new IllegalArgumentException(arg);
}
env.init(task);
checker = new Checker(env);
if (addTaskListener) {
final DeclScanner ds = new DeclScanner() {
@Override
void visitDecl(Tree tree, Name name) {
TreePath p = getCurrentPath();
DocCommentTree dc = env.trees.getDocCommentTree(p);
checker.scan(dc, p);
}
};
TaskListener tl = new TaskListener() {
@Override
public void started(TaskEvent e) {
switch (e.getKind()) {
case ANALYZE:
CompilationUnitTree tree;
while ((tree = todo.poll()) != null)
ds.scan(tree, null);
break;
}
}
@Override
public void finished(TaskEvent e) {
switch (e.getKind()) {
case PARSE:
todo.add(e.getCompilationUnit());
break;
}
}
Queue<CompilationUnitTree> todo = new LinkedList<CompilationUnitTree>();
};
task.addTaskListener(tl); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public EClass getIfcWorkSchedule() {
if (ifcWorkScheduleEClass == null) {
ifcWorkScheduleEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(773);
}
return ifcWorkScheduleEClass;
} } | public class class_name {
@Override
public EClass getIfcWorkSchedule() {
if (ifcWorkScheduleEClass == null) {
ifcWorkScheduleEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(773);
// depends on control dependency: [if], data = [none]
}
return ifcWorkScheduleEClass;
} } |
public class class_name {
@Override
public String getHtmlParagraphs(int min, int max) {
int count = getCount(min, max);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < count; i++) {
sb.append("<p>");
sb.append(getParagraphs(1, 1));
sb.append("</p>");
}
return sb.toString().trim();
} } | public class class_name {
@Override
public String getHtmlParagraphs(int min, int max) {
int count = getCount(min, max);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < count; i++) {
sb.append("<p>"); // depends on control dependency: [for], data = [none]
sb.append(getParagraphs(1, 1)); // depends on control dependency: [for], data = [none]
sb.append("</p>"); // depends on control dependency: [for], data = [none]
}
return sb.toString().trim();
} } |
public class class_name {
private String processName(String name) {
String prefix = "";
if (this.type != null) {
prefix = this.type.getName() + ".";
}
return prefix + name;
} } | public class class_name {
private String processName(String name) {
String prefix = "";
if (this.type != null) {
prefix = this.type.getName() + ".";
// depends on control dependency: [if], data = [none]
}
return prefix + name;
} } |
public class class_name {
public long getIOWriteThroughput() {
assert(m_startTS != Long.MAX_VALUE);
assert(m_endTS != Long.MIN_VALUE);
if (m_bytesSent == 0) return 0;
if (m_endTS < m_startTS) {
m_endTS = m_startTS + 1; // 1 ms duration is sorta cheatin'
}
long durationMs = m_endTS - m_startTS;
return (long) (m_bytesSent / (durationMs / 1000.0));
} } | public class class_name {
public long getIOWriteThroughput() {
assert(m_startTS != Long.MAX_VALUE);
assert(m_endTS != Long.MIN_VALUE);
if (m_bytesSent == 0) return 0;
if (m_endTS < m_startTS) {
m_endTS = m_startTS + 1; // 1 ms duration is sorta cheatin' // depends on control dependency: [if], data = [none]
}
long durationMs = m_endTS - m_startTS;
return (long) (m_bytesSent / (durationMs / 1000.0));
} } |
public class class_name {
public ImmutableList<TemplateMetadata> getTemplates(CallNode node) {
if (node instanceof CallBasicNode) {
String calleeName = ((CallBasicNode) node).getCalleeName();
TemplateMetadata template = basicTemplatesOrElementsMap.get(calleeName);
return template == null ? ImmutableList.of() : ImmutableList.of(template);
} else {
String calleeName = ((CallDelegateNode) node).getDelCalleeName();
return delTemplateSelector.delTemplateNameToValues().get(calleeName);
}
} } | public class class_name {
public ImmutableList<TemplateMetadata> getTemplates(CallNode node) {
if (node instanceof CallBasicNode) {
String calleeName = ((CallBasicNode) node).getCalleeName();
TemplateMetadata template = basicTemplatesOrElementsMap.get(calleeName);
return template == null ? ImmutableList.of() : ImmutableList.of(template); // depends on control dependency: [if], data = [none]
} else {
String calleeName = ((CallDelegateNode) node).getDelCalleeName();
return delTemplateSelector.delTemplateNameToValues().get(calleeName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String relativize(URL base, URL full)
{
try {
return base.toURI().relativize(full.toURI())
.normalize().toString();
} catch (URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
} } | public class class_name {
public static String relativize(URL base, URL full)
{
try {
return base.toURI().relativize(full.toURI())
.normalize().toString(); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException ex) {
throw new IllegalArgumentException(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void onMessage(final ArrayBuffer arrayBuffer) {
if (arrayBuffer != null && arrayBuffer.byteLength() > 0) {
final byte[] message = toByteArray(arrayBuffer);
if (message.length > 0) {
postMessageEvent(message);
}
}
} } | public class class_name {
protected void onMessage(final ArrayBuffer arrayBuffer) {
if (arrayBuffer != null && arrayBuffer.byteLength() > 0) {
final byte[] message = toByteArray(arrayBuffer);
if (message.length > 0) {
postMessageEvent(message); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private QueryMethodCache generateQueryMethodCacheByMethod(EntityInfo entityInfo,Method method){
Class<?> mapperClass = entityInfo.getMapperClass();
Class<?> entityClass = entityInfo.getEntityClass();
QueryMethodCache methodCache = new QueryMethodCache();
String methodName = mapperClass.getName() + SPLIT_PONIT + method.getName();
methodCache.methodName = methodName;
methodCache.fieldNames = new String[method.getParameterTypes().length];
methodCache.cacheGroupKey = entityClass.getSimpleName() + GROUPKEY_SUFFIX;
//
methodCache.collectionResult = method.getReturnType() == List.class || method.getReturnType() == Set.class;
if(methodCache.collectionResult){
methodCache.groupRalated = true;
}else{
// count等统计查询
methodCache.groupRalated = method.getReturnType().isAnnotationPresent(Table.class) == false;
}
StringBuilder sb = new StringBuilder(entityClass.getSimpleName()).append(SPLIT_PONIT).append(method.getName());
Annotation[][] annotations = method.getParameterAnnotations();
for (int i = 0; i < annotations.length; i++) {
Annotation[] aa = annotations[i];
if(aa.length > 0){
String fieldName = null;
inner:for (Annotation annotation : aa) {
if(annotation.toString().contains(Param.class.getName())){
fieldName = ((Param)annotation).value();
break inner;
}
}
if(!methodCache.groupRalated && MybatisMapperParser.entityHasProperty(entityClass, fieldName)){
methodCache.fieldNames[i] = fieldName;
}
}else{
if(!methodCache.groupRalated){
throw new MybatisHanlerInitException(String.format("unique查询方法[%s] 使用了自动缓存Annotation @Cache,参数必须使用 @Param 绑定属性名称", methodName));
}
}
//
sb.append(i == 0 ? ":" : "_").append("%s");
}
if(!methodCache.groupRalated && methodCache.fieldNames.length == 1 && entityInfo.getIdProperty().equals(methodCache.fieldNames[0])){
throw new MybatisHanlerInitException(String.format("按主键查询方法[%s] 使用了自动缓存Annotation @Cache,请使用默认方法[%s]代替", methodName,methodDefine.selectName()));
}
methodCache.keyPattern = sb.toString();
return methodCache;
} } | public class class_name {
private QueryMethodCache generateQueryMethodCacheByMethod(EntityInfo entityInfo,Method method){
Class<?> mapperClass = entityInfo.getMapperClass();
Class<?> entityClass = entityInfo.getEntityClass();
QueryMethodCache methodCache = new QueryMethodCache();
String methodName = mapperClass.getName() + SPLIT_PONIT + method.getName();
methodCache.methodName = methodName;
methodCache.fieldNames = new String[method.getParameterTypes().length];
methodCache.cacheGroupKey = entityClass.getSimpleName() + GROUPKEY_SUFFIX;
//
methodCache.collectionResult = method.getReturnType() == List.class || method.getReturnType() == Set.class;
if(methodCache.collectionResult){
methodCache.groupRalated = true;
}else{
// count等统计查询
methodCache.groupRalated = method.getReturnType().isAnnotationPresent(Table.class) == false;
}
StringBuilder sb = new StringBuilder(entityClass.getSimpleName()).append(SPLIT_PONIT).append(method.getName());
Annotation[][] annotations = method.getParameterAnnotations();
for (int i = 0; i < annotations.length; i++) {
Annotation[] aa = annotations[i];
if(aa.length > 0){
String fieldName = null;
inner:for (Annotation annotation : aa) {
if(annotation.toString().contains(Param.class.getName())){
fieldName = ((Param)annotation).value();
// depends on control dependency: [if], data = [none]
break inner;
}
}
if(!methodCache.groupRalated && MybatisMapperParser.entityHasProperty(entityClass, fieldName)){
methodCache.fieldNames[i] = fieldName;
}
}else{
if(!methodCache.groupRalated){
throw new MybatisHanlerInitException(String.format("unique查询方法[%s] 使用了自动缓存Annotation @Cache,参数必须使用 @Param 绑定属性名称", methodName));
}
}
//
sb.append(i == 0 ? ":" : "_").append("%s");
}
if(!methodCache.groupRalated && methodCache.fieldNames.length == 1 && entityInfo.getIdProperty().equals(methodCache.fieldNames[0])){
throw new MybatisHanlerInitException(String.format("按主键查询方法[%s] 使用了自动缓存Annotation @Cache,请使用默认方法[%s]代替", methodName,methodDefine.selectName()));
}
methodCache.keyPattern = sb.toString();
return methodCache;
} } |
public class class_name {
protected static void setAdditionalWorkQueues(Bus bus, Map<String, String> props)
{
if (props != null && !props.isEmpty()) {
Map<String, Map<String, String>> queuesMap = new HashMap<String, Map<String,String>>();
for (Entry<String, String> e : props.entrySet()) {
String k = e.getKey();
if (k.startsWith(Constants.CXF_QUEUE_PREFIX)) {
String sk = k.substring(Constants.CXF_QUEUE_PREFIX.length());
int i = sk.indexOf(".");
if (i > 0) {
String queueName = sk.substring(0, i);
String queueProp = sk.substring(i+1);
Map<String, String> m = queuesMap.get(queueName);
if (m == null) {
m = new HashMap<String, String>();
queuesMap.put(queueName, m);
}
m.put(queueProp, e.getValue());
}
}
}
WorkQueueManager mgr = bus.getExtension(WorkQueueManager.class);
for (Entry<String, Map<String, String>> e : queuesMap.entrySet()) {
final String queueName = e.getKey();
AutomaticWorkQueue q = createWorkQueue(queueName, e.getValue());
mgr.addNamedWorkQueue(queueName, q);
}
}
} } | public class class_name {
protected static void setAdditionalWorkQueues(Bus bus, Map<String, String> props)
{
if (props != null && !props.isEmpty()) {
Map<String, Map<String, String>> queuesMap = new HashMap<String, Map<String,String>>();
for (Entry<String, String> e : props.entrySet()) {
String k = e.getKey();
if (k.startsWith(Constants.CXF_QUEUE_PREFIX)) {
String sk = k.substring(Constants.CXF_QUEUE_PREFIX.length());
int i = sk.indexOf(".");
if (i > 0) {
String queueName = sk.substring(0, i);
String queueProp = sk.substring(i+1);
Map<String, String> m = queuesMap.get(queueName);
if (m == null) {
m = new HashMap<String, String>(); // depends on control dependency: [if], data = [none]
queuesMap.put(queueName, m); // depends on control dependency: [if], data = [none]
}
m.put(queueProp, e.getValue()); // depends on control dependency: [if], data = [none]
}
}
}
WorkQueueManager mgr = bus.getExtension(WorkQueueManager.class);
for (Entry<String, Map<String, String>> e : queuesMap.entrySet()) {
final String queueName = e.getKey();
AutomaticWorkQueue q = createWorkQueue(queueName, e.getValue());
mgr.addNamedWorkQueue(queueName, q); // depends on control dependency: [for], data = [e]
}
}
} } |
public class class_name {
@Override
public void onViewRecycled(BinderViewHolder<C, ? extends View> holder) {
if (mPerformanceMonitor != null) {
mPerformanceMonitor.recordStart(PHASE_UNBIND, holder.itemView);
}
holder.unbind();
if (mPerformanceMonitor != null) {
mPerformanceMonitor.recordEnd(PHASE_UNBIND, holder.itemView);
}
} } | public class class_name {
@Override
public void onViewRecycled(BinderViewHolder<C, ? extends View> holder) {
if (mPerformanceMonitor != null) {
mPerformanceMonitor.recordStart(PHASE_UNBIND, holder.itemView); // depends on control dependency: [if], data = [none]
}
holder.unbind();
if (mPerformanceMonitor != null) {
mPerformanceMonitor.recordEnd(PHASE_UNBIND, holder.itemView); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void sourceLoadProgressNotification(int statusCode, int percentage) {
Enumeration e = scalablePictureStatusListeners.elements();
while (e.hasMoreElements()) {
((ScalablePictureListener) e.nextElement())
.sourceLoadProgressNotification(statusCode, percentage);
}
} } | public class class_name {
public void sourceLoadProgressNotification(int statusCode, int percentage) {
Enumeration e = scalablePictureStatusListeners.elements();
while (e.hasMoreElements()) {
((ScalablePictureListener) e.nextElement())
.sourceLoadProgressNotification(statusCode, percentage);
// depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private boolean checkEnabled() {
boolean retVal = false;
try {
if (getSettings().getBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED)) {
if (!getSettings().getBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED)
|| NexusAnalyzer.DEFAULT_URL.equals(getSettings().getString(Settings.KEYS.ANALYZER_NEXUS_URL))) {
LOGGER.debug("Enabling the Central analyzer");
retVal = true;
} else {
LOGGER.info("Nexus analyzer is enabled, disabling the Central Analyzer");
}
} else {
LOGGER.info("Central analyzer disabled");
}
} catch (InvalidSettingException ise) {
LOGGER.warn("Invalid setting. Disabling the Central analyzer");
}
return retVal;
} } | public class class_name {
private boolean checkEnabled() {
boolean retVal = false;
try {
if (getSettings().getBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED)) {
if (!getSettings().getBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED)
|| NexusAnalyzer.DEFAULT_URL.equals(getSettings().getString(Settings.KEYS.ANALYZER_NEXUS_URL))) {
LOGGER.debug("Enabling the Central analyzer"); // depends on control dependency: [if], data = [none]
retVal = true; // depends on control dependency: [if], data = [none]
} else {
LOGGER.info("Nexus analyzer is enabled, disabling the Central Analyzer"); // depends on control dependency: [if], data = [none]
}
} else {
LOGGER.info("Central analyzer disabled"); // depends on control dependency: [if], data = [none]
}
} catch (InvalidSettingException ise) {
LOGGER.warn("Invalid setting. Disabling the Central analyzer");
} // depends on control dependency: [catch], data = [none]
return retVal;
} } |
public class class_name {
public void marshall(ReplicationPendingModifiedValues replicationPendingModifiedValues, ProtocolMarshaller protocolMarshaller) {
if (replicationPendingModifiedValues == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(replicationPendingModifiedValues.getReplicationInstanceClass(), REPLICATIONINSTANCECLASS_BINDING);
protocolMarshaller.marshall(replicationPendingModifiedValues.getAllocatedStorage(), ALLOCATEDSTORAGE_BINDING);
protocolMarshaller.marshall(replicationPendingModifiedValues.getMultiAZ(), MULTIAZ_BINDING);
protocolMarshaller.marshall(replicationPendingModifiedValues.getEngineVersion(), ENGINEVERSION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ReplicationPendingModifiedValues replicationPendingModifiedValues, ProtocolMarshaller protocolMarshaller) {
if (replicationPendingModifiedValues == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(replicationPendingModifiedValues.getReplicationInstanceClass(), REPLICATIONINSTANCECLASS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationPendingModifiedValues.getAllocatedStorage(), ALLOCATEDSTORAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationPendingModifiedValues.getMultiAZ(), MULTIAZ_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationPendingModifiedValues.getEngineVersion(), ENGINEVERSION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@TimerJ
public TableMetadataBuilder addIndex(IndexType indType, String indexName, String... fields) throws ExecutionException {
IndexName indName = new IndexName(tableName.getName(), tableName.getName(), indexName);
Map<ColumnName, ColumnMetadata> columnsMetadata = new HashMap<ColumnName, ColumnMetadata>(fields.length);
// recover the columns from the table metadata
for (String field : fields) {
ColumnMetadata cMetadata = columns.get(new ColumnName(tableName, field));
if (cMetadata == null) {
throw new ExecutionException("Trying to index a not existing column: " + field);
}
columnsMetadata.put(new ColumnName(tableName, field), cMetadata);
}
IndexMetadata indMetadata = new IndexMetadata(indName, columnsMetadata, indType, null);
indexes.put(indName, indMetadata);
return this;
} } | public class class_name {
@TimerJ
public TableMetadataBuilder addIndex(IndexType indType, String indexName, String... fields) throws ExecutionException {
IndexName indName = new IndexName(tableName.getName(), tableName.getName(), indexName);
Map<ColumnName, ColumnMetadata> columnsMetadata = new HashMap<ColumnName, ColumnMetadata>(fields.length);
// recover the columns from the table metadata
for (String field : fields) {
ColumnMetadata cMetadata = columns.get(new ColumnName(tableName, field));
if (cMetadata == null) {
throw new ExecutionException("Trying to index a not existing column: " + field);
}
columnsMetadata.put(new ColumnName(tableName, field), cMetadata); // depends on control dependency: [for], data = [field]
}
IndexMetadata indMetadata = new IndexMetadata(indName, columnsMetadata, indType, null);
indexes.put(indName, indMetadata);
return this;
} } |
public class class_name {
public FindFile searchPath(final String searchPath) {
if (searchPath.indexOf(File.pathSeparatorChar) != -1) {
String[] paths = StringUtil.split(searchPath, File.pathSeparator);
for (String path : paths) {
addPath(new File(path));
}
} else {
addPath(new File(searchPath));
}
return this;
} } | public class class_name {
public FindFile searchPath(final String searchPath) {
if (searchPath.indexOf(File.pathSeparatorChar) != -1) {
String[] paths = StringUtil.split(searchPath, File.pathSeparator);
for (String path : paths) {
addPath(new File(path)); // depends on control dependency: [for], data = [path]
}
} else {
addPath(new File(searchPath)); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public void enter(long orderId, Side side, long price, long size) {
if (orders.containsKey(orderId)) {
return;
}
if (side == Side.BUY) {
buy(orderId, price, size);
} else {
sell(orderId, price, size);
}
} } | public class class_name {
public void enter(long orderId, Side side, long price, long size) {
if (orders.containsKey(orderId)) {
return; // depends on control dependency: [if], data = [none]
}
if (side == Side.BUY) {
buy(orderId, price, size); // depends on control dependency: [if], data = [none]
} else {
sell(orderId, price, size); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static double deltaHours(int calUnit, int increments) {
if (calUnit == Calendar.DATE) {
return 24 * increments;
} else if (calUnit == Calendar.HOUR) {
return increments;
} else if (calUnit == Calendar.MINUTE) {
return increments / 60;
} else if (calUnit == Calendar.SECOND) {
return increments / 3600;
}
return -1;
} } | public class class_name {
public static double deltaHours(int calUnit, int increments) {
if (calUnit == Calendar.DATE) {
return 24 * increments; // depends on control dependency: [if], data = [none]
} else if (calUnit == Calendar.HOUR) {
return increments; // depends on control dependency: [if], data = [none]
} else if (calUnit == Calendar.MINUTE) {
return increments / 60; // depends on control dependency: [if], data = [none]
} else if (calUnit == Calendar.SECOND) {
return increments / 3600; // depends on control dependency: [if], data = [none]
}
return -1;
} } |
public class class_name {
public void flush(IoSession session) {
try {
internalFlush(session.getFilterChain().getNextFilter(this),
session, buffersMap.get(session));
} catch (Throwable e) {
session.getFilterChain().fireExceptionCaught(e);
}
} } | public class class_name {
public void flush(IoSession session) {
try {
internalFlush(session.getFilterChain().getNextFilter(this),
session, buffersMap.get(session)); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
session.getFilterChain().fireExceptionCaught(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public EClass getIfcFlowControllerType() {
if (ifcFlowControllerTypeEClass == null) {
ifcFlowControllerTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(241);
}
return ifcFlowControllerTypeEClass;
} } | public class class_name {
public EClass getIfcFlowControllerType() {
if (ifcFlowControllerTypeEClass == null) {
ifcFlowControllerTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(241);
// depends on control dependency: [if], data = [none]
}
return ifcFlowControllerTypeEClass;
} } |
public class class_name {
public static Object getValueOfField(Field field, Object ref) {
field.setAccessible(true);
Object value = null;
try {
value = field.get(ref);
} catch (IllegalArgumentException e) {
log.warning(e.getClass().getSimpleName() + ": " + e.getMessage());
} catch (IllegalAccessException e) {
log.warning(e.getClass().getSimpleName() + ": " + e.getMessage());
}
return value;
} } | public class class_name {
public static Object getValueOfField(Field field, Object ref) {
field.setAccessible(true);
Object value = null;
try {
value = field.get(ref); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
log.warning(e.getClass().getSimpleName() + ": " + e.getMessage());
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
log.warning(e.getClass().getSimpleName() + ": " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
return value;
} } |
public class class_name {
protected void commitTempFile() throws CmsException {
CmsObject cms = getCms();
CmsFile tempFile;
List<CmsProperty> properties;
try {
switchToTempProject();
tempFile = cms.readFile(getParamTempfile(), CmsResourceFilter.ALL);
properties = cms.readPropertyObjects(getParamTempfile(), false);
} finally {
// make sure the project is reset in case of any exception
switchToCurrentProject();
}
if (cms.existsResource(getParamResource(), CmsResourceFilter.ALL)) {
// update properties of original file first (required if change in encoding occurred)
cms.writePropertyObjects(getParamResource(), properties);
// now replace the content of the original file
CmsFile orgFile = cms.readFile(getParamResource(), CmsResourceFilter.ALL);
orgFile.setContents(tempFile.getContents());
getCloneCms().writeFile(orgFile);
} else {
// original file does not exist, remove visibility permission entries and copy temporary file
// switch to the temporary file project
try {
switchToTempProject();
// lock the temporary file
cms.changeLock(getParamTempfile());
// remove visibility permissions for everybody on temporary file if possible
if (cms.hasPermissions(tempFile, CmsPermissionSet.ACCESS_CONTROL)) {
cms.rmacc(
getParamTempfile(),
I_CmsPrincipal.PRINCIPAL_GROUP,
OpenCms.getDefaultUsers().getGroupUsers());
}
} finally {
// make sure the project is reset in case of any exception
switchToCurrentProject();
}
cms.copyResource(getParamTempfile(), getParamResource(), CmsResource.COPY_AS_NEW);
// ensure the content handler is called
CmsFile orgFile = cms.readFile(getParamResource(), CmsResourceFilter.ALL);
getCloneCms().writeFile(orgFile);
}
// remove the temporary file flag
int flags = cms.readResource(getParamResource(), CmsResourceFilter.ALL).getFlags();
if ((flags & CmsResource.FLAG_TEMPFILE) == CmsResource.FLAG_TEMPFILE) {
flags ^= CmsResource.FLAG_TEMPFILE;
cms.chflags(getParamResource(), flags);
}
} } | public class class_name {
protected void commitTempFile() throws CmsException {
CmsObject cms = getCms();
CmsFile tempFile;
List<CmsProperty> properties;
try {
switchToTempProject();
tempFile = cms.readFile(getParamTempfile(), CmsResourceFilter.ALL);
properties = cms.readPropertyObjects(getParamTempfile(), false);
} finally {
// make sure the project is reset in case of any exception
switchToCurrentProject();
}
if (cms.existsResource(getParamResource(), CmsResourceFilter.ALL)) {
// update properties of original file first (required if change in encoding occurred)
cms.writePropertyObjects(getParamResource(), properties);
// now replace the content of the original file
CmsFile orgFile = cms.readFile(getParamResource(), CmsResourceFilter.ALL);
orgFile.setContents(tempFile.getContents());
getCloneCms().writeFile(orgFile);
} else {
// original file does not exist, remove visibility permission entries and copy temporary file
// switch to the temporary file project
try {
switchToTempProject(); // depends on control dependency: [try], data = [none]
// lock the temporary file
cms.changeLock(getParamTempfile()); // depends on control dependency: [try], data = [none]
// remove visibility permissions for everybody on temporary file if possible
if (cms.hasPermissions(tempFile, CmsPermissionSet.ACCESS_CONTROL)) {
cms.rmacc(
getParamTempfile(),
I_CmsPrincipal.PRINCIPAL_GROUP,
OpenCms.getDefaultUsers().getGroupUsers()); // depends on control dependency: [if], data = [none]
}
} finally {
// make sure the project is reset in case of any exception
switchToCurrentProject();
}
cms.copyResource(getParamTempfile(), getParamResource(), CmsResource.COPY_AS_NEW);
// ensure the content handler is called
CmsFile orgFile = cms.readFile(getParamResource(), CmsResourceFilter.ALL);
getCloneCms().writeFile(orgFile);
}
// remove the temporary file flag
int flags = cms.readResource(getParamResource(), CmsResourceFilter.ALL).getFlags();
if ((flags & CmsResource.FLAG_TEMPFILE) == CmsResource.FLAG_TEMPFILE) {
flags ^= CmsResource.FLAG_TEMPFILE;
cms.chflags(getParamResource(), flags);
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> Expression<T> list(Class<T> clazz, List<? extends Expression<?>> exprs) {
Expression<T> rv = (Expression<T>) exprs.get(0);
if (exprs.size() == 1) {
rv = operation(clazz, Ops.SINGLETON, rv, exprs.get(0));
} else {
for (int i = 1; i < exprs.size(); i++) {
rv = operation(clazz, Ops.LIST, rv, exprs.get(i));
}
}
return rv;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> Expression<T> list(Class<T> clazz, List<? extends Expression<?>> exprs) {
Expression<T> rv = (Expression<T>) exprs.get(0);
if (exprs.size() == 1) {
rv = operation(clazz, Ops.SINGLETON, rv, exprs.get(0));
} else {
for (int i = 1; i < exprs.size(); i++) {
rv = operation(clazz, Ops.LIST, rv, exprs.get(i)); // depends on control dependency: [for], data = [i]
}
}
return rv;
} } |
public class class_name {
private long getCurrentPosition() {
long pos;
if (!useLoadBuf) {
return in.position();
}
try {
if (in != null) {
pos = (channel.position() - in.remaining());
} else {
pos = channel.position();
}
return pos;
} catch (Exception e) {
log.error("Error getCurrentPosition", e);
return 0;
}
} } | public class class_name {
private long getCurrentPosition() {
long pos;
if (!useLoadBuf) {
return in.position(); // depends on control dependency: [if], data = [none]
}
try {
if (in != null) {
pos = (channel.position() - in.remaining()); // depends on control dependency: [if], data = [none]
} else {
pos = channel.position(); // depends on control dependency: [if], data = [none]
}
return pos; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Error getCurrentPosition", e);
return 0;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void render(Graphics g) {
// last list generation
if (list == -1) {
list = GL.glGenLists(1);
GL.glNewList(list, SGL.GL_COMPILE);
render(g, diagram);
GL.glEndList();
}
GL.glCallList(list);
TextureImpl.bindNone();
} } | public class class_name {
public void render(Graphics g) {
// last list generation
if (list == -1) {
list = GL.glGenLists(1);
// depends on control dependency: [if], data = [none]
GL.glNewList(list, SGL.GL_COMPILE);
// depends on control dependency: [if], data = [(list]
render(g, diagram);
// depends on control dependency: [if], data = [none]
GL.glEndList();
// depends on control dependency: [if], data = [none]
}
GL.glCallList(list);
TextureImpl.bindNone();
} } |
public class class_name {
public static Asset getAsset(AssetKey key) {
int delimIdx = getDelimIndex(key);
if (delimIdx > 0) {
// look in package rule sets
String pkgName = key.getName().substring(0, delimIdx);
String assetName = key.getName().substring(delimIdx + 1);
try {
Package pkgVO = PackageCache.getPackage(pkgName);
if (pkgVO != null) {
for (Asset asset : pkgVO.getAssets()) {
if (asset.getName().equals(assetName))
return getAsset(new AssetKey(asset.getId()));
if (Asset.JAVA.equals(key.getLanguage()) && asset.getName().equals(assetName + ".java"))
return getAsset(new AssetKey(asset.getId()));
if (Asset.GROOVY.equals(key.getLanguage()) && asset.getName().equals(assetName + ".groovy"))
return getAsset(new AssetKey(asset.getId()));
}
}
}
catch (CachingException ex) {
logger.severeException(ex.getMessage(), ex);
}
// try to load (for archived compatibility case)
Asset asset = loadAsset(key);
if (asset != null) {
getAssetMap();
synchronized(assetMap) {
assetMap.put(new AssetKey(asset), asset);
}
return asset;
}
return null; // not found
}
getAssetMap();
synchronized(assetMap) {
for (AssetKey mapKey : assetMap.keySet()) {
if (key.equals(mapKey))
return assetMap.get(mapKey);
}
}
Asset asset = null;
asset = loadAsset(key);
if (asset != null) {
synchronized(assetMap) {
assetMap.put(new AssetKey(asset), asset);
}
}
return asset;
} } | public class class_name {
public static Asset getAsset(AssetKey key) {
int delimIdx = getDelimIndex(key);
if (delimIdx > 0) {
// look in package rule sets
String pkgName = key.getName().substring(0, delimIdx);
String assetName = key.getName().substring(delimIdx + 1);
try {
Package pkgVO = PackageCache.getPackage(pkgName);
if (pkgVO != null) {
for (Asset asset : pkgVO.getAssets()) {
if (asset.getName().equals(assetName))
return getAsset(new AssetKey(asset.getId()));
if (Asset.JAVA.equals(key.getLanguage()) && asset.getName().equals(assetName + ".java"))
return getAsset(new AssetKey(asset.getId()));
if (Asset.GROOVY.equals(key.getLanguage()) && asset.getName().equals(assetName + ".groovy"))
return getAsset(new AssetKey(asset.getId()));
}
}
}
catch (CachingException ex) {
logger.severeException(ex.getMessage(), ex);
} // depends on control dependency: [catch], data = [none]
// try to load (for archived compatibility case)
Asset asset = loadAsset(key);
if (asset != null) {
getAssetMap(); // depends on control dependency: [if], data = [none]
synchronized(assetMap) { // depends on control dependency: [if], data = [(asset]
assetMap.put(new AssetKey(asset), asset);
}
return asset; // depends on control dependency: [if], data = [none]
}
return null; // not found // depends on control dependency: [if], data = [none]
}
getAssetMap();
synchronized(assetMap) {
for (AssetKey mapKey : assetMap.keySet()) {
if (key.equals(mapKey))
return assetMap.get(mapKey);
}
}
Asset asset = null;
asset = loadAsset(key);
if (asset != null) {
synchronized(assetMap) { // depends on control dependency: [if], data = [(asset]
assetMap.put(new AssetKey(asset), asset);
}
}
return asset;
} } |
public class class_name {
private static String getProxyClassName(String name, Set<String> pkgs, Map<String, String> mappedUniName,
boolean isUniName) {
String ret = "";
if (name.indexOf(PACKAGE_SPLIT_CHAR) != -1) {
String[] split = name.split("\\.");
boolean classFound = false;
for (String string : split) {
if (pkgs.contains(string) && !classFound) {
ret += string + PACKAGE_SPLIT_CHAR;
} else {
classFound = true;
ret += getProxyClassName(string, mappedUniName, isUniName) + PACKAGE_SPLIT_CHAR;
}
}
ret = StringUtils.removeEnd(ret, PACKAGE_SPLIT);
} else {
String clsName = name;
String uniName = mappedUniName.get(clsName);
if (uniName == null) {
uniName = clsName + getUniNameSuffix(isUniName);
mappedUniName.put(clsName, uniName);
}
clsName = uniName;
ret = clsName;
}
return ret;
} } | public class class_name {
private static String getProxyClassName(String name, Set<String> pkgs, Map<String, String> mappedUniName,
boolean isUniName) {
String ret = "";
if (name.indexOf(PACKAGE_SPLIT_CHAR) != -1) {
String[] split = name.split("\\.");
boolean classFound = false;
for (String string : split) {
if (pkgs.contains(string) && !classFound) {
ret += string + PACKAGE_SPLIT_CHAR; // depends on control dependency: [if], data = [none]
} else {
classFound = true; // depends on control dependency: [if], data = [none]
ret += getProxyClassName(string, mappedUniName, isUniName) + PACKAGE_SPLIT_CHAR; // depends on control dependency: [if], data = [none]
}
}
ret = StringUtils.removeEnd(ret, PACKAGE_SPLIT); // depends on control dependency: [if], data = [none]
} else {
String clsName = name;
String uniName = mappedUniName.get(clsName);
if (uniName == null) {
uniName = clsName + getUniNameSuffix(isUniName); // depends on control dependency: [if], data = [none]
mappedUniName.put(clsName, uniName); // depends on control dependency: [if], data = [none]
}
clsName = uniName; // depends on control dependency: [if], data = [none]
ret = clsName; // depends on control dependency: [if], data = [none]
}
return ret;
} } |
public class class_name {
protected final String getDefault(final String placeholderWithDefault) {
int separatorIdx = placeholderWithDefault.indexOf(defaultSeparator);
if (separatorIdx == -1) {
return null;
} else {
return placeholderWithDefault.substring(separatorIdx + 1);
}
} } | public class class_name {
protected final String getDefault(final String placeholderWithDefault) {
int separatorIdx = placeholderWithDefault.indexOf(defaultSeparator);
if (separatorIdx == -1) {
return null; // depends on control dependency: [if], data = [none]
} else {
return placeholderWithDefault.substring(separatorIdx + 1); // depends on control dependency: [if], data = [(separatorIdx]
}
} } |
public class class_name {
public Long getSeed() {
try {
Field f = Random.class.getDeclaredField("seed"); //NoSuchFieldException
f.setAccessible(true);
AtomicLong seed = (AtomicLong) f.get(random);
return seed == null ? null : seed.get();
} catch(Exception e) {
// not allowed to access
return null;
}
} } | public class class_name {
public Long getSeed() {
try {
Field f = Random.class.getDeclaredField("seed"); //NoSuchFieldException
f.setAccessible(true); // depends on control dependency: [try], data = [none]
AtomicLong seed = (AtomicLong) f.get(random);
return seed == null ? null : seed.get(); // depends on control dependency: [try], data = [none]
} catch(Exception e) {
// not allowed to access
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static MtasConfiguration readConfiguration(InputStream reader)
throws IOException {
MtasConfiguration currentConfig = null;
// parse xml
XMLInputFactory factory = XMLInputFactory.newInstance();
try {
XMLStreamReader streamReader = factory.createXMLStreamReader(reader);
QName qname;
try {
int event = streamReader.getEventType();
while (true) {
switch (event) {
case XMLStreamConstants.START_DOCUMENT:
if (!streamReader.getCharacterEncodingScheme().equals("UTF-8")) {
throw new IOException("XML not UTF-8 encoded");
}
break;
case XMLStreamConstants.END_DOCUMENT:
case XMLStreamConstants.SPACE:
break;
case XMLStreamConstants.START_ELEMENT:
// get data
qname = streamReader.getName();
if (currentConfig == null) {
if (qname.getLocalPart().equals("mtas")) {
currentConfig = new MtasConfiguration();
} else {
throw new IOException("no Mtas Configuration");
}
} else {
MtasConfiguration parentConfig = currentConfig;
currentConfig = new MtasConfiguration();
parentConfig.children.add(currentConfig);
currentConfig.parent = parentConfig;
currentConfig.name = qname.getLocalPart();
for (int i = 0; i < streamReader.getAttributeCount(); i++) {
currentConfig.attributes.put(
streamReader.getAttributeLocalName(i),
streamReader.getAttributeValue(i));
}
}
break;
case XMLStreamConstants.END_ELEMENT:
if (currentConfig.parent == null) {
return currentConfig;
} else {
currentConfig = currentConfig.parent;
}
break;
case XMLStreamConstants.CHARACTERS:
break;
}
if (!streamReader.hasNext()) {
break;
}
event = streamReader.next();
}
} finally {
streamReader.close();
}
} catch (XMLStreamException e) {
log.debug(e);
}
return null;
} } | public class class_name {
public static MtasConfiguration readConfiguration(InputStream reader)
throws IOException {
MtasConfiguration currentConfig = null;
// parse xml
XMLInputFactory factory = XMLInputFactory.newInstance();
try {
XMLStreamReader streamReader = factory.createXMLStreamReader(reader);
QName qname;
try {
int event = streamReader.getEventType();
while (true) {
switch (event) {
case XMLStreamConstants.START_DOCUMENT:
if (!streamReader.getCharacterEncodingScheme().equals("UTF-8")) {
throw new IOException("XML not UTF-8 encoded");
}
break;
case XMLStreamConstants.END_DOCUMENT:
case XMLStreamConstants.SPACE:
break;
case XMLStreamConstants.START_ELEMENT:
// get data
qname = streamReader.getName();
if (currentConfig == null) {
if (qname.getLocalPart().equals("mtas")) {
currentConfig = new MtasConfiguration(); // depends on control dependency: [if], data = [none]
} else {
throw new IOException("no Mtas Configuration");
}
} else {
MtasConfiguration parentConfig = currentConfig;
currentConfig = new MtasConfiguration(); // depends on control dependency: [if], data = [none]
parentConfig.children.add(currentConfig); // depends on control dependency: [if], data = [(currentConfig]
currentConfig.parent = parentConfig; // depends on control dependency: [if], data = [none]
currentConfig.name = qname.getLocalPart(); // depends on control dependency: [if], data = [none]
for (int i = 0; i < streamReader.getAttributeCount(); i++) {
currentConfig.attributes.put(
streamReader.getAttributeLocalName(i),
streamReader.getAttributeValue(i)); // depends on control dependency: [for], data = [none]
}
}
break;
case XMLStreamConstants.END_ELEMENT:
if (currentConfig.parent == null) {
return currentConfig; // depends on control dependency: [if], data = [none]
} else {
currentConfig = currentConfig.parent; // depends on control dependency: [if], data = [none]
}
break;
case XMLStreamConstants.CHARACTERS:
break;
}
if (!streamReader.hasNext()) {
break;
}
event = streamReader.next(); // depends on control dependency: [while], data = [none]
}
} finally {
streamReader.close();
}
} catch (XMLStreamException e) {
log.debug(e);
}
return null;
} } |
public class class_name {
public ServiceCall<Void> addAudio(AddAudioOptions addAudioOptions) {
Validator.notNull(addAudioOptions, "addAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { addAudioOptions.customizationId(), addAudioOptions.audioName() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "addAudio");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (addAudioOptions.containedContentType() != null) {
builder.header("Contained-Content-Type", addAudioOptions.containedContentType());
}
if (addAudioOptions.contentType() != null) {
builder.header("Content-Type", addAudioOptions.contentType());
}
if (addAudioOptions.allowOverwrite() != null) {
builder.query("allow_overwrite", String.valueOf(addAudioOptions.allowOverwrite()));
}
builder.bodyContent(addAudioOptions.contentType(), null, null, addAudioOptions.audioResource());
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} } | public class class_name {
public ServiceCall<Void> addAudio(AddAudioOptions addAudioOptions) {
Validator.notNull(addAudioOptions, "addAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { addAudioOptions.customizationId(), addAudioOptions.audioName() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "addAudio");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
builder.header("Accept", "application/json");
if (addAudioOptions.containedContentType() != null) {
builder.header("Contained-Content-Type", addAudioOptions.containedContentType()); // depends on control dependency: [if], data = [none]
}
if (addAudioOptions.contentType() != null) {
builder.header("Content-Type", addAudioOptions.contentType()); // depends on control dependency: [if], data = [none]
}
if (addAudioOptions.allowOverwrite() != null) {
builder.query("allow_overwrite", String.valueOf(addAudioOptions.allowOverwrite())); // depends on control dependency: [if], data = [(addAudioOptions.allowOverwrite()]
}
builder.bodyContent(addAudioOptions.contentType(), null, null, addAudioOptions.audioResource());
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} } |
public class class_name {
private void suppressLog4jLogging() {
if ( ! log4jLoggingSuppressed.getAndSet(true) ) {
Logger logger = Logger.getLogger("org.apache.http");
logger.setLevel(Level.ERROR);
logger.addAppender(new ConsoleAppender());
}
} } | public class class_name {
private void suppressLog4jLogging() {
if ( ! log4jLoggingSuppressed.getAndSet(true) ) {
Logger logger = Logger.getLogger("org.apache.http");
logger.setLevel(Level.ERROR); // depends on control dependency: [if], data = [none]
logger.addAppender(new ConsoleAppender()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public DescribeIndexFieldsResult withIndexFields(IndexFieldStatus... indexFields) {
if (this.indexFields == null) {
setIndexFields(new com.amazonaws.internal.SdkInternalList<IndexFieldStatus>(indexFields.length));
}
for (IndexFieldStatus ele : indexFields) {
this.indexFields.add(ele);
}
return this;
} } | public class class_name {
public DescribeIndexFieldsResult withIndexFields(IndexFieldStatus... indexFields) {
if (this.indexFields == null) {
setIndexFields(new com.amazonaws.internal.SdkInternalList<IndexFieldStatus>(indexFields.length)); // depends on control dependency: [if], data = [none]
}
for (IndexFieldStatus ele : indexFields) {
this.indexFields.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public String[] getNames() {
String[] headers = new String[columns.getColumns().size()];
for (int i = 0; i < columns.getColumns().size(); i++) {
headers[i] = columns.getColumns().get(i).getName();
}
return headers;
} } | public class class_name {
public String[] getNames() {
String[] headers = new String[columns.getColumns().size()];
for (int i = 0; i < columns.getColumns().size(); i++) {
headers[i] = columns.getColumns().get(i).getName(); // depends on control dependency: [for], data = [i]
}
return headers;
} } |
public class class_name {
protected Collection<ReadLock> getReadLocks() {
// internally ownerTags.size() (WeakHashMap) contains synchronization
// better avoid calling it
// normally there will be one sharedObject so the capacity may be
// considered as 2 because the load factor is 0.75f
final Collection<ReadLock> readLocks = new HashSet<>(2);
for (final AbstractHtml ownerTag : ownerTags) {
final ReadLock readLock = ownerTag.getSharedObject()
.getLock(ACCESS_OBJECT).readLock();
if (readLock != null) {
readLocks.add(readLock);
}
}
return readLocks;
} } | public class class_name {
protected Collection<ReadLock> getReadLocks() {
// internally ownerTags.size() (WeakHashMap) contains synchronization
// better avoid calling it
// normally there will be one sharedObject so the capacity may be
// considered as 2 because the load factor is 0.75f
final Collection<ReadLock> readLocks = new HashSet<>(2);
for (final AbstractHtml ownerTag : ownerTags) {
final ReadLock readLock = ownerTag.getSharedObject()
.getLock(ACCESS_OBJECT).readLock();
if (readLock != null) {
readLocks.add(readLock); // depends on control dependency: [if], data = [(readLock]
}
}
return readLocks;
} } |
public class class_name {
public IRObject getReference() {
if (ref == null) {
ref = org.omg.CORBA.PrimitiveDefHelper.narrow(
servantToReference(new PrimitiveDefPOATie(this)));
}
return ref;
} } | public class class_name {
public IRObject getReference() {
if (ref == null) {
ref = org.omg.CORBA.PrimitiveDefHelper.narrow(
servantToReference(new PrimitiveDefPOATie(this))); // depends on control dependency: [if], data = [none]
}
return ref;
} } |
public class class_name {
private Observable<R> getFallbackOrThrowException(final AbstractCommand<R> _cmd, final HystrixEventType eventType, final FailureType failureType, final String message, final Exception originalException) {
final HystrixRequestContext requestContext = HystrixRequestContext.getContextForCurrentThread();
long latency = System.currentTimeMillis() - executionResult.getStartTimestamp();
// record the executionResult
// do this before executing fallback so it can be queried from within getFallback (see See https://github.com/Netflix/Hystrix/pull/144)
executionResult = executionResult.addEvent((int) latency, eventType);
if (isUnrecoverable(originalException)) {
logger.error("Unrecoverable Error for HystrixCommand so will throw HystrixRuntimeException and not apply fallback. ", originalException);
/* executionHook for all errors */
Exception e = wrapWithOnErrorHook(failureType, originalException);
return Observable.error(new HystrixRuntimeException(failureType, this.getClass(), getLogMessagePrefix() + " " + message + " and encountered unrecoverable error.", e, null));
} else {
if (isRecoverableError(originalException)) {
logger.warn("Recovered from java.lang.Error by serving Hystrix fallback", originalException);
}
if (properties.fallbackEnabled().get()) {
/* fallback behavior is permitted so attempt */
final Action1<Notification<? super R>> setRequestContext = new Action1<Notification<? super R>>() {
@Override
public void call(Notification<? super R> rNotification) {
setRequestContextIfNeeded(requestContext);
}
};
final Action1<R> markFallbackEmit = new Action1<R>() {
@Override
public void call(R r) {
if (shouldOutputOnNextEvents()) {
executionResult = executionResult.addEvent(HystrixEventType.FALLBACK_EMIT);
eventNotifier.markEvent(HystrixEventType.FALLBACK_EMIT, commandKey);
}
}
};
final Action0 markFallbackCompleted = new Action0() {
@Override
public void call() {
long latency = System.currentTimeMillis() - executionResult.getStartTimestamp();
eventNotifier.markEvent(HystrixEventType.FALLBACK_SUCCESS, commandKey);
executionResult = executionResult.addEvent((int) latency, HystrixEventType.FALLBACK_SUCCESS);
}
};
final Func1<Throwable, Observable<R>> handleFallbackError = new Func1<Throwable, Observable<R>>() {
@Override
public Observable<R> call(Throwable t) {
/* executionHook for all errors */
Exception e = wrapWithOnErrorHook(failureType, originalException);
Exception fe = getExceptionFromThrowable(t);
long latency = System.currentTimeMillis() - executionResult.getStartTimestamp();
Exception toEmit;
if (fe instanceof UnsupportedOperationException) {
logger.debug("No fallback for HystrixCommand. ", fe); // debug only since we're throwing the exception and someone higher will do something with it
eventNotifier.markEvent(HystrixEventType.FALLBACK_MISSING, commandKey);
executionResult = executionResult.addEvent((int) latency, HystrixEventType.FALLBACK_MISSING);
toEmit = new HystrixRuntimeException(failureType, _cmd.getClass(), getLogMessagePrefix() + " " + message + " and no fallback available.", e, fe);
} else {
logger.debug("HystrixCommand execution " + failureType.name() + " and fallback failed.", fe);
eventNotifier.markEvent(HystrixEventType.FALLBACK_FAILURE, commandKey);
executionResult = executionResult.addEvent((int) latency, HystrixEventType.FALLBACK_FAILURE);
toEmit = new HystrixRuntimeException(failureType, _cmd.getClass(), getLogMessagePrefix() + " " + message + " and fallback failed.", e, fe);
}
// NOTE: we're suppressing fallback exception here
if (shouldNotBeWrapped(originalException)) {
return Observable.error(e);
}
return Observable.error(toEmit);
}
};
final TryableSemaphore fallbackSemaphore = getFallbackSemaphore();
final AtomicBoolean semaphoreHasBeenReleased = new AtomicBoolean(false);
final Action0 singleSemaphoreRelease = new Action0() {
@Override
public void call() {
if (semaphoreHasBeenReleased.compareAndSet(false, true)) {
fallbackSemaphore.release();
}
}
};
Observable<R> fallbackExecutionChain;
// acquire a permit
if (fallbackSemaphore.tryAcquire()) {
try {
if (isFallbackUserDefined()) {
executionHook.onFallbackStart(this);
fallbackExecutionChain = getFallbackObservable();
} else {
//same logic as above without the hook invocation
fallbackExecutionChain = getFallbackObservable();
}
} catch (Throwable ex) {
//If hook or user-fallback throws, then use that as the result of the fallback lookup
fallbackExecutionChain = Observable.error(ex);
}
return fallbackExecutionChain
.doOnEach(setRequestContext)
.lift(new FallbackHookApplication(_cmd))
.lift(new DeprecatedOnFallbackHookApplication(_cmd))
.doOnNext(markFallbackEmit)
.doOnCompleted(markFallbackCompleted)
.onErrorResumeNext(handleFallbackError)
.doOnTerminate(singleSemaphoreRelease)
.doOnUnsubscribe(singleSemaphoreRelease);
} else {
return handleFallbackRejectionByEmittingError();
}
} else {
return handleFallbackDisabledByEmittingError(originalException, failureType, message);
}
}
} } | public class class_name {
private Observable<R> getFallbackOrThrowException(final AbstractCommand<R> _cmd, final HystrixEventType eventType, final FailureType failureType, final String message, final Exception originalException) {
final HystrixRequestContext requestContext = HystrixRequestContext.getContextForCurrentThread();
long latency = System.currentTimeMillis() - executionResult.getStartTimestamp();
// record the executionResult
// do this before executing fallback so it can be queried from within getFallback (see See https://github.com/Netflix/Hystrix/pull/144)
executionResult = executionResult.addEvent((int) latency, eventType);
if (isUnrecoverable(originalException)) {
logger.error("Unrecoverable Error for HystrixCommand so will throw HystrixRuntimeException and not apply fallback. ", originalException);
/* executionHook for all errors */
Exception e = wrapWithOnErrorHook(failureType, originalException);
return Observable.error(new HystrixRuntimeException(failureType, this.getClass(), getLogMessagePrefix() + " " + message + " and encountered unrecoverable error.", e, null)); // depends on control dependency: [if], data = [none]
} else {
if (isRecoverableError(originalException)) {
logger.warn("Recovered from java.lang.Error by serving Hystrix fallback", originalException); // depends on control dependency: [if], data = [none]
}
if (properties.fallbackEnabled().get()) {
/* fallback behavior is permitted so attempt */
final Action1<Notification<? super R>> setRequestContext = new Action1<Notification<? super R>>() {
@Override
public void call(Notification<? super R> rNotification) {
setRequestContextIfNeeded(requestContext);
}
};
final Action1<R> markFallbackEmit = new Action1<R>() {
@Override
public void call(R r) {
if (shouldOutputOnNextEvents()) {
executionResult = executionResult.addEvent(HystrixEventType.FALLBACK_EMIT); // depends on control dependency: [if], data = [none]
eventNotifier.markEvent(HystrixEventType.FALLBACK_EMIT, commandKey); // depends on control dependency: [if], data = [none]
}
}
};
final Action0 markFallbackCompleted = new Action0() {
@Override
public void call() {
long latency = System.currentTimeMillis() - executionResult.getStartTimestamp();
eventNotifier.markEvent(HystrixEventType.FALLBACK_SUCCESS, commandKey);
executionResult = executionResult.addEvent((int) latency, HystrixEventType.FALLBACK_SUCCESS);
}
};
final Func1<Throwable, Observable<R>> handleFallbackError = new Func1<Throwable, Observable<R>>() {
@Override
public Observable<R> call(Throwable t) {
/* executionHook for all errors */
Exception e = wrapWithOnErrorHook(failureType, originalException);
Exception fe = getExceptionFromThrowable(t);
long latency = System.currentTimeMillis() - executionResult.getStartTimestamp();
Exception toEmit;
if (fe instanceof UnsupportedOperationException) {
logger.debug("No fallback for HystrixCommand. ", fe); // debug only since we're throwing the exception and someone higher will do something with it // depends on control dependency: [if], data = [none]
eventNotifier.markEvent(HystrixEventType.FALLBACK_MISSING, commandKey); // depends on control dependency: [if], data = [none]
executionResult = executionResult.addEvent((int) latency, HystrixEventType.FALLBACK_MISSING); // depends on control dependency: [if], data = [none]
toEmit = new HystrixRuntimeException(failureType, _cmd.getClass(), getLogMessagePrefix() + " " + message + " and no fallback available.", e, fe); // depends on control dependency: [if], data = [none]
} else {
logger.debug("HystrixCommand execution " + failureType.name() + " and fallback failed.", fe); // depends on control dependency: [if], data = [none]
eventNotifier.markEvent(HystrixEventType.FALLBACK_FAILURE, commandKey); // depends on control dependency: [if], data = [none]
executionResult = executionResult.addEvent((int) latency, HystrixEventType.FALLBACK_FAILURE); // depends on control dependency: [if], data = [none]
toEmit = new HystrixRuntimeException(failureType, _cmd.getClass(), getLogMessagePrefix() + " " + message + " and fallback failed.", e, fe); // depends on control dependency: [if], data = [none]
}
// NOTE: we're suppressing fallback exception here
if (shouldNotBeWrapped(originalException)) {
return Observable.error(e); // depends on control dependency: [if], data = [none]
}
return Observable.error(toEmit);
}
};
final TryableSemaphore fallbackSemaphore = getFallbackSemaphore();
final AtomicBoolean semaphoreHasBeenReleased = new AtomicBoolean(false);
final Action0 singleSemaphoreRelease = new Action0() {
@Override
public void call() {
if (semaphoreHasBeenReleased.compareAndSet(false, true)) {
fallbackSemaphore.release(); // depends on control dependency: [if], data = [none]
}
}
};
Observable<R> fallbackExecutionChain;
// acquire a permit
if (fallbackSemaphore.tryAcquire()) {
try {
if (isFallbackUserDefined()) {
executionHook.onFallbackStart(this); // depends on control dependency: [if], data = [none]
fallbackExecutionChain = getFallbackObservable(); // depends on control dependency: [if], data = [none]
} else {
//same logic as above without the hook invocation
fallbackExecutionChain = getFallbackObservable(); // depends on control dependency: [if], data = [none]
}
} catch (Throwable ex) {
//If hook or user-fallback throws, then use that as the result of the fallback lookup
fallbackExecutionChain = Observable.error(ex);
} // depends on control dependency: [catch], data = [none]
return fallbackExecutionChain
.doOnEach(setRequestContext)
.lift(new FallbackHookApplication(_cmd))
.lift(new DeprecatedOnFallbackHookApplication(_cmd))
.doOnNext(markFallbackEmit)
.doOnCompleted(markFallbackCompleted)
.onErrorResumeNext(handleFallbackError)
.doOnTerminate(singleSemaphoreRelease)
.doOnUnsubscribe(singleSemaphoreRelease); // depends on control dependency: [if], data = [none]
} else {
return handleFallbackRejectionByEmittingError(); // depends on control dependency: [if], data = [none]
}
} else {
return handleFallbackDisabledByEmittingError(originalException, failureType, message); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static URI resolve(String relUri, URI base) {
URI uri = createURI(relUri);
if (uri.getScheme() == null && uri.getUserInfo() == null && uri.getHost() == null && uri.getPort() == -1
&& StringUtils.isEmpty(uri.getPath()) && uri.getQuery() != null) {
try {
return new URI(base.getScheme(), base.getUserInfo(), base.getHost(), base.getPort(), base.getPath(),
uri.getQuery(), uri.getFragment());
} catch (URISyntaxException e) {
throw new InvalidUriException(e);
}
} else {
return base.resolve(uri);
}
} } | public class class_name {
public static URI resolve(String relUri, URI base) {
URI uri = createURI(relUri);
if (uri.getScheme() == null && uri.getUserInfo() == null && uri.getHost() == null && uri.getPort() == -1
&& StringUtils.isEmpty(uri.getPath()) && uri.getQuery() != null) {
try {
return new URI(base.getScheme(), base.getUserInfo(), base.getHost(), base.getPort(), base.getPath(),
uri.getQuery(), uri.getFragment()); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
throw new InvalidUriException(e);
} // depends on control dependency: [catch], data = [none]
} else {
return base.resolve(uri); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<LocaleEncodingMappingType<LocaleEncodingMappingListType<T>>> getAllLocaleEncodingMapping()
{
List<LocaleEncodingMappingType<LocaleEncodingMappingListType<T>>> list = new ArrayList<LocaleEncodingMappingType<LocaleEncodingMappingListType<T>>>();
List<Node> nodeList = childNode.get("locale-encoding-mapping");
for(Node node: nodeList)
{
LocaleEncodingMappingType<LocaleEncodingMappingListType<T>> type = new LocaleEncodingMappingTypeImpl<LocaleEncodingMappingListType<T>>(this, "locale-encoding-mapping", childNode, node);
list.add(type);
}
return list;
} } | public class class_name {
public List<LocaleEncodingMappingType<LocaleEncodingMappingListType<T>>> getAllLocaleEncodingMapping()
{
List<LocaleEncodingMappingType<LocaleEncodingMappingListType<T>>> list = new ArrayList<LocaleEncodingMappingType<LocaleEncodingMappingListType<T>>>();
List<Node> nodeList = childNode.get("locale-encoding-mapping");
for(Node node: nodeList)
{
LocaleEncodingMappingType<LocaleEncodingMappingListType<T>> type = new LocaleEncodingMappingTypeImpl<LocaleEncodingMappingListType<T>>(this, "locale-encoding-mapping", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
public static boolean hasDigit(String str)
{
final Pattern pattern = Pattern.compile("[0-9]");
final Matcher matcher = pattern.matcher(str);
while (matcher.find())
{
return true;
}
return false;
} } | public class class_name {
public static boolean hasDigit(String str)
{
final Pattern pattern = Pattern.compile("[0-9]");
final Matcher matcher = pattern.matcher(str);
while (matcher.find())
{
return true; // depends on control dependency: [while], data = [none]
}
return false;
} } |
public class class_name {
private void addPostParams(final Request request) {
if (path != null) {
request.addPostParam("Path", path);
}
if (visibility != null) {
request.addPostParam("Visibility", visibility.toString());
}
} } | public class class_name {
private void addPostParams(final Request request) {
if (path != null) {
request.addPostParam("Path", path); // depends on control dependency: [if], data = [none]
}
if (visibility != null) {
request.addPostParam("Visibility", visibility.toString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String[] getAllClassPathNotInJar() {
String[] allClassPath = getAllClassPaths();
List<String> allClassPathNotInJar = new ArrayList<String>();
for (String classPath : allClassPath) {
if (classPath.endsWith("jar")) {
continue;
}
allClassPathNotInJar.add(classPath);
}
return allClassPathNotInJar.toArray(new String[allClassPathNotInJar.size()]);
} } | public class class_name {
public static String[] getAllClassPathNotInJar() {
String[] allClassPath = getAllClassPaths();
List<String> allClassPathNotInJar = new ArrayList<String>();
for (String classPath : allClassPath) {
if (classPath.endsWith("jar")) {
continue;
}
allClassPathNotInJar.add(classPath);
// depends on control dependency: [for], data = [classPath]
}
return allClassPathNotInJar.toArray(new String[allClassPathNotInJar.size()]);
} } |
public class class_name {
public static Ipv6Range parse(String range) {
int idx = range.indexOf(DASH);
if (idx != -1) {
Ipv6 start = Ipv6.parse(range.substring(0, idx));
Ipv6 end = Ipv6.parse(range.substring(idx + 1, range.length()));
return new Ipv6Range(start, end);
} else {
return parseCidr(range);
}
} } | public class class_name {
public static Ipv6Range parse(String range) {
int idx = range.indexOf(DASH);
if (idx != -1) {
Ipv6 start = Ipv6.parse(range.substring(0, idx));
Ipv6 end = Ipv6.parse(range.substring(idx + 1, range.length()));
return new Ipv6Range(start, end); // depends on control dependency: [if], data = [none]
} else {
return parseCidr(range); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public RequestEvent waitRequest(long timeout) {
initErrorInfo();
synchronized (reqBlock) {
if (reqEvents.isEmpty()) {
try {
LOG.trace("about to block, waiting");
reqBlock.waitForEvent(timeout);
LOG.trace("we've come out of the block");
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return null;
}
}
LOG.trace("either we got the request, or timed out");
if (reqEvents.isEmpty()) {
setReturnCode(TIMEOUT_OCCURRED);
setErrorMessage("The maximum amount of time to wait for a request message has elapsed.");
return null;
}
return (RequestEvent) reqEvents.removeFirst();
}
} } | public class class_name {
public RequestEvent waitRequest(long timeout) {
initErrorInfo();
synchronized (reqBlock) {
if (reqEvents.isEmpty()) {
try {
LOG.trace("about to block, waiting"); // depends on control dependency: [try], data = [none]
reqBlock.waitForEvent(timeout); // depends on control dependency: [try], data = [none]
LOG.trace("we've come out of the block"); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return null;
} // depends on control dependency: [catch], data = [none]
}
LOG.trace("either we got the request, or timed out");
if (reqEvents.isEmpty()) {
setReturnCode(TIMEOUT_OCCURRED); // depends on control dependency: [if], data = [none]
setErrorMessage("The maximum amount of time to wait for a request message has elapsed."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return (RequestEvent) reqEvents.removeFirst();
}
} } |
public class class_name {
public final void mFLOAT() throws RecognitionException {
try {
int _type = FLOAT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? | '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? | ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? | ( '0' .. '9' )+ FloatTypeSuffix )
int alt13=4;
alt13 = dfa13.predict(input);
switch (alt13) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )?
{
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:9: ( '0' .. '9' )+
int cnt3=0;
loop3:
while (true) {
int alt3=2;
int LA3_0 = input.LA(1);
if ( ((LA3_0 >= '0' && LA3_0 <= '9')) ) {
alt3=1;
}
switch (alt3) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
input.consume();
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
default :
if ( cnt3 >= 1 ) break loop3;
if (state.backtracking>0) {state.failed=true; return;}
EarlyExitException eee = new EarlyExitException(3, input);
throw eee;
}
cnt3++;
}
match('.'); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:25: ( '0' .. '9' )*
loop4:
while (true) {
int alt4=2;
int LA4_0 = input.LA(1);
if ( ((LA4_0 >= '0' && LA4_0 <= '9')) ) {
alt4=1;
}
switch (alt4) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
input.consume();
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
default :
break loop4;
}
}
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:37: ( Exponent )?
int alt5=2;
int LA5_0 = input.LA(1);
if ( (LA5_0=='E'||LA5_0=='e') ) {
alt5=1;
}
switch (alt5) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:37: Exponent
{
mExponent(); if (state.failed) return;
}
break;
}
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:47: ( FloatTypeSuffix )?
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0=='B'||LA6_0=='D'||LA6_0=='F'||LA6_0=='d'||LA6_0=='f') ) {
alt6=1;
}
switch (alt6) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( input.LA(1)=='B'||input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='d'||input.LA(1)=='f' ) {
input.consume();
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
}
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:89:9: '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )?
{
match('.'); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:89:13: ( '0' .. '9' )+
int cnt7=0;
loop7:
while (true) {
int alt7=2;
int LA7_0 = input.LA(1);
if ( ((LA7_0 >= '0' && LA7_0 <= '9')) ) {
alt7=1;
}
switch (alt7) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
input.consume();
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
default :
if ( cnt7 >= 1 ) break loop7;
if (state.backtracking>0) {state.failed=true; return;}
EarlyExitException eee = new EarlyExitException(7, input);
throw eee;
}
cnt7++;
}
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:89:25: ( Exponent )?
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0=='E'||LA8_0=='e') ) {
alt8=1;
}
switch (alt8) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:89:25: Exponent
{
mExponent(); if (state.failed) return;
}
break;
}
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:89:35: ( FloatTypeSuffix )?
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0=='B'||LA9_0=='D'||LA9_0=='F'||LA9_0=='d'||LA9_0=='f') ) {
alt9=1;
}
switch (alt9) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( input.LA(1)=='B'||input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='d'||input.LA(1)=='f' ) {
input.consume();
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
}
}
break;
case 3 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:90:9: ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )?
{
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:90:9: ( '0' .. '9' )+
int cnt10=0;
loop10:
while (true) {
int alt10=2;
int LA10_0 = input.LA(1);
if ( ((LA10_0 >= '0' && LA10_0 <= '9')) ) {
alt10=1;
}
switch (alt10) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
input.consume();
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
default :
if ( cnt10 >= 1 ) break loop10;
if (state.backtracking>0) {state.failed=true; return;}
EarlyExitException eee = new EarlyExitException(10, input);
throw eee;
}
cnt10++;
}
mExponent(); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:90:30: ( FloatTypeSuffix )?
int alt11=2;
int LA11_0 = input.LA(1);
if ( (LA11_0=='B'||LA11_0=='D'||LA11_0=='F'||LA11_0=='d'||LA11_0=='f') ) {
alt11=1;
}
switch (alt11) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( input.LA(1)=='B'||input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='d'||input.LA(1)=='f' ) {
input.consume();
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
}
}
break;
case 4 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:91:9: ( '0' .. '9' )+ FloatTypeSuffix
{
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:91:9: ( '0' .. '9' )+
int cnt12=0;
loop12:
while (true) {
int alt12=2;
int LA12_0 = input.LA(1);
if ( ((LA12_0 >= '0' && LA12_0 <= '9')) ) {
alt12=1;
}
switch (alt12) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
input.consume();
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
default :
if ( cnt12 >= 1 ) break loop12;
if (state.backtracking>0) {state.failed=true; return;}
EarlyExitException eee = new EarlyExitException(12, input);
throw eee;
}
cnt12++;
}
mFloatTypeSuffix(); if (state.failed) return;
}
break;
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
} } | public class class_name {
public final void mFLOAT() throws RecognitionException {
try {
int _type = FLOAT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? | '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? | ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? | ( '0' .. '9' )+ FloatTypeSuffix )
int alt13=4;
alt13 = dfa13.predict(input);
switch (alt13) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )?
{
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:9: ( '0' .. '9' )+
int cnt3=0;
loop3:
while (true) {
int alt3=2;
int LA3_0 = input.LA(1);
if ( ((LA3_0 >= '0' && LA3_0 <= '9')) ) {
alt3=1; // depends on control dependency: [if], data = [none]
}
switch (alt3) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
input.consume(); // depends on control dependency: [if], data = [none]
state.failed=false; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
default :
if ( cnt3 >= 1 ) break loop3;
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
EarlyExitException eee = new EarlyExitException(3, input);
throw eee;
}
cnt3++; // depends on control dependency: [while], data = [none]
}
match('.'); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:25: ( '0' .. '9' )*
loop4:
while (true) {
int alt4=2;
int LA4_0 = input.LA(1);
if ( ((LA4_0 >= '0' && LA4_0 <= '9')) ) {
alt4=1; // depends on control dependency: [if], data = [none]
}
switch (alt4) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
input.consume(); // depends on control dependency: [if], data = [none]
state.failed=false; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
default :
break loop4;
}
}
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:37: ( Exponent )?
int alt5=2;
int LA5_0 = input.LA(1);
if ( (LA5_0=='E'||LA5_0=='e') ) {
alt5=1; // depends on control dependency: [if], data = [none]
}
switch (alt5) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:37: Exponent
{
mExponent(); if (state.failed) return;
}
break;
}
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:88:47: ( FloatTypeSuffix )?
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0=='B'||LA6_0=='D'||LA6_0=='F'||LA6_0=='d'||LA6_0=='f') ) {
alt6=1; // depends on control dependency: [if], data = [none]
}
switch (alt6) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( input.LA(1)=='B'||input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='d'||input.LA(1)=='f' ) {
input.consume(); // depends on control dependency: [if], data = [none]
state.failed=false; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
}
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:89:9: '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )?
{
match('.'); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:89:13: ( '0' .. '9' )+
int cnt7=0;
loop7:
while (true) {
int alt7=2;
int LA7_0 = input.LA(1);
if ( ((LA7_0 >= '0' && LA7_0 <= '9')) ) {
alt7=1; // depends on control dependency: [if], data = [none]
}
switch (alt7) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
input.consume(); // depends on control dependency: [if], data = [none]
state.failed=false; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
default :
if ( cnt7 >= 1 ) break loop7;
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
EarlyExitException eee = new EarlyExitException(7, input);
throw eee;
}
cnt7++; // depends on control dependency: [while], data = [none]
}
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:89:25: ( Exponent )?
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0=='E'||LA8_0=='e') ) {
alt8=1; // depends on control dependency: [if], data = [none]
}
switch (alt8) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:89:25: Exponent
{
mExponent(); if (state.failed) return;
}
break;
}
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:89:35: ( FloatTypeSuffix )?
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0=='B'||LA9_0=='D'||LA9_0=='F'||LA9_0=='d'||LA9_0=='f') ) {
alt9=1; // depends on control dependency: [if], data = [none]
}
switch (alt9) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( input.LA(1)=='B'||input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='d'||input.LA(1)=='f' ) {
input.consume(); // depends on control dependency: [if], data = [none]
state.failed=false; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
}
}
break;
case 3 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:90:9: ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )?
{
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:90:9: ( '0' .. '9' )+
int cnt10=0;
loop10:
while (true) {
int alt10=2;
int LA10_0 = input.LA(1);
if ( ((LA10_0 >= '0' && LA10_0 <= '9')) ) {
alt10=1; // depends on control dependency: [if], data = [none]
}
switch (alt10) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
input.consume(); // depends on control dependency: [if], data = [none]
state.failed=false; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
default :
if ( cnt10 >= 1 ) break loop10;
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
EarlyExitException eee = new EarlyExitException(10, input);
throw eee;
}
cnt10++; // depends on control dependency: [while], data = [none]
}
mExponent(); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:90:30: ( FloatTypeSuffix )?
int alt11=2;
int LA11_0 = input.LA(1);
if ( (LA11_0=='B'||LA11_0=='D'||LA11_0=='F'||LA11_0=='d'||LA11_0=='f') ) {
alt11=1; // depends on control dependency: [if], data = [none]
}
switch (alt11) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( input.LA(1)=='B'||input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='d'||input.LA(1)=='f' ) {
input.consume(); // depends on control dependency: [if], data = [none]
state.failed=false; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
}
}
break;
case 4 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:91:9: ( '0' .. '9' )+ FloatTypeSuffix
{
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:91:9: ( '0' .. '9' )+
int cnt12=0;
loop12:
while (true) {
int alt12=2;
int LA12_0 = input.LA(1);
if ( ((LA12_0 >= '0' && LA12_0 <= '9')) ) {
alt12=1; // depends on control dependency: [if], data = [none]
}
switch (alt12) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
input.consume(); // depends on control dependency: [if], data = [none]
state.failed=false; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
default :
if ( cnt12 >= 1 ) break loop12;
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
EarlyExitException eee = new EarlyExitException(12, input);
throw eee;
}
cnt12++; // depends on control dependency: [while], data = [none]
}
mFloatTypeSuffix(); if (state.failed) return;
}
break;
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
} } |
public class class_name {
public AbstractExpression singlePartitioningExpression() {
AbstractExpression e = singlePartitioningExpressionForReport();
if (e != null && isUsefulPartitioningExpression(e)) {
return e;
}
return null;
} } | public class class_name {
public AbstractExpression singlePartitioningExpression() {
AbstractExpression e = singlePartitioningExpressionForReport();
if (e != null && isUsefulPartitioningExpression(e)) {
return e; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static void resolveConflicts(PatternCacheControl specificPattern, PatternCacheControl generalPattern) {
for (Entry<Directive, String> entry : generalPattern.getDirectives().entrySet()) {
Directive generalDirective = entry.getKey();
String generalValue = entry.getValue();
if (generalValue == EMPTY_STRING_VALUE) {
specificPattern.setDirective(generalDirective, EMPTY_STRING_VALUE);
} else {
resolveValueConflicts(generalDirective, generalValue, specificPattern);
}
}
} } | public class class_name {
public static void resolveConflicts(PatternCacheControl specificPattern, PatternCacheControl generalPattern) {
for (Entry<Directive, String> entry : generalPattern.getDirectives().entrySet()) {
Directive generalDirective = entry.getKey();
String generalValue = entry.getValue();
if (generalValue == EMPTY_STRING_VALUE) {
specificPattern.setDirective(generalDirective, EMPTY_STRING_VALUE); // depends on control dependency: [if], data = [EMPTY_STRING_VALUE)]
} else {
resolveValueConflicts(generalDirective, generalValue, specificPattern); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static Config resolveEncrypted(Config config, Optional<String> encConfigPath) {
if (!encConfigPath.isPresent() || !config.hasPath(encConfigPath.get())) {
return config;
}
Config encryptedConfig = config.getConfig(encConfigPath.get());
PasswordManager passwordManager = PasswordManager.getInstance(configToProperties(config));
Map<String, String> tmpMap = Maps.newHashMap();
for (Map.Entry<String, ConfigValue> entry : encryptedConfig.entrySet()) {
String val = entry.getValue().unwrapped().toString();
val = passwordManager.readPassword(val);
tmpMap.put(entry.getKey(), val);
}
return ConfigFactory.parseMap(tmpMap).withFallback(config);
} } | public class class_name {
public static Config resolveEncrypted(Config config, Optional<String> encConfigPath) {
if (!encConfigPath.isPresent() || !config.hasPath(encConfigPath.get())) {
return config; // depends on control dependency: [if], data = [none]
}
Config encryptedConfig = config.getConfig(encConfigPath.get());
PasswordManager passwordManager = PasswordManager.getInstance(configToProperties(config));
Map<String, String> tmpMap = Maps.newHashMap();
for (Map.Entry<String, ConfigValue> entry : encryptedConfig.entrySet()) {
String val = entry.getValue().unwrapped().toString();
val = passwordManager.readPassword(val); // depends on control dependency: [for], data = [none]
tmpMap.put(entry.getKey(), val); // depends on control dependency: [for], data = [entry]
}
return ConfigFactory.parseMap(tmpMap).withFallback(config);
} } |
public class class_name {
@Nullable
public static MongoException fromThrowable(@Nullable final Throwable t) {
if (t == null) {
return null;
} else {
return fromThrowableNonNull(t);
}
} } | public class class_name {
@Nullable
public static MongoException fromThrowable(@Nullable final Throwable t) {
if (t == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
return fromThrowableNonNull(t); // depends on control dependency: [if], data = [(t]
}
} } |
public class class_name {
public ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor) {
String version = getBundleVersion("org.eclipse.virgo.kernel.userregion");
if (version != null) {
String type = "kernel";
if (getBundleVersion("org.eclipse.gemini.web.core") != null) {
type = "tomcat";
} else if (getBundleVersion("org.eclipse.jetty.osgi.boot") != null) {
type = "jetty";
}
Map<String,String> extraInfo = new HashMap<String,String>();
extraInfo.put("type",type);
return new ServerHandle("Eclipse","Virgo",version, extraInfo);
} else {
return null;
}
} } | public class class_name {
public ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor) {
String version = getBundleVersion("org.eclipse.virgo.kernel.userregion");
if (version != null) {
String type = "kernel";
if (getBundleVersion("org.eclipse.gemini.web.core") != null) {
type = "tomcat"; // depends on control dependency: [if], data = [none]
} else if (getBundleVersion("org.eclipse.jetty.osgi.boot") != null) {
type = "jetty"; // depends on control dependency: [if], data = [none]
}
Map<String,String> extraInfo = new HashMap<String,String>();
extraInfo.put("type",type); // depends on control dependency: [if], data = [none]
return new ServerHandle("Eclipse","Virgo",version, extraInfo); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void parse(
final boolean errorOnExtraProperties, final PObject requestData, final Object objectToPopulate,
final String... extraPropertyToIgnore) {
checkForExtraProperties(errorOnExtraProperties, objectToPopulate.getClass(), requestData,
extraPropertyToIgnore);
final Collection<Field> allAttributes =
ParserUtils.getAttributes(objectToPopulate.getClass(), FILTER_NON_FINAL_FIELDS);
Map<String, Class<?>> missingProperties = new HashMap<>();
final OneOfTracker oneOfTracker = new OneOfTracker();
final RequiresTracker requiresTracker = new RequiresTracker();
final String paramClassName = objectToPopulate.getClass().getName();
for (Field attribute: allAttributes) {
oneOfTracker.register(attribute);
requiresTracker.register(attribute);
}
for (Field property: allAttributes) {
try {
Object value;
try {
value = parseValue(errorOnExtraProperties, extraPropertyToIgnore, property.getType(),
property.getName(),
requestData);
} catch (UnsupportedTypeException e) {
String type = e.type.getName();
if (e.type.isArray()) {
type = e.type.getComponentType().getName() + "[]";
}
throw new RuntimeException(
"The type '" + type + "' is not a supported type when parsing json. " +
"See documentation for supported types.\n\nUnsupported type found in " +
paramClassName
+ " " +
"under the property: " + property.getName() +
"\n\nTo support more types add the type to" +
" " +
"parseValue and parseArrayValue in this class and add a test to the " +
"test class",
e);
}
try {
oneOfTracker.markAsVisited(property);
requiresTracker.markAsVisited(property);
property.set(objectToPopulate, value);
} catch (IllegalAccessException e) {
throw ExceptionUtils.getRuntimeException(e);
}
} catch (ObjectMissingException e) {
final HasDefaultValue hasDefaultValue = property.getAnnotation(HasDefaultValue.class);
final OneOf oneOf = property.getAnnotation(OneOf.class);
final CanSatisfyOneOf canSatisfyOneOf = property.getAnnotation(CanSatisfyOneOf.class);
if (hasDefaultValue == null && oneOf == null && canSatisfyOneOf == null) {
missingProperties.put(property.getName(), property.getType());
}
}
}
oneOfTracker.checkAllGroupsSatisfied(requestData.getCurrentPath());
requiresTracker.checkAllRequirementsSatisfied(requestData.getCurrentPath());
if (!missingProperties.isEmpty()) {
String message =
"Request Json is missing some required attributes at: '" + requestData.getCurrentPath() +
"': ";
throw new MissingPropertyException(message, missingProperties,
getAllAttributeNames(objectToPopulate.getClass()));
}
try {
final Method method = objectToPopulate.getClass().getMethod(POST_CONSTRUCT_METHOD_NAME);
method.invoke(objectToPopulate);
} catch (NoSuchMethodException e) {
LOGGER.debug("No {} method on parameter object of class {}", POST_CONSTRUCT_METHOD_NAME,
paramClassName);
} catch (InvocationTargetException e) {
final Throwable targetException = e.getTargetException();
if (targetException instanceof RuntimeException) {
throw (RuntimeException) targetException;
} else if (targetException instanceof Error) {
throw (Error) targetException;
}
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static void parse(
final boolean errorOnExtraProperties, final PObject requestData, final Object objectToPopulate,
final String... extraPropertyToIgnore) {
checkForExtraProperties(errorOnExtraProperties, objectToPopulate.getClass(), requestData,
extraPropertyToIgnore);
final Collection<Field> allAttributes =
ParserUtils.getAttributes(objectToPopulate.getClass(), FILTER_NON_FINAL_FIELDS);
Map<String, Class<?>> missingProperties = new HashMap<>();
final OneOfTracker oneOfTracker = new OneOfTracker();
final RequiresTracker requiresTracker = new RequiresTracker();
final String paramClassName = objectToPopulate.getClass().getName();
for (Field attribute: allAttributes) {
oneOfTracker.register(attribute); // depends on control dependency: [for], data = [attribute]
requiresTracker.register(attribute); // depends on control dependency: [for], data = [attribute]
}
for (Field property: allAttributes) {
try {
Object value;
try {
value = parseValue(errorOnExtraProperties, extraPropertyToIgnore, property.getType(),
property.getName(),
requestData); // depends on control dependency: [try], data = [none]
} catch (UnsupportedTypeException e) {
String type = e.type.getName();
if (e.type.isArray()) {
type = e.type.getComponentType().getName() + "[]"; // depends on control dependency: [if], data = [none]
}
throw new RuntimeException(
"The type '" + type + "' is not a supported type when parsing json. " +
"See documentation for supported types.\n\nUnsupported type found in " +
paramClassName
+ " " +
"under the property: " + property.getName() +
"\n\nTo support more types add the type to" +
" " +
"parseValue and parseArrayValue in this class and add a test to the " +
"test class",
e);
} // depends on control dependency: [catch], data = [none]
try {
oneOfTracker.markAsVisited(property); // depends on control dependency: [try], data = [none]
requiresTracker.markAsVisited(property); // depends on control dependency: [try], data = [none]
property.set(objectToPopulate, value); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
throw ExceptionUtils.getRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} catch (ObjectMissingException e) {
final HasDefaultValue hasDefaultValue = property.getAnnotation(HasDefaultValue.class);
final OneOf oneOf = property.getAnnotation(OneOf.class);
final CanSatisfyOneOf canSatisfyOneOf = property.getAnnotation(CanSatisfyOneOf.class);
if (hasDefaultValue == null && oneOf == null && canSatisfyOneOf == null) {
missingProperties.put(property.getName(), property.getType()); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
oneOfTracker.checkAllGroupsSatisfied(requestData.getCurrentPath());
requiresTracker.checkAllRequirementsSatisfied(requestData.getCurrentPath());
if (!missingProperties.isEmpty()) {
String message =
"Request Json is missing some required attributes at: '" + requestData.getCurrentPath() +
"': ";
throw new MissingPropertyException(message, missingProperties,
getAllAttributeNames(objectToPopulate.getClass()));
}
try {
final Method method = objectToPopulate.getClass().getMethod(POST_CONSTRUCT_METHOD_NAME);
method.invoke(objectToPopulate); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
LOGGER.debug("No {} method on parameter object of class {}", POST_CONSTRUCT_METHOD_NAME,
paramClassName);
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
final Throwable targetException = e.getTargetException();
if (targetException instanceof RuntimeException) {
throw (RuntimeException) targetException;
} else if (targetException instanceof Error) {
throw (Error) targetException;
}
throw new RuntimeException(e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected Parameter removeParameter(final String name) {
if (name == null) { throw new IllegalArgumentException("Parameter name cannot be null"); }
final Iterator<Parameter> iter = result.simpleParameters.getChildren().iterator();
while (iter.hasNext()) {
final Parameter p = iter.next();
if (name.equals(p.name)) {
iter.remove();
return p;
}
}
return null;
} } | public class class_name {
protected Parameter removeParameter(final String name) {
if (name == null) { throw new IllegalArgumentException("Parameter name cannot be null"); }
final Iterator<Parameter> iter = result.simpleParameters.getChildren().iterator();
while (iter.hasNext()) {
final Parameter p = iter.next();
if (name.equals(p.name)) {
iter.remove();
// depends on control dependency: [if], data = [none]
return p;
// depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static <E> int iterableSize(Iterable<E> itrbl) {
int size = 0;
for (Iterator<E> iter = itrbl.iterator(); iter.hasNext();) {
iter.next();
size++;
}
return size;
} } | public class class_name {
public static <E> int iterableSize(Iterable<E> itrbl) {
int size = 0;
for (Iterator<E> iter = itrbl.iterator(); iter.hasNext();) {
iter.next(); // depends on control dependency: [for], data = [iter]
size++; // depends on control dependency: [for], data = [none]
}
return size;
} } |
public class class_name {
@Override
public EClass getIfcFireSuppressionTerminalType() {
if (ifcFireSuppressionTerminalTypeEClass == null) {
ifcFireSuppressionTerminalTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(274);
}
return ifcFireSuppressionTerminalTypeEClass;
} } | public class class_name {
@Override
public EClass getIfcFireSuppressionTerminalType() {
if (ifcFireSuppressionTerminalTypeEClass == null) {
ifcFireSuppressionTerminalTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(274);
// depends on control dependency: [if], data = [none]
}
return ifcFireSuppressionTerminalTypeEClass;
} } |
public class class_name {
private MtasParserObject[] computeObjectFromMappingValue(
MtasParserObject object, Map<String, String> mappingValue,
Map<String, List<MtasParserObject>> currentList)
throws MtasParserException {
MtasParserObject[] checkObjects = null;
MtasParserObject checkObject;
Integer ancestorNumber = null;
String ancestorType = null;
// try to get relevant object
if (mappingValue.get(MAPPING_VALUE_SOURCE)
.equals(MtasParserMapping.SOURCE_OWN)) {
checkObjects = new MtasParserObject[] { object };
} else {
ancestorNumber = mappingValue.get(MAPPING_VALUE_ANCESTOR) != null
? Integer.parseInt(mappingValue.get(MAPPING_VALUE_ANCESTOR)) : null;
ancestorType = computeTypeFromMappingSource(
mappingValue.get(MAPPING_VALUE_SOURCE));
// get ancestor object
if (ancestorType != null) {
int s = currentList.get(ancestorType).size();
// check existence ancestor for conditions
if (ancestorNumber != null) {
if ((s > 0) && (ancestorNumber < s) && (checkObject = currentList
.get(ancestorType).get((s - ancestorNumber - 1))) != null) {
checkObjects = new MtasParserObject[] { checkObject };
}
} else {
checkObjects = new MtasParserObject[s];
for (int i = s - 1; i >= 0; i--) {
checkObjects[s - i - 1] = currentList.get(ancestorType).get(i);
}
}
}
}
return checkObjects;
} } | public class class_name {
private MtasParserObject[] computeObjectFromMappingValue(
MtasParserObject object, Map<String, String> mappingValue,
Map<String, List<MtasParserObject>> currentList)
throws MtasParserException {
MtasParserObject[] checkObjects = null;
MtasParserObject checkObject;
Integer ancestorNumber = null;
String ancestorType = null;
// try to get relevant object
if (mappingValue.get(MAPPING_VALUE_SOURCE)
.equals(MtasParserMapping.SOURCE_OWN)) {
checkObjects = new MtasParserObject[] { object };
} else {
ancestorNumber = mappingValue.get(MAPPING_VALUE_ANCESTOR) != null
? Integer.parseInt(mappingValue.get(MAPPING_VALUE_ANCESTOR)) : null;
ancestorType = computeTypeFromMappingSource(
mappingValue.get(MAPPING_VALUE_SOURCE));
// get ancestor object
if (ancestorType != null) {
int s = currentList.get(ancestorType).size();
// check existence ancestor for conditions
if (ancestorNumber != null) {
if ((s > 0) && (ancestorNumber < s) && (checkObject = currentList
.get(ancestorType).get((s - ancestorNumber - 1))) != null) {
checkObjects = new MtasParserObject[] { checkObject }; // depends on control dependency: [if], data = [none]
}
} else {
checkObjects = new MtasParserObject[s]; // depends on control dependency: [if], data = [none]
for (int i = s - 1; i >= 0; i--) {
checkObjects[s - i - 1] = currentList.get(ancestorType).get(i); // depends on control dependency: [for], data = [i]
}
}
}
}
return checkObjects;
} } |
public class class_name {
private boolean checkMagnetCapturePicture() {
boolean captured = false;
Iterator<Magnet> iter = magnets.iterator();
while( iter.hasNext() ) {
Magnet i = iter.next();
if( i.handlePictureTaken() ) {
iter.remove();
captured = true;
}
}
return captured;
} } | public class class_name {
private boolean checkMagnetCapturePicture() {
boolean captured = false;
Iterator<Magnet> iter = magnets.iterator();
while( iter.hasNext() ) {
Magnet i = iter.next();
if( i.handlePictureTaken() ) {
iter.remove(); // depends on control dependency: [if], data = [none]
captured = true; // depends on control dependency: [if], data = [none]
}
}
return captured;
} } |
public class class_name {
public void marshall(Attribute attribute, ProtocolMarshaller protocolMarshaller) {
if (attribute == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(attribute.getKey(), KEY_BINDING);
protocolMarshaller.marshall(attribute.getValue(), VALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Attribute attribute, ProtocolMarshaller protocolMarshaller) {
if (attribute == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(attribute.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(attribute.getValue(), VALUE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final int getConstantIndex(String constant)
{
int nameIndex = getNameIndex(constant);
for (ConstantInfo ci : listConstantInfo(ConstantString.class))
{
ConstantString ic = (ConstantString) ci;
if (nameIndex == ic.getString_index())
{
return constantPoolIndexMap.get(ci);
}
}
return -1;
} } | public class class_name {
public final int getConstantIndex(String constant)
{
int nameIndex = getNameIndex(constant);
for (ConstantInfo ci : listConstantInfo(ConstantString.class))
{
ConstantString ic = (ConstantString) ci;
if (nameIndex == ic.getString_index())
{
return constantPoolIndexMap.get(ci); // depends on control dependency: [if], data = [none]
}
}
return -1;
} } |
public class class_name {
public StringColumn append(String value) {
try {
lookupTable.append(value);
} catch (NoKeysAvailableException ex) {
lookupTable = lookupTable.promoteYourself();
try {
lookupTable.append(value);
} catch (NoKeysAvailableException e) {
// this can't happen
throw new IllegalStateException(e);
}
}
return this;
} } | public class class_name {
public StringColumn append(String value) {
try {
lookupTable.append(value); // depends on control dependency: [try], data = [none]
} catch (NoKeysAvailableException ex) {
lookupTable = lookupTable.promoteYourself();
try {
lookupTable.append(value); // depends on control dependency: [try], data = [none]
} catch (NoKeysAvailableException e) {
// this can't happen
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
return this;
} } |
public class class_name {
protected void replayTranLog() throws Exception {
if (tc.isEntryEnabled())
Tr.entry(tc, "replayTranLog");
final LogCursor recoverableUnits = _tranLog.recoverableUnits();
LogCursor recoverableUnitSections = null;
int recoveredServiceItems = 0;
boolean shuttingDown = false;
boolean recoveredTransactions = false;
try {
// The recovered transctions may include completed transactions.
// These will be filtered out by the TransactionImpl.reconstruct call
// We will force a checkpoint after this in case we previously crashed.
while (recoverableUnits.hasNext() && !shuttingDown) {
final RecoverableUnit ru = (RecoverableUnit) recoverableUnits.next();
if (tc.isEventEnabled())
Tr.event(tc, "Replaying record " + ru.identity() + " from the transaction log");
recoverableUnitSections = ru.sections();
boolean tranRecord = false;
while (!tranRecord && recoverableUnitSections.hasNext()) {
final RecoverableUnitSection rus = (RecoverableUnitSection) recoverableUnitSections.next();
final int rusId = rus.identity();
final byte[] logData = rus.lastData(); // Only ever have 1 data item per service data sections
if (tc.isEventEnabled())
Tr.event(tc, "Replaying section " + rusId, Util.toHexString(logData));
switch (rusId) {
case TransactionImpl.SERVER_DATA_SECTION:
if (tc.isDebugEnabled())
Tr.debug(tc, "Server name data record");
if (_tranlogServerSection != null) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log SERVER_DATA_SECTIONs found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName());
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
if (_tranlogServiceData == null) {
_tranlogServiceData = ru;
} else if (_tranlogServiceData != ru) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log service data records found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName());
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
_tranlogServerSection = rus;
recoveredServiceItems++;
if (logData != null && logData.length != 0) {
final String recoveredServerName = new String(logData);
if (_recoveredServerName == null) {
_recoveredServerName = recoveredServerName;
//
// Check to see if the logged serverName is the same as this server
// If it is different, we just output a message as we may be replaying another server log
// on this server. We leave the service data set to the original server name in case we
// crash before recovery has completed. We need to ensure we have a matching server name
// with that from the partner log. On shutdown, if there are no transactions running, we
// clear out the transaction log, but leave the partner log and may update the server name
// to this server in the partner log. If there are transactions running, we never update
// the server name in the log.
//
if (!_failureScopeController.serverName().equals(_recoveredServerName)) {
Tr.warning(tc, "WTRN0020_RECOVERING_TRANSACTIONS", _recoveredServerName);
}
} else if (!_recoveredServerName.equals(recoveredServerName)) {
Tr.error(tc, "WTRN0024_INCONSISTENT_LOGS");
throw new IOException("Inconsistent Transaction and XA Resource recovery logs");
}
}
break;
case TransactionImpl.APPLID_DATA_SECTION:
if (tc.isDebugEnabled())
Tr.debug(tc, "Applid data record");
if (_tranlogApplIdSection != null) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log APPLID_DATA_SECTIONs found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName());
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
if (_tranlogServiceData == null) {
_tranlogServiceData = ru;
} else if (_tranlogServiceData != ru) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log service data records found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName());
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
_tranlogApplIdSection = rus;
recoveredServiceItems++;
if (logData != null) {
if (_recoveredApplId == null) {
_recoveredApplId = logData;
} else if (!Util.equal(_recoveredApplId, logData)) {
Tr.error(tc, "WTRN0024_INCONSISTENT_LOGS");
throw new IOException("Inconsistent Transaction and XA Resource recovery logs");
}
}
break;
case TransactionImpl.EPOCH_DATA_SECTION:
if (tc.isDebugEnabled())
Tr.debug(tc, "Epoch data record");
if (_tranlogEpochSection != null) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log EPOCH_DATA_SECTIONs found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName());
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
if (_tranlogServiceData == null) {
_tranlogServiceData = ru;
} else if (_tranlogServiceData != ru) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log service data records found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName());
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
_tranlogEpochSection = rus;
recoveredServiceItems++;
if (logData != null && logData.length > 3) {
final int recoveredEpoch = Util.getIntFromBytes(logData, 0, 4);
if (tc.isDebugEnabled())
Tr.debug(tc, "Recovered epoch: " + recoveredEpoch);
// If epoch isnt set or tranlog epoch is larger than partner, take the larger.
// These can get out of step if one crashes during a restart.
if (recoveredEpoch > _recoveredEpoch) {
_recoveredEpoch = recoveredEpoch;
}
}
break;
default:
tranRecord = true;
break;
}
}
recoverableUnitSections.close();
recoverableUnitSections = null; // reset in case of throw/catch
if (tranRecord) {
recoveredTransactions = handleTranRecord(ru, recoveredTransactions, recoverableUnits);
}
// Check to see if shutdown has begun before proceeding. If it has, no
// further action can be taken.
shuttingDown = shutdownInProgress();
}
// Only bother to check that the retrieved information is valid if we are not
// trying to stop processing the partner log.
if (!shuttingDown) {
if (recoveredTransactions) {
// We have at least recovered a transaction
// Check we have all of the service data
if (recoveredServiceItems != TRANSACTION_SERVICE_ITEMS) {
if (tc.isEventEnabled())
Tr.event(tc, "Recoverable log records found without service data records");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName());
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
} else if (recoveredServiceItems != 0 && recoveredServiceItems != TRANSACTION_SERVICE_ITEMS) {
if (tc.isEventEnabled())
Tr.event(tc, "Only a subset of service data records recovered");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName());
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
}
} catch (Throwable exc) {
FFDCFilter.processException(exc, "com.ibm.tx.jta.impl.RecoveryManager.replayTranLog", "512", this);
if (recoverableUnitSections != null)
recoverableUnitSections.close();
Tr.error(tc, "WTRN0025_TRAN_RECOVERY_FAILED", exc);
SystemException se = new SystemException(exc.toString());
if (tc.isEntryEnabled())
Tr.exit(tc, "replayTranLog", se);
throw se;
} finally {
recoverableUnits.close();
}
if (tc.isEntryEnabled())
Tr.exit(tc, "replayTranLog");
} } | public class class_name {
protected void replayTranLog() throws Exception {
if (tc.isEntryEnabled())
Tr.entry(tc, "replayTranLog");
final LogCursor recoverableUnits = _tranLog.recoverableUnits();
LogCursor recoverableUnitSections = null;
int recoveredServiceItems = 0;
boolean shuttingDown = false;
boolean recoveredTransactions = false;
try {
// The recovered transctions may include completed transactions.
// These will be filtered out by the TransactionImpl.reconstruct call
// We will force a checkpoint after this in case we previously crashed.
while (recoverableUnits.hasNext() && !shuttingDown) {
final RecoverableUnit ru = (RecoverableUnit) recoverableUnits.next();
if (tc.isEventEnabled())
Tr.event(tc, "Replaying record " + ru.identity() + " from the transaction log");
recoverableUnitSections = ru.sections(); // depends on control dependency: [while], data = [none]
boolean tranRecord = false;
while (!tranRecord && recoverableUnitSections.hasNext()) {
final RecoverableUnitSection rus = (RecoverableUnitSection) recoverableUnitSections.next();
final int rusId = rus.identity();
final byte[] logData = rus.lastData(); // Only ever have 1 data item per service data sections
if (tc.isEventEnabled())
Tr.event(tc, "Replaying section " + rusId, Util.toHexString(logData));
switch (rusId) {
case TransactionImpl.SERVER_DATA_SECTION:
if (tc.isDebugEnabled())
Tr.debug(tc, "Server name data record");
if (_tranlogServerSection != null) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log SERVER_DATA_SECTIONs found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName()); // depends on control dependency: [if], data = [none]
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
if (_tranlogServiceData == null) {
_tranlogServiceData = ru; // depends on control dependency: [if], data = [none]
} else if (_tranlogServiceData != ru) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log service data records found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName()); // depends on control dependency: [if], data = [none]
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
_tranlogServerSection = rus;
recoveredServiceItems++;
if (logData != null && logData.length != 0) {
final String recoveredServerName = new String(logData);
if (_recoveredServerName == null) {
_recoveredServerName = recoveredServerName; // depends on control dependency: [if], data = [none]
//
// Check to see if the logged serverName is the same as this server
// If it is different, we just output a message as we may be replaying another server log
// on this server. We leave the service data set to the original server name in case we
// crash before recovery has completed. We need to ensure we have a matching server name
// with that from the partner log. On shutdown, if there are no transactions running, we
// clear out the transaction log, but leave the partner log and may update the server name
// to this server in the partner log. If there are transactions running, we never update
// the server name in the log.
//
if (!_failureScopeController.serverName().equals(_recoveredServerName)) {
Tr.warning(tc, "WTRN0020_RECOVERING_TRANSACTIONS", _recoveredServerName); // depends on control dependency: [if], data = [none]
}
} else if (!_recoveredServerName.equals(recoveredServerName)) {
Tr.error(tc, "WTRN0024_INCONSISTENT_LOGS"); // depends on control dependency: [if], data = [none]
throw new IOException("Inconsistent Transaction and XA Resource recovery logs");
}
}
break;
case TransactionImpl.APPLID_DATA_SECTION:
if (tc.isDebugEnabled())
Tr.debug(tc, "Applid data record");
if (_tranlogApplIdSection != null) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log APPLID_DATA_SECTIONs found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName()); // depends on control dependency: [if], data = [none]
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
if (_tranlogServiceData == null) {
_tranlogServiceData = ru; // depends on control dependency: [if], data = [none]
} else if (_tranlogServiceData != ru) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log service data records found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName()); // depends on control dependency: [if], data = [none]
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
_tranlogApplIdSection = rus;
recoveredServiceItems++;
if (logData != null) {
if (_recoveredApplId == null) {
_recoveredApplId = logData; // depends on control dependency: [if], data = [none]
} else if (!Util.equal(_recoveredApplId, logData)) {
Tr.error(tc, "WTRN0024_INCONSISTENT_LOGS"); // depends on control dependency: [if], data = [none]
throw new IOException("Inconsistent Transaction and XA Resource recovery logs");
}
}
break;
case TransactionImpl.EPOCH_DATA_SECTION:
if (tc.isDebugEnabled())
Tr.debug(tc, "Epoch data record");
if (_tranlogEpochSection != null) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log EPOCH_DATA_SECTIONs found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName()); // depends on control dependency: [if], data = [none]
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
if (_tranlogServiceData == null) {
_tranlogServiceData = ru; // depends on control dependency: [if], data = [none]
} else if (_tranlogServiceData != ru) {
if (tc.isEventEnabled())
Tr.event(tc, "Multiple log service data records found");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName()); // depends on control dependency: [if], data = [none]
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
_tranlogEpochSection = rus;
recoveredServiceItems++;
if (logData != null && logData.length > 3) {
final int recoveredEpoch = Util.getIntFromBytes(logData, 0, 4);
if (tc.isDebugEnabled())
Tr.debug(tc, "Recovered epoch: " + recoveredEpoch);
// If epoch isnt set or tranlog epoch is larger than partner, take the larger.
// These can get out of step if one crashes during a restart.
if (recoveredEpoch > _recoveredEpoch) {
_recoveredEpoch = recoveredEpoch; // depends on control dependency: [if], data = [none]
}
}
break;
default:
tranRecord = true;
break;
}
}
recoverableUnitSections.close(); // depends on control dependency: [while], data = [none]
recoverableUnitSections = null; // reset in case of throw/catch // depends on control dependency: [while], data = [none]
if (tranRecord) {
recoveredTransactions = handleTranRecord(ru, recoveredTransactions, recoverableUnits); // depends on control dependency: [if], data = [none]
}
// Check to see if shutdown has begun before proceeding. If it has, no
// further action can be taken.
shuttingDown = shutdownInProgress(); // depends on control dependency: [while], data = [none]
}
// Only bother to check that the retrieved information is valid if we are not
// trying to stop processing the partner log.
if (!shuttingDown) {
if (recoveredTransactions) {
// We have at least recovered a transaction
// Check we have all of the service data
if (recoveredServiceItems != TRANSACTION_SERVICE_ITEMS) {
if (tc.isEventEnabled())
Tr.event(tc, "Recoverable log records found without service data records");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName()); // depends on control dependency: [if], data = [none]
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
} else if (recoveredServiceItems != 0 && recoveredServiceItems != TRANSACTION_SERVICE_ITEMS) {
if (tc.isEventEnabled())
Tr.event(tc, "Only a subset of service data records recovered");
Tr.warning(tc, "WTRN0019_LOGFILE_CORRUPTED", _tranLog.logProperties().logName()); // depends on control dependency: [if], data = [none]
throw new IOException(_tranLog.logProperties().logName() + " corrupted");
}
}
} catch (Throwable exc) {
FFDCFilter.processException(exc, "com.ibm.tx.jta.impl.RecoveryManager.replayTranLog", "512", this);
if (recoverableUnitSections != null)
recoverableUnitSections.close();
Tr.error(tc, "WTRN0025_TRAN_RECOVERY_FAILED", exc);
SystemException se = new SystemException(exc.toString());
if (tc.isEntryEnabled())
Tr.exit(tc, "replayTranLog", se);
throw se;
} finally {
recoverableUnits.close();
}
if (tc.isEntryEnabled())
Tr.exit(tc, "replayTranLog");
} } |
public class class_name {
public synchronized void setTimeout(int timeout) {
try {
this.timeout = timeout;
if (socket != null) {
socket.setSoTimeout(timeout);
}
}
catch (IOException ex) {
logger.warn("Could not set timeout to value " + timeout, ex);
}
} } | public class class_name {
public synchronized void setTimeout(int timeout) {
try {
this.timeout = timeout; // depends on control dependency: [try], data = [none]
if (socket != null) {
socket.setSoTimeout(timeout); // depends on control dependency: [if], data = [none]
}
}
catch (IOException ex) {
logger.warn("Could not set timeout to value " + timeout, ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Locale extractLocale() {
Locale loc = null;
int underscore = m_name.lastIndexOf("_");
if (underscore > -1) {
String localeName = m_name.substring(underscore + 1);
if (localeName.lastIndexOf(".") > -1) {
localeName = localeName.substring(0, localeName.lastIndexOf("."));
}
loc = CmsLocaleManager.getLocale(localeName);
}
return loc;
} } | public class class_name {
private Locale extractLocale() {
Locale loc = null;
int underscore = m_name.lastIndexOf("_");
if (underscore > -1) {
String localeName = m_name.substring(underscore + 1);
if (localeName.lastIndexOf(".") > -1) {
localeName = localeName.substring(0, localeName.lastIndexOf(".")); // depends on control dependency: [if], data = [none]
}
loc = CmsLocaleManager.getLocale(localeName); // depends on control dependency: [if], data = [none]
}
return loc;
} } |
public class class_name {
public boolean getUserInfo(String strUser, boolean bForceRead)
{
boolean bFound = false;
if ((strUser == null) || (strUser.length() ==0))
return false; // Not found.
int iUserID = -1;
try { // First see if strUser is the UserID in string format
if (Utility.isNumeric(strUser))
if ((strUser != null) && (strUser.length() > 0))
iUserID = Integer.parseInt(strUser);
if (iUserID == 0)
iUserID = -1;
} catch (NumberFormatException ex) {
iUserID = -1;
}
if ((iUserID == -1) && (strUser.length() > 0))
{ // Read using the User name
if (!bForceRead)
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
if (this.getField(UserInfo.USER_NAME).toString().equalsIgnoreCase(strUser))
return true; // Already current
this.getField(UserInfo.USER_NAME).setString(strUser);
this.setKeyArea(UserInfo.USER_NAME_KEY);
try {
bFound = this.seek(null);
} catch (DBException ex) {
ex.printStackTrace();
bFound = false;
}
this.setKeyArea(UserInfo.ID_KEY);
}
if (iUserID != -1)
{ // Valid UserID, read it!
if (!bForceRead)
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
if (this.getField(UserInfo.ID).getValue() == iUserID)
return true; // Already current
this.getField(UserInfo.ID).setValue(iUserID);
try {
this.setKeyArea(UserInfo.ID_KEY);
bFound = this.seek(null);
} catch (DBException ex) {
ex.printStackTrace();
bFound = false;
}
}
return bFound;
} } | public class class_name {
public boolean getUserInfo(String strUser, boolean bForceRead)
{
boolean bFound = false;
if ((strUser == null) || (strUser.length() ==0))
return false; // Not found.
int iUserID = -1;
try { // First see if strUser is the UserID in string format
if (Utility.isNumeric(strUser))
if ((strUser != null) && (strUser.length() > 0))
iUserID = Integer.parseInt(strUser);
if (iUserID == 0)
iUserID = -1;
} catch (NumberFormatException ex) {
iUserID = -1;
} // depends on control dependency: [catch], data = [none]
if ((iUserID == -1) && (strUser.length() > 0))
{ // Read using the User name
if (!bForceRead)
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
if (this.getField(UserInfo.USER_NAME).toString().equalsIgnoreCase(strUser))
return true; // Already current
this.getField(UserInfo.USER_NAME).setString(strUser); // depends on control dependency: [if], data = [none]
this.setKeyArea(UserInfo.USER_NAME_KEY); // depends on control dependency: [if], data = [none]
try {
bFound = this.seek(null); // depends on control dependency: [try], data = [none]
} catch (DBException ex) {
ex.printStackTrace();
bFound = false;
} // depends on control dependency: [catch], data = [none]
this.setKeyArea(UserInfo.ID_KEY); // depends on control dependency: [if], data = [none]
}
if (iUserID != -1)
{ // Valid UserID, read it!
if (!bForceRead)
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
if (this.getField(UserInfo.ID).getValue() == iUserID)
return true; // Already current
this.getField(UserInfo.ID).setValue(iUserID); // depends on control dependency: [if], data = [(iUserID]
try {
this.setKeyArea(UserInfo.ID_KEY); // depends on control dependency: [try], data = [none]
bFound = this.seek(null); // depends on control dependency: [try], data = [none]
} catch (DBException ex) {
ex.printStackTrace();
bFound = false;
} // depends on control dependency: [catch], data = [none]
}
return bFound;
} } |
public class class_name {
public Object processSecurityPreInvokeException(SecurityViolationException sve, RequestProcessor requestProcessor, HttpServletRequest request,
HttpServletResponse response, WebAppDispatcherContext dispatchContext, WebApp context, String name) throws ServletErrorReport {
Object secObject = null;
// begin pq56177
secObject = sve.getWebSecurityContext();
int sc = sve.getStatusCode(); // access status code directly. Is
// SC_FORBIDDEN the default?
// if (sc==null){
// if
// (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable
// (Level.FINE) == true)
// {
// logger.logp(Level.FINE,
// CLASS_NAME,"processSecurityPreInvokeException",
// "webReply is null, default to 403 status code");
// }
// sc = HttpServletResponse.SC_FORBIDDEN;
// }
Throwable cause = sve.getCause();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.entering(CLASS_NAME, "processSecurityPreInvokeException");
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException",
"SecurityCollaboratorHelper.processPreInvokeException(): WebSecurityException thrown (" + sve.toString()
+ "). HTTP status code: " + sc + "resource : " + name);
} // end if
if (sc == HttpServletResponse.SC_FORBIDDEN) {
// If the user has defined a custom error page for
// SC_FORBIDDEN (HTTP status code 403) then send
// it to the client ...
if (context.isErrorPageDefined(sc) == true) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException", "Using user defined error page for HTTP status code "
+ sc);
}
WebAppErrorReport wErrorReport = new WebAppErrorReport(cause);
wErrorReport.setErrorCode(sc);
context.sendError(request, response, wErrorReport);
} else {
// ... otherwise, use the one provided by the
// SecurityCollaborator
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException",
"Using default security error page for HTTP status code " + sc);
}
try {
securityCollaborator.handleException(request, response, cause);
} catch (Exception ex) {
if (requestProcessor != null) {
throw WebAppErrorReport.constructErrorReport(ex, requestProcessor);
} else {
throw WebAppErrorReport.constructErrorReport(ex, name);
}
}
// reply.sendError(wResp);
} // end if-else
} else if (sc == HttpServletResponse.SC_UNAUTHORIZED) {
// Invoking handleException will add the necessary headers
// to the response ...
try {
securityCollaborator.handleException(request, response, cause);
} catch (Exception ex) {
if (requestProcessor != null) {
throw WebAppErrorReport.constructErrorReport(ex, requestProcessor);
} else {
throw WebAppErrorReport.constructErrorReport(ex, name);
}
}
// ... if the user has defined a custom error page for
// SC_UNAUTHORIZED (HTTP status code 401) then
// send it to the client
if (context.isErrorPageDefined(sc) == true) {
WebContainerRequestState reqState = com.ibm.wsspi.webcontainer.WebContainerRequestState.getInstance(false);
boolean errorPageAlreadySent = false;
if (reqState!=null) {
String spnegoErrorPageAlreadySent = (String)reqState.getAttribute("spnego.error.page");
reqState.removeAttribute("spnego.error.page");
if (spnegoErrorPageAlreadySent != null && spnegoErrorPageAlreadySent.equalsIgnoreCase("true")) {
errorPageAlreadySent = true;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE) == true) {
logger.logp(Level.FINE, CLASS_NAME,"processSecurityPreInvokeException", "skip error page - already created by spego code");
}
}
}
if (!errorPageAlreadySent) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException", "Using user defined error page for HTTP status code "
+ sc);
}
WebAppErrorReport wErrorReport = new WebAppErrorReport(cause);
wErrorReport.setErrorCode(sc);
context.sendError(request, response, wErrorReport);
}
} else {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException",
"Using default security error page for HTTP status code " + sc);
}
// reply.sendError(wResp); comment-out 140967
}
} else {
// Unexpected status code ... not SC_UNAUTHORIZED or SC_FORBIDDEN
if ((logger.isLoggable(Level.FINE) == true)) {
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException", "HTTP status code: " + sc);
}
try {
securityCollaborator.handleException(request, response, cause);
} catch (Exception ex) {
if (requestProcessor != null) {
throw WebAppErrorReport.constructErrorReport(ex, requestProcessor);
} else {
throw WebAppErrorReport.constructErrorReport(ex, name);
}
}
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.exiting(CLASS_NAME, "processSecurityPreInvokeException");
}
return secObject;
} } | public class class_name {
public Object processSecurityPreInvokeException(SecurityViolationException sve, RequestProcessor requestProcessor, HttpServletRequest request,
HttpServletResponse response, WebAppDispatcherContext dispatchContext, WebApp context, String name) throws ServletErrorReport {
Object secObject = null;
// begin pq56177
secObject = sve.getWebSecurityContext();
int sc = sve.getStatusCode(); // access status code directly. Is
// SC_FORBIDDEN the default?
// if (sc==null){
// if
// (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable
// (Level.FINE) == true)
// {
// logger.logp(Level.FINE,
// CLASS_NAME,"processSecurityPreInvokeException",
// "webReply is null, default to 403 status code");
// }
// sc = HttpServletResponse.SC_FORBIDDEN;
// }
Throwable cause = sve.getCause();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.entering(CLASS_NAME, "processSecurityPreInvokeException");
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException",
"SecurityCollaboratorHelper.processPreInvokeException(): WebSecurityException thrown (" + sve.toString()
+ "). HTTP status code: " + sc + "resource : " + name);
} // end if
if (sc == HttpServletResponse.SC_FORBIDDEN) {
// If the user has defined a custom error page for
// SC_FORBIDDEN (HTTP status code 403) then send
// it to the client ...
if (context.isErrorPageDefined(sc) == true) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException", "Using user defined error page for HTTP status code "
+ sc); // depends on control dependency: [if], data = [none]
}
WebAppErrorReport wErrorReport = new WebAppErrorReport(cause);
wErrorReport.setErrorCode(sc); // depends on control dependency: [if], data = [none]
context.sendError(request, response, wErrorReport); // depends on control dependency: [if], data = [none]
} else {
// ... otherwise, use the one provided by the
// SecurityCollaborator
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException",
"Using default security error page for HTTP status code " + sc); // depends on control dependency: [if], data = [none]
}
try {
securityCollaborator.handleException(request, response, cause); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
if (requestProcessor != null) {
throw WebAppErrorReport.constructErrorReport(ex, requestProcessor);
} else {
throw WebAppErrorReport.constructErrorReport(ex, name);
}
} // depends on control dependency: [catch], data = [none]
// reply.sendError(wResp);
} // end if-else
} else if (sc == HttpServletResponse.SC_UNAUTHORIZED) {
// Invoking handleException will add the necessary headers
// to the response ...
try {
securityCollaborator.handleException(request, response, cause);
} catch (Exception ex) {
if (requestProcessor != null) {
throw WebAppErrorReport.constructErrorReport(ex, requestProcessor);
} else {
throw WebAppErrorReport.constructErrorReport(ex, name);
}
}
// ... if the user has defined a custom error page for
// SC_UNAUTHORIZED (HTTP status code 401) then
// send it to the client
if (context.isErrorPageDefined(sc) == true) {
WebContainerRequestState reqState = com.ibm.wsspi.webcontainer.WebContainerRequestState.getInstance(false);
boolean errorPageAlreadySent = false;
if (reqState!=null) {
String spnegoErrorPageAlreadySent = (String)reqState.getAttribute("spnego.error.page");
reqState.removeAttribute("spnego.error.page");
if (spnegoErrorPageAlreadySent != null && spnegoErrorPageAlreadySent.equalsIgnoreCase("true")) {
errorPageAlreadySent = true;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE) == true) {
logger.logp(Level.FINE, CLASS_NAME,"processSecurityPreInvokeException", "skip error page - already created by spego code");
}
}
}
if (!errorPageAlreadySent) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException", "Using user defined error page for HTTP status code "
+ sc);
}
WebAppErrorReport wErrorReport = new WebAppErrorReport(cause);
wErrorReport.setErrorCode(sc);
context.sendError(request, response, wErrorReport);
}
} else {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException",
"Using default security error page for HTTP status code " + sc);
}
// reply.sendError(wResp); comment-out 140967
}
} else {
// Unexpected status code ... not SC_UNAUTHORIZED or SC_FORBIDDEN
if ((logger.isLoggable(Level.FINE) == true)) {
logger.logp(Level.FINE, CLASS_NAME, "processSecurityPreInvokeException", "HTTP status code: " + sc);
}
try {
securityCollaborator.handleException(request, response, cause);
} catch (Exception ex) {
if (requestProcessor != null) {
throw WebAppErrorReport.constructErrorReport(ex, requestProcessor);
} else {
throw WebAppErrorReport.constructErrorReport(ex, name);
}
}
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE) == true) {
logger.exiting(CLASS_NAME, "processSecurityPreInvokeException");
}
return secObject;
} } |
public class class_name {
@Local
public final CompletableFuture<Integer> sendMessage(final Convert convert, final Object message0, final boolean last, final Stream<? extends Serializable> userids) {
Object[] array = userids.toArray();
Serializable[] ss = new Serializable[array.length];
for (int i = 0; i < array.length; i++) {
ss[i] = (Serializable) array[i];
}
return sendMessage(convert, message0, last, ss);
} } | public class class_name {
@Local
public final CompletableFuture<Integer> sendMessage(final Convert convert, final Object message0, final boolean last, final Stream<? extends Serializable> userids) {
Object[] array = userids.toArray();
Serializable[] ss = new Serializable[array.length];
for (int i = 0; i < array.length; i++) {
ss[i] = (Serializable) array[i];
// depends on control dependency: [for], data = [i]
}
return sendMessage(convert, message0, last, ss);
} } |
public class class_name {
protected void parseCommentBindVariable() {
String expr = tokenizer.getToken();
String s = tokenizer.skipToken();
if (s.startsWith("(") && s.endsWith(")")) {
peek().addChild(new ParenBindVariableNode(Math.max(this.position - 2, 0), expr, s, outputBindComment));
} else if (expr.startsWith("#")) {
peek().addChild(new EmbeddedValueNode(Math.max(this.position - 2, 0), expr.substring(1), true, s));
} else if (expr.startsWith("$")) {
peek().addChild(new EmbeddedValueNode(Math.max(this.position - 2, 0), expr.substring(1), s));
} else {
peek().addChild(new BindVariableNode(Math.max(this.position - 2, 0), expr, s, outputBindComment));
}
this.position = this.tokenizer.getPosition();
} } | public class class_name {
protected void parseCommentBindVariable() {
String expr = tokenizer.getToken();
String s = tokenizer.skipToken();
if (s.startsWith("(") && s.endsWith(")")) {
peek().addChild(new ParenBindVariableNode(Math.max(this.position - 2, 0), expr, s, outputBindComment)); // depends on control dependency: [if], data = [none]
} else if (expr.startsWith("#")) {
peek().addChild(new EmbeddedValueNode(Math.max(this.position - 2, 0), expr.substring(1), true, s)); // depends on control dependency: [if], data = [none]
} else if (expr.startsWith("$")) {
peek().addChild(new EmbeddedValueNode(Math.max(this.position - 2, 0), expr.substring(1), s)); // depends on control dependency: [if], data = [none]
} else {
peek().addChild(new BindVariableNode(Math.max(this.position - 2, 0), expr, s, outputBindComment)); // depends on control dependency: [if], data = [none]
}
this.position = this.tokenizer.getPosition();
} } |
public class class_name {
public boolean hasNextShort(int radix) {
setRadix(radix);
boolean result = hasNext(integerPattern());
if (result) { // Cache it
try {
String s = (matcher.group(SIMPLE_GROUP_INDEX) == null) ?
processIntegerToken(hasNextResult) :
hasNextResult;
typeCache = Short.parseShort(s, radix);
} catch (NumberFormatException nfe) {
result = false;
}
}
return result;
} } | public class class_name {
public boolean hasNextShort(int radix) {
setRadix(radix);
boolean result = hasNext(integerPattern());
if (result) { // Cache it
try {
String s = (matcher.group(SIMPLE_GROUP_INDEX) == null) ?
processIntegerToken(hasNextResult) :
hasNextResult;
typeCache = Short.parseShort(s, radix); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
result = false;
} // depends on control dependency: [catch], data = [none]
}
return result;
} } |
public class class_name {
public void addCssResource(final ApplicationResource resource) {
WApplicationModel model = getOrCreateComponentModel();
if (model.cssResources == null) {
model.cssResources = new ArrayList<>();
} else if (model.cssResources.contains(resource)) {
return;
}
model.cssResources.add(resource);
MemoryUtil.checkSize(model.cssResources.size(), this.getClass().getSimpleName());
} } | public class class_name {
public void addCssResource(final ApplicationResource resource) {
WApplicationModel model = getOrCreateComponentModel();
if (model.cssResources == null) {
model.cssResources = new ArrayList<>(); // depends on control dependency: [if], data = [none]
} else if (model.cssResources.contains(resource)) {
return; // depends on control dependency: [if], data = [none]
}
model.cssResources.add(resource);
MemoryUtil.checkSize(model.cssResources.size(), this.getClass().getSimpleName());
} } |
public class class_name {
public static void include(
String contextRelativePath,
RequestDispatcher dispatcher,
HttpServletRequest request,
HttpServletResponse response,
Map<String,?> args
) throws SkipPageException, ServletException, IOException {
// Track original page when first accessed
final String oldOriginal = getOriginalPage(request);
try {
// Set original request path if not already set
if(oldOriginal == null) {
String servletPath = request.getServletPath();
if(logger.isLoggable(Level.FINE)) logger.log(
Level.FINE,
"request={0}, servletPath={1}",
new Object[] {
request,
servletPath
}
);
setOriginalPage(request, servletPath);
}
// Keep old dispatch page to restore
final String oldDispatchPage = getDispatchedPage(request);
try {
if(logger.isLoggable(Level.FINE)) logger.log(
Level.FINE,
"request={0}, oldDispatchPage={1}",
new Object[] {
request,
oldDispatchPage
}
);
// Store as new relative path source
setDispatchedPage(request, contextRelativePath);
// Keep old arguments to restore
final Object oldArgs = request.getAttribute(Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME);
try {
// Set new arguments
request.setAttribute(
Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME,
args==null ? null : AoCollections.optimalUnmodifiableMap(args)
);
// Perform dispatch
Includer.dispatchInclude(dispatcher, request, response);
} finally {
// Restore any previous args
request.setAttribute(Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME, oldArgs);
}
} finally {
setDispatchedPage(request, oldDispatchPage);
}
} finally {
if(oldOriginal == null) {
setOriginalPage(request, null);
}
}
} } | public class class_name {
public static void include(
String contextRelativePath,
RequestDispatcher dispatcher,
HttpServletRequest request,
HttpServletResponse response,
Map<String,?> args
) throws SkipPageException, ServletException, IOException {
// Track original page when first accessed
final String oldOriginal = getOriginalPage(request);
try {
// Set original request path if not already set
if(oldOriginal == null) {
String servletPath = request.getServletPath();
if(logger.isLoggable(Level.FINE)) logger.log(
Level.FINE,
"request={0}, servletPath={1}",
new Object[] {
request,
servletPath
}
);
setOriginalPage(request, servletPath); // depends on control dependency: [if], data = [none]
}
// Keep old dispatch page to restore
final String oldDispatchPage = getDispatchedPage(request);
try {
if(logger.isLoggable(Level.FINE)) logger.log(
Level.FINE,
"request={0}, oldDispatchPage={1}",
new Object[] {
request,
oldDispatchPage
}
);
// Store as new relative path source
setDispatchedPage(request, contextRelativePath); // depends on control dependency: [try], data = [none]
// Keep old arguments to restore
final Object oldArgs = request.getAttribute(Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME);
try {
// Set new arguments
request.setAttribute(
Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME,
args==null ? null : AoCollections.optimalUnmodifiableMap(args)
); // depends on control dependency: [try], data = [none]
// Perform dispatch
Includer.dispatchInclude(dispatcher, request, response); // depends on control dependency: [try], data = [none]
} finally {
// Restore any previous args
request.setAttribute(Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME, oldArgs);
}
} finally {
setDispatchedPage(request, oldDispatchPage);
}
} finally {
if(oldOriginal == null) {
setOriginalPage(request, null); // depends on control dependency: [if], data = [null)]
}
}
} } |
public class class_name {
protected void configureTitle(TitleConfigurable configurable, String objectName) {
Assert.notNull(configurable, "configurable");
Assert.notNull(objectName, "objectName");
String title = loadMessage(objectName + "." + TITLE_KEY);
if (StringUtils.hasText(title)) {
configurable.setTitle(title);
}
} } | public class class_name {
protected void configureTitle(TitleConfigurable configurable, String objectName) {
Assert.notNull(configurable, "configurable");
Assert.notNull(objectName, "objectName");
String title = loadMessage(objectName + "." + TITLE_KEY);
if (StringUtils.hasText(title)) {
configurable.setTitle(title); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private User updateUserStandard(LdapName originalId, User existingUser) {
User savedUser = userRepo.save(existingUser);
if(!originalId.equals(savedUser.getId())) {
// The user has moved - we need to update group references.
LdapName oldMemberDn = toAbsoluteDn(originalId);
LdapName newMemberDn = toAbsoluteDn(savedUser.getId());
Collection<Group> groups = groupRepo.findByMember(oldMemberDn);
updateGroupReferences(groups, oldMemberDn, newMemberDn);
}
return savedUser;
} } | public class class_name {
private User updateUserStandard(LdapName originalId, User existingUser) {
User savedUser = userRepo.save(existingUser);
if(!originalId.equals(savedUser.getId())) {
// The user has moved - we need to update group references.
LdapName oldMemberDn = toAbsoluteDn(originalId);
LdapName newMemberDn = toAbsoluteDn(savedUser.getId());
Collection<Group> groups = groupRepo.findByMember(oldMemberDn);
updateGroupReferences(groups, oldMemberDn, newMemberDn); // depends on control dependency: [if], data = [none]
}
return savedUser;
} } |
public class class_name {
public String getDbWorkConStr() {
if (m_provider.equals(POSTGRESQL_PROVIDER)) {
return getDbProperty(m_databaseKey + ".constr.newDb");
} else {
return getExtProperty(CmsDbPoolV11.KEY_DATABASE_POOL + '.' + getPool() + ".jdbcUrl");
}
} } | public class class_name {
public String getDbWorkConStr() {
if (m_provider.equals(POSTGRESQL_PROVIDER)) {
return getDbProperty(m_databaseKey + ".constr.newDb"); // depends on control dependency: [if], data = [none]
} else {
return getExtProperty(CmsDbPoolV11.KEY_DATABASE_POOL + '.' + getPool() + ".jdbcUrl"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public long calculateStandardDeviationSquaredFemtos() {
long totalFemtos = 0L;
for (AssetClassAllocation a : assetClassAllocationList) {
for (AssetClassAllocation b : assetClassAllocationList) {
if (a == b) {
totalFemtos += a.getQuantifiedStandardDeviationRiskMicros() * b.getQuantifiedStandardDeviationRiskMicros()
* 1000L;
} else {
// Matches twice: once for (A, B) and once for (B, A)
long correlationMillis = a.getAssetClass().getCorrelationMillisMap().get(b.getAssetClass());
totalFemtos += a.getQuantifiedStandardDeviationRiskMicros() * b.getQuantifiedStandardDeviationRiskMicros()
* correlationMillis;
}
}
}
return totalFemtos;
} } | public class class_name {
public long calculateStandardDeviationSquaredFemtos() {
long totalFemtos = 0L;
for (AssetClassAllocation a : assetClassAllocationList) {
for (AssetClassAllocation b : assetClassAllocationList) {
if (a == b) {
totalFemtos += a.getQuantifiedStandardDeviationRiskMicros() * b.getQuantifiedStandardDeviationRiskMicros()
* 1000L; // depends on control dependency: [if], data = [none]
} else {
// Matches twice: once for (A, B) and once for (B, A)
long correlationMillis = a.getAssetClass().getCorrelationMillisMap().get(b.getAssetClass());
totalFemtos += a.getQuantifiedStandardDeviationRiskMicros() * b.getQuantifiedStandardDeviationRiskMicros()
* correlationMillis; // depends on control dependency: [if], data = [none]
}
}
}
return totalFemtos;
} } |
public class class_name {
public void marshall(CrlConfiguration crlConfiguration, ProtocolMarshaller protocolMarshaller) {
if (crlConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(crlConfiguration.getEnabled(), ENABLED_BINDING);
protocolMarshaller.marshall(crlConfiguration.getExpirationInDays(), EXPIRATIONINDAYS_BINDING);
protocolMarshaller.marshall(crlConfiguration.getCustomCname(), CUSTOMCNAME_BINDING);
protocolMarshaller.marshall(crlConfiguration.getS3BucketName(), S3BUCKETNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CrlConfiguration crlConfiguration, ProtocolMarshaller protocolMarshaller) {
if (crlConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(crlConfiguration.getEnabled(), ENABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(crlConfiguration.getExpirationInDays(), EXPIRATIONINDAYS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(crlConfiguration.getCustomCname(), CUSTOMCNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(crlConfiguration.getS3BucketName(), S3BUCKETNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public long getRollingMaxValue(HystrixRollingNumberEvent type) {
long values[] = getValues(type);
if (values.length == 0) {
return 0;
} else {
Arrays.sort(values);
return values[values.length - 1];
}
} } | public class class_name {
public long getRollingMaxValue(HystrixRollingNumberEvent type) {
long values[] = getValues(type);
if (values.length == 0) {
return 0; // depends on control dependency: [if], data = [none]
} else {
Arrays.sort(values); // depends on control dependency: [if], data = [none]
return values[values.length - 1]; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private ImmutableSet<ResultAttribute> initResultAttributesToWriteAsTags(List<String> resultTags) {
ImmutableSet<ResultAttribute> result;
if (resultTags == null) {
result = ImmutableSet.copyOf(ResultAttributes.values());
} else {
result = ResultAttributes.forNames(resultTags);
}
LOG.debug("Result Tags to write set to: {}", result);
return result;
} } | public class class_name {
private ImmutableSet<ResultAttribute> initResultAttributesToWriteAsTags(List<String> resultTags) {
ImmutableSet<ResultAttribute> result;
if (resultTags == null) {
result = ImmutableSet.copyOf(ResultAttributes.values()); // depends on control dependency: [if], data = [none]
} else {
result = ResultAttributes.forNames(resultTags); // depends on control dependency: [if], data = [(resultTags]
}
LOG.debug("Result Tags to write set to: {}", result);
return result;
} } |
public class class_name {
protected VertexType getNextSearchTreeRoot() {
// FIXME: slow linear search, should improve
for (Iterator<VertexType> i = graph.vertexIterator(); i.hasNext();) {
VertexType vertex = i.next();
if (visitMe(vertex)) {
return vertex;
}
}
return null;
} } | public class class_name {
protected VertexType getNextSearchTreeRoot() {
// FIXME: slow linear search, should improve
for (Iterator<VertexType> i = graph.vertexIterator(); i.hasNext();) {
VertexType vertex = i.next();
if (visitMe(vertex)) {
return vertex; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
protected Set<CellElement> getIgnoredCellElementsForColSpan(Band band) {
Set<CellElement> result = new HashSet<CellElement>();
int rows = band.getRowCount();
int cols = band.getColumnCount();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
BandElement element = band.getElementAt(i, j);
if (element == null) {
continue;
}
//int rowSpan = element.getRowSpan();
int colSpan = element.getColSpan();
if (colSpan > 1) {
for (int k = 1; k < colSpan; k++) {
result.add(new CellElement(i, j + k));
}
}
}
}
return result;
} } | public class class_name {
protected Set<CellElement> getIgnoredCellElementsForColSpan(Band band) {
Set<CellElement> result = new HashSet<CellElement>();
int rows = band.getRowCount();
int cols = band.getColumnCount();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
BandElement element = band.getElementAt(i, j);
if (element == null) {
continue;
}
//int rowSpan = element.getRowSpan();
int colSpan = element.getColSpan();
if (colSpan > 1) {
for (int k = 1; k < colSpan; k++) {
result.add(new CellElement(i, j + k)); // depends on control dependency: [for], data = [k]
}
}
}
}
return result;
} } |
public class class_name {
static public <D extends ImageGray<D>>
void intensityE( D derivX , D derivY , GrayF32 intensity )
{
if( derivX instanceof GrayF32) {
GradientToEdgeFeatures.intensityE((GrayF32)derivX,(GrayF32)derivY,intensity);
} else if( derivX instanceof GrayS16) {
GradientToEdgeFeatures.intensityE((GrayS16)derivX,(GrayS16)derivY,intensity);
} else if( derivX instanceof GrayS32) {
GradientToEdgeFeatures.intensityE((GrayS32)derivX,(GrayS32)derivY,intensity);
} else {
throw new IllegalArgumentException("Unknown input type");
}
} } | public class class_name {
static public <D extends ImageGray<D>>
void intensityE( D derivX , D derivY , GrayF32 intensity )
{
if( derivX instanceof GrayF32) {
GradientToEdgeFeatures.intensityE((GrayF32)derivX,(GrayF32)derivY,intensity); // depends on control dependency: [if], data = [none]
} else if( derivX instanceof GrayS16) {
GradientToEdgeFeatures.intensityE((GrayS16)derivX,(GrayS16)derivY,intensity); // depends on control dependency: [if], data = [none]
} else if( derivX instanceof GrayS32) {
GradientToEdgeFeatures.intensityE((GrayS32)derivX,(GrayS32)derivY,intensity); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown input type");
}
} } |
public class class_name {
public void set(long startIndex, long endIndex)
{
if (endIndex <= startIndex) return;
int startWord = (int) (startIndex >> 6);
// since endIndex is one past the end, this is index of the last
// word to be changed.
int endWord = expandingWordNum(endIndex - 1);
long startmask = -1L << startIndex;
long endmask = -1L >>> -endIndex; // 64-(endIndex&0x3f) is the same as -endIndex
// due to wrap
if (startWord == endWord)
{
bits[startWord] |= (startmask & endmask);
return;
}
bits[startWord] |= startmask;
Arrays.fill(bits, startWord + 1, endWord, -1L);
bits[endWord] |= endmask;
} } | public class class_name {
public void set(long startIndex, long endIndex)
{
if (endIndex <= startIndex) return;
int startWord = (int) (startIndex >> 6);
// since endIndex is one past the end, this is index of the last
// word to be changed.
int endWord = expandingWordNum(endIndex - 1);
long startmask = -1L << startIndex;
long endmask = -1L >>> -endIndex; // 64-(endIndex&0x3f) is the same as -endIndex
// due to wrap
if (startWord == endWord)
{
bits[startWord] |= (startmask & endmask); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
bits[startWord] |= startmask;
Arrays.fill(bits, startWord + 1, endWord, -1L);
bits[endWord] |= endmask;
} } |
public class class_name {
public final EObject entryRuleSarlScript() throws RecognitionException {
EObject current = null;
EObject iv_ruleSarlScript = null;
try {
// InternalSARL.g:84:51: (iv_ruleSarlScript= ruleSarlScript EOF )
// InternalSARL.g:85:2: iv_ruleSarlScript= ruleSarlScript EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getSarlScriptRule());
}
pushFollow(FOLLOW_1);
iv_ruleSarlScript=ruleSarlScript();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleSarlScript;
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject entryRuleSarlScript() throws RecognitionException {
EObject current = null;
EObject iv_ruleSarlScript = null;
try {
// InternalSARL.g:84:51: (iv_ruleSarlScript= ruleSarlScript EOF )
// InternalSARL.g:85:2: iv_ruleSarlScript= ruleSarlScript EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getSarlScriptRule()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_1);
iv_ruleSarlScript=ruleSarlScript();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleSarlScript; // depends on control dependency: [if], data = [none]
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
public void marshall(RouteSettings routeSettings, ProtocolMarshaller protocolMarshaller) {
if (routeSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(routeSettings.getDataTraceEnabled(), DATATRACEENABLED_BINDING);
protocolMarshaller.marshall(routeSettings.getDetailedMetricsEnabled(), DETAILEDMETRICSENABLED_BINDING);
protocolMarshaller.marshall(routeSettings.getLoggingLevel(), LOGGINGLEVEL_BINDING);
protocolMarshaller.marshall(routeSettings.getThrottlingBurstLimit(), THROTTLINGBURSTLIMIT_BINDING);
protocolMarshaller.marshall(routeSettings.getThrottlingRateLimit(), THROTTLINGRATELIMIT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RouteSettings routeSettings, ProtocolMarshaller protocolMarshaller) {
if (routeSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(routeSettings.getDataTraceEnabled(), DATATRACEENABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(routeSettings.getDetailedMetricsEnabled(), DETAILEDMETRICSENABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(routeSettings.getLoggingLevel(), LOGGINGLEVEL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(routeSettings.getThrottlingBurstLimit(), THROTTLINGBURSTLIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(routeSettings.getThrottlingRateLimit(), THROTTLINGRATELIMIT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void peanoSort(List<? extends SpatialComparable> objs, int start, int end, double[] mms, int[] dims, int depth, long[] bits, boolean desc) {
final int numdim = (dims != null) ? dims.length : (mms.length >> 1);
final int edim = (dims != null) ? dims[depth] : depth;
// Find the splitting points.
final double min = mms[2 * edim], max = mms[2 * edim + 1];
final double tfirst = (min + min + max) / 3.;
final double tsecond = (min + max + max) / 3.;
// Safeguard against duplicate points:
if(max - tsecond < 1E-10 || tsecond - tfirst < 1E-10 || tfirst - min < 1E-10) {
boolean ok = false;
for(int d = 0; d < numdim; d++) {
int d2 = ((dims != null) ? dims[d] : d) << 1;
if(mms[d2 + 1] - mms[d2] >= 1E-10) {
ok = true;
break;
}
}
if(!ok) {
return;
}
}
final boolean inv = BitsUtil.get(bits, edim) ^ desc;
// Split the data set into three parts
int fsplit, ssplit;
if(!inv) {
fsplit = pivotizeList1D(objs, start, end, edim, tfirst, false);
ssplit = (fsplit < end - 1) ? pivotizeList1D(objs, fsplit, end, edim, tsecond, false) : fsplit;
}
else {
fsplit = pivotizeList1D(objs, start, end, edim, tsecond, true);
ssplit = (fsplit < end - 1) ? pivotizeList1D(objs, fsplit, end, edim, tfirst, true) : fsplit;
}
int nextdim = (depth + 1) % numdim;
// Do we need to update the min/max values?
if(start < fsplit - 1) {
mms[2 * edim] = !inv ? min : tsecond;
mms[2 * edim + 1] = !inv ? tfirst : max;
peanoSort(objs, start, fsplit, mms, dims, nextdim, bits, desc);
}
if(fsplit < ssplit - 1) {
BitsUtil.flipI(bits, edim); // set (all but dim: we also flip "desc")
mms[2 * edim] = tfirst;
mms[2 * edim + 1] = tsecond;
peanoSort(objs, fsplit, ssplit, mms, dims, nextdim, bits, !desc);
BitsUtil.flipI(bits, edim);
}
if(ssplit < end - 1) {
mms[2 * edim] = !inv ? tsecond : min;
mms[2 * edim + 1] = !inv ? max : tfirst;
peanoSort(objs, ssplit, end, mms, dims, nextdim, bits, desc);
}
// Restore ranges
mms[2 * edim] = min;
mms[2 * edim + 1] = max;
} } | public class class_name {
protected void peanoSort(List<? extends SpatialComparable> objs, int start, int end, double[] mms, int[] dims, int depth, long[] bits, boolean desc) {
final int numdim = (dims != null) ? dims.length : (mms.length >> 1);
final int edim = (dims != null) ? dims[depth] : depth;
// Find the splitting points.
final double min = mms[2 * edim], max = mms[2 * edim + 1];
final double tfirst = (min + min + max) / 3.;
final double tsecond = (min + max + max) / 3.;
// Safeguard against duplicate points:
if(max - tsecond < 1E-10 || tsecond - tfirst < 1E-10 || tfirst - min < 1E-10) {
boolean ok = false;
for(int d = 0; d < numdim; d++) {
int d2 = ((dims != null) ? dims[d] : d) << 1;
if(mms[d2 + 1] - mms[d2] >= 1E-10) {
ok = true; // depends on control dependency: [if], data = [none]
break;
}
}
if(!ok) {
return; // depends on control dependency: [if], data = [none]
}
}
final boolean inv = BitsUtil.get(bits, edim) ^ desc;
// Split the data set into three parts
int fsplit, ssplit;
if(!inv) {
fsplit = pivotizeList1D(objs, start, end, edim, tfirst, false); // depends on control dependency: [if], data = [none]
ssplit = (fsplit < end - 1) ? pivotizeList1D(objs, fsplit, end, edim, tsecond, false) : fsplit; // depends on control dependency: [if], data = [none]
}
else {
fsplit = pivotizeList1D(objs, start, end, edim, tsecond, true); // depends on control dependency: [if], data = [none]
ssplit = (fsplit < end - 1) ? pivotizeList1D(objs, fsplit, end, edim, tfirst, true) : fsplit; // depends on control dependency: [if], data = [none]
}
int nextdim = (depth + 1) % numdim;
// Do we need to update the min/max values?
if(start < fsplit - 1) {
mms[2 * edim] = !inv ? min : tsecond; // depends on control dependency: [if], data = [none]
mms[2 * edim + 1] = !inv ? tfirst : max; // depends on control dependency: [if], data = [none]
peanoSort(objs, start, fsplit, mms, dims, nextdim, bits, desc); // depends on control dependency: [if], data = [none]
}
if(fsplit < ssplit - 1) {
BitsUtil.flipI(bits, edim); // set (all but dim: we also flip "desc") // depends on control dependency: [if], data = [none]
mms[2 * edim] = tfirst; // depends on control dependency: [if], data = [none]
mms[2 * edim + 1] = tsecond; // depends on control dependency: [if], data = [none]
peanoSort(objs, fsplit, ssplit, mms, dims, nextdim, bits, !desc); // depends on control dependency: [if], data = [none]
BitsUtil.flipI(bits, edim); // depends on control dependency: [if], data = [none]
}
if(ssplit < end - 1) {
mms[2 * edim] = !inv ? tsecond : min; // depends on control dependency: [if], data = [none]
mms[2 * edim + 1] = !inv ? max : tfirst; // depends on control dependency: [if], data = [none]
peanoSort(objs, ssplit, end, mms, dims, nextdim, bits, desc); // depends on control dependency: [if], data = [none]
}
// Restore ranges
mms[2 * edim] = min;
mms[2 * edim + 1] = max;
} } |
public class class_name {
public Integer getEnd() {
if (mtasPositionType.equals(POSITION_RANGE)
|| mtasPositionType.equals(POSITION_SET)) {
return mtasPositionEnd;
} else if (mtasPositionType.equals(POSITION_SINGLE)) {
return mtasPositionStart;
} else {
return null;
}
} } | public class class_name {
public Integer getEnd() {
if (mtasPositionType.equals(POSITION_RANGE)
|| mtasPositionType.equals(POSITION_SET)) {
return mtasPositionEnd; // depends on control dependency: [if], data = [none]
} else if (mtasPositionType.equals(POSITION_SINGLE)) {
return mtasPositionStart; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static final MemcachedClient create(
String hosts,
Protocol protocol,
String user,
String pass,
String[] authMechanisms) {
MemcachedClient client = null;
try {
ConnectionFactory connectionFactory;
if (isNotNullOrEmpty(user)) {
AuthDescriptor authDescriptor = new AuthDescriptor(
authMechanisms,
new PlainCallbackHandler(user, pass));
connectionFactory = new ConnectionFactoryBuilder()
.setProtocol(protocol)
.setAuthDescriptor(authDescriptor)
.build();
} else {
connectionFactory = new ConnectionFactoryBuilder()
.setProtocol(protocol)
.build();
}
client = new MemcachedClient(connectionFactory, AddrUtil.getAddresses(hosts));
} catch (IOException ex) {
log.error("An error occurred when creating the MemcachedClient.", ex);
throw new PippoRuntimeException(ex);
}
return client;
} } | public class class_name {
public static final MemcachedClient create(
String hosts,
Protocol protocol,
String user,
String pass,
String[] authMechanisms) {
MemcachedClient client = null;
try {
ConnectionFactory connectionFactory;
if (isNotNullOrEmpty(user)) {
AuthDescriptor authDescriptor = new AuthDescriptor(
authMechanisms,
new PlainCallbackHandler(user, pass));
connectionFactory = new ConnectionFactoryBuilder()
.setProtocol(protocol)
.setAuthDescriptor(authDescriptor)
.build(); // depends on control dependency: [if], data = [none]
} else {
connectionFactory = new ConnectionFactoryBuilder()
.setProtocol(protocol)
.build(); // depends on control dependency: [if], data = [none]
}
client = new MemcachedClient(connectionFactory, AddrUtil.getAddresses(hosts)); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
log.error("An error occurred when creating the MemcachedClient.", ex);
throw new PippoRuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
return client;
} } |
public class class_name {
public static JComponent createAdjustEditor ()
{
VGroupLayout layout = new VGroupLayout(
VGroupLayout.NONE, VGroupLayout.STRETCH,
3, VGroupLayout.TOP);
layout.setOffAxisJustification(VGroupLayout.LEFT);
JTabbedPane editor = new EditorPane();
Font font = editor.getFont();
Font smaller = font.deriveFont(font.getSize()-1f);
String library = null;
JPanel lpanel = null;
String pkgname = null;
CollapsiblePanel pkgpanel = null;
int acount = _adjusts.size();
for (int ii = 0; ii < acount; ii++) {
Adjust adjust = _adjusts.get(ii);
// create a new library label if necessary
if (!adjust.getLibrary().equals(library)) {
library = adjust.getLibrary();
pkgname = null;
lpanel = new JPanel(layout);
lpanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
editor.addTab(library, lpanel);
}
// create a new package panel if necessary
if (!adjust.getPackage().equals(pkgname)) {
pkgname = adjust.getPackage();
pkgpanel = new CollapsiblePanel();
JCheckBox pkgcheck = new JCheckBox(pkgname);
pkgcheck.setSelected(true);
pkgpanel.setTrigger(pkgcheck, null, null);
pkgpanel.setTriggerContainer(pkgcheck);
pkgpanel.getContent().setLayout(layout);
pkgpanel.setCollapsed(false);
lpanel.add(pkgpanel);
}
// add an entry for this adjustment
pkgpanel.getContent().add(new JSeparator());
JPanel aeditor = adjust.getEditor();
aeditor.setFont(smaller);
pkgpanel.getContent().add(aeditor);
}
return editor;
} } | public class class_name {
public static JComponent createAdjustEditor ()
{
VGroupLayout layout = new VGroupLayout(
VGroupLayout.NONE, VGroupLayout.STRETCH,
3, VGroupLayout.TOP);
layout.setOffAxisJustification(VGroupLayout.LEFT);
JTabbedPane editor = new EditorPane();
Font font = editor.getFont();
Font smaller = font.deriveFont(font.getSize()-1f);
String library = null;
JPanel lpanel = null;
String pkgname = null;
CollapsiblePanel pkgpanel = null;
int acount = _adjusts.size();
for (int ii = 0; ii < acount; ii++) {
Adjust adjust = _adjusts.get(ii);
// create a new library label if necessary
if (!adjust.getLibrary().equals(library)) {
library = adjust.getLibrary(); // depends on control dependency: [if], data = [none]
pkgname = null; // depends on control dependency: [if], data = [none]
lpanel = new JPanel(layout); // depends on control dependency: [if], data = [none]
lpanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); // depends on control dependency: [if], data = [none]
editor.addTab(library, lpanel); // depends on control dependency: [if], data = [none]
}
// create a new package panel if necessary
if (!adjust.getPackage().equals(pkgname)) {
pkgname = adjust.getPackage(); // depends on control dependency: [if], data = [none]
pkgpanel = new CollapsiblePanel(); // depends on control dependency: [if], data = [none]
JCheckBox pkgcheck = new JCheckBox(pkgname);
pkgcheck.setSelected(true); // depends on control dependency: [if], data = [none]
pkgpanel.setTrigger(pkgcheck, null, null); // depends on control dependency: [if], data = [none]
pkgpanel.setTriggerContainer(pkgcheck); // depends on control dependency: [if], data = [none]
pkgpanel.getContent().setLayout(layout); // depends on control dependency: [if], data = [none]
pkgpanel.setCollapsed(false); // depends on control dependency: [if], data = [none]
lpanel.add(pkgpanel); // depends on control dependency: [if], data = [none]
}
// add an entry for this adjustment
pkgpanel.getContent().add(new JSeparator()); // depends on control dependency: [for], data = [none]
JPanel aeditor = adjust.getEditor();
aeditor.setFont(smaller); // depends on control dependency: [for], data = [none]
pkgpanel.getContent().add(aeditor); // depends on control dependency: [for], data = [none]
}
return editor;
} } |
public class class_name {
@Override
public EClass getIfcReinforcingMesh() {
if (ifcReinforcingMeshEClass == null) {
ifcReinforcingMeshEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(515);
}
return ifcReinforcingMeshEClass;
} } | public class class_name {
@Override
public EClass getIfcReinforcingMesh() {
if (ifcReinforcingMeshEClass == null) {
ifcReinforcingMeshEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(515);
// depends on control dependency: [if], data = [none]
}
return ifcReinforcingMeshEClass;
} } |
public class class_name {
@Nullable
public synchronized List<ProducerContextCallbacks> setIsPrefetchNoCallbacks(boolean isPrefetch) {
if (isPrefetch == mIsPrefetch) {
return null;
}
mIsPrefetch = isPrefetch;
return new ArrayList<>(mCallbacks);
} } | public class class_name {
@Nullable
public synchronized List<ProducerContextCallbacks> setIsPrefetchNoCallbacks(boolean isPrefetch) {
if (isPrefetch == mIsPrefetch) {
return null; // depends on control dependency: [if], data = [none]
}
mIsPrefetch = isPrefetch;
return new ArrayList<>(mCallbacks);
} } |
public class class_name {
public StrBuilder replaceFirst(final char search, final char replace) {
if (search != replace) {
for (int i = 0; i < size; i++) {
if (buffer[i] == search) {
buffer[i] = replace;
break;
}
}
}
return this;
} } | public class class_name {
public StrBuilder replaceFirst(final char search, final char replace) {
if (search != replace) {
for (int i = 0; i < size; i++) {
if (buffer[i] == search) {
buffer[i] = replace; // depends on control dependency: [if], data = [none]
break;
}
}
}
return this;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.