_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q169800 | ClientManager.setPreferredClientType | validation | public void setPreferredClientType(ClientType preferredClientType) {
if (null == preferredClientType) {
this.preferredClientType = ClientType.CLI;
} else {
this.preferredClientType = preferredClientType;
}
} | java | {
"resource": ""
} |
q169801 | CliGitAdd.add | validation | public GitAddResponse add(File repositoryPath, GitAddOptions options, List<File> paths)
throws JavaGitException, IOException {
CheckUtilities.checkFileValidity(repositoryPath);
GitAddParser parser = new GitAddParser();
List<String> command = buildCommand(repositoryPath, options, paths);
GitAddResponseImpl response = (GitAddResponseImpl) ProcessUtilities.runCommand(repositoryPath,
command, parser);
if (options != null) {
addDryRun(options, response);
}
return (GitAddResponse) response;
} | java | {
"resource": ""
} |
q169802 | CliGitAdd.add | validation | public GitAddResponse add(File repositoryPath, List<File> files) throws JavaGitException,
IOException {
GitAddOptions options = null;
return add(repositoryPath, options, files);
} | java | {
"resource": ""
} |
q169803 | CliGitAdd.add | validation | public GitAddResponse add(File repositoryPath, File file) throws JavaGitException, IOException {
List<File> filePaths = new ArrayList<File>();
filePaths.add(file);
GitAddOptions options = null;
return add(repositoryPath, options, filePaths);
} | java | {
"resource": ""
} |
q169804 | CliGitAdd.add | validation | public GitAddResponse add(File repositoryPath, GitAddOptions options, File file)
throws JavaGitException, IOException {
List<File> paths = new ArrayList<File>();
paths.add(file);
return add(repositoryPath, options, paths);
} | java | {
"resource": ""
} |
q169805 | CliGitAdd.addDryRun | validation | public GitAddResponse addDryRun(File repositoryPath, List<File> paths) throws JavaGitException,
IOException {
GitAddOptions options = new GitAddOptions();
options.setDryRun(true);
return add(repositoryPath, options, paths);
} | java | {
"resource": ""
} |
q169806 | CliGitAdd.addVerbose | validation | public GitAddResponse addVerbose(File repositoryPath, List<File> paths) throws JavaGitException,
IOException {
GitAddOptions options = new GitAddOptions();
options.setVerbose(true);
return add(repositoryPath, options, paths);
} | java | {
"resource": ""
} |
q169807 | CliGitAdd.addWithForce | validation | public GitAddResponse addWithForce(File repositoryPath, List<File> paths)
throws JavaGitException, IOException {
GitAddOptions options = new GitAddOptions();
options.setForce(true);
return add(repositoryPath, options, paths);
} | java | {
"resource": ""
} |
q169808 | CliGitAdd.addDryRun | validation | private void addDryRun(GitAddOptions options, GitAddResponseImpl response) {
if (options.dryRun()) {
response.setDryRun(true);
}
} | java | {
"resource": ""
} |
q169809 | GitVersion.compareToReleaseMinor | validation | private int compareToReleaseMinor(GitVersion that) {
if (this.containsReleaseMinor() && that.containsReleaseMinor())
return compareToInt(this.getReleaseMinor(), that.getReleaseMinor());
else if (!this.containsReleaseMinor() && !that.containsReleaseMinor())
return SAME;
else if (this.containsReleaseMinor() && !that.containsReleaseMinor())
return LATER;
else
return PREVIOUS;
} | java | {
"resource": ""
} |
q169810 | GitAdd.add | validation | public GitAddResponse add(File repositoryPath, GitAddOptions options, List<File> paths)
throws IOException, JavaGitException {
CheckUtilities.checkFileValidity(repositoryPath.getAbsoluteFile());
IClient client = ClientManager.getInstance().getPreferredClient();
IGitAdd gitAdd = client.getGitAddInstance();
return gitAdd.add(repositoryPath, options, paths);
} | java | {
"resource": ""
} |
q169811 | GitAdd.addVerbose | validation | public GitAddResponse addVerbose(File repositoryPath, List<File> paths) throws IOException,
JavaGitException {
IClient client = ClientManager.getInstance().getPreferredClient();
IGitAdd gitAdd = client.getGitAddInstance();
return gitAdd.addVerbose(repositoryPath, paths);
} | java | {
"resource": ""
} |
q169812 | CliGitCommit.commitProcessor | validation | protected GitCommitResponseImpl commitProcessor(File repository, GitCommitOptions options,
String message, List<File> paths) throws IOException, JavaGitException {
CheckUtilities.checkNullArgument(repository, "repository");
CheckUtilities.checkStringArgument(message, "message");
List<String> commandLine = buildCommand(options, message, paths);
GitCommitParser parser = new GitCommitParser(repository.getAbsolutePath());
return (GitCommitResponseImpl) ProcessUtilities.runCommand(repository, commandLine, parser);
} | java | {
"resource": ""
} |
q169813 | JavaGitConfiguration.setGitPath | validation | public static void setGitPath(File path) throws IOException, JavaGitException {
if (path != null) {
CheckUtilities.checkFileValidity(path);
if (!(path.isDirectory())) {
throw new JavaGitException(020002, ExceptionMessageMap.getMessage("020002") + " { path=["
+ path.getPath() + "] }");
}
}
try {
determineGitVersion(path);
} catch (Exception e) {
// The path that was passed in doesn't work. Catch any errors and throw this one instead.
throw new JavaGitException(100002, ExceptionMessageMap.getMessage("100002") + " { path=["
+ path.getPath() + "] }", e);
}
// Make sure we're hanging onto an absolute path.
gitPath = (path != null) ? path.getAbsoluteFile() : null;
} | java | {
"resource": ""
} |
q169814 | ParameterMarshaller.createList | validation | private static List<IParameter> createList(Method method) {
List<IParameter> parameters = new ArrayList<IParameter>();
Class<?> paramTypes[] = method.getParameterTypes();
Annotation[][] methodAnnotations = method.getParameterAnnotations();
for (int i = 0; i < methodAnnotations.length; i++) {
// defaults
boolean paramRequired = true;
String paramName = "";
Class<?> paramClass = paramTypes[i];
for (Annotation a : methodAnnotations[i]) {
if (a instanceof Binder) {
paramName = ((Binder) a).name();
paramRequired = ((Binder) a).required();
break;
}
// else if (a instanceof Environment) {
// paramName = ((Environment) a).name();
// paramRequired = ((Environment) a).required();
// break;
// }
}
parameters.add(Parameter.create(paramName, paramClass, paramRequired));
}
return parameters;
} | java | {
"resource": ""
} |
q169815 | ParameterMarshaller.getFunctionDefinitionArray | validation | public int[] getFunctionDefinitionArray(int functionOffset, int maxParams, int returnType) {
int[] definition = new int[maxParams + EXTRA_FUNC_DEF_VALUES];
int paramCount = getParameterCount(false);
int fullParamCount = getParameterCount(true);
definition[0] = functionOffset;
if (paramCount > maxParams) {
throw new IllegalStateException("Attempted to get function definition table when supplied "
+ "max parameter count " + maxParams + " is smaller than real param count " + paramCount);
}
definition[1] = paramCount;
int j = 2;
for (int i = 0; i < fullParamCount; i++) {
// add grammar element if it is NOT an injected type
if ((this.parameters.get(i) instanceof InjectedParameter) == false) {
definition[j] = this.parameters.get(i).getGrammarElementType();
j++;
}
}
// pad out unspecified param types
for (; j < definition.length - 1; j++) {
definition[j] = Parameter.GRAMMAR_ELEMENT_UNSPECIFIED;
}
// return type as last value
definition[definition.length - 1] = returnType;
return definition;
} | java | {
"resource": ""
} |
q169816 | ParameterMarshaller.getValueArray | validation | public Object[] getValueArray(Workspace ws, DataBinder binder, ExecutionContext ctx) {
Object[] paramArray = new Object[this.parameters.size()];
for (int i = 0; i < this.parameters.size(); i++) {
// inject params if needed
IParameter p = this.parameters.get(i);
try {
if (p.getType() == Workspace.class) {
paramArray[i] = ws;
} else if (p.getType() == DataBinder.class) {
paramArray[i] = binder;
} else if (p.getType().isAssignableFrom(ExecutionContext.class)) {
paramArray[i] = ctx;
} else {
paramArray[i] = null;
}
} catch (ClassCastException e) {
SystemUtils.trace("twine", "getArgumentValue failed on parameter " + (i + 1) + ": " + e.getMessage());
}
}
return paramArray;
} | java | {
"resource": ""
} |
q169817 | DotGit.existsInstance | validation | public static synchronized boolean existsInstance(File path) {
String canonicalPath = "";
try {
canonicalPath = path.getCanonicalPath();
} catch (IOException e) {
//obviously, the answer is NO
return false;
}
return INSTANCES.containsKey(canonicalPath);
} | java | {
"resource": ""
} |
q169818 | DotGit.createBranch | validation | public Ref createBranch(String name) throws IOException, JavaGitException {
Ref newBranch = Ref.createBranchRef(name);
GitBranch gitBranch = new GitBranch();
gitBranch.createBranch(path, newBranch);
return newBranch;
} | java | {
"resource": ""
} |
q169819 | DotGit.deleteBranch | validation | public void deleteBranch(Ref branch, boolean forceDelete)
throws IOException, JavaGitException {
GitBranch gitBranch = new GitBranch();
gitBranch.deleteBranch(path, forceDelete, false, branch);
branch = null;
} | java | {
"resource": ""
} |
q169820 | DotGit.renameBranch | validation | public Ref renameBranch(Ref branchFrom, String nameTo, boolean forceRename)
throws IOException, JavaGitException {
Ref newBranch = Ref.createBranchRef(nameTo);
GitBranch gitBranch = new GitBranch();
gitBranch.renameBranch(path, forceRename, branchFrom, newBranch);
return newBranch;
} | java | {
"resource": ""
} |
q169821 | DotGit.getBranches | validation | public Iterator<Ref> getBranches() throws IOException, JavaGitException {
GitBranch gitBranch = new GitBranch();
GitBranchOptions options = new GitBranchOptions();
GitBranchResponse response = gitBranch.branch(path, options);
return response.getBranchListIterator();
} | java | {
"resource": ""
} |
q169822 | GitCommit.commitAll | validation | public GitCommitResponseImpl commitAll(File repository, String message) throws IOException,
JavaGitException {
CheckUtilities.checkNullArgument(repository, "repository");
CheckUtilities.checkStringArgument(message, "message");
IClient client = ClientManager.getInstance().getPreferredClient();
IGitCommit gitCommit = client.getGitCommitInstance();
return gitCommit.commitAll(repository, message);
} | java | {
"resource": ""
} |
q169823 | ObjectConverter.convert | validation | @SuppressWarnings("unchecked")
public static <T> T convert(Object from, Class<T> to) {
// Null is just null.
if (from == null) {
return null;
}
// Can we cast? Then just do it.
if (to.isAssignableFrom(from.getClass())) {
return to.cast(from);
}
// Lookup the suitable converter.
String converterId = from.getClass().getName() + "_" + to.getName();
Method converter = CONVERTERS.get(converterId);
if (converter == null) {
throw new UnsupportedOperationException("Cannot convert from " + from.getClass().getName() + " to "
+ to.getName() + ". Requested converter does not exist.");
}
// Convert the value.
try {
// primitives don't appear to have a .cast() method, which causes a null
// pointer exception
if (to.isPrimitive()) {
return (T) converter.invoke(to, from);
}
return to.cast(converter.invoke(to, from));
} catch (Exception e) {
throw new RuntimeException("Cannot convert from " + from.getClass().getName() + " to " + to.getName()
+ ". Conversion failed with " + e.getMessage(), e);
}
} | java | {
"resource": ""
} |
q169824 | ObjectConverter.integerToBoolean | validation | public static Boolean integerToBoolean(Integer value) {
return value.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;
} | java | {
"resource": ""
} |
q169825 | ObjectConverter.booleanToInteger | validation | public static Integer booleanToInteger(Boolean value) {
return value.booleanValue() ? Integer.valueOf(1) : Integer.valueOf(0);
} | java | {
"resource": ""
} |
q169826 | ObjectConverter.longToString | validation | public static String longToString(Date value) {
if (value == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat();
return sdf.format(value);
} | java | {
"resource": ""
} |
q169827 | ExceptionMessageMap.getMessage | validation | public static String getMessage(String code) {
String str = MESSAGE_MAP.get(code);
if (null == str) {
return "NO MESSAGE FOR ERROR CODE. { code=[" + code + "] }";
}
return str;
} | java | {
"resource": ""
} |
q169828 | GitResetResponse.getFileNeedingUpdate | validation | public File getFileNeedingUpdate(int index) {
CheckUtilities.checkIntIndexInListRange(filesNeedingUpdate, index);
return filesNeedingUpdate.get(index);
} | java | {
"resource": ""
} |
q169829 | GitStatusResponseImpl.addToDeletedFilesToCommit | validation | public void addToDeletedFilesToCommit(File file) {
deletedFilesToCommit.add(file);
fileToStatus.put(file, Status.DELETED_TO_COMMIT);
} | java | {
"resource": ""
} |
q169830 | GitStatusResponseImpl.addToDeletedFilesNotUpdated | validation | public void addToDeletedFilesNotUpdated(File file) {
deletedFilesNotUpdated.add(file);
fileToStatus.put(file, Status.DELETED);
} | java | {
"resource": ""
} |
q169831 | GitStatusResponseImpl.addToModifiedFilesToCommit | validation | public void addToModifiedFilesToCommit(File file) {
modifiedFilesToCommit.add(file);
fileToStatus.put(file, Status.MODIFIED_TO_COMMIT);
} | java | {
"resource": ""
} |
q169832 | GitStatusResponseImpl.addToModifiedFilesNotUpdated | validation | public void addToModifiedFilesNotUpdated(File file) {
modifiedFilesNotUpdated.add(file);
fileToStatus.put(file, Status.MODIFIED);
} | java | {
"resource": ""
} |
q169833 | GitStatusResponseImpl.addToNewFilesToCommit | validation | public void addToNewFilesToCommit(File file) {
newFilesToCommit.add(file);
fileToStatus.put(file, Status.NEW_TO_COMMIT);
} | java | {
"resource": ""
} |
q169834 | GitStatusResponseImpl.addToRenamedFilesToCommit | validation | public void addToRenamedFilesToCommit(File file) {
renamedFilesToCommit.add(file);
fileToStatus.put(file, Status.RENAMED_TO_COMMIT);
} | java | {
"resource": ""
} |
q169835 | GitStatusResponseImpl.addToUntrackedFiles | validation | public void addToUntrackedFiles(File file) {
untrackedFiles.add(file);
fileToStatus.put(file, Status.UNTRACKED);
} | java | {
"resource": ""
} |
q169836 | Parameter.create | validation | public static Parameter create(String name, Class<?> type, boolean required) throws IllegalArgumentException {
if (InjectedParameter.isValidType(type)) {
return new InjectedParameter(name, type);
}
if (type.isPrimitive() && !required) {
String msg = "Parameter [" + name + "] found with non-nullable type. Use a wrapper type or change to required";
throw new IllegalArgumentException(msg);
}
Parameter p;
if (type == String.class) {
p = new StringParameter(name, type);
} else if (type == Integer.class || type == int.class) {
p = new IntegerParameter(name, type);
} else if (type == Long.class || type == long.class) {
p = new LongParameter(name, type);
} else if (type == Float.class || type == float.class) {
p = new FloatParameter(name, type);
} else if (type == Double.class || type == double.class) {
p = new DoubleParameter(name, type);
} else if (type == Date.class) {
p = new DateParameter(name, type);
} else if (type == ResultSet.class || type == DataResultSet.class) {
p = new ResultSetParameter(name, type);
} else if (type == Boolean.class || type == boolean.class) {
p = new BooleanParameter(name, type);
} else if (type == Provider.class) {
p = new ProviderParameter(name);
} else {
throw new IllegalArgumentException("Parameter type " + type.getName() + " is not valid");
}
p.setRequired(required);
return p;
} | java | {
"resource": ""
} |
q169837 | Parameter.getStringValue | validation | public String getStringValue(DataBinder binder) {
// binder can't get a non existent param
if (this.name == null || this.name.equals("")) {
return null;
}
String value = (String) binder.getLocal(this.name);
if (value == null && this.required) {
throw new IllegalArgumentException("Parameter " + name + " is required");
}
return value;
} | java | {
"resource": ""
} |
q169838 | GitBranchOptions.setOptVerbose | validation | public void setOptVerbose(boolean optVerbose) {
checkCanSetNoArgOption("--verbose");
if ((false == optVerbose) && (optAbbrev || optNoAbbrev)) {
throw new IllegalArgumentException(ExceptionMessageMap.getMessage("000120")
+ " --no-abbrev or --abbrev can only be used with --verbose.");
}
this.optVerbose = optVerbose;
} | java | {
"resource": ""
} |
q169839 | GitBranchOptions.setOptDLower | validation | public void setOptDLower(boolean optDLower) {
checkCanSetDeleteOption("-d");
if (optDLower && optDUpper) {
throw new IllegalArgumentException(ExceptionMessageMap.getMessage("000120")
+ " -d cannot be used with -D.");
}
this.optDLower = optDLower;
} | java | {
"resource": ""
} |
q169840 | GitBranchOptions.setOptDUpper | validation | public void setOptDUpper(boolean optDUpper) {
checkCanSetDeleteOption("-D");
if (optDLower && optDUpper) {
throw new IllegalArgumentException(ExceptionMessageMap.getMessage("000120")
+ " -D cannot be used with -d.");
}
this.optDUpper = optDUpper;
} | java | {
"resource": ""
} |
q169841 | GitBranchOptions.setOptMLower | validation | public void setOptMLower(boolean optMLower) {
checkCanSetRenameOption("-m");
if (optMLower && optMUpper) {
throw new IllegalArgumentException(ExceptionMessageMap.getMessage("000120")
+ " -m cannot be used with -M.");
}
this.optMLower = optMLower;
} | java | {
"resource": ""
} |
q169842 | GitBranchOptions.setOptMUpper | validation | public void setOptMUpper(boolean optMUpper) {
checkCanSetRenameOption("-M");
if (optMLower && optMUpper) {
throw new IllegalArgumentException(ExceptionMessageMap.getMessage("000120")
+ " -M cannot be used with -m.");
}
this.optMUpper = optMUpper;
} | java | {
"resource": ""
} |
q169843 | ScriptProxy.getFunctionReturnType | validation | public Integer getFunctionReturnType(Method m) {
Class<?> type = m.getReturnType();
if (type == Void.class || type == void.class) {
return RETURN_VOID;
}
if (type == Boolean.class || type == boolean.class) {
return RETURN_BOOLEAN;
}
if (type == Integer.class || type == int.class || type == Long.class || type == long.class) {
return RETURN_INTEGER;
}
if (type == Float.class || type == float.class || type == Double.class || type == double.class) {
return RETURN_FLOAT;
}
return RETURN_STRING;
} | java | {
"resource": ""
} |
q169844 | ScriptProxy.evaluateFunction | validation | public boolean evaluateFunction(ScriptInfo info, Object[] args, ExecutionContext context) throws ServiceException {
/**
* This code below is optimized for speed, not clarity. Do not modify the
* code below when making new IdocScript functions. It is needed to prepare
* the necessary variables for the evaluation and return of the custom
* IdocScript functions. Only customize the switch statement below.
*/
int config[] = (int[]) info.m_entry;
String functionCalled = info.m_key;
int functionIndex = config[0];
int nargs = args.length - 1;
int allowedParams = config[1];
if (allowedParams >= 0 && allowedParams != nargs) {
String msg = LocaleUtils.encodeMessage("csScriptEvalNotEnoughArgs", null, functionCalled, "" + allowedParams);
throw new IllegalArgumentException(msg);
}
UserData userData = (UserData) context.getCachedObject("UserData");
if (userData == null) {
String msg = LocaleUtils.encodeMessage("csUserDataNotAvailable", null, functionCalled);
throw new ServiceException(msg);
}
if (functionIndex > m_functionTable.length) {
SystemUtils.trace("twine", "Unknown function with index" + functionIndex);
return false;
}
try {
args[nargs] = runFunctionMethod(functionIndex, args, context);
} catch (Exception e) {
String msg = e.getMessage();
if (e instanceof InvocationTargetException) {
msg = ((InvocationTargetException) e).getTargetException().getMessage();
}
msg = "Unable to execute function '" + functionCalled + "()': " + msg;
SystemUtils.err(e, msg);
SystemUtils.trace("twine", msg);
throw new ServiceException(e);
}
// Handled function.
return true;
} | java | {
"resource": ""
} |
q169845 | ScriptProxy.getInjectedValueArray | validation | public Object[] getInjectedValueArray(Method method, Object[] args, ExecutionContext ctx)
throws IllegalArgumentException, ServiceException {
ParameterMarshaller marshaller = new ParameterMarshaller(method);
if ((ctx instanceof Service) == false) {
throw new ServiceException("Tried to create parameters with injection and not inside a service.");
}
return marshaller.getValueArray(args, (Service) ctx);
} | java | {
"resource": ""
} |
q169846 | ScriptProxy.runFunctionMethod | validation | public Object runFunctionMethod(int functionIndex, Object[] args, ExecutionContext ctx) throws SecurityException,
NoSuchMethodException, IllegalArgumentException, ServiceException, IllegalAccessException,
InvocationTargetException {
Method method = functionMethods[functionIndex];
Object params[] = getInjectedValueArray(method, args, ctx);
Object result;
try {
result = method.invoke(m_class.newInstance(), params);
} catch (InstantiationException e) {
// TODO catch and re-throw ewwwww
throw new ServiceException("Cannot delegate instantiate script context: " + e.getMessage());
}
if (result == null) {
return result;
}
return convertReturnValue(result);
} | java | {
"resource": ""
} |
q169847 | ScriptProxy.convertReturnValue | validation | private Object convertReturnValue(Object result) {
if (boolean.class.isInstance(result) || result instanceof Boolean) {
return ScriptExtensionUtils.computeReturnObject(1, ((Boolean) result).booleanValue(), 0, 0.0, null);
} else if (long.class.isInstance(result)) {
return (Long) result;
} else if (int.class.isInstance(result) || result instanceof Integer) {
return new Long((Integer) result);
} else if (double.class.isInstance(result)) {
return (Double) result;
}
// String/Double/Long/Float
return result;
} | java | {
"resource": ""
} |
q169848 | ScriptProxy.evaluateValue | validation | public boolean evaluateValue(ScriptInfo info, boolean[] returnBool, String[] returnString, ExecutionContext context,
boolean isConditional) throws ServiceException {
/**
* This code, like the beginning block of code in evaluateFunction, is
* required for preparing the data for evaluation. It should not be altered.
* Only customize the switch statement below.
*/
int config[] = (int[]) info.m_entry;
String key = info.m_key;
if ((context instanceof Service) == false) {
// Some variables will evaluate trivially instead of throwing an
// exception.
if (config[1] == RETURN_BOOLEAN) {
returnBool[0] = false;
returnString[0] = "";
return true;
}
throw new ServiceException("Script variable " + key + " must have be evaluated in "
+ "context of a Service object.");
}
UserData userData = (UserData) context.getCachedObject("UserData");
if (userData == null) {
throw new ServiceException("Script variable " + key + " must have user data context.");
}
int variableIndex = config[0];
String variableRequested = m_variableTable[variableIndex];
if (variableIndex > m_variableTable.length) {
return false; // unknown variable
}
Object result = null;
try {
result = runVariableMethod(variableIndex, context);
} catch (Exception e) {
String msg = "Unable to handle variable " + variableRequested + ": " + e.getMessage();
SystemUtils.err(e, msg);
SystemUtils.trace("twine", msg);
throw new ServiceException(msg);
}
if (isConditional) {
returnBool[0] = ObjectConverter.convert(result, boolean.class);
} else {
returnString[0] = ObjectConverter.convert(result, String.class);
}
return true;
} | java | {
"resource": ""
} |
q169849 | GitBranch.branch | validation | public GitBranchResponse branch(File repositoryPath) throws IOException, JavaGitException {
CheckUtilities.checkNullArgument(repositoryPath, "repository path");
IClient client = ClientManager.getInstance().getPreferredClient();
IGitBranch gitBranch = client.getGitBranchInstance();
return gitBranch.branch(repositoryPath);
} | java | {
"resource": ""
} |
q169850 | GitBranch.deleteBranch | validation | public GitBranchResponse deleteBranch(File repositoryPath, boolean forceDelete, boolean remote,
Ref branchName) throws IOException, JavaGitException {
CheckUtilities.checkNullArgument(repositoryPath, "repository path");
CheckUtilities.checkNullArgument(branchName, "branch name");
CheckUtilities.validateArgumentRefType(branchName, Ref.RefType.BRANCH, "branch name");
IClient client = ClientManager.getInstance().getPreferredClient();
IGitBranch gitBranch = client.getGitBranchInstance();
return gitBranch.deleteBranch(repositoryPath, forceDelete, remote, branchName);
} | java | {
"resource": ""
} |
q169851 | GitBranch.deleteBranch | validation | public GitBranchResponse deleteBranch(File repositoryPath, boolean forceDelete, boolean remote,
List<Ref> branchList) throws IOException, JavaGitException {
CheckUtilities.checkNullArgument(repositoryPath, "repository path");
CheckUtilities.checkNullListArgument(branchList, "branch list");
CheckUtilities.validateListRefType(branchList, Ref.RefType.BRANCH, "branch list");
IClient client = ClientManager.getInstance().getPreferredClient();
IGitBranch gitBranch = client.getGitBranchInstance();
return gitBranch.deleteBranches(repositoryPath, forceDelete, remote, branchList);
} | java | {
"resource": ""
} |
q169852 | GitBranch.renameBranch | validation | public GitBranchResponse renameBranch(File repositoryPath, boolean forceRename, Ref newName)
throws IOException, JavaGitException {
CheckUtilities.checkNullArgument(repositoryPath, "repository path");
CheckUtilities.checkNullArgument(newName, "new name");
CheckUtilities.validateArgumentRefType(newName, Ref.RefType.BRANCH, "new name");
IClient client = ClientManager.getInstance().getPreferredClient();
IGitBranch gitBranch = client.getGitBranchInstance();
return gitBranch.renameBranch(repositoryPath, forceRename, newName);
} | java | {
"resource": ""
} |
q169853 | WorkingTree.commit | validation | public GitCommitResponse commit(String comment) throws IOException, JavaGitException {
GitCommit gitCommit = new GitCommit();
return gitCommit.commit(path, comment);
} | java | {
"resource": ""
} |
q169854 | WorkingTree.getCurrentBranch | validation | public Ref getCurrentBranch() throws IOException, JavaGitException {
GitBranch gitBranch = new GitBranch();
GitBranchOptions options = new GitBranchOptions();
GitBranchResponse response = gitBranch.branch(path, options);
return response.getCurrentBranch();
} | java | {
"resource": ""
} |
q169855 | WorkingTree.checkout | validation | public void checkout(Ref ref) throws IOException, JavaGitException {
GitCheckout gitCheckout = new GitCheckout();
gitCheckout.checkout(path, null, ref);
/*
* TODO (rs2705): Figure out why this function is setting this.path. When does the WorkingTree
* path change?
*/
// this.path = branch.getBranchRoot().getPath();
} | java | {
"resource": ""
} |
q169856 | WorkingTree.getStatus | validation | public GitStatusResponse getStatus() throws IOException, JavaGitException {
GitStatus gitStatus = new GitStatus();
return gitStatus.status(path);
} | java | {
"resource": ""
} |
q169857 | GitRm.rm | validation | public GitRmResponse rm(File repository, File path) throws IOException, JavaGitException {
CheckUtilities.checkNullArgument(repository, "repository");
CheckUtilities.checkNullArgument(path, "path");
IClient client = ClientManager.getInstance().getPreferredClient();
IGitRm GitRm = client.getGitRmInstance();
return GitRm.rm(repository, path);
} | java | {
"resource": ""
} |
q169858 | GitStatusResponse.getFileFromNewFilesToCommit | validation | public File getFileFromNewFilesToCommit(int index) {
CheckUtilities.checkIntIndexInListRange(newFilesToCommit, index);
return newFilesToCommit.get(index);
} | java | {
"resource": ""
} |
q169859 | GitStatusResponse.getFileFromDeletedFilesToCommit | validation | public File getFileFromDeletedFilesToCommit(int index) {
CheckUtilities.checkIntIndexInListRange(deletedFilesToCommit, index);
return deletedFilesToCommit.get(index);
} | java | {
"resource": ""
} |
q169860 | GitStatusResponse.getFileFromModifiedFilesToCommit | validation | public File getFileFromModifiedFilesToCommit(int index) {
CheckUtilities.checkIntIndexInListRange(modifiedFilesToCommit, index);
return modifiedFilesToCommit.get(index);
} | java | {
"resource": ""
} |
q169861 | GitStatusResponse.getFileFromDeletedFilesNotUpdated | validation | public File getFileFromDeletedFilesNotUpdated(int index) {
CheckUtilities.checkIntIndexInListRange(deletedFilesNotUpdated, index);
return deletedFilesNotUpdated.get(index);
} | java | {
"resource": ""
} |
q169862 | GitStatusResponse.getFileFromModifiedFilesNotUpdated | validation | public File getFileFromModifiedFilesNotUpdated(int index) {
CheckUtilities.checkIntIndexInListRange(modifiedFilesNotUpdated, index);
return modifiedFilesNotUpdated.get(index);
} | java | {
"resource": ""
} |
q169863 | GitStatusResponse.getFileFromUntrackedFiles | validation | public File getFileFromUntrackedFiles(int index) {
CheckUtilities.checkIntIndexInListRange(untrackedFiles, index);
return untrackedFiles.get(index);
} | java | {
"resource": ""
} |
q169864 | GitStatusResponse.getFileFromRenamedFiles | validation | public File getFileFromRenamedFiles(int index) {
CheckUtilities.checkIntIndexInListRange(renamedFilesToCommit, index);
return renamedFilesToCommit.get(index);
} | java | {
"resource": ""
} |
q169865 | GitStatusResponse.getError | validation | public String getError(int index) {
if (index < errors.size()) {
ErrorDetails errorDetails = errors.get(index);
return errorDetails.lineNumber + ". " + errorDetails.error;
}
return null;
} | java | {
"resource": ""
} |
q169866 | GitStatusResponse.getError | validation | public String getError() {
StringBuilder strBuilder = new StringBuilder();
for (int i = 0; i < errors.size(); i++) {
strBuilder.append(getError(i) + " ");
}
return strBuilder.toString();
} | java | {
"resource": ""
} |
q169867 | GitReset.gitReset | validation | public static GitResetResponse gitReset(File repository) throws IOException, JavaGitException {
CheckUtilities.checkNullArgument(repository, "repository");
IClient client = ClientManager.getInstance().getPreferredClient();
IGitReset gitReset = client.getGitResetInstance();
return gitReset.gitReset(repository);
} | java | {
"resource": ""
} |
q169868 | GitCommitResponseImpl.addAddedFile | validation | public boolean addAddedFile(File pathToFile, String mode) {
if (null == pathToFile) {
return false;
}
return addedFiles.add(new AddedOrDeletedFile(pathToFile, mode));
} | java | {
"resource": ""
} |
q169869 | GitCommitResponseImpl.addCopiedFile | validation | public boolean addCopiedFile(File sourceFilePath, File destinationFilePath, int percentage) {
if (null == sourceFilePath || null == destinationFilePath) {
return false;
}
return copiedFiles.add(new CopiedOrMovedFile(sourceFilePath, destinationFilePath, percentage));
} | java | {
"resource": ""
} |
q169870 | GitCommitResponseImpl.addDeletedFile | validation | public boolean addDeletedFile(File pathToFile, String mode) {
if (null == pathToFile) {
return false;
}
return deletedFiles.add(new AddedOrDeletedFile(pathToFile, mode));
} | java | {
"resource": ""
} |
q169871 | GitCommitResponseImpl.setFilesChanged | validation | public boolean setFilesChanged(String filesChangedStr) {
try {
this.filesChanged = Integer.parseInt(filesChangedStr);
return true;
} catch (NumberFormatException e) {
return false;
}
} | java | {
"resource": ""
} |
q169872 | GitCommitResponseImpl.setLinesDeleted | validation | public boolean setLinesDeleted(String linesDeletedStr) {
try {
this.linesDeleted = Integer.parseInt(linesDeletedStr);
return true;
} catch (NumberFormatException e) {
return false;
}
} | java | {
"resource": ""
} |
q169873 | GitCommitResponseImpl.setLinesInserted | validation | public boolean setLinesInserted(String linesInsertedStr) {
try {
this.linesInserted = Integer.parseInt(linesInsertedStr);
return true;
} catch (NumberFormatException e) {
return false;
}
} | java | {
"resource": ""
} |
q169874 | CliGitMv.mvProcess | validation | public GitMvResponseImpl mvProcess(File repoPath, GitMvOptions options, List<File> source,
File destination) throws IOException, JavaGitException {
List<String> commandLine = buildCommand(options, source, destination);
GitMvParser parser = new GitMvParser();
return (GitMvResponseImpl) ProcessUtilities.runCommand(repoPath, commandLine, parser);
} | java | {
"resource": ""
} |
q169875 | StringUtilities.indexOfLeft | validation | public static int indexOfLeft(String str, int from, char c) {
int pos = -1;
int f = from;
while( f >= 0 && pos == -1 )
if ( str.charAt(f--) == c )
pos = f+1;
return pos;
} | java | {
"resource": ""
} |
q169876 | ResultSetParameter.getResultSet | validation | private DataResultSet getResultSet(String name, Service service) {
ResultSet rs = service.getBinder().getResultSet(name);
DataResultSet drs = new DataResultSet();
if (rs != null) {
drs.copy(rs);
return drs;
}
return null;
} | java | {
"resource": ""
} |
q169877 | CliGitLog.log | validation | public List<Commit> log(File repositoryPath, GitLogOptions options)
throws JavaGitException, IOException {
CheckUtilities.checkFileValidity(repositoryPath);
GitLogParser parser = new GitLogParser();
List<String> command = buildCommand(repositoryPath, options);
GitLogResponse response = (GitLogResponse) ProcessUtilities.runCommand(repositoryPath,
command, parser);
if (response.containsError()) {
int line = response.getError(0).getLineNumber();
String error = response.getError(0).error();
throw new JavaGitException(420001, "Line " + line + ", " + error);
}
return response.getLog();
} | java | {
"resource": ""
} |
q169878 | GitLogResponse.addCommit | validation | public void addCommit(){
if(this.sha!=null){
Commit commit = new Commit(this.sha, this.mergeDetails, this.author, this.dateString,
this.message, this.files);
if (commitList == null){
commitList = new ArrayList<Commit>();
}
this.commitList.add(commit);
//reset variables for future commits.
this.files = null;
this.mergeDetails = null;
this.message = null;
}
} | java | {
"resource": ""
} |
q169879 | GitLogResponse.addFile | validation | public void addFile(String filename,int linesAdded, int linesDeleted){
CommitFile commitFile = new CommitFile(filename, linesAdded, linesDeleted);
if (files == null){
files = new ArrayList<CommitFile>();
}
this.files.add(commitFile);
} | java | {
"resource": ""
} |
q169880 | CliGitCheckout.checkout | validation | public GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref ref)
throws JavaGitException, IOException {
CheckUtilities.checkFileValidity(repositoryPath);
checkRefAgainstRefType(ref, RefType.HEAD);
List<String> command = buildCommand(options, ref);
GitCheckoutParser parser = new GitCheckoutParser();
GitCheckoutResponse response = (GitCheckoutResponse) ProcessUtilities.runCommand(repositoryPath,
command, parser);
return response;
} | java | {
"resource": ""
} |
q169881 | CliGitCheckout.checkout | validation | public GitCheckoutResponse checkout(File repositoryPath) throws JavaGitException, IOException {
GitCheckoutOptions options = null;
return checkout(repositoryPath, options, null);
} | java | {
"resource": ""
} |
q169882 | CliGitCheckout.checkout | validation | public GitCheckoutResponse checkout(File repositoryPath, Ref branch) throws JavaGitException,
IOException {
return checkout(repositoryPath, null, branch);
} | java | {
"resource": ""
} |
q169883 | CliGitCheckout.checkout | validation | public GitCheckoutResponse checkout(File repositoryPath, List<File> paths)
throws JavaGitException, IOException {
CheckUtilities.checkFileValidity(repositoryPath);
CheckUtilities.checkNullListArgument(paths, "list of file paths");
GitCheckoutParser parser = new GitCheckoutParser();
List<String> command = buildCommand(null, null, paths);
GitCheckoutResponse response = (GitCheckoutResponse) ProcessUtilities.runCommand(repositoryPath,
command, parser);
return response;
} | java | {
"resource": ""
} |
q169884 | CliGitCheckout.checkout | validation | public GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref ref,
List<File> paths) throws JavaGitException, IOException {
CheckUtilities.checkFileValidity(repositoryPath);
if (ref != null && ref.getRefType() == RefType.HEAD) {
throw new IllegalArgumentException("Invalid ref type passed as argument to checkout");
}
GitCheckoutParser parser = new GitCheckoutParser();
List<String> command = buildCommand(options, ref, paths);
return (GitCheckoutResponse) ProcessUtilities.runCommand(repositoryPath, command, parser);
} | java | {
"resource": ""
} |
q169885 | CliGitCheckout.checkout | validation | public GitCheckoutResponse checkout(File repositoryPath, GitCheckoutOptions options, Ref branch,
File path) throws JavaGitException, IOException {
CheckUtilities.checkFileValidity(repositoryPath);
GitCheckoutParser parser = new GitCheckoutParser();
List<File> paths = new ArrayList<File>();
paths.add(path);
List<String> command = buildCommand(options, branch, paths);
GitCheckoutResponse response = (GitCheckoutResponse) ProcessUtilities.runCommand(repositoryPath,
command, parser);
return response;
} | java | {
"resource": ""
} |
q169886 | CliGitCheckout.checkRefAgainstRefType | validation | private void checkRefAgainstRefType(Ref ref, RefType refType) {
if (ref != null && ref.getRefType() == refType) {
throw new IllegalArgumentException("Invalid ref type passed as argument to checkout");
}
} | java | {
"resource": ""
} |
q169887 | GitDirectory.getChildren | validation | public List<GitFileSystemObject> getChildren() throws IOException, JavaGitException {
List<GitFileSystemObject> children = new ArrayList<GitFileSystemObject>();
// get all of the file system objects currently located under this directory
for (File memberFile : file.listFiles()) {
// check if this file is hidden also some times the .git and
//other unix hidden directories are not hidden in Windows
if (memberFile.isHidden()||memberFile.getName().startsWith(".")) {
// ignore (could be .git directory)
continue;
}
// now, just check for the type of the filesystem object
if (memberFile.isDirectory()) {
children.add(new GitDirectory(memberFile, workingTree));
} else {
children.add(new GitFile(memberFile, workingTree));
}
}
return children;
} | java | {
"resource": ""
} |
q169888 | GitRmResponse.getRemovedFile | validation | public File getRemovedFile(int index) {
CheckUtilities.checkIntIndexInListRange(removedFiles, index);
return removedFiles.get(index);
} | java | {
"resource": ""
} |
q169889 | GitCheckout.checkout | validation | public GitCheckoutResponse checkout(File repositoryPath, List<File> paths) throws IOException,
JavaGitException {
CheckUtilities.checkFileValidity(repositoryPath);
CheckUtilities.checkNullListArgument(paths, "List of Paths");
IClient client = ClientManager.getInstance().getPreferredClient();
IGitCheckout gitCheckout = client.getGitCheckoutInstance();
return gitCheckout.checkout(repositoryPath, paths);
} | java | {
"resource": ""
} |
q169890 | GitCheckout.checkout | validation | public GitCheckoutResponse checkout(File repositoryPath, Ref ref, List<File> paths)
throws JavaGitException, IOException {
CheckUtilities.checkFileValidity(repositoryPath);
if ( ref != null && ( ref.getRefType() != RefType.BRANCH && ref.getRefType() != RefType.SHA1) ) {
throw new JavaGitException(100000, ExceptionMessageMap.getMessage("100000")
+ " RefType passed: " + ref.getRefType());
}
CheckUtilities.checkNullListArgument(paths, "List of files");
IClient client = ClientManager.getInstance().getPreferredClient();
IGitCheckout gitCheckout = client.getGitCheckoutInstance();
return gitCheckout.checkout(repositoryPath, ref, paths);
} | java | {
"resource": ""
} |
q169891 | GitAddResponseImpl.setComment | validation | public void setComment(int lineNumber, String commentString) {
ResponseString comment = new ResponseString(lineNumber, commentString);
comments.add(comment);
} | java | {
"resource": ""
} |
q169892 | CliGitBranch.setDeleteOptions | validation | public void setDeleteOptions(GitBranchOptions options, boolean forceDelete, boolean remote) {
if (forceDelete) {
options.setOptDUpper(true);
} else {
options.setOptDLower(true);
}
if (remote) {
options.setOptR(true);
}
} | java | {
"resource": ""
} |
q169893 | ServiceInjector.inject | validation | @Override
public void inject(Class<?> klass) throws DataException {
Method[] classMethods = klass.getMethods();
for (Method method : classMethods) {
ServiceMethod annotation = (ServiceMethod) method.getAnnotation(ServiceMethod.class);
if (annotation != null) {
injectServiceMethod(method, annotation);
}
}
} | java | {
"resource": ""
} |
q169894 | ServiceInjector.injectServiceMethod | validation | private static void injectServiceMethod(Method method, ServiceMethod annotation) throws DataException {
ServiceData serviceData = new ServiceData();
String template = annotation.template();
int accessLevel = annotation.accessLevel();
String serviceType = (!annotation.type().equals("")) ? annotation.type() : null;
String errorMessage = annotation.errorMessage();
String subjects = annotation.subjects();
String serviceName = annotation.name();
try {
serviceData.init(serviceName, ServiceProxy.class.getName(), accessLevel, template, serviceType, errorMessage,
subjects);
} catch (Exception e) {
throw new DataException("Cannot create ServiceData object for " + serviceName + " - " + e.getMessage());
}
// action parameters, none by default
String controlFlags = "";
String methodHashCode = MethodRegistry.addMethod(method);
if (methodHashCode == null) {
throw new DataException("Cannot register method " + method.toString() + " because it has a null hashCode");
}
try {
serviceData.addAction(Action.CODE_TYPE, "delegateWithParameters", methodHashCode, controlFlags, "");
} catch (DataException e) {
throw new DataException("Cannot add defaut action to service" + serviceName + " - " + e.getMessage());
}
// inject service
ServiceManager.putService(serviceName, serviceData);
} | java | {
"resource": ""
} |
q169895 | GitCheckoutOptions.setOptB | validation | public void setOptB(Ref newBranch) {
CheckUtilities.validateArgumentRefType(newBranch, RefType.BRANCH, "New Branch Name");
optB = newBranch;
} | java | {
"resource": ""
} |
q169896 | CliGitClone.cloneProcess | validation | public GitCloneResponseImpl cloneProcess(File workingDirectoryPath, GitCloneOptions options,
URL repository, File directory) throws IOException, JavaGitException {
List<String> commandLine = buildCommand(options, repository, directory);
GitCloneParser parser = new GitCloneParser();
return (GitCloneResponseImpl) ProcessUtilities.runCommand(workingDirectoryPath, commandLine, parser);
} | java | {
"resource": ""
} |
q169897 | Bootstrapper.doFilter | validation | public int doFilter(Workspace ws, DataBinder binder, ExecutionContext ctx) throws DataException, ServiceException {
String configFileName = (String) ctx.getCachedObject("filterParameter");
try {
ClassLoader cl = getClass().getClassLoader();
Enumeration<URL> propFiles = cl.getResources(configFileName);
// There should be at least one entry (TwineLib contains an example file)
if (!propFiles.hasMoreElements()) {
propFiles = getResources11g(cl, configFileName);
}
while (propFiles.hasMoreElements()) {
URL propFile = propFiles.nextElement();
if (SystemUtils.m_verbose) {
SystemUtils.trace("twine", "Loading config file: " + propFile.toString());
}
IClassInjector filterInjector = new FilterInjector();
filterInjector.injectClasses(propFile);
IClassInjector serviceInjector = new ServiceInjector();
serviceInjector.injectClasses(propFile);
IClassInjector scriptInjector = new IdocScriptInjector();
scriptInjector.injectClasses(propFile);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return CONTINUE;
} | java | {
"resource": ""
} |
q169898 | Bootstrapper.getResources11g | validation | private Enumeration<URL> getResources11g(ClassLoader classLoader, String configFileName) {
List<URL> newProps = new ArrayList<URL>();
if (classLoader.getClass().getSimpleName().equalsIgnoreCase("IdcClassLoader")) {
try {
Field field = classLoader.getClass().getField("m_zipfiles");
@SuppressWarnings("unchecked")
Map<String, IdcZipFile> zipFiles = (Map<String, IdcZipFile>) field.get(classLoader);
for (Entry<String, IdcZipFile> entry : zipFiles.entrySet()) {
if (entry.getValue().m_entries.get(configFileName) != null) {
String jarFile = entry.getKey();
// windows needs a slash before the C:/
if (!jarFile.startsWith("/")) {
jarFile = "/" + jarFile;
}
try {
URL u = new URL("jar:file:" + entry.getKey() + "!/" + configFileName);
newProps.add(u);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
} catch (Exception e) {
// If there is any exception the ClassLoader is an unrecognised format
e.printStackTrace();
}
}
return Collections.enumeration(newProps);
} | java | {
"resource": ""
} |
q169899 | GitResetOptions.setup | validation | private void setup(ResetType resetType, Ref commitName) {
CheckUtilities.checkNullArgument(resetType, "resetType");
CheckUtilities.checkNullArgument(commitName, "commitName");
this.resetType = resetType;
this.commitName = commitName;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.