_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q159600
DefaultFFMPEGLocator.copyFile
train
private void copyFile(String path, File dest) { String resourceName= "native/" + path; try { LOG.debug("Copy from resource <"+resourceName+"> to target <"+dest.getAbsolutePath()+">"); if (copy(getClass().getResourceAsStream(resourceName), dest.getAbsolutePath())) ...
java
{ "resource": "" }
q159601
DefaultFFMPEGLocator.copy
train
private boolean copy(InputStream source, String destination) { boolean success = true; try { Files.copy(source, Paths.get(destination), StandardCopyOption.REPLACE_EXISTING); } catch (IOException ex) { LOG.fatal("Cannot write file " + destination, ...
java
{ "resource": "" }
q159602
GitHubProjectMojo.debug
train
protected void debug(String message) { final Log log = getLog(); if (log != null) log.debug(message); }
java
{ "resource": "" }
q159603
GitHubProjectMojo.debug
train
protected void debug(String message, Throwable throwable) { final Log log = getLog(); if (log != null) log.debug(message, throwable); }
java
{ "resource": "" }
q159604
GitHubProjectMojo.info
train
protected void info(String message) { final Log log = getLog(); if (log != null) log.info(message); }
java
{ "resource": "" }
q159605
GitHubProjectMojo.configureOAuth2Token
train
protected boolean configureOAuth2Token(final GitHubClient client, final String oauth2Token) { if (StringUtils.isEmpty(oauth2Token)) return false; if (isDebug()) debug("Using OAuth2 access token authentication"); client.setOAuth2Token(oauth2Token); return true; }
java
{ "resource": "" }
q159606
GitHubProjectMojo.configureServerCredentials
train
protected boolean configureServerCredentials(final GitHubClient client, final String serverId, final Settings settings, final MavenSession session) throws MojoExecutionException { if (StringUtils.isEmpty(serverId)) return false; String serverUsername = null; String serverPassword = null; // Mav...
java
{ "resource": "" }
q159607
GitHubProjectMojo.getServer
train
protected Server getServer(final Settings settings, final String serverId) { if (settings == null) return null; List<Server> servers = settings.getServers(); if (servers == null || servers.isEmpty()) return null; for (Server server : servers) if (serverId.equals(server.getId())) return server; r...
java
{ "resource": "" }
q159608
GitHubProjectMojo.matchNonProxy
train
protected boolean matchNonProxy( final Proxy proxy, final String hostname ) { String host = hostname; if ( null == hostname ) host = IGitHubConstants.HOST_DEFAULT; // IGitHubConstants.HOST_API; // code from org.apache.maven.plugins.site.AbstractDeployMojo#getProxyInfo final String nonProxyHosts = proxy.ge...
java
{ "resource": "" }
q159609
GitHubProjectMojo.getProxy
train
protected Proxy getProxy(final Settings settings, final String serverId, final String host) { if (settings == null) return null; List<Proxy> proxies = settings.getProxies(); if (proxies == null || proxies.isEmpty()) return null; // search id match first if ( serverId != null && !serverId.isEmpty() ) { ...
java
{ "resource": "" }
q159610
RepositoryUtils.extractRepositoryFromScmUrl
train
public static RepositoryId extractRepositoryFromScmUrl(String url) { if (StringUtils.isEmpty(url)) return null; int ghIndex = url.indexOf(HOST_DEFAULT); if (ghIndex == -1 || ghIndex + 1 >= url.length()) return null; if (!url.endsWith(SUFFIX_GIT)) return null; url = url.substring(ghIndex + HOST_DEFAUL...
java
{ "resource": "" }
q159611
StringUtils.isEmpty
train
public static boolean isEmpty(final String... values) { if (values == null || values.length == 0) return true; for (String value : values) if (value == null || value.length() == 0) return true; return false; }
java
{ "resource": "" }
q159612
ExtendedColorPicker.updateValuesFromHSVFields
train
@Override protected void updateValuesFromHSVFields () { int[] hsv = ColorUtils.RGBtoHSV(color); int h = hsv[0]; int s = hsv[1]; int v = hsv[2]; if (hBar.isInputValid()) h = hBar.getValue(); if (sBar.isInputValid()) s = sBar.getValue(); if (vBar.isInputValid()) v = vBar.getValue(); color = ColorUtils....
java
{ "resource": "" }
q159613
ExtendedColorPicker.updateValuesFromRGBFields
train
private void updateValuesFromRGBFields () { int r = MathUtils.round(color.r * 255.0f); int g = MathUtils.round(color.g * 255.0f); int b = MathUtils.round(color.b * 255.0f); if (rBar.isInputValid()) r = rBar.getValue(); if (gBar.isInputValid()) g = gBar.getValue(); if (bBar.isInputValid()) b = bBar.getValue...
java
{ "resource": "" }
q159614
HighlightTextArea.processHighlighter
train
public void processHighlighter () { if (highlights == null) return; highlights.clear(); if (highlighter != null) highlighter.process(this, highlights); chunkUpdateScheduled = true; }
java
{ "resource": "" }
q159615
SimpleFormValidator.notEmpty
train
public FormInputValidator notEmpty (VisValidatableTextField field, String errorMsg) { EmptyInputValidator validator = new EmptyInputValidator(errorMsg); field.addValidator(validator); add(field); return validator; }
java
{ "resource": "" }
q159616
SimpleFormValidator.integerNumber
train
public FormInputValidator integerNumber (VisValidatableTextField field, String errorMsg) { ValidatorWrapper wrapper = new ValidatorWrapper(errorMsg, Validators.INTEGERS); field.addValidator(wrapper); add(field); return wrapper; }
java
{ "resource": "" }
q159617
SimpleFormValidator.floatNumber
train
public FormInputValidator floatNumber (VisValidatableTextField field, String errorMsg) { ValidatorWrapper wrapper = new ValidatorWrapper(errorMsg, Validators.FLOATS); field.addValidator(wrapper); add(field); return wrapper; }
java
{ "resource": "" }
q159618
SimpleFormValidator.custom
train
public FormInputValidator custom (VisValidatableTextField field, FormInputValidator customValidator) { field.addValidator(customValidator); add(field); return customValidator; }
java
{ "resource": "" }
q159619
SimpleFormValidator.validate
train
public void validate () { formInvalid = false; errorMsgText = null; for (CheckedButtonWrapper wrapper : buttons) { if (wrapper.button.isChecked() != wrapper.mustBeChecked) { wrapper.setButtonStateInvalid(true); } else { wrapper.setButtonStateInvalid(false); } } for (CheckedButtonWrapper wra...
java
{ "resource": "" }
q159620
VisTextArea.sizeChanged
train
@Override protected void sizeChanged () { lastText = null; // Cause calculateOffsets to recalculate the line breaks. // The number of lines showed must be updated whenever the height is updated BitmapFont font = style.font; Drawable background = style.background; float availableHeight = getHeight() - (backg...
java
{ "resource": "" }
q159621
FormValidator.fileExists
train
public FormInputValidator fileExists (VisValidatableTextField field, String errorMsg) { FileExistsValidator validator = new FileExistsValidator(errorMsg); field.addValidator(validator); add(field); return validator; }
java
{ "resource": "" }
q159622
FormValidator.fileExists
train
public FormInputValidator fileExists (VisValidatableTextField field, FileHandle relativeTo, String errorMsg) { FileExistsValidator validator = new FileExistsValidator(relativeTo.file(), errorMsg); field.addValidator(validator); add(field); return validator; }
java
{ "resource": "" }
q159623
FormValidator.directory
train
public FormInputValidator directory (VisValidatableTextField field, String errorMsg) { DirectoryValidator validator = new DirectoryValidator(errorMsg); field.addValidator(validator); add(field); return validator; }
java
{ "resource": "" }
q159624
FormValidator.directoryEmpty
train
public FormInputValidator directoryEmpty (VisValidatableTextField field, String errorMsg) { DirectoryContentValidator validator = new DirectoryContentValidator(errorMsg, true); field.addValidator(validator); add(field); return validator; }
java
{ "resource": "" }
q159625
FormValidator.directoryNotEmpty
train
public FormInputValidator directoryNotEmpty (VisValidatableTextField field, String errorMsg) { DirectoryContentValidator validator = new DirectoryContentValidator(errorMsg, false); field.addValidator(validator); add(field); return validator; }
java
{ "resource": "" }
q159626
TabbedPane.remove
train
public boolean remove (final Tab tab, boolean ignoreTabDirty) { checkIfTabsBelongsToThisPane(tab); if (ignoreTabDirty) { return removeTab(tab); } if (tab.isDirty() && mainTable.getStage() != null) { Dialogs.showOptionDialog(mainTable.getStage(), Text.UNSAVED_DIALOG_TITLE.get(), Text.UNSAVED_DIALOG_TEXT....
java
{ "resource": "" }
q159627
TabbedPane.removeAll
train
public void removeAll () { for (Tab tab : tabs) { tab.setPane(null); tab.onHide(); tab.dispose(); } tabs.clear(); tabsButtonMap.clear(); tabsPane.clear(); notifyListenersRemovedAll(); }
java
{ "resource": "" }
q159628
Menu.setMenuBar
train
void setMenuBar (MenuBar menuBar) { if (this.menuBar != null && menuBar != null) throw new IllegalStateException("Menu was already added to MenuBar"); this.menuBar = menuBar; }
java
{ "resource": "" }
q159629
VisWindow.centerWindow
train
public boolean centerWindow () { Group parent = getParent(); if (parent == null) { centerOnAdd = true; return false; } else { moveToCenter(); return true; } }
java
{ "resource": "" }
q159630
VisWindow.fadeOut
train
public void fadeOut (float time) { if (fadeOutActionRunning) return; fadeOutActionRunning = true; final Touchable previousTouchable = getTouchable(); setTouchable(Touchable.disabled); Stage stage = getStage(); if (stage != null && stage.getKeyboardFocus() != null && stage.getKeyboardFocus().isDescendantOf(t...
java
{ "resource": "" }
q159631
Dialogs.showOKDialog
train
public static VisDialog showOKDialog (Stage stage, String title, String text) { final VisDialog dialog = new VisDialog(title); dialog.closeOnEscape(); dialog.text(text); dialog.button(ButtonType.OK.getText()).padBottom(3); dialog.pack(); dialog.centerWindow(); dialog.addListener(new InputListener() { @...
java
{ "resource": "" }
q159632
Dialogs.showOptionDialog
train
public static OptionDialog showOptionDialog (Stage stage, String title, String text, OptionDialogType type, OptionDialogListener listener) { OptionDialog dialog = new OptionDialog(title, text, type, listener); stage.addActor(dialog.fadeIn()); return dialog; }
java
{ "resource": "" }
q159633
Dialogs.showInputDialog
train
public static InputDialog showInputDialog (Stage stage, String title, String fieldTitle, InputDialogListener listener) { InputDialog dialog = new InputDialog(title, fieldTitle, true, null, listener); stage.addActor(dialog.fadeIn()); return dialog; }
java
{ "resource": "" }
q159634
Dialogs.showErrorDialog
train
public static DetailsDialog showErrorDialog (Stage stage, String text) { return showErrorDialog(stage, text, (String) null); }
java
{ "resource": "" }
q159635
Dialogs.showErrorDialog
train
public static DetailsDialog showErrorDialog (Stage stage, String text, Throwable exception) { if (exception == null) return showErrorDialog(stage, text, (String) null); else return showErrorDialog(stage, text, getStackTrace(exception)); }
java
{ "resource": "" }
q159636
Dialogs.showErrorDialog
train
public static DetailsDialog showErrorDialog (Stage stage, String text, String details) { DetailsDialog dialog = new DetailsDialog(text, Text.ERROR.get(), details); stage.addActor(dialog.fadeIn()); return dialog; }
java
{ "resource": "" }
q159637
MessageToast.addLinkLabel
train
public void addLinkLabel (String text, LinkLabel.LinkLabelListener labelListener) { LinkLabel label = new LinkLabel(text); label.setListener(labelListener); linkLabelTable.add(label).spaceRight(12); }
java
{ "resource": "" }
q159638
FloatSpinnerModel.setMin
train
public void setMin (BigDecimal min) { if (min.compareTo(max) > 0) throw new IllegalArgumentException("min can't be > max"); this.min = min; if (min.compareTo(BigDecimal.ZERO) >= 0) { textFieldFilter.setAcceptNegativeValues(false); } else { textFieldFilter.setAcceptNegativeValues(true); } if (curren...
java
{ "resource": "" }
q159639
ColorUtils.HSVtoRGB
train
public static Color HSVtoRGB (float h, float s, float v, float alpha) { Color c = HSVtoRGB(h, s, v); c.a = alpha; return c; }
java
{ "resource": "" }
q159640
ColorUtils.RGBtoHSV
train
public static int[] RGBtoHSV (float r, float g, float b) { float h, s, v; float min, max, delta; min = Math.min(Math.min(r, g), b); max = Math.max(Math.max(r, g), b); v = max; delta = max - min; if (max != 0) s = delta / max; else { s = 0; h = 0; return new int[]{MathUtils.round(h), MathU...
java
{ "resource": "" }
q159641
BaseHighlighter.word
train
public void word (Color color, String... words) { for (String word : words) { addRule(new WordHighlightRule(color, word)); } }
java
{ "resource": "" }
q159642
BaseHighlighter.process
train
public void process (HighlightTextArea textArea, Array<Highlight> highlights) { for (HighlightRule rule : rules) { rule.process(textArea, highlights); } }
java
{ "resource": "" }
q159643
BasicColorPicker.updateValuesFromCurrentColor
train
protected void updateValuesFromCurrentColor () { int[] hsv = ColorUtils.RGBtoHSV(color); int ch = hsv[0]; int cs = hsv[1]; int cv = hsv[2]; verticalBar.setValue(ch); palette.setValue(cs, cv); }
java
{ "resource": "" }
q159644
BasicColorPicker.setColor
train
@Override public void setColor (Color newColor) { if (allowAlphaEdit == false) newColor.a = 1; //this method overrides setColor in Actor, not big deal we definitely don't need it setColor(newColor, true); }
java
{ "resource": "" }
q159645
Tooltip.removeTooltip
train
public static void removeTooltip (Actor target) { Array<EventListener> listeners = target.getListeners(); for (EventListener listener : listeners) { if (listener instanceof TooltipInputListener) target.removeListener(listener); } }
java
{ "resource": "" }
q159646
Tooltip.setText
train
public void setText (String text) { if (content instanceof VisLabel) { ((VisLabel) content).setText(text); } else { setContent(new VisLabel(text)); } pack(); }
java
{ "resource": "" }
q159647
MultiSplitPane.setWidgets
train
public void setWidgets (Iterable<Actor> actors) { clearChildren(); widgetBounds.clear(); scissors.clear(); handleBounds.clear(); splits.clear(); for (Actor actor : actors) { super.addActor(actor); widgetBounds.add(new Rectangle()); scissors.add(new Rectangle()); } float currentSplit = 0; flo...
java
{ "resource": "" }
q159648
ToastManager.show
train
public void show (String text, float timeSec) { VisTable table = new VisTable(); table.add(text).grow(); show(table, timeSec); }
java
{ "resource": "" }
q159649
ToastManager.show
train
public void show (final Toast toast, float timeSec) { Table toastMainTable = toast.getMainTable(); if (toastMainTable.getStage() != null) { remove(toast); } toasts.add(toast); toast.setToastManager(this); toast.fadeIn(); toastMainTable.pack(); root.addActor(toastMainTable); updateToastsPositions(...
java
{ "resource": "" }
q159650
ToastManager.remove
train
public boolean remove (Toast toast) { boolean removed = toasts.removeValue(toast, true); if (removed) { toast.getMainTable().remove(); Timer.Task timerTask = timersTasks.remove(toast); if (timerTask != null) timerTask.cancel(); updateToastsPositions(); } return removed; }
java
{ "resource": "" }
q159651
CursorManager.restoreDefaultCursor
train
public static void restoreDefaultCursor () { if (systemCursorAsDefault) { Gdx.graphics.setSystemCursor(defaultSystemCursor); } else { Gdx.graphics.setCursor(defaultCursor); } }
java
{ "resource": "" }
q159652
VisDialog.text
train
public VisDialog text (String text) { if (skin == null) throw new IllegalStateException("This method may only be used if the dialog was constructed with a Skin."); return text(text, skin.get(LabelStyle.class)); }
java
{ "resource": "" }
q159653
VisDialog.text
train
public VisDialog text (String text, LabelStyle labelStyle) { return text(new Label(text, labelStyle)); }
java
{ "resource": "" }
q159654
VisDialog.button
train
public VisDialog button (String text, Object object) { if (skin == null) throw new IllegalStateException("This method may only be used if the dialog was constructed with a Skin."); return button(text, object, skin.get(VisTextButtonStyle.class)); }
java
{ "resource": "" }
q159655
VisDialog.button
train
public VisDialog button (String text, Object object, VisTextButtonStyle buttonStyle) { return button(new VisTextButton(text, buttonStyle), object); }
java
{ "resource": "" }
q159656
VisDialog.button
train
public VisDialog button (Button button, Object object) { buttonTable.add(button); setObject(button, object); return this; }
java
{ "resource": "" }
q159657
VisDialog.hide
train
public void hide (Action action) { Stage stage = getStage(); if (stage != null) { removeListener(focusListener); if (previousKeyboardFocus != null && previousKeyboardFocus.getStage() == null) previousKeyboardFocus = null; Actor actor = stage.getKeyboardFocus(); if (actor == null || actor.isDescendantOf(...
java
{ "resource": "" }
q159658
VisDialog.hide
train
public void hide () { hide(sequence(Actions.fadeOut(FADE_TIME, Interpolation.fade), Actions.removeListener(ignoreTouchDown, true), Actions.removeActor())); }
java
{ "resource": "" }
q159659
AsyncTask.executeOnGdx
train
protected void executeOnGdx (final Runnable runnable) { final CountDownLatch latch = new CountDownLatch(1); final AtomicReference<Exception> exceptionAt = new AtomicReference<Exception>(); Gdx.app.postRunnable(new Runnable() { @Override public void run () { try { runnable.run(); } catch (Exce...
java
{ "resource": "" }
q159660
SimpleFloatSpinnerModel.setMin
train
public void setMin (float min) { if (min > max) throw new IllegalArgumentException("min can't be > max"); this.min = min; if (min >= 0) { textFieldFilter.setAcceptNegativeValues(false); } else { textFieldFilter.setAcceptNegativeValues(true); } if (current < min) { current = min; spinner.notif...
java
{ "resource": "" }
q159661
ArraySpinnerModel.invalidateDataSet
train
public void invalidateDataSet () { updateCurrentItem(MathUtils.clamp(currentIndex, 0, items.size - 1)); spinner.notifyValueChanged(true); }
java
{ "resource": "" }
q159662
ArraySpinnerModel.setItems
train
public void setItems (Array<T> newItems) { items.clear(); items.addAll(newItems); currentIndex = 0; invalidateDataSet(); }
java
{ "resource": "" }
q159663
FileUtils.isValidFileName
train
public static boolean isValidFileName (String name) { try { if (OsUtils.isWindows()) { if (name.contains(">") || name.contains("<")) return false; name = name.toLowerCase(); //Windows is case insensitive } return new File(name).getCanonicalFile().getName().equals(name); } catch (Exception e) { r...
java
{ "resource": "" }
q159664
FileUtils.showDirInExplorer
train
@SuppressWarnings("unchecked") public static void showDirInExplorer (FileHandle dir) throws IOException { File dirToShow; if (dir.isDirectory()) { dirToShow = dir.file(); } else { dirToShow = dir.parent().file(); } if (OsUtils.isMac()) { FileManager.revealInFinder(dirToShow); } else { try { ...
java
{ "resource": "" }
q159665
PopupMenu.getDefaultInputListener
train
public InputListener getDefaultInputListener (final int mouseButton) { if (defaultInputListener == null) { defaultInputListener = new InputListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { return true; } @Override public void t...
java
{ "resource": "" }
q159666
PopupMenu.showMenu
train
public void showMenu (Stage stage, float x, float y) { setPosition(x, y - getHeight()); if (stage.getHeight() - getY() > stage.getHeight()) setY(getY() + getHeight()); ActorUtils.keepWithinStage(stage, this); stage.addActor(this); }
java
{ "resource": "" }
q159667
PopupMenu.setActiveSubMenu
train
void setActiveSubMenu (PopupMenu newSubMenu) { if (activeSubMenu == newSubMenu) return; if (activeSubMenu != null) activeSubMenu.remove(); activeSubMenu = newSubMenu; if (newSubMenu != null) { newSubMenu.setParentMenu(this); } }
java
{ "resource": "" }
q159668
ScrollableTextArea.createCompatibleScrollPane
train
public ScrollPane createCompatibleScrollPane () { VisScrollPane scrollPane = new VisScrollPane(this); scrollPane.setOverscroll(false, false); scrollPane.setFlickScroll(false); scrollPane.setFadeScrollBars(false); scrollPane.setScrollbarsOnTop(true); scrollPane.setScrollingDisabled(true, false); return scr...
java
{ "resource": "" }
q159669
VisValidatableTextField.setRestoreLastValid
train
public void setRestoreLastValid (boolean restoreLastValid) { if (hasSelection) throw new IllegalStateException("Last valid text restore can't be changed while filed has selection"); this.restoreLastValid = restoreLastValid; if (restoreLastValid) { if (restoreFocusListener == null) restoreFocusListener = n...
java
{ "resource": "" }
q159670
CallerLoggerUtil.getName
train
public static String getName(String name, int level) { level++; String fullName; if (name == null) fullName = getCallerClassName(level); else if (name.contains(".")) fullName = name; else fullName = getCallerClassName(level) + "." + name; return fullName; }
java
{ "resource": "" }
q159671
CompositeProcessListener.removeAll
train
public void removeAll(Class<? extends ProcessListener> type) { for (Iterator<ProcessListener> it = children.iterator(); it.hasNext();) { if (type.isInstance(it.next())) it.remove(); } }
java
{ "resource": "" }
q159672
LogOutputStream.write
train
public void write(final int cc) throws IOException { final byte c = (byte) cc; if ((c == '\n') || (c == '\r')) { // new line is started in case of // - CR (regardless of previous character) // - LF if previous character was not CR and not LF if (c == '\r' || (c == '\n' && (lastReceivedBy...
java
{ "resource": "" }
q159673
LogOutputStream.write
train
public void write(final byte[] b, final int off, final int len) throws IOException { // find the line breaks and pass other chars through in blocks int offset = off; int blockStartOffset = offset; int remaining = len; while (remaining > 0) { while (remaining > 0 && b[offset] != LF && b[o...
java
{ "resource": "" }
q159674
ExceptionUtil.addSuppressed
train
public static void addSuppressed(Throwable t, Throwable suppressed) { if (METHOD_ADD_SUPPRESSED != null) { try { METHOD_ADD_SUPPRESSED.invoke(t, suppressed); } catch (Exception e) { throw new IllegalStateException("Could not add suppressed exception:", e); } } }
java
{ "resource": "" }
q159675
StandardProcessCloser.closeStreams
train
private void closeStreams(final Process process) throws IOException { IOException caught = null; try { process.getOutputStream().close(); } catch (IOException e) { if (e.getMessage().equals("Stream closed")) { /** * OutputStream's contract for the close() method: If the str...
java
{ "resource": "" }
q159676
ProcessExecutor.environment
train
public ProcessExecutor environment(String name, String value) { environment.put(name, value); return this; }
java
{ "resource": "" }
q159677
ProcessExecutor.exitValue
train
public ProcessExecutor exitValue(Integer exitValue) { return exitValues(exitValue == null ? null : new Integer[] { exitValue } ); }
java
{ "resource": "" }
q159678
ProcessExecutor.redirectInput
train
public ProcessExecutor redirectInput(InputStream input) { PumpStreamHandler pumps = pumps(); // Only set the input stream handler, preserve the same output and error stream handler return streams(new PumpStreamHandler(pumps == null ? null : pumps.getOut(), pumps == null ? null : pumps.getErr(), input)); }
java
{ "resource": "" }
q159679
ProcessExecutor.redirectOutputAlsoTo
train
private static PumpStreamHandler redirectOutputAlsoTo(PumpStreamHandler pumps, OutputStream output) { if (output == null) throw new IllegalArgumentException("OutputStream must be provided."); OutputStream current = pumps.getOut(); if (current != null && !(current instanceof NullOutputStream)) { ...
java
{ "resource": "" }
q159680
ProcessExecutor.startInternal
train
protected final WaitForProcess startInternal() throws IOException { // Invoke listeners - they can modify this executor listeners.beforeStart(this); if (builder.command().isEmpty()) { throw new IllegalStateException("Command has not been set."); } validateStreams(streams, readOutput); ap...
java
{ "resource": "" }
q159681
ProcessExecutor.getAttributes
train
private ProcessAttributes getAttributes() { return new ProcessAttributes( getCommand(), getDirectory(), new LinkedHashMap<String, String>(environment), allowedExitValues == null ? null : new HashSet<Integer>(allowedExitValues)); }
java
{ "resource": "" }
q159682
ProcessExecutor.waitFor
train
private ProcessResult waitFor(WaitForProcess task) throws IOException, InterruptedException, TimeoutException { ProcessResult result; if (timeout == null) { // Use the current thread result = task.call(); } else { // Fork another thread to invoke Process.waitFor() ExecutorService...
java
{ "resource": "" }
q159683
ProcessExecutor.invokeSubmit
train
protected <T> Future<T> invokeSubmit(ExecutorService executor, Callable<T> task) { return executor.submit(wrapTask(task)); }
java
{ "resource": "" }
q159684
ShutdownHookProcessDestroyer.run
train
public void run() { /* check if running the routine is still necessary */ if(shutDownHookExecuted) { return; } synchronized (processes) { running = true; Enumeration e = processes.elements(); while (e.hasMoreElements()) { destroy((Process) e.nextElement()); } ...
java
{ "resource": "" }
q159685
InvalidExitUtil.checkExit
train
public static void checkExit(ProcessAttributes attributes, ProcessResult result) { Set<Integer> allowedExitValues = attributes.getAllowedExitValues(); if (allowedExitValues != null && !allowedExitValues.contains(result.getExitValue())) { StringBuilder sb = new StringBuilder(); sb.append("Unexpected ...
java
{ "resource": "" }
q159686
AddMojo.loadBindingTemplate
train
protected BindingTemplate loadBindingTemplate(String type) { try (final InputStream is = AddMojo.class.getResourceAsStream("/bindings.json")) { final String bindingsJsonStr = IOUtil.toString(is); final BindingsTemplate bindingsTemplate = new ObjectMapper() .readValue(bind...
java
{ "resource": "" }
q159687
AddMojo.getFunctionTemplate
train
protected FunctionTemplate getFunctionTemplate(final List<FunctionTemplate> templates) throws Exception { info(""); info(FIND_TEMPLATE); if (settings != null && !settings.isInteractiveMode()) { assureInputInBatchMode(getFunctionTemplate(), str -> getTemplateNames(tem...
java
{ "resource": "" }
q159688
AddMojo.prepareRequiredParameters
train
protected Map<String, String> prepareRequiredParameters(final FunctionTemplate template, final BindingTemplate bindingTemplate) throws MojoFailureException { info(""); info(PREPARE_PARAMS); prepareFunctionName(); prepa...
java
{ "resource": "" }
q159689
AddMojo.substituteParametersInTemplate
train
protected String substituteParametersInTemplate(final FunctionTemplate template, final Map<String, String> params) { String ret = template.getFiles().get("function.java"); for (final Map.Entry<String, String> entry : params.entrySet()) { ret = ret.replace(String.format("$%s$", entry.getKey()...
java
{ "resource": "" }
q159690
AddMojo.saveNewFunctionToFile
train
protected void saveNewFunctionToFile(final String newFunctionClass) throws Exception { info(""); info(SAVE_FILE); final File packageDir = getPackageDir(); final File targetFile = getTargetFile(packageDir); createPackageDirIfNotExist(packageDir); saveToTargetFile(targe...
java
{ "resource": "" }
q159691
DeployMojo.createOrUpdateFunctionApp
train
protected void createOrUpdateFunctionApp() throws Exception { final FunctionApp app = getFunctionApp(); if (app == null) { createFunctionApp(); } else { updateFunctionApp(app); } }
java
{ "resource": "" }
q159692
AzureAuthHelper.getAuthObjFromServerId
train
protected Authenticated getAuthObjFromServerId(final Settings settings, final String serverId) { if (StringUtils.isEmpty(serverId)) { getLog().debug(SERVER_ID_NOT_CONFIG); return null; } final Server server = Utils.getServer(settings, serverId); try { ...
java
{ "resource": "" }
q159693
AzureAuthHelper.getAuthObjFromFile
train
protected Authenticated getAuthObjFromFile(final File authFile) { if (authFile == null) { getLog().debug(AUTH_FILE_NOT_CONFIG); return null; } if (!authFile.exists()) { getLog().error(AUTH_FILE_NOT_EXIST + authFile.getAbsolutePath()); return null;...
java
{ "resource": "" }
q159694
AzureAuthHelper.getAuthObjFromAzureCli
train
protected Authenticated getAuthObjFromAzureCli() { try { final Azure.Configurable azureConfigurable = azureConfigure(); final Authenticated auth; if (isInCloudShell()) { getLog().info(AUTH_WITH_MSI); auth = azureConfigurable.authenticate(new MS...
java
{ "resource": "" }
q159695
AzureAuthHelper.getAppTokenCredentialsFromServer
train
protected ApplicationTokenCredentials getAppTokenCredentialsFromServer(Server server) { if (server == null) { return null; } final String clientId = Utils.getValueFromServerConfiguration(server, CLIENT_ID); if (StringUtils.isEmpty(clientId)) { getLog().debug(CLIE...
java
{ "resource": "" }
q159696
EventHubTriggerJava.run
train
@FunctionName("EventHubTriggerJava") public void run( @EventHubTrigger(name = "message", eventHubName = "trigger", connection = "CIEventHubConnection", consumerGroup = "$Default") String message, @EventHubOutput(name = "result", eventHubName = "output", connection = "CIEventHubConnection" ) ...
java
{ "resource": "" }
q159697
Utils.getServer
train
public static Server getServer(final Settings settings, final String serverId) { if (settings == null || StringUtils.isEmpty(serverId)) { return null; } return settings.getServer(serverId); }
java
{ "resource": "" }
q159698
Utils.assureServerExist
train
public static void assureServerExist(final Server server, final String serverId) throws MojoExecutionException { if (server == null) { throw new MojoExecutionException(String.format("Server not found in settings.xml. ServerId=%s", serverId)); } }
java
{ "resource": "" }
q159699
Utils.getValueFromServerConfiguration
train
public static String getValueFromServerConfiguration(final Server server, final String key) { if (server == null) { return null; } final Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration(); if (configuration == null) { return null; } ...
java
{ "resource": "" }