idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
18,200 | @ XmlElementWrapper ( name = "allpages" ) @ XmlElement ( name = "p" , type = P . class ) public List < P > getAllpages ( ) { return allpages ; } | Gets the value of the allpages property . |
18,201 | @ XmlElementWrapper ( name = "allimages" ) @ XmlElement ( name = "img" , type = Img . class ) public List < Img > getAllImages ( ) { return allimages ; } | Gets the value of the allimages property . |
18,202 | @ XmlElementWrapper ( name = "pages" ) @ XmlElement ( name = "page" , type = Page . class ) public List < Page > getPages ( ) { return pages ; } | Gets the value of the pages property . |
18,203 | public void init ( ) throws Exception { SSLContext ctx = SSLContext . getInstance ( "TLS" ) ; if ( ignoreCertificates ) { ctx . init ( new KeyManager [ 0 ] , new TrustManager [ ] { new DefaultTrustManager ( ) } , new SecureRandom ( ) ) ; SSLContext . setDefault ( ctx ) ; } HostnameVerifier hv = new IgnoreHostName ( ) ;... | initialize this wiki |
18,204 | public void login ( ) throws Exception { WikiUser wuser = WikiUser . getUser ( getWikiid ( ) , getSiteurl ( ) ) ; if ( wuser == null ) { throw new Exception ( "user for " + getWikiid ( ) + "(" + getSiteurl ( ) + ") not configured" ) ; } try { Login login = login ( wuser . getUsername ( ) , wuser . getPassword ( ) ) ; L... | log me in with the configured user |
18,205 | public Unmarshaller getUnmarshaller ( ) throws JAXBException { JAXBContext context = JAXBContext . newInstance ( classOfT ) ; Unmarshaller u = context . createUnmarshaller ( ) ; u . setEventHandler ( new ValidationEventHandler ( ) { public boolean handleEvent ( ValidationEvent event ) { return true ; } } ) ; return u ;... | get a fitting Unmarshaller |
18,206 | public T fromXML ( String xml ) throws Exception { Unmarshaller u = this . getUnmarshaller ( ) ; u . setProperty ( MarshallerProperties . MEDIA_TYPE , "application/xml" ) ; T result = this . fromString ( u , xml ) ; return result ; } | get an instance of T for the given xml string |
18,207 | public T fromJson ( String json ) throws Exception { Unmarshaller u = this . getUnmarshaller ( ) ; u . setProperty ( MarshallerProperties . MEDIA_TYPE , "application/json" ) ; T result = this . fromString ( u , json ) ; return result ; } | get an instance of T for the given json string |
18,208 | public String getString ( Marshaller marshaller , T instance ) throws JAXBException { StringWriter sw = new StringWriter ( ) ; marshaller . marshal ( instance , sw ) ; String result = sw . toString ( ) ; return result ; } | get the string representation of the given marshaller |
18,209 | protected void initNameSpaces ( General general , List < Ns > namespaceList ) { namespaces = new LinkedHashMap < String , Ns > ( ) ; namespacesById = new LinkedHashMap < Integer , Ns > ( ) ; namespacesByCanonicalName = new LinkedHashMap < String , Ns > ( ) ; for ( Ns namespace : namespaceList ) { String namespacename =... | initialize the NameSpaces from the given namespaceList |
18,210 | public String mapNamespace ( String ns , SiteInfo targetWiki ) throws Exception { Map < String , Ns > sourceMap = this . getNamespaces ( ) ; Map < Integer , Ns > targetMap = targetWiki . getNamespacesById ( ) ; Ns sourceNs = sourceMap . get ( ns ) ; if ( sourceNs == null ) { if ( debug ) LOGGER . log ( Level . WARNING ... | map the given namespace to the target wiki |
18,211 | public static String generateRandomKey ( int pLength ) { int asciiFirst = 48 ; int asciiLast = 122 ; Integer [ ] exceptions = { 58 , 59 , 60 , 61 , 62 , 63 , 91 , 92 , 93 , 94 , 96 } ; List < Integer > exceptionsList = Arrays . asList ( exceptions ) ; SecureRandom random = new SecureRandom ( ) ; StringBuilder builder =... | generate a Random key |
18,212 | public static Crypt getRandomCrypt ( ) { String lCypher = generateRandomKey ( 32 ) ; String lSalt = generateRandomKey ( 8 ) ; Crypt result = new Crypt ( lCypher , lSalt ) ; return result ; } | get a random Crypt |
18,213 | String encrypt ( String property ) throws GeneralSecurityException , UnsupportedEncodingException { SecretKeyFactory keyFactory = SecretKeyFactory . getInstance ( "PBEWithMD5AndDES" ) ; SecretKey key = keyFactory . generateSecret ( new PBEKeySpec ( cypher ) ) ; Cipher pbeCipher = Cipher . getInstance ( "PBEWithMD5AndDE... | encrypt the given property |
18,214 | public static String getInput ( String name , BufferedReader br ) throws IOException { System . out . print ( "Please Enter " + name + ": " ) ; String value = br . readLine ( ) ; return value ; } | get input from standard in |
18,215 | public static File getPropertyFile ( String wikiId , String user ) { String userPropertiesFileName = System . getProperty ( "user.home" ) + "/.mediawiki-japi/" + user + "_" + wikiId + ".ini" ; File propFile = new File ( userPropertiesFileName ) ; return propFile ; } | get the property file for the given wikiId and user |
18,216 | public static File getPropertyFile ( String wikiId ) { String user = System . getProperty ( "user.name" ) ; return getPropertyFile ( wikiId , user ) ; } | get the propertyFile for the given wikiId |
18,217 | public static Properties getProperties ( String wikiId ) throws FileNotFoundException , IOException { File propFile = getPropertyFile ( wikiId ) ; Properties props = new Properties ( ) ; props . load ( new FileReader ( propFile ) ) ; return props ; } | get the Properties for the given wikiId |
18,218 | public static WikiUser getUser ( String wikiId , String siteurl ) { WikiUser result = null ; try { Properties props = getProperties ( wikiId ) ; result = new WikiUser ( ) ; result . setUsername ( props . getProperty ( "user" ) ) ; result . setEmail ( props . getProperty ( "email" ) ) ; Crypt pcf = new Crypt ( props . g... | get the Wiki user for the given wikiid |
18,219 | public static void createIniFile ( String ... args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String wikiid = null ; if ( args . length > 0 ) wikiid = args [ 0 ] ; else wikiid = getInput ( "wiki id" , br ) ; String username = null ; if ( args . length > 1 ) username = a... | create a credentials ini file from the command line |
18,220 | @ XmlElementWrapper ( name = "modules" ) @ XmlElement ( name = "module" , type = Module . class ) public List < Module > getModules ( ) { return modules ; } | Ruft den Wert der modules - Eigenschaft ab . |
18,221 | @ XmlElementWrapper ( name = "sections" ) @ XmlElement ( name = "s" , type = S . class ) public List < S > getSections ( ) { return sections ; } | Gets the value of the sections property . |
18,222 | public static Api fromXML ( final String xml ) throws Exception { Api result = null ; try { result = apifactory . fromXML ( xml ) ; } catch ( JAXBException je ) { LOGGER . log ( Level . SEVERE , je . getMessage ( ) ) ; LOGGER . log ( Level . INFO , xml ) ; throw je ; } return result ; } | create a Api from an XML string |
18,223 | public String getIsoTimeStamp ( ) { TimeZone tz = TimeZone . getTimeZone ( "UTC" ) ; DateFormat df = new SimpleDateFormat ( "yyyy-MM-dd'T'HH:mm:ssX" ) ; df . setTimeZone ( tz ) ; String nowAsISO = df . format ( new Date ( ) ) ; return nowAsISO ; } | get a current IsoTimeStamp |
18,224 | public static String getStringFromUrl ( String urlString ) { ApacheHttpClient lclient = ApacheHttpClient . create ( ) ; WebResource webResource = lclient . resource ( urlString ) ; ClientResponse response = webResource . get ( ClientResponse . class ) ; if ( response . getStatus ( ) != 200 ) { throw new RuntimeExceptio... | get a String from a given URL |
18,225 | public Builder getResource ( String queryUrl ) throws Exception { if ( debug ) LOGGER . log ( Level . INFO , queryUrl ) ; WebResource wrs = client . resource ( queryUrl ) ; Builder result = wrs . header ( "USER-AGENT" , USER_AGENT ) ; return result ; } | get the given Builder for the given queryUrl this is a wrapper to be able to debug all QueryUrl |
18,226 | public ClientResponse getPostResponse ( String queryUrl , String params , TokenResult token , Object pFormDataObject ) throws Exception { params = params . replace ( "|" , "%7C" ) ; params = params . replace ( "+" , "%20" ) ; FormDataMultiPart form = null ; MultivaluedMap < String , String > lFormData = null ; if ( pFo... | get a Post response |
18,227 | public ClientResponse getResponse ( String url , Method method ) throws Exception { Builder resource = getResource ( url ) ; ClientResponse response = null ; switch ( method ) { case Get : response = resource . get ( ClientResponse . class ) ; break ; case Post : response = resource . post ( ClientResponse . class ) ; ... | get a response for the given url and method |
18,228 | public String getResponseString ( ClientResponse response ) throws Exception { if ( debug ) LOGGER . log ( Level . INFO , "status: " + response . getStatus ( ) ) ; String responseText = response . getEntity ( String . class ) ; if ( response . getStatus ( ) != 200 ) { handleError ( "status " + response . getStatus ( ) ... | get the Response string |
18,229 | public Map < String , String > getParamMap ( String params ) { Map < String , String > result = new HashMap < String , String > ( ) ; String [ ] paramlist = params . split ( "&" ) ; for ( int i = 0 ; i < paramlist . length ; i ++ ) { String [ ] parts = paramlist [ i ] . split ( "=" ) ; if ( parts . length == 2 ) result... | get a Map of parameter from a & delimited parameter list |
18,230 | public String getActionResultText ( String action , String params , TokenResult token , Object pFormData , String format ) throws Exception { String queryUrl = siteurl + scriptPath + apiPath + "action=" + action + "&format=" + format ; ClientResponse response ; response = this . getPostResponse ( queryUrl , params , to... | get the action result for the given parameters |
18,231 | public Api getActionResult ( String action , String params , TokenResult token , Object pFormData , String format ) throws Exception { String text = this . getActionResultText ( action , params , token , pFormData , format ) ; Api api = null ; if ( "xml" . equals ( format ) ) { if ( debug ) { String xmlDebug = text . r... | get the result for the given action and params |
18,232 | public Api getActionResult ( String action , String params , TokenResult token , Object pFormData ) throws Exception { return getActionResult ( action , params , token , pFormData , format ) ; } | get the action result for the default format |
18,233 | public Api getActionResult ( String action , String params ) throws Exception { Api result = this . getActionResult ( action , params , null , null ) ; return result ; } | get the result for the given action and query |
18,234 | public Api getQueryResult ( String query ) throws Exception { Api result = this . getActionResult ( "query" , query , null , null ) ; return result ; } | get the Result for the given query |
18,235 | public TokenResult prepareLogin ( String username ) throws Exception { username = encode ( username ) ; Api apiResult = null ; TokenResult token = new TokenResult ( ) ; token . tokenName = "lgtoken" ; token . tokenMode = TokenMode . token1_19 ; if ( this . isVersion128 ( ) ) { apiResult = this . getQueryResult ( "&meta... | prepare the login by getting the login token |
18,236 | public Login login ( String username , String password , String domain ) throws Exception { TokenResult token = prepareLogin ( username ) ; Login login = login ( token , username , password , domain ) ; return login ; } | login with the given username password and domain |
18,237 | public Login login ( String username , String password ) throws Exception { return login ( username , password , null ) ; } | login with the given username and password |
18,238 | public void logout ( ) throws Exception { Api apiResult = getActionResult ( "logout" , "" , null , null ) ; if ( apiResult != null ) { userid = null ; } if ( cookies != null ) { cookies . clear ( ) ; cookies = null ; } } | end the session |
18,239 | public String getSectionText ( String pageTitle , int sectionNumber ) throws Exception { String result = this . getPageContent ( pageTitle , "&rvsection=" + sectionNumber , false ) ; return result ; } | get the text for the given section |
18,240 | public Parse getParse ( String params ) throws Exception { String action = "parse" ; Api api = getActionResult ( action , params ) ; super . handleError ( api ) ; return api . getParse ( ) ; } | get the parse Result for the given params |
18,241 | public synchronized void upload ( InputStream fileToUpload , String filename , String contents , String comment ) throws Exception { TokenResult token = getEditToken ( "File:" + filename , "edit" ) ; final FormDataMultiPart multiPart = new FormDataMultiPart ( ) ; multiPart . bodyPart ( new StreamDataBodyPart ( "file" ,... | upload from the given inputstream |
18,242 | public static void showVersion ( ) { System . err . println ( "Mediawiki-Japi Version: " + VERSION ) ; System . err . println ( ) ; System . err . println ( " github: https://github.com/WolfgangFahl/Mediawiki-Japi" ) ; System . err . println ( "" ) ; } | show the Version |
18,243 | public void usage ( String msg ) { System . err . println ( msg ) ; showVersion ( ) ; System . err . println ( " usage: java com.bitplan.mediawiki.japi.Mediawiki" ) ; parser . printUsage ( System . err ) ; exitCode = 1 ; } | show a usage |
18,244 | public Api createAccount ( String name , String eMail , String realname , boolean mailpassword , String reason , String language ) throws Exception { String createtoken = "?" ; if ( getVersion ( ) . compareToIgnoreCase ( "Mediawiki 1.27" ) >= 0 ) { Api apiResult = this . getQueryResult ( "&meta=tokens&type=createaccoun... | create the given user account |
18,245 | public List < Rc > sortByTitleAndFilterDoubles ( List < Rc > rcList ) { List < Rc > result = new ArrayList < Rc > ( ) ; List < Rc > sorted = new ArrayList < Rc > ( ) ; sorted . addAll ( rcList ) ; Collections . sort ( sorted , new Comparator < Rc > ( ) { public int compare ( Rc lRc , Rc rRc ) { int result = lRc . getTi... | sort the given List by title and filter double titles |
18,246 | public String dateToMWTimeStamp ( Date date ) { SimpleDateFormat mwTimeStampFormat = new SimpleDateFormat ( "yyyyMMddHHmmss" ) ; String result = mwTimeStampFormat . format ( date ) ; return result ; } | convert a data to a MediaWiki API timestamp |
18,247 | public List < Rc > getMostRecentChanges ( int days , int rcLimit ) throws Exception { Date today = new Date ( ) ; Calendar cal = new GregorianCalendar ( ) ; cal . setTime ( today ) ; cal . add ( Calendar . DAY_OF_MONTH , - days ) ; Date date30daysbefore = cal . getTime ( ) ; String rcstart = dateToMWTimeStamp ( today )... | get the most recent changes |
18,248 | protected void handleError ( String errMsg ) throws Exception { LOGGER . log ( Level . SEVERE , errMsg ) ; if ( this . isThrowExceptionOnError ( ) ) { throw new Exception ( errMsg ) ; } } | handle the given error Message according to the exception setting |
18,249 | protected void handleError ( Error error ) throws Exception { String errMsg = "error: " + error . getCode ( ) + " info: " + error . getInfo ( ) ; handleError ( errMsg ) ; } | handle the given api error |
18,250 | public Api fromXML ( String xml ) throws Exception { Api api = Api . fromXML ( xml ) ; Error error = api . getError ( ) ; if ( error != null ) { String errMsg = "error code=" + error . getCode ( ) + " info:'" + error . getInfo ( ) + "'" ; this . handleError ( errMsg ) ; } return api ; } | return Api from the given xml |
18,251 | protected String encode ( String param ) throws Exception { String result = URLEncoder . encode ( param , "UTF-8" ) ; return result ; } | request parameter encoding |
18,252 | protected String decode ( String html ) throws Exception { String result = StringEscapeUtils . unescapeHtml4 ( html ) ; return result ; } | decode the given html markup |
18,253 | public String normalizeTitle ( String title ) throws Exception { String result = encode ( title ) ; result = result . replace ( "+" , "_" ) ; return result ; } | normalize the given page title |
18,254 | public static AccessContext getAccessContextOnThread ( ) { final Stack < AccessContext > stack = threadLocal . get ( ) ; return stack != null ? stack . peek ( ) : null ; } | Get prepared access - context on thread . |
18,255 | public static void setAccessContextOnThread ( AccessContext accessContext ) { if ( accessContext == null ) { String msg = "The argument[accessContext] must not be null." ; throw new IllegalArgumentException ( msg ) ; } Stack < AccessContext > stack = threadLocal . get ( ) ; if ( stack == null ) { stack = new Stack < Ac... | Set prepared access - context on thread . |
18,256 | public static boolean isExistAccessContextOnThread ( ) { final Stack < AccessContext > stack = threadLocal . get ( ) ; return stack != null ? ! stack . isEmpty ( ) : false ; } | Is existing prepared access - context on thread? |
18,257 | public void downloadStreamCall ( ResponseDownloadResource resource , HttpServletResponse response ) { final WrittenStreamCall streamCall = resource . getStreamCall ( ) ; if ( streamCall == null ) { String msg = "Either byte data or input stream is required: " + resource ; throw new IllegalArgumentException ( msg ) ; } ... | switched to stream call way for closing headache |
18,258 | public static Date getTransactionTime ( ) { final Stack < Date > stack = threadLocal . get ( ) ; return stack != null ? stack . peek ( ) : null ; } | Get the value of the transaction time . |
18,259 | public static void setTransactionTime ( Date transactionTime ) { if ( transactionTime == null ) { String msg = "The argument 'transactionTime' should not be null." ; throw new IllegalArgumentException ( msg ) ; } Stack < Date > stack = threadLocal . get ( ) ; if ( stack == null ) { stack = new Stack < Date > ( ) ; thre... | Set the value of the transaction time . |
18,260 | public ActionExecute findActionExecute ( String paramPath ) { for ( ActionExecute execute : executeMap . values ( ) ) { if ( execute . determineTargetByPathParameter ( paramPath ) ) { return execute ; } } return null ; } | optional unused for performance |
18,261 | protected void doSetFrom ( String from , String personal ) { assertArgumentNotEmpty ( "from" , from ) ; assertArgumentNotEmpty ( "personal" , personal ) ; postcard . setFrom ( createAddress ( from , personal ) ) ; } | public methods are prepared at sub - class |
18,262 | public void pushLogging ( String key , Object value ) { assertArgumentNotNull ( "key" , key ) ; assertArgumentNotNull ( "value" , value ) ; postcard . pushLogging ( key , value ) ; } | Push element of mail logging . |
18,263 | protected List < Class < ? extends Annotation > > createAnnotationTypeList ( Class < ? > ... annotations ) { final List < Class < ? extends Annotation > > annotationList = new ArrayList < Class < ? extends Annotation > > ( ) ; for ( Class < ? > annoType : annotations ) { @ SuppressWarnings ( "unchecked" ) final Class <... | for Generic headache . |
18,264 | protected SqlStringFilter createSqlStringFilter ( ActionRuntime runtime ) { final Method actionMethod = runtime . getExecuteMethod ( ) ; return newRomanticTraceableSqlStringFilter ( actionMethod , ( ) -> { return buildSqlMarkingAdditionalInfo ( ) ; } ) ; } | Create the filter of SQL string for DBFlute . |
18,265 | protected void checkLoginRequired ( ActionRuntime runtime ) throws LoginRequiredException { loginManager . ifPresent ( nager -> { nager . checkLoginRequired ( createLogingHandlingResource ( runtime ) ) ; } ) ; } | Check the login required for the requested action . |
18,266 | public void setWrappedData ( Object data ) { if ( data == null ) { inner = null ; arrayFromInner = null ; setRowIndex ( - 1 ) ; } else { inner = ( Collection < E > ) data ; arrayFromInner = ( E [ ] ) new Object [ inner . size ( ) ] ; inner . toArray ( arrayFromInner ) ; setRowIndex ( 0 ) ; } } | Set the wrapped data . |
18,267 | protected SqlAnalyzer createSqlAnalyzer ( String templateText , boolean blockNullParameter ) { final SqlAnalyzer analyzer = new SqlAnalyzer ( templateText , blockNullParameter ) { protected String filterAtFirst ( String sql ) { return sql ; } protected EmbeddedVariableNode newEmbeddedVariableNode ( String expr , String... | almost same as mailflute |
18,268 | public OptionalEntity < USER_ENTITY > findLoginUser ( Object userId ) { assertUserIdRequired ( userId ) ; try { @ SuppressWarnings ( "unchecked" ) final ID castId = ( ID ) userId ; return doFindLoginUser ( castId ) ; } catch ( ClassCastException e ) { throw new IllegalStateException ( "Cannot cast the user ID: " + user... | Find the login user in the database . |
18,269 | protected void doLogin ( LoginCredential credential , LoginSpecifiedOption option ) throws LoginFailureException { handleLoginSuccess ( findLoginUser ( credential ) . orElseThrow ( ( ) -> { final String msg = "Not found the user by the credential: " + credential + ", " + option ; return handleLoginFailure ( msg , crede... | Do actually login for the user by credential . |
18,270 | protected void handleLoginSuccess ( USER_ENTITY userEntity , LoginSpecifiedOption option ) { assertUserEntityRequired ( userEntity ) ; final USER_BEAN userBean = saveLoginInfoToSession ( userEntity ) ; if ( userBean instanceof SyncCheckable ) { ( ( SyncCheckable ) userBean ) . manageLastestSyncCheckTime ( timeManager .... | Handle login success for the found login user . |
18,271 | protected USER_BEAN saveLoginInfoToSession ( USER_ENTITY userEntity ) { regenerateSessionId ( ) ; logger . debug ( "...Saving login info to session" ) ; final USER_BEAN userBean = createUserBean ( userEntity ) ; sessionManager . setAttribute ( getUserBeanKey ( ) , userBean ) ; return userBean ; } | Save login info as user bean to session . |
18,272 | protected void saveRememberMeKeyToCookie ( USER_ENTITY userEntity , USER_BEAN userBean ) { final int expireDays = getRememberMeAccessTokenExpireDays ( ) ; getCookieRememberMeKey ( ) . ifPresent ( cookieKey -> { doSaveRememberMeCookie ( userEntity , userBean , expireDays , cookieKey ) ; } ) ; } | Save remember - me key to cookie . |
18,273 | protected void doSaveRememberMeCookie ( USER_ENTITY userEntity , USER_BEAN userBean , int expireDays , String cookieKey ) { logger . debug ( "...Saving remember-me key to cookie: key={}" , cookieKey ) ; final String value = buildRememberMeCookieValue ( userEntity , userBean , expireDays ) ; final int expireSeconds = ex... | Do save remember - me key to cookie . |
18,274 | protected boolean isValidRememberMeCookie ( String userKey , String expireDate ) { final String currentDate = formatForRememberMeExpireDate ( timeManager . currentHandyDate ( ) ) ; if ( currentDate . compareTo ( expireDate ) < 0 ) { return true ; } logger . debug ( "The access token for remember-me expired: userKey={} ... | Are the user ID and expire date extracted from cookie valid? |
18,275 | protected boolean doRememberMe ( ID userId , String expireDate , RememberMeLoginSpecifiedOption option ) { final boolean updateToken = option . isUpdateToken ( ) ; final boolean silentLogin = option . isSilentLogin ( ) ; if ( logger . isDebugEnabled ( ) ) { final StringBuilder sb = new StringBuilder ( ) ; sb . append (... | Do actually remember - me for the user . |
18,276 | protected void asLoginRequired ( LoginHandlingResource resource ) throws LoginRequiredException { logger . debug ( "...Checking login status for login required" ) ; if ( tryAlreadyLoginOrRememberMe ( resource ) ) { checkPermission ( resource ) ; return ; } if ( needsSavingRequestedLoginRedirect ( resource ) ) { saveReq... | Check as the login - required action . |
18,277 | protected void asNonLoginRequired ( LoginHandlingResource resource ) throws LoginRequiredException { if ( ! isSuppressRememberMeOfNonLoginRequired ( resource ) ) { logger . debug ( "...Checking login status for non login required" ) ; if ( tryAlreadyLoginOrRememberMe ( resource ) ) { checkPermission ( resource ) ; retu... | Check as the non login required action . |
18,278 | public Object remove ( Serializable key ) { if ( component . initialStateMarked ( ) ) { Object retVal = deltaMap . remove ( key ) ; if ( retVal == null ) { return defaultMap . remove ( key ) ; } else { defaultMap . remove ( key ) ; return retVal ; } } else { return defaultMap . remove ( key ) ; } } | We need to remove from both maps if we do remove an existing key . |
18,279 | public Object saveState ( FacesContext context ) { if ( context == null ) { throw new NullPointerException ( ) ; } if ( component . initialStateMarked ( ) ) { return saveMap ( context , deltaMap ) ; } else { return saveMap ( context , defaultMap ) ; } } | One and only implementation of save - state - makes all other implementations unnecessary . |
18,280 | public void restoreState ( FacesContext context , Object state ) { if ( context == null ) { throw new NullPointerException ( ) ; } if ( state == null ) { return ; } if ( ! component . initialStateMarked ( ) && ! defaultMap . isEmpty ( ) ) { defaultMap . clear ( ) ; if ( deltaMap != null && ! deltaMap . isEmpty ( ) ) { ... | One and only implementation of restore state . Makes all other implementations unnecessary . |
18,281 | private void advance ( ) { try { if ( tok == null ) tok = source . token ( ) ; } catch ( LexerException e ) { throw new IllegalStateException ( e ) ; } catch ( IOException e ) { throw new IllegalStateException ( e ) ; } } | Rethrows IOException inside IllegalStateException . |
18,282 | public Token next ( ) { if ( ! hasNext ( ) ) throw new NoSuchElementException ( ) ; Token t = this . tok ; this . tok = null ; return t ; } | Returns the next token from the enclosed Source . |
18,283 | private static Object saveBindings ( FacesContext context , Map < String , ValueExpression > bindings ) { if ( bindings == null ) { return ( null ) ; } Object values [ ] = new Object [ 2 ] ; values [ 0 ] = bindings . keySet ( ) . toArray ( new String [ bindings . size ( ) ] ) ; Object [ ] bindingValues = bindings . val... | Utility for saving bindings state |
18,284 | private static Map < String , ValueExpression > restoreBindings ( FacesContext context , Object state ) { if ( state == null ) { return ( null ) ; } Object values [ ] = ( Object [ ] ) state ; String names [ ] = ( String [ ] ) values [ 0 ] ; Object states [ ] = ( Object [ ] ) values [ 1 ] ; Map < String , ValueExpressio... | Utility for restoring bindings from state |
18,285 | private void setLiteralValue ( String propertyName , ValueExpression expression ) { assert ( expression . isLiteralText ( ) ) ; Object value ; ELContext context = FacesContext . getCurrentInstance ( ) . getELContext ( ) ; try { value = expression . getValue ( context ) ; } catch ( ELException ele ) { throw new FacesExc... | Sets a property converting it from a literal |
18,286 | private static List < String > toSingletonList ( String propertyName , String value ) { if ( ( null == value ) || ( value . length ( ) == 0 ) ) { return null ; } if ( value . charAt ( 0 ) == '@' ) { List < String > list ; if ( ALL . equals ( value ) ) { list = ALL_LIST ; } else if ( FORM . equals ( value ) ) { list = F... | Converts a String with no spaces to a singleton list |
18,287 | private static Object [ ] toObjectArray ( Object primitiveArray ) { if ( primitiveArray == null ) { throw new NullPointerException ( ) ; } if ( primitiveArray instanceof Object [ ] ) { return ( Object [ ] ) primitiveArray ; } if ( primitiveArray instanceof Collection ) { return ( ( Collection ) primitiveArray ) . toArr... | Convert an array of primitives to an array of boxed objects . |
18,288 | public boolean hasMessageOf ( String property ) { assertArgumentNotNull ( "property" , property ) ; final UserMessageItem item = getPropertyItem ( property ) ; return item != null && ! item . getMessageList ( ) . isEmpty ( ) ; } | Does the property has user message? |
18,289 | public boolean hasMessageOf ( String property , String messageKey ) { assertArgumentNotNull ( "property" , property ) ; assertArgumentNotNull ( "messageKey" , messageKey ) ; final UserMessageItem item = getPropertyItem ( property ) ; return item != null && item . getMessageList ( ) . stream ( ) . anyMatch ( message -> ... | Does the property has user message for the message key? |
18,290 | private static int _indexOfStartingFrom ( List < ? > list , int startIndex , Object searchValue ) { int itemCount = list . size ( ) ; boolean found = false ; for ( int currIndex = startIndex ; currIndex < itemCount ; currIndex ++ ) { Object currId = list . get ( currIndex ) ; if ( ( searchValue == currId ) || ( ( searc... | Similar to List . indexOf except that we start searching from a specific index and then wrap aroud . For this to be performant the List should implement RandomAccess . |
18,291 | private Resource findComponentResourceBundleLocaleMatch ( FacesContext context , String resourceName , String libraryName ) { Resource result = null ; ResourceBundle resourceBundle = null ; int i ; if ( - 1 != ( i = resourceName . lastIndexOf ( "." ) ) ) { resourceName = resourceName . substring ( 0 , i ) + ".propertie... | way to handle this . |
18,292 | private void clearFacesEvents ( FacesContext context ) { if ( context . getRenderResponse ( ) || context . getResponseComplete ( ) ) { if ( events != null ) { for ( List < FacesEvent > eventList : events ) { if ( eventList != null ) { eventList . clear ( ) ; } } events = null ; } } } | or if there is a response complete signal . |
18,293 | private static Locale getLocaleFromString ( String localeStr ) throws IllegalArgumentException { if ( null == localeStr || localeStr . length ( ) < 2 ) { throw new IllegalArgumentException ( "Illegal locale String: " + localeStr ) ; } Locale result = null ; String lang = null ; String country = null ; String variant = ... | language - country - variant . |
18,294 | protected String convertToPerformanceView ( long afterMinusBefore ) { if ( afterMinusBefore < 0 ) { return String . valueOf ( afterMinusBefore ) ; } long sec = afterMinusBefore / 1000 ; final long min = sec / 60 ; sec = sec % 60 ; final long mil = afterMinusBefore % 1000 ; final StringBuffer sb = new StringBuffer ( ) ;... | Convert to performance view . |
18,295 | protected List < Object > resolveLabelParameter ( Locale locale , String key , Object [ ] args ) { final MessageResourceBundle bundle = getBundle ( locale ) ; if ( args == null || args . length == 0 ) { return DfCollectionUtil . emptyList ( ) ; } final List < Object > resolvedList = new ArrayList < Object > ( args . le... | Resolve label parameters in the arguments . |
18,296 | public void handleWarning ( Source source , int line , int column , String msg ) throws LexerException { warnings ++ ; print ( source . getName ( ) + ":" + line + ":" + column + ": warning: " + msg ) ; } | Handles a warning . |
18,297 | public void handleError ( Source source , int line , int column , String msg ) throws LexerException { errors ++ ; print ( source . getName ( ) + ":" + line + ":" + column + ": error: " + msg ) ; } | Handles an error . |
18,298 | protected OptionalThing < ClassificationMeta > findMeta ( Class < ? > defmetaType , String classificationName ) { return LaClassificationUtil . findMeta ( defmetaType , classificationName ) ; } | helper for sub class |
18,299 | private void executeValidate ( FacesContext context ) { try { validate ( context ) ; } catch ( RuntimeException e ) { context . renderResponse ( ) ; throw e ; } if ( ! isValid ( ) ) { context . validationFailed ( ) ; context . renderResponse ( ) ; } } | Executes validation logic . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.