id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
50,900
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java
SiftScaleSpace.computeOctaveScales
private void computeOctaveScales() { octaveImages[0] = tempImage0; for (int i = 1; i < numScales+3; i++) { octaveImages[i].reshape(tempImage0.width, tempImage0.height); applyGaussian(octaveImages[i - 1], octaveImages[i], kernelSigmaToK[i-1]); } for (int i = 1; i < numScales+3; i++) { differenceOfGauss...
java
private void computeOctaveScales() { octaveImages[0] = tempImage0; for (int i = 1; i < numScales+3; i++) { octaveImages[i].reshape(tempImage0.width, tempImage0.height); applyGaussian(octaveImages[i - 1], octaveImages[i], kernelSigmaToK[i-1]); } for (int i = 1; i < numScales+3; i++) { differenceOfGauss...
[ "private", "void", "computeOctaveScales", "(", ")", "{", "octaveImages", "[", "0", "]", "=", "tempImage0", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "numScales", "+", "3", ";", "i", "++", ")", "{", "octaveImages", "[", "i", "]", ".", ...
Computes all the scale images in an octave. This includes DoG images.
[ "Computes", "all", "the", "scale", "images", "in", "an", "octave", ".", "This", "includes", "DoG", "images", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java#L217-L228
50,901
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java
SiftScaleSpace.applyGaussian
void applyGaussian(GrayF32 input, GrayF32 output, Kernel1D kernel) { tempBlur.reshape(input.width, input.height); GConvolveImageOps.horizontalNormalized(kernel, input, tempBlur); GConvolveImageOps.verticalNormalized(kernel, tempBlur,output); }
java
void applyGaussian(GrayF32 input, GrayF32 output, Kernel1D kernel) { tempBlur.reshape(input.width, input.height); GConvolveImageOps.horizontalNormalized(kernel, input, tempBlur); GConvolveImageOps.verticalNormalized(kernel, tempBlur,output); }
[ "void", "applyGaussian", "(", "GrayF32", "input", ",", "GrayF32", "output", ",", "Kernel1D", "kernel", ")", "{", "tempBlur", ".", "reshape", "(", "input", ".", "width", ",", "input", ".", "height", ")", ";", "GConvolveImageOps", ".", "horizontalNormalized", ...
Applies the separable kernel to the input image and stores the results in the output image.
[ "Applies", "the", "separable", "kernel", "to", "the", "input", "image", "and", "stores", "the", "results", "in", "the", "output", "image", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java#L241-L245
50,902
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldHelperFunctions.java
TldHelperFunctions.computeOverlap
public double computeOverlap( ImageRectangle a , ImageRectangle b ) { if( !a.intersection(b,work) ) return 0; int areaI = work.area(); int bottom = a.area() + b.area() - areaI; return areaI/ (double)bottom; }
java
public double computeOverlap( ImageRectangle a , ImageRectangle b ) { if( !a.intersection(b,work) ) return 0; int areaI = work.area(); int bottom = a.area() + b.area() - areaI; return areaI/ (double)bottom; }
[ "public", "double", "computeOverlap", "(", "ImageRectangle", "a", ",", "ImageRectangle", "b", ")", "{", "if", "(", "!", "a", ".", "intersection", "(", "b", ",", "work", ")", ")", "return", "0", ";", "int", "areaI", "=", "work", ".", "area", "(", ")",...
Computes the fractional area of intersection between the two regions. @return number from 0 to 1. higher means more intersection
[ "Computes", "the", "fractional", "area", "of", "intersection", "between", "the", "two", "regions", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldHelperFunctions.java#L38-L47
50,903
lessthanoptimal/BoofCV
demonstrations/src/main/java/boofcv/demonstrations/calibration/SubpixelGridTargetDisplay.java
SubpixelGridTargetDisplay.getCenter
public Point2D_F64 getCenter() { Rectangle r = getVisibleRect(); double x = (r.x+r.width/2)/scale; double y = (r.y+r.height/2)/scale; return new Point2D_F64(x,y); }
java
public Point2D_F64 getCenter() { Rectangle r = getVisibleRect(); double x = (r.x+r.width/2)/scale; double y = (r.y+r.height/2)/scale; return new Point2D_F64(x,y); }
[ "public", "Point2D_F64", "getCenter", "(", ")", "{", "Rectangle", "r", "=", "getVisibleRect", "(", ")", ";", "double", "x", "=", "(", "r", ".", "x", "+", "r", ".", "width", "/", "2", ")", "/", "scale", ";", "double", "y", "=", "(", "r", ".", "y...
The center pixel in the current view at a scale of 1
[ "The", "center", "pixel", "in", "the", "current", "view", "at", "a", "scale", "of", "1" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/calibration/SubpixelGridTargetDisplay.java#L86-L93
50,904
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java
GitFlowVersionInfo.isValidVersion
public static boolean isValidVersion(final String version) { return StringUtils.isNotBlank(version) && (ALTERNATE_PATTERN.matcher(version).matches() || STANDARD_PATTERN .matcher(version).matches()); }
java
public static boolean isValidVersion(final String version) { return StringUtils.isNotBlank(version) && (ALTERNATE_PATTERN.matcher(version).matches() || STANDARD_PATTERN .matcher(version).matches()); }
[ "public", "static", "boolean", "isValidVersion", "(", "final", "String", "version", ")", "{", "return", "StringUtils", ".", "isNotBlank", "(", "version", ")", "&&", "(", "ALTERNATE_PATTERN", ".", "matcher", "(", "version", ")", ".", "matches", "(", ")", "||"...
Validates version. @param version Version to validate. @return <code>true</code> when version is valid, <code>false</code> otherwise.
[ "Validates", "version", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java#L55-L59
50,905
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java
GitFlowVersionInfo.featureVersion
public String featureVersion(final String featureName) { String version = toString(); if (featureName != null) { version = getReleaseVersionString() + "-" + featureName + (isSnapshot() ? "-" + Artifact.SNAPSHOT_VERSION : ""); } return version; }
java
public String featureVersion(final String featureName) { String version = toString(); if (featureName != null) { version = getReleaseVersionString() + "-" + featureName + (isSnapshot() ? "-" + Artifact.SNAPSHOT_VERSION : ""); } return version; }
[ "public", "String", "featureVersion", "(", "final", "String", "featureName", ")", "{", "String", "version", "=", "toString", "(", ")", ";", "if", "(", "featureName", "!=", "null", ")", "{", "version", "=", "getReleaseVersionString", "(", ")", "+", "\"-\"", ...
Gets version with appended feature name. @param featureName Feature name to append. @return Version with appended feature name.
[ "Gets", "version", "with", "appended", "feature", "name", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java#L111-L118
50,906
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.initExecutables
private void initExecutables() { if (StringUtils.isBlank(cmdMvn.getExecutable())) { if (StringUtils.isBlank(mvnExecutable)) { mvnExecutable = "mvn"; } cmdMvn.setExecutable(mvnExecutable); } if (StringUtils.isBlank(cmdGit.getExecutable())) { ...
java
private void initExecutables() { if (StringUtils.isBlank(cmdMvn.getExecutable())) { if (StringUtils.isBlank(mvnExecutable)) { mvnExecutable = "mvn"; } cmdMvn.setExecutable(mvnExecutable); } if (StringUtils.isBlank(cmdGit.getExecutable())) { ...
[ "private", "void", "initExecutables", "(", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "cmdMvn", ".", "getExecutable", "(", ")", ")", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "mvnExecutable", ")", ")", "{", "mvnExecutable", "...
Initializes command line executables.
[ "Initializes", "command", "line", "executables", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L180-L193
50,907
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.validateConfiguration
protected void validateConfiguration(String... params) throws MojoFailureException { if (StringUtils.isNotBlank(argLine) && MAVEN_DISALLOWED_PATTERN.matcher(argLine).find()) { throw new MojoFailureException( "The argLine doesn't match allowed pattern."...
java
protected void validateConfiguration(String... params) throws MojoFailureException { if (StringUtils.isNotBlank(argLine) && MAVEN_DISALLOWED_PATTERN.matcher(argLine).find()) { throw new MojoFailureException( "The argLine doesn't match allowed pattern."...
[ "protected", "void", "validateConfiguration", "(", "String", "...", "params", ")", "throws", "MojoFailureException", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "argLine", ")", "&&", "MAVEN_DISALLOWED_PATTERN", ".", "matcher", "(", "argLine", ")", ".", ...
Validates plugin configuration. Throws exception if configuration is not valid. @param params Configuration parameters to validate. @throws MojoFailureException If configuration is not valid.
[ "Validates", "plugin", "configuration", ".", "Throws", "exception", "if", "configuration", "is", "not", "valid", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L204-L220
50,908
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.getCurrentProjectVersion
protected String getCurrentProjectVersion() throws MojoFailureException { final Model model = readModel(mavenSession.getCurrentProject()); if (model.getVersion() == null) { throw new MojoFailureException( "Cannot get current project version. This plugin should be executed...
java
protected String getCurrentProjectVersion() throws MojoFailureException { final Model model = readModel(mavenSession.getCurrentProject()); if (model.getVersion() == null) { throw new MojoFailureException( "Cannot get current project version. This plugin should be executed...
[ "protected", "String", "getCurrentProjectVersion", "(", ")", "throws", "MojoFailureException", "{", "final", "Model", "model", "=", "readModel", "(", "mavenSession", ".", "getCurrentProject", "(", ")", ")", ";", "if", "(", "model", ".", "getVersion", "(", ")", ...
Gets current project version from pom.xml file. @return Current project version. @throws MojoFailureException
[ "Gets", "current", "project", "version", "from", "pom", ".", "xml", "file", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L228-L235
50,909
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.readModel
private Model readModel(MavenProject project) throws MojoFailureException { try { // read pom.xml Model model; FileReader fileReader = new FileReader(project.getFile().getAbsoluteFile()); MavenXpp3Reader mavenReader = new MavenXpp3Reader(); try { ...
java
private Model readModel(MavenProject project) throws MojoFailureException { try { // read pom.xml Model model; FileReader fileReader = new FileReader(project.getFile().getAbsoluteFile()); MavenXpp3Reader mavenReader = new MavenXpp3Reader(); try { ...
[ "private", "Model", "readModel", "(", "MavenProject", "project", ")", "throws", "MojoFailureException", "{", "try", "{", "// read pom.xml", "Model", "model", ";", "FileReader", "fileReader", "=", "new", "FileReader", "(", "project", ".", "getFile", "(", ")", "."...
Reads model from Maven project pom.xml. @param project Maven project @return Maven model @throws MojoFailureException
[ "Reads", "model", "from", "Maven", "project", "pom", ".", "xml", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L245-L262
50,910
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.validBranchName
protected boolean validBranchName(final String branchName) throws MojoFailureException, CommandLineException { CommandResult r = executeGitCommandExitCode("check-ref-format", "--allow-onelevel", branchName); return r.getExitCode() == SUCCESS_EXIT_CODE; }
java
protected boolean validBranchName(final String branchName) throws MojoFailureException, CommandLineException { CommandResult r = executeGitCommandExitCode("check-ref-format", "--allow-onelevel", branchName); return r.getExitCode() == SUCCESS_EXIT_CODE; }
[ "protected", "boolean", "validBranchName", "(", "final", "String", "branchName", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "CommandResult", "r", "=", "executeGitCommandExitCode", "(", "\"check-ref-format\"", ",", "\"--allow-onelevel\"", ",", ...
Checks if branch name is acceptable. @param branchName Branch name to check. @return <code>true</code> when name is valid, <code>false</code> otherwise. @throws MojoFailureException @throws CommandLineException
[ "Checks", "if", "branch", "name", "is", "acceptable", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L330-L335
50,911
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.executeGitHasUncommitted
private boolean executeGitHasUncommitted() throws MojoFailureException, CommandLineException { boolean uncommited = false; // 1 if there were differences and 0 means no differences // git diff --no-ext-diff --ignore-submodules --quiet --exit-code final CommandResult diffCom...
java
private boolean executeGitHasUncommitted() throws MojoFailureException, CommandLineException { boolean uncommited = false; // 1 if there were differences and 0 means no differences // git diff --no-ext-diff --ignore-submodules --quiet --exit-code final CommandResult diffCom...
[ "private", "boolean", "executeGitHasUncommitted", "(", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "boolean", "uncommited", "=", "false", ";", "// 1 if there were differences and 0 means no differences", "// git diff --no-ext-diff --ignore-submodules --qu...
Executes git commands to check for uncommitted changes. @return <code>true</code> when there are uncommitted changes, <code>false</code> otherwise. @throws CommandLineException @throws MojoFailureException
[ "Executes", "git", "commands", "to", "check", "for", "uncommitted", "changes", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L345-L377
50,912
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.initGitFlowConfig
protected void initGitFlowConfig() throws MojoFailureException, CommandLineException { gitSetConfig("gitflow.branch.master", gitFlowConfig.getProductionBranch()); gitSetConfig("gitflow.branch.develop", gitFlowConfig.getDevelopmentBranch()); gitSetConf...
java
protected void initGitFlowConfig() throws MojoFailureException, CommandLineException { gitSetConfig("gitflow.branch.master", gitFlowConfig.getProductionBranch()); gitSetConfig("gitflow.branch.develop", gitFlowConfig.getDevelopmentBranch()); gitSetConf...
[ "protected", "void", "initGitFlowConfig", "(", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "gitSetConfig", "(", "\"gitflow.branch.master\"", ",", "gitFlowConfig", ".", "getProductionBranch", "(", ")", ")", ";", "gitSetConfig", "(", "\"gitflo...
Executes git config commands to set Git Flow configuration. @throws MojoFailureException @throws CommandLineException
[ "Executes", "git", "config", "commands", "to", "set", "Git", "Flow", "configuration", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L385-L404
50,913
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitSetConfig
private void gitSetConfig(final String name, String value) throws MojoFailureException, CommandLineException { if (value == null || value.isEmpty()) { value = "\"\""; } // ignore error exit codes executeGitCommandExitCode("config", name, value); }
java
private void gitSetConfig(final String name, String value) throws MojoFailureException, CommandLineException { if (value == null || value.isEmpty()) { value = "\"\""; } // ignore error exit codes executeGitCommandExitCode("config", name, value); }
[ "private", "void", "gitSetConfig", "(", "final", "String", "name", ",", "String", "value", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "if", "(", "value", "==", "null", "||", "value", ".", "isEmpty", "(", ")", ")", "{", "value", ...
Executes git config command. @param name Option name. @param value Option value. @throws MojoFailureException @throws CommandLineException
[ "Executes", "git", "config", "command", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L416-L424
50,914
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitFindTags
protected String gitFindTags() throws MojoFailureException, CommandLineException { String tags = executeGitCommandReturn("for-each-ref", "--sort=*authordate", "--format=\"%(refname:short)\"", "refs/tags/"); // https://github.com/aleksandr-m/gitflow-maven-plugin/issues/3 tags = re...
java
protected String gitFindTags() throws MojoFailureException, CommandLineException { String tags = executeGitCommandReturn("for-each-ref", "--sort=*authordate", "--format=\"%(refname:short)\"", "refs/tags/"); // https://github.com/aleksandr-m/gitflow-maven-plugin/issues/3 tags = re...
[ "protected", "String", "gitFindTags", "(", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "String", "tags", "=", "executeGitCommandReturn", "(", "\"for-each-ref\"", ",", "\"--sort=*authordate\"", ",", "\"--format=\\\"%(refname:short)\\\"\"", ",", "...
Executes git for-each-ref to get all tags. @return Git tags. @throws MojoFailureException @throws CommandLineException
[ "Executes", "git", "for", "-", "each", "-", "ref", "to", "get", "all", "tags", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L471-L477
50,915
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitFindLastTag
protected String gitFindLastTag() throws MojoFailureException, CommandLineException { String tag = executeGitCommandReturn("for-each-ref", "--sort=-*authordate", "--count=1", "--format=\"%(refname:short)\"", "refs/tags/"); // https://github.com/aleksandr-m/gitflow-maven-plugin/issues/3 ...
java
protected String gitFindLastTag() throws MojoFailureException, CommandLineException { String tag = executeGitCommandReturn("for-each-ref", "--sort=-*authordate", "--count=1", "--format=\"%(refname:short)\"", "refs/tags/"); // https://github.com/aleksandr-m/gitflow-maven-plugin/issues/3 ...
[ "protected", "String", "gitFindLastTag", "(", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "String", "tag", "=", "executeGitCommandReturn", "(", "\"for-each-ref\"", ",", "\"--sort=-*authordate\"", ",", "\"--count=1\"", ",", "\"--format=\\\"%(refn...
Executes git for-each-ref to get the last tag. @return Last tag. @throws MojoFailureException @throws CommandLineException
[ "Executes", "git", "for", "-", "each", "-", "ref", "to", "get", "the", "last", "tag", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L486-L493
50,916
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.removeQuotes
private String removeQuotes(String str) { if (str != null && !str.isEmpty()) { str = str.replaceAll("\"", ""); } return str; }
java
private String removeQuotes(String str) { if (str != null && !str.isEmpty()) { str = str.replaceAll("\"", ""); } return str; }
[ "private", "String", "removeQuotes", "(", "String", "str", ")", "{", "if", "(", "str", "!=", "null", "&&", "!", "str", ".", "isEmpty", "(", ")", ")", "{", "str", "=", "str", ".", "replaceAll", "(", "\"\\\"\"", ",", "\"\"", ")", ";", "}", "return", ...
Removes double quotes from the string. @param str String to remove quotes from. @return String without quotes.
[ "Removes", "double", "quotes", "from", "the", "string", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L502-L507
50,917
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitCheckBranchExists
protected boolean gitCheckBranchExists(final String branchName) throws MojoFailureException, CommandLineException { CommandResult commandResult = executeGitCommandExitCode("show-ref", "--verify", "--quiet", "refs/heads/" + branchName); return commandResult.getExitCode() == SU...
java
protected boolean gitCheckBranchExists(final String branchName) throws MojoFailureException, CommandLineException { CommandResult commandResult = executeGitCommandExitCode("show-ref", "--verify", "--quiet", "refs/heads/" + branchName); return commandResult.getExitCode() == SU...
[ "protected", "boolean", "gitCheckBranchExists", "(", "final", "String", "branchName", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "CommandResult", "commandResult", "=", "executeGitCommandExitCode", "(", "\"show-ref\"", ",", "\"--verify\"", ",", ...
Checks if local branch with given name exists. @param branchName Name of the branch to check. @return <code>true</code> if local branch exists, <code>false</code> otherwise. @throws MojoFailureException @throws CommandLineException
[ "Checks", "if", "local", "branch", "with", "given", "name", "exists", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L519-L524
50,918
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitCheckTagExists
protected boolean gitCheckTagExists(final String tagName) throws MojoFailureException, CommandLineException { CommandResult commandResult = executeGitCommandExitCode("show-ref", "--verify", "--quiet", "refs/tags/" + tagName); return commandResult.getExitCode() == SUCCESS_EXIT_CODE; }
java
protected boolean gitCheckTagExists(final String tagName) throws MojoFailureException, CommandLineException { CommandResult commandResult = executeGitCommandExitCode("show-ref", "--verify", "--quiet", "refs/tags/" + tagName); return commandResult.getExitCode() == SUCCESS_EXIT_CODE; }
[ "protected", "boolean", "gitCheckTagExists", "(", "final", "String", "tagName", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "CommandResult", "commandResult", "=", "executeGitCommandExitCode", "(", "\"show-ref\"", ",", "\"--verify\"", ",", "\"-...
Checks if local tag with given name exists. @param tagName Name of the tag to check. @return <code>true</code> if local tag exists, <code>false</code> otherwise. @throws MojoFailureException @throws CommandLineException
[ "Checks", "if", "local", "tag", "with", "given", "name", "exists", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L535-L539
50,919
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitCheckout
protected void gitCheckout(final String branchName) throws MojoFailureException, CommandLineException { getLog().info("Checking out '" + branchName + "' branch."); executeGitCommand("checkout", branchName); }
java
protected void gitCheckout(final String branchName) throws MojoFailureException, CommandLineException { getLog().info("Checking out '" + branchName + "' branch."); executeGitCommand("checkout", branchName); }
[ "protected", "void", "gitCheckout", "(", "final", "String", "branchName", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "getLog", "(", ")", ".", "info", "(", "\"Checking out '\"", "+", "branchName", "+", "\"' branch.\"", ")", ";", "execu...
Executes git checkout. @param branchName Branch name to checkout. @throws MojoFailureException @throws CommandLineException
[ "Executes", "git", "checkout", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L549-L554
50,920
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitCreateAndCheckout
protected void gitCreateAndCheckout(final String newBranchName, final String fromBranchName) throws MojoFailureException, CommandLineException { getLog().info( "Creating a new branch '" + newBranchName + "' from '" + fromBranchName + "' and checkin...
java
protected void gitCreateAndCheckout(final String newBranchName, final String fromBranchName) throws MojoFailureException, CommandLineException { getLog().info( "Creating a new branch '" + newBranchName + "' from '" + fromBranchName + "' and checkin...
[ "protected", "void", "gitCreateAndCheckout", "(", "final", "String", "newBranchName", ",", "final", "String", "fromBranchName", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "getLog", "(", ")", ".", "info", "(", "\"Creating a new branch '\"", ...
Executes git checkout -b. @param newBranchName Create branch with this name. @param fromBranchName Create branch from this branch. @throws MojoFailureException @throws CommandLineException
[ "Executes", "git", "checkout", "-", "b", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L566-L574
50,921
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.replaceProperties
private String replaceProperties(String message, Map<String, String> map) { if (map != null) { for (Entry<String, String> entr : map.entrySet()) { message = StringUtils.replace(message, "@{" + entr.getKey() + "}", entr.getValue()); } } return message; ...
java
private String replaceProperties(String message, Map<String, String> map) { if (map != null) { for (Entry<String, String> entr : map.entrySet()) { message = StringUtils.replace(message, "@{" + entr.getKey() + "}", entr.getValue()); } } return message; ...
[ "private", "String", "replaceProperties", "(", "String", "message", ",", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "if", "(", "map", "!=", "null", ")", "{", "for", "(", "Entry", "<", "String", ",", "String", ">", "entr", ":", "map", ...
Replaces properties in message. @param message @param map Key is a string to replace wrapped in <code>@{...}</code>. Value is a string to replace with. @return
[ "Replaces", "properties", "in", "message", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L604-L611
50,922
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitBranchDelete
protected void gitBranchDelete(final String branchName) throws MojoFailureException, CommandLineException { getLog().info("Deleting '" + branchName + "' branch."); executeGitCommand("branch", "-d", branchName); }
java
protected void gitBranchDelete(final String branchName) throws MojoFailureException, CommandLineException { getLog().info("Deleting '" + branchName + "' branch."); executeGitCommand("branch", "-d", branchName); }
[ "protected", "void", "gitBranchDelete", "(", "final", "String", "branchName", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "getLog", "(", ")", ".", "info", "(", "\"Deleting '\"", "+", "branchName", "+", "\"' branch.\"", ")", ";", "execu...
Executes git branch -d. @param branchName Branch name to delete. @throws MojoFailureException @throws CommandLineException
[ "Executes", "git", "branch", "-", "d", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L762-L767
50,923
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitBranchDeleteForce
protected void gitBranchDeleteForce(final String branchName) throws MojoFailureException, CommandLineException { getLog().info("Deleting (-D) '" + branchName + "' branch."); executeGitCommand("branch", "-D", branchName); }
java
protected void gitBranchDeleteForce(final String branchName) throws MojoFailureException, CommandLineException { getLog().info("Deleting (-D) '" + branchName + "' branch."); executeGitCommand("branch", "-D", branchName); }
[ "protected", "void", "gitBranchDeleteForce", "(", "final", "String", "branchName", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "getLog", "(", ")", ".", "info", "(", "\"Deleting (-D) '\"", "+", "branchName", "+", "\"' branch.\"", ")", ";"...
Executes git branch -D. @param branchName Branch name to delete. @throws MojoFailureException @throws CommandLineException
[ "Executes", "git", "branch", "-", "D", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L777-L782
50,924
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitFetchRemoteAndCreate
protected void gitFetchRemoteAndCreate(final String branchName) throws MojoFailureException, CommandLineException { if (!gitCheckBranchExists(branchName)) { getLog().info( "Local branch '" + branchName + "' doesn...
java
protected void gitFetchRemoteAndCreate(final String branchName) throws MojoFailureException, CommandLineException { if (!gitCheckBranchExists(branchName)) { getLog().info( "Local branch '" + branchName + "' doesn...
[ "protected", "void", "gitFetchRemoteAndCreate", "(", "final", "String", "branchName", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "if", "(", "!", "gitCheckBranchExists", "(", "branchName", ")", ")", "{", "getLog", "(", ")", ".", "info"...
Fetches and checkouts from remote if local branch doesn't exist. @param branchName Branch name to check. @throws MojoFailureException @throws CommandLineException
[ "Fetches", "and", "checkouts", "from", "remote", "if", "local", "branch", "doesn", "t", "exist", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L792-L804
50,925
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitFetchRemoteAndCompare
protected void gitFetchRemoteAndCompare(final String branchName) throws MojoFailureException, CommandLineException { if (gitFetchRemote(branchName)) { getLog().info( "Comparing local branch '" + branchName + "' with remote '" + gitFlowConfi...
java
protected void gitFetchRemoteAndCompare(final String branchName) throws MojoFailureException, CommandLineException { if (gitFetchRemote(branchName)) { getLog().info( "Comparing local branch '" + branchName + "' with remote '" + gitFlowConfi...
[ "protected", "void", "gitFetchRemoteAndCompare", "(", "final", "String", "branchName", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "if", "(", "gitFetchRemote", "(", "branchName", ")", ")", "{", "getLog", "(", ")", ".", "info", "(", "...
Executes git fetch and compares local branch with the remote. @param branchName Branch name to fetch and compare. @throws MojoFailureException @throws CommandLineException
[ "Executes", "git", "fetch", "and", "compares", "local", "branch", "with", "the", "remote", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L814-L837
50,926
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitFetchRemote
private boolean gitFetchRemote(final String branchName) throws MojoFailureException, CommandLineException { getLog().info( "Fetching remote branch '" + gitFlowConfig.getOrigin() + " " + branchName + "'."); CommandResult result = executeGitCommandExitC...
java
private boolean gitFetchRemote(final String branchName) throws MojoFailureException, CommandLineException { getLog().info( "Fetching remote branch '" + gitFlowConfig.getOrigin() + " " + branchName + "'."); CommandResult result = executeGitCommandExitC...
[ "private", "boolean", "gitFetchRemote", "(", "final", "String", "branchName", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "getLog", "(", ")", ".", "info", "(", "\"Fetching remote branch '\"", "+", "gitFlowConfig", ".", "getOrigin", "(", ...
Executes git fetch. @param branchName Branch name to fetch. @return <code>true</code> if git fetch returned success exit code, <code>false</code> otherwise. @throws MojoFailureException @throws CommandLineException
[ "Executes", "git", "fetch", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L849-L869
50,927
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.mvnSetVersions
protected void mvnSetVersions(final String version) throws MojoFailureException, CommandLineException { getLog().info("Updating version(s) to '" + version + "'."); String newVersion = "-DnewVersion=" + version; String g = ""; String a = ""; if (versionsForceUpdate) { ...
java
protected void mvnSetVersions(final String version) throws MojoFailureException, CommandLineException { getLog().info("Updating version(s) to '" + version + "'."); String newVersion = "-DnewVersion=" + version; String g = ""; String a = ""; if (versionsForceUpdate) { ...
[ "protected", "void", "mvnSetVersions", "(", "final", "String", "version", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "getLog", "(", ")", ".", "info", "(", "\"Updating version(s) to '\"", "+", "version", "+", "\"'.\"", ")", ";", "Strin...
Executes 'set' goal of versions-maven-plugin or 'set-version' of tycho-versions-plugin in case it is tycho build. @param version New version to set. @throws MojoFailureException @throws CommandLineException
[ "Executes", "set", "goal", "of", "versions", "-", "maven", "-", "plugin", "or", "set", "-", "version", "of", "tycho", "-", "versions", "-", "plugin", "in", "case", "it", "is", "tycho", "build", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L924-L955
50,928
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.mvnRun
protected void mvnRun(final String goals) throws Exception { getLog().info("Running Maven goals: " + goals); executeMvnCommand(CommandLineUtils.translateCommandline(goals)); }
java
protected void mvnRun(final String goals) throws Exception { getLog().info("Running Maven goals: " + goals); executeMvnCommand(CommandLineUtils.translateCommandline(goals)); }
[ "protected", "void", "mvnRun", "(", "final", "String", "goals", ")", "throws", "Exception", "{", "getLog", "(", ")", ".", "info", "(", "\"Running Maven goals: \"", "+", "goals", ")", ";", "executeMvnCommand", "(", "CommandLineUtils", ".", "translateCommandline", ...
Executes Maven goals. @param goals The goals to execute. @throws Exception
[ "Executes", "Maven", "goals", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L993-L997
50,929
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.executeGitCommandReturn
private String executeGitCommandReturn(final String... args) throws CommandLineException, MojoFailureException { return executeCommand(cmdGit, true, null, args).getOut(); }
java
private String executeGitCommandReturn(final String... args) throws CommandLineException, MojoFailureException { return executeCommand(cmdGit, true, null, args).getOut(); }
[ "private", "String", "executeGitCommandReturn", "(", "final", "String", "...", "args", ")", "throws", "CommandLineException", ",", "MojoFailureException", "{", "return", "executeCommand", "(", "cmdGit", ",", "true", ",", "null", ",", "args", ")", ".", "getOut", ...
Executes Git command and returns output. @param args Git command line arguments. @return Command output. @throws CommandLineException @throws MojoFailureException
[ "Executes", "Git", "command", "and", "returns", "output", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1008-L1011
50,930
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.executeGitCommandExitCode
private CommandResult executeGitCommandExitCode(final String... args) throws CommandLineException, MojoFailureException { return executeCommand(cmdGit, false, null, args); }
java
private CommandResult executeGitCommandExitCode(final String... args) throws CommandLineException, MojoFailureException { return executeCommand(cmdGit, false, null, args); }
[ "private", "CommandResult", "executeGitCommandExitCode", "(", "final", "String", "...", "args", ")", "throws", "CommandLineException", ",", "MojoFailureException", "{", "return", "executeCommand", "(", "cmdGit", ",", "false", ",", "null", ",", "args", ")", ";", "}...
Executes Git command without failing on non successful exit code. @param args Git command line arguments. @return Command result. @throws CommandLineException @throws MojoFailureException
[ "Executes", "Git", "command", "without", "failing", "on", "non", "successful", "exit", "code", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1022-L1025
50,931
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.executeGitCommand
private void executeGitCommand(final String... args) throws CommandLineException, MojoFailureException { executeCommand(cmdGit, true, null, args); }
java
private void executeGitCommand(final String... args) throws CommandLineException, MojoFailureException { executeCommand(cmdGit, true, null, args); }
[ "private", "void", "executeGitCommand", "(", "final", "String", "...", "args", ")", "throws", "CommandLineException", ",", "MojoFailureException", "{", "executeCommand", "(", "cmdGit", ",", "true", ",", "null", ",", "args", ")", ";", "}" ]
Executes Git command. @param args Git command line arguments. @throws CommandLineException @throws MojoFailureException
[ "Executes", "Git", "command", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1035-L1038
50,932
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.executeMvnCommand
private void executeMvnCommand(final String... args) throws CommandLineException, MojoFailureException { executeCommand(cmdMvn, true, argLine, args); }
java
private void executeMvnCommand(final String... args) throws CommandLineException, MojoFailureException { executeCommand(cmdMvn, true, argLine, args); }
[ "private", "void", "executeMvnCommand", "(", "final", "String", "...", "args", ")", "throws", "CommandLineException", ",", "MojoFailureException", "{", "executeCommand", "(", "cmdMvn", ",", "true", ",", "argLine", ",", "args", ")", ";", "}" ]
Executes Maven command. @param args Maven command line arguments. @throws CommandLineException @throws MojoFailureException
[ "Executes", "Maven", "command", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1048-L1051
50,933
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.executeCommand
private CommandResult executeCommand(final Commandline cmd, final boolean failOnError, final String argStr, final String... args) throws CommandLineException, MojoFailureException { // initialize executables initExecutables(); if (getLog().isDebugEnabled()) {...
java
private CommandResult executeCommand(final Commandline cmd, final boolean failOnError, final String argStr, final String... args) throws CommandLineException, MojoFailureException { // initialize executables initExecutables(); if (getLog().isDebugEnabled()) {...
[ "private", "CommandResult", "executeCommand", "(", "final", "Commandline", "cmd", ",", "final", "boolean", "failOnError", ",", "final", "String", "argStr", ",", "final", "String", "...", "args", ")", "throws", "CommandLineException", ",", "MojoFailureException", "{"...
Executes command line. @param cmd Command line. @param failOnError Whether to throw exception on NOT success exit code. @param argStr Command line arguments as a string. @param args Command line arguments. @return {@link CommandResult} instance holding command exit code, output and error if any. @throws CommandLineExc...
[ "Executes", "command", "line", "." ]
d7be13c653d885c1cb1d8cd0337fa9db985c381e
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1071-L1112
50,934
dadoonet/fscrawler
elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ESVersion.java
ESVersion.fromString
public static ESVersion fromString(String version) { String lVersion = version; final boolean snapshot = lVersion.endsWith("-SNAPSHOT"); if (snapshot) { lVersion = lVersion.substring(0, lVersion.length() - 9); } String[] parts = lVersion.split("[.-]"); if (par...
java
public static ESVersion fromString(String version) { String lVersion = version; final boolean snapshot = lVersion.endsWith("-SNAPSHOT"); if (snapshot) { lVersion = lVersion.substring(0, lVersion.length() - 9); } String[] parts = lVersion.split("[.-]"); if (par...
[ "public", "static", "ESVersion", "fromString", "(", "String", "version", ")", "{", "String", "lVersion", "=", "version", ";", "final", "boolean", "snapshot", "=", "lVersion", ".", "endsWith", "(", "\"-SNAPSHOT\"", ")", ";", "if", "(", "snapshot", ")", "{", ...
Returns the version given its string representation, current version if the argument is null or empty
[ "Returns", "the", "version", "given", "its", "string", "representation", "current", "version", "if", "the", "argument", "is", "null", "or", "empty" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ESVersion.java#L32-L78
50,935
dadoonet/fscrawler
elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ESDocumentField.java
ESDocumentField.getValue
public <V> V getValue() { if (values == null || values.isEmpty()) { return null; } return (V)values.get(0); }
java
public <V> V getValue() { if (values == null || values.isEmpty()) { return null; } return (V)values.get(0); }
[ "public", "<", "V", ">", "V", "getValue", "(", ")", "{", "if", "(", "values", "==", "null", "||", "values", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "return", "(", "V", ")", "values", ".", "get", "(", "0", ")", ";", "}"...
The first value of the hit.
[ "The", "first", "value", "of", "the", "hit", "." ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ESDocumentField.java#L55-L60
50,936
dadoonet/fscrawler
core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java
FsParserAbstract.updateFsJob
private void updateFsJob(String jobName, LocalDateTime scanDate) throws Exception { // We need to round that latest date to the lower second and // remove 2 seconds. // See #82: https://github.com/dadoonet/fscrawler/issues/82 scanDate = scanDate.minus(2, ChronoUnit.SECONDS); FsJo...
java
private void updateFsJob(String jobName, LocalDateTime scanDate) throws Exception { // We need to round that latest date to the lower second and // remove 2 seconds. // See #82: https://github.com/dadoonet/fscrawler/issues/82 scanDate = scanDate.minus(2, ChronoUnit.SECONDS); FsJo...
[ "private", "void", "updateFsJob", "(", "String", "jobName", ",", "LocalDateTime", "scanDate", ")", "throws", "Exception", "{", "// We need to round that latest date to the lower second and", "// remove 2 seconds.", "// See #82: https://github.com/dadoonet/fscrawler/issues/82", "scanD...
Update the job metadata @param jobName job name @param scanDate last date we scan the dirs @throws Exception In case of error
[ "Update", "the", "job", "metadata" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L208-L220
50,937
dadoonet/fscrawler
core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java
FsParserAbstract.indexDirectory
private void indexDirectory(String path) throws Exception { fr.pilato.elasticsearch.crawler.fs.beans.Path pathObject = new fr.pilato.elasticsearch.crawler.fs.beans.Path(); // The real and complete path pathObject.setReal(path); String rootdir = path.substring(0, path.lastIndexOf(File.sep...
java
private void indexDirectory(String path) throws Exception { fr.pilato.elasticsearch.crawler.fs.beans.Path pathObject = new fr.pilato.elasticsearch.crawler.fs.beans.Path(); // The real and complete path pathObject.setReal(path); String rootdir = path.substring(0, path.lastIndexOf(File.sep...
[ "private", "void", "indexDirectory", "(", "String", "path", ")", "throws", "Exception", "{", "fr", ".", "pilato", ".", "elasticsearch", ".", "crawler", ".", "fs", ".", "beans", ".", "Path", "pathObject", "=", "new", "fr", ".", "pilato", ".", "elasticsearch...
Index a directory @param path complete path like /path/to/subdir
[ "Index", "a", "directory" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L537-L548
50,938
dadoonet/fscrawler
core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java
FsParserAbstract.removeEsDirectoryRecursively
private void removeEsDirectoryRecursively(final String path) throws Exception { logger.debug("Delete folder [{}]", path); Collection<String> listFile = getFileDirectory(path); for (String esfile : listFile) { esDelete(fsSettings.getElasticsearch().getIndex(), SignTool.sign(path.conc...
java
private void removeEsDirectoryRecursively(final String path) throws Exception { logger.debug("Delete folder [{}]", path); Collection<String> listFile = getFileDirectory(path); for (String esfile : listFile) { esDelete(fsSettings.getElasticsearch().getIndex(), SignTool.sign(path.conc...
[ "private", "void", "removeEsDirectoryRecursively", "(", "final", "String", "path", ")", "throws", "Exception", "{", "logger", ".", "debug", "(", "\"Delete folder [{}]\"", ",", "path", ")", ";", "Collection", "<", "String", ">", "listFile", "=", "getFileDirectory",...
Remove a full directory and sub dirs recursively
[ "Remove", "a", "full", "directory", "and", "sub", "dirs", "recursively" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L553-L567
50,939
dadoonet/fscrawler
core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java
FsParserAbstract.esIndex
private void esIndex(String index, String id, String json, String pipeline) { logger.debug("Indexing {}/{}?pipeline={}", index, id, pipeline); logger.trace("JSon indexed : {}", json); if (!closed) { esClient.index(index, id, json, pipeline); } else { logger.warn(...
java
private void esIndex(String index, String id, String json, String pipeline) { logger.debug("Indexing {}/{}?pipeline={}", index, id, pipeline); logger.trace("JSon indexed : {}", json); if (!closed) { esClient.index(index, id, json, pipeline); } else { logger.warn(...
[ "private", "void", "esIndex", "(", "String", "index", ",", "String", "id", ",", "String", "json", ",", "String", "pipeline", ")", "{", "logger", ".", "debug", "(", "\"Indexing {}/{}?pipeline={}\"", ",", "index", ",", "id", ",", "pipeline", ")", ";", "logge...
Add to bulk an IndexRequest in JSon format
[ "Add", "to", "bulk", "an", "IndexRequest", "in", "JSon", "format" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L572-L581
50,940
dadoonet/fscrawler
core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java
FsParserAbstract.esDelete
private void esDelete(String index, String id) { logger.debug("Deleting {}/{}", index, id); if (!closed) { esClient.delete(index, id); } else { logger.warn("trying to remove a file while closing crawler. Document [{}]/[{}] has been ignored", index, id); } }
java
private void esDelete(String index, String id) { logger.debug("Deleting {}/{}", index, id); if (!closed) { esClient.delete(index, id); } else { logger.warn("trying to remove a file while closing crawler. Document [{}]/[{}] has been ignored", index, id); } }
[ "private", "void", "esDelete", "(", "String", "index", ",", "String", "id", ")", "{", "logger", ".", "debug", "(", "\"Deleting {}/{}\"", ",", "index", ",", "id", ")", ";", "if", "(", "!", "closed", ")", "{", "esClient", ".", "delete", "(", "index", "...
Add to bulk a DeleteRequest
[ "Add", "to", "bulk", "a", "DeleteRequest" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L586-L593
50,941
dadoonet/fscrawler
elasticsearch-client/elasticsearch-client-v6/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/v6/ElasticsearchClientV6.java
ElasticsearchClientV6.checkVersion
@Override public void checkVersion() throws IOException { ESVersion esVersion = getVersion(); if (esVersion.major != compatibleVersion()) { throw new RuntimeException("The Elasticsearch client version [" + compatibleVersion() + "] is not compatible with the Elasticsea...
java
@Override public void checkVersion() throws IOException { ESVersion esVersion = getVersion(); if (esVersion.major != compatibleVersion()) { throw new RuntimeException("The Elasticsearch client version [" + compatibleVersion() + "] is not compatible with the Elasticsea...
[ "@", "Override", "public", "void", "checkVersion", "(", ")", "throws", "IOException", "{", "ESVersion", "esVersion", "=", "getVersion", "(", ")", ";", "if", "(", "esVersion", ".", "major", "!=", "compatibleVersion", "(", ")", ")", "{", "throw", "new", "Run...
For Elasticsearch 6, we need to make sure we are running at least Elasticsearch 6.4 @throws IOException when something is wrong while asking the version of the node.
[ "For", "Elasticsearch", "6", "we", "need", "to", "make", "sure", "we", "are", "running", "at", "least", "Elasticsearch", "6", ".", "4" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/elasticsearch-client/elasticsearch-client-v6/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/v6/ElasticsearchClientV6.java#L179-L192
50,942
dadoonet/fscrawler
rest/src/main/java/fr/pilato/elasticsearch/crawler/fs/rest/RestServer.java
RestServer.start
public static void start(FsSettings settings, ElasticsearchClient esClient) { // We create the service only one if (httpServer == null) { // create a resource config that scans for JAX-RS resources and providers // in fr.pilato.elasticsearch.crawler.fs.rest package fi...
java
public static void start(FsSettings settings, ElasticsearchClient esClient) { // We create the service only one if (httpServer == null) { // create a resource config that scans for JAX-RS resources and providers // in fr.pilato.elasticsearch.crawler.fs.rest package fi...
[ "public", "static", "void", "start", "(", "FsSettings", "settings", ",", "ElasticsearchClient", "esClient", ")", "{", "// We create the service only one", "if", "(", "httpServer", "==", "null", ")", "{", "// create a resource config that scans for JAX-RS resources and provide...
Starts Grizzly HTTP server exposing JAX-RS resources defined in this application. @param settings FSCrawler settings @param esClient Elasticsearch client
[ "Starts", "Grizzly", "HTTP", "server", "exposing", "JAX", "-", "RS", "resources", "defined", "in", "this", "application", "." ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/rest/src/main/java/fr/pilato/elasticsearch/crawler/fs/rest/RestServer.java#L44-L64
50,943
dadoonet/fscrawler
core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsCrawlerImpl.java
FsCrawlerImpl.upgrade
@SuppressWarnings("deprecation") public boolean upgrade() throws Exception { // We need to start a client so we can send requests to elasticsearch try { esClient.start(); } catch (Exception t) { logger.fatal("We can not start Elasticsearch Client. Exiting.", t); ...
java
@SuppressWarnings("deprecation") public boolean upgrade() throws Exception { // We need to start a client so we can send requests to elasticsearch try { esClient.start(); } catch (Exception t) { logger.fatal("We can not start Elasticsearch Client. Exiting.", t); ...
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "boolean", "upgrade", "(", ")", "throws", "Exception", "{", "// We need to start a client so we can send requests to elasticsearch", "try", "{", "esClient", ".", "start", "(", ")", ";", "}", "catch", "(",...
Upgrade FSCrawler indices @return true if done successfully @throws Exception In case of error
[ "Upgrade", "FSCrawler", "indices" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsCrawlerImpl.java#L94-L147
50,944
dadoonet/fscrawler
framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java
FsCrawlerUtil.getOwnerName
public static String getOwnerName(final File file) { try { final Path path = Paths.get(file.getAbsolutePath()); final FileOwnerAttributeView ownerAttributeView = Files.getFileAttributeView(path, FileOwnerAttributeView.class); return ownerAttributeView != null ? ownerAttribute...
java
public static String getOwnerName(final File file) { try { final Path path = Paths.get(file.getAbsolutePath()); final FileOwnerAttributeView ownerAttributeView = Files.getFileAttributeView(path, FileOwnerAttributeView.class); return ownerAttributeView != null ? ownerAttribute...
[ "public", "static", "String", "getOwnerName", "(", "final", "File", "file", ")", "{", "try", "{", "final", "Path", "path", "=", "Paths", ".", "get", "(", "file", ".", "getAbsolutePath", "(", ")", ")", ";", "final", "FileOwnerAttributeView", "ownerAttributeVi...
Determines the 'owner' of the file.
[ "Determines", "the", "owner", "of", "the", "file", "." ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L358-L368
50,945
dadoonet/fscrawler
framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java
FsCrawlerUtil.copyDefaultResources
public static void copyDefaultResources(Path configPath) throws IOException { Path targetResourceDir = configPath.resolve("_default"); for (String filename : MAPPING_RESOURCES) { Path target = targetResourceDir.resolve(filename); if (Files.exists(target)) { logge...
java
public static void copyDefaultResources(Path configPath) throws IOException { Path targetResourceDir = configPath.resolve("_default"); for (String filename : MAPPING_RESOURCES) { Path target = targetResourceDir.resolve(filename); if (Files.exists(target)) { logge...
[ "public", "static", "void", "copyDefaultResources", "(", "Path", "configPath", ")", "throws", "IOException", "{", "Path", "targetResourceDir", "=", "configPath", ".", "resolve", "(", "\"_default\"", ")", ";", "for", "(", "String", "filename", ":", "MAPPING_RESOURC...
Copy default resources files which are available as project resources under fr.pilato.elasticsearch.crawler.fs._default package to a given configuration path under a _default sub directory. @param configPath The config path which is by default .fscrawler @throws IOException If copying does not work
[ "Copy", "default", "resources", "files", "which", "are", "available", "as", "project", "resources", "under", "fr", ".", "pilato", ".", "elasticsearch", ".", "crawler", ".", "fs", ".", "_default", "package", "to", "a", "given", "configuration", "path", "under",...
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L441-L453
50,946
dadoonet/fscrawler
framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java
FsCrawlerUtil.copyResourceFile
public static void copyResourceFile(String source, Path target) throws IOException { InputStream resource = FsCrawlerUtil.class.getResourceAsStream(source); FileUtils.copyInputStreamToFile(resource, target.toFile()); }
java
public static void copyResourceFile(String source, Path target) throws IOException { InputStream resource = FsCrawlerUtil.class.getResourceAsStream(source); FileUtils.copyInputStreamToFile(resource, target.toFile()); }
[ "public", "static", "void", "copyResourceFile", "(", "String", "source", ",", "Path", "target", ")", "throws", "IOException", "{", "InputStream", "resource", "=", "FsCrawlerUtil", ".", "class", ".", "getResourceAsStream", "(", "source", ")", ";", "FileUtils", "....
Copy a single resource file from the classpath or from a JAR. @param target The target @throws IOException If copying does not work
[ "Copy", "a", "single", "resource", "file", "from", "the", "classpath", "or", "from", "a", "JAR", "." ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L460-L463
50,947
dadoonet/fscrawler
framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java
FsCrawlerUtil.readPropertiesFromClassLoader
public static Properties readPropertiesFromClassLoader(String resource) { Properties properties = new Properties(); try { properties.load(FsCrawlerUtil.class.getClassLoader().getResourceAsStream(resource)); } catch (IOException e) { throw new RuntimeException(e); ...
java
public static Properties readPropertiesFromClassLoader(String resource) { Properties properties = new Properties(); try { properties.load(FsCrawlerUtil.class.getClassLoader().getResourceAsStream(resource)); } catch (IOException e) { throw new RuntimeException(e); ...
[ "public", "static", "Properties", "readPropertiesFromClassLoader", "(", "String", "resource", ")", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "try", "{", "properties", ".", "load", "(", "FsCrawlerUtil", ".", "class", ".", "getClass...
Read a property file from the class loader @param resource Resource name @return The properties loaded
[ "Read", "a", "property", "file", "from", "the", "class", "loader" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L470-L478
50,948
dadoonet/fscrawler
framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java
FsCrawlerUtil.copyDirs
public static void copyDirs(Path source, Path target, CopyOption... options) throws IOException { if (Files.notExists(target)) { Files.createDirectory(target); } logger.debug(" --> Copying resources from [{}]", source); if (Files.notExists(source)) { throw new R...
java
public static void copyDirs(Path source, Path target, CopyOption... options) throws IOException { if (Files.notExists(target)) { Files.createDirectory(target); } logger.debug(" --> Copying resources from [{}]", source); if (Files.notExists(source)) { throw new R...
[ "public", "static", "void", "copyDirs", "(", "Path", "source", ",", "Path", "target", ",", "CopyOption", "...", "options", ")", "throws", "IOException", "{", "if", "(", "Files", ".", "notExists", "(", "target", ")", ")", "{", "Files", ".", "createDirectory...
Copy files from a source to a target under a _default sub directory. @param source The source dir @param target The target dir @param options Potential options @throws IOException If copying does not work
[ "Copy", "files", "from", "a", "source", "to", "a", "target", "under", "a", "_default", "sub", "directory", "." ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L488-L502
50,949
dadoonet/fscrawler
framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java
FsCrawlerUtil.unzip
public static void unzip(String jarFile, Path destination) throws IOException { Map<String, String> zipProperties = new HashMap<>(); /* We want to read an existing ZIP File, so we set this to false */ zipProperties.put("create", "false"); zipProperties.put("encoding", "UTF-8"); U...
java
public static void unzip(String jarFile, Path destination) throws IOException { Map<String, String> zipProperties = new HashMap<>(); /* We want to read an existing ZIP File, so we set this to false */ zipProperties.put("create", "false"); zipProperties.put("encoding", "UTF-8"); U...
[ "public", "static", "void", "unzip", "(", "String", "jarFile", ",", "Path", "destination", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "String", ">", "zipProperties", "=", "new", "HashMap", "<>", "(", ")", ";", "/* We want to read an existing...
Unzip a jar file @param jarFile Jar file url like file:/path/to/foo.jar @param destination Directory where we want to extract the content to @throws IOException In case of any IO problem
[ "Unzip", "a", "jar", "file" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L543-L569
50,950
dadoonet/fscrawler
framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java
FsCrawlerUtil.isFileSizeUnderLimit
public static boolean isFileSizeUnderLimit(ByteSizeValue limit, long fileSizeAsBytes) { boolean result = true; if (limit != null) { // We check the file size to avoid indexing too big files ByteSizeValue fileSize = new ByteSizeValue(fileSizeAsBytes); int compare = fil...
java
public static boolean isFileSizeUnderLimit(ByteSizeValue limit, long fileSizeAsBytes) { boolean result = true; if (limit != null) { // We check the file size to avoid indexing too big files ByteSizeValue fileSize = new ByteSizeValue(fileSizeAsBytes); int compare = fil...
[ "public", "static", "boolean", "isFileSizeUnderLimit", "(", "ByteSizeValue", "limit", ",", "long", "fileSizeAsBytes", ")", "{", "boolean", "result", "=", "true", ";", "if", "(", "limit", "!=", "null", ")", "{", "// We check the file size to avoid indexing too big file...
Compare if a file size is strictly under a given limit @param limit Limit. If null, we consider that there is no limit and we return true. @param fileSizeAsBytes File size @return true if under the limit. false otherwise.
[ "Compare", "if", "a", "file", "size", "is", "strictly", "under", "a", "given", "limit" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L612-L624
50,951
dadoonet/fscrawler
elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ElasticsearchClientUtil.java
ElasticsearchClientUtil.findClass
private static Class<ElasticsearchClient> findClass(int version) throws ClassNotFoundException { String className = "fr.pilato.elasticsearch.crawler.fs.client.v" + version + ".ElasticsearchClientV" + version; logger.trace("Trying to find a class named [{}]", className); Class<?> aClass = Class.f...
java
private static Class<ElasticsearchClient> findClass(int version) throws ClassNotFoundException { String className = "fr.pilato.elasticsearch.crawler.fs.client.v" + version + ".ElasticsearchClientV" + version; logger.trace("Trying to find a class named [{}]", className); Class<?> aClass = Class.f...
[ "private", "static", "Class", "<", "ElasticsearchClient", ">", "findClass", "(", "int", "version", ")", "throws", "ClassNotFoundException", "{", "String", "className", "=", "\"fr.pilato.elasticsearch.crawler.fs.client.v\"", "+", "version", "+", "\".ElasticsearchClientV\"", ...
Try to load an ElasticsearchClient class @param version Version number to use. It's only the major part of the version. Like 5 or 6. @return The Client class
[ "Try", "to", "load", "an", "ElasticsearchClient", "class" ]
cca00a14e21ef9986aa30e19b160463aed6bf921
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ElasticsearchClientUtil.java#L100-L110
50,952
EsotericSoftware/yamlbeans
src/com/esotericsoftware/yamlbeans/YamlConfig.java
YamlConfig.setClassTag
public void setClassTag (String tag, Class type) { if (tag == null) throw new IllegalArgumentException("tag cannot be null."); if (type == null) throw new IllegalArgumentException("type cannot be null."); classNameToTag.put(type.getName(), tag); tagToClass.put(tag, type); }
java
public void setClassTag (String tag, Class type) { if (tag == null) throw new IllegalArgumentException("tag cannot be null."); if (type == null) throw new IllegalArgumentException("type cannot be null."); classNameToTag.put(type.getName(), tag); tagToClass.put(tag, type); }
[ "public", "void", "setClassTag", "(", "String", "tag", ",", "Class", "type", ")", "{", "if", "(", "tag", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"tag cannot be null.\"", ")", ";", "if", "(", "type", "==", "null", ")", "throw",...
Allows the specified tag to be used in YAML instead of the full class name.
[ "Allows", "the", "specified", "tag", "to", "be", "used", "in", "YAML", "instead", "of", "the", "full", "class", "name", "." ]
f5610997edbc5534fc7e9f0a91654d14742345ca
https://github.com/EsotericSoftware/yamlbeans/blob/f5610997edbc5534fc7e9f0a91654d14742345ca/src/com/esotericsoftware/yamlbeans/YamlConfig.java#L69-L74
50,953
EsotericSoftware/yamlbeans
src/com/esotericsoftware/yamlbeans/YamlConfig.java
YamlConfig.setScalarSerializer
public void setScalarSerializer (Class type, ScalarSerializer serializer) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (serializer == null) throw new IllegalArgumentException("serializer cannot be null."); scalarSerializers.put(type, serializer); }
java
public void setScalarSerializer (Class type, ScalarSerializer serializer) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (serializer == null) throw new IllegalArgumentException("serializer cannot be null."); scalarSerializers.put(type, serializer); }
[ "public", "void", "setScalarSerializer", "(", "Class", "type", ",", "ScalarSerializer", "serializer", ")", "{", "if", "(", "type", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"type cannot be null.\"", ")", ";", "if", "(", "serializer", ...
Adds a serializer for the specified scalar type.
[ "Adds", "a", "serializer", "for", "the", "specified", "scalar", "type", "." ]
f5610997edbc5534fc7e9f0a91654d14742345ca
https://github.com/EsotericSoftware/yamlbeans/blob/f5610997edbc5534fc7e9f0a91654d14742345ca/src/com/esotericsoftware/yamlbeans/YamlConfig.java#L77-L81
50,954
EsotericSoftware/yamlbeans
src/com/esotericsoftware/yamlbeans/YamlConfig.java
YamlConfig.setPropertyElementType
public void setPropertyElementType (Class type, String propertyName, Class elementType) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null."); if (elementType == null) throw new IllegalArgumen...
java
public void setPropertyElementType (Class type, String propertyName, Class elementType) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null."); if (elementType == null) throw new IllegalArgumen...
[ "public", "void", "setPropertyElementType", "(", "Class", "type", ",", "String", "propertyName", ",", "Class", "elementType", ")", "{", "if", "(", "type", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"type cannot be null.\"", ")", ";", "...
Sets the default type of elements in a Collection or Map property. No tag will be output for elements of this type. This type will be used for each element if no tag is found.
[ "Sets", "the", "default", "type", "of", "elements", "in", "a", "Collection", "or", "Map", "property", ".", "No", "tag", "will", "be", "output", "for", "elements", "of", "this", "type", ".", "This", "type", "will", "be", "used", "for", "each", "element", ...
f5610997edbc5534fc7e9f0a91654d14742345ca
https://github.com/EsotericSoftware/yamlbeans/blob/f5610997edbc5534fc7e9f0a91654d14742345ca/src/com/esotericsoftware/yamlbeans/YamlConfig.java#L85-L97
50,955
EsotericSoftware/yamlbeans
src/com/esotericsoftware/yamlbeans/YamlConfig.java
YamlConfig.setPropertyDefaultType
public void setPropertyDefaultType (Class type, String propertyName, Class defaultType) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null."); if (defaultType == null) throw new IllegalArgumen...
java
public void setPropertyDefaultType (Class type, String propertyName, Class defaultType) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null."); if (defaultType == null) throw new IllegalArgumen...
[ "public", "void", "setPropertyDefaultType", "(", "Class", "type", ",", "String", "propertyName", ",", "Class", "defaultType", ")", "{", "if", "(", "type", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"type cannot be null.\"", ")", ";", "...
Sets the default type of a property. No tag will be output for values of this type. This type will be used if no tag is found.
[ "Sets", "the", "default", "type", "of", "a", "property", ".", "No", "tag", "will", "be", "output", "for", "values", "of", "this", "type", ".", "This", "type", "will", "be", "used", "if", "no", "tag", "is", "found", "." ]
f5610997edbc5534fc7e9f0a91654d14742345ca
https://github.com/EsotericSoftware/yamlbeans/blob/f5610997edbc5534fc7e9f0a91654d14742345ca/src/com/esotericsoftware/yamlbeans/YamlConfig.java#L101-L109
50,956
EsotericSoftware/yamlbeans
src/com/esotericsoftware/yamlbeans/YamlReader.java
YamlReader.read
public <T> T read (Class<T> type) throws YamlException { return read(type, null); }
java
public <T> T read (Class<T> type) throws YamlException { return read(type, null); }
[ "public", "<", "T", ">", "T", "read", "(", "Class", "<", "T", ">", "type", ")", "throws", "YamlException", "{", "return", "read", "(", "type", ",", "null", ")", ";", "}" ]
Reads an object of the specified type from YAML. @param type The type of object to read. If null, behaves the same as {{@link #read()}.
[ "Reads", "an", "object", "of", "the", "specified", "type", "from", "YAML", "." ]
f5610997edbc5534fc7e9f0a91654d14742345ca
https://github.com/EsotericSoftware/yamlbeans/blob/f5610997edbc5534fc7e9f0a91654d14742345ca/src/com/esotericsoftware/yamlbeans/YamlReader.java#L91-L93
50,957
EsotericSoftware/yamlbeans
src/com/esotericsoftware/yamlbeans/YamlReader.java
YamlReader.read
public <T> T read (Class<T> type, Class elementType) throws YamlException { try { while (true) { Event event = parser.getNextEvent(); if (event == null) return null; if (event.type == STREAM_END) return null; if (event.type == DOCUMENT_START) break; } return (T)readValue(type, element...
java
public <T> T read (Class<T> type, Class elementType) throws YamlException { try { while (true) { Event event = parser.getNextEvent(); if (event == null) return null; if (event.type == STREAM_END) return null; if (event.type == DOCUMENT_START) break; } return (T)readValue(type, element...
[ "public", "<", "T", ">", "T", "read", "(", "Class", "<", "T", ">", "type", ",", "Class", "elementType", ")", "throws", "YamlException", "{", "try", "{", "while", "(", "true", ")", "{", "Event", "event", "=", "parser", ".", "getNextEvent", "(", ")", ...
Reads an array, Map, List, or Collection object of the specified type from YAML, using the specified element type. @param type The type of object to read. If null, behaves the same as {{@link #read()}.
[ "Reads", "an", "array", "Map", "List", "or", "Collection", "object", "of", "the", "specified", "type", "from", "YAML", "using", "the", "specified", "element", "type", "." ]
f5610997edbc5534fc7e9f0a91654d14742345ca
https://github.com/EsotericSoftware/yamlbeans/blob/f5610997edbc5534fc7e9f0a91654d14742345ca/src/com/esotericsoftware/yamlbeans/YamlReader.java#L97-L111
50,958
EsotericSoftware/yamlbeans
src/com/esotericsoftware/yamlbeans/YamlReader.java
YamlReader.readValue
protected Object readValue (Class type, Class elementType, Class defaultType) throws YamlException, ParserException, TokenizerException { String tag = null, anchor = null; Event event = parser.peekNextEvent(); switch (event.type) { case ALIAS: parser.getNextEvent(); anchor = ((AliasEvent)event)...
java
protected Object readValue (Class type, Class elementType, Class defaultType) throws YamlException, ParserException, TokenizerException { String tag = null, anchor = null; Event event = parser.peekNextEvent(); switch (event.type) { case ALIAS: parser.getNextEvent(); anchor = ((AliasEvent)event)...
[ "protected", "Object", "readValue", "(", "Class", "type", ",", "Class", "elementType", ",", "Class", "defaultType", ")", "throws", "YamlException", ",", "ParserException", ",", "TokenizerException", "{", "String", "tag", "=", "null", ",", "anchor", "=", "null", ...
Reads an object from the YAML. Can be overidden to take some action for any of the objects returned.
[ "Reads", "an", "object", "from", "the", "YAML", ".", "Can", "be", "overidden", "to", "take", "some", "action", "for", "any", "of", "the", "objects", "returned", "." ]
f5610997edbc5534fc7e9f0a91654d14742345ca
https://github.com/EsotericSoftware/yamlbeans/blob/f5610997edbc5534fc7e9f0a91654d14742345ca/src/com/esotericsoftware/yamlbeans/YamlReader.java#L114-L139
50,959
EsotericSoftware/yamlbeans
src/com/esotericsoftware/yamlbeans/YamlReader.java
YamlReader.createObject
protected Object createObject (Class type) throws InvocationTargetException { // Use deferred construction if a non-zero-arg constructor is available. DeferredConstruction deferredConstruction = Beans.getDeferredConstruction(type, config); if (deferredConstruction != null) return deferredConstruction; retur...
java
protected Object createObject (Class type) throws InvocationTargetException { // Use deferred construction if a non-zero-arg constructor is available. DeferredConstruction deferredConstruction = Beans.getDeferredConstruction(type, config); if (deferredConstruction != null) return deferredConstruction; retur...
[ "protected", "Object", "createObject", "(", "Class", "type", ")", "throws", "InvocationTargetException", "{", "// Use deferred construction if a non-zero-arg constructor is available.\r", "DeferredConstruction", "deferredConstruction", "=", "Beans", ".", "getDeferredConstruction", ...
Returns a new object of the requested type.
[ "Returns", "a", "new", "object", "of", "the", "requested", "type", "." ]
f5610997edbc5534fc7e9f0a91654d14742345ca
https://github.com/EsotericSoftware/yamlbeans/blob/f5610997edbc5534fc7e9f0a91654d14742345ca/src/com/esotericsoftware/yamlbeans/YamlReader.java#L460-L465
50,960
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlStreamRenderer.java
HtmlStreamRenderer.error
private final void error(String message, CharSequence identifier) { if (badHtmlHandler != Handler.DO_NOTHING) { // Avoid string append. badHtmlHandler.handle(message + " : " + identifier); } }
java
private final void error(String message, CharSequence identifier) { if (badHtmlHandler != Handler.DO_NOTHING) { // Avoid string append. badHtmlHandler.handle(message + " : " + identifier); } }
[ "private", "final", "void", "error", "(", "String", "message", ",", "CharSequence", "identifier", ")", "{", "if", "(", "badHtmlHandler", "!=", "Handler", ".", "DO_NOTHING", ")", "{", "// Avoid string append.", "badHtmlHandler", ".", "handle", "(", "message", "+"...
Called when the series of calls make no sense. May be overridden to throw an unchecked throwable, to log, or to take some other action. @param message for human consumption. @param identifier an HTML identifier associated with the message.
[ "Called", "when", "the", "series", "of", "calls", "make", "no", "sense", ".", "May", "be", "overridden", "to", "throw", "an", "unchecked", "throwable", "to", "log", "or", "to", "take", "some", "other", "action", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlStreamRenderer.java#L115-L119
50,961
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlStreamRenderer.java
HtmlStreamRenderer.safeName
static String safeName(String unsafeElementName) { String elementName = HtmlLexer.canonicalName(unsafeElementName); // Substitute a reliably non-raw-text element for raw-text and // plain-text elements. switch (elementName.length()) { case 3: if ("xmp".equals(elementName)) { return "pre";...
java
static String safeName(String unsafeElementName) { String elementName = HtmlLexer.canonicalName(unsafeElementName); // Substitute a reliably non-raw-text element for raw-text and // plain-text elements. switch (elementName.length()) { case 3: if ("xmp".equals(elementName)) { return "pre";...
[ "static", "String", "safeName", "(", "String", "unsafeElementName", ")", "{", "String", "elementName", "=", "HtmlLexer", ".", "canonicalName", "(", "unsafeElementName", ")", ";", "// Substitute a reliably non-raw-text element for raw-text and", "// plain-text elements.", "swi...
Canonicalizes the element name and possibly substitutes an alternative that has more consistent semantics.
[ "Canonicalizes", "the", "element", "name", "and", "possibly", "substitutes", "an", "alternative", "that", "has", "more", "consistent", "semantics", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlStreamRenderer.java#L388-L405
50,962
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/Trie.java
Trie.lookup
public Trie lookup(char ch) { int i = Arrays.binarySearch(childMap, ch); return i >= 0 ? children[i] : null; }
java
public Trie lookup(char ch) { int i = Arrays.binarySearch(childMap, ch); return i >= 0 ? children[i] : null; }
[ "public", "Trie", "lookup", "(", "char", "ch", ")", "{", "int", "i", "=", "Arrays", ".", "binarySearch", "(", "childMap", ",", "ch", ")", ";", "return", "i", ">=", "0", "?", "children", "[", "i", "]", ":", "null", ";", "}" ]
The child corresponding to the given character. @return null if no such trie.
[ "The", "child", "corresponding", "to", "the", "given", "character", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/Trie.java#L125-L128
50,963
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/Trie.java
Trie.lookup
public Trie lookup(CharSequence s) { Trie t = this; for (int i = 0, n = s.length(); i < n; ++i) { t = t.lookup(s.charAt(i)); if (null == t) { break; } } return t; }
java
public Trie lookup(CharSequence s) { Trie t = this; for (int i = 0, n = s.length(); i < n; ++i) { t = t.lookup(s.charAt(i)); if (null == t) { break; } } return t; }
[ "public", "Trie", "lookup", "(", "CharSequence", "s", ")", "{", "Trie", "t", "=", "this", ";", "for", "(", "int", "i", "=", "0", ",", "n", "=", "s", ".", "length", "(", ")", ";", "i", "<", "n", ";", "++", "i", ")", "{", "t", "=", "t", "."...
The descendant of this trie corresponding to the string for this trie appended with s. @param s non null. @return null if no such trie.
[ "The", "descendant", "of", "this", "trie", "corresponding", "to", "the", "string", "for", "this", "trie", "appended", "with", "s", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/Trie.java#L136-L143
50,964
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/FilterUrlByProtocolAttributePolicy.java
FilterUrlByProtocolAttributePolicy.normalizeUri
static String normalizeUri(String s) { int n = s.length(); boolean colonsIrrelevant = false; for (int i = 0; i < n; ++i) { char ch = s.charAt(i); switch (ch) { case '/': case '#': case '?': case ':': colonsIrrelevant = true; break; case '(': case ')': ...
java
static String normalizeUri(String s) { int n = s.length(); boolean colonsIrrelevant = false; for (int i = 0; i < n; ++i) { char ch = s.charAt(i); switch (ch) { case '/': case '#': case '?': case ':': colonsIrrelevant = true; break; case '(': case ')': ...
[ "static", "String", "normalizeUri", "(", "String", "s", ")", "{", "int", "n", "=", "s", ".", "length", "(", ")", ";", "boolean", "colonsIrrelevant", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "++", "i", ")", "...
Percent encodes anything that looks like a colon, or a parenthesis.
[ "Percent", "encodes", "anything", "that", "looks", "like", "a", "colon", "or", "a", "parenthesis", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/FilterUrlByProtocolAttributePolicy.java#L97-L125
50,965
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlElementTables.java
HtmlElementTables.canContain
public boolean canContain(int parent, int child) { if (nofeatureElements.get(parent)) { // It's hard to interrogate a browser about the behavior of // <noscript> in scriptless mode using JavaScript, and the // behavior of <noscript> is more dangerous when in that mode, // so we hardcode that...
java
public boolean canContain(int parent, int child) { if (nofeatureElements.get(parent)) { // It's hard to interrogate a browser about the behavior of // <noscript> in scriptless mode using JavaScript, and the // behavior of <noscript> is more dangerous when in that mode, // so we hardcode that...
[ "public", "boolean", "canContain", "(", "int", "parent", ",", "int", "child", ")", "{", "if", "(", "nofeatureElements", ".", "get", "(", "parent", ")", ")", "{", "// It's hard to interrogate a browser about the behavior of", "// <noscript> in scriptless mode using JavaScr...
True if parent can directly contain child.
[ "True", "if", "parent", "can", "directly", "contain", "child", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlElementTables.java#L193-L205
50,966
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlElementTables.java
HtmlElementTables.impliedElements
int[] impliedElements(int anc, int desc) { // <style> and <script> are allowed anywhere. if (desc == SCRIPT_TAG || desc == STYLE_TAG) { return ZERO_INTS; } // It's dangerous to allow free <li> tags because of the way an <li> // implies a </li> if there is an <li> on the parse stack without a ...
java
int[] impliedElements(int anc, int desc) { // <style> and <script> are allowed anywhere. if (desc == SCRIPT_TAG || desc == STYLE_TAG) { return ZERO_INTS; } // It's dangerous to allow free <li> tags because of the way an <li> // implies a </li> if there is an <li> on the parse stack without a ...
[ "int", "[", "]", "impliedElements", "(", "int", "anc", ",", "int", "desc", ")", "{", "// <style> and <script> are allowed anywhere.", "if", "(", "desc", "==", "SCRIPT_TAG", "||", "desc", "==", "STYLE_TAG", ")", "{", "return", "ZERO_INTS", ";", "}", "// It's da...
Elements in order which are implicitly opened when a descendant tag is lexically nested within an ancestor.
[ "Elements", "in", "order", "which", "are", "implicitly", "opened", "when", "a", "descendant", "tag", "is", "lexically", "nested", "within", "an", "ancestor", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlElementTables.java#L325-L374
50,967
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlLexer.java
HtmlLexer.canonicalName
static String canonicalName(String elementOrAttribName) { return elementOrAttribName.indexOf(':') >= 0 ? elementOrAttribName : Strings.toLowerCase(elementOrAttribName); }
java
static String canonicalName(String elementOrAttribName) { return elementOrAttribName.indexOf(':') >= 0 ? elementOrAttribName : Strings.toLowerCase(elementOrAttribName); }
[ "static", "String", "canonicalName", "(", "String", "elementOrAttribName", ")", "{", "return", "elementOrAttribName", ".", "indexOf", "(", "'", "'", ")", ">=", "0", "?", "elementOrAttribName", ":", "Strings", ".", "toLowerCase", "(", "elementOrAttribName", ")", ...
Normalize case of names that are not name-spaced. This lower-cases HTML element and attribute names, but not ones for embedded SVG or MATHML.
[ "Normalize", "case", "of", "names", "that", "are", "not", "name", "-", "spaced", ".", "This", "lower", "-", "cases", "HTML", "element", "and", "attribute", "names", "but", "not", "ones", "for", "embedded", "SVG", "or", "MATHML", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlLexer.java#L60-L63
50,968
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlLexer.java
HtmlLexer.produce
@Override protected HtmlToken produce() { HtmlToken token = readToken(); if (token == null) { return null; } switch (token.type) { // Keep track of whether we're inside a tag or not. case TAGBEGIN: state = State.IN_TAG; break; case TAGEND: if (state == State.SAW...
java
@Override protected HtmlToken produce() { HtmlToken token = readToken(); if (token == null) { return null; } switch (token.type) { // Keep track of whether we're inside a tag or not. case TAGBEGIN: state = State.IN_TAG; break; case TAGEND: if (state == State.SAW...
[ "@", "Override", "protected", "HtmlToken", "produce", "(", ")", "{", "HtmlToken", "token", "=", "readToken", "(", ")", ";", "if", "(", "token", "==", "null", ")", "{", "return", "null", ";", "}", "switch", "(", "token", ".", "type", ")", "{", "// Kee...
Makes sure that this.token contains a token if one is available. This may require fetching and combining multiple tokens from the underlying splitter.
[ "Makes", "sure", "that", "this", ".", "token", "contains", "a", "token", "if", "one", "is", "available", ".", "This", "may", "require", "fetching", "and", "combining", "multiple", "tokens", "from", "the", "underlying", "splitter", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlLexer.java#L82-L164
50,969
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlLexer.java
HtmlLexer.collapseSubsequent
private HtmlToken collapseSubsequent(HtmlToken token) { HtmlToken collapsed = token; for (HtmlToken next; (next= peekToken(0)) != null && next.type == token.type; readToken()) { collapsed = join(collapsed, next); } return collapsed; }
java
private HtmlToken collapseSubsequent(HtmlToken token) { HtmlToken collapsed = token; for (HtmlToken next; (next= peekToken(0)) != null && next.type == token.type; readToken()) { collapsed = join(collapsed, next); } return collapsed; }
[ "private", "HtmlToken", "collapseSubsequent", "(", "HtmlToken", "token", ")", "{", "HtmlToken", "collapsed", "=", "token", ";", "for", "(", "HtmlToken", "next", ";", "(", "next", "=", "peekToken", "(", "0", ")", ")", "!=", "null", "&&", "next", ".", "typ...
Collapses all the following tokens of the same type into this.token.
[ "Collapses", "all", "the", "following", "tokens", "of", "the", "same", "type", "into", "this", ".", "token", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlLexer.java#L169-L177
50,970
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlLexer.java
HtmlLexer.isValuelessAttribute
private static boolean isValuelessAttribute(String attribName) { boolean valueless = VALUELESS_ATTRIB_NAMES.contains( Strings.toLowerCase(attribName)); return valueless; }
java
private static boolean isValuelessAttribute(String attribName) { boolean valueless = VALUELESS_ATTRIB_NAMES.contains( Strings.toLowerCase(attribName)); return valueless; }
[ "private", "static", "boolean", "isValuelessAttribute", "(", "String", "attribName", ")", "{", "boolean", "valueless", "=", "VALUELESS_ATTRIB_NAMES", ".", "contains", "(", "Strings", ".", "toLowerCase", "(", "attribName", ")", ")", ";", "return", "valueless", ";",...
Can the attribute appear in HTML without a value.
[ "Can", "the", "attribute", "appear", "in", "HTML", "without", "a", "value", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlLexer.java#L245-L249
50,971
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlLexer.java
HtmlInputSplitter.produce
@Override protected HtmlToken produce() { HtmlToken token = parseToken(); if (null == token) { return null; } // Handle escape-exempt blocks. // The parse() method is only dimly aware of escape-excempt blocks, so // here we detect the beginning and ends of escape exempt blocks, and // reclass...
java
@Override protected HtmlToken produce() { HtmlToken token = parseToken(); if (null == token) { return null; } // Handle escape-exempt blocks. // The parse() method is only dimly aware of escape-excempt blocks, so // here we detect the beginning and ends of escape exempt blocks, and // reclass...
[ "@", "Override", "protected", "HtmlToken", "produce", "(", ")", "{", "HtmlToken", "token", "=", "parseToken", "(", ")", ";", "if", "(", "null", "==", "token", ")", "{", "return", "null", ";", "}", "// Handle escape-exempt blocks.", "// The parse() method is only...
Make sure that there is a token ready to yield in this.token.
[ "Make", "sure", "that", "there", "is", "a", "token", "ready", "to", "yield", "in", "this", ".", "token", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlLexer.java#L293-L332
50,972
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlPolicyBuilder.java
HtmlPolicyBuilder.allowElements
public HtmlPolicyBuilder allowElements( ElementPolicy policy, String... elementNames) { invalidateCompiledState(); for (String elementName : elementNames) { elementName = HtmlLexer.canonicalName(elementName); ElementPolicy newPolicy = ElementPolicy.Util.join( elPolicies.get(elementNa...
java
public HtmlPolicyBuilder allowElements( ElementPolicy policy, String... elementNames) { invalidateCompiledState(); for (String elementName : elementNames) { elementName = HtmlLexer.canonicalName(elementName); ElementPolicy newPolicy = ElementPolicy.Util.join( elPolicies.get(elementNa...
[ "public", "HtmlPolicyBuilder", "allowElements", "(", "ElementPolicy", "policy", ",", "String", "...", "elementNames", ")", "{", "invalidateCompiledState", "(", ")", ";", "for", "(", "String", "elementName", ":", "elementNames", ")", "{", "elementName", "=", "HtmlL...
Allow the given elements with the given policy. @param policy May remove or add attributes, change the element name, or deny the element.
[ "Allow", "the", "given", "elements", "with", "the", "given", "policy", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlPolicyBuilder.java#L229-L247
50,973
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlPolicyBuilder.java
HtmlPolicyBuilder.allowWithoutAttributes
public HtmlPolicyBuilder allowWithoutAttributes(String... elementNames) { invalidateCompiledState(); for (String elementName : elementNames) { elementName = HtmlLexer.canonicalName(elementName); skipIfEmpty.remove(elementName); } return this; }
java
public HtmlPolicyBuilder allowWithoutAttributes(String... elementNames) { invalidateCompiledState(); for (String elementName : elementNames) { elementName = HtmlLexer.canonicalName(elementName); skipIfEmpty.remove(elementName); } return this; }
[ "public", "HtmlPolicyBuilder", "allowWithoutAttributes", "(", "String", "...", "elementNames", ")", "{", "invalidateCompiledState", "(", ")", ";", "for", "(", "String", "elementName", ":", "elementNames", ")", "{", "elementName", "=", "HtmlLexer", ".", "canonicalNam...
Assuming the given elements are allowed, allows them to appear without attributes. @see #DEFAULT_SKIP_IF_EMPTY @see #disallowWithoutAttributes
[ "Assuming", "the", "given", "elements", "are", "allowed", "allows", "them", "to", "appear", "without", "attributes", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlPolicyBuilder.java#L313-L320
50,974
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlPolicyBuilder.java
HtmlPolicyBuilder.disallowWithoutAttributes
public HtmlPolicyBuilder disallowWithoutAttributes(String... elementNames) { invalidateCompiledState(); for (String elementName : elementNames) { elementName = HtmlLexer.canonicalName(elementName); skipIfEmpty.add(elementName); } return this; }
java
public HtmlPolicyBuilder disallowWithoutAttributes(String... elementNames) { invalidateCompiledState(); for (String elementName : elementNames) { elementName = HtmlLexer.canonicalName(elementName); skipIfEmpty.add(elementName); } return this; }
[ "public", "HtmlPolicyBuilder", "disallowWithoutAttributes", "(", "String", "...", "elementNames", ")", "{", "invalidateCompiledState", "(", ")", ";", "for", "(", "String", "elementName", ":", "elementNames", ")", "{", "elementName", "=", "HtmlLexer", ".", "canonical...
Disallows the given elements from appearing without attributes. @see #DEFAULT_SKIP_IF_EMPTY @see #allowWithoutAttributes
[ "Disallows", "the", "given", "elements", "from", "appearing", "without", "attributes", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlPolicyBuilder.java#L328-L335
50,975
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlPolicyBuilder.java
HtmlPolicyBuilder.allowAttributes
public AttributeBuilder allowAttributes(String... attributeNames) { ImmutableList.Builder<String> b = ImmutableList.builder(); for (String attributeName : attributeNames) { b.add(HtmlLexer.canonicalName(attributeName)); } return new AttributeBuilder(b.build()); }
java
public AttributeBuilder allowAttributes(String... attributeNames) { ImmutableList.Builder<String> b = ImmutableList.builder(); for (String attributeName : attributeNames) { b.add(HtmlLexer.canonicalName(attributeName)); } return new AttributeBuilder(b.build()); }
[ "public", "AttributeBuilder", "allowAttributes", "(", "String", "...", "attributeNames", ")", "{", "ImmutableList", ".", "Builder", "<", "String", ">", "b", "=", "ImmutableList", ".", "builder", "(", ")", ";", "for", "(", "String", "attributeName", ":", "attri...
Returns an object that lets you associate policies with the given attributes, and allow them globally or on specific elements.
[ "Returns", "an", "object", "that", "lets", "you", "associate", "policies", "with", "the", "given", "attributes", "and", "allow", "them", "globally", "or", "on", "specific", "elements", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlPolicyBuilder.java#L341-L347
50,976
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/HtmlPolicyBuilder.java
HtmlPolicyBuilder.withPreprocessor
public HtmlPolicyBuilder withPreprocessor(HtmlStreamEventProcessor pp) { this.preprocessor = HtmlStreamEventProcessor.Processors.compose( this.preprocessor, pp); return this; }
java
public HtmlPolicyBuilder withPreprocessor(HtmlStreamEventProcessor pp) { this.preprocessor = HtmlStreamEventProcessor.Processors.compose( this.preprocessor, pp); return this; }
[ "public", "HtmlPolicyBuilder", "withPreprocessor", "(", "HtmlStreamEventProcessor", "pp", ")", "{", "this", ".", "preprocessor", "=", "HtmlStreamEventProcessor", ".", "Processors", ".", "compose", "(", "this", ".", "preprocessor", ",", "pp", ")", ";", "return", "t...
Inserts a pre-processor into the pipeline between the lexer and the policy. Pre-processors receive HTML events before the policy, so the policy will be applied to anything they add. Pre-processors are not in the TCB since they cannot bypass the policy.
[ "Inserts", "a", "pre", "-", "processor", "into", "the", "pipeline", "between", "the", "lexer", "and", "the", "policy", ".", "Pre", "-", "processors", "receive", "HTML", "events", "before", "the", "policy", "so", "the", "policy", "will", "be", "applied", "t...
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlPolicyBuilder.java#L567-L571
50,977
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/examples/SlashdotPolicyExample.java
SlashdotPolicyExample.main
public static void main(String[] args) throws IOException { if (args.length != 0) { System.err.println("Reads from STDIN and writes to STDOUT"); System.exit(-1); } System.err.println("[Reading from STDIN]"); // Fetch the HTML to sanitize. String html = CharStreams.toString( new I...
java
public static void main(String[] args) throws IOException { if (args.length != 0) { System.err.println("Reads from STDIN and writes to STDOUT"); System.exit(-1); } System.err.println("[Reading from STDIN]"); // Fetch the HTML to sanitize. String html = CharStreams.toString( new I...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "if", "(", "args", ".", "length", "!=", "0", ")", "{", "System", ".", "err", ".", "println", "(", "\"Reads from STDIN and writes to STDOUT\"", ")", ";",...
A test-bed that reads HTML from stdin and writes sanitized content to stdout.
[ "A", "test", "-", "bed", "that", "reads", "HTML", "from", "stdin", "and", "writes", "sanitized", "content", "to", "stdout", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/examples/SlashdotPolicyExample.java#L95-L123
50,978
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/Encoding.java
Encoding.decodeHtml
public static String decodeHtml(String s) { int firstAmp = s.indexOf('&'); int safeLimit = longestPrefixOfGoodCodeunits(s); if ((firstAmp & safeLimit) < 0) { return s; } StringBuilder sb; { int n = s.length(); sb = new StringBuilder(n); int pos = 0; int amp = firstAmp; ...
java
public static String decodeHtml(String s) { int firstAmp = s.indexOf('&'); int safeLimit = longestPrefixOfGoodCodeunits(s); if ((firstAmp & safeLimit) < 0) { return s; } StringBuilder sb; { int n = s.length(); sb = new StringBuilder(n); int pos = 0; int amp = firstAmp; ...
[ "public", "static", "String", "decodeHtml", "(", "String", "s", ")", "{", "int", "firstAmp", "=", "s", ".", "indexOf", "(", "'", "'", ")", ";", "int", "safeLimit", "=", "longestPrefixOfGoodCodeunits", "(", "s", ")", ";", "if", "(", "(", "firstAmp", "&"...
Decodes HTML entities to produce a string containing only valid Unicode scalar values.
[ "Decodes", "HTML", "entities", "to", "produce", "a", "string", "containing", "only", "valid", "Unicode", "scalar", "values", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/Encoding.java#L42-L71
50,979
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/Encoding.java
Encoding.stripBannedCodeunits
@TCB static String stripBannedCodeunits(String s) { int safeLimit = longestPrefixOfGoodCodeunits(s); if (safeLimit < 0) { return s; } StringBuilder sb = new StringBuilder(s); stripBannedCodeunits(sb, safeLimit); return sb.toString(); }
java
@TCB static String stripBannedCodeunits(String s) { int safeLimit = longestPrefixOfGoodCodeunits(s); if (safeLimit < 0) { return s; } StringBuilder sb = new StringBuilder(s); stripBannedCodeunits(sb, safeLimit); return sb.toString(); }
[ "@", "TCB", "static", "String", "stripBannedCodeunits", "(", "String", "s", ")", "{", "int", "safeLimit", "=", "longestPrefixOfGoodCodeunits", "(", "s", ")", ";", "if", "(", "safeLimit", "<", "0", ")", "{", "return", "s", ";", "}", "StringBuilder", "sb", ...
Returns the portion of its input that consists of XML safe chars. @see <a href="http://www.w3.org/TR/2008/REC-xml-20081126/#charsets">XML Ch. 2.2 - Characters</a>
[ "Returns", "the", "portion", "of", "its", "input", "that", "consists", "of", "XML", "safe", "chars", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/Encoding.java#L77-L85
50,980
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/Encoding.java
Encoding.longestPrefixOfGoodCodeunits
@TCB private static int longestPrefixOfGoodCodeunits(String s) { int n = s.length(), i; for (i = 0; i < n; ++i) { char ch = s.charAt(i); if (ch < 0x20) { if (IS_BANNED_ASCII[ch]) { return i; } } else if (0xd800 <= ch) { if (ch <= 0xdfff) { if (i+1 ...
java
@TCB private static int longestPrefixOfGoodCodeunits(String s) { int n = s.length(), i; for (i = 0; i < n; ++i) { char ch = s.charAt(i); if (ch < 0x20) { if (IS_BANNED_ASCII[ch]) { return i; } } else if (0xd800 <= ch) { if (ch <= 0xdfff) { if (i+1 ...
[ "@", "TCB", "private", "static", "int", "longestPrefixOfGoodCodeunits", "(", "String", "s", ")", "{", "int", "n", "=", "s", ".", "length", "(", ")", ",", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "n", ";", "++", "i", ")", "{", "char",...
The number of code-units at the front of s that form code-points in the XML Character production. @return -1 if all of s is in the XML Character production.
[ "The", "number", "of", "code", "-", "units", "at", "the", "front", "of", "s", "that", "form", "code", "-", "points", "in", "the", "XML", "Character", "production", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/Encoding.java#L130-L152
50,981
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/TagBalancingHtmlStreamEventReceiver.java
TagBalancingHtmlStreamEventReceiver.canContain
private boolean canContain( int child, int container, int containerIndexOnStack) { Preconditions.checkArgument(containerIndexOnStack >= 0); int anc = container; int ancIndexOnStack = containerIndexOnStack; while (true) { if (METADATA.canContain(anc, child)) { return true; } ...
java
private boolean canContain( int child, int container, int containerIndexOnStack) { Preconditions.checkArgument(containerIndexOnStack >= 0); int anc = container; int ancIndexOnStack = containerIndexOnStack; while (true) { if (METADATA.canContain(anc, child)) { return true; } ...
[ "private", "boolean", "canContain", "(", "int", "child", ",", "int", "container", ",", "int", "containerIndexOnStack", ")", "{", "Preconditions", ".", "checkArgument", "(", "containerIndexOnStack", ">=", "0", ")", ";", "int", "anc", "=", "container", ";", "int...
Takes into account transparency when figuring out what can be contained.
[ "Takes", "into", "account", "transparency", "when", "figuring", "out", "what", "can", "be", "contained", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/TagBalancingHtmlStreamEventReceiver.java#L217-L235
50,982
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/examples/UrlTextExample.java
UrlTextExample.run
public static void run(Appendable out, String... inputs) throws IOException { PolicyFactory policyBuilder = new HtmlPolicyBuilder() .allowAttributes("src").onElements("img") .allowAttributes("href").onElements("a") // Allow some URLs through. .allowStandardUrlProtocols() .allowElements...
java
public static void run(Appendable out, String... inputs) throws IOException { PolicyFactory policyBuilder = new HtmlPolicyBuilder() .allowAttributes("src").onElements("img") .allowAttributes("href").onElements("a") // Allow some URLs through. .allowStandardUrlProtocols() .allowElements...
[ "public", "static", "void", "run", "(", "Appendable", "out", ",", "String", "...", "inputs", ")", "throws", "IOException", "{", "PolicyFactory", "policyBuilder", "=", "new", "HtmlPolicyBuilder", "(", ")", ".", "allowAttributes", "(", "\"src\"", ")", ".", "onEl...
Sanitizes inputs to out.
[ "Sanitizes", "inputs", "to", "out", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/examples/UrlTextExample.java#L115-L138
50,983
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/PolicyFactory.java
PolicyFactory.and
public PolicyFactory and(PolicyFactory f) { ImmutableMap.Builder<String, ElementAndAttributePolicies> b = ImmutableMap.builder(); // Merge this and f into a map of element names to attribute policies. for (Map.Entry<String, ElementAndAttributePolicies> e : policies.entrySet()) { String...
java
public PolicyFactory and(PolicyFactory f) { ImmutableMap.Builder<String, ElementAndAttributePolicies> b = ImmutableMap.builder(); // Merge this and f into a map of element names to attribute policies. for (Map.Entry<String, ElementAndAttributePolicies> e : policies.entrySet()) { String...
[ "public", "PolicyFactory", "and", "(", "PolicyFactory", "f", ")", "{", "ImmutableMap", ".", "Builder", "<", "String", ",", "ElementAndAttributePolicies", ">", "b", "=", "ImmutableMap", ".", "builder", "(", ")", ";", "// Merge this and f into a map of element names to ...
Produces a factory that allows the union of the grants, and intersects policies where they overlap on a particular granted attribute or element name.
[ "Produces", "a", "factory", "that", "allows", "the", "union", "of", "the", "grants", "and", "intersects", "policies", "where", "they", "overlap", "on", "a", "particular", "granted", "attribute", "or", "element", "name", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/PolicyFactory.java#L142-L214
50,984
OWASP/java-html-sanitizer
src/main/java/org/owasp/html/CssGrammar.java
CssGrammar.cssContent
static String cssContent(String token) { int n = token.length(); int pos = 0; StringBuilder sb = null; if (n >= 2) { char ch0 = token.charAt(0); if (ch0 == '"' || ch0 == '\'') { if (ch0 == token.charAt(n - 1)) { pos = 1; --n; sb = new StringBuilder(n); ...
java
static String cssContent(String token) { int n = token.length(); int pos = 0; StringBuilder sb = null; if (n >= 2) { char ch0 = token.charAt(0); if (ch0 == '"' || ch0 == '\'') { if (ch0 == token.charAt(n - 1)) { pos = 1; --n; sb = new StringBuilder(n); ...
[ "static", "String", "cssContent", "(", "String", "token", ")", "{", "int", "n", "=", "token", ".", "length", "(", ")", ";", "int", "pos", "=", "0", ";", "StringBuilder", "sb", "=", "null", ";", "if", "(", "n", ">=", "2", ")", "{", "char", "ch0", ...
Decodes any escape sequences and strips any quotes from the input.
[ "Decodes", "any", "escape", "sequences", "and", "strips", "any", "quotes", "from", "the", "input", "." ]
a30315fe9a41e19c449628e7ef3488b3a7856009
https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/CssGrammar.java#L154-L198
50,985
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/Sort.java
Sort.quickSort
private static void quickSort(int[] order, double[] values, int start, int end, int limit) { // the while loop implements tail-recursion to avoid excessive stack calls on nasty cases while (end - start > limit) { // pivot by a random element int pivotIndex = start + prng.nextInt...
java
private static void quickSort(int[] order, double[] values, int start, int end, int limit) { // the while loop implements tail-recursion to avoid excessive stack calls on nasty cases while (end - start > limit) { // pivot by a random element int pivotIndex = start + prng.nextInt...
[ "private", "static", "void", "quickSort", "(", "int", "[", "]", "order", ",", "double", "[", "]", "values", ",", "int", "start", ",", "int", "end", ",", "int", "limit", ")", "{", "// the while loop implements tail-recursion to avoid excessive stack calls on nasty ca...
Standard quick sort except that sorting is done on an index array rather than the values themselves @param order The pre-allocated index array @param values The values to sort @param start The beginning of the values to sort @param end The value after the last value to sort @param limit The minimum size to recur...
[ "Standard", "quick", "sort", "except", "that", "sorting", "is", "done", "on", "an", "index", "array", "rather", "than", "the", "values", "themselves" ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/Sort.java#L79-L157
50,986
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/Sort.java
Sort.quickSort
private static void quickSort(double[] key, double[][] values, int start, int end, int limit) { // the while loop implements tail-recursion to avoid excessive stack calls on nasty cases while (end - start > limit) { // median of three values for the pivot int a = start; ...
java
private static void quickSort(double[] key, double[][] values, int start, int end, int limit) { // the while loop implements tail-recursion to avoid excessive stack calls on nasty cases while (end - start > limit) { // median of three values for the pivot int a = start; ...
[ "private", "static", "void", "quickSort", "(", "double", "[", "]", "key", ",", "double", "[", "]", "[", "]", "values", ",", "int", "start", ",", "int", "end", ",", "int", "limit", ")", "{", "// the while loop implements tail-recursion to avoid excessive stack ca...
Standard quick sort except that sorting rearranges parallel arrays @param key Values to sort on @param values The auxilliary values to sort. @param start The beginning of the values to sort @param end The value after the last value to sort @param limit The minimum size to recurse down to.
[ "Standard", "quick", "sort", "except", "that", "sorting", "rearranges", "parallel", "arrays" ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/Sort.java#L195-L317
50,987
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/Sort.java
Sort.insertionSort
@SuppressWarnings("SameParameterValue") private static void insertionSort(double[] key, double[][] values, int start, int end, int limit) { // loop invariant: all values start ... i-1 are ordered for (int i = start + 1; i < end; i++) { double v = key[i]; int m = Math.max(i - ...
java
@SuppressWarnings("SameParameterValue") private static void insertionSort(double[] key, double[][] values, int start, int end, int limit) { // loop invariant: all values start ... i-1 are ordered for (int i = start + 1; i < end; i++) { double v = key[i]; int m = Math.max(i - ...
[ "@", "SuppressWarnings", "(", "\"SameParameterValue\"", ")", "private", "static", "void", "insertionSort", "(", "double", "[", "]", "key", ",", "double", "[", "]", "[", "]", "values", ",", "int", "start", ",", "int", "end", ",", "int", "limit", ")", "{",...
Limited range insertion sort. We assume that no element has to move more than limit steps because quick sort has done its thing. This version works on parallel arrays of keys and values. @param key The array of keys @param values The values we are sorting @param start The starting point of the sort @param end ...
[ "Limited", "range", "insertion", "sort", ".", "We", "assume", "that", "no", "element", "has", "to", "move", "more", "than", "limit", "steps", "because", "quick", "sort", "has", "done", "its", "thing", ".", "This", "version", "works", "on", "parallel", "arr...
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/Sort.java#L330-L351
50,988
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/Sort.java
Sort.checkPartition
@SuppressWarnings("UnusedDeclaration") public static void checkPartition(int[] order, double[] values, double pivotValue, int start, int low, int high, int end) { if (order.length != values.length) { throw new IllegalArgumentException("Arguments must be same size"); } if (!(star...
java
@SuppressWarnings("UnusedDeclaration") public static void checkPartition(int[] order, double[] values, double pivotValue, int start, int low, int high, int end) { if (order.length != values.length) { throw new IllegalArgumentException("Arguments must be same size"); } if (!(star...
[ "@", "SuppressWarnings", "(", "\"UnusedDeclaration\"", ")", "public", "static", "void", "checkPartition", "(", "int", "[", "]", "order", ",", "double", "[", "]", "values", ",", "double", "pivotValue", ",", "int", "start", ",", "int", "low", ",", "int", "hi...
Check that a partition step was done correctly. For debugging and testing. @param order The array of indexes representing a permutation of the keys. @param values The keys to sort. @param pivotValue The value that splits the data @param start The beginning of the data of interest. @param low Valu...
[ "Check", "that", "a", "partition", "step", "was", "done", "correctly", ".", "For", "debugging", "and", "testing", "." ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/Sort.java#L382-L411
50,989
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/Sort.java
Sort.insertionSort
@SuppressWarnings("SameParameterValue") private static void insertionSort(int[] order, double[] values, int start, int n, int limit) { for (int i = start + 1; i < n; i++) { int t = order[i]; double v = values[order[i]]; int m = Math.max(i - limit, start); for ...
java
@SuppressWarnings("SameParameterValue") private static void insertionSort(int[] order, double[] values, int start, int n, int limit) { for (int i = start + 1; i < n; i++) { int t = order[i]; double v = values[order[i]]; int m = Math.max(i - limit, start); for ...
[ "@", "SuppressWarnings", "(", "\"SameParameterValue\"", ")", "private", "static", "void", "insertionSort", "(", "int", "[", "]", "order", ",", "double", "[", "]", "values", ",", "int", "start", ",", "int", "n", ",", "int", "limit", ")", "{", "for", "(", ...
Limited range insertion sort. We assume that no element has to move more than limit steps because quick sort has done its thing. @param order The permutation index @param values The values we are sorting @param start Where to start the sort @param n How many elements to sort @param limit The largest amount of...
[ "Limited", "range", "insertion", "sort", ".", "We", "assume", "that", "no", "element", "has", "to", "move", "more", "than", "limit", "steps", "because", "quick", "sort", "has", "done", "its", "thing", "." ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/Sort.java#L423-L439
50,990
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/AbstractTDigest.java
AbstractTDigest.quantile
static double quantile(double index, double previousIndex, double nextIndex, double previousMean, double nextMean) { final double delta = nextIndex - previousIndex; final double previousWeight = (nextIndex - index) / delta; final double nextWeight = (index - previousIndex) / delta; retur...
java
static double quantile(double index, double previousIndex, double nextIndex, double previousMean, double nextMean) { final double delta = nextIndex - previousIndex; final double previousWeight = (nextIndex - index) / delta; final double nextWeight = (index - previousIndex) / delta; retur...
[ "static", "double", "quantile", "(", "double", "index", ",", "double", "previousIndex", ",", "double", "nextIndex", ",", "double", "previousMean", ",", "double", "nextMean", ")", "{", "final", "double", "delta", "=", "nextIndex", "-", "previousIndex", ";", "fi...
Computes an interpolated value of a quantile that is between two centroids. Index is the quantile desired multiplied by the total number of samples - 1. @param index Denormalized quantile desired @param previousIndex The denormalized quantile corresponding to the center of the previous centroid. @pa...
[ "Computes", "an", "interpolated", "value", "of", "a", "quantile", "that", "is", "between", "two", "centroids", "." ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/AbstractTDigest.java#L103-L108
50,991
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/AVLGroupTree.java
AVLGroupTree.add
public void add(double centroid, int count, List<Double> data) { this.centroid = centroid; this.count = count; this.data = data; tree.add(); }
java
public void add(double centroid, int count, List<Double> data) { this.centroid = centroid; this.count = count; this.data = data; tree.add(); }
[ "public", "void", "add", "(", "double", "centroid", ",", "int", "count", ",", "List", "<", "Double", ">", "data", ")", "{", "this", ".", "centroid", "=", "centroid", ";", "this", ".", "count", "=", "count", ";", "this", ".", "data", "=", "data", ";...
Add the provided centroid to the tree.
[ "Add", "the", "provided", "centroid", "to", "the", "tree", "." ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/AVLGroupTree.java#L154-L159
50,992
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/AVLGroupTree.java
AVLGroupTree.update
@SuppressWarnings("WeakerAccess") public void update(int node, double centroid, int count, List<Double> data, boolean forceInPlace) { if (centroid == centroids[node]||forceInPlace) { // we prefer to update in place so repeated values don't shuffle around and for merging centroids[nod...
java
@SuppressWarnings("WeakerAccess") public void update(int node, double centroid, int count, List<Double> data, boolean forceInPlace) { if (centroid == centroids[node]||forceInPlace) { // we prefer to update in place so repeated values don't shuffle around and for merging centroids[nod...
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "void", "update", "(", "int", "node", ",", "double", "centroid", ",", "int", "count", ",", "List", "<", "Double", ">", "data", ",", "boolean", "forceInPlace", ")", "{", "if", "(", "centroid",...
Update values associated with a node, readjusting the tree if necessary.
[ "Update", "values", "associated", "with", "a", "node", "readjusting", "the", "tree", "if", "necessary", "." ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/AVLGroupTree.java#L170-L186
50,993
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/AVLTreeDigest.java
AVLTreeDigest.smallByteSize
@Override public int smallByteSize() { int bound = byteSize(); ByteBuffer buf = ByteBuffer.allocate(bound); asSmallBytes(buf); return buf.position(); }
java
@Override public int smallByteSize() { int bound = byteSize(); ByteBuffer buf = ByteBuffer.allocate(bound); asSmallBytes(buf); return buf.position(); }
[ "@", "Override", "public", "int", "smallByteSize", "(", ")", "{", "int", "bound", "=", "byteSize", "(", ")", ";", "ByteBuffer", "buf", "=", "ByteBuffer", ".", "allocate", "(", "bound", ")", ";", "asSmallBytes", "(", "buf", ")", ";", "return", "buf", "....
Returns an upper bound on the number of bytes that will be required to represent this histogram in the tighter representation.
[ "Returns", "an", "upper", "bound", "on", "the", "number", "of", "bytes", "that", "will", "be", "required", "to", "represent", "this", "histogram", "in", "the", "tighter", "representation", "." ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/AVLTreeDigest.java#L491-L497
50,994
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/AVLTreeDigest.java
AVLTreeDigest.asBytes
@Override public void asBytes(ByteBuffer buf) { buf.putInt(VERBOSE_ENCODING); buf.putDouble(min); buf.putDouble(max); buf.putDouble((float) compression()); buf.putInt(summary.size()); for (Centroid centroid : summary) { buf.putDouble(centroid.mean()); ...
java
@Override public void asBytes(ByteBuffer buf) { buf.putInt(VERBOSE_ENCODING); buf.putDouble(min); buf.putDouble(max); buf.putDouble((float) compression()); buf.putInt(summary.size()); for (Centroid centroid : summary) { buf.putDouble(centroid.mean()); ...
[ "@", "Override", "public", "void", "asBytes", "(", "ByteBuffer", "buf", ")", "{", "buf", ".", "putInt", "(", "VERBOSE_ENCODING", ")", ";", "buf", ".", "putDouble", "(", "min", ")", ";", "buf", ".", "putDouble", "(", "max", ")", ";", "buf", ".", "putD...
Outputs a histogram as bytes using a particularly cheesy encoding.
[ "Outputs", "a", "histogram", "as", "bytes", "using", "a", "particularly", "cheesy", "encoding", "." ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/AVLTreeDigest.java#L505-L519
50,995
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/AVLTreeDigest.java
AVLTreeDigest.fromBytes
@SuppressWarnings("WeakerAccess") public static AVLTreeDigest fromBytes(ByteBuffer buf) { int encoding = buf.getInt(); if (encoding == VERBOSE_ENCODING) { double min = buf.getDouble(); double max = buf.getDouble(); double compression = buf.getDouble(); ...
java
@SuppressWarnings("WeakerAccess") public static AVLTreeDigest fromBytes(ByteBuffer buf) { int encoding = buf.getInt(); if (encoding == VERBOSE_ENCODING) { double min = buf.getDouble(); double max = buf.getDouble(); double compression = buf.getDouble(); ...
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "static", "AVLTreeDigest", "fromBytes", "(", "ByteBuffer", "buf", ")", "{", "int", "encoding", "=", "buf", ".", "getInt", "(", ")", ";", "if", "(", "encoding", "==", "VERBOSE_ENCODING", ")", "{...
Reads a histogram from a byte buffer @param buf The buffer to read from. @return The new histogram structure
[ "Reads", "a", "histogram", "from", "a", "byte", "buffer" ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/AVLTreeDigest.java#L548-L589
50,996
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/Comparison.java
Comparison.compareChi2
@SuppressWarnings("WeakerAccess") public static double compareChi2(TDigest dist1, TDigest dist2, double[] qCuts) { double[][] count = new double[2][]; count[0] = new double[qCuts.length + 1]; count[1] = new double[qCuts.length + 1]; double oldQ = 0; double oldQ2 = 0; ...
java
@SuppressWarnings("WeakerAccess") public static double compareChi2(TDigest dist1, TDigest dist2, double[] qCuts) { double[][] count = new double[2][]; count[0] = new double[qCuts.length + 1]; count[1] = new double[qCuts.length + 1]; double oldQ = 0; double oldQ2 = 0; ...
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "static", "double", "compareChi2", "(", "TDigest", "dist1", ",", "TDigest", "dist2", ",", "double", "[", "]", "qCuts", ")", "{", "double", "[", "]", "[", "]", "count", "=", "new", "double", ...
Use a log-likelihood ratio test to compare two distributions. This is done by estimating counts in quantile ranges from each distribution and then comparing those counts using a multinomial test. The result should be asymptotically chi^2 distributed if the data comes from the same distribution, but this isn't so much u...
[ "Use", "a", "log", "-", "likelihood", "ratio", "test", "to", "compare", "two", "distributions", ".", "This", "is", "done", "by", "estimating", "counts", "in", "quantile", "ranges", "from", "each", "distribution", "and", "then", "comparing", "those", "counts", ...
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/Comparison.java#L48-L75
50,997
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/IntAVLTree.java
IntAVLTree.find
public int find() { for (int node = root; node != NIL; ) { final int cmp = compare(node); if (cmp < 0) { node = left(node); } else if (cmp > 0) { node = right(node); } else { return node; } } ...
java
public int find() { for (int node = root; node != NIL; ) { final int cmp = compare(node); if (cmp < 0) { node = left(node); } else if (cmp > 0) { node = right(node); } else { return node; } } ...
[ "public", "int", "find", "(", ")", "{", "for", "(", "int", "node", "=", "root", ";", "node", "!=", "NIL", ";", ")", "{", "final", "int", "cmp", "=", "compare", "(", "node", ")", ";", "if", "(", "cmp", "<", "0", ")", "{", "node", "=", "left", ...
Find a node in this tree.
[ "Find", "a", "node", "in", "this", "tree", "." ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/IntAVLTree.java#L255-L267
50,998
tdunning/t-digest
core/src/main/java/com/tdunning/math/stats/IntAVLTree.java
IntAVLTree.remove
public void remove(int node) { if (node == NIL) { throw new IllegalArgumentException(); } if (left(node) != NIL && right(node) != NIL) { // inner node final int next = next(node); assert next != NIL; swap(node, next); } ...
java
public void remove(int node) { if (node == NIL) { throw new IllegalArgumentException(); } if (left(node) != NIL && right(node) != NIL) { // inner node final int next = next(node); assert next != NIL; swap(node, next); } ...
[ "public", "void", "remove", "(", "int", "node", ")", "{", "if", "(", "node", "==", "NIL", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "left", "(", "node", ")", "!=", "NIL", "&&", "right", "(", "node", ")", ...
Remove the specified node from the tree.
[ "Remove", "the", "specified", "node", "from", "the", "tree", "." ]
0820b016fefc1f66fe3b089cec9b4ba220da4ef1
https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/IntAVLTree.java#L292-L339
50,999
citrusframework/citrus
modules/citrus-jms/src/main/java/com/consol/citrus/jms/message/JmsMessage.java
JmsMessage.getMessageId
public String getMessageId() { Object messageId = getHeader(JmsMessageHeaders.MESSAGE_ID); if (messageId != null) { return messageId.toString(); } return null; }
java
public String getMessageId() { Object messageId = getHeader(JmsMessageHeaders.MESSAGE_ID); if (messageId != null) { return messageId.toString(); } return null; }
[ "public", "String", "getMessageId", "(", ")", "{", "Object", "messageId", "=", "getHeader", "(", "JmsMessageHeaders", ".", "MESSAGE_ID", ")", ";", "if", "(", "messageId", "!=", "null", ")", "{", "return", "messageId", ".", "toString", "(", ")", ";", "}", ...
Gets the JMS messageId header. @return
[ "Gets", "the", "JMS", "messageId", "header", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/message/JmsMessage.java#L111-L119