proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/password/IntuitiveHardcodePasswordDetector.java | IntuitiveHardcodePasswordDetector | getInjectionPoint | class IntuitiveHardcodePasswordDetector extends BasicInjectionDetector {
private static final String HARD_CODE_PASSWORD_TYPE = "HARD_CODE_PASSWORD";
/**
* Passwords in various language
* http://www.indifferentlanguages.com/words/password
*
* The keyword is also used to detect variable name... |
assert invoke != null && cpg != null;
String method = invoke.getMethodName(cpg);
String sig = invoke.getSignature(cpg);
if(sig.startsWith("(Ljava/lang/String;)")) {
if(method.startsWith("set")) { // Targeting : x.setPassword("abc123")
String methodLowerCa... | 624 | 237 | 861 | <methods>public void registerVisitor(com.h3xstream.findsecbugs.taintanalysis.TaintFrameAdditionalVisitor) <variables>static com.h3xstream.findsecbugs.injection.ClassMethodSignature OBJECT,private static final com.h3xstream.findsecbugs.injection.SinksLoader SINKS_LOADER,private final Map<com.h3xstream.findsecbugs.inject... |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/password/JschPasswordDetector.java | JschPasswordDetector | getPriorityFromTaintFrame | class JschPasswordDetector extends BasicInjectionDetector {
private static final String HARD_CODE_PASSWORD_TYPE = "HARD_CODE_PASSWORD";
public JschPasswordDetector(BugReporter bugReporter) {
super(bugReporter);
}
@Override
protected int getPriorityFromTaintFrame(TaintFrame fact, int offse... |
Taint stringValue = fact.getStackValue(offset);
if (TaintUtil.isConstantValue(stringValue)) { //Is a constant value
return Priorities.NORMAL_PRIORITY;
} else {
return Priorities.IGNORE_PRIORITY;
}
| 374 | 78 | 452 | <methods>public void registerVisitor(com.h3xstream.findsecbugs.taintanalysis.TaintFrameAdditionalVisitor) <variables>static com.h3xstream.findsecbugs.injection.ClassMethodSignature OBJECT,private static final com.h3xstream.findsecbugs.injection.SinksLoader SINKS_LOADER,private final Map<com.h3xstream.findsecbugs.inject... |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/saml/SamlIgnoreCommentsDetector.java | SamlIgnoreCommentsDetector | sawOpcode | class SamlIgnoreCommentsDetector extends OpcodeStackDetector {
private static final String SAML_IGNORE_COMMENTS = "SAML_IGNORE_COMMENTS";
private static final InvokeMatcherBuilder SET_IGNORE_COMMENTS = invokeInstruction()
.atClass(
"org.opensaml.xml.parse.BasicParserPool",
... |
if (seen == Const.INVOKEVIRTUAL && SET_IGNORE_COMMENTS.matches(this)) {
final OpcodeStack.Item item = stack.getStackItem(0);
/* item has signature of Integer, check "instanceof" added to prevent cast from throwing exceptions */
if (StackUtils.isConstantInteger(item) && (In... | 201 | 169 | 370 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/scala/PlayUnvalidatedRedirectDetector.java | PlayUnvalidatedRedirectDetector | sawOpcode | class PlayUnvalidatedRedirectDetector extends OpcodeStackDetector {
private static final String PLAY_UNVALIDATED_REDIRECT_TYPE = "PLAY_UNVALIDATED_REDIRECT";
private static List<String> REDIRECT_METHODS = Arrays.asList("Redirect","SeeOther","MovedPermanently","TemporaryRedirect");
private BugReporter bu... |
try {
if(seen == Const.INVOKEVIRTUAL && REDIRECT_METHODS.contains(getNameConstantOperand())) {
if("scala/runtime/AbstractFunction0".equals(getClassDescriptor().getXClass().getSuperclassDescriptor().getClassName())) {
bugReporter.reportBug(new BugInstance(this, P... | 170 | 165 | 335 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/scala/ScalaSensitiveDataExposureDetector.java | ScalaSensitiveDataExposureDetector | getPriority | class ScalaSensitiveDataExposureDetector extends BasicInjectionDetector {
private static final String SCALA_SENSITIVE_DATA_EXPOSURE_TYPE = "SCALA_SENSITIVE_DATA_EXPOSURE";
public ScalaSensitiveDataExposureDetector(BugReporter bugReporter) {
super(bugReporter);
loadConfiguredSinks("sensitive-da... |
// If this call doesn't contain any sensitive data - There is no reason to report it.
if (!taint.hasTag(Taint.Tag.SENSITIVE_DATA)) {
return Priorities.IGNORE_PRIORITY;
}
return super.getPriority(taint);
| 166 | 79 | 245 | <methods>public void registerVisitor(com.h3xstream.findsecbugs.taintanalysis.TaintFrameAdditionalVisitor) <variables>static com.h3xstream.findsecbugs.injection.ClassMethodSignature OBJECT,private static final com.h3xstream.findsecbugs.injection.SinksLoader SINKS_LOADER,private final Map<com.h3xstream.findsecbugs.inject... |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/scala/SslDisablerDetector.java | SslDisablerDetector | sawOpcode | class SslDisablerDetector extends OpcodeStackDetector {
private static final String WEAK_TRUST_MANAGER_TYPE = "WEAK_TRUST_MANAGER";
private static final String WEAK_HOSTNAME_VERIFIER_TYPE = "WEAK_HOSTNAME_VERIFIER";
private BugReporter bugReporter;
public SslDisablerDetector(BugReporter bugReporter) ... |
// printOpCode(seen);
// SslDisablerDetector: [0000] getstatic
// SslDisablerDetector: [0003] invokevirtual SecurityBypasser$.destroyAllSSLSecurityForTheEntireVMForever ()V
if(seen == INVOKEVIRTUAL && getClassConstantOperand().endsWith("SecurityBypasser$") && getNameConstantOperand()... | 157 | 519 | 676 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/scala/XssMvcApiDetector.java | XssMvcApiDetector | getPriorityFromTaintFrame | class XssMvcApiDetector extends BasicInjectionDetector {
private static final String SCALA_XSS_MVC_API_TYPE = "SCALA_XSS_MVC_API";
// This variable is compared with a .toLowerCase() variable. Please keep this const lowercase.
private static final String VULNERABLE_CONTENT_TYPE = "text/html";
public X... |
Taint mvcResultTaint = fact.getStackValue(offset);
// The MVC Result object was tainted - This could still be safe if the content-type is a safe one
if (!mvcResultTaint.isSafe()) {
// Get the value of the content-type parameter
Taint parameterTaint = fact.getStackValue(... | 426 | 163 | 589 | <methods>public void registerVisitor(com.h3xstream.findsecbugs.taintanalysis.TaintFrameAdditionalVisitor) <variables>static com.h3xstream.findsecbugs.injection.ClassMethodSignature OBJECT,private static final com.h3xstream.findsecbugs.injection.SinksLoader SINKS_LOADER,private final Map<com.h3xstream.findsecbugs.inject... |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/scala/XssTwirlDetector.java | XssTwirlDetector | getPriority | class XssTwirlDetector extends BasicInjectionDetector {
private static final String SCALA_XSS_TWIRL_TYPE = "SCALA_XSS_TWIRL";
public XssTwirlDetector(BugReporter bugReporter) {
super(bugReporter);
loadConfiguredSinks("xss-scala-twirl.txt", SCALA_XSS_TWIRL_TYPE);
}
@Override
protec... |
if (!taint.isSafe() && taint.hasTag(Taint.Tag.XSS_SAFE)) {
if(FindSecBugsGlobalConfig.getInstance().isReportPotentialXssWrongContext()) {
return Priorities.LOW_PRIORITY;
}
else {
return Priorities.IGNORE_PRIORITY;
}
} else ... | 146 | 201 | 347 | <methods>public void registerVisitor(com.h3xstream.findsecbugs.taintanalysis.TaintFrameAdditionalVisitor) <variables>static com.h3xstream.findsecbugs.injection.ClassMethodSignature OBJECT,private static final com.h3xstream.findsecbugs.injection.SinksLoader SINKS_LOADER,private final Map<com.h3xstream.findsecbugs.inject... |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/serial/DeserializationGadgetDetector.java | DeserializationGadgetDetector | visitClassContext | class DeserializationGadgetDetector implements Detector {
private static final String DESERIALIZATION_GADGET_TYPE = "DESERIALIZATION_GADGET";
private static final List<String> DANGEROUS_APIS = Arrays.asList(
"java/lang/reflect/Method", //
"java/lang/reflect/Constructor", //
... |
JavaClass javaClass = classContext.getJavaClass();
boolean isSerializable = InterfaceUtils.isSubtype(javaClass, "java.io.Serializable");
boolean isInvocationHandler = InterfaceUtils.isSubtype(javaClass, "java.lang.reflect.InvocationHandler");
boolean useDangerousApis = false;
bo... | 632 | 716 | 1,348 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/serial/ObjectDeserializationDetector.java | ObjectDeserializationDetector | analyzeMethod | class ObjectDeserializationDetector implements Detector {
private static final String OBJECT_DESERIALIZATION_TYPE = "OBJECT_DESERIALIZATION";
private BugReporter bugReporter;
private static List<String> OBJECT_INPUTSTREAM_READ_METHODS = Arrays.asList("readObject", //
"readUnshared", "readArr... |
MethodGen methodGen = classContext.getMethodGen(m);
ConstantPoolGen cpg = classContext.getConstantPoolGen();
CFG cfg = classContext.getCFG(m);
if (methodGen == null || methodGen.getInstructionList() == null) {
return; //No instruction .. nothing to do
}
fo... | 381 | 422 | 803 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/serial/UnsafeJacksonDeserializationDetector.java | UnsafeJacksonDeserializationDetector | analyzeField | class UnsafeJacksonDeserializationDetector implements Detector {
private static final String DESERIALIZATION_TYPE = "JACKSON_UNSAFE_DESERIALIZATION";
private BugReporter bugReporter;
public UnsafeJacksonDeserializationDetector(BugReporter bugReporter) {
this.bugReporter = bugReporter;
}
... |
for (AnnotationEntry annotation : field.getAnnotationEntries()) {
if (ANNOTATION_TYPES.contains(annotation.getAnnotationType()) ||
annotation.getAnnotationType().contains("JsonTypeInfo")) {
for (ElementValuePair elementValuePair : annotation.getElementValuePairs... | 762 | 250 | 1,012 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/spring/CorsRegistryCORSDetector.java | CorsRegistryCORSDetector | getStringArray | class CorsRegistryCORSDetector extends OpcodeStackDetector {
private BugReporter bugReporter;
public CorsRegistryCORSDetector(BugReporter bugReporter) {
this.bugReporter = bugReporter;
}
@Override
public void sawOpcode(int seen) {
//printOpCode(seen);
if (seen == Const.IN... |
Integer argumentsNum = (Integer) item.getConstant();
String[] strings = new String[argumentsNum];
for (int i=0; i<argumentsNum; i++) {
int idx=-5-5*i;
int stringIdx=getNextCodeByte(idx);
// System.out.println(stringIdx);
String s=getStringFromIdx(s... | 487 | 137 | 624 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/spring/SignatureParserWithGeneric.java | SignatureParserWithGeneric | getArgumentsClasses | class SignatureParserWithGeneric {
private final List<String> argumentsTypes;
private final String returnType;
public SignatureParserWithGeneric(String signature) {
GenericSignatureParser delegate = new GenericSignatureParser(signature);
List<String> arguments = new ArrayList<>();
... |
List<JavaClass[]> types = new ArrayList<>();
for(String argumentType : argumentsTypes) {
if(argumentType.equals("")) continue;
types.add(typeToJavaClass(argumentType));
}
return types;
| 576 | 64 | 640 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/spring/SpringEntityLeakDetector.java | SpringEntityLeakDetector | visitClassContext | class SpringEntityLeakDetector implements Detector {
private static final String ENTITY_LEAK_TYPE = "ENTITY_LEAK";
private static final String ENTITY_MASS_ASSIGNMENT_TYPE = "ENTITY_MASS_ASSIGNMENT";
private static final List<String> REQUEST_MAPPING_ANNOTATION_TYPES = Arrays.asList(
"Lorg/springframework/web/b... |
JavaClass clazz = classContext.getJavaClass();
Method[] methods = clazz.getMethods();
for (Method m: methods) {
if (hasRequestMapping(m)) { //We only need to analyse method with the annotation @RequestMapping
analyzeMethod(m, classContext);
}
}
| 908 | 82 | 990 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/spring/SpringUnvalidatedRedirectDetector.java | SpringUnvalidatedRedirectDetector | analyzeMethod | class SpringUnvalidatedRedirectDetector implements Detector {
private static final String SPRING_UNVALIDATED_REDIRECT_TYPE = "SPRING_UNVALIDATED_REDIRECT";
private static final List<String> REQUEST_MAPPING_ANNOTATION_TYPES = Arrays.asList(
"Lorg/springframework/web/bind/annotation/RequestMapping;", ... |
JavaClass clazz = classContext.getJavaClass();
ConstantPoolGen cpg = classContext.getConstantPoolGen();
CFG cfg = classContext.getCFG(m);
for (Iterator<Location> i = cfg.locationIterator(); i.hasNext(); ) {
Location loc = i.next();
Instruction inst = loc.getHand... | 511 | 362 | 873 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintClassConfig.java | TaintClassConfig | load | class TaintClassConfig implements TaintTypeConfig {
public static final Taint.State DEFAULT_TAINT_STATE = Taint.State.NULL;
private static final String IMMUTABLE = "#IMMUTABLE";
private Taint.State taintState = DEFAULT_TAINT_STATE;
private boolean immutable;
private String typeSignature;
private... |
if (taintConfig == null) {
throw new NullPointerException("Taint config is null");
}
taintConfig = taintConfig.trim();
if (taintConfig.isEmpty()) {
throw new IOException("No taint class config specified");
}
if (taintConfig.endsWith(IMMUTABLE)) {
... | 1,184 | 165 | 1,349 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintConfigLoader.java | TaintConfigLoader | putFromLine | class TaintConfigLoader {
/**
* Loads the summaries and do what is specified
*
* @param input input stream with configured summaries
* @param receiver specifies the action for each summary when loaded
* @throws IOException if cannot read the stream or the format is bad
*/
public ... |
if (line.startsWith("-")) {
// for comments or removing summary temporarily
return;
}
String[] tuple = line.split("\\:");
if (tuple.length != 2) {
throw new IOException("Line format is not 'type signature:config info': " + line);
}
rec... | 274 | 103 | 377 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintFieldConfig.java | TaintFieldConfig | load | class TaintFieldConfig implements TaintTypeConfig {
public static final Taint.State DEFAULT_TAINT_STATE = Taint.State.NULL;
private Taint.State taintState = DEFAULT_TAINT_STATE;
private String typeSignature;
private static final Pattern typePattern;
private static final Pattern taintConfigPattern;
... |
if (taintConfig == null) {
throw new NullPointerException("Taint config is null");
}
taintConfig = taintConfig.trim();
if (taintConfig.isEmpty()) {
throw new IOException("No taint class config specified");
}
if (!taintConfig.isEmpty()) {
... | 1,101 | 109 | 1,210 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintFrame.java | TaintFrame | toString | class TaintFrame extends Frame<Taint> {
public TaintFrame(int numLocals) {
super(numLocals);
}
public String toString(MethodGen method) {<FILL_FUNCTION_BODY>}
@Override
public String toString() {
return toString(new String[getNumLocals()]);
}
/**
* The toString met... |
String[] variables = new String[method.getLocalVariables().length];
LocalVariableGen[] variablesGen = method.getLocalVariables();
for(int i=0; i<variablesGen.length ;i++) {
variables[i] = variablesGen[i].getName();
}
return toString(variables);
| 572 | 84 | 656 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintMethodConfigWithArgumentsAndLocation.java | TaintMethodConfigWithArgumentsAndLocation | accepts | class TaintMethodConfigWithArgumentsAndLocation extends TaintMethodConfig {
private static final Pattern methodWithStringConstantOrEnumPattern;
private String location;
static {
String javaIdentifierRegex = "\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*";
String classNameRegex = ... |
int pos = config.lastIndexOf('@');
if (pos < 0) {
return false;
}
config = config.substring(0, pos);
return methodWithStringConstantOrEnumPattern.matcher(typeSignature).matches() &&
TaintMethodConfig.configPattern.matcher(config).matches();
| 728 | 86 | 814 | <methods>public void <init>(boolean) ,public void <init>(com.h3xstream.findsecbugs.taintanalysis.TaintMethodConfig) ,public static boolean accepts(java.lang.String, java.lang.String) ,public void addMutableStackIndex(int) ,public static com.h3xstream.findsecbugs.taintanalysis.TaintMethodConfig getDefaultConstructorConf... |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/data/TaintLocation.java | TaintLocation | equals | class TaintLocation {
private final MethodDescriptor methodDescriptor;
private final int position;
/**
* Constructs a location from the specified method and position inside
*
* @param methodDescriptor method of the location
* @param position position in the method
* @throws NullP... |
if (obj == null) {
return false;
}
if (!(obj instanceof TaintLocation)) {
return false;
}
final TaintLocation other = (TaintLocation) obj;
return methodDescriptor.equals(other.methodDescriptor) && position == other.position;
| 365 | 75 | 440 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/data/UnknownSource.java | UnknownSource | hashCode | class UnknownSource {
private UnknownSourceType sourceType;
private int parameterIndex = -1;
private String signatureMethod = "";
private String signatureField = "";
private final Taint.State state;
public UnknownSource(UnknownSourceType sourceType, Taint.State state) {
this.sour... |
int result = sourceType.hashCode();
result = 31 * result + parameterIndex;
result = 31 * result + signatureMethod.hashCode();
result = 31 * result + signatureField.hashCode();
return result;
| 587 | 61 | 648 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/extra/JstlExpressionWhiteLister.java | JstlExpressionWhiteLister | patternsFromStream | class JstlExpressionWhiteLister extends BasicInjectionDetector implements TaintFrameAdditionalVisitor {
private static final String SYSTEM_PROPERTY = "findsecbugs.jstlsafe.customregexfile";
private static final Pattern TAG_FOR_HTML_CONTENT_PATTERN = Pattern.compile("\\$\\{e:forHtmlContent\\([a-zA-Z0-9\\._]+\\... |
final List<Pattern> patterns = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream, UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
if (!"".equals(line.trim())) {
patterns.add(P... | 1,318 | 104 | 1,422 | <methods>public void registerVisitor(com.h3xstream.findsecbugs.taintanalysis.TaintFrameAdditionalVisitor) <variables>static com.h3xstream.findsecbugs.injection.ClassMethodSignature OBJECT,private static final com.h3xstream.findsecbugs.injection.SinksLoader SINKS_LOADER,private final Map<com.h3xstream.findsecbugs.inject... |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/extra/PotentialValueTracker.java | PotentialValueTracker | visitInvoke | class PotentialValueTracker extends BasicInjectionDetector implements TaintFrameAdditionalVisitor {
private static final InvokeMatcherBuilder PROPERTIES_GET_WITH_DEFAULT = invokeInstruction()
.atClass("java/util/Properties")
.atMethod("getProperty")
.withArgs("(Ljava/lang/String... |
if(PROPERTIES_GET_WITH_DEFAULT.matches(invoke,cpg) || OPTIONAL_OR.matches(invoke,cpg) || HASHMAP_GET_WITH_DEFAULT.matches(invoke,cpg)) {
Taint defaultVal = parameters.get(0); //Top of the stack last arguments
if(defaultVal.getConstantValue() != null) {
Taint value = fra... | 469 | 150 | 619 | <methods>public void registerVisitor(com.h3xstream.findsecbugs.taintanalysis.TaintFrameAdditionalVisitor) <variables>static com.h3xstream.findsecbugs.injection.ClassMethodSignature OBJECT,private static final com.h3xstream.findsecbugs.injection.SinksLoader SINKS_LOADER,private final Map<com.h3xstream.findsecbugs.inject... |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/template/FreemarkerDetector.java | FreemarkerDetector | sawOpcode | class FreemarkerDetector extends OpcodeStackDetector {
private static final String FREEMARKER_TYPE = "TEMPLATE_INJECTION_FREEMARKER";
private BugReporter bugReporter;
public FreemarkerDetector(BugReporter bugReporter) {
this.bugReporter = bugReporter;
}
@Override
public void sawOpcod... |
//printOpCode(seen);
// FreemarkerDetector: [0113] invokevirtual freemarker/template/Template.process (Ljava/lang/Object;Ljava/io/Writer;)V
if (seen == Const.INVOKEVIRTUAL && getClassConstantOperand().equals("freemarker/template/Template")
&& getNameConstantOperand().equals("proce... | 127 | 167 | 294 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/template/PebbleDetector.java | PebbleDetector | sawOpcode | class PebbleDetector extends OpcodeStackDetector {
private static final String PEBBLE_TYPE = "TEMPLATE_INJECTION_PEBBLE";
private BugReporter bugReporter;
public PebbleDetector(BugReporter bugReporter) {
this.bugReporter = bugReporter;
}
@Override
public void sawOpcode(int seen) {<FIL... |
if (seen == Const.INVOKEVIRTUAL && getClassConstantOperand().equals("com/mitchellbosecke/pebble/template/PebbleTemplate")
&& getNameConstantOperand().equals("evaluate")) {
bugReporter.reportBug(new BugInstance(this, PEBBLE_TYPE, Priorities.NORMAL_PRIORITY)
.addC... | 118 | 120 | 238 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/template/VelocityDetector.java | VelocityDetector | sawOpcode | class VelocityDetector extends OpcodeStackDetector {
private static final String VELOCITY_TYPE = "TEMPLATE_INJECTION_VELOCITY";
private BugReporter bugReporter;
public VelocityDetector(BugReporter bugReporter) {
this.bugReporter = bugReporter;
}
@Override
public void sawOpcode(int se... |
// printOpCode(seen);
if (seen == Const.INVOKESTATIC && getClassConstantOperand().equals("org/apache/velocity/app/Velocity")
&& getNameConstantOperand().equals("evaluate")) {
OpcodeStack.Item item = stack.getStackItem(0);
if(!StackUtils.isConstantString(item)) {... | 118 | 156 | 274 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/wicket/WicketXssComponentDetector.java | WicketXssComponentDetector | analyzeMethod | class WicketXssComponentDetector implements Detector {
private static final boolean DEBUG = false;
private static final String WIC_XSS = "WICKET_XSS1";
/**
* For simplicity we don't look at the class name. The method args signature is precise enough.
*/
private static final InvokeMatcherBuild... |
//Conditions that needs to fill to identify the vulnerability
boolean escapeModelStringsSetToFalse = false;
boolean escapeModelStringsValueUnknown = false;
Location locationWeakness = null;
ConstantPoolGen cpg = classContext.getConstantPoolGen();
CFG cfg = classContext... | 334 | 531 | 865 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/xml/EnabledExtensionsInApacheXmlRpcDetector.java | EnabledExtensionsInApacheXmlRpcDetector | sawOpcode | class EnabledExtensionsInApacheXmlRpcDetector extends OpcodeStackDetector {
private static final String RPC_ENABLED_EXTENSIONS = "RPC_ENABLED_EXTENSIONS";
private static final InvokeMatcherBuilder ENABLE_EXTENSIONS = invokeInstruction()
.atClass(
"org.apache.xmlrpc.client.XmlRpc... |
if (seen == Const.INVOKEVIRTUAL && ENABLE_EXTENSIONS.matches(this)) {
final OpcodeStack.Item item = stack.getStackItem(0);
/* item has signature of Integer, check "instanceof" added to prevent cast from throwing exceptions */
if ((item.getConstant() == null)
... | 217 | 182 | 399 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/xml/SchemaFactoryDetector.java | SchemaFactoryDetector | sawOpcode | class SchemaFactoryDetector extends OpcodeStackDetector {
private static final String XXE_SCHEMA_FACTORY_TYPE = "XXE_SCHEMA_FACTORY";
private static final String SCHEMA_FACTORY_CLASS_NAME = "javax/xml/validation/SchemaFactory";
private static final String SET_FEATURE_METHOD = "setFeature";
private s... |
if (isNotNewSchemaMethod(opcode)) {
return;
}
final ClassContext classContext = getClassContext();
final CFG cfg;
try {
cfg = classContext.getCFG(getMethod());
} catch (final CFGBuilderException e) {
AnalysisContext.logError("Cannot g... | 946 | 401 | 1,347 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/xml/TransformerFactoryDetector.java | TransformerFactoryDetector | sawOpcode | class TransformerFactoryDetector extends OpcodeStackDetector {
private static final String XXE_DTD_TRANSFORM_FACTORY_TYPE = "XXE_DTD_TRANSFORM_FACTORY";
private static final String XXE_XSLT_TRANSFORM_FACTORY_TYPE = "XXE_XSLT_TRANSFORM_FACTORY";
private static final String PROPERTY_SUPPORT_DTD = "http://ja... |
if (seen != Const.INVOKEVIRTUAL && seen != Const.INVOKEINTERFACE && seen != Const.INVOKESTATIC) {
return;
}
String fullClassName = getClassConstantOperand();
String method = getNameConstantOperand();
//The method call is doing XML parsing (see class javadoc)
... | 282 | 1,171 | 1,453 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/xml/ValidatorDetector.java | ValidatorDetector | sawOpcode | class ValidatorDetector extends OpcodeStackDetector {
private static final String XXE_VALIDATOR_TYPE = "XXE_VALIDATOR";
private static final String VALIDATOR_CLASS_NAME = "javax/xml/validation/Validator";
private static final String SET_FEATURE_METHOD = "setFeature";
private static final String SET_... |
if (isNotValidateMethod(opcode)) {
return;
}
final ClassContext classContext = getClassContext();
final CFG cfg;
try {
cfg = classContext.getCFG(getMethod());
} catch (final CFGBuilderException e) {
AnalysisContext.logError("Cannot ge... | 919 | 396 | 1,315 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/xml/XmlDecoderDetector.java | XmlDecoderDetector | sawOpcode | class XmlDecoderDetector extends OpcodeStackDetector {
private static final String XML_DECODER = "XML_DECODER";
private static final InvokeMatcherBuilder XML_DECODER_CONSTRUCTOR = invokeInstruction().atClass("java/beans/XMLDecoder").atMethod("<init>");
private BugReporter bugReporter;
public XmlDeco... |
if (seen == Const.INVOKESPECIAL && XML_DECODER_CONSTRUCTOR.matches(this)) {
bugReporter.reportBug(new BugInstance(this, XML_DECODER, Priorities.HIGH_PRIORITY) //
.addClass(this).addMethod(this).addSourceLine(this));
}
| 158 | 94 | 252 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/xml/XmlStreamReaderDetector.java | XmlStreamReaderDetector | sawOpcode | class XmlStreamReaderDetector extends OpcodeStackDetector {
private static final String XXE_XMLSTREAMREADER_TYPE = "XXE_XMLSTREAMREADER";;
private static final String PROPERTY_SUPPORT_DTD = "javax.xml.stream.supportDTD";
private static final String PROPERTY_IS_SUPPORTING_EXTERNAL_ENTITIES = "javax.xml.stre... |
if (seen != Const.INVOKEVIRTUAL) {
return;
}
String fullClassName = getClassConstantOperand();
String method = getNameConstantOperand();
//The method call is doing XML parsing (see class javadoc)
if (fullClassName.equals("javax/xml/stream/XMLInputFactory") &... | 195 | 830 | 1,025 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/xpath/XPathInjectionDetector.java | XPathInjectionDetector | getPriority | class XPathInjectionDetector extends BasicInjectionDetector {
public XPathInjectionDetector(BugReporter bugReporter) {
super(bugReporter);
loadConfiguredSinks("xpath-javax.txt", "XPATH_INJECTION");
loadConfiguredSinks("xpath-apache.txt", "XPATH_INJECTION");
// TODO add net.sf.saxon.... |
if (!taint.isSafe() && taint.hasTag(Taint.Tag.XPATH_INJECTION_SAFE)) {
return Priorities.IGNORE_PRIORITY;
} else {
return super.getPriority(taint);
}
| 223 | 71 | 294 | <methods>public void registerVisitor(com.h3xstream.findsecbugs.taintanalysis.TaintFrameAdditionalVisitor) <variables>static com.h3xstream.findsecbugs.injection.ClassMethodSignature OBJECT,private static final com.h3xstream.findsecbugs.injection.SinksLoader SINKS_LOADER,private final Map<com.h3xstream.findsecbugs.inject... |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/xss/XSSRequestWrapperDetector.java | XSSRequestWrapperDetector | visitClassContext | class XSSRequestWrapperDetector implements Detector {
private static final String XSS_REQUEST_WRAPPER_TYPE = "XSS_REQUEST_WRAPPER";
private BugReporter bugReporter;
public XSSRequestWrapperDetector(BugReporter bugReporter) {
this.bugReporter = bugReporter;
}
@Override
public void vis... |
JavaClass javaClass = classContext.getJavaClass();
//The class extends HttpServletRequestWrapper
boolean isRequestWrapper = InterfaceUtils.isSubtype(javaClass, "javax.servlet.http.HttpServletRequestWrapper");
//Not the target of this detector
if (!isRequestWrapper) return;
... | 136 | 184 | 320 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/xss/XssJspDetector.java | XssJspDetector | getPriority | class XssJspDetector extends BasicInjectionDetector {
private static final String XSS_JSP_PRINT_TYPE = "XSS_JSP_PRINT";
@SuppressFBWarnings(value = "MS_MUTABLE_COLLECTION_PKGPROTECT",
justification = "It is intended to be shared with XssServletDetector. Accidental modification of this list is unli... |
if (!taint.isSafe() && taint.hasTag(Taint.Tag.XSS_SAFE)) {
if(FindSecBugsGlobalConfig.getInstance().isReportPotentialXssWrongContext()) {
return Priorities.LOW_PRIORITY;
}
else {
return Priorities.IGNORE_PRIORITY;
}
} else ... | 313 | 201 | 514 | <methods>public void registerVisitor(com.h3xstream.findsecbugs.taintanalysis.TaintFrameAdditionalVisitor) <variables>static com.h3xstream.findsecbugs.injection.ClassMethodSignature OBJECT,private static final com.h3xstream.findsecbugs.injection.SinksLoader SINKS_LOADER,private final Map<com.h3xstream.findsecbugs.inject... |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/xss/XssServletDetector.java | XssServletDetector | getPriority | class XssServletDetector extends BasicInjectionDetector {
private static final String XSS_SERVLET_TYPE = "XSS_SERVLET";
private static final String[] REQUIRED_CLASSES = {
"Ljavax/servlet/http/ServletResponse;",
"Ljavax/servlet/http/ServletResponseWrapper;",
"Ljavax/servlet/http/HttpServ... |
if (!taint.isSafe() && taint.hasTag(Taint.Tag.XSS_SAFE)) {
if(FindSecBugsGlobalConfig.getInstance().isReportPotentialXssWrongContext()) {
return Priorities.LOW_PRIORITY;
} else {
return Priorities.IGNORE_PRIORITY;
}
} else if (!taint.i... | 536 | 199 | 735 | <methods>public void registerVisitor(com.h3xstream.findsecbugs.taintanalysis.TaintFrameAdditionalVisitor) <variables>static com.h3xstream.findsecbugs.injection.ClassMethodSignature OBJECT,private static final com.h3xstream.findsecbugs.injection.SinksLoader SINKS_LOADER,private final Map<com.h3xstream.findsecbugs.inject... |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-samples-deps/src/main/java/javax/ws/rs/core/Response.java | ResponseBuilder | fromStatusCode | class ResponseBuilder {
protected ResponseBuilder() {}
protected static ResponseBuilder newInstance() {
return null;
}
public abstract Response build();
@Override
public abstract ResponseBuilder clone();
public abstract ResponseBuilder status(int ... |
for (Status s : Status.values()) {
if (s.code == statusCode) {
return s;
}
}
return null;
| 970 | 43 | 1,013 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-samples-deps/src/main/java/org/apache/commons/collections4/comparators/TransformingComparator.java | TransformingComparator | hashCode | class TransformingComparator<I, O> implements Comparator<I>, Serializable {
private static final long serialVersionUID = 3456940356043606220L;
private final Comparator<O> decorated;
private final Transformer<? super I, ? extends O> transformer;
public TransformingComparator(Transformer<? super I, ? ext... |
byte total = 17;
int total1 = total * 37 + (this.decorated == null?0:this.decorated.hashCode());
total1 = total1 * 37 + (this.transformer == null?0:this.transformer.hashCode());
return total1;
| 412 | 77 | 489 | <no_super_class> |
find-sec-bugs_find-sec-bugs | find-sec-bugs/findsecbugs-samples-deps/src/main/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java | ClassLoaderObjectInputStream | resolveProxyClass | class ClassLoaderObjectInputStream extends ObjectInputStream {
/**
* The class loader to use.
*/
private final ClassLoader classLoader;
/**
* Constructs a new ClassLoaderObjectInputStream.
*
* @param classLoader the ClassLoader from which classes should be loaded
* @param inp... |
final Class<?>[] interfaceClasses = new Class[interfaces.length];
for (int i = 0; i < interfaces.length; i++) {
interfaceClasses[i] = Class.forName(interfaces[i], false, classLoader);
}
try {
return Proxy.getProxyClass(classLoader, interfaceClasses);
} ca... | 520 | 113 | 633 | <methods>public void <init>(java.io.InputStream) throws java.io.IOException,public int available() throws java.io.IOException,public void close() throws java.io.IOException,public void defaultReadObject() throws java.io.IOException, java.lang.ClassNotFoundException,public final java.io.ObjectInputFilter getObjectInputF... |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/internal/DocxLinkResolver.java | DocxLinkResolver | resolveLink | class DocxLinkResolver implements LinkResolver {
final private String docRelativeURL;
final private String docRootURL;
final private String[] relativeParts;
final private boolean prefixWwwLinks;
public DocxLinkResolver(LinkResolverBasicContext context) {
// can use context for custom settin... |
if (node instanceof Image || node instanceof Link || node instanceof Reference || node instanceof JekyllTag) {
String url = link.getUrl();
if (docRelativeURL.isEmpty() && docRootURL.isEmpty()) {
// resolve url, return one of LinkStatus other than LinkStatus.UNKNOWN
... | 415 | 1,031 | 1,446 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/util/AttributeFormat.java | AttributeFormat | getValidFontItalic | class AttributeFormat {
final public @Nullable String fontFamily;
final public @Nullable String fontSize;
final public @Nullable Boolean fontBold;
final public @Nullable Boolean fontItalic;
final public @Nullable String textColor;
final public @Nullable String fillColor;
public AttributeFor... |
if (s == null) return null;
switch (s) {
case "oblique":
case "italic":
return true;
case "normal":
return false;
default:
// convert to numeric then round up/down to 700/400
if (s.startsW... | 1,453 | 154 | 1,607 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/util/AttributeRunFormatProvider.java | AttributeRunFormatProvider | getRPr | class AttributeRunFormatProvider<T> extends RunFormatProviderBase<T> {
final public AttributeFormat myAttributeFormat;
public AttributeRunFormatProvider(DocxContext<T> docx, String fontFamily, String fontSize, String fontWeight, String fontStyle, String textColor, String fillColor) {
super(docx, null, ... |
RunFormatProvider<T> parent = myParent;
if (parent != null) {
RPr rpr1 = myDocx.getFactory().createRPr();
parent.getRPr(rpr1);
inheritParentStyle(rPr, rpr1);
}
ParaRPr paraRPr = myDocx.getP().getPPr().getRPr();
myAttributeFormat.setFormatRP... | 203 | 137 | 340 | <methods>public void <init>(DocxContext<T>, java.lang.String, boolean, java.lang.String) ,public void close() ,public T getProviderFrame() ,public void getRPr(org.docx4j.wml.RPr) ,public RunFormatProvider<T> getRunParent() ,public org.docx4j.wml.Style getStyle() ,public java.lang.String getStyleId() ,public void open()... |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/util/BlockFormatProviderBase.java | BlockFormatProviderBase | getParaRPr | class BlockFormatProviderBase<T> implements BlockFormatProvider<T> {
protected final DocxContext<T> myDocx;
protected final T myFrame;
protected final BlockFormatProvider<T> myParent;
protected final String myBaseStyleId;
protected int myPCount;
public BlockFormatProviderBase(DocxContext<T> doc... |
BlockFormatProvider<T> parent = getStyleParent();
if (parent != null) {
parent.getParaRPr(rPr);
}
Style style = getStyle();
if (style != null && style.getRPr() != null) {
StyleUtil.apply(myDocx.getHelper().getExplicitRPr(style.getRPr()), rPr);
}
... | 1,092 | 103 | 1,195 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/util/ColorNameMapper.java | ColorNameMapper | colorToString | class ColorNameMapper {
final private static Map<String, Color> colors = new HashMap<>();
static {
colors.put("black", new Color(0x000000));
colors.put("blue", new Color(0x0000FF));
colors.put("cyan", new Color(0x00FFFF));
colors.put("green", new Color(0x008000));
colors.... |
int r = color.getRed();
int g = color.getGreen();
int b = color.getBlue();
return String.format("%02x%02x%02x", r, g, b);
| 1,179 | 59 | 1,238 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/util/FootnoteBlockFormatProvider.java | FootnoteBlockFormatProvider | inheritParentFormat | class FootnoteBlockFormatProvider<T> extends BlockFormatProviderBase<T> {
public FootnoteBlockFormatProvider(DocxContext<T> docx) {
super(docx, docx.getRenderingOptions().FOOTNOTE_STYLE);
}
@Override
protected void inheritParentFormat(PPr pPr, PPr parentPPr) {<FILL_FUNCTION_BODY>}
@Overrid... |
// do not inherit otherwise the formatting for the footnote reference is
// applied to footnote block children
| 130 | 28 | 158 | <methods>public void <init>(DocxContext<T>, java.lang.String) ,public void adjustPPrForFormatting(org.docx4j.wml.PPr) ,public void close() ,public BlockFormatProvider<T> getBlockParent() ,public void getPPr(org.docx4j.wml.PPr) ,public void getParaRPr(org.docx4j.wml.RPr) ,public T getProviderFrame() ,public org.docx4j.w... |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/util/ListItemBlockFormatProvider.java | ListItemBlockFormatProvider | getPPr | class ListItemBlockFormatProvider<T> extends BlockFormatProviderBase<T> {
final private DocxContext<T> myDocx;
final private String mySpacingStyleId;
final private long myIdNum;
final private int myListLevel;
final private Class[] mySkipContextFrameClasses;
public ListItemBlockFormatProvider(Do... |
if (myPCount == 0) {
// Create object for numPr
PPrBase.NumPr numPr = myDocx.getFactory().createPPrBaseNumPr();
pPr.setNumPr(numPr);
// Create object for numId
PPrBase.NumPr.NumId numId = myDocx.getFactory().createPPrBaseNumPrNumId();
num... | 596 | 377 | 973 | <methods>public void <init>(DocxContext<T>, java.lang.String) ,public void adjustPPrForFormatting(org.docx4j.wml.PPr) ,public void close() ,public BlockFormatProvider<T> getBlockParent() ,public void getPPr(org.docx4j.wml.PPr) ,public void getParaRPr(org.docx4j.wml.RPr) ,public T getProviderFrame() ,public org.docx4j.w... |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/util/QuotedFormatProvider.java | QuotedFormatProvider | adjustPPrForFormatting | class QuotedFormatProvider<T> extends BlockFormatProviderBase<T> {
final private BigInteger myBefore;
final private BigInteger myAfter;
public QuotedFormatProvider(DocxContext<T> docx, int level, String styleId) {
super(docx, styleId);
BigInteger left;
BigInteger before;
Bi... |
// // here we need to adjust for inherited left margin
// BigInteger newLeftInd = myDocx.getHelper().safeIndLeft(pPr);
// PPr styledPPr = myDocx.getHelper().getExplicitPPr(pPr);
// if (styledPPr != null && styledPPr.getPBdr() != null && newLeftInd != null && newLeftInd.compareTo(myLeftInd) ... | 420 | 296 | 716 | <methods>public void <init>(DocxContext<T>, java.lang.String) ,public void adjustPPrForFormatting(org.docx4j.wml.PPr) ,public void close() ,public BlockFormatProvider<T> getBlockParent() ,public void getPPr(org.docx4j.wml.PPr) ,public void getParaRPr(org.docx4j.wml.RPr) ,public T getProviderFrame() ,public org.docx4j.w... |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/util/RunFormatProviderBase.java | RunFormatProviderBase | getRPr | class RunFormatProviderBase<T> implements RunFormatProvider<T> {
protected final DocxContext<T> myDocx;
protected final T myFrame;
protected final RunFormatProvider<T> myParent;
protected final String myBaseStyleId;
protected final boolean myNoCharacterStyles;
protected final String myHighlightS... |
// Create object for rStyle
if (!myNoCharacterStyles && myHighlightShadingColor.isEmpty() && myBaseStyleId != null) {
RStyle rstyle = myDocx.getFactory().createRStyle();
rPr.setRStyle(rstyle);
rstyle.setVal(myBaseStyleId);
}
// handle inheritance
... | 596 | 589 | 1,185 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/util/SubscriptRunFormatProvider.java | SubscriptRunFormatProvider | getRPr | class SubscriptRunFormatProvider<T> extends RunFormatProviderBase<T> {
public SubscriptRunFormatProvider(DocxContext<T> docx, boolean noCharacterStyles) {
super(docx, docx.getRenderingOptions().SUBSCRIPT_STYLE, noCharacterStyles, null);
}
@Override
public void getRPr(RPr rPr) {<FILL_FUNCTION_BO... |
super.getRPr(rPr);
//
//// Create object for sz
//HpsMeasure hpsmeasure = docx.getFactory().createHpsMeasure();
//rPr.setSz(hpsmeasure);
//hpsmeasure.setVal(BigInteger.valueOf(19));
//
//// Create object for position
//CTSignedHpsMeasure signedhps... | 109 | 154 | 263 | <methods>public void <init>(DocxContext<T>, java.lang.String, boolean, java.lang.String) ,public void close() ,public T getProviderFrame() ,public void getRPr(org.docx4j.wml.RPr) ,public RunFormatProvider<T> getRunParent() ,public org.docx4j.wml.Style getStyle() ,public java.lang.String getStyleId() ,public void open()... |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/util/SuperscriptRunFormatProvider.java | SuperscriptRunFormatProvider | getRPr | class SuperscriptRunFormatProvider<T> extends RunFormatProviderBase<T> {
public SuperscriptRunFormatProvider(DocxContext<T> docx, boolean noCharacterStyles) {
super(docx, docx.getRenderingOptions().SUPERSCRIPT_STYLE, noCharacterStyles, null);
}
@Override
public void getRPr(RPr rPr) {<FILL_FUNCT... |
super.getRPr(rPr);
//
//// Create object for sz
//HpsMeasure hpsmeasure = docx.getFactory().createHpsMeasure();
//rPr.setSz(hpsmeasure);
//hpsmeasure.setVal(BigInteger.valueOf(19));
//
//// Create object for position
//CTSignedHpsMeasure signedhps... | 113 | 154 | 267 | <methods>public void <init>(DocxContext<T>, java.lang.String, boolean, java.lang.String) ,public void close() ,public T getProviderFrame() ,public void getRPr(org.docx4j.wml.RPr) ,public RunFormatProvider<T> getRunParent() ,public org.docx4j.wml.Style getStyle() ,public java.lang.String getStyleId() ,public void open()... |
vsch_flexmark-java | flexmark-java/flexmark-docx-converter/src/main/java/com/vladsch/flexmark/docx/converter/util/XmlFormatter.java | XmlFormatter | format | class XmlFormatter {
public static String format(String xml) {<FILL_FUNCTION_BODY>}
public static String formatDocumentBody(String xml) {
try {
InputSource src = new InputSource(new StringReader(xml));
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();... |
try {
InputSource src = new InputSource(new StringReader(xml));
Node document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(src).getDocumentElement();
Boolean keepDeclaration = Boolean.valueOf(xml.startsWith("<?xml"));
//May need this: System... | 488 | 270 | 758 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-abbreviation/src/main/java/com/vladsch/flexmark/ext/abbreviation/AbbreviationExtension.java | AbbreviationExtension | extend | class AbbreviationExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension, Parser.ReferenceHoldingExtension, Formatter.FormatterExtension {
/**
* A {@link DataKey} that is used to set the behavior of the abbreviations repository when duplicates are defined. {@link KeepType}
*/
... |
if (htmlRendererBuilder.isRendererType("HTML")) {
htmlRendererBuilder.nodeRendererFactory(new AbbreviationNodeRenderer.Factory());
} else if (htmlRendererBuilder.isRendererType("JIRA")) {
}
| 848 | 59 | 907 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-abbreviation/src/main/java/com/vladsch/flexmark/ext/abbreviation/AbbreviationVisitorExt.java | AbbreviationVisitorExt | VISIT_HANDLERS | class AbbreviationVisitorExt {
public static <V extends AbbreviationVisitor> VisitHandler<?>[] VISIT_HANDLERS(V visitor) {<FILL_FUNCTION_BODY>}
} |
return new VisitHandler<?>[] {
new VisitHandler<>(AbbreviationBlock.class, visitor::visit),
new VisitHandler<>(Abbreviation.class, visitor::visit),
};
| 55 | 54 | 109 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-abbreviation/src/main/java/com/vladsch/flexmark/ext/abbreviation/internal/AbbreviationBlockParser.java | BlockFactory | tryStart | class BlockFactory extends AbstractBlockParserFactory {
BlockFactory(DataHolder options) {
super(options);
}
@Override
public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockParser) {<FILL_FUNCTION_BODY>}
} |
if (state.getIndent() >= 4) {
return BlockStart.none();
}
BasedSequence line = state.getLine();
int nextNonSpace = state.getNextNonSpaceIndex();
BasedSequence trySequence = line.subSequence(nextNonSpace, line.length());
Matcher m... | 70 | 360 | 430 | <methods>public non-sealed void <init>() ,public void addLine(com.vladsch.flexmark.parser.block.ParserState, com.vladsch.flexmark.util.sequence.BasedSequence) ,public boolean breakOutOnDoubleBlankLine() ,public boolean canContain(com.vladsch.flexmark.parser.block.ParserState, com.vladsch.flexmark.parser.block.BlockPars... |
vsch_flexmark-java | flexmark-java/flexmark-ext-abbreviation/src/main/java/com/vladsch/flexmark/ext/abbreviation/internal/AbbreviationNodeFormatter.java | AbbreviationNodeFormatter | modifyTransformedReference | class AbbreviationNodeFormatter extends NodeRepositoryFormatter<AbbreviationRepository, AbbreviationBlock, Abbreviation> {
final public static DataKey<Map<String, String>> ABBREVIATION_TRANSLATION_MAP = new DataKey<>("ABBREVIATION_TRANSLATION_MAP", new HashMap<>()); //
final public static DataKey<Map<String, St... |
if (transformUnderscores && context.isTransformingText()) {
if (transformedText.startsWith("-") && transformedText.endsWith("-")) {
transformedText = "_" + transformedText.substring(1, transformedText.length() - 1) + "_";
} else if (transformedText.startsWith("_") && tra... | 1,004 | 141 | 1,145 | <methods>public void <init>(com.vladsch.flexmark.util.data.DataHolder, DataKey<Map<java.lang.String,java.lang.String>>, DataKey<Map<java.lang.String,java.lang.String>>) ,public @Nullable Set<FormattingPhase> getFormattingPhases() ,public Comparator<com.vladsch.flexmark.ext.abbreviation.AbbreviationBlock> getReferenceCo... |
vsch_flexmark-java | flexmark-java/flexmark-ext-abbreviation/src/main/java/com/vladsch/flexmark/ext/abbreviation/internal/AbbreviationNodePostProcessor.java | AbbreviationNodePostProcessor | process | class AbbreviationNodePostProcessor extends NodePostProcessor {
private Pattern abbreviations = null;
private HashMap<String, BasedSequence> abbreviationMap = null;
private AbbreviationNodePostProcessor(Document document) {
computeAbbreviations(document);
}
private void computeAbbreviation... |
if (abbreviations == null) return;
BasedSequence original = node.getChars();
ReplacedTextMapper textMapper = new ReplacedTextMapper(original);
BasedSequence literal = Escaping.unescape(original, textMapper);
Matcher m = abbreviations.matcher(literal);
int lastEscaped =... | 652 | 534 | 1,186 | <methods>public non-sealed void <init>() ,public final @NotNull Document processDocument(@NotNull Document) <variables> |
vsch_flexmark-java | flexmark-java/flexmark-ext-abbreviation/src/main/java/com/vladsch/flexmark/ext/abbreviation/internal/AbbreviationNodeRenderer.java | AbbreviationNodeRenderer | render | class AbbreviationNodeRenderer implements NodeRenderer {
final private AbbreviationOptions options;
public AbbreviationNodeRenderer(DataHolder options) {
this.options = new AbbreviationOptions(options);
}
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
re... |
String text = node.getChars().unescape();
BasedSequence abbreviation = node.getAbbreviation();
String tag;
if (options.useLinks) {
html.attr("href", "#");
tag = "a";
} else {
tag = "abbr";
}
html.attr("title", abbreviation);
... | 254 | 130 | 384 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-abbreviation/src/main/java/com/vladsch/flexmark/ext/abbreviation/internal/AbbreviationRepository.java | AbbreviationRepository | getReferencedElements | class AbbreviationRepository extends NodeRepository<AbbreviationBlock> {
public AbbreviationRepository(DataHolder options) {
super(AbbreviationExtension.ABBREVIATIONS_KEEP.get(options));
}
@NotNull
@Override
public DataKey<AbbreviationRepository> getDataKey() {
return AbbreviationE... |
HashSet<AbbreviationBlock> references = new HashSet<>();
visitNodes(parent, value -> {
if (value instanceof Abbreviation) {
AbbreviationBlock reference = ((Abbreviation) value).getReferenceNode(AbbreviationRepository.this);
if (reference != null) {
... | 189 | 106 | 295 | <methods>public void <init>(@Nullable KeepType) ,public void clear() ,public boolean containsKey(@NotNull Object) ,public boolean containsValue(java.lang.Object) ,public @NotNull Set<Map.Entry<String,AbbreviationBlock>> entrySet() ,public boolean equals(java.lang.Object) ,public @Nullable AbbreviationBlock get(@NotNull... |
vsch_flexmark-java | flexmark-java/flexmark-ext-admonition/src/main/java/com/vladsch/flexmark/ext/admonition/AdmonitionBlock.java | AdmonitionBlock | setTitleChars | class AdmonitionBlock extends Block implements ParagraphContainer {
private BasedSequence openingMarker = BasedSequence.NULL;
private BasedSequence info = BasedSequence.NULL;
protected BasedSequence titleOpeningMarker = BasedSequence.NULL;
protected BasedSequence title = BasedSequence.NULL;
protecte... |
if (titleChars != null && titleChars != BasedSequence.NULL) {
int titleCharsLength = titleChars.length();
titleOpeningMarker = titleChars.subSequence(0, 1);
title = titleChars.subSequence(1, titleCharsLength - 1);
titleClosingMarker = titleChars.subSequence(title... | 853 | 147 | 1,000 | <methods>public void <init>() ,public void <init>(@NotNull BasedSequence) ,public void <init>(@NotNull BasedSequence, @NotNull List<BasedSequence>) ,public void <init>(@NotNull List<BasedSequence>) ,public void <init>(com.vladsch.flexmark.util.ast.BlockContent) ,public @Nullable Block getParent() <variables> |
vsch_flexmark-java | flexmark-java/flexmark-ext-admonition/src/main/java/com/vladsch/flexmark/ext/admonition/internal/AdmonitionBlockParser.java | BlockFactory | tryStart | class BlockFactory extends AbstractBlockParserFactory {
final private AdmonitionOptions options;
BlockFactory(DataHolder options) {
super(options);
this.options = new AdmonitionOptions(options);
}
@Override
public BlockStart tryStart(ParserState state, M... |
if (state.getIndent() >= 4) {
return BlockStart.none();
}
int nextNonSpace = state.getNextNonSpaceIndex();
BlockParser matched = matchedBlockParser.getBlockParser();
boolean inParagraph = matched.isParagraphParser();
boolean inPar... | 95 | 533 | 628 | <methods>public non-sealed void <init>() ,public void addLine(com.vladsch.flexmark.parser.block.ParserState, com.vladsch.flexmark.util.sequence.BasedSequence) ,public boolean breakOutOnDoubleBlankLine() ,public boolean canContain(com.vladsch.flexmark.parser.block.ParserState, com.vladsch.flexmark.parser.block.BlockPars... |
vsch_flexmark-java | flexmark-java/flexmark-ext-admonition/src/main/java/com/vladsch/flexmark/ext/admonition/internal/AdmonitionNodeFormatter.java | AdmonitionNodeFormatter | render | class AdmonitionNodeFormatter implements NodeFormatter {
final private AdmonitionOptions options;
public AdmonitionNodeFormatter(DataHolder options) {
this.options = new AdmonitionOptions(options);
}
@Nullable
@Override
public Set<Class<?>> getNodeClasses() {
return null;
}... |
markdown.blankLine();
markdown.append(node.getOpeningMarker()).append(' ');
markdown.appendNonTranslating(node.getInfo());
if (node.getTitle().isNotNull()) {
markdown.append(' ').append('"').appendTranslating(node.getTitle()).append('"');
}
markdown.line();
... | 258 | 148 | 406 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-admonition/src/main/java/com/vladsch/flexmark/ext/admonition/internal/AdmonitionNodeRenderer.java | AdmonitionNodeRenderer | renderDocument | class AdmonitionNodeRenderer implements PhasedNodeRenderer {
public static AttributablePart ADMONITION_SVG_OBJECT_PART = new AttributablePart("ADMONITION_SVG_OBJECT_PART");
public static AttributablePart ADMONITION_HEADING_PART = new AttributablePart("ADMONITION_HEADING_PART");
public static AttributablePar... |
if (phase == BODY_TOP) {
// dump out the SVG used by the rest of the nodes
HashSet<String> resolvedQualifiers = new HashSet<>();
Set<String> referencedQualifiers = new AdmonitionCollectingVisitor().collectAndGetQualifiers(document);
for (String qualifier : refe... | 1,180 | 366 | 1,546 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-anchorlink/src/main/java/com/vladsch/flexmark/ext/anchorlink/AnchorLinkExtension.java | AnchorLinkExtension | extend | class AnchorLinkExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension {
final public static DataKey<Boolean> ANCHORLINKS_WRAP_TEXT = new DataKey<>("ANCHORLINKS_WRAP_TEXT", true);
final public static DataKey<String> ANCHORLINKS_TEXT_PREFIX = new DataKey<>("ANCHORLINKS_TEXT_PREFIX", "");... |
if (htmlRendererBuilder.isRendererType("HTML")) {
htmlRendererBuilder.nodeRendererFactory(new AnchorLinkNodeRenderer.Factory());
} else if (htmlRendererBuilder.isRendererType("JIRA")) {
}
| 473 | 59 | 532 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-anchorlink/src/main/java/com/vladsch/flexmark/ext/anchorlink/internal/AnchorLinkNodePostProcessor.java | AnchorLinkNodePostProcessor | process | class AnchorLinkNodePostProcessor extends NodePostProcessor {
final private AnchorLinkOptions options;
public AnchorLinkNodePostProcessor(DataHolder options) {
this.options = new AnchorLinkOptions(options);
}
@Override
public void process(@NotNull NodeTracker state, @NotNull Node node) {<F... |
if (node instanceof Heading) {
Heading heading = (Heading) node;
if (heading.getText().isNotNull()) {
Node anchor = new AnchorLink();
if (!options.wrapText) {
if (heading.getFirstChild() == null) {
anchor.setCh... | 228 | 200 | 428 | <methods>public non-sealed void <init>() ,public final @NotNull Document processDocument(@NotNull Document) <variables> |
vsch_flexmark-java | flexmark-java/flexmark-ext-anchorlink/src/main/java/com/vladsch/flexmark/ext/anchorlink/internal/AnchorLinkNodeRenderer.java | AnchorLinkNodeRenderer | getNodeRenderingHandlers | class AnchorLinkNodeRenderer implements NodeRenderer {
final private AnchorLinkOptions options;
public AnchorLinkNodeRenderer(DataHolder options) {
this.options = new AnchorLinkOptions(options);
}
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {<FILL_FUNCTION_BODY... |
HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
set.add(new NodeRenderingHandler<>(AnchorLink.class, this::render));
return set;
| 495 | 50 | 545 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-aside/src/main/java/com/vladsch/flexmark/ext/aside/AsideExtension.java | AsideExtension | extend | class AsideExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension, Formatter.FormatterExtension {
final public static DataKey<Boolean> EXTEND_TO_BLANK_LINE = new DataKey<>("EXTEND_TO_BLANK_LINE", Parser.BLOCK_QUOTE_EXTEND_TO_BLANK_LINE);
final public static DataKey<Boolean> IGNORE_BLANK... |
if (htmlRendererBuilder.isRendererType("HTML")) {
htmlRendererBuilder.nodeRendererFactory(new AsideNodeRenderer.Factory());
} else if (htmlRendererBuilder.isRendererType("JIRA")) {
}
| 625 | 58 | 683 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-aside/src/main/java/com/vladsch/flexmark/ext/aside/internal/AsideBlockParser.java | AsideBlockParser | isMarker | class AsideBlockParser extends AbstractBlockParser {
final public static char MARKER_CHAR = '|';
final private AsideBlock block = new AsideBlock();
final private boolean allowLeadingSpace;
final private boolean continueToBlankLine;
final private boolean ignoreBlankLine;
final private boolean in... |
CharSequence line = state.getLine();
if ((!inParagraph || interruptsParagraph) && index < line.length() && line.charAt(index) == MARKER_CHAR) {
if ((allowLeadingSpace || state.getIndent() == 0) && (!inParagraphListItem || interruptsItemParagraph)) {
if (inParagraphListItem &... | 1,860 | 165 | 2,025 | <methods>public non-sealed void <init>() ,public void addLine(com.vladsch.flexmark.parser.block.ParserState, com.vladsch.flexmark.util.sequence.BasedSequence) ,public boolean breakOutOnDoubleBlankLine() ,public boolean canContain(com.vladsch.flexmark.parser.block.ParserState, com.vladsch.flexmark.parser.block.BlockPars... |
vsch_flexmark-java | flexmark-java/flexmark-ext-aside/src/main/java/com/vladsch/flexmark/ext/aside/internal/AsideNodeFormatter.java | AsideNodeFormatter | getNodeFormattingHandlers | class AsideNodeFormatter implements NodeFormatter {
public AsideNodeFormatter(DataHolder options) {
}
@Nullable
@Override
public Set<Class<?>> getNodeClasses() {
return null;
}
@Override
public char getBlockQuoteLikePrefixChar() {
return '|';
}
// only regist... |
HashSet<NodeFormattingHandler<?>> set = new HashSet<>();
set.add(new NodeFormattingHandler<>(AsideBlock.class, AsideNodeFormatter.this::render));
return set;
| 243 | 56 | 299 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-aside/src/main/java/com/vladsch/flexmark/ext/aside/internal/AsideNodeRenderer.java | AsideNodeRenderer | getNodeRenderingHandlers | class AsideNodeRenderer implements NodeRenderer {
public AsideNodeRenderer(DataHolder options) {
}
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {<FILL_FUNCTION_BODY>}
private void render(AsideBlock node, NodeRendererContext context, HtmlWriter html) {
html.with... |
HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
set.add(new NodeRenderingHandler<>(AsideBlock.class, this::render));
return set;
| 170 | 50 | 220 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-attributes/src/main/java/com/vladsch/flexmark/ext/attributes/AttributeNode.java | AttributeNode | getAstExtra | class AttributeNode extends Node implements DoNotDecorate {
protected BasedSequence name = BasedSequence.NULL;
protected BasedSequence attributeSeparator = BasedSequence.NULL;
protected BasedSequence openingMarker = BasedSequence.NULL;
protected BasedSequence value = BasedSequence.NULL;
protected Ba... |
segmentSpanChars(out, name, "name");
segmentSpanChars(out, attributeSeparator, "sep");
delimitedSegmentSpanChars(out, openingMarker, value, closingMarker, "value");
if (isImplicitName()) out.append(" isImplicit");
if (isClass()) out.append(" isClass");
if (isId()) out.ap... | 796 | 101 | 897 | <methods>public void <init>() ,public void <init>(@NotNull BasedSequence) ,public void appendChain(@NotNull Node) ,public void appendChild(com.vladsch.flexmark.util.ast.Node) ,public static void astChars(@NotNull StringBuilder, @NotNull CharSequence, @NotNull String) ,public void astExtraChars(@NotNull StringBuilder) ,... |
vsch_flexmark-java | flexmark-java/flexmark-ext-attributes/src/main/java/com/vladsch/flexmark/ext/attributes/AttributesExtension.java | AttributesExtension | parserOptions | class AttributesExtension implements Parser.ParserExtension
, RendererExtension
, HtmlRenderer.HtmlRendererExtension
, Formatter.FormatterExtension
//, Parser.ReferenceHoldingExtension
{
final public static DataKey<NodeAttributeRepository> NODE_ATTRIBUTES = new DataKey<>("NODE_ATTRIB... |
if (options.contains(FENCED_CODE_INFO_ATTRIBUTES) && FENCED_CODE_INFO_ATTRIBUTES.get(options) && !options.contains(FENCED_CODE_ADD_ATTRIBUTES)) {
// change default to pre only, to add to code use attributes after info
options.set(FENCED_CODE_ADD_ATTRIBUTES, FencedCodeAddType.ADD_TO_PRE)... | 1,133 | 113 | 1,246 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-attributes/src/main/java/com/vladsch/flexmark/ext/attributes/AttributesVisitorExt.java | AttributesVisitorExt | VISIT_HANDLERS | class AttributesVisitorExt {
public static <V extends AttributesVisitor> VisitHandler<?>[] VISIT_HANDLERS(V visitor) {<FILL_FUNCTION_BODY>}
} |
return new VisitHandler<?>[] {
new VisitHandler<>(AttributesNode.class, visitor::visit),
new VisitHandler<>(AttributeNode.class, visitor::visit),
};
| 53 | 51 | 104 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-attributes/src/main/java/com/vladsch/flexmark/ext/attributes/internal/AttributesAttributeProvider.java | AttributesAttributeProvider | setAttributes | class AttributesAttributeProvider implements AttributeProvider {
final private NodeAttributeRepository nodeAttributeRepository;
final private AttributesOptions attributeOptions;
public AttributesAttributeProvider(LinkResolverContext context) {
DataHolder options = context.getOptions();
attr... |
// regression bug, issue #372, add option, default to both as before
if (part == CoreNodeRenderer.CODE_CONTENT ? attributeOptions.fencedCodeAddAttributes.addToCode : attributeOptions.fencedCodeAddAttributes.addToPre) {
ArrayList<AttributesNode> nodeAttributesList = nodeAttributeRepository.g... | 290 | 422 | 712 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-attributes/src/main/java/com/vladsch/flexmark/ext/attributes/internal/AttributesFormatOptions.java | AttributesFormatOptions | setIn | class AttributesFormatOptions implements MutableDataSetter {
final public boolean attributesCombineConsecutive;
final public boolean attributesSort;
final public DiscretionaryText attributesSpaces;
final public DiscretionaryText attributeEqualSpace;
final public AttributeValueQuotes attributeValueQu... |
dataHolder.set(AttributesExtension.FORMAT_ATTRIBUTES_COMBINE_CONSECUTIVE, attributesCombineConsecutive);
dataHolder.set(AttributesExtension.FORMAT_ATTRIBUTES_SORT, attributesSort);
dataHolder.set(AttributesExtension.FORMAT_ATTRIBUTES_SPACES, attributesSpaces);
dataHolder.set(AttributesE... | 338 | 189 | 527 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-attributes/src/main/java/com/vladsch/flexmark/ext/attributes/internal/AttributesInlineParserExtension.java | AttributesInlineParserExtension | parse | class AttributesInlineParserExtension implements InlineParserExtension {
final private AttributeParsing parsing;
public AttributesInlineParserExtension(LightInlineParser inlineParser) {
this.parsing = new AttributeParsing(inlineParser.getParsing());
}
@Override
public void finalizeDocument... |
if (inlineParser.peek(1) != '{') {
int index = inlineParser.getIndex();
BasedSequence input = inlineParser.getInput();
Matcher matcher = inlineParser.matcher(parsing.ATTRIBUTES_TAG);
if (matcher != null) {
BasedSequence attributesOpen = input.subS... | 327 | 786 | 1,113 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-attributes/src/main/java/com/vladsch/flexmark/ext/attributes/internal/AttributesNodeRenderer.java | AttributesNodeRenderer | getNodeRenderingHandlers | class AttributesNodeRenderer implements NodeRenderer {
final private AttributesOptions myOptions;
public AttributesNodeRenderer(DataHolder options) {
myOptions = new AttributesOptions(options);
}
// only registered if assignTextAttributes is enabled
@Override
public Set<NodeRenderingH... |
HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
set.add(new NodeRenderingHandler<>(AttributesNode.class, (node, context, html) -> {
}));
set.add(new NodeRenderingHandler<>(TextBase.class, (node, context, html) -> {
if (myOptions.assignTextAttributes) {
... | 150 | 204 | 354 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-attributes/src/main/java/com/vladsch/flexmark/ext/attributes/internal/AttributesOptions.java | AttributesOptions | setIn | class AttributesOptions implements MutableDataSetter {
final public boolean assignTextAttributes;
final public boolean wrapNonAttributeText;
final public boolean useEmptyImplicitAsSpanDelimiter;
final public boolean fencedCodeInfoAttributes;
final public FencedCodeAddType fencedCodeAddAttributes;
... |
dataHolder.set(AttributesExtension.ASSIGN_TEXT_ATTRIBUTES, assignTextAttributes);
dataHolder.set(AttributesExtension.WRAP_NON_ATTRIBUTE_TEXT, wrapNonAttributeText);
dataHolder.set(AttributesExtension.USE_EMPTY_IMPLICIT_AS_SPAN_DELIMITER, useEmptyImplicitAsSpanDelimiter);
dataHolder.set(... | 280 | 159 | 439 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-attributes/src/main/java/com/vladsch/flexmark/ext/attributes/internal/NodeAttributeRepository.java | NodeAttributeRepository | put | class NodeAttributeRepository implements Map<Node, ArrayList<AttributesNode>> {
protected final HashMap<Node, ArrayList<AttributesNode>> nodeAttributesHashMap = new HashMap<>();
public NodeAttributeRepository(DataHolder options) {
}
public DataKey<NodeAttributeRepository> getDataKey() {
return... |
ArrayList<AttributesNode> another = nodeAttributesHashMap.get(key);
if (another == null) {
another = new ArrayList<>();
nodeAttributesHashMap.put(key, another);
}
another.add(value);
return another;
| 562 | 67 | 629 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-definition/src/main/java/com/vladsch/flexmark/ext/definition/DefinitionExtension.java | DefinitionExtension | extend | class DefinitionExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension, Formatter.FormatterExtension {
final public static DataKey<Boolean> COLON_MARKER = new DataKey<>("COLON_MARKER", true);
final public static DataKey<Integer> MARKER_SPACES = new DataKey<>("MARKER_SPACE", 1);
fina... |
if (htmlRendererBuilder.isRendererType("HTML")) {
htmlRendererBuilder.nodeRendererFactory(new DefinitionNodeRenderer.Factory());
} else if (htmlRendererBuilder.isRendererType("JIRA")) {
}
| 494 | 57 | 551 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-definition/src/main/java/com/vladsch/flexmark/ext/definition/DefinitionVisitorExt.java | DefinitionVisitorExt | VISIT_HANDLERS | class DefinitionVisitorExt {
public static <V extends DefinitionVisitor> VisitHandler<?>[] VISIT_HANDLERS(V visitor) {<FILL_FUNCTION_BODY>}
} |
return new VisitHandler<?>[] {
new VisitHandler<>(DefinitionItem.class, visitor::visit),
new VisitHandler<>(DefinitionList.class, visitor::visit),
new VisitHandler<>(DefinitionTerm.class, visitor::visit),
new VisitHandler<>(DefinitionItem.class, v... | 51 | 85 | 136 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-definition/src/main/java/com/vladsch/flexmark/ext/definition/internal/DefinitionItemBlockParser.java | ItemData | parseItemMarker | class ItemData {
final boolean isEmpty;
final boolean isTight;
final int markerIndex;
final int markerColumn;
final int markerIndent;
final int contentOffset;
final BasedSequence itemMarker;
ItemData(boolean isEmpty, boolean isTight, int markerIndex, int ... |
BasedSequence line = state.getLine();
int markerIndex = state.getNextNonSpaceIndex();
int markerColumn = state.getColumn() + state.getIndent();
int markerIndent = state.getIndent();
BasedSequence rest = line.subSequence(markerIndex, line.length());
final char c1 = rest.... | 330 | 430 | 760 | <methods>public non-sealed void <init>() ,public void addLine(com.vladsch.flexmark.parser.block.ParserState, com.vladsch.flexmark.util.sequence.BasedSequence) ,public boolean breakOutOnDoubleBlankLine() ,public boolean canContain(com.vladsch.flexmark.parser.block.ParserState, com.vladsch.flexmark.parser.block.BlockPars... |
vsch_flexmark-java | flexmark-java/flexmark-ext-definition/src/main/java/com/vladsch/flexmark/ext/definition/internal/DefinitionListBlockPreProcessor.java | DefinitionListBlockPreProcessor | preProcess | class DefinitionListBlockPreProcessor implements BlockPreProcessor {
final private DefinitionOptions options;
public DefinitionListBlockPreProcessor(DataHolder options) {
this.options = new DefinitionOptions(options);
}
@Override
public void preProcess(ParserState state, Block block) {<FIL... |
Boolean blankLinesInAST = BLANK_LINES_IN_AST.get(state.getProperties());
if (block instanceof DefinitionList) {
// need to propagate loose/tight
final DefinitionList definitionList = (DefinitionList) block;
boolean isTight = definitionList.isTight();
if ... | 322 | 251 | 573 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-definition/src/main/java/com/vladsch/flexmark/ext/definition/internal/DefinitionListItemBlockPreProcessor.java | DefinitionListItemBlockPreProcessor | preProcess | class DefinitionListItemBlockPreProcessor implements BlockPreProcessor {
final private DefinitionOptions options;
Boolean blankLinesInAst;
public DefinitionListItemBlockPreProcessor(DataHolder options) {
this.options = new DefinitionOptions(options);
blankLinesInAst = BLANK_LINES_IN_AST.get... |
if (block instanceof DefinitionItem) {
// we chop up the previous paragraph into definition terms and add the definition item to the last one
// we add all these to the previous DefinitionList or add a new one if there isn't one
final DefinitionItem definitionItem = (Definit... | 324 | 1,043 | 1,367 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-definition/src/main/java/com/vladsch/flexmark/ext/definition/internal/DefinitionNodeFormatter.java | DefinitionNodeFormatter | render | class DefinitionNodeFormatter implements NodeFormatter {
final private DefinitionFormatOptions options;
final private ListOptions listOptions;
public DefinitionNodeFormatter(DataHolder options) {
this.options = new DefinitionFormatOptions(options);
this.listOptions = ListOptions.get(options... |
BasedSequence openMarkerChars = node.getChars().prefixOf(node.getFirstChild().getChars());
BasedSequence openMarker = openMarkerChars.subSequence(0, 1);
BasedSequence openMarkerSpaces = openMarkerChars.subSequence(1);
if (options.markerSpaces >= 1 && openMarkerSpaces.length() != option... | 385 | 427 | 812 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-definition/src/main/java/com/vladsch/flexmark/ext/definition/internal/DefinitionNodeRenderer.java | DefinitionNodeRenderer | render | class DefinitionNodeRenderer implements NodeRenderer {
final private ListOptions listOptions;
public DefinitionNodeRenderer(DataHolder options) {
this.listOptions = ListOptions.get(options);
}
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
HashSet<NodeRe... |
if (listOptions.isTightListItem(node)) {
html.srcPosWithEOL(node.getChars()).withAttr(CoreNodeRenderer.TIGHT_LIST_ITEM).withCondIndent().tagLine("dd", () -> {
html.text(node.getMarkerSuffix().unescape());
context.renderChildren(node);
});
} else {... | 436 | 172 | 608 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-emoji/src/main/java/com/vladsch/flexmark/ext/emoji/Emoji.java | Emoji | collectText | class Emoji extends Node implements DelimitedNode, TextContainer {
protected BasedSequence openingMarker = BasedSequence.NULL;
protected BasedSequence text = BasedSequence.NULL;
protected BasedSequence closingMarker = BasedSequence.NULL;
@NotNull
@Override
public BasedSequence[] getSegments() {... |
if (BitFieldSet.any(flags, F_FOR_HEADING_ID)) {
if (HtmlRenderer.HEADER_ID_ADD_EMOJI_SHORTCUT.get(getDocument())) {
out.append(text);
}
}
return false;
| 458 | 74 | 532 | <methods>public void <init>() ,public void <init>(@NotNull BasedSequence) ,public void appendChain(@NotNull Node) ,public void appendChild(com.vladsch.flexmark.util.ast.Node) ,public static void astChars(@NotNull StringBuilder, @NotNull CharSequence, @NotNull String) ,public void astExtraChars(@NotNull StringBuilder) ,... |
vsch_flexmark-java | flexmark-java/flexmark-ext-emoji/src/main/java/com/vladsch/flexmark/ext/emoji/EmojiExtension.java | EmojiExtension | extend | class EmojiExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension, Formatter.FormatterExtension {
final public static DataKey<String> ATTR_ALIGN = new DataKey<>("ATTR_ALIGN", "absmiddle");
final public static DataKey<String> ATTR_IMAGE_SIZE = new DataKey<>("ATTR_IMAGE_SIZE", "20");
... |
if (htmlRendererBuilder.isRendererType("HTML")) {
htmlRendererBuilder.nodeRendererFactory(new EmojiNodeRenderer.Factory());
} else if (htmlRendererBuilder.isRendererType("JIRA")) {
htmlRendererBuilder.nodeRendererFactory(new EmojiJiraRenderer.Factory());
}
| 517 | 79 | 596 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-emoji/src/main/java/com/vladsch/flexmark/ext/emoji/internal/EmojiDelimiterProcessor.java | EmojiDelimiterProcessor | getDelimiterUse | class EmojiDelimiterProcessor implements DelimiterProcessor {
@Override
public char getOpeningCharacter() {
return ':';
}
@Override
public char getClosingCharacter() {
return ':';
}
@Override
public int getMinLength() {
return 1;
}
@Override
public... |
if (opener.length() >= 1 && closer.length() >= 1) {
return 1;
} else {
return 1;
}
| 569 | 43 | 612 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-emoji/src/main/java/com/vladsch/flexmark/ext/emoji/internal/EmojiJiraRenderer.java | EmojiJiraRenderer | render | class EmojiJiraRenderer implements NodeRenderer {
final public static HashMap<String, String> shortCutMap = new HashMap<>();
static {
shortCutMap.put("smile", ":)");
shortCutMap.put("frowning", ":(");
shortCutMap.put("stuck_out_tongue", ":P");
shortCutMap.put("grinning", ":D");
... |
Emoji emoji = (Emoji) node;
String shortcut = shortCutMap.get(emoji.getText().toString());
if (shortcut == null) {
// output as text
html.text(":");
context.renderChildren(node);
html.text(":");
} else {
html.raw(shortcut);
... | 527 | 96 | 623 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-emoji/src/main/java/com/vladsch/flexmark/ext/emoji/internal/EmojiNodeFormatter.java | EmojiNodeFormatter | getNodeFormattingHandlers | class EmojiNodeFormatter implements NodeFormatter {
public EmojiNodeFormatter(DataHolder options) {
}
@Nullable
@Override
public Set<Class<?>> getNodeClasses() {
return null;
}
// only registered if assignTextAttributes is enabled
@Nullable
@Override
public Set<NodeFo... |
HashSet<NodeFormattingHandler<?>> set = new HashSet<>();
set.add(new NodeFormattingHandler<>(Emoji.class, EmojiNodeFormatter.this::render));
return set;
| 242 | 57 | 299 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-emoji/src/main/java/com/vladsch/flexmark/ext/emoji/internal/EmojiNodeRenderer.java | EmojiNodeRenderer | render | class EmojiNodeRenderer implements NodeRenderer {
final EmojiOptions myOptions;
public EmojiNodeRenderer(DataHolder options) {
myOptions = new EmojiOptions(options);
}
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
HashSet<NodeRenderingHandler<?>> set = ... |
EmojiResolvedShortcut shortcut = EmojiResolvedShortcut.getEmojiText(node, myOptions.useShortcutType, myOptions.useImageType, myOptions.rootImagePath, myOptions.useUnicodeFileNames);
if (shortcut.emoji == null || shortcut.emojiText == null) {
// output as text
html.text(":");
... | 215 | 323 | 538 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-emoji/src/main/java/com/vladsch/flexmark/ext/emoji/internal/EmojiReference.java | Emoji | getEmojiList | class Emoji {
public final String shortcut;
public String[] aliasShortcuts;
public final String category;
public String subcategory;
public final String emojiCheatSheetFile; // name part of the file no extension
public final String githubFile; // name part of the file no ... |
if (emojiList == null) {
// read it in
emojiList = new ArrayList<>(3000);
final String emojiReference = EMOJI_REFERENCE_TXT;
InputStream stream = EmojiReference.class.getResourceAsStream(emojiReference);
if (stream == null) {
throw n... | 394 | 794 | 1,188 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-emoji/src/main/java/com/vladsch/flexmark/ext/emoji/internal/EmojiResolvedShortcut.java | EmojiResolvedShortcut | getEmojiText | class EmojiResolvedShortcut {
final public EmojiReference.Emoji emoji;
final public String emojiText;
final public boolean isUnicode;
final public String alt;
public EmojiResolvedShortcut(EmojiReference.Emoji emoji, String emojiText, boolean isUnicode, String alt) {
this.emoji = emoji;
... |
EmojiReference.Emoji emoji = EmojiShortcuts.getEmojiFromShortcut(emojiId);
String emojiText = null;
boolean isUnicode = false;
String alt = null;
if (emoji != null) {
String unicodeText = null;
String imageText = null;
if (useImageType.isUnic... | 463 | 523 | 986 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-emoji/src/main/java/com/vladsch/flexmark/ext/emoji/internal/EmojiShortcuts.java | EmojiShortcuts | getUnicodeChars | class EmojiShortcuts {
final public static String gitHubUrlPrefix = EmojiReference.githubUrl;
final private static HashMap<String, Emoji> emojiShortcuts = new HashMap<>();
final private static HashMap<String, Emoji> emojiURIs = new HashMap<>();
final private static HashMap<Emoji, String> emojiUnicodeCh... |
if (emoji == null || emoji.unicodeChars == null) {
return null;
}
String value = emojiUnicodeChars.get(emoji);
if (value == null) {
String[] unicodePoints = emoji.unicodeChars.replace("U+", "").split(" ");
StringBuilder sb = new StringBuilder(16);
... | 714 | 174 | 888 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-enumerated-reference/src/main/java/com/vladsch/flexmark/ext/enumerated/reference/EnumeratedReferenceBase.java | EnumeratedReferenceBase | getReferenceNode | class EnumeratedReferenceBase extends Node implements DelimitedNode, DoNotDecorate, ReferencingNode<EnumeratedReferenceRepository, EnumeratedReferenceBlock> {
protected BasedSequence openingMarker = BasedSequence.NULL;
protected BasedSequence text = BasedSequence.NULL;
protected BasedSequence closingMarker ... |
if (enumeratedReferenceBlock != null || text.isEmpty()) return enumeratedReferenceBlock;
enumeratedReferenceBlock = getEnumeratedReferenceBlock(repository);
return enumeratedReferenceBlock;
| 693 | 50 | 743 | <methods>public void <init>() ,public void <init>(@NotNull BasedSequence) ,public void appendChain(@NotNull Node) ,public void appendChild(com.vladsch.flexmark.util.ast.Node) ,public static void astChars(@NotNull StringBuilder, @NotNull CharSequence, @NotNull String) ,public void astExtraChars(@NotNull StringBuilder) ,... |
vsch_flexmark-java | flexmark-java/flexmark-ext-enumerated-reference/src/main/java/com/vladsch/flexmark/ext/enumerated/reference/EnumeratedReferenceExtension.java | EnumeratedReferenceExtension | transferReferences | class EnumeratedReferenceExtension implements Parser.ParserExtension
, HtmlRenderer.HtmlRendererExtension
, Parser.ReferenceHoldingExtension
, Formatter.FormatterExtension
{
final public static DataKey<KeepType> ENUMERATED_REFERENCES_KEEP = new DataKey<>("ENUMERATED_REFERENCES_KEEP", KeepTyp... |
if (document.contains(ENUMERATED_REFERENCES) && included.contains(ENUMERATED_REFERENCES)) {
return Parser.transferReferences(ENUMERATED_REFERENCES.get(document), ENUMERATED_REFERENCES.get(included), ENUMERATED_REFERENCES_KEEP.get(document) == KeepType.FIRST);
}
return false;
| 702 | 110 | 812 | <no_super_class> |
vsch_flexmark-java | flexmark-java/flexmark-ext-enumerated-reference/src/main/java/com/vladsch/flexmark/ext/enumerated/reference/EnumeratedReferenceRepository.java | EnumeratedReferenceRepository | getType | class EnumeratedReferenceRepository extends NodeRepository<EnumeratedReferenceBlock> {
private ArrayList<EnumeratedReferenceBlock> referencedEnumeratedReferenceBlocks = new ArrayList<>();
public static String getType(String text) {<FILL_FUNCTION_BODY>}
public List<EnumeratedReferenceBlock> getReferencedEn... |
int pos = text.lastIndexOf(':');
if (pos > 0) {
return text.subSequence(0, pos).toString();
} else {
// use empty type
return EnumeratedReferences.EMPTY_TYPE;
}
| 443 | 68 | 511 | <methods>public void <init>(@Nullable KeepType) ,public void clear() ,public boolean containsKey(@NotNull Object) ,public boolean containsValue(java.lang.Object) ,public @NotNull Set<Map.Entry<String,EnumeratedReferenceBlock>> entrySet() ,public boolean equals(java.lang.Object) ,public @Nullable EnumeratedReferenceBloc... |
vsch_flexmark-java | flexmark-java/flexmark-ext-enumerated-reference/src/main/java/com/vladsch/flexmark/ext/enumerated/reference/EnumeratedReferenceVisitorExt.java | EnumeratedReferenceVisitorExt | VISIT_HANDLERS | class EnumeratedReferenceVisitorExt {
public static <V extends EnumeratedReferenceVisitor> VisitHandler<?>[] VISIT_HANDLERS(V visitor) {<FILL_FUNCTION_BODY>}
} |
return new VisitHandler<?>[] {
new VisitHandler<>(EnumeratedReferenceText.class, visitor::visit),
new VisitHandler<>(EnumeratedReferenceLink.class, visitor::visit),
new VisitHandler<>(EnumeratedReferenceBlock.class, visitor::visit),
};
| 57 | 77 | 134 | <no_super_class> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.