| dataset_index,text,true_label,predicted_label,correct,error_type,probability_secure_communication,probability_unrelated |
| 0,"public FTPSClient(final String protocol, final boolean isImplicit) { this.protocol = protocol; this.isImplicit = isImplicit; if (isImplicit) { setDefaultPort(DEFAULT_FTPS_PORT); } }",secure_communication,secure_communication,True,,0.9943948984146118,0.0056051043793559074 |
| 1,"try { final Path directoryPath = Paths.get(directoryPathProperty).normalize(); final String transitUri; if (removalStrategy == RemovalStrategy.DIRECTORY) { transfer.deleteDirectory(flowFile, directoryPath.toString()); transitUri = ""sftp://%s"".formatted(directoryPath); } else { filename = context.getProperty(FILENAME).evaluateAttributeExpressions(flowFile).getValue(); final Path filePath = directoryPath.resolve(filename).normalize(); final Path fileParent = filePath.getParent(); if (!directoryPath.equals(fileParent == null ? Paths.get("""") : fileParent)) { final String errorMessage = ""Attempting to delete file at path '%s' which is not a direct child of the directory '%s'"" .formatted(filePath, directoryPath); handleFailure(session, flowFile, errorMessage, null); continue; } transfer.deleteFile(flowFile, directoryPath.toString(), filename); transitUri = ""sftp://%s"".formatted(filePath); }",secure_communication,secure_communication,True,,0.9152535200119019,0.08474646508693695 |
| 2,"@Override public void deleteFile(final FlowFile flowFile, final String path, final String remoteFileName) throws IOException { final FTPClient client = getClient(flowFile); if (path != null) { setWorkingDirectory(path); } if (!client.deleteFile(remoteFileName)) { throw new IOException(""Failed to remove file "" + remoteFileName + "" due to "" + client.getReplyString()); } }",unrelated,unrelated,True,,0.0005838510696776211,0.9994161128997803 |
| 3,"private void setClientProperties(final FTPClient client, final PropertyContext context) { final int bufferSize = context.getProperty(BUFFER_SIZE).asDataSize(DataUnit.B).intValue(); final Duration dataTimeout = context.getProperty(DATA_TIMEOUT).asDuration(); final int connectionTimeout = context.getProperty(CONNECTION_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue(); client.setBufferSize(bufferSize); client.setDataTimeout(dataTimeout); client.setDefaultTimeout(connectionTimeout); client.setRemoteVerificationEnabled(false); client.setAutodetectUTF8(true); final boolean unicodeEnabled = context.getProperty(UTF8_ENCODING).isSet() ? context.getProperty(UTF8_ENCODING).asBoolean() : false; if (unicodeEnabled) { client.setControlEncoding(StandardCharsets.UTF_8.name()); } }",unrelated,unrelated,True,,0.0005749599658884108,0.9994250535964966 |
| 4,"final Map<String, String> attributes = flowFile == null ? Collections.emptyMap() : flowFile.getAttributes(); this.clientSession = CLIENT_PROVIDER.getClientSession(ctx, attributes); final SftpClientFactory sftpClientFactory = SftpClientFactory.instance(); sftpClient = sftpClientFactory.createSftpClient(clientSession); activeHostname = evaledHostname; activePort = evaledPort; activePassword = evaledPassword; activeUsername = evaledUsername; activePrivateKeyPath = evaledPrivateKeyPath; activePrivateKeyPassphrase = evaledPrivateKeyPassphrase; this.closed = false;",secure_communication,secure_communication,True,,0.996921718120575,0.003078295150771737 |
| 5,"protected FTPClient createClient(final PropertyContext context, final Map<String, String> attributes) { return FTP_CLIENT_PROVIDER.getClient(context, attributes); }",unrelated,unrelated,True,,0.0005607513594441116,0.9994391798973083 |
| 6,"public void ensureDirectoryExists(final FlowFile flowFile, final File directoryName) throws IOException { final SftpClient sftpClient = getSFTPClient(flowFile); final String remoteDirectory = directoryName.getAbsolutePath().replace(""\\"", ""/"").replaceAll(""^.:"", """"); if (disableDirectoryListing) { try { sftpClient.mkdir(remoteDirectory); return; } catch (final SftpException e) { final int status = e.getStatus(); final String statusName = SftpConstants.getStatusName(status); if (SftpConstants.SSH_FX_NO_SUCH_FILE == status) { logger.debug(""Failed to create directory [{}] Status [{}] attempting to create parent directory"", directoryName, statusName); } else if (SftpConstants.SSH_FX_FAILURE == status) { logger.debug(""Failed to create directory [{}] Status [{}]"", remoteDirectory, statusName); return; } else { throw new IOException(""Failed to create directory [%s] Status [%s]"".formatted(remoteDirectory, statusName), e); } }",secure_communication,secure_communication,True,,0.9968721270561218,0.003127892268821597 |
| 7,"if (attributesRequested.isConfigured()) { try { final SftpClient.Attributes attributes = sftpClient.stat(remotePath); attributesRequested.setAttributes(attributes); sftpClient.setStat(remotePath, attributes); } catch (final IOException e) { logger.warn(""Failed to set attributes on Remote File [{}] for {}"", remotePath, flowFile, e); }",secure_communication,secure_communication,True,,0.9969307780265808,0.003069285536184907 |
| 8,"final String fullPath = buildFullPath(path, filename); try { final SftpClient.Attributes fileAttributes = sftpClient.stat(fullPath); if (fileAttributes.isDirectory()) { fileInfo = null; } else { fileInfo = newFileInfo(path, filename, fileAttributes); } } catch (final SftpException e) { final int status = e.getStatus(); if (SftpConstants.SSH_FX_NO_SUCH_FILE == status) { return null; } else { throw new IOException(""Failed to read remote attributes [%s]"".formatted(fullPath), e); }",secure_communication,secure_communication,True,,0.9969168901443481,0.0030831678304821253 |
| 9,"public FlowFile getRemoteFile(final String remoteFileName, final FlowFile origFlowFile, final ProcessSession session) throws ProcessException, IOException { final SftpClient sftpClient = getSFTPClient(origFlowFile); try (InputStream inputStream = sftpClient.read(remoteFileName)) { return session.write(origFlowFile, inputStream::transferTo); } catch (final SftpException e) { final int status = e.getStatus(); switch (status) { case SftpConstants.SSH_FX_NO_SUCH_FILE: throw new FileNotFoundException(""No such file or directory [%s] on remote system"".formatted(remoteFileName)); case SftpConstants.SSH_FX_PERMISSION_DENIED: throw new PermissionDeniedException(""Insufficient permissions to read [%s]"".formatted(remoteFileName), e); default: throw new IOException(""Failed to read [%s]"".formatted(remoteFileName), e); }",secure_communication,secure_communication,True,,0.9969173669815063,0.0030826502479612827 |
| 10,"SFTPClient sftpClient = null; try { sftpClient = new SFTPClient(connection); try { SFTPv3FileAttributes fileAttributes = sftpClient._stat(workingDirectory); if (fileAttributes == null) { listener.getLogger() .println(Messages.SSHLauncher_RemoteFSDoesNotExist(getTimestamp(), workingDirectory)); sftpClient.mkdirs(workingDirectory, 0700); } else if (fileAttributes.isRegularFile()) { throw new IOException(Messages.SSHLauncher_RemoteFSIsAFile(workingDirectory)); } listener.getLogger().println(Messages.SSHLauncher_CopyingAgentJar(getTimestamp())); byte[] agentJar = new Slave.JnlpJar(AGENT_JAR).readFully();",secure_communication,secure_communication,True,,0.9969127178192139,0.0030872314237058163 |
| 11,"public void rename(final FlowFile flowFile, final String source, final String target) throws IOException { final SftpClient sftpClient = getSFTPClient(flowFile); try { sftpClient.rename(source, target); } catch (final SftpException e) { final int status = e.getStatus(); switch (status) { case SftpConstants.SSH_FX_NO_SUCH_FILE: throw new FileNotFoundException(""No such file or directory [%s] on remote system"".formatted(source)); case SftpConstants.SSH_FX_PERMISSION_DENIED: throw new PermissionDeniedException(""Insufficient permissions to rename [%s] to [%s]"".formatted(source, target), e); default: throw new IOException(""Failed to rename [%s] to [%s]"".formatted(source, target), e); } }",secure_communication,secure_communication,True,,0.9968684315681458,0.0031315425876528025 |
| 12,"private boolean isIncludedDirectory(final String directory, final SftpClient.DirEntry dirEntry, final boolean recursionEnabled, final boolean symlinksEnabled) { boolean includedDirectory = false; final SftpClient.Attributes entryAttributes = dirEntry.getAttributes(); if (entryAttributes.isDirectory()) { includedDirectory = recursionEnabled; } else if (symlinksEnabled && entryAttributes.isSymbolicLink()) { final String filename = dirEntry.getFilename(); final String path = buildFullPath(directory, filename); try { final SftpClient.Attributes attributes = sftpClient.stat(path); includedDirectory = attributes.isDirectory(); } catch (final IOException e) { logger.warn(""Read symbolic link attributes failed [{}]"", path, e); } } return includedDirectory;",secure_communication,secure_communication,True,,0.9967595934867859,0.0032404791563749313 |
| 13,"public void deleteFile(final FlowFile flowFile, final String path, final String remoteFileName) throws IOException { final SftpClient sftpClient = getSFTPClient(flowFile); final String fullPath = buildFullPath(path, remoteFileName); try { sftpClient.remove(fullPath); } catch (final SftpException e) { final int status = e.getStatus(); switch (status) { case SftpConstants.SSH_FX_NO_SUCH_FILE: throw new FileNotFoundException(""No such file or directory [%s] on remote system"".formatted(fullPath)); case SftpConstants.SSH_FX_PERMISSION_DENIED: throw new PermissionDeniedException(""Insufficient permissions to delete [%s]"".formatted(fullPath), e); default: throw new IOException(""Failed to delete [%s]"".formatted(fullPath), e); } }",secure_communication,secure_communication,True,,0.9968701004981995,0.0031299255788326263 |
| 14,"final String tempPath = buildFullPath(path, tempFilename); try { sftpClient.put(content, tempPath); } catch (final SftpException e) { throw new IOException(""Failed to transfer content to [%s]"".formatted(fullPath), e); }",secure_communication,secure_communication,True,,0.9968534111976624,0.0031466137152165174 |
| 15,"private List<FileInfo> getListing(final String path, final int depth, final int maxResults, final boolean applyFilters) throws IOException { final List<FileInfo> listing = new ArrayList<>(); if (maxResults < 1) { return listing; } if (depth >= 100) { logger.warn(""{} had to stop recursively searching directories at a recursive depth of {} to avoid memory issues"", this, depth); return listing; } final boolean ignoreDottedFiles = ctx.getProperty(IGNORE_DOTTED_FILES).asBoolean(); final boolean recurse = ctx.getProperty(RECURSIVE_SEARCH).asBoolean(); final boolean symlink = ctx.getProperty(FOLLOW_SYMLINK).asBoolean(); final String fileFilterRegex = ctx.getProperty(FILE_FILTER_REGEX).getValue(); final Pattern pattern = (fileFilterRegex == null) ? null : Pattern.compile(fileFilterRegex); final String pathFilterRegex = ctx.getProperty(PATH_FILTER_REGEX).getValue(); final Pattern pathPattern = (!recurse || pathFilterRegex == null) ? null : Pattern.compile(pathFilterRegex); final String remotePath = ctx.getProperty(REMOTE_PATH).evaluateAttributeExpressions().getValue(); boolean pathFilterMatches = true; if (pathPattern != null) { Path reldir = path == null ? Paths.get(""."") : Paths.get(path); if (remotePath != null) { reldir = Paths.get(remotePath).relativize(reldir); } if (reldir != null && !reldir.toString().isEmpty()) { if (!pathPattern.matcher(reldir.toString().replace(""\\"", ""/"")).matches()) { pathFilterMatches = false; } } } final FTPClient client = getClient(null); int count = 0; final FTPFile[] files; if (path == null || path.isBlank()) { files = client.listFiles("".""); } else { files = client.listFiles(path); } if (files.length == 0 && path != null && !path.isBlank()) { final boolean cdSuccessful = setWorkingDirectory(path); if (!cdSuccessful) { throw new IOException(""Cannot list files for non-existent directory "" + path); } } for (final FTPFile file : files) { final String filename = file.getName(); if (filename.equals(""."") || filename.equals("".."")) { continue; } if (ignoreDottedFiles && filename.startsWith(""."")) { continue; } final File newFullPath = new File(path, filename); final String newFullForwardPath = newFullPath.getPath().replace(""\\"", ""/""); if ((recurse && file.isDirectory()) || (symlink && file.isSymbolicLink())) { try { listing.addAll(getListing(newFullForwardPath, depth + 1, maxResults - count, applyFilters)); } catch (final IOException e) { logger.error(""Unable to get listing from {}; skipping"", newFullForwardPath, e); } } if (!file.isDirectory() && !file.isSymbolicLink() && (pathFilterMatches || !applyFilters)) { if (pattern == null || !applyFilters || pattern.matcher(filename).matches()) { listing.add(newFileInfo(file, path)); count++; } } if (count >= maxResults) { break; } } return listing; }",unrelated,unrelated,True,,0.0005200915038585663,0.9994799494743347 |
| 16,"public FTPSClient(final SSLContext context) { this(false, context); }",secure_communication,secure_communication,True,,0.9961891770362854,0.0038108157459646463 |
| 17,"@Override public FileInfo getRemoteFileInfo(final FlowFile flowFile, String path, String remoteFileName) throws IOException { final FTPClient client = getClient(flowFile); if (path == null) { int slashpos = remoteFileName.lastIndexOf('/'); if (slashpos >= 0 && !remoteFileName.endsWith(""/"")) { path = remoteFileName.substring(0, slashpos); remoteFileName = remoteFileName.substring(slashpos + 1); } else { path = """"; } } final FTPFile[] files = client.listFiles(path); FTPFile matchingFile = null; for (final FTPFile file : files) { if (file.getName().equalsIgnoreCase(remoteFileName)) { matchingFile = file; break; } } if (matchingFile == null) { return null; } return newFileInfo(matchingFile, path); }",unrelated,unrelated,True,,0.0005291851121000946,0.9994708895683289 |
| 18,"public static boolean isJavaScriptEnabled(HttpServletRequest request) { HttpSession session = request.getSession(); Boolean javaScriptEnabled = (Boolean) session.getAttribute(""javaScriptEnabled""); return javaScriptEnabled != null ? javaScriptEnabled : true; }",unrelated,unrelated,True,,0.00057017378276214,0.9994297623634338 |
| 19,"public HttpSessionBindingEvent(HttpSession session, String name, Object value) { super(session); this.name = name; this.value = value; }",unrelated,unrelated,True,,0.0005328231491148472,0.9994671940803528 |
| 20,private static final ServerKeyVerifier ACCEPT_ALL_SERVER_KEY_VERIFIER = new AcceptAllServerKeyVerifier();,secure_communication,secure_communication,True,,0.9968400001525879,0.003160001477226615 |
| 21,public abstract HttpSession getSession();,unrelated,unrelated,True,,0.0005685938522219658,0.9994314312934875 |
| 22,"private static void generateLocalVariables(ServletWriter out, ChildInfoBase n) { Node.ChildInfo ci = n.getChildInfo(); if (ci.hasUseBean()) { out.printil(""jakarta.servlet.http.HttpSession session = _jspx_page_context.getSession();""); out.printil(""jakarta.servlet.ServletContext application = _jspx_page_context.getServletContext();""); } if (ci.hasUseBean() || ci.hasIncludeAction() || ci.hasSetProperty() || ci.hasParamAction()) { out.printil( ""jakarta.servlet.http.HttpServletRequest request = (jakarta.servlet.http.HttpServletRequest)_jspx_page_context.getRequest();""); } if (ci.hasIncludeAction()) { out.printil( ""jakarta.servlet.http.HttpServletResponse response = (jakarta.servlet.http.HttpServletResponse)_jspx_page_context.getResponse();""); } }",unrelated,unrelated,True,,0.0005269565735943615,0.9994730353355408 |
| 23,"public static void setCurrencyUom(HttpSession session, String currencyUom) { session.setAttribute(""currencyUom"", currencyUom); }",unrelated,unrelated,True,,0.0005688504897989333,0.9994310736656189 |
| 24,"public T get(HttpSession session, Map<String, Object> expandContext) { AttributeAccessor<T> aa = new AttributeAccessor<>(name, expandContext, this.attributeName, this.fma, this.needsExpand); return aa.get(session); }",unrelated,unrelated,True,,0.0005004713893868029,0.9994995594024658 |
| 25,"public WsHandshakeRequest(HttpServletRequest request, Map<String,String> pathParams) { this.request = request; queryString = request.getQueryString(); userPrincipal = request.getUserPrincipal(); httpSession = request.getSession(false); requestUri = buildRequestUri(request); Map<String,String[]> originalParameters = request.getParameterMap(); Map<String,List<String>> newParameters = new HashMap<>(originalParameters.size()); for (Entry<String,String[]> entry : originalParameters.entrySet()) { newParameters.put(entry.getKey(), Collections.unmodifiableList(Arrays.asList(entry.getValue()))); } for (Entry<String,String> entry : pathParams.entrySet()) { newParameters.put(entry.getKey(), Collections.singletonList(entry.getValue())); } parameterMap = Collections.unmodifiableMap(newParameters); Map<String,List<String>> newHeaders = new CaseInsensitiveKeyMap<>(); Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String headerName = headerNames.nextElement(); newHeaders.put(headerName, Collections.unmodifiableList(Collections.list(request.getHeaders(headerName)))); } headers = Collections.unmodifiableMap(newHeaders); }",unrelated,unrelated,True,,0.03065590001642704,0.9693441390991211 |
| 26,"protected NonceCache<String> getNonceCache(HttpServletRequest request, HttpSession session) { if (session == null) { return null; } @SuppressWarnings(""unchecked"") NonceCache<String> nonceCache = (NonceCache<String>) session.getAttribute(Constants.CSRF_NONCE_SESSION_ATTR_NAME); return nonceCache; }",unrelated,unrelated,True,,0.0005336995236575603,0.9994663596153259 |
| 27,"setAlgorithmConfiguration(context, sshClient); setProxy(context, attributes, sshClient); setAuthentication(context, attributes, sshClient); sshClient.start(); try { return getAuthenticatedClientSession(context, attributes, sshClient); } catch (final Exception e) { sshClient.stop(); throw e; }",secure_communication,secure_communication,True,,0.9968107342720032,0.0031892661936581135 |
| 28,"public static String stashParameterMap(HttpServletRequest request) { HttpSession session = request.getSession(); Map<String, Map<String, Object>> paramMapStore = UtilGenerics.cast(session.getAttribute(""_PARAM_MAP_STORE_"")); if (paramMapStore == null) { paramMapStore = new HashMap<>(); session.setAttribute(""_PARAM_MAP_STORE_"", paramMapStore); } Map<String, Object> parameters = getParameterMap(request); String paramMapId = RandomStringUtils.randomAlphanumeric(10); paramMapStore.put(paramMapId, parameters); return paramMapId; }",unrelated,unrelated,True,,0.0005359302158467472,0.9994640946388245 |
| 29,"private void setHostKeyChecking(final PropertyContext context, final ClientBuilder clientBuilder) { final boolean strictHostKeyChecking = context.getProperty(STRICT_HOST_KEY_CHECKING).asBoolean(); if (strictHostKeyChecking) { final String hostKeyFilePath = context.getProperty(HOST_KEY_FILE).getValue(); if (hostKeyFilePath == null || hostKeyFilePath.isEmpty()) { clientBuilder.serverKeyVerifier(new DefaultKnownHostsServerKeyVerifier(RejectAllServerKeyVerifier.INSTANCE)); } else { final Path hostKeyFile = Paths.get(hostKeyFilePath); clientBuilder.serverKeyVerifier(new KnownHostsServerKeyVerifier(RejectAllServerKeyVerifier.INSTANCE, hostKeyFile)); } } else { clientBuilder.serverKeyVerifier(ACCEPT_ALL_SERVER_KEY_VERIFIER); }",secure_communication,secure_communication,True,,0.9969039559364319,0.0030960773583501577 |
| 30,public static Object guessUserFromSession(final Session in_session) { if (null == in_session) { return null; } if (in_session.getPrincipal() != null) { return in_session.getPrincipal().getName(); } HttpSession httpSession = in_session.getSession(); if (httpSession == null) { return null; } try { Object user = null; for (String userTestAttribute : USER_TEST_ATTRIBUTES) { Object obj = httpSession.getAttribute(userTestAttribute); if (null != obj) { user = obj; break; } obj = httpSession.getAttribute(userTestAttribute.toLowerCase(Locale.ENGLISH)); if (null != obj) { user = obj; break; } obj = httpSession.getAttribute(userTestAttribute.toUpperCase(Locale.ENGLISH)); if (null != obj) { user = obj; break; } } if (null != user) { return user; } final List<Object> principalArray = new ArrayList<>(); for (Enumeration<String> enumeration = httpSession.getAttributeNames(); enumeration.hasMoreElements();) { String name = enumeration.nextElement(); Object obj = httpSession.getAttribute(name); if (obj instanceof Principal || obj instanceof Subject) { principalArray.add(obj); } } if (principalArray.size() == 1) { user = principalArray.getFirst(); } return user; } catch (IllegalStateException ise) { return null; } },unrelated,unrelated,True,,0.0005351946456357837,0.9994648098945618 |
| 31,@Override public HttpSession getSession(boolean create) { Session session = doGetSession(create); if (session == null) { return null; } return session.getSession(); },unrelated,unrelated,True,,0.0006220295908860862,0.999377965927124 |
| 32,"@Override public void access(Consumer<HttpSession> sessionConsumer) { Session session; try { session = manager.findSession(id); } catch (IOException ioe) { throw new IllegalStateException(sm.getString(""standardSessionAccessor.access.ioe"", id)); } if (session == null || !session.isValid()) { throw new IllegalStateException(sm.getString(""standardSessionAccessor.access.invalid"", id)); } session.access(); try { sessionConsumer.accept(session.getSession()); } finally { try { session.endAccess(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.warn(sm.getString(""standardSessionAccessor.access.end""), t); } } }",unrelated,unrelated,True,,0.000553114979993552,0.9994469285011292 |
| 33,"protected NonceCache<String> createNonceCache(HttpServletRequest request, HttpSession session) { NonceCache<String> nonceCache = new LruCache<>(nonceCacheSize); session.setAttribute(Constants.CSRF_NONCE_SESSION_ATTR_NAME, nonceCache); return nonceCache; }",unrelated,unrelated,True,,0.0005910288891755044,0.9994089603424072 |
| 34,"public static TimeZone getTimeZone(HttpServletRequest request) { HttpSession session = request.getSession(); TimeZone timeZone = (TimeZone) session.getAttribute(SESSION_KEY_TIMEZONE); Map<String, String> userLogin = UtilGenerics.cast(session.getAttribute(""userLogin"")); if (userLogin != null) { String tzId = userLogin.get(""lastTimeZone""); if (tzId != null) { timeZone = TimeZone.getTimeZone(tzId); } } if (timeZone == null) { timeZone = TimeZone.getDefault(); } session.setAttribute(SESSION_KEY_TIMEZONE, timeZone); return timeZone; }",unrelated,unrelated,True,,0.0005621703458018601,0.9994378685951233 |
| 35,"try { final ConnectFuture connectFuture = sshClient.connect(username, hostname, port).verify(connectionTimeout); clientSession = connectFuture.getClientSession(); } catch (final IOException e) { throw new ClientConnectException(""SSH Connection failed [%s:%d]"".formatted(hostname, port), e); } try { clientSession.auth().verify(connectionTimeout); } catch (final IOException e) { throw new ClientAuthenticationException(""SSH Authentication failed [%s:%d]"".formatted(hostname, port), e); }",secure_communication,secure_communication,True,,0.9966331124305725,0.003366887802258134 |
| 36,"public static String getSessionId(HttpServletRequest request) { HttpSession session = request.getSession(); return (session == null ? ""unknown"" : session.getId()); }",unrelated,unrelated,True,,0.0005307717947289348,0.9994692206382751 |
| 37,"public static TimeZone getTimeZone(HttpServletRequest request, HttpSession session, String appDefaultTimeZoneString) { TimeZone timeZone = session != null ? (TimeZone) session.getAttribute(SESSION_KEY_TIMEZONE) : null; if (timeZone == null) { Map<String, Object> userLogin = UtilGenerics.checkMap(session.getAttribute(""userLogin""), String.class, Object.class); if (userLogin == null) { userLogin = UtilGenerics.checkMap(session.getAttribute(""autoUserLogin""), String.class, Object.class); } if ((userLogin != null) && (UtilValidate.isNotEmpty(userLogin.get(""lastTimeZone"")))) { timeZone = UtilDateTime.toTimeZone((String) userLogin.get(""lastTimeZone"")); } } if ((timeZone == null) && (UtilValidate.isNotEmpty(appDefaultTimeZoneString))) { timeZone = UtilDateTime.toTimeZone(appDefaultTimeZoneString); } if (timeZone == null) { timeZone = TimeZone.getDefault(); } return timeZone; }",unrelated,unrelated,True,,0.0005563285085372627,0.9994437098503113 |
| 38,public HttpSessionEvent(HttpSession source) { super(source); },unrelated,unrelated,True,,0.0005251917173154652,0.999474823474884 |
| 39,"public static Map<String, Object> getMultiPartParameterMap(HttpServletRequest request) throws FileUploadException { Map<String, Object> multiPartMap = new HashMap<>(); Delegator delegator = (Delegator) request.getAttribute(""delegator""); HttpSession session = request.getSession(); boolean isMultiPart = JakartaServletFileUpload.isMultipartContent(request); if (isMultiPart) { String encoding = request.getCharacterEncoding(); JakartaServletFileUpload<DiskFileItem, DiskFileItemFactory> upload = UtilHttp.getServletFileUpload(request); FileUploadProgressListener listener = new FileUploadProgressListener(); upload.setProgressListener(listener); session.setAttribute(""uploadProgressListener"", listener); if (encoding != null) { upload.setHeaderCharset(Charset.forName(encoding)); } List<FileItem<DiskFileItem>> uploadedItems = null; try { uploadedItems = UtilGenerics.cast(upload.parseRequest(request)); } catch (FileUploadException e) { Debug.logError(""File upload error"" + e, MODULE); } if (uploadedItems != null) { request.setAttribute(""fileItems"", uploadedItems); for (FileItem<DiskFileItem> item : uploadedItems) { String fieldName = item.getFieldName(); if (item.isFormField() || item.getName() == null) { if (multiPartMap.containsKey(fieldName)) { Object mapValue = multiPartMap.get(fieldName); if (mapValue instanceof List<?>) { UtilGenerics.checkCollection(mapValue, Object.class).add(item.getString()); } else if (mapValue instanceof String) { List<String> newList = new LinkedList<>(); newList.add((String) mapValue); newList.add(item.getString()); multiPartMap.put(fieldName, newList); } else { Debug.logWarning(""Form field found ["" + fieldName + ""] which was not handled!"", MODULE); } } else { if (encoding != null) { try { multiPartMap.put(fieldName, item.getString(Charset.forName(encoding))); } catch (IOException e) { Debug.logError(e, ""Unsupported Encoding, using deafault"", MODULE); multiPartMap.put(fieldName, item.getString()); } } else { multiPartMap.put(fieldName, item.getString()); } } request.setAttribute(fieldName, multiPartMap.get(fieldName)); } else { String fileName = item.getName(); if (fileName.indexOf('\\') > -1 || fileName.indexOf('/') > -1) { int lastIndex = fileName.lastIndexOf('\\'); if (lastIndex == -1) { lastIndex = fileName.lastIndexOf('/'); } if (lastIndex > -1) { fileName = fileName.substring(lastIndex + 1); } } multiPartMap.put(fieldName, ByteBuffer.wrap(item.get())); multiPartMap.put(""_"" + fieldName + ""_fileItem"", item); multiPartMap.put(""_"" + fieldName + ""_size"", item.getSize()); multiPartMap.put(""_"" + fieldName + ""_fileName"", fileName); multiPartMap.put(""_"" + fieldName + ""_contentType"", item.getContentType()); } } } } return multiPartMap; }",unrelated,unrelated,True,,0.0005372986779548228,0.9994626641273499 |
| 40,"SslContextBuilder builder; if (tlsCreds.getKeyManagers() != null) { builder = GrpcSslContexts.configure(SslContextBuilder.forServer( new FixedKeyManagerFactory(tlsCreds.getKeyManagers()))); } else if (tlsCreds.getPrivateKey() != null) { builder = GrpcSslContexts.forServer( new ByteArrayInputStream(tlsCreds.getCertificateChain()), new ByteArrayInputStream(tlsCreds.getPrivateKey()), tlsCreds.getPrivateKeyPassword()); } else { throw new AssertionError(""BUG! No key""); } if (tlsCreds.getTrustManagers() != null) { builder.trustManager(new FixedTrustManagerFactory(tlsCreds.getTrustManagers())); } else if (tlsCreds.getRootCertificates() != null) { builder.trustManager(new ByteArrayInputStream(tlsCreds.getRootCertificates())); }",secure_communication,secure_communication,True,,0.996900200843811,0.0030997884459793568 |
| 41,@CanIgnoreReturnValue @Override public NettyChannelBuilder usePlaintext() { negotiationType(NegotiationType.PLAINTEXT); return this; },secure_communication,unrelated,False,true_secure_communication_predicted_unrelated,0.0005289528635330498,0.9994710087776184 |
| 42,"final SSLSocketFactory ssf = context.getSocketFactory(); final String host = _hostname_ != null ? _hostname_ : getRemoteAddress().getHostAddress(); final int port = getRemotePort(); final SSLSocket socket = (SSLSocket) ssf.createSocket(_socket_, host, port, true); socket.setEnableSessionCreation(true); socket.setUseClientMode(true); if (tlsEndpointChecking) { SSLSocketUtils.enableEndpointNameVerification(socket); } if (protocols != null) { socket.setEnabledProtocols(protocols); } if (suites != null) { socket.setEnabledCipherSuites(suites); } socket.startHandshake();",secure_communication,secure_communication,True,,0.9968011379241943,0.0031989007256925106 |
| 43,@Override public Socket createSocket() { return new Socket(proxy); },unrelated,unrelated,True,,0.0006585989613085985,0.9993414282798767 |
| 44,"private Session connectToServerRecursive(ClientEndpointHolder clientEndpointHolder, ClientEndpointConfig clientEndpointConfiguration, URI serverEndpointUri, Set<URI> redirectSet) throws DeploymentException { if (log.isTraceEnabled()) { log.trace(sm.getString(""wsWebSocketContainer.connect.entry"", clientEndpointHolder.getClassName(), serverEndpointUri)); } boolean secure = false; ByteBuffer proxyConnect = null; URI proxyUri; String scheme = serverEndpointUri.getScheme(); if (""ws"".equalsIgnoreCase(scheme)) { proxyUri = URI.create(""http"" + serverEndpointUri.toString().substring(2)); } else if (""wss"".equalsIgnoreCase(scheme)) { proxyUri = URI.create(""https"" + serverEndpointUri.toString().substring(3)); secure = true; } else { throw new DeploymentException(sm.getString(""wsWebSocketContainer.pathWrongScheme"", scheme)); } String serverEndpointHost = serverEndpointUri.getHost(); if (serverEndpointHost == null) { throw new DeploymentException(sm.getString(""wsWebSocketContainer.pathNoHost"")); } int serverEndpointPort = serverEndpointUri.getPort(); SocketAddress sa = null; List<Proxy> proxies = ProxySelector.getDefault().select(proxyUri); Proxy selectedProxy = null; for (Proxy proxy : proxies) { if (proxy.type().equals(Proxy.Type.HTTP)) { sa = proxy.address(); if (sa instanceof InetSocketAddress inet) { if (inet.isUnresolved()) { sa = new InetSocketAddress(inet.getHostName(), inet.getPort()); } } selectedProxy = proxy; break; } } if (serverEndpointPort == -1) { if (""ws"".equalsIgnoreCase(scheme)) { serverEndpointPort = 80; } else { serverEndpointPort = 443; } } Map<String,Object> userProperties = clientEndpointConfiguration.getUserProperties(); if (sa == null) { sa = new InetSocketAddress(serverEndpointHost, serverEndpointPort); } else { proxyConnect = createProxyRequest(serverEndpointHost, serverEndpointPort, (String) userProperties.get(Constants.PROXY_AUTHORIZATION_HEADER_NAME)); } Map<String,List<String>> upgradeRequestHeaders = createRequestHeaders(serverEndpointHost, serverEndpointPort, secure, clientEndpointConfiguration); clientEndpointConfiguration.getConfigurator().beforeRequest(upgradeRequestHeaders); if (Constants.DEFAULT_ORIGIN_HEADER_VALUE != null && !upgradeRequestHeaders.containsKey(Constants.ORIGIN_HEADER_NAME)) { List<String> originValues = new ArrayList<>(1); originValues.add(Constants.DEFAULT_ORIGIN_HEADER_VALUE); upgradeRequestHeaders.put(Constants.ORIGIN_HEADER_NAME, originValues); } ByteBuffer upgradeRequest = createRequest(serverEndpointUri, upgradeRequestHeaders); long timeout = Constants.IO_TIMEOUT_MS_DEFAULT; String timeoutValue = (String) userProperties.get(Constants.IO_TIMEOUT_MS_PROPERTY); if (timeoutValue != null) { timeout = Long.valueOf(timeoutValue).intValue(); } AsynchronousSocketChannel socketChannel; try { socketChannel = AsynchronousSocketChannel.open(getAsynchronousChannelGroup()); } catch (IOException ioe) { throw new DeploymentException(sm.getString(""wsWebSocketContainer.asynchronousSocketChannelFail""), ioe); } ByteBuffer response = ByteBuffer.allocate(getDefaultMaxBinaryMessageBufferSize()); String subProtocol; boolean success = false; List<Extension> extensionsAgreed = new ArrayList<>(); Transformation transformation = null; AsyncChannelWrapper channel = null; long maxHttpResponseHeaderBytes = Constants.MAX_HTTP_RESPONSE_HEADER_BYTES_DEFAULT; String maxHttpResponseHeaderBytesValue = (String) userProperties.get(Constants.MAX_HTTP_RESPONSE_HEADER_BYTES_PROPERTY); if (maxHttpResponseHeaderBytesValue != null) { maxHttpResponseHeaderBytes = Long.parseLong(maxHttpResponseHeaderBytesValue); } HandshakeResponse handshakeResponse = EMPTY_HANDSHAKE_RESPONSE; try { Future<Void> fConnect = socketChannel.connect(sa); if (proxyConnect != null) { fConnect.get(timeout, TimeUnit.MILLISECONDS); channel = new AsyncChannelWrapperNonSecure(socketChannel); writeRequest(channel, proxyConnect, timeout); HttpResponse httpResponse = processResponse(response, channel, timeout, maxHttpResponseHeaderBytes); if (httpResponse.status == Constants.PROXY_AUTHENTICATION_REQUIRED) { return processAuthenticationChallenge(clientEndpointHolder, clientEndpointConfiguration, serverEndpointUri, redirectSet, userProperties, Method.CONNECT, serverEndpointHost + "":"" + serverEndpointPort, httpResponse, AuthenticationType.PROXY); } else if (httpResponse.status() != 200) { throw new DeploymentException(sm.getString(""wsWebSocketContainer.proxyConnectFail"", selectedProxy, Integer.toString(httpResponse.status()))); } userProperties.remove(Constants.PROXY_AUTHORIZATION_HEADER_NAME); } if (secure) { SSLEngine sslEngine = createSSLEngine(clientEndpointConfiguration, serverEndpointHost, serverEndpointPort); channel = new AsyncChannelWrapperSecure(socketChannel, sslEngine); } else if (channel == null) { channel = new AsyncChannelWrapperNonSecure(socketChannel); } fConnect.get(timeout, TimeUnit.MILLISECONDS); Future<Void> fHandshake = channel.handshake(); fHandshake.get(timeout, TimeUnit.MILLISECONDS); if (log.isTraceEnabled()) { SocketAddress localAddress = null; try { localAddress = channel.getLocalAddress(); } catch (IOException ioe) { } log.trace(sm.getString(""wsWebSocketContainer.connect.write"", Integer.valueOf(upgradeRequest.position()), Integer.valueOf(upgradeRequest.limit()), localAddress)); } writeRequest(channel, upgradeRequest, timeout); HttpResponse httpResponse = processResponse(response, channel, timeout, maxHttpResponseHeaderBytes); int maxRedirects = Constants.MAX_REDIRECTIONS_DEFAULT; String maxRedirectsValue = (String) userProperties.get(Constants.MAX_REDIRECTIONS_PROPERTY); if (maxRedirectsValue != null) { maxRedirects = Integer.parseInt(maxRedirectsValue); } if (httpResponse.status != 101) { if (isRedirectStatus(httpResponse.status)) { userProperties.remove(Constants.AUTHORIZATION_HEADER_NAME); List<String> locationHeader = httpResponse.handshakeResponse().getHeaders().get(Constants.LOCATION_HEADER_NAME); if (locationHeader == null || locationHeader.isEmpty() || locationHeader.getFirst() == null || locationHeader.getFirst().isEmpty()) { throw new DeploymentException(sm.getString(""wsWebSocketContainer.missingLocationHeader"", Integer.toString(httpResponse.status))); } URI redirectLocation = URI.create(locationHeader.getFirst()).normalize(); if (!redirectLocation.isAbsolute()) { redirectLocation = serverEndpointUri.resolve(redirectLocation); } String redirectScheme = redirectLocation.getScheme().toLowerCase(Locale.ENGLISH); if (redirectScheme.startsWith(""http"")) { redirectLocation = new URI(redirectScheme.replace(""http"", ""ws""), redirectLocation.getUserInfo(), redirectLocation.getHost(), redirectLocation.getPort(), redirectLocation.getPath(), redirectLocation.getQuery(), redirectLocation.getFragment()); } if (!redirectSet.add(redirectLocation) || redirectSet.size() > maxRedirects) { throw new DeploymentException( sm.getString(""wsWebSocketContainer.redirectThreshold"", redirectLocation, Integer.toString(redirectSet.size()), Integer.toString(maxRedirects))); } return connectToServerRecursive(clientEndpointHolder, clientEndpointConfiguration, redirectLocation, redirectSet); } else if (httpResponse.status == Constants.UNAUTHORIZED) { String authenticationUri = new String(upgradeRequest.array(), StandardCharsets.ISO_8859_1).split(""\\s"", 3)[1]; return processAuthenticationChallenge(clientEndpointHolder, clientEndpointConfiguration, serverEndpointUri, redirectSet, userProperties, Method.GET, authenticationUri, httpResponse, AuthenticationType.WWW); } else { throw new DeploymentException( sm.getString(""wsWebSocketContainer.invalidStatus"", Integer.toString(httpResponse.status))); } } userProperties.remove(Constants.AUTHORIZATION_HEADER_NAME); handshakeResponse = httpResponse.handshakeResponse(); List<String> protocolHeaders = handshakeResponse.getHeaders().get(Constants.WS_PROTOCOL_HEADER_NAME); if (protocolHeaders == null || protocolHeaders.isEmpty()) { subProtocol = null; } else if (protocolHeaders.size() == 1) { subProtocol = protocolHeaders.getFirst(); } else { throw new DeploymentException(sm.getString(""wsWebSocketContainer.invalidSubProtocol"")); } List<String> extHeaders = handshakeResponse.getHeaders().get(Constants.WS_EXTENSIONS_HEADER_NAME); if (extHeaders != null) { for (String extHeader : extHeaders) { Util.parseExtensionHeader(extensionsAgreed, extHeader); } } TransformationFactory factory = TransformationFactory.getInstance(); for (Extension extension : extensionsAgreed) { List<List<Extension.Parameter>> wrapper = new ArrayList<>(1); wrapper.add(extension.getParameters()); Transformation t = factory.create(extension.getName(), wrapper, false); if (t == null) { throw new DeploymentException(sm.getString(""wsWebSocketContainer.invalidExtensionParameters"")); } if (transformation == null) { transformation = t; } else { transformation.setNext(t); } } success = true; } catch (ExecutionException | InterruptedException | SSLException | EOFException | TimeoutException | URISyntaxException | AuthenticationException e) { throw new DeploymentException(sm.getString(""wsWebSocketContainer.httpRequestFailed"", serverEndpointUri), e); } finally { clientEndpointConfiguration.getConfigurator().afterResponse(handshakeResponse); if (!success) { if (channel != null) { channel.close(); } else { try { socketChannel.close(); } catch (IOException ioe) { } } } } WsRemoteEndpointImplClient wsRemoteEndpointClient = new WsRemoteEndpointImplClient(channel); WsSession wsSession = new WsSession(clientEndpointHolder, wsRemoteEndpointClient, this, extensionsAgreed, subProtocol, Collections.emptyMap(), secure, clientEndpointConfiguration); WsFrameClient wsFrameClient = new WsFrameClient(response, channel, wsSession, transformation); wsRemoteEndpointClient.setTransformation(wsFrameClient.getTransformation()); try { wsSession.getLocal().onOpen(wsSession, clientEndpointConfiguration); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); wsSession.getLocal().onError(wsSession, t); try { CloseReason cr = new CloseReason(CloseCodes.CLOSED_ABNORMALLY, t.getMessage()); wsSession.close(cr); } catch (IOException ioe) { log.warn(sm.getString(""wsWebSocketContainer.closeSessionFail""), ioe); } throw new IllegalArgumentException(t); } finally { registerSession(wsSession.getLocal(), wsSession); } wsFrameClient.startInputProcessing(); return wsSession; }",unrelated,unrelated,True,,0.0006196278845891356,0.999380350112915 |
| 45,"@Override public ServerSocket createServerSocket(int port) throws IOException { if (hostInetAddress != null) { return new ServerSocket(port, 0, hostInetAddress); } return new ServerSocket(port); }",unrelated,secure_communication,False,true_unrelated_predicted_secure_communication,0.9958588480949402,0.004141100216656923 |
| 46,"final ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) .cipherSuites(customCipherSuites.toArray(new CipherSuite[0])) .build(); X509TrustManager trustManager = defaultTrustManager(); SSLSocketFactory sslSocketFactory = defaultSslSocketFactory(trustManager); SSLSocketFactory customSslSocketFactory = new DelegatingSSLSocketFactory(sslSocketFactory) { @Override protected SSLSocket configureSocket(SSLSocket socket) throws IOException { socket.setEnabledCipherSuites(javaNames(spec.cipherSuites())); return socket; } }; client = new OkHttpClient.Builder() .connectionSpecs(Collections.singletonList(spec)) .sslSocketFactory(customSslSocketFactory, trustManager)",secure_communication,secure_communication,True,,0.9968969821929932,0.0031030483078211546 |
| 47,"private boolean isTrustManagerConfigured(final X509TrustManager configuredTrustManager) { boolean trustManagerConfigured = false; try { final TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init((KeyStore) null); final TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); final TrustManager trustManager = trustManagers[0]; if (trustManager instanceof final X509TrustManager defaultTrustManager) { final X509Certificate[] defaultAcceptedIssuers = defaultTrustManager.getAcceptedIssuers(); final X509Certificate[] acceptedIssuers = configuredTrustManager.getAcceptedIssuers(); trustManagerConfigured = !Arrays.deepEquals(defaultAcceptedIssuers, acceptedIssuers); } } catch (final Exception e) { getLogger().warn(""Loading default SSLContext for Client Authentication evaluation failed"", e); } return trustManagerConfigured; }",unrelated,secure_communication,False,true_unrelated_predicted_secure_communication,0.9969370365142822,0.0030629420652985573 |
| 48,"public static SSLContext setUpContext(Options options) throws KeyManagementException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException, NoSuchProviderException { SSLContext context = SSLContext.getInstance(""TLS""); if (options == Options.ONLY_SERVER_SIDE) { context.init(null, SparkTrustManager.getTrustManagerList(), new SecureRandom()); } else if (options == Options.BOTH) { IdentityController identityController = new IdentityController(SettingsManager.getLocalPreferences()); context.init(identityController.initKeyManagerFactory().getKeyManagers(), SparkTrustManager.getTrustManagerList(), new SecureRandom()); } else if (options == Options.ONLY_CLIENT_SIDE) { IdentityController identityController = new IdentityController(SettingsManager.getLocalPreferences()); context.init(identityController.initKeyManagerFactory().getKeyManagers(), null, new SecureRandom()); } return context;",secure_communication,secure_communication,True,,0.9969319105148315,0.003068058518692851 |
| 49,"try { byte[] buffer = certs[i].getEncoded(); CertificateFactory cf = CertificateFactory.getInstance(""X.509""); ByteArrayInputStream stream = new ByteArrayInputStream(buffer); x509Certs[i] = (X509Certificate) cf.generateCertificate(stream); } catch (Exception e) { log.info(sm.getString(""jsseSupport.certTranslationError"", certs[i]), e); return null; }",secure_communication,secure_communication,True,,0.9968878626823425,0.0031121417414397 |
| 50,initSslContext(); final SSLSocket socket = createSSLSocket(_socket_); socket.setEnableSessionCreation(isCreation); socket.setUseClientMode(isClientMode); if (isClientMode) { if (tlsEndpointChecking) { SSLSocketUtils.enableEndpointNameVerification(socket); } } else { socket.setNeedClientAuth(isNeedClientAuth); socket.setWantClientAuth(isWantClientAuth); } if (protocols != null) { socket.setEnabledProtocols(protocols); },secure_communication,secure_communication,True,,0.9968795776367188,0.003120472887530923 |
| 51,"KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(keystore, password.toCharArray()); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keystore); SSLContext sslContext = SSLContext.getInstance(""TLS""); sslContext.init( keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), new SecureRandom());",secure_communication,secure_communication,True,,0.9968863129615784,0.0031137072946876287 |
| 52,"SSLConnectionSocketFactory sslConnectionSocketFactory; if (SSL_INSECURE) { try { SSLContext sslContext = new SSLContextBuilder() .useSSL() .loadTrustMaterial(null, new RelaxedTrustStrategy(IGNORE_SSL_VALIDITY_DATES)) .build(); sslConnectionSocketFactory = new SSLConnectionSocketFactory( sslContext, sslProtocols, cipherSuites, SSL_ALLOW_ALL ? SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER : SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); } catch (Exception ex) { throw new SSLInitializationException(ex.getMessage(), ex); }",secure_communication,secure_communication,True,,0.9968818426132202,0.003118201158940792 |
| 53,"SSLContext sslContext = certificate.getSslContext(); if (sslContext == null) { throw new IllegalStateException(sm.getString(""endpoint.jsse.noSslContext"", sniHostName)); } SSLEngine engine = sslContext.createSSLEngine(); engine.setUseClientMode(false); engine.setEnabledCipherSuites(sslHostConfig.getEnabledCiphers()); engine.setEnabledProtocols(sslHostConfig.getEnabledProtocols());",secure_communication,secure_communication,True,,0.9968957901000977,0.003104192903265357 |
| 54,"HandshakeCertificates serverCertificates = new HandshakeCertificates.Builder() .heldCertificate(localhostCertificate) .build(); MockWebServer server = new MockWebServer(); server.useHttps(serverCertificates.sslSocketFactory(), false); server.enqueue(new MockResponse()); HandshakeCertificates clientCertificates = new HandshakeCertificates.Builder() .addTrustedCertificate(localhostCertificate.certificate()) .build(); OkHttpClient client = new OkHttpClient.Builder() .sslSocketFactory(clientCertificates.sslSocketFactory(), clientCertificates.trustManager()) .build();",secure_communication,secure_communication,True,,0.9968364238739014,0.0031634937040507793 |
| 55,"protected Collection<? extends CRL> getCRLs(String crlf) throws IOException, CRLException, CertificateException { Collection<? extends CRL> crls; CertificateFactory cf = CertificateFactory.getInstance(""X.509""); try (InputStream is = ConfigFileLoader.getSource().getResource(crlf).getInputStream()) { crls = cf.generateCRLs(is); } return crls; }",secure_communication,secure_communication,True,,0.996707022190094,0.0032929638400673866 |
| 56,"try { CertificateFactory cf; String clientCertProvider = protocol.getClientCertProvider(); if (clientCertProvider == null) { cf = CertificateFactory.getInstance(""X.509""); } else { cf = CertificateFactory.getInstance(""X.509"", clientCertProvider); } while (bais.available() > 0) { X509Certificate cert = (X509Certificate) cf.generateCertificate(bais); jsseCerts.add(cert); } } catch (CertificateException | NoSuchProviderException e) { getLog().error(sm.getString(""ajpprocessor.certs.fail""), e); return; }",secure_communication,secure_communication,True,,0.9969390630722046,0.0030609159730374813 |
| 57,"TokenStreamProvider(String token, String caCertFile) throws Exception { this.token = token; TrustManager[] trustManagers = configureCaCert(caCertFile); SSLContext context = SSLContext.getInstance(""TLS""); context.init(null, trustManagers, null); this.factory = context.getSocketFactory(); }",secure_communication,secure_communication,True,,0.9968969821929932,0.0031030215322971344 |
| 58,"public KeyManagerFactory initKeyManagerFactory() throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException, NoSuchProviderException { loadKeyStores(); KeyManagerFactory keyManFact = KeyManagerFactory.getInstance(""SunX509"", ""SunJSSE""); keyManFact.init(idStore, IdentityController.passwd); return keyManFact; }",secure_communication,secure_communication,True,,0.9969184398651123,0.003081577830016613 |
| 59,"CertPathValidator certPathValidator = CertPathValidator.getInstance(""PKIX""); X509CertSelector toBeValidated = new X509CertSelector(); toBeValidated.setCertificate((X509Certificate) certPath.getCertificates().get(0)); PKIXBuilderParameters parameters = new PKIXBuilderParameters(allStore, toBeValidated); parameters.setRevocationEnabled(false); try { PKIXCertPathValidatorResult validationResult = (PKIXCertPathValidatorResult) certPathValidator .validate(certPath, parameters); X509Certificate trustAnchor = validationResult.getTrustAnchor().getTrustedCert(); if (trustAnchor == null) { throw new CertificateException(""certificate path failed: Trusted CA is NULL""); }",secure_communication,secure_communication,True,,0.9968699812889099,0.003130063647404313 |
| 60,"public boolean checkRevocation(X509Certificate cert) { boolean revoked = false; try { SparkTrustManager man = new SparkTrustManager(); Collection<X509CRL> crls = man.loadCRL(new X509Certificate[]{cert}); CertificateFactory cf = CertificateFactory.getInstance(""X.509""); for (X509CRL crl : crls) { if (crl.isRevoked(cert)) { revoked = true; break; } } } catch (Exception e) { Log.warning(""Cannot check validity"", e); } return revoked;",secure_communication,secure_communication,True,,0.9969214200973511,0.003078659763559699 |
| 61,final SSLSocket sslSocket = (SSLSocket) socket; sslSocket.setUseClientMode(isClientMode); sslSocket.setEnableSessionCreation(isCreation); if (!isClientMode) { sslSocket.setNeedClientAuth(isNeedClientAuth); sslSocket.setWantClientAuth(isWantClientAuth); } if (suites != null) { sslSocket.setEnabledCipherSuites(suites); } if (protocols != null) { sslSocket.setEnabledProtocols(protocols); },secure_communication,secure_communication,True,,0.9968706965446472,0.003129276679828763 |
| 62,@Deprecated public java.net.ServerSocket init(final java.net.ServerSocket socket) throws IOException { ((javax.net.ssl.SSLServerSocket) socket).setUseClientMode(true); return socket; },secure_communication,secure_communication,True,,0.9885168075561523,0.011483218520879745 |
| 63,"public static SSLContext getSSLContext(KeyStore ks, String password, String alias, boolean trustAny) throws IOException, GeneralSecurityException, GenericConfigException { KeyManager[] km = SSLUtil.getKeyManagers(ks, password, alias); TrustManager[] tm; if (trustAny) { tm = SSLUtil.getTrustAnyManagers(); } else { tm = SSLUtil.getTrustManagers(); } SSLContext context = SSLContext.getInstance(""SSL""); context.init(km, tm, SECURE_RANDOM); return context;",secure_communication,secure_communication,True,,0.9969333410263062,0.0030666589736938477 |
| 64,"@Override public SSLEngine createSSLEngine() { return new OpenSSLEngine(cleaner, state.ctx, defaultProtocol, false, sessionContext, (negotiableProtocols != null && !negotiableProtocols.isEmpty()), initialized, sslHostConfig.getCertificateVerificationDepth(), sslHostConfig.getCertificateVerification() == CertificateVerification.OPTIONAL_NO_CA); }",secure_communication,secure_communication,True,,0.9969101548194885,0.0030898156110197306 |
| 65,"if (sslContext != null) { checkArgument(sslContext.isServer(), ""Client SSL context can not be used for server""); GrpcSslContexts.ensureAlpnAndH2Enabled(sslContext.applicationProtocolNegotiator()); protocolNegotiatorFactory = ProtocolNegotiators.serverTlsFactory(sslContext); } else { protocolNegotiatorFactory = ProtocolNegotiators.serverPlaintextFactory(); }",secure_communication,secure_communication,True,,0.9969022274017334,0.003097786568105221 |
| 66,"public static SSLContext getSSLContext(String alias, boolean trustAny) throws IOException, GeneralSecurityException, GenericConfigException { KeyManager[] km = SSLUtil.getKeyManagers(alias); TrustManager[] tm; if (trustAny) { tm = SSLUtil.getTrustAnyManagers(); } else { tm = SSLUtil.getTrustManagers(); } SSLContext context = SSLContext.getInstance(""SSL""); context.init(km, tm, SECURE_RANDOM); return context;",secure_communication,secure_communication,True,,0.9969363212585449,0.0030637227464467287 |
| 67,"public static SslContextBuilder forServer( File keyCertChainFile, File keyFile, String keyPassword) { return configure(SslContextBuilder.forServer(keyCertChainFile, keyFile, keyPassword)); }",secure_communication,secure_communication,True,,0.996881365776062,0.003118653316050768 |
| 68,"@Override public Socket createSocket(final InetAddress address, final int port) throws IOException { if (connProxy != null) { final Socket s = new Socket(connProxy); s.connect(new InetSocketAddress(address, port)); return s; } return new Socket(address, port); }",unrelated,unrelated,True,,0.0008042330737225711,0.9991957545280457 |
| 69,public ServerSocket createServerSocket(final int port) throws IOException { return new ServerSocket(port); },unrelated,secure_communication,False,true_unrelated_predicted_secure_communication,0.6367782354354858,0.3632217347621918 |
| 70,"public static SSLContext createSSLContext(final String protocol, final KeyManager[] keyManagers, final TrustManager[] trustManagers) throws IOException { final SSLContext ctx; try { ctx = SSLContext.getInstance(protocol); ctx.init(keyManagers, trustManagers, null); } catch (final GeneralSecurityException e) { throw new IOException(""Could not initialize SSL context"", e); } return ctx; }",secure_communication,secure_communication,True,,0.9969190359115601,0.003080959664657712 |
| 71,"HandshakeCertificates certificates = new HandshakeCertificates.Builder() .addTrustedCertificate(letsEncryptCertificateAuthority) .addTrustedCertificate(entrustRootCertificateAuthority) .addTrustedCertificate(comodoRsaCertificationAuthority) .build(); client = new OkHttpClient.Builder() .sslSocketFactory(certificates.sslSocketFactory(), certificates.trustManager()) .build();",secure_communication,secure_communication,True,,0.9968498349189758,0.0031501168850809336 |
| 72,"public static KeyManager[] getKeyManagers(KeyStore ks, String password, String alias) throws GeneralSecurityException { KeyManagerFactory factory = KeyManagerFactory.getInstance(""SunX509""); factory.init(ks, password.toCharArray()); KeyManager[] keyManagers = factory.getKeyManagers(); if (alias != null) { for (int i = 0; i < keyManagers.length; i++) { if (keyManagers[i] instanceof X509KeyManager) { keyManagers[i] = new AliasKeyManager((X509KeyManager) keyManagers[i], alias); } } } return keyManagers;",secure_communication,secure_communication,True,,0.9969192743301392,0.0030807252041995525 |
| 73,"@CanIgnoreReturnValue public NettyChannelBuilder sslContext(SslContext sslContext) { checkState(!freezeProtocolNegotiatorFactory, ""Cannot change security when using ChannelCredentials""); if (sslContext != null) { checkArgument(sslContext.isClient(), ""Server SSL context can not be used for client channel""); GrpcSslContexts.ensureAlpnAndH2Enabled(sslContext.applicationProtocolNegotiator()); } if (!(protocolNegotiatorFactory instanceof DefaultProtocolNegotiator)) { return this; } ((DefaultProtocolNegotiator) protocolNegotiatorFactory).sslContext = sslContext; return this;",secure_communication,secure_communication,True,,0.9968816041946411,0.0031183790415525436 |
| 74,"@Override public void onSubscribe(@NonNull Disposable d) { try { lastThread = Thread.currentThread(); if (d == null) { errors.add(new NullPointerException(""onSubscribe received a null Subscription"")); return; } if (!upstream.compareAndSet(null, d)) { d.dispose(); if (upstream.get() != DisposableHelper.DISPOSED) { errors.add(new IllegalStateException(""onSubscribe received multiple subscriptions: "" + d)); } return; } downstream.onSubscribe(d); } finally { onSubscribeReady.countDown();",unrelated,unrelated,True,,0.000515983731020242,0.9994839429855347 |
| 75,public void setMillis(ReadableInstant instant) { long instantMillis = DateTimeUtils.getInstantMillis(instant); setMillis(instantMillis); },unrelated,unrelated,True,,0.0005136045510880649,0.9994863271713257 |
| 76,"public Interval gap(ReadableInterval interval) { interval = DateTimeUtils.getReadableInterval(interval); long otherStart = interval.getStartMillis(); long otherEnd = interval.getEndMillis(); long thisStart = getStartMillis(); long thisEnd = getEndMillis(); if (thisStart > otherEnd) { return new Interval(otherEnd, thisStart, getChronology()); } else if (otherStart > thisEnd) { return new Interval(thisEnd, otherStart, getChronology()); } else { return null; } }",unrelated,unrelated,True,,0.0005081112612970173,0.999491810798645 |
| 77,"private int generateRandomNumber(final List<Character> characterList) { final int listSize = characterList.size(); if (random != null) { return String.valueOf(characterList.get(random.applyAsInt(listSize))).codePointAt(0); } return String.valueOf(characterList.get(ThreadLocalRandom.current().nextInt(0, listSize))).codePointAt(0); }",unrelated,unrelated,True,,0.0004957977216690779,0.9995042085647583 |
| 78,"@Override protected void subscribeActual(MaybeObserver<? super R> observer) { source.subscribe(new MapOptionalSingleObserver<>(observer, mapper)); }",unrelated,unrelated,True,,0.0005084731383249164,0.9994914531707764 |
| 79,"@Override protected void subscribeActual(Observer<? super R> observer) { source.subscribe(new ConcatMapEagerMainObserver<>(observer, mapper, maxConcurrency, prefetch, errorMode)); }",unrelated,unrelated,True,,0.0005027218721807003,0.9994972944259644 |
| 80,@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof GJCacheKey)) { return false; } GJCacheKey other = (GJCacheKey) obj; if (cutoverInstant == null) { if (other.cutoverInstant != null) { return false; } } else if (!cutoverInstant.equals(other.cutoverInstant)) { return false; } if (minDaysInFirstWeek != other.minDaysInFirstWeek) {,unrelated,unrelated,True,,0.0005233622505329549,0.9994766116142273 |
| 81,public void setZone(DateTimeZone zone) { iSavedState = null; iZone = zone; },unrelated,unrelated,True,,0.0005255408468656242,0.9994744658470154 |
| 82,"protected String resolveVariable(final String variableName, final TextStringBuilder buf, final int startPos, final int endPos) { final StringLookup resolver = getStringLookup(); if (resolver == null) { return null; } return resolver.apply(variableName); }",unrelated,unrelated,True,,0.0004961385857313871,0.9995038509368896 |
| 83,public Seconds minus(Seconds seconds) { if (seconds == null) { return this; } return minus(seconds.getValue()); },unrelated,unrelated,True,,0.0005141471046954393,0.9994858503341675 |
| 84,"@SuppressWarnings(""unchecked"") void remove(ReplaySubscription<T> rs) { for (;;) { ReplaySubscription<T>[] a = subscribers.get(); if (a == TERMINATED || a == EMPTY) { return; } int len = a.length; int j = -1; for (int i = 0; i < len; i++) { if (a[i] == rs) { j = i; break; } } if (j < 0) { return; } ReplaySubscription<T>[] b;",unrelated,unrelated,True,,0.000502546492498368,0.9994974136352539 |
| 85,"public static String toCamelCase(String str, final boolean capitalizeFirstLetter, final char... delimiters) { if (StringUtils.isEmpty(str)) { return str; } str = str.toLowerCase(Locale.ROOT); final int strLen = str.length(); final int[] newCodePoints = new int[strLen]; int outOffset = 0; final Set<Integer> delimiterSet = toDelimiterSet(delimiters); boolean capitalizeNext = capitalizeFirstLetter; for (int index = 0; index < strLen;) { final int codePoint = str.codePointAt(index); if (delimiterSet.contains(codePoint)) { capitalizeNext = outOffset != 0; index += Character.charCount(codePoint); } else if (capitalizeNext || outOffset == 0 && capitalizeFirstLetter) { final int titleCaseCodePoint = Character.toTitleCase(codePoint); newCodePoints[outOffset++] = titleCaseCodePoint; index += Character.charCount(titleCaseCodePoint); capitalizeNext = false;",unrelated,unrelated,True,,0.0005144088645465672,0.9994856119155884 |
| 86,"public DateMidnight plusMonths(int months) { if (months == 0) { return this; } long instant = getChronology().months().add(getMillis(), months); return withMillis(instant); }",unrelated,unrelated,True,,0.0005202165339142084,0.9994798302650452 |
| 87,"private String parseFormatDescription(final String pattern, final ParsePosition pos) { final int start = pos.getIndex(); seekNonWs(pattern, pos); final int text = pos.getIndex(); int depth = 1; while (pos.getIndex() < pattern.length()) { switch (pattern.charAt(pos.getIndex())) { case START_FE: depth++; next(pos); break; case END_FE: depth--; if (depth == 0) { return pattern.substring(text, pos.getIndex()); } next(pos); break; case QUOTE: getQuotedString(pattern, pos);",unrelated,unrelated,True,,0.0005178099381737411,0.9994822144508362 |
| 88,"@Override public int hashCode() { int total = 157; for (int i = 0, isize = size(); i < isize; i++) { total = 23 * total + getValue(i); total = 23 * total + getFieldType(i).hashCode(); } total += getChronology().hashCode(); return total; }",unrelated,unrelated,True,,0.0005069907638244331,0.9994930028915405 |
| 89,"@Override public @NonNull CompletionStage<Boolean> next(@NonNull T item) { try { return Objects.requireNonNull(onNext.apply(item), ""onNext returned a null CompletionStage""); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); return CompletableFuture.failedStage(ex); } }",unrelated,unrelated,True,,0.000503496325109154,0.9994964599609375 |
| 90,"@CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull public final Observable<T> observeOn(@NonNull Scheduler scheduler) { return observeOn(scheduler, StandardBufferedConfig.DEFAULT); }",unrelated,unrelated,True,,0.0005062707350589335,0.9994937181472778 |
| 91,public MpscLinkedQueue() { producerNode = new AtomicReference<>(); consumerNode = new AtomicReference<>(); LinkedQueueNode<T> node = new LinkedQueueNode<>(); spConsumerNode(node); xchgProducerNode(node); },unrelated,unrelated,True,,0.0005081649869680405,0.999491810798645 |
| 92,"private static int[] algorithmB(final CharSequence left, final CharSequence right) { final int m = left.length(); final int n = right.length(); final int[][] dpRows = new int[2][1 + n]; for (int i = 1; i <= m; i++) { final int[] temp = dpRows[0]; dpRows[0] = dpRows[1]; dpRows[1] = temp; for (int j = 1; j <= n; j++) { if (left.charAt(i - 1) == right.charAt(j - 1)) { dpRows[1][j] = dpRows[0][j - 1] + 1; } else { dpRows[1][j] = Math.max(dpRows[1][j - 1], dpRows[0][j]);",unrelated,unrelated,True,,0.0005133102531544864,0.9994866847991943 |
| 93,"public void printTo(StringBuffer buf, long instant) { try { printTo((Appendable) buf, instant); } catch (IOException ex) { } }",unrelated,unrelated,True,,0.0005001412937417626,0.9994997978210449 |
| 94,public boolean isGreaterThan(Seconds other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.0005068705067969859,0.9994931221008301 |
| 95,"@Override public long set(long instant, int value) { FieldUtils.verifyValueBounds(this, value, iMin, iMax); int remainder = getRemainder(getWrappedField().get(instant)); return getWrappedField().set(instant, value * iDivisor + remainder); }",unrelated,unrelated,True,,0.0005033833440393209,0.999496579170227 |
| 96,final void removeSelf() { DisposableContainer c = composite.getAndSet(null); if (c != null) { c.delete(this); } },unrelated,unrelated,True,,0.0005128211341798306,0.9994871616363525 |
| 97,"@Override int getMonthOfYear(long millis, int year) { long monthZeroBased = (millis - getYearMillis(year)) / MILLIS_PER_MONTH; return ((int) monthZeroBased) + 1; }",unrelated,unrelated,True,,0.0005109023186378181,0.9994890689849854 |
| 98,"int getDayOfMonth(long millis, int year) { int month = getMonthOfYear(millis, year); return getDayOfMonth(millis, year, month); }",unrelated,unrelated,True,,0.0005229124799370766,0.9994770884513855 |
| 99,"private GJChronology(Chronology base, JulianChronology julian, GregorianChronology gregorian, Instant cutoverInstant) { super(base, new Object[] {julian, gregorian, cutoverInstant}); }",unrelated,unrelated,True,,0.0005093137733638287,0.9994906187057495 |
| 100,"public static void appendPaddedInteger(Appendable appendable, long value, int size) throws IOException { int intValue = (int)value; if (intValue == value) { appendPaddedInteger(appendable, intValue, size); } else if (size <= 19) { appendable.append(Long.toString(value)); } else { if (value < 0) { appendable.append('-'); if (value != Long.MIN_VALUE) { value = -value; } else { for (; size > 19; size--) { appendable.append('0'); } appendable.append(""9223372036854775808""); return; } } int digits = (int)(Math.log(value) / LOG_10) + 1;",unrelated,unrelated,True,,0.0005043094861321151,0.9994956254959106 |
| 101,"@Override public void onNext(T t) { if (fusionMode == QueueSubscription.NONE) { parent.innerNext(this, t); } else { parent.drain(); } }",unrelated,unrelated,True,,0.0005022526602260768,0.9994977712631226 |
| 102,"public static Years yearsBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.years()); return Years.years(amount); }",unrelated,unrelated,True,,0.0005052927881479263,0.9994946718215942 |
| 103,private Chronology selectChronology(Chronology chrono) { chrono = DateTimeUtils.getChronology(chrono); if (iChrono != null) { chrono = iChrono; } if (iZone != null) { chrono = chrono.withZone(iZone); } return chrono; },unrelated,unrelated,True,,0.00051571533549577,0.9994843006134033 |
| 104,"public StrBuilder replaceAll(final char search, final char replace) { if (search != replace) { for (int i = 0; i < size; i++) { if (buffer[i] == search) { buffer[i] = replace; } } } return this; }",unrelated,unrelated,True,,0.0005044883582741022,0.9994955062866211 |
| 105,"public static <V> String replace(final Object source, final Map<String, V> valueMap, final String prefix, final String suffix) { return new StrSubstitutor(valueMap, prefix, suffix).replace(source); }",unrelated,unrelated,True,,0.0005021858960390091,0.9994977712631226 |
| 106,public boolean isGreaterThan(Minutes other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.0005094577209092677,0.99949049949646 |
| 107,"protected int convertText(String text, Locale locale) { try { return Integer.parseInt(text); } catch (NumberFormatException ex) { throw new IllegalFieldValueException(getType(), text); } }",unrelated,unrelated,True,,0.0005091734929010272,0.9994908571243286 |
| 108,"@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull public static <@NonNull T> Observable<T> merge(@NonNull Iterable<@NonNull ? extends ObservableSource<? extends T>> sources, @NonNull StandardConcurrentBufferedConfig config) { Objects.requireNonNull(config, ""config is null""); return fromIterable(sources).flatMap(Functions.identity(), config); }",unrelated,unrelated,True,,0.0005184532492421567,0.9994816184043884 |
| 109,"public ObservableWithLatestFromMany(@NonNull ObservableSource<T> source, @NonNull Iterable<? extends ObservableSource<?>> otherIterable, @NonNull Function<? super Object[], R> combiner) { super(source); this.otherArray = null; this.otherIterable = otherIterable; this.combiner = combiner; }",unrelated,unrelated,True,,0.0005136658437550068,0.9994863271713257 |
| 110,"@Override public String toString() { String str = ""BuddhistChronology""; DateTimeZone zone = getZone(); if (zone != null) { str = str + '[' + zone.getID() + ']'; } return str; }",unrelated,unrelated,True,,0.0005103279836475849,0.9994896650314331 |
| 111,"@Override public long set(long millis, int value) { FieldUtils.verifyValueBounds(this, value, iMinValue, getMaximumValue()); if (value <= iSkip) { value--; } return super.set(millis, value); }",unrelated,unrelated,True,,0.0005040725227445364,0.9994958639144897 |
| 112,"public Interval withDurationAfterStart(ReadableDuration duration) { long durationMillis = DateTimeUtils.getDurationMillis(duration); if (durationMillis == toDurationMillis()) { return this; } Chronology chrono = getChronology(); long startMillis = getStartMillis(); long endMillis = chrono.add(startMillis, durationMillis, 1); return new Interval(startMillis, endMillis, chrono); }",unrelated,unrelated,True,,0.0005077217356301844,0.9994922876358032 |
| 113,"@CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull public final <@NonNull R> Flowable<R> replay(@NonNull Function<? super Flowable<T>, @NonNull ? extends Publisher<R>> selector, long time, @NonNull TimeUnit unit) { return replay(selector, time, unit, Schedulers.computation()); }",unrelated,unrelated,True,,0.0005142637528479099,0.9994857311248779 |
| 114,"@SuppressWarnings(""unchecked"") @NonNull public static <T> Predicate<T> alwaysFalse() { return (Predicate<T>)ALWAYS_FALSE; }",unrelated,unrelated,True,,0.0005062355194240808,0.9994937181472778 |
| 115,"@Override public long set(long instant, int value) { FieldUtils.verifyValueBounds(this, value, getMinimumValue(), getMaximumValue()); return instant + (value - get(instant)) * iUnitMillis; }",unrelated,unrelated,True,,0.0005068269674666226,0.9994931221008301 |
| 116,"public DelegatedDateTimeField(DateTimeField field, DurationField rangeField, DateTimeFieldType type) { super(); if (field == null) { throw new IllegalArgumentException(""The field must not be null""); } iField = field; iRangeDurationField = rangeField; iType = (type == null ? field.getType() : type); }",unrelated,unrelated,True,,0.0004969673464074731,0.9995030164718628 |
| 117,"public Calendar toCalendar(Locale locale) { if (locale == null) { locale = Locale.getDefault(); } DateTimeZone zone = getZone(); Calendar cal = Calendar.getInstance(zone.toTimeZone(), locale); cal.setTime(toDate()); return cal; }",unrelated,unrelated,True,,0.0005289279506541789,0.999471127986908 |
| 118,public StringMatcher stringMatcher(final char... chars) { final int length = ArrayUtils.getLength(chars); return length == 0 ? NONE_MATCHER : length == 1 ? new AbstractStringMatcher.CharMatcher(chars[0]) : new AbstractStringMatcher.CharArrayMatcher(chars); },unrelated,unrelated,True,,0.0005001537501811981,0.9994997978210449 |
| 119,@Override public int getMinimumValue(ReadablePartial instant) { return getMinimumValue(); },unrelated,unrelated,True,,0.0005031168693676591,0.9994968175888062 |
| 120,"@Override protected void subscribeActual(Observer<? super T> t) { CacheDisposable<T> consumer = new CacheDisposable<>(t, multicaster, head); t.onSubscribe(consumer); multicaster.add(consumer); if (consumer.isDisposed()) { multicaster.remove(consumer); } if (!once.get() && once.compareAndSet(false, true)) { source.subscribe(multicaster); } else { multicaster.replay(consumer); } }",unrelated,unrelated,True,,0.0005022127879783511,0.9994977712631226 |
| 121,"public LocalDateTime withTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) { Chronology chrono = getChronology(); long instant = getLocalMillis(); instant = chrono.hourOfDay().set(instant, hourOfDay); instant = chrono.minuteOfHour().set(instant, minuteOfHour); instant = chrono.secondOfMinute().set(instant, secondOfMinute); instant = chrono.millisOfSecond().set(instant, millisOfSecond); return withLocalMillis(instant); }",unrelated,unrelated,True,,0.000518572807777673,0.9994814991950989 |
| 122,"public void printTo(StringBuilder buf, ReadablePartial partial) { try { printTo((Appendable) buf, partial); } catch (IOException ex) { } }",unrelated,unrelated,True,,0.0004976780037395656,0.9995023012161255 |
| 123,"public MaybeToSingle(MaybeSource<T> source, T defaultValue) { this.source = source; this.defaultValue = defaultValue; }",unrelated,unrelated,True,,0.0005077718524262309,0.9994921684265137 |
| 124,"public DeferredExecutorScheduler(@NonNull Supplier<? extends Executor> executorSupplier, boolean interruptibleWorker, boolean fair) { this.executorSupplier = executorSupplier; this.interruptibleWorker = interruptibleWorker; this.fair = fair; }",unrelated,unrelated,True,,0.000510099926032126,0.9994899034500122 |
| 125,"@Override public long add(long instant, int years) { if (years == 0) { return instant; } return set(instant, get(instant) + years); }",unrelated,unrelated,True,,0.000510727521032095,0.9994893074035645 |
| 126,@Override public boolean equals(Object period) { if (this == period) { return true; } if (period instanceof ReadablePeriod == false) { return false; } ReadablePeriod other = (ReadablePeriod) period; return (other.getPeriodType() == getPeriodType() && other.getValue(0) == getValue()); },unrelated,unrelated,True,,0.0005028665764257312,0.9994971752166748 |
| 127,"public int indexOf(final char ch, int startIndex) { startIndex = Math.max(startIndex, 0); if (startIndex >= size) { return -1; } final char[] thisBuf = buffer; for (int i = startIndex; i < size; i++) { if (thisBuf[i] == ch) { return i; } } return -1; }",unrelated,unrelated,True,,0.0005026085418649018,0.9994974136352539 |
| 128,@Override public Object clone() { try { return cloneReset(); } catch (final CloneNotSupportedException ex) { return null; } },unrelated,unrelated,True,,0.0005015229107812047,0.9994984865188599 |
| 129,"BasicDayOfYearDateTimeField(BasicChronology chronology, DurationField days) { super(DateTimeFieldType.dayOfYear(), days); iChronology = chronology; }",unrelated,unrelated,True,,0.0005049805622547865,0.9994950294494629 |
| 130,"public LocalTime(Object instant, Chronology chronology) { PartialConverter converter = ConverterManager.getInstance().getPartialConverter(instant); chronology = converter.getChronology(instant, chronology); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); int[] values = converter.getPartialValues(this, instant, chronology, ISODateTimeFormat.localTimeParser()); iLocalMillis = iChronology.getDateTimeMillis(0L, values[0], values[1], values[2], values[3]); }",unrelated,unrelated,True,,0.0005307971150614321,0.9994692206382751 |
| 131,"private static Predicate<Integer> generateIsDelimiterFunction(final char[] delimiters) { final Predicate<Integer> isDelimiter; if (delimiters == null || delimiters.length == 0) { isDelimiter = delimiters == null ? Character::isWhitespace : c -> false; } else { final Set<Integer> delimiterSet = new HashSet<>(); for (int index = 0; index < delimiters.length; index++) { delimiterSet.add(Character.codePointAt(delimiters, index)); } isDelimiter = delimiterSet::contains; } return isDelimiter; }",unrelated,unrelated,True,,0.0005056396475993097,0.9994943141937256 |
| 132,static long readMillis(DataInput in) throws IOException { int v = in.readUnsignedByte(); switch (v >> 6) { case 0: default: v = (v << (32 - 6)) >> (32 - 6); return v * (30 * 60000L); case 1: v = (v << (32 - 6)) >> (32 - 30); v |= (in.readUnsignedByte()) << 16; v |= (in.readUnsignedByte()) << 8; v |= (in.readUnsignedByte()); return v * 60000L; case 2: long w = (((long)v) << (64 - 6)) >> (64 - 38); w |= (in.readUnsignedByte()) << 24;,unrelated,unrelated,True,,0.0005278415628708899,0.9994722008705139 |
| 133,public boolean isGreaterThan(Weeks other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); },unrelated,unrelated,True,,0.0005050599575042725,0.9994949102401733 |
| 134,"@SuppressWarnings(""unchecked"") public final U awaitOnSubscribe(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { if (!onSubscribeReady.await(timeout, unit)) { throw new TimeoutException(""TestSubscriber.awaitOnSubscribe timed out""); } return (U)this; }",unrelated,unrelated,True,,0.0004978485521860421,0.9995021820068359 |
| 135,"@Override public int getMaximumValue(ReadablePartial partial) { if (partial.isSupported(DateTimeFieldType.monthOfYear())) { int month = partial.get(DateTimeFieldType.monthOfYear()); if (partial.isSupported(DateTimeFieldType.year())) { int year = partial.get(DateTimeFieldType.year()); return iChronology.getDaysInYearMonth(year, month); } return iChronology.getDaysInMonthMax(month); } return getMaximumValue(); }",unrelated,unrelated,True,,0.0005108024342916906,0.9994891881942749 |
| 136,"public static Hours hoursBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.hours()); return Hours.hours(amount); }",unrelated,unrelated,True,,0.000509080768097192,0.9994908571243286 |
| 137,"public int get(DateTimeField field) { if (field == null) { throw new IllegalArgumentException(""The DateTimeField must not be null""); } return field.get(getMillis()); }",unrelated,unrelated,True,,0.0005010560853406787,0.9994989633560181 |
| 138,@Override public long roundHalfFloor(long instant) { return getWrappedField().roundHalfFloor(instant); },unrelated,unrelated,True,,0.0005008364678360522,0.9994992017745972 |
|
|