_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q15500
AbstractGlobalWebSingleton.getGlobalSingleton
train
@Nonnull public static final <T extends AbstractGlobalWebSingleton> T getGlobalSingleton (@Nonnull final Class <T> aClass) { return getSingleton (_getStaticScope (true), aClass); }
java
{ "resource": "" }
q15501
DNSHelper.setDNSCacheTime
train
public static void setDNSCacheTime (final int nSeconds) { final String sValue = Integer.toString (nSeconds); Security.setProperty ("networkaddress.cache.ttl", sValue); Security.setProperty ("networkaddress.cache.negative.ttl", sValue); SystemProperties.setPropertyValue ("disableWSAddressCaching", nSec...
java
{ "resource": "" }
q15502
AcceptCharsetList.getQValueOfCharset
train
@Nonnull public QValue getQValueOfCharset (@Nonnull final String sCharset) { ValueEnforcer.notNull (sCharset, "Charset"); // Find charset direct QValue aQuality = m_aMap.get (_unify (sCharset)); if (aQuality == null) { // If not explicitly given, check for "*" aQuality = m_aMap.get ...
java
{ "resource": "" }
q15503
LWJGLUtil.checkForGLError
train
public static void checkForGLError() { if (CausticUtil.isDebugEnabled()) { final int errorValue = GL11.glGetError(); if (errorValue != GL11.GL_NO_ERROR) { throw new GLException("GL ERROR: " + GLU.gluErrorString(errorValue)); } } }
java
{ "resource": "" }
q15504
PemObjectReader.getPemObject
train
public static PemObject getPemObject(final File file) throws IOException { PemObject pemObject; try (PemReader pemReader = new PemReader(new InputStreamReader(new FileInputStream(file)))) { pemObject = pemReader.readPemObject(); } return pemObject; }
java
{ "resource": "" }
q15505
MockHttpSession.clearAttributes
train
public void clearAttributes () { for (final Map.Entry <String, Object> entry : m_aAttributes.entrySet ()) { final String sName = entry.getKey (); final Object aValue = entry.getValue (); if (aValue instanceof HttpSessionBindingListener) ((HttpSessionBindingListener) aValue).valueUnbo...
java
{ "resource": "" }
q15506
MockHttpSession.serializeState
train
@Nonnull public Serializable serializeState () { final ICommonsMap <String, Object> aState = new CommonsHashMap <> (); for (final Map.Entry <String, Object> entry : m_aAttributes.entrySet ()) { final String sName = entry.getKey (); final Object aValue = entry.getValue (); if (aValue in...
java
{ "resource": "" }
q15507
ResponseHelperSettings.setAll
train
@Nonnull public static EChange setAll (final boolean bResponseCompressionEnabled, final boolean bResponseGzipEnabled, final boolean bResponseDeflateEnabled) { return s_aRWLock.writeLocked ( () -> { EChange eChange = EChange.UNCHANGED; i...
java
{ "resource": "" }
q15508
ResponseHelperSettings.setExpirationSeconds
train
@Nonnull public static EChange setExpirationSeconds (final int nExpirationSeconds) { return s_aRWLock.writeLocked ( () -> { if (s_nExpirationSeconds == nExpirationSeconds) return EChange.UNCHANGED; s_nExpirationSeconds = nExpirationSeconds; LOGGER.info ("ResponseHelper expirationSecond...
java
{ "resource": "" }
q15509
FileItemStream.openStream
train
@Nonnull public InputStream openStream () throws IOException { if (m_aIS instanceof ICloseable && ((ICloseable) m_aIS).isClosed ()) throw new MultipartItemSkippedException (); return m_aIS; }
java
{ "resource": "" }
q15510
XQuery.text
train
public @Nonnull String text() { return new NodeListSpliterator(node.getChildNodes()).stream() .filter(it -> it instanceof Text) .map(it -> ((Text) it).getNodeValue()) .collect(joining()); }
java
{ "resource": "" }
q15511
XQuery.attr
train
public @Nonnull Map<String, String> attr() { synchronized (this) { if (attrMap.get() == null) { attrMap.set( Optional.ofNullable(node.getAttributes()) .map(XQuery::attributesToMap) .map(Collections::unmodifiableMap) ...
java
{ "resource": "" }
q15512
XQuery.evaluate
train
private @Nonnull NodeList evaluate(String xpath) { try { XPathExpression expr = xpf.newXPath().compile(xpath); return (NodeList) expr.evaluate(node, XPathConstants.NODESET); } catch (XPathExpressionException ex) { throw new IllegalArgumentException("Invalid XPath '" +...
java
{ "resource": "" }
q15513
XQuery.findElement
train
private @Nonnull Optional<XQuery> findElement(Function<Node, Node> iterator) { Node it = node; do { it = iterator.apply(it); } while (it != null && !(it instanceof Element)); return Optional.ofNullable(it).map(XQuery::new); }
java
{ "resource": "" }
q15514
DigestAuthServerBuilder.setOpaque
train
@Nonnull public DigestAuthServerBuilder setOpaque (@Nonnull final String sOpaque) { if (!HttpStringHelper.isQuotedTextContent (sOpaque)) throw new IllegalArgumentException ("opaque is invalid: " + sOpaque); m_sOpaque = sOpaque; return this; }
java
{ "resource": "" }
q15515
ServletHelper.getRequestPathInfo
train
@Nonnull public static String getRequestPathInfo (@Nullable final HttpServletRequest aRequest) { String ret = null; if (aRequest != null) try { // They may return null! if (aRequest.isAsyncSupported () && aRequest.isAsyncStarted ()) ret = (String) aRequest.getAttribute ...
java
{ "resource": "" }
q15516
ServletHelper.getRequestRequestURI
train
@Nonnull public static String getRequestRequestURI (@Nullable final HttpServletRequest aRequest) { String ret = ""; if (aRequest != null) try { if (aRequest.isAsyncSupported () && aRequest.isAsyncStarted ()) ret = (String) aRequest.getAttribute (AsyncContext.ASYNC_REQUEST_URI);...
java
{ "resource": "" }
q15517
ServletHelper.getRequestRequestURL
train
@Nonnull public static StringBuffer getRequestRequestURL (@Nullable final HttpServletRequest aRequest) { StringBuffer ret = null; if (aRequest != null) try { ret = aRequest.getRequestURL (); } catch (final Exception ex) { // fall through if (isLogExcepti...
java
{ "resource": "" }
q15518
ServletHelper.getRequestServletPath
train
@Nonnull public static String getRequestServletPath (@Nullable final HttpServletRequest aRequest) { String ret = ""; if (aRequest != null) try { if (aRequest.isAsyncSupported () && aRequest.isAsyncStarted ()) ret = (String) aRequest.getAttribute (AsyncContext.ASYNC_SERVLET_PATH...
java
{ "resource": "" }
q15519
BasicAuthServerBuilder.setRealm
train
@Nonnull public BasicAuthServerBuilder setRealm (@Nonnull final String sRealm) { ValueEnforcer.isTrue (HttpStringHelper.isQuotedTextContent (sRealm), () -> "Realm is invalid: " + sRealm); m_sRealm = sRealm; return this; }
java
{ "resource": "" }
q15520
Path.contains
train
public boolean contains(String path) { boolean result = false; FileName fn = new FileName(path); if (fn.getPath().startsWith(getPath())) { result = true; } return result; }
java
{ "resource": "" }
q15521
WordlistsProcessor.getCurrentAttempt
train
public String getCurrentAttempt() { if (currentIndex < words.size()) { final String currentAttempt = words.get(currentIndex); return currentAttempt; } return null; }
java
{ "resource": "" }
q15522
WordlistsProcessor.process
train
public boolean process() { boolean continueIterate = true; boolean found = false; String attempt = getCurrentAttempt(); while (continueIterate) { if (attempt.equals(toCheckAgainst)) { found = true; break; } attempt = getCurrentAttempt(); continueIterate = increment(); } return foun...
java
{ "resource": "" }
q15523
FailedMailQueue.remove
train
@Nullable public FailedMailData remove (@Nullable final String sID) { if (StringHelper.hasNoText (sID)) return null; return m_aRWLock.writeLocked ( () -> internalRemove (sID)); }
java
{ "resource": "" }
q15524
HttpBasicAuth.getBasicAuthClientCredentials
train
@Nullable public static BasicAuthClientCredentials getBasicAuthClientCredentials (@Nullable final String sAuthHeader) { final String sRealHeader = StringHelper.trim (sAuthHeader); if (StringHelper.hasNoText (sRealHeader)) return null; final String [] aElements = RegExHelper.getSplitToArray (sReal...
java
{ "resource": "" }
q15525
ServletStatusManager.onServletInit
train
public void onServletInit (@Nonnull final Class <? extends GenericServlet> aServletClass) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("onServletInit: " + aServletClass); _updateStatus (aServletClass, EServletStatus.INITED); }
java
{ "resource": "" }
q15526
ServletStatusManager.onServletInvocation
train
public void onServletInvocation (@Nonnull final Class <? extends GenericServlet> aServletClass) { m_aRWLock.writeLocked ( () -> _getOrCreateServletStatus (aServletClass).internalIncrementInvocationCount ()); }
java
{ "resource": "" }
q15527
NetworkPortHelper.checkPortOpen
train
@Nonnull public static ENetworkPortStatus checkPortOpen (@Nonnull @Nonempty final String sHostName, @Nonnegative final int nPort, @Nonnegative final int nTimeoutMillisecs) { ValueEnforcer.notEmpty (sHostName, "Ho...
java
{ "resource": "" }
q15528
UserAgentDecryptor._decryptUserAgent
train
@Nonnull private static UserAgentElementList _decryptUserAgent (@Nonnull final String sUserAgent) { final UserAgentElementList ret = new UserAgentElementList (); final StringScanner aSS = new StringScanner (sUserAgent.trim ()); while (true) { aSS.skipWhitespaces (); final int nIndex = aS...
java
{ "resource": "" }
q15529
UserAgentDecryptor.decryptUserAgentString
train
@Nonnull public static IUserAgent decryptUserAgentString (@Nonnull final String sUserAgent) { ValueEnforcer.notNull (sUserAgent, "UserAgent"); String sRealUserAgent = sUserAgent; // Check if surrounded with '"' or ''' if (sRealUserAgent.length () >= 2) { final char cFirst = sRealUserAgen...
java
{ "resource": "" }
q15530
AuthenticatorProxySettingsManager.requestProxyPasswordAuthentication
train
@Nullable public static PasswordAuthentication requestProxyPasswordAuthentication (@Nullable final String sHostName, @Nullable final int nPort, @Nullable final String s...
java
{ "resource": "" }
q15531
Browser.get
train
public static <T> T get(final Class<T> pageClass, final String... params) { cryIfNotAnnotated(pageClass); try { final String pageUrl = pageClass.getAnnotation(Page.class).value(); return loadPage(pageUrl, pageClass, Arrays.asList(params)); } catch (final Exception e) { ...
java
{ "resource": "" }
q15532
RequestParamMap._getChildMapExceptLast
train
@Nullable private ICommonsOrderedMap <String, RequestParamMapItem> _getChildMapExceptLast (@Nonnull @Nonempty final String... aPath) { ValueEnforcer.notEmpty (aPath, "Path"); ICommonsOrderedMap <String, RequestParamMapItem> aMap = m_aMap; // Until the second last object for (int i = 0; i < aPath.le...
java
{ "resource": "" }
q15533
RequestParamMap.getFieldName
train
@Nonnull @Nonempty @Deprecated public static String getFieldName (@Nonnull @Nonempty final String sBaseName) { ValueEnforcer.notEmpty (sBaseName, "BaseName"); return sBaseName; }
java
{ "resource": "" }
q15534
RequestParamMap.setSeparators
train
public static void setSeparators (final char cOpen, final char cClose) { ValueEnforcer.isFalse (cOpen == cClose, "Open and closing element may not be identical!"); s_sOpen = Character.toString (cOpen); s_sClose = Character.toString (cClose); }
java
{ "resource": "" }
q15535
RequestParamMap.setSeparators
train
public static void setSeparators (@Nonnull @Nonempty final String sOpen, @Nonnull @Nonempty final String sClose) { ValueEnforcer.notEmpty (sOpen, "Open"); ValueEnforcer.notEmpty (sClose, "Close"); ValueEnforcer.isFalse (sOpen.contains (sClose), "open may not contain close"); ValueEnforcer.isFalse (sCl...
java
{ "resource": "" }
q15536
RequestHelper.getWithoutSessionID
train
@Nonnull public static SimpleURL getWithoutSessionID (@Nonnull final ISimpleURL aURL) { ValueEnforcer.notNull (aURL, "URL"); // Strip the parameter from the path, but keep parameters and anchor intact! // Note: using URLData avoid parsing, since the data was already parsed! return new SimpleURL (new...
java
{ "resource": "" }
q15537
RequestHelper.getPathWithinServletContext
train
@Nonnull public static String getPathWithinServletContext (@Nonnull final HttpServletRequest aHttpRequest) { ValueEnforcer.notNull (aHttpRequest, "HttpRequest"); final String sRequestURI = getRequestURI (aHttpRequest); if (StringHelper.hasNoText (sRequestURI)) { // Can e.g. happen for "Reques...
java
{ "resource": "" }
q15538
RequestHelper.getHttpVersion
train
@Nullable public static EHttpVersion getHttpVersion (@Nonnull final HttpServletRequest aHttpRequest) { ValueEnforcer.notNull (aHttpRequest, "HttpRequest"); final String sProtocol = aHttpRequest.getProtocol (); return EHttpVersion.getFromNameOrNull (sProtocol); }
java
{ "resource": "" }
q15539
RequestHelper.getHttpMethod
train
@Nullable public static EHttpMethod getHttpMethod (@Nonnull final HttpServletRequest aHttpRequest) { ValueEnforcer.notNull (aHttpRequest, "HttpRequest"); final String sMethod = aHttpRequest.getMethod (); return EHttpMethod.getFromNameOrNull (sMethod); }
java
{ "resource": "" }
q15540
RequestHelper.getRequestHeaderMap
train
@Nonnull @ReturnsMutableCopy public static HttpHeaderMap getRequestHeaderMap (@Nonnull final HttpServletRequest aHttpRequest) { ValueEnforcer.notNull (aHttpRequest, "HttpRequest"); final HttpHeaderMap ret = new HttpHeaderMap (); final Enumeration <String> aHeaders = aHttpRequest.getHeaderNames (); ...
java
{ "resource": "" }
q15541
RequestHelper.getRequestClientCertificates
train
@Nullable public static X509Certificate [] getRequestClientCertificates (@Nonnull final HttpServletRequest aHttpRequest) { return _getRequestAttr (aHttpRequest, SERVLET_ATTR_CLIENT_CERTIFICATE, X509Certificate [].class); }
java
{ "resource": "" }
q15542
RequestHelper.getHttpUserAgentStringFromRequest
train
@Nullable public static String getHttpUserAgentStringFromRequest (@Nonnull final HttpServletRequest aHttpRequest) { // Use non-standard headers first String sUserAgent = aHttpRequest.getHeader (CHttpHeader.UA); if (sUserAgent == null) { sUserAgent = aHttpRequest.getHeader (CHttpHeader.X_DEVICE...
java
{ "resource": "" }
q15543
RequestHelper.getCheckBoxHiddenFieldName
train
@Nonnull @Nonempty public static String getCheckBoxHiddenFieldName (@Nonnull @Nonempty final String sFieldName) { ValueEnforcer.notEmpty (sFieldName, "FieldName"); return DEFAULT_CHECKBOX_HIDDEN_FIELD_PREFIX + sFieldName; }
java
{ "resource": "" }
q15544
CookieHelper.createCookie
train
@Nonnull public static Cookie createCookie (@Nonnull final String sName, @Nullable final String sValue, final String sPath, final boolean bExpireWhenBrowserIsClosed) { final Cookie aCookie = new Cookie...
java
{ "resource": "" }
q15545
CookieHelper.removeCookie
train
public static void removeCookie (@Nonnull final HttpServletResponse aHttpResponse, @Nonnull final Cookie aCookie) { ValueEnforcer.notNull (aHttpResponse, "HttpResponse"); ValueEnforcer.notNull (aCookie, "aCookie"); // expire the cookie! aCookie.setMaxAge (0); aHttpResponse.addCookie (aCookie); ...
java
{ "resource": "" }
q15546
EncryptedPrivateKeyReader.readPasswordProtectedPrivateKey
train
public static PrivateKey readPasswordProtectedPrivateKey(final byte[] encryptedPrivateKeyBytes, final String password, final String algorithm) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidKeyException, InvalidAlgorithmParameterException { final Encrypted...
java
{ "resource": "" }
q15547
ServletAsyncSpec.createAsync
train
@Nonnull public static ServletAsyncSpec createAsync (@CheckForSigned final long nTimeoutMillis, @Nullable final Iterable <? extends AsyncListener> aAsyncListeners) { return new ServletAsyncSpec (true, nTimeoutMillis, aAsyncListeners); }
java
{ "resource": "" }
q15548
MergeMojo.initOutput
train
protected OutputStream initOutput(final File file) throws MojoExecutionException { // stream to return final OutputStream stream; // plenty of things can go wrong... try { // directory? if (file.isDirectory()) { throw new MojoExecutionException...
java
{ "resource": "" }
q15549
MergeMojo.initInput
train
protected InputStream initInput(final File file) throws MojoExecutionException { InputStream stream = null; try { if (file.isDirectory()) { throw new MojoExecutionException("File " + file.getAbsolutePath() + " is directory!"); ...
java
{ "resource": "" }
q15550
MergeMojo.appendStream
train
protected void appendStream(final InputStream input, final OutputStream output) throws MojoExecutionException { // prebuffer int character; try { // get line seperator, based on system final String newLine = System.getProperty("line.separator"); // rea...
java
{ "resource": "" }
q15551
DeferredFileOutputStream.onThresholdReached
train
@Override protected void onThresholdReached () throws IOException { FileOutputStream aFOS = null; try { aFOS = new FileOutputStream (m_aOutputFile); m_aMemoryOS.writeTo (aFOS); m_aCurrentOS = aFOS; // Explicitly close the stream (even though this is a no-op) StreamHelper.c...
java
{ "resource": "" }
q15552
DeferredFileOutputStream.writeTo
train
public void writeTo (@Nonnull @WillNotClose final OutputStream aOS) throws IOException { // we may only need to check if this is closed if we are working with a file // but we should force the habit of closing whether we are working with // a file or memory. if (!m_bClosed) throw new IOException...
java
{ "resource": "" }
q15553
MeshGenerator.generatePlane
train
public static VertexData generatePlane(Vector2f size) { final VertexData destination = new VertexData(); final VertexAttribute positionsAttribute = new VertexAttribute("positions", DataType.FLOAT, 3); destination.addAttribute(0, positionsAttribute); final TFloatList positions = new TFloa...
java
{ "resource": "" }
q15554
MeshGenerator.generatePlane
train
public static void generatePlane(TFloatList positions, TFloatList normals, TFloatList textureCoords, TIntList indices, Vector2f size) { /* * 2-----3 * | | * | | * 0-----1 */ // Corner positions final Vector2f p = size.div(2); final Vec...
java
{ "resource": "" }
q15555
MeshGenerator.generateCylinder
train
public static void generateCylinder(TFloatList positions, TFloatList normals, TIntList indices, float radius, float height) { // 0,0,0 will be halfway up the cylinder in the middle final float halfHeight = height / 2; // The positions at the rims of the cylinders final List<Vector3f> rim...
java
{ "resource": "" }
q15556
MockEventListenerList.setFrom
train
@Nonnull public EChange setFrom (@Nonnull final MockEventListenerList aList) { ValueEnforcer.notNull (aList, "List"); // Assigning this to this? if (this == aList) return EChange.UNCHANGED; // Get all listeners to assign final ICommonsList <EventListener> aOtherListeners = aList.getAllLi...
java
{ "resource": "" }
q15557
MockEventListenerList.addListener
train
@Nonnull public EChange addListener (@Nonnull final EventListener aListener) { ValueEnforcer.notNull (aListener, "Listener"); // Small consistency check if (!(aListener instanceof ServletContextListener) && !(aListener instanceof HttpSessionListener) && !(aListener instanceof ServletReq...
java
{ "resource": "" }
q15558
XMLSitemapProvider.forEachURLSet
train
public static void forEachURLSet (@Nonnull final Consumer <? super XMLSitemapURLSet> aConsumer) { ValueEnforcer.notNull (aConsumer, "Consumer"); for (final IXMLSitemapProviderSPI aSPI : s_aProviders) { final XMLSitemapURLSet aURLSet = aSPI.createURLSet (); aConsumer.accept (aURLSet); } }
java
{ "resource": "" }
q15559
Camera.getViewMatrix
train
public Matrix4f getViewMatrix() { if (updateViewMatrix) { rotationMatrixInverse = Matrix4f.createRotation(rotation); final Matrix4f rotationMatrix = Matrix4f.createRotation(rotation.invert()); final Matrix4f positionMatrix = Matrix4f.createTranslation(position.negate()); ...
java
{ "resource": "" }
q15560
Camera.createPerspective
train
public static Camera createPerspective(float fieldOfView, int windowWidth, int windowHeight, float near, float far) { return new Camera(Matrix4f.createPerspective(fieldOfView, (float) windowWidth / windowHeight, near, far)); }
java
{ "resource": "" }
q15561
CertificateReader.readPemCertificate
train
public static X509Certificate readPemCertificate(final File file) throws IOException, CertificateException { final String privateKeyAsString = readPemFileAsBase64(file); final byte[] decoded = new Base64().decode(privateKeyAsString); return readCertificate(decoded); }
java
{ "resource": "" }
q15562
LoggingFilter.isLogRequest
train
@OverrideOnDemand protected boolean isLogRequest (@Nonnull final HttpServletRequest aHttpRequest, @Nonnull final HttpServletResponse aHttpResponse) { boolean bLog = isGloballyEnabled () && m_aLogger.isInfoEnabled (); if (bLog) { // Check for excluded path fi...
java
{ "resource": "" }
q15563
HttpClientManager.execute
train
@Nonnull public CloseableHttpResponse execute (@Nonnull final HttpUriRequest aRequest) throws IOException { return execute (aRequest, (HttpContext) null); }
java
{ "resource": "" }
q15564
HttpClientManager.execute
train
@Nonnull public CloseableHttpResponse execute (@Nonnull final HttpUriRequest aRequest, @Nullable final HttpContext aHttpContext) throws IOException { checkIfClosed (); HttpDebugger.beforeRequest (aRequest, aHttpContext); CloseableHttpResponse ret = null; Throw...
java
{ "resource": "" }
q15565
HttpClientManager.execute
train
@Nullable public <T> T execute (@Nonnull final HttpUriRequest aRequest, @Nonnull final ResponseHandler <T> aResponseHandler) throws IOException { return execute (aRequest, (HttpContext) null, aResponseHandler); }
java
{ "resource": "" }
q15566
EmailGlobalSettings.setMailQueueSize
train
@Nonnull public static EChange setMailQueueSize (@Nonnegative final int nMaxMailQueueLen, @Nonnegative final int nMaxMailSendCount) { ValueEnforcer.isGT0 (nMaxMailQueueLen, "MaxMailQueueLen"); ValueEnforcer.isGT0 (nMaxMailSendCount, "MaxMailSendCount"); ValueEnf...
java
{ "resource": "" }
q15567
EmailGlobalSettings.setUseSSL
train
@Nonnull public static EChange setUseSSL (final boolean bUseSSL) { return s_aRWLock.writeLocked ( () -> { if (s_bUseSSL == bUseSSL) return EChange.UNCHANGED; s_bUseSSL = bUseSSL; return EChange.CHANGED; }); }
java
{ "resource": "" }
q15568
EmailGlobalSettings.setUseSTARTTLS
train
@Nonnull public static EChange setUseSTARTTLS (final boolean bUseSTARTTLS) { return s_aRWLock.writeLocked ( () -> { if (s_bUseSTARTTLS == bUseSTARTTLS) return EChange.UNCHANGED; s_bUseSTARTTLS = bUseSTARTTLS; return EChange.CHANGED; }); }
java
{ "resource": "" }
q15569
EmailGlobalSettings.setConnectionTimeoutMilliSecs
train
@Nonnull public static EChange setConnectionTimeoutMilliSecs (final long nMilliSecs) { return s_aRWLock.writeLocked ( () -> { if (s_nConnectionTimeoutMilliSecs == nMilliSecs) return EChange.UNCHANGED; if (nMilliSecs <= 0) LOGGER.warn ("You are setting an indefinite connection timeout...
java
{ "resource": "" }
q15570
EmailGlobalSettings.setTimeoutMilliSecs
train
@Nonnull public static EChange setTimeoutMilliSecs (final long nMilliSecs) { return s_aRWLock.writeLocked ( () -> { if (s_nTimeoutMilliSecs == nMilliSecs) return EChange.UNCHANGED; if (nMilliSecs <= 0) LOGGER.warn ("You are setting an indefinite socket timeout for the mail transport ...
java
{ "resource": "" }
q15571
EmailGlobalSettings.addConnectionListener
train
public static void addConnectionListener (@Nonnull final ConnectionListener aConnectionListener) { ValueEnforcer.notNull (aConnectionListener, "ConnectionListener"); s_aRWLock.writeLocked ( () -> s_aConnectionListeners.add (aConnectionListener)); }
java
{ "resource": "" }
q15572
EmailGlobalSettings.removeConnectionListener
train
@Nonnull public static EChange removeConnectionListener (@Nullable final ConnectionListener aConnectionListener) { if (aConnectionListener == null) return EChange.UNCHANGED; return s_aRWLock.writeLocked ( () -> s_aConnectionListeners.removeObject (aConnectionListener)); }
java
{ "resource": "" }
q15573
EmailGlobalSettings.addEmailDataTransportListener
train
public static void addEmailDataTransportListener (@Nonnull final IEmailDataTransportListener aEmailDataTransportListener) { ValueEnforcer.notNull (aEmailDataTransportListener, "EmailDataTransportListener"); s_aRWLock.writeLocked ( () -> s_aEmailDataTransportListeners.add (aEmailDataTransportListener)); }
java
{ "resource": "" }
q15574
EmailGlobalSettings.removeEmailDataTransportListener
train
@Nonnull public static EChange removeEmailDataTransportListener (@Nullable final IEmailDataTransportListener aEmailDataTransportListener) { if (aEmailDataTransportListener == null) return EChange.UNCHANGED; return s_aRWLock.writeLocked ( () -> s_aEmailDataTransportListeners.removeObject (aEmailDataTr...
java
{ "resource": "" }
q15575
EmailGlobalSettings.enableJavaxMailDebugging
train
@SuppressFBWarnings ("LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE") public static void enableJavaxMailDebugging (final boolean bDebug) { java.util.logging.Logger.getLogger ("com.sun.mail.smtp").setLevel (bDebug ? Level.FINEST : Level.INFO); java.util.logging.Logger.getLogger ("com.sun.mail.smtp.protocol").setLevel...
java
{ "resource": "" }
q15576
EmailGlobalSettings.setToDefault
train
public static void setToDefault () { s_aRWLock.writeLocked ( () -> { s_nMaxMailQueueLen = DEFAULT_MAX_QUEUE_LENGTH; s_nMaxMailSendCount = DEFAULT_MAX_SEND_COUNT; s_bUseSSL = DEFAULT_USE_SSL; s_bUseSTARTTLS = DEFAULT_USE_STARTTLS; s_nConnectionTimeoutMilliSecs = DEFAULT_CONNECT_TIMEOU...
java
{ "resource": "" }
q15577
GoogleMapsUrlSigner.convertToKeyByteArray
train
public static byte[] convertToKeyByteArray(String yourGooglePrivateKeyString) { yourGooglePrivateKeyString = yourGooglePrivateKeyString.replace('-', '+'); yourGooglePrivateKeyString = yourGooglePrivateKeyString.replace('_', '/'); return Base64.getDecoder().decode(yourGooglePrivateKeyString); }
java
{ "resource": "" }
q15578
GoogleMapsUrlSigner.signRequest
train
public static String signRequest(final String yourGooglePrivateKeyString, final String path, final String query) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException, URISyntaxException { // Retrieve the proper URL components to sign final String resource = path + '?' + query; ...
java
{ "resource": "" }
q15579
GoogleMapsUrlSigner.signRequest
train
public static String signRequest(final URL url, final String yourGooglePrivateKeyString) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException, URISyntaxException { // Retrieve the proper URL components to sign final String resource = url.getPath() + '?' + url.getQuery(); // Ge...
java
{ "resource": "" }
q15580
UnifiedResponseDefaultSettings.setResponseHeader
train
public static void setResponseHeader (@Nonnull @Nonempty final String sName, @Nonnull @Nonempty final String sValue) { ValueEnforcer.notEmpty (sName, "Name"); ValueEnforcer.notEmpty (sValue, "Value"); s_aRWLock.writeLocked ( () -> s_aResponseHeaderMap.setHeader (sName, sValue)); }
java
{ "resource": "" }
q15581
UnifiedResponseDefaultSettings.addResponseHeader
train
public static void addResponseHeader (@Nonnull @Nonempty final String sName, @Nonnull @Nonempty final String sValue) { ValueEnforcer.notEmpty (sName, "Name"); ValueEnforcer.notEmpty (sValue, "Value"); s_aRWLock.writeLocked ( () -> s_aResponseHeaderMap.addHeader (sName, sValue)); }
java
{ "resource": "" }
q15582
MapHelper.merge
train
public static <S, T> Map<S, T> merge(Map<S, T> map, Map<S, T> toMerge) { Map<S, T> ret = new HashMap<S, T>(); ret.putAll(ensure(map)); ret.putAll(ensure(toMerge)); return ret; }
java
{ "resource": "" }
q15583
FileItemHeaders.addHeader
train
public void addHeader (@Nonnull final String sName, @Nullable final String sValue) { ValueEnforcer.notNull (sName, "HeaderName"); final String sNameLower = sName.toLowerCase (Locale.US); m_aRWLock.writeLocked ( () -> { ICommonsList <String> aHeaderValueList = m_aHeaderNameToValueListMap.get (sName...
java
{ "resource": "" }
q15584
CausticUtil.checkVersion
train
public static void checkVersion(GLVersioned required, GLVersioned object) { if (!debug) { return; } final GLVersion requiredVersion = required.getGLVersion(); final GLVersion objectVersion = object.getGLVersion(); if (objectVersion.getMajor() > requiredVersion.getMajo...
java
{ "resource": "" }
q15585
CausticUtil.getPackedPixels
train
public static int[] getPackedPixels(ByteBuffer imageData, Format format, Rectangle size) { final int[] pixels = new int[size.getArea()]; final int width = size.getWidth(); final int height = size.getHeight(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) ...
java
{ "resource": "" }
q15586
CausticUtil.getImage
train
public static BufferedImage getImage(ByteBuffer imageData, Format format, Rectangle size) { final int width = size.getWidth(); final int height = size.getHeight(); final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); final int[] pixels = ((DataBuffer...
java
{ "resource": "" }
q15587
CausticUtil.fromIntRGBA
train
public static Vector4f fromIntRGBA(int r, int g, int b, int a) { return new Vector4f((r & 0xff) / 255f, (g & 0xff) / 255f, (b & 0xff) / 255f, (a & 0xff) / 255f); }
java
{ "resource": "" }
q15588
CausticUtil.createByteBuffer
train
public static ByteBuffer createByteBuffer(int capacity) { return ByteBuffer.allocateDirect(capacity * DataType.BYTE.getByteSize()).order(ByteOrder.nativeOrder()); }
java
{ "resource": "" }
q15589
GenomicsDataSourceBase.getUnmappedMatesOfMappedReads
train
protected UnmappedReads<Read> getUnmappedMatesOfMappedReads(String readsetId) throws GeneralSecurityException, IOException { LOG.info("Collecting unmapped mates of mapped reads for injection"); final Iterable<Read> unmappedReadsIterable = getUnmappedReadsIterator(readsetId); final UnmappedReads<Read...
java
{ "resource": "" }
q15590
Rectangle.set
train
public void set(Rectangle rectangle) { set(rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight()); }
java
{ "resource": "" }
q15591
WebScopeSessionManager.getSessionWebScopeOfSession
train
@Nullable public static ISessionWebScope getSessionWebScopeOfSession (@Nullable final HttpSession aHttpSession) { return aHttpSession == null ? null : getSessionWebScopeOfID (aHttpSession.getId ()); }
java
{ "resource": "" }
q15592
WebScopeSessionManager.destroyAllWebSessions
train
public static void destroyAllWebSessions () { // destroy all session web scopes (make a copy, because we're invalidating // the sessions!) for (final ISessionWebScope aSessionScope : getAllSessionWebScopes ()) { // Unfortunately we need a special handling here if (aSessionScope.selfDestruc...
java
{ "resource": "" }
q15593
DiskFileItem.writeObject
train
private void writeObject (final ObjectOutputStream aOS) throws IOException { // Read the data if (m_aDFOS.isInMemory ()) { _ensureCachedContentIsPresent (); } else { m_aCachedContent = null; m_aDFOSFile = m_aDFOS.getFile (); } // write out values aOS.defaultWrite...
java
{ "resource": "" }
q15594
DiskFileItem.getSize
train
@Nonnegative public long getSize () { if (m_nSize >= 0) return m_nSize; if (m_aCachedContent != null) return m_aCachedContent.length; if (m_aDFOS.isInMemory ()) return m_aDFOS.getDataLength (); return m_aDFOS.getFile ().length (); }
java
{ "resource": "" }
q15595
DiskFileItem.directGet
train
@ReturnsMutableObject ("Speed") @SuppressFBWarnings ("EI_EXPOSE_REP") @Nullable public byte [] directGet () { if (isInMemory ()) { _ensureCachedContentIsPresent (); return m_aCachedContent; } return SimpleFileIO.getAllFileBytes (m_aDFOS.getFile ()); }
java
{ "resource": "" }
q15596
DiskFileItem.getStringWithFallback
train
@Nonnull public String getStringWithFallback (@Nonnull final Charset aFallbackCharset) { final String sCharset = getCharSet (); final Charset aCharset = CharsetHelper.getCharsetFromNameOrDefault (sCharset, aFallbackCharset); return getString (aCharset); }
java
{ "resource": "" }
q15597
GA4GHPicardRunner.run
train
public void run(String[] args) { LOG.info("Starting GA4GHPicardRunner"); try { parseCmdLine(args); buildPicardCommand(); startProcess(); pumpInputData(); waitForProcessEnd(); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } }
java
{ "resource": "" }
q15598
GA4GHPicardRunner.parseCmdLine
train
void parseCmdLine(String[] args) { JCommander parser = new JCommander(this, args); parser.setProgramName("GA4GHPicardRunner"); LOG.info("Cmd line parsed"); }
java
{ "resource": "" }
q15599
GA4GHPicardRunner.buildPicardCommand
train
private void buildPicardCommand() throws IOException, GeneralSecurityException, URISyntaxException { File picardJarPath = new File(picardPath, "picard.jar"); if (!picardJarPath.exists()) { throw new IOException("Picard tool not found at " + picardJarPath.getAbsolutePath()); } ...
java
{ "resource": "" }