idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
130,900 | public static String parse ( String input ) { if ( input == null ) { return null ; } Matcher matcher = CHALLENGE_PATTERN . matcher ( input ) ; if ( matcher . matches ( ) ) { return matcher . group ( 1 ) ; } else { return extractFromFormParameters ( input ) ; } } | Extract the access token embedded in the input string . |
130,901 | public Scope setAttributes ( Iterable < Pair > attributes ) { if ( attributes == null ) { this . attributes = null ; return this ; } List < Pair > list = new ArrayList < Pair > ( ) ; for ( Pair attribute : attributes ) { if ( attribute == null || attribute . getKey ( ) == null ) { continue ; } list . add ( attribute ) ... | Set attributes . |
130,902 | public static String [ ] extractNames ( Scope [ ] scopes ) { if ( scopes == null ) { return null ; } String [ ] names = new String [ scopes . length ] ; for ( int i = 0 ; i < scopes . length ; ++ i ) { Scope scope = scopes [ i ] ; names [ i ] = ( scope == null ) ? null : scope . getName ( ) ; } return names ; } | Extract scope names . |
130,903 | public static String encode ( String input ) { try { return URLEncoder . encode ( input , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { return input ; } } | URL - encode the input with UTF - 8 . |
130,904 | public static String decode ( String input ) { try { return URLDecoder . decode ( input , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { return input ; } } | URL - decode the input with UTF - 8 . |
130,905 | private void setResponse ( int statusCode , String statusMessage , String responseBody , Map < String , List < String > > responseHeaders ) { mStatusCode = statusCode ; mStatusMessage = statusMessage ; mResponseBody = responseBody ; mResponseHeaders = responseHeaders ; } | Set the data fields related to HTTP response information . |
130,906 | public BackchannelAuthenticationCompleteRequest setClaims ( Map < String , Object > claims ) { if ( claims == null || claims . size ( ) == 0 ) { this . claims = null ; } else { setClaims ( Utils . toJson ( claims ) ) ; } return this ; } | Set additional claims which will be embedded in the ID token . |
130,907 | private < TResponse > TResponse callServiceOwnerGetApi ( String path , Map < String , String > queryParams , Class < TResponse > responseClass ) throws AuthleteApiException { return callGetApi ( mServiceOwnerCredentials , path , queryParams , responseClass ) ; } | Call an API with HTTP GET method and Service Owner credentials . |
130,908 | private < TResponse > TResponse callServiceGetApi ( String path , Map < String , String > queryParams , Class < TResponse > responseClass ) throws AuthleteApiException { return callGetApi ( mServiceCredentials , path , queryParams , responseClass ) ; } | Call an API with HTTP GET method and Service credentials . |
130,909 | private < TResponse > TResponse callGetApi ( BasicCredentials credentials , String path , Map < String , String > queryParams , Class < TResponse > responseClass ) throws AuthleteApiException { return callApi ( HttpMethod . GET , credentials , path , queryParams , ( Object ) null , responseClass ) ; } | Call an API with HTTP GET method . |
130,910 | private < TResponse > TResponse callServiceOwnerPostApi ( String path , Map < String , String > queryParams , Object requestBody , Class < TResponse > responseClass ) throws AuthleteApiException { return callPostApi ( mServiceOwnerCredentials , path , queryParams , requestBody , responseClass ) ; } | Call an API with HTTP POST method and Service Owner credentials . |
130,911 | private < TResponse > TResponse callServicePostApi ( String path , Map < String , String > queryParams , Object requestBody , Class < TResponse > responseClass ) throws AuthleteApiException { return callPostApi ( mServiceCredentials , path , queryParams , requestBody , responseClass ) ; } | Call an API with HTTP POST method and Service credentials . |
130,912 | private < TResponse > TResponse callPostApi ( BasicCredentials credentials , String path , Map < String , String > queryParams , Object requestBody , Class < TResponse > responseClass ) throws AuthleteApiException { return callApi ( HttpMethod . POST , credentials , path , queryParams , requestBody , responseClass ) ; ... | Call an API with HTTP POST method . |
130,913 | private < TResponse > void callServiceOwnerDeleteApi ( String path , Map < String , String > queryParams ) throws AuthleteApiException { callDeleteApi ( mServiceOwnerCredentials , path , queryParams ) ; } | Call an API with HTTP DELETE method and Service Owner credentials . |
130,914 | private < TResponse > void callServiceDeleteApi ( String path , Map < String , String > queryParams ) throws AuthleteApiException { callDeleteApi ( mServiceCredentials , path , queryParams ) ; } | Call an API with HTTP DELETE method and Service credentials . |
130,915 | private < TResponse > void callDeleteApi ( BasicCredentials credentials , String path , Map < String , String > queryParams ) throws AuthleteApiException { callApi ( HttpMethod . DELETE , credentials , path , queryParams , ( Object ) null , ( Class < TResponse > ) null ) ; } | Call an API with HTTP DELETE method . |
130,916 | private < TResponse > TResponse callApi ( HttpMethod method , BasicCredentials credentials , String path , Map < String , String > queryParams , Object requestBody , Class < TResponse > responseClass ) throws AuthleteApiException { HttpURLConnection con = createConnection ( method , credentials , mBaseUrl , path , quer... | Call an API . |
130,917 | public static String join ( String [ ] strings , String delimiter ) { if ( strings == null ) { return null ; } if ( strings . length == 0 ) { return "" ; } boolean useDelimiter = ( delimiter != null && delimiter . length ( ) != 0 ) ; StringBuilder sb = new StringBuilder ( ) ; for ( String string : strings ) { sb . appe... | Concatenate string with the specified delimiter . |
130,918 | public static String stringifyScopeNames ( Scope [ ] scopes ) { if ( scopes == null ) { return null ; } String [ ] array = new String [ scopes . length ] ; for ( int i = 0 ; i < scopes . length ; ++ i ) { array [ i ] = ( scopes [ i ] == null ) ? null : scopes [ i ] . getName ( ) ; } return join ( array , " " ) ; } | Generate a list of scope names . |
130,919 | public QueryBuilder append ( @ SuppressWarnings ( "ParameterHidesMemberVariable" ) SqlQuery query ) { this . query . append ( query . getSql ( ) ) ; arguments . addAll ( query . getArguments ( ) ) ; return this ; } | Appends given query and its arguments to this query . |
130,920 | @ SuppressWarnings ( "unchecked" ) protected E buildConcreteInstance ( User user , Integer expirationTimeInMinutes ) { if ( expirationTimeInMinutes == null ) { return ( E ) new PasswordResetToken ( user ) ; } return ( E ) new PasswordResetToken ( user , expirationTimeInMinutes ) ; } | Builds a concrete instance of this class . |
130,921 | public void saveUser ( User user ) { LOG . trace ( "Trying to create a new user" ) ; final String pwHash = passwordEncoder . encode ( user . getPassword ( ) ) ; user . setPassword ( pwHash ) ; dao . saveOrUpdate ( user ) ; LOG . info ( "Created the user " + user . getAccountName ( ) ) ; } | Used to create a user . Implements special logic by encoding the password . |
130,922 | @ RequestMapping ( value = "/setLayersForMap.action" , method = RequestMethod . POST ) public java . util . Map < String , Object > setLayersForMap ( @ RequestParam ( "mapModuleId" ) Integer mapModuleId , @ RequestParam ( "layerIds" ) List < Integer > layerIds ) { try { if ( mapModuleId == null || layerIds == null || l... | Set layers for map |
130,923 | @ RequestMapping ( value = "/upload.action" , method = RequestMethod . POST ) public ResponseEntity < ? > uploadFile ( @ RequestParam ( "file" ) MultipartFile uploadedFile ) { LOG . debug ( "Requested to upload a multipart-file" ) ; Map < String , Object > responseMap = new HashMap < String , Object > ( ) ; try { E fil... | Persists a file as bytearray in the database |
130,924 | public static Response get ( String url , Credentials credentials , Header [ ] requestHeaders ) throws URISyntaxException , HttpException { return send ( new HttpGet ( url ) , credentials , requestHeaders ) ; } | Performs an HTTP GET on the given URL . |
130,925 | public static Response get ( URI uri ) throws URISyntaxException , HttpException { return send ( new HttpGet ( uri ) , null , null ) ; } | Performs an HTTP GET on the given URI . No credentials needed . |
130,926 | public static Response get ( URI uri , Credentials credentials , Header [ ] requestHeaders ) throws URISyntaxException , HttpException { return send ( new HttpGet ( uri ) , credentials , requestHeaders ) ; } | Performs an HTTP GET on the given URI . Basic auth is used if both username and pw are not null . |
130,927 | public static Response forwardGet ( URI uri , HttpServletRequest request , boolean forwardHeaders ) throws URISyntaxException , HttpException { Header [ ] headersToForward = null ; if ( request != null && forwardHeaders ) { headersToForward = HttpUtil . getHeadersFromRequest ( request ) ; } return send ( new HttpGet ( ... | Forward GET request to uri based on given request |
130,928 | public static Response post ( String url , String password , String username ) throws URISyntaxException , UnsupportedEncodingException , HttpException { return postParams ( new HttpPost ( url ) , new ArrayList < NameValuePair > ( ) , new UsernamePasswordCredentials ( username , password ) , null ) ; } | Performs an HTTP POST on the given URL . Basic auth is used if both and password are not null . |
130,929 | public static Response post ( URI uri ) throws URISyntaxException , UnsupportedEncodingException , HttpException { return postParams ( new HttpPost ( uri ) , new ArrayList < NameValuePair > ( ) , null , null ) ; } | Performs an HTTP POST on the given URI . |
130,930 | public static Response forwardPost ( URI uri , HttpServletRequest request , boolean forwardHeaders ) throws URISyntaxException , HttpException { Header [ ] headersToForward = null ; if ( request != null && forwardHeaders ) { headersToForward = HttpUtil . getHeadersFromRequest ( request ) ; } String ctString = request .... | Forward POST to uri based on given request |
130,931 | public static Response put ( URI uri , String body , ContentType contentType , String username , String password ) throws URISyntaxException , HttpException { return putBody ( new HttpPut ( uri ) , body , contentType , new UsernamePasswordCredentials ( username , password ) , null ) ; } | Performs an HTTP PUT on the given URL . |
130,932 | public static boolean isSaneRequest ( HttpServletRequest request ) { if ( request != null && request . getMethod ( ) != null ) { return true ; } return false ; } | Checks if request and request method are not null |
130,933 | private static Header [ ] removeHeaders ( Header [ ] headersToClean , String [ ] headersToRemove ) { ArrayList < Header > headers = new ArrayList < > ( ) ; if ( headersToClean == null ) { return null ; } for ( Header header : headersToClean ) { if ( ! StringUtils . equalsAnyIgnoreCase ( header . getName ( ) , headersTo... | Remove headers form header array that match Strings in headersToRemove |
130,934 | public RESTImport createImportJob ( String workSpaceName , String dataStoreName ) throws Exception { if ( StringUtils . isEmpty ( workSpaceName ) ) { throw new GeoServerRESTImporterException ( "No workspace given. Please provide a " + "workspace to import the data in." ) ; } RESTImport importJob = new RESTImport ( ) ; ... | Create a new import job . |
130,935 | public boolean createReprojectTransformTask ( Integer importJobId , Integer taskId , String sourceSrs , String targetSrs ) throws URISyntaxException , HttpException { RESTReprojectTransform transformTask = new RESTReprojectTransform ( ) ; if ( StringUtils . isNotEmpty ( sourceSrs ) ) { transformTask . setSource ( sourc... | Create a reprojection task . |
130,936 | public RESTImportTaskList uploadFile ( Integer importJobId , File file , String sourceSrs ) throws Exception { LOG . debug ( "Uploading file " + file . getName ( ) + " to import job " + importJobId ) ; Response httpResponse = HttpUtil . post ( this . addEndPoint ( importJobId + "/tasks" ) , file , this . username , thi... | Upload an import file . |
130,937 | public boolean updateImportTask ( int importJobId , int importTaskId , AbstractRESTEntity updateTaskEntity ) throws Exception { LOG . debug ( "Updating the import task " + importTaskId + " in job " + importJobId + " with " + updateTaskEntity ) ; Response httpResponse = HttpUtil . put ( this . addEndPoint ( importJobId ... | Updates the given import task . |
130,938 | public boolean deleteImportJob ( Integer importJobId ) throws URISyntaxException , HttpException { LOG . debug ( "Deleting the import job " + importJobId ) ; Response httpResponse = HttpUtil . delete ( this . addEndPoint ( importJobId . toString ( ) ) , this . username , this . password ) ; boolean success = httpRespon... | Deletes an importJob . |
130,939 | public boolean runImportJob ( Integer importJobId ) throws UnsupportedEncodingException , URISyntaxException , HttpException { LOG . debug ( "Starting the import for job " + importJobId ) ; Response httpResponse = HttpUtil . post ( this . addEndPoint ( Integer . toString ( importJobId ) ) , this . username , this . pas... | Run a previously configured import job . |
130,940 | public RESTLayer getLayer ( Integer importJobId , Integer taskId ) throws Exception { Response httpResponse = HttpUtil . get ( this . addEndPoint ( importJobId + "/tasks/" + taskId + "/layer" ) , this . username , this . password ) ; return ( RESTLayer ) this . asEntity ( httpResponse . getBody ( ) , RESTLayer . class ... | Get a layer . |
130,941 | public List < RESTLayer > getAllImportedLayers ( Integer importJobId , List < RESTImportTask > tasks ) throws Exception { ArrayList < RESTLayer > layers = new ArrayList < RESTLayer > ( ) ; for ( RESTImportTask task : tasks ) { RESTImportTask refreshedTask = this . getRESTImportTask ( importJobId , task . getId ( ) ) ; ... | fetch all created Layers of import job |
130,942 | public RESTData getDataOfImportTask ( Integer importJobId , Integer taskId ) throws Exception { final DeserializationFeature unwrapRootValueFeature = DeserializationFeature . UNWRAP_ROOT_VALUE ; boolean unwrapRootValueFeatureIsEnabled = mapper . isEnabled ( unwrapRootValueFeature ) ; Response httpResponse = HttpUtil . ... | Get the data of an import task . |
130,943 | public RESTImportTask getRESTImportTask ( Integer importJobId , Integer taskId ) throws Exception { Response httpResponse = HttpUtil . get ( this . addEndPoint ( importJobId + "/tasks/" + taskId ) , this . username , this . password ) ; return ( RESTImportTask ) this . asEntity ( httpResponse . getBody ( ) , RESTImport... | Get an import task . |
130,944 | private boolean createTransformTask ( Integer importJobId , Integer taskId , RESTTransform transformTask ) throws URISyntaxException , HttpException { LOG . debug ( "Creating a new transform task for import job" + importJobId + " and task " + taskId ) ; mapper . disable ( SerializationFeature . WRAP_ROOT_VALUE ) ; Resp... | Helper method to create an importer transformTask |
130,945 | public static File addPrjFileToArchive ( File file , String targetCrs ) throws ZipException , IOException , NoSuchAuthorityCodeException , FactoryException { ZipFile zipFile = new ZipFile ( file ) ; CoordinateReferenceSystem decodedTargetCrs = CRS . decode ( targetCrs ) ; String targetCrsWkt = toSingleLineWKT ( decoded... | Add a projection file to a shapefile zip archive . |
130,946 | public static String toSingleLineWKT ( CoordinateReferenceSystem crs ) { String wkt = null ; try { Formattable formattable = ( Formattable ) crs ; wkt = formattable . toWKT ( 0 , false ) ; } catch ( ClassCastException e ) { wkt = crs . toWKT ( ) ; } wkt = wkt . replaceAll ( "\n" , "" ) . replaceAll ( " " , "" ) ; retu... | Turns the CRS into a single line WKT |
130,947 | private AbstractRESTEntity asEntity ( byte [ ] responseBody , Class < ? > clazz ) throws Exception { AbstractRESTEntity entity = null ; entity = ( AbstractRESTEntity ) mapper . readValue ( responseBody , clazz ) ; return entity ; } | Convert a byte array to an importer REST entity . |
130,948 | private String asJSON ( Object entity ) { String entityJson = null ; try { entityJson = this . mapper . writeValueAsString ( entity ) ; } catch ( Exception e ) { LOG . error ( "Could not parse as JSON: " + e . getMessage ( ) ) ; } return entityJson ; } | Convert an object to json . |
130,949 | private URI addEndPoint ( String endPoint ) throws URISyntaxException { if ( StringUtils . isEmpty ( endPoint ) || endPoint . equals ( "/" ) ) { return this . baseUri ; } if ( this . baseUri . getPath ( ) . endsWith ( "/" ) || endPoint . startsWith ( "/" ) ) { endPoint = this . baseUri . getPath ( ) + endPoint ; } else... | Add an endpoint . |
130,950 | public static final Map < String , Object > error ( String errorMsg , Map additionalReturnValuesMap ) { Map < String , Object > returnMap = new HashMap < String , Object > ( 3 ) ; returnMap . put ( "message" , errorMsg ) ; returnMap . put ( "additionalInfo" , additionalReturnValuesMap ) ; returnMap . put ( "success" , ... | Method returning error message and additional return values |
130,951 | private int detectColumnIndexOfLocale ( String locale , CSVReader csvReader ) throws Exception { int indexOfLocale = - 1 ; List < String > headerLine = Arrays . asList ( ArrayUtils . nullToEmpty ( csvReader . readNext ( ) ) ) ; if ( headerLine == null || headerLine . isEmpty ( ) ) { throw new Exception ( "CSV locale fi... | Extracts the column index of the given locale in the CSV file . |
130,952 | private boolean isInWhiteList ( URL url ) { final String host = url . getHost ( ) ; final int port = url . getPort ( ) ; final String protocol = url . getProtocol ( ) ; final int portToTest = ( port != - 1 ) ? port : ( StringUtils . equalsIgnoreCase ( protocol , "https" ) ? 443 : 80 ) ; List < String > matchingWhiteLis... | Helper method to check whether the URI is contained in the host whitelist provided in list of whitelisted hosts |
130,953 | @ RequestMapping ( value = "/endpointdoc" , method = RequestMethod . GET ) public Set < RequestMappingInfo > getEndpoints ( ) { return this . service . getEndpoints ( requestMappingHandlerMapping ) ; } | Provides an overview of all mapped endpoints . |
130,954 | public E findById ( ID id ) { LOG . trace ( "Finding " + entityClass . getSimpleName ( ) + " with ID " + id ) ; return ( E ) getSession ( ) . get ( entityClass , id ) ; } | Return the real object from the database . Returns null if the object does not exist . |
130,955 | public void saveOrUpdate ( E e ) { final Integer id = e . getId ( ) ; final boolean hasId = id != null ; String createOrUpdatePrefix = hasId ? "Updating" : "Creating a new" ; String idSuffix = hasId ? " with ID " + id : "" ; LOG . trace ( createOrUpdatePrefix + " instance of " + entityClass . getSimpleName ( ) + idSuff... | Saves or updates the passed entity . |
130,956 | public void delete ( E e ) { LOG . trace ( "Deleting " + entityClass . getSimpleName ( ) + " with ID " + e . getId ( ) ) ; getSession ( ) . delete ( e ) ; } | Deletes the passed entity . |
130,957 | @ SuppressWarnings ( "unchecked" ) public List < E > findByCriteria ( Criterion ... criterion ) throws HibernateException { LOG . trace ( "Finding instances of " + entityClass . getSimpleName ( ) + " based on " + criterion . length + " criteria" ) ; Criteria criteria = createDistinctRootEntityCriteria ( criterion ) ; r... | Gets the results that match a variable number of passed criterions . Call this method without arguments to find all entities . |
130,958 | @ SuppressWarnings ( "unchecked" ) public E findByUniqueCriteria ( Criterion ... criterion ) throws HibernateException { LOG . trace ( "Finding one unique " + entityClass . getSimpleName ( ) + " based on " + criterion . length + " criteria" ) ; Criteria criteria = createDistinctRootEntityCriteria ( criterion ) ; return... | Gets the unique result that matches a variable number of passed criterions . |
130,959 | @ SuppressWarnings ( "unchecked" ) public PagingResult < E > findByCriteriaWithSortingAndPaging ( Integer firstResult , Integer maxResults , List < Order > sorters , Criterion ... criterion ) throws HibernateException { int nrOfSorters = sorters == null ? 0 : sorters . size ( ) ; LOG . trace ( "Finding instances of " +... | Gets the results that match a variable number of passed criterions considering the paging - and sort - info at the same time . |
130,960 | public Number getTotalCount ( Criterion ... criterion ) throws HibernateException { Criteria criteria = getSession ( ) . createCriteria ( entityClass ) ; addCriterionsToCriteria ( criteria , criterion ) ; criteria . setProjection ( Projections . rowCount ( ) ) ; return ( Long ) criteria . uniqueResult ( ) ; } | Returns the total count of db entries for the current type . |
130,961 | public void authenticate ( String username , String password ) { ldapTemplate . authenticate ( query ( ) . where ( "objectClass" ) . is ( "simpleSecurityObject" ) . and ( "cn" ) . is ( username ) , password ) ; LOGGER . info ( "Successfully authenticated " + username ) ; } | Authenticate against ldap . |
130,962 | public List < String > getGroups ( String username , String property ) { final List < String > result = new ArrayList < > ( ) ; ldapTemplate . search ( query ( ) . where ( "cn" ) . is ( username ) , new AttributesMapper < String > ( ) { public String mapFromAttributes ( Attributes attrs ) throws NamingException { Namin... | Extract groups from ldap . |
130,963 | public void sendMail ( String from , String replyTo , String [ ] to , String [ ] cc , String [ ] bcc , String subject , String msg ) throws Exception { SimpleMailMessage simpleMailMassage = new SimpleMailMessage ( ) ; if ( from == null || from . isEmpty ( ) ) { from = defaultMailSender ; } simpleMailMassage . setFrom (... | Sends a SimpleMailMessage . |
130,964 | public void sendMimeMail ( String from , String replyTo , String [ ] to , String [ ] cc , String [ ] bcc , String subject , String msg , Boolean html , String attachmentFilename , File attachmentFile ) throws MessagingException , MailException { Boolean multipart = false ; if ( attachmentFilename != null && attachmentF... | Sends a MimeMessage . |
130,965 | protected String transformEntityName ( EntityNaming entityNaming ) { String singular = super . transformEntityName ( entityNaming ) ; return transformToPluralForm ( singular ) ; } | Transforms an entity name to plural form . |
130,966 | public E registerUser ( E user , HttpServletRequest request ) throws Exception { String email = user . getEmail ( ) ; E existingUser = dao . findByEmail ( email ) ; if ( existingUser != null ) { final String errorMessage = "User with eMail '" + email + "' already exists." ; LOG . info ( errorMessage ) ; throw new Excep... | Registers a new user . Initially the user will be inactive . An email with an activation link will be sent to the user . |
130,967 | public E persistNewUser ( E user , boolean encryptPassword ) { if ( user . getId ( ) != null ) { return user ; } if ( encryptPassword ) { user . setPassword ( passwordEncoder . encode ( user . getPassword ( ) ) ) ; } dao . saveOrUpdate ( user ) ; return user ; } | Persists a new user in the database . |
130,968 | public Object convertToEntityAttribute ( String dbData ) { if ( "true" . equalsIgnoreCase ( dbData ) ) { return true ; } else if ( "false" . equalsIgnoreCase ( dbData ) ) { return false ; } else if ( NumberUtils . isParsable ( dbData ) ) { if ( NumberUtils . isDigits ( dbData ) || ( dbData . startsWith ( "-" ) && Numbe... | Converts a string value from the database to the best matching java primitive type . |
130,969 | public boolean hasPermission ( User user , E userGroup , Permission permission ) { if ( user != null && permission . equals ( Permission . READ ) && userGroup . getMembers ( ) . contains ( user ) ) { LOG . trace ( "Granting READ access on group where the user is member." ) ; return true ; } return super . hasPermission... | Grants READ permission on groups where the user is a member . Uses default implementation otherwise . |
130,970 | public Identifier toPhysicalTableName ( Identifier tableIdentifier , JdbcEnvironment context ) { return convertToLimitedLowerCase ( context , tableIdentifier , tablePrefix ) ; } | Converts table names to lower case and limits the length if necessary . |
130,971 | public Identifier toPhysicalColumnName ( Identifier columnIdentifier , JdbcEnvironment context ) { return convertToLimitedLowerCase ( context , columnIdentifier , null ) ; } | Converts column names to lower case and limits the length if necessary . |
130,972 | protected Integer getIdentifierLengthLimit ( JdbcEnvironment context ) { String dialectName = context . getDialect ( ) . getClass ( ) . getSimpleName ( ) ; if ( dialectName . startsWith ( "Oracle" ) ) { return LENGTH_LIMIT_ORACLE ; } else if ( context . getDialect ( ) instanceof ShogunCoreOracleDialect ) { return LENGT... | Determines the identifier length limit for the given JDBC context . Returns null if no limitation is necessary . |
130,973 | public String getParameterIgnoreCase ( String name ) { for ( Map . Entry < String , String [ ] > entry : customParameters . entrySet ( ) ) { if ( entry . getKey ( ) . equalsIgnoreCase ( name ) ) { return StringUtils . join ( entry . getValue ( ) , "," ) ; } } return null ; } | Get a parameter by name ignoring case . |
130,974 | public void initializeDatabaseContent ( ) { if ( this . shogunInitEnabled ) { LOG . info ( "Initializing SHOGun content" ) ; for ( PersistentObject object : objectsToCreate ) { if ( object instanceof User ) { initService . saveUser ( ( User ) object ) ; } else { initService . savePersistentObject ( object ) ; } } } els... | The method called on initialization |
130,975 | @ PreAuthorize ( "isAuthenticated()" ) public E uploadFile ( MultipartFile file ) throws Exception { if ( file == null ) { final String errMsg = "Upload failed. File is null." ; LOG . error ( errMsg ) ; throw new Exception ( errMsg ) ; } else if ( file . isEmpty ( ) ) { final String errMsg = "Upload failed. File is emp... | Method persists a given MultipartFile as a bytearray in the database |
130,976 | @ PreAuthorize ( "isAuthenticated()" ) public E saveImage ( MultipartFile file , boolean createThumbnail , Integer thumbnailTargetSize ) throws Exception { InputStream is = null ; ByteArrayInputStream bais = null ; E imageToPersist = null ; try { is = file . getInputStream ( ) ; byte [ ] imageByteArray = IOUtils . toBy... | Method persists a given Image as a bytearray in the database |
130,977 | public static byte [ ] scaleImage ( byte [ ] imageBytes , String outputFormat , Integer targetSize ) throws Exception { InputStream is = null ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; byte [ ] imageInBytes = null ; BufferedImage image = null ; BufferedImage resizedImage = null ; try { is = new Byte... | Scales an image by the given dimensions |
130,978 | private void addMasterJulLogRecords ( Container result ) { result . add ( new LogRecordContent ( "nodes/master/logs/all_memory_buffer.log" ) { public Iterable < LogRecord > getLogRecords ( ) { return SupportPlugin . getInstance ( ) . getAllLogRecords ( ) ; } } ) ; final File [ ] julLogFiles = SupportPlugin . getRootDir... | Adds j . u . l logging output that the support - core plugin captures . |
130,979 | private static String camelCaseToSentenceCase ( String camelCase ) { String name = StringUtils . join ( StringUtils . splitByCharacterTypeCamelCase ( camelCase ) , " " ) ; return name . substring ( 0 , 1 ) . toUpperCase ( Locale . ENGLISH ) + name . substring ( 1 ) . toLowerCase ( Locale . ENGLISH ) ; } | Converts aCamelCaseString into A sentence case string . |
130,980 | public static ContentMappings newInstance ( ) throws IOException { ContentMappings mappings = Persistence . load ( ContentMappings . class ) ; if ( mappings == null ) { mappings = ( ContentMappings ) new XmlProxy ( ) . readResolve ( ) ; } return mappings ; } | Constructs a new ContentMappings using an existing config file or default settings if not found . |
130,981 | public void doDownload ( StaplerRequest req , StaplerResponse rsp ) throws ServletException , IOException { doGenerateAllBundles ( req , rsp ) ; } | Generates a support bundle . |
130,982 | private boolean isBinary ( ) { try ( InputStream in = getInputStream ( ) ) { long size = Files . size ( file . toPath ( ) ) ; if ( size == 0 ) { return true ; } byte [ ] b = new byte [ ( size < StreamUtils . DEFAULT_PROBE_SIZE ? ( int ) size : StreamUtils . DEFAULT_PROBE_SIZE ) ] ; int read = in . read ( b ) ; if ( rea... | Check if the file is binary or not |
130,983 | private static String getVersion ( ) { Properties properties = new Properties ( ) ; try ( InputStream ins = HttpRosetteAPI . class . getClassLoader ( ) . getResourceAsStream ( "version.properties" ) ) { properties . load ( ins ) ; } catch ( IOException e ) { } return properties . getProperty ( "version" , "undefined" )... | Returns the version of the binding . |
130,984 | private static byte [ ] getBytes ( InputStream is ) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; byte [ ] buf = new byte [ 4096 ] ; while ( true ) { int r = is . read ( buf ) ; if ( r == - 1 ) { out . flush ( ) ; return out . toByteArray ( ) ; } out . write ( buf , 0 , r ) ; } } | Returns a byte array from InputStream . |
130,985 | public SupportedLanguagesResponse getSupportedLanguages ( String endpoint ) throws HttpRosetteAPIException { if ( DOC_ENDPOINTS . contains ( endpoint ) || NAME_DEDUPLICATION_SERVICE_PATH . equals ( endpoint ) ) { return sendGetRequest ( urlBase + endpoint + SUPPORTED_LANGUAGES_SUBPATH , SupportedLanguagesResponse . cla... | Gets the set of language and script codes supported by the specified Rosette API endpoint . |
130,986 | public SupportedLanguagePairsResponse getSupportedLanguagePairs ( String endpoint ) throws HttpRosetteAPIException { if ( NAMES_ENDPOINTS . contains ( endpoint ) && ! NAME_DEDUPLICATION_SERVICE_PATH . equals ( endpoint ) ) { return sendGetRequest ( urlBase + endpoint + SUPPORTED_LANGUAGES_SUBPATH , SupportedLanguagePai... | Gets the set of language script codes and transliteration scheme pairs supported by the specified Rosette API endpoint . |
130,987 | public < RequestType extends Request , ResponseType extends Response > Future < ResponseType > performAsync ( String endpoint , RequestType request , Class < ResponseType > responseClass ) throws HttpRosetteAPIException { throw new UnsupportedOperationException ( "Asynchronous operations are not yet supported" ) ; } | This method always throws UnsupportedOperationException . |
130,988 | private < T extends Object > T getResponse ( HttpResponse httpResponse , Class < T > clazz ) throws IOException , HttpRosetteAPIException { int status = httpResponse . getStatusLine ( ) . getStatusCode ( ) ; String encoding = headerValueOrNull ( httpResponse . getFirstHeader ( HttpHeaders . CONTENT_ENCODING ) ) ; try (... | Gets response from HTTP connection according to the specified response class ; throws for an error response . |
130,989 | public static String findSecrets ( File xmlFile ) throws SAXException , IOException , TransformerException { XMLReader xr = new XMLFilterImpl ( XMLReaderFactory . createXMLReader ( ) ) { private String tagName = "" ; public void startElement ( String uri , String localName , String qName , Attributes atts ) throws SAXE... | find the secret in the xml file and replace it with the place holder |
130,990 | private static Source createSafeSource ( XMLReader reader , InputSource source ) { try { reader . setFeature ( "http://xml.org/sax/features/external-general-entities" , false ) ; } catch ( SAXException ignored ) { } try { reader . setFeature ( "http://xml.org/sax/features/external-parameter-entities" , false ) ; } catc... | Converts a Source into a Source that is protected against XXE attacks . |
130,991 | @ edu . umd . cs . findbugs . annotations . SuppressWarnings ( { "DM_DEFAULT_ENCODING" , "OS_OPEN_STREAM" } ) private static void getUlimit ( PrintWriter writer ) throws IOException { InputStream is = new ProcessBuilder ( "bash" , "-c" , "ulimit -a" ) . start ( ) . getInputStream ( ) ; try { BufferedReader bufferedRead... | This method executes the command bash - c ulimit - a on the machine . |
130,992 | public void addExtendedInformation ( String key , Object value ) { if ( extendedInformation == null ) { extendedInformation = new HashMap < > ( ) ; } extendedInformation . put ( key , value ) ; } | add more extended information to the response |
130,993 | public synchronized void flush ( ) throws IOException { ensureOpen ( ) ; if ( decodedBuf . position ( ) > 0 ) { decodedBuf . flip ( ) ; String contents = decodedBuf . toString ( ) ; String filtered = contentFilter . filter ( contents ) ; out . write ( filtered . getBytes ( charset ) ) ; decodedBuf . clear ( ) ; } out .... | Flushes the current buffered contents and filters them as is . |
130,994 | public synchronized void reset ( ) { ensureOpen ( ) ; encodedBuf . clear ( ) ; if ( decodedBuf . capacity ( ) > FilteredConstants . DEFAULT_DECODER_CAPACITY ) { this . decodedBuf = CharBuffer . allocate ( FilteredConstants . DEFAULT_DECODER_CAPACITY ) ; } else { decodedBuf . clear ( ) ; } decoder . reset ( ) ; } | Resets the state of this stream s decoders and buffers . |
130,995 | private Set < String > getActiveCacheKeys ( final List < Node > nodes ) { Set < String > cacheKeys = new HashSet < > ( nodes . size ( ) ) ; for ( Node node : nodes ) { String cacheKey = Util . getDigestOf ( node . getNodeName ( ) + ":" + ( ( hudson . model . Slave ) node ) . getRemoteFS ( ) ) ; LOGGER . log ( Level . F... | Build a Set including the cacheKeys associated to every agent in the instance |
130,996 | static boolean mayBeDate ( String s ) { if ( s == null || s . length ( ) != "yyyy-MM-dd_HH-mm-ss" . length ( ) ) { return false ; } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { switch ( s . charAt ( i ) ) { case '-' : switch ( i ) { case 4 : case 7 : case 13 : case 16 : break ; default : return false ; } break ; cas... | A pre - check to see if a string is a build timestamp formatted date . |
130,997 | private static Iterable < PluginWrapper > getPluginsSorted ( ) { PluginManager pluginManager = Jenkins . getInstance ( ) . getPluginManager ( ) ; return getPluginsSorted ( pluginManager ) ; } | Fixes JENKINS - 47779 caused by JENKINS - 47713 Not using SortedSet because of PluginWrapper doesn t implements equals and hashCode . |
130,998 | protected static void showUsage ( Class < ? extends ExampleBase > commandClass ) { System . err . println ( USAGE_STR + commandClass . getName ( ) ) ; } | Prints out how to run the program |
130,999 | protected static String responseToJson ( Response response ) throws JsonProcessingException { ObjectMapper mapper = ApiModelMixinModule . setupObjectMapper ( new ObjectMapper ( ) ) ; mapper . enable ( SerializationFeature . INDENT_OUTPUT ) ; mapper . setSerializationInclusion ( JsonInclude . Include . NON_NULL ) ; retu... | Converts a response to JSON string |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.