idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
23,100
public static MergeResult mergeRevision ( long revision , File directory , String branch , String baseUrl ) throws IOException { CommandLine cmdLine = new CommandLine ( SVN_CMD ) ; cmdLine . addArgument ( CMD_MERGE ) ; addDefaultArguments ( cmdLine , null , null ) ; cmdLine . addArgument ( "-x" ) ; cmdLine . addArgumen...
Merge the given revision and return true if only mergeinfo changes were done on trunk .
23,101
public static String getMergedRevisions ( File directory , String ... branches ) throws IOException { CommandLine cmdLine ; cmdLine = new CommandLine ( SVN_CMD ) ; cmdLine . addArgument ( "propget" ) ; addDefaultArguments ( cmdLine , null , null ) ; cmdLine . addArgument ( "svn:mergeinfo" ) ; StringBuilder MERGED_REVIS...
Retrieve a list of all merged revisions .
23,102
public static void revertAll ( File directory ) throws IOException { log . info ( "Reverting SVN Working copy at " + directory ) ; CommandLine cmdLine = new CommandLine ( SVN_CMD ) ; cmdLine . addArgument ( CMD_REVERT ) ; addDefaultArguments ( cmdLine , null , null ) ; cmdLine . addArgument ( OPT_DEPTH ) ; cmdLine . ad...
Revert all changes pending in the given SVN Working Copy .
23,103
public static void cleanup ( File directory ) throws IOException { log . info ( "Cleaning SVN Working copy at " + directory ) ; CommandLine cmdLine = new CommandLine ( SVN_CMD ) ; cmdLine . addArgument ( "cleanup" ) ; addDefaultArguments ( cmdLine , null , null ) ; try ( InputStream result = ExecutionHelper . getComman...
Run svn cleanup on the given working copy .
23,104
public static InputStream checkout ( String url , File directory , String user , String pwd ) throws IOException { if ( ! directory . exists ( ) && ! directory . mkdirs ( ) ) { throw new IOException ( "Could not create new working copy directory at " + directory ) ; } CommandLine cmdLine = new CommandLine ( SVN_CMD ) ;...
Performs a SVN Checkout of the given URL to the given directory
23,105
public static void copyBranch ( String base , String branch , long revision , String baseUrl ) throws IOException { log . info ( "Copying branch " + base + AT_REVISION + revision + " to branch " + branch ) ; CommandLine cmdLine = new CommandLine ( SVN_CMD ) ; cmdLine . addArgument ( "cp" ) ; addDefaultArguments ( cmdLi...
Make a branch by calling the svn cp operation .
23,106
public ConfigurationStore getStore ( ) throws ConfigException { if ( store != null ) { return store ; } String uriStr = getConfigUri ( ) ; if ( uriStr == null ) { getPfile ( ) ; String configPname = getConfigPname ( ) ; if ( configPname == null ) { throw new ConfigException ( "Either a uri or property name must be spec...
Get a ConfigurationStore based on the uri or property value .
23,107
protected String loadOnlyConfig ( final Class < T > cl ) { try { ConfigurationStore cs = getStore ( ) ; List < String > configNames = cs . getConfigs ( ) ; if ( configNames . isEmpty ( ) ) { error ( "No configuration on path " + cs . getLocation ( ) ) ; return "No configuration on path " + cs . getLocation ( ) ; } if (...
Load the configuration if we only expect one and we don t care or know what it s called .
23,108
public static StorageConfiguration deserialize ( final File pFile ) throws TTIOException { try { FileReader fileReader = new FileReader ( new File ( pFile , Paths . ConfigBinary . getFile ( ) . getName ( ) ) ) ; JsonReader jsonReader = new JsonReader ( fileReader ) ; jsonReader . beginObject ( ) ; jsonReader . nextName...
Generate a StorageConfiguration out of a file .
23,109
@ ConfInfo ( dontSave = true ) public String getProperty ( final Collection < String > col , final String name ) { String key = name + "=" ; for ( String p : col ) { if ( p . startsWith ( key ) ) { return p . substring ( key . length ( ) ) ; } } return null ; }
Get a property stored as a String name = val
23,110
public void removeProperty ( final Collection < String > col , final String name ) { try { String v = getProperty ( col , name ) ; if ( v == null ) { return ; } col . remove ( name + "=" + v ) ; } catch ( Throwable t ) { throw new RuntimeException ( t ) ; } }
Remove a property stored as a String name = val
23,111
@ SuppressWarnings ( "unchecked" ) public < L extends List > L setListProperty ( final L list , final String name , final String val ) { removeProperty ( list , name ) ; return addListProperty ( list , name , val ) ; }
Set a property
23,112
public void toXml ( final Writer wtr ) throws ConfigException { try { XmlEmit xml = new XmlEmit ( ) ; xml . addNs ( new NameSpace ( ns , "BW" ) , true ) ; xml . startEmit ( wtr ) ; dump ( xml , false ) ; xml . flush ( ) ; } catch ( ConfigException cfe ) { throw cfe ; } catch ( Throwable t ) { throw new ConfigException ...
Output to a writer
23,113
public ConfigBase fromXml ( final InputStream is , final Class cl ) throws ConfigException { try { return fromXml ( parseXml ( is ) , cl ) ; } catch ( final ConfigException ce ) { throw ce ; } catch ( final Throwable t ) { throw new ConfigException ( t ) ; } }
XML root element must have type attribute if cl is null
23,114
public ConfigBase fromXml ( final Element rootEl , final Class cl ) throws ConfigException { try { final ConfigBase cb = ( ConfigBase ) getObject ( rootEl , cl ) ; if ( cb == null ) { return null ; } for ( final Element el : XmlUtil . getElementsArray ( rootEl ) ) { populate ( el , cb , null , null ) ; } return cb ; } ...
XML root element must have type attribute
23,115
public void setPath ( final String ideal , final String actual ) { synchronized ( transformers ) { pathMap . put ( ideal , actual ) ; } }
Set ideal to actual mapping .
23,116
public static void initLogging ( ) throws IOException { sendCommonsLogToJDKLog ( ) ; try ( InputStream resource = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( "logging.properties" ) ) { if ( resource != null ) { try { LogManager . getLogManager ( ) . readConfiguration ( resource ) ; } ...
Initialize Logging from a file logging . properties which needs to be found in the classpath .
23,117
public void add ( final ITreeData paramNodeX , final ITreeData paramNodeY ) throws TTIOException { mMapping . put ( paramNodeX , paramNodeY ) ; mReverseMapping . put ( paramNodeY , paramNodeX ) ; updateSubtreeMap ( paramNodeX , mRtxNew ) ; updateSubtreeMap ( paramNodeY , mRtxOld ) ; }
Adds the matching x - > y .
23,118
public long containedChildren ( final ITreeData paramNodeX , final ITreeData paramNodeY ) throws TTIOException { assert paramNodeX != null ; assert paramNodeY != null ; long retVal = 0 ; mRtxOld . moveTo ( paramNodeX . getDataKey ( ) ) ; for ( final AbsAxis axis = new DescendantAxis ( mRtxOld , true ) ; axis . hasNext ...
Counts the number of child nodes in the subtrees of x and y that are also in the matching .
23,119
public static List < String > fixPath ( final String path ) throws ServletException { if ( path == null ) { return null ; } String decoded ; try { decoded = URLDecoder . decode ( path , "UTF8" ) ; } catch ( Throwable t ) { throw new ServletException ( "bad path: " + path ) ; } if ( decoded == null ) { return ( null ) ;...
Return a path broken into its elements after . and .. are removed . If the parameter path attempts to go above the root we return null .
23,120
protected Object readJson ( final InputStream is , final Class cl , final HttpServletResponse resp ) throws ServletException { if ( is == null ) { return null ; } try { return getMapper ( ) . readValue ( is , cl ) ; } catch ( Throwable t ) { resp . setStatus ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR ) ; if ( deb...
Parse the request body and return the object .
23,121
public static String timeToReadable ( long millis , String suffix ) { StringBuilder builder = new StringBuilder ( ) ; boolean haveDays = false ; if ( millis > ONE_DAY ) { millis = handleTime ( builder , millis , ONE_DAY , "day" , "s" ) ; haveDays = true ; } boolean haveHours = false ; if ( millis >= ONE_HOUR ) { millis...
Format the given number of milliseconds as readable string optionally appending a suffix .
23,122
public static synchronized XMLEventReader createFileReader ( final File paramFile ) throws IOException , XMLStreamException { final XMLInputFactory factory = XMLInputFactory . newInstance ( ) ; factory . setProperty ( XMLInputFactory . SUPPORT_DTD , false ) ; final InputStream in = new FileInputStream ( paramFile ) ; r...
Create a new StAX reader on a file .
23,123
public static synchronized XMLEventReader createStringReader ( final String paramString ) throws IOException , XMLStreamException { final XMLInputFactory factory = XMLInputFactory . newInstance ( ) ; factory . setProperty ( XMLInputFactory . SUPPORT_DTD , false ) ; final InputStream in = new ByteArrayInputStream ( para...
Create a new StAX reader on a string .
23,124
public String simpleGet ( String url ) throws IOException { final AtomicReference < String > str = new AtomicReference < > ( ) ; simpleGetInternal ( url , inputStream -> { try { str . set ( IOUtils . toString ( inputStream , "UTF-8" ) ) ; } catch ( IOException e ) { throw new IllegalStateException ( e ) ; } } , null ) ...
Perform a simple get - operation and return the resulting String .
23,125
public byte [ ] simpleGetBytes ( String url ) throws IOException { final AtomicReference < byte [ ] > bytes = new AtomicReference < > ( ) ; simpleGetInternal ( url , inputStream -> { try { bytes . set ( IOUtils . toByteArray ( inputStream ) ) ; } catch ( IOException e ) { throw new IllegalStateException ( e ) ; } } , n...
Perform a simple get - operation and return the resulting byte - array .
23,126
public void simpleGet ( String url , Consumer < InputStream > consumer ) throws IOException { simpleGetInternal ( url , consumer , null ) ; }
Perform a simple get - operation and passes the resulting InputStream to the given Consumer
23,127
public static String retrieveData ( String url , String user , String password , int timeoutMs ) throws IOException { try ( HttpClientWrapper wrapper = new HttpClientWrapper ( user , password , timeoutMs ) ) { return wrapper . simpleGet ( url ) ; } }
Small helper method to simply query the URL without password and return the resulting data .
23,128
public static HttpEntity checkAndFetch ( HttpResponse response , String url ) throws IOException { int statusCode = response . getStatusLine ( ) . getStatusCode ( ) ; if ( statusCode > 206 ) { String msg = "Had HTTP StatusCode " + statusCode + " for request: " + url + ", response: " + response . getStatusLine ( ) . get...
Helper method to check the status code of the response and throw an IOException if it is an error or moved state .
23,129
public void createResource ( final InputStream inputStream , final String resourceName ) throws JaxRxException { synchronized ( resourceName ) { if ( inputStream == null ) { throw new JaxRxException ( 400 , "Bad user request" ) ; } else { try { shred ( inputStream , resourceName ) ; } catch ( final TTException exce ) {...
This method is responsible to create a new database .
23,130
public void add ( final InputStream input , final String resource ) throws JaxRxException { synchronized ( resource ) { try { shred ( input , resource ) ; } catch ( final TTException exce ) { throw new JaxRxException ( exce ) ; } } }
This method is responsible to add a new XML document to a collection .
23,131
public void deleteResource ( final String resourceName ) throws WebApplicationException { synchronized ( resourceName ) { try { mDatabase . truncateResource ( new SessionConfiguration ( resourceName , null ) ) ; } catch ( TTException e ) { throw new WebApplicationException ( e ) ; } } }
This method is responsible to delete an existing database .
23,132
public long getLastRevision ( final String resourceName ) throws JaxRxException , TTException { long lastRevision ; if ( mDatabase . existsResource ( resourceName ) ) { ISession session = null ; try { session = mDatabase . getSession ( new SessionConfiguration ( resourceName , StandardSettings . KEY ) ) ; lastRevision ...
This method reads the existing database and offers the last revision id of the database
23,133
private void serializIt ( final String resource , final Long revision , final OutputStream output , final boolean nodeid ) throws JaxRxException , TTException { ISession session = null ; try { session = mDatabase . getSession ( new SessionConfiguration ( resource , StandardSettings . KEY ) ) ; final XMLSerializerBuilde...
The XML serializer to a given tnk file .
23,134
public void revertToRevision ( final String resourceName , final long backToRevision ) throws JaxRxException , TTException { ISession session = null ; INodeWriteTrx wtx = null ; boolean abort = false ; try { session = mDatabase . getSession ( new SessionConfiguration ( resourceName , StandardSettings . KEY ) ) ; wtx = ...
This method reverts the latest revision data to the requested .
23,135
private String discover ( final String url ) throws TimezonesException { String realUrl ; try { new URL ( url ) ; realUrl = url ; } catch ( final Throwable t ) { realUrl = "https://" + url + "/.well-known/timezone" ; } for ( int redirects = 0 ; redirects < 10 ; redirects ++ ) { try ( CloseableHttpResponse hresp = doCal...
See if we have a url for the service . If not discover the real one .
23,136
protected void emitEndElement ( final INodeReadTrx paramRTX ) { try { indent ( ) ; mOut . write ( ECharsForSerializing . OPEN_SLASH . getBytes ( ) ) ; mOut . write ( paramRTX . nameForKey ( ( ( ITreeNameData ) paramRTX . getNode ( ) ) . getNameKey ( ) ) . getBytes ( ) ) ; mOut . write ( ECharsForSerializing . CLOSE . g...
Emit end element .
23,137
private void indent ( ) throws IOException { if ( mIndent ) { for ( int i = 0 ; i < mStack . size ( ) * mIndentSpaces ; i ++ ) { mOut . write ( " " . getBytes ( ) ) ; } } }
Indentation of output .
23,138
private void write ( final long mValue ) throws IOException { final int length = ( int ) Math . log10 ( ( double ) mValue ) ; int digit = 0 ; long remainder = mValue ; for ( int i = length ; i >= 0 ; i -- ) { digit = ( byte ) ( remainder / LONG_POWERS [ i ] ) ; mOut . write ( ( byte ) ( digit + ASCII_OFFSET ) ) ; remai...
Write non - negative non - zero long as UTF - 8 bytes .
23,139
public static String isoDate ( final Date val ) { synchronized ( isoDateFormat ) { try { isoDateFormat . setTimeZone ( Timezones . getDefaultTz ( ) ) ; } catch ( TimezonesException tze ) { throw new RuntimeException ( tze ) ; } return isoDateFormat . format ( val ) ; } }
Turn Date into yyyyMMdd
23,140
public static String rfcDate ( final Date val ) { synchronized ( rfcDateFormat ) { try { rfcDateFormat . setTimeZone ( Timezones . getDefaultTz ( ) ) ; } catch ( TimezonesException tze ) { throw new RuntimeException ( tze ) ; } return rfcDateFormat . format ( val ) ; } }
Turn Date into yyyy - MM - dd
23,141
public static String isoDateTime ( final Date val ) { synchronized ( isoDateTimeFormat ) { try { isoDateTimeFormat . setTimeZone ( Timezones . getDefaultTz ( ) ) ; } catch ( TimezonesException tze ) { throw new RuntimeException ( tze ) ; } return isoDateTimeFormat . format ( val ) ; } }
Turn Date into yyyyMMddTHHmmss
23,142
public static String isoDateTime ( final Date val , final TimeZone tz ) { synchronized ( isoDateTimeTZFormat ) { isoDateTimeTZFormat . setTimeZone ( tz ) ; return isoDateTimeTZFormat . format ( val ) ; } }
Turn Date into yyyyMMddTHHmmss for a given timezone
23,143
public static Date fromISODate ( final String val ) throws BadDateException { try { synchronized ( isoDateFormat ) { try { isoDateFormat . setTimeZone ( Timezones . getDefaultTz ( ) ) ; } catch ( TimezonesException tze ) { throw new RuntimeException ( tze ) ; } return isoDateFormat . parse ( val ) ; } } catch ( Throwab...
Get Date from yyyyMMdd
23,144
public static Date fromRfcDate ( final String val ) throws BadDateException { try { synchronized ( rfcDateFormat ) { try { rfcDateFormat . setTimeZone ( Timezones . getDefaultTz ( ) ) ; } catch ( TimezonesException tze ) { throw new RuntimeException ( tze ) ; } return rfcDateFormat . parse ( val ) ; } } catch ( Throwab...
Get Date from yyyy - MM - dd
23,145
public static Date fromISODateTime ( final String val ) throws BadDateException { try { synchronized ( isoDateTimeFormat ) { try { isoDateTimeFormat . setTimeZone ( Timezones . getDefaultTz ( ) ) ; } catch ( TimezonesException tze ) { throw new RuntimeException ( tze ) ; } return isoDateTimeFormat . parse ( val ) ; } }...
Get Date from yyyyMMddThhmmss
23,146
public static Date fromISODateTime ( final String val , final TimeZone tz ) throws BadDateException { try { synchronized ( isoDateTimeTZFormat ) { isoDateTimeTZFormat . setTimeZone ( tz ) ; return isoDateTimeTZFormat . parse ( val ) ; } } catch ( Throwable t ) { throw new BadDateException ( ) ; } }
Get Date from yyyyMMddThhmmss with timezone
23,147
@ SuppressWarnings ( "unused" ) public static Date fromISODateTimeUTC ( final String val , final TimeZone tz ) throws BadDateException { try { synchronized ( isoDateTimeUTCTZFormat ) { isoDateTimeUTCTZFormat . setTimeZone ( tz ) ; return isoDateTimeUTCTZFormat . parse ( val ) ; } } catch ( Throwable t ) { throw new Bad...
Get Date from yyyyMMddThhmmssZ with timezone
23,148
public static Date fromISODateTimeUTC ( final String val ) throws BadDateException { try { synchronized ( isoDateTimeUTCFormat ) { return isoDateTimeUTCFormat . parse ( val ) ; } } catch ( Throwable t ) { throw new BadDateException ( ) ; } }
Get Date from yyyyMMddThhmmssZ
23,149
public static String fromISODateTimeUTCtoRfc822 ( final String val ) throws BadDateException { try { synchronized ( isoDateTimeUTCFormat ) { return rfc822Date ( isoDateTimeUTCFormat . parse ( val ) ) ; } } catch ( Throwable t ) { throw new BadDateException ( ) ; } }
Get RFC822 form from yyyyMMddThhmmssZ
23,150
public static boolean isISODate ( final String val ) throws BadDateException { try { if ( val . length ( ) != 8 ) { return false ; } fromISODate ( val ) ; return true ; } catch ( Throwable t ) { return false ; } }
Check Date is yyyyMMdd
23,151
public static boolean isISODateTimeUTC ( final String val ) throws BadDateException { try { if ( val . length ( ) != 16 ) { return false ; } fromISODateTimeUTC ( val ) ; return true ; } catch ( Throwable t ) { return false ; } }
Check Date is yyyyMMddThhmmddZ
23,152
public static boolean isISODateTime ( final String val ) throws BadDateException { try { if ( val . length ( ) != 15 ) { return false ; } fromISODateTime ( val ) ; return true ; } catch ( Throwable t ) { return false ; } }
Check Date is yyyyMMddThhmmdd
23,153
public static Date fromDate ( final String dt ) throws BadDateException { try { if ( dt == null ) { return null ; } if ( dt . indexOf ( "T" ) > 0 ) { return fromDateTime ( dt ) ; } if ( ! dt . contains ( "-" ) ) { return fromISODate ( dt ) ; } return fromRfcDate ( dt ) ; } catch ( Throwable t ) { throw new BadDateExcep...
Return rfc or iso String date or datetime as java Date
23,154
public static Date fromDateTime ( final String dt ) throws BadDateException { try { if ( dt == null ) { return null ; } if ( ! dt . contains ( "-" ) ) { return fromISODateTimeUTC ( dt ) ; } return fromRfcDateTimeUTC ( dt ) ; } catch ( Throwable t ) { throw new BadDateException ( ) ; } }
Return rfc or iso String datetime as java Date
23,155
public AbstractModule createModule ( ) { return new AbstractModule ( ) { protected void configure ( ) { bind ( IDataFactory . class ) . to ( mDataFacClass ) ; bind ( IMetaEntryFactory . class ) . to ( mMetaFacClass ) ; bind ( IRevisioning . class ) . to ( mRevisioningClass ) ; bind ( IByteHandlerPipeline . class ) . to...
Creating an Guice Module based on the parameters set .
23,156
public void setProperty ( final String name , final String val ) { if ( props == null ) { props = new Properties ( ) ; } props . setProperty ( name , val ) ; }
Allows applications to provide parameters to methods using this object class
23,157
public void startEmit ( final Writer wtr , final String dtd ) throws IOException { this . wtr = wtr ; this . dtd = dtd ; }
Emit any headers dtd and namespace declarations
23,158
public void openTag ( final QName tag , final String attrName , final String attrVal ) throws IOException { blanks ( ) ; openTagSameLine ( tag , attrName , attrVal ) ; newline ( ) ; indent += 2 ; }
open with attribute
23,159
public void openTagSameLine ( final QName tag , final String attrName , final String attrVal ) throws IOException { lb ( ) ; emitQName ( tag ) ; attribute ( attrName , attrVal ) ; endOpeningTag ( ) ; }
Emit an opening tag ready for nested values . No new line
23,160
private void value ( final String val , final String quoteChar ) throws IOException { if ( val == null ) { return ; } String q = quoteChar ; if ( q == null ) { q = "" ; } if ( ( val . indexOf ( '&' ) >= 0 ) || ( val . indexOf ( '<' ) >= 0 ) ) { out ( "<![CDATA[" ) ; out ( q ) ; out ( val ) ; out ( q ) ; out ( "]]>" ) ;...
Write out a value
23,161
public OptionElement parseOptions ( final InputStream is ) throws OptionsException { Reader rdr = null ; try { rdr = new InputStreamReader ( is ) ; DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( false ) ; DocumentBuilder builder = factory . newDocumentBuilder (...
Parse the input stream and return the internal representation .
23,162
public void toXml ( final OptionElement root , final OutputStream str ) throws OptionsException { Writer wtr = null ; try { XmlEmit xml = new XmlEmit ( true ) ; wtr = new OutputStreamWriter ( str ) ; xml . startEmit ( wtr ) ; xml . openTag ( outerTag ) ; for ( OptionElement oe : root . getChildren ( ) ) { childToXml ( ...
Emit the options as xml .
23,163
public Object getProperty ( final String name ) throws OptionsException { Object val = getOptProperty ( name ) ; if ( val == null ) { throw new OptionsException ( "Missing property " + name ) ; } return val ; }
Get required property throw exception if absent
23,164
public String getStringProperty ( final String name ) throws OptionsException { Object val = getProperty ( name ) ; if ( ! ( val instanceof String ) ) { throw new OptionsException ( "org.bedework.calenv.bad.option.value" ) ; } return ( String ) val ; }
Return the String value of the named property .
23,165
public Collection match ( final String name ) throws OptionsException { if ( useSystemwideValues ) { return match ( optionsRoot , makePathElements ( name ) , - 1 ) ; } return match ( localOptionsRoot , makePathElements ( name ) , - 1 ) ; }
Match for values .
23,166
public static String getProperty ( final MessageResources msg , final String pname , final String def ) throws Throwable { String p = msg . getMessage ( pname ) ; if ( p == null ) { return def ; } return p ; }
Return a property value or the default
23,167
public static String getReqProperty ( final MessageResources msg , final String pname ) throws Throwable { String p = getProperty ( msg , pname , null ) ; if ( p == null ) { logger . error ( "No definition for property " + pname ) ; throw new Exception ( ": No definition for property " + pname ) ; } return p ; }
Return a required property value
23,168
public static boolean getBoolProperty ( final MessageResources msg , final String pname , final boolean def ) throws Throwable { String p = msg . getMessage ( pname ) ; if ( p == null ) { return def ; } return Boolean . valueOf ( p ) ; }
Return a boolean property value or the default
23,169
public static int getIntProperty ( final MessageResources msg , final String pname , final int def ) throws Throwable { String p = msg . getMessage ( pname ) ; if ( p == null ) { return def ; } return Integer . valueOf ( p ) ; }
Return an int property value or the default
23,170
public static MessageEmit getErrorObj ( final HttpServletRequest request , final String errorObjAttrName ) { if ( errorObjAttrName == null ) { return null ; } HttpSession sess = request . getSession ( false ) ; if ( sess == null ) { logger . error ( "No session!!!!!!!" ) ; return null ; } Object o = sess . getAttribute...
Get the existing error object from the session or null .
23,171
public static MessageEmit getMessageObj ( final HttpServletRequest request , final String messageObjAttrName ) { if ( messageObjAttrName == null ) { return null ; } HttpSession sess = request . getSession ( false ) ; if ( sess == null ) { logger . error ( "No session!!!!!!!" ) ; return null ; } Object o = sess . getAtt...
Get the existing message object from the session or null .
23,172
public static double quickRatio ( final String paramFirst , final String paramSecond ) { if ( paramFirst == null || paramSecond == null ) { return 1 ; } double matches = 0 ; final int x [ ] [ ] = new int [ 256 ] [ ] ; for ( char c : paramSecond . toCharArray ( ) ) { if ( x [ c >> 8 ] == null ) { x [ c >> 8 ] = new int ...
Calculates the similarity of two strings . This is done by comparing the frequency each character occures in both strings .
23,173
public ObjectName createCustomComponentMBeanName ( final String type , final String name ) { ObjectName result = null ; String tmp = jmxDomainName + ":" + "type=" + sanitizeString ( type ) + ",name=" + sanitizeString ( name ) ; try { result = new ObjectName ( tmp ) ; } catch ( MalformedObjectNameException e ) { error (...
Formulate and return the MBean ObjectName of a custom control MBean
23,174
public static ObjectName getSystemObjectName ( final String domainName , final String containerName , final Class theClass ) throws MalformedObjectNameException { String tmp = domainName + ":" + "type=" + theClass . getName ( ) + ",name=" + getRelativeName ( containerName , theClass ) ; return new ObjectName ( tmp ) ; ...
Retrieve a System ObjectName
23,175
public void unregisterMBean ( final ObjectName name ) throws JMException { if ( ( beanServer != null ) && beanServer . isRegistered ( name ) && registeredMBeanNames . remove ( name ) ) { beanServer . unregisterMBean ( name ) ; } }
Unregister an MBean
23,176
public void set ( final T paramOrigin , final T paramDestination , final boolean paramBool ) { assert paramOrigin != null ; assert paramDestination != null ; if ( ! mMap . containsKey ( paramOrigin ) ) { mMap . put ( paramOrigin , new IdentityHashMap < T , Boolean > ( ) ) ; } mMap . get ( paramOrigin ) . put ( paramDes...
Sets the connection between a and b .
23,177
public boolean get ( final T paramOrigin , final T paramDestination ) { assert paramOrigin != null ; assert paramDestination != null ; if ( ! mMap . containsKey ( paramOrigin ) ) { return false ; } final Boolean bool = mMap . get ( paramOrigin ) . get ( paramDestination ) ; return bool != null && bool ; }
Returns whether there is a connection between a and b . Unknown objects do never have a connection .
23,178
public void toStringSegment ( final ToString ts ) { ts . append ( "sysCode" , String . valueOf ( getSysCode ( ) ) ) ; ts . append ( "dtstamp" , getDtstamp ( ) ) ; ts . append ( "sequence" , getSequence ( ) ) ; }
Add our stuff to the ToString object
23,179
public synchronized byte [ ] toByteArray ( ) { byte [ ] outBuff = new byte [ count ] ; int pos = 0 ; for ( BufferPool . Buffer b : buffers ) { System . arraycopy ( b . buf , 0 , outBuff , pos , b . pos ) ; pos += b . pos ; } return outBuff ; }
Creates a newly allocated byte array . Its size is the current size of this output stream and the valid contents of the buffer have been copied into it .
23,180
public void release ( ) throws IOException { for ( BufferPool . Buffer b : buffers ) { PooledBuffers . release ( b ) ; } buffers . clear ( ) ; count = 0 ; }
This really release buffers back to the pool . MUST be called to gain the benefit of pooling .
23,181
public static boolean createFolderStructure ( final File pFile , IConfigurationPath [ ] pPaths ) throws TTIOException { boolean returnVal = true ; pFile . mkdirs ( ) ; for ( IConfigurationPath paths : pPaths ) { final File toCreate = new File ( pFile , paths . getFile ( ) . getName ( ) ) ; if ( paths . isFolder ( ) ) {...
Creating a folder structure based on a set of paths given as parameter and returning a boolean determining the success .
23,182
public static int compareStructure ( final File pFile , IConfigurationPath [ ] pPaths ) { int existing = 0 ; for ( final IConfigurationPath path : pPaths ) { final File currentFile = new File ( pFile , path . getFile ( ) . getName ( ) ) ; if ( currentFile . exists ( ) ) { existing ++ ; } } return existing - pPaths . le...
Checking a structure in a folder to be equal with the data in this enum .
23,183
public static synchronized void invokeFullDiff ( final Builder paramBuilder ) throws TTException { checkParams ( paramBuilder ) ; DiffKind . FULL . invoke ( paramBuilder ) ; }
Do a full diff .
23,184
public static synchronized void invokeStructuralDiff ( final Builder paramBuilder ) throws TTException { checkParams ( paramBuilder ) ; DiffKind . STRUCTURAL . invoke ( paramBuilder ) ; }
Do a structural diff .
23,185
private static void checkParams ( final Builder paramBuilder ) { checkState ( paramBuilder . mSession != null && paramBuilder . mKey >= 0 && paramBuilder . mNewRev >= 0 && paramBuilder . mOldRev >= 0 && paramBuilder . mObservers != null && paramBuilder . mKind != null , "No valid arguments specified!" ) ; checkState ( ...
Check parameters for validity and assign global static variables .
23,186
public boolean equalsAllBut ( DirRecord that , String [ ] attrIDs ) throws NamingException { if ( attrIDs == null ) throw new NamingException ( "DirectoryRecord: null attrID list" ) ; if ( ! dnEquals ( that ) ) { return false ; } int n = attrIDs . length ; if ( n == 0 ) return true ; Attributes thisAttrs = getAttribute...
This compares all but the named attributes allbut true = > All must be equal except those on the list
23,187
public boolean dnEquals ( DirRecord that ) throws NamingException { if ( that == null ) { throw new NamingException ( "Null record for dnEquals" ) ; } String thisDn = getDn ( ) ; if ( thisDn == null ) { throw new NamingException ( "No dn for this record" ) ; } String thatDn = that . getDn ( ) ; if ( thatDn == null ) { ...
Check dns for equality
23,188
public void addAttr ( String attr , Object val ) throws NamingException { Attribute a = findAttr ( attr ) ; if ( a == null ) { setAttr ( attr , val ) ; } else { a . add ( val ) ; } }
Add the attribute value to the table . If an attribute already exists add it to the end of its values .
23,189
public boolean contains ( Attribute attr ) throws NamingException { if ( attr == null ) { return false ; } Attribute recAttr = getAttributes ( ) . get ( attr . getID ( ) ) ; if ( recAttr == null ) { return false ; } NamingEnumeration ne = attr . getAll ( ) ; while ( ne . hasMore ( ) ) { if ( ! recAttr . contains ( ne ....
Return true if the record contains all of the values of the given attribute .
23,190
public NamingEnumeration attrElements ( String attr ) throws NamingException { Attribute a = findAttr ( attr ) ; if ( a == null ) { return null ; } return a . getAll ( ) ; }
Retrieve an enumeration of the named attribute s values . The behaviour of this enumeration is unspecified if the the attribute s values are added changed or removed while the enumeration is in progress . If the attribute values are ordered the enumeration s items will be ordered .
23,191
private void emitEndTag ( ) throws TTIOException { final long nodeKey = mRtx . getNode ( ) . getDataKey ( ) ; mEvent = mFac . createEndElement ( mRtx . getQNameOfCurrentNode ( ) , new NamespaceIterator ( mRtx ) ) ; mRtx . moveTo ( nodeKey ) ; }
Emit end tag .
23,192
private void emitNode ( ) throws TTIOException { switch ( mRtx . getNode ( ) . getKind ( ) ) { case ROOT : mEvent = mFac . createStartDocument ( ) ; break ; case ELEMENT : final long key = mRtx . getNode ( ) . getDataKey ( ) ; final QName qName = mRtx . getQNameOfCurrentNode ( ) ; mEvent = mFac . createStartElement ( q...
Emit a node .
23,193
private void emit ( ) throws TTIOException { if ( mCloseElements ) { if ( ! mStack . empty ( ) && mStack . peek ( ) != ( ( ITreeStructData ) mRtx . getNode ( ) ) . getLeftSiblingKey ( ) ) { mRtx . moveTo ( mStack . pop ( ) ) ; emitEndTag ( ) ; mRtx . moveTo ( mKey ) ; } else if ( ! mStack . empty ( ) ) { mRtx . moveTo ...
Move to node and emit it .
23,194
private boolean isBooleanFalse ( ) { if ( getNode ( ) . getDataKey ( ) >= 0 ) { return false ; } else { if ( getNode ( ) . getTypeKey ( ) == NamePageHash . generateHashForString ( "xs:boolean" ) ) { return ! ( Boolean . parseBoolean ( new String ( ( ( ITreeValData ) getNode ( ) ) . getRawValue ( ) ) ) ) ; } else { retu...
Tests whether current Item is an atomic value with boolean value false .
23,195
private String expandString ( ) { final FastStringBuffer fsb = new FastStringBuffer ( FastStringBuffer . SMALL ) ; try { final INodeReadTrx rtx = createRtxAndMove ( ) ; final FilterAxis axis = new FilterAxis ( new DescendantAxis ( rtx ) , rtx , new TextFilter ( rtx ) ) ; while ( axis . hasNext ( ) ) { if ( rtx . getNod...
Filter text nodes .
23,196
public int getTypeAnnotation ( ) { int type = 0 ; if ( nodeKind == ATTRIBUTE ) { type = StandardNames . XS_UNTYPED_ATOMIC ; } else { type = StandardNames . XS_UNTYPED ; } return type ; }
Get the type annotation .
23,197
public boolean walk ( OutputHandler outputHandler ) throws IOException { try ( ZipFile zipFile = new ZipFile ( zip ) ) { Enumeration < ? extends ZipEntry > entries = zipFile . entries ( ) ; while ( entries . hasMoreElements ( ) ) { ZipEntry entry = entries . nextElement ( ) ; File file = new File ( zip , entry . getNam...
Run the ZipFileWalker using the given OutputHandler
23,198
public void updateConfigInfo ( final HttpServletRequest request , final XSLTConfig xcfg ) throws ServletException { PresentationState ps = getPresentationState ( request ) ; if ( ps == null ) { return ; } if ( xcfg . nextCfg == null ) { xcfg . nextCfg = new XSLTFilterConfigInfo ( ) ; } else { xcfg . cfg . updateFrom ( ...
This method can be overridden to allow a subclass to set up ready for a transformation .
23,199
protected PresentationState getPresentationState ( HttpServletRequest request ) { String attrName = getPresentationAttrName ( ) ; if ( ( attrName == null ) || ( attrName . equals ( "NONE" ) ) ) { return null ; } Object o = request . getAttribute ( attrName ) ; if ( o == null ) { HttpSession sess = request . getSession ...
Obtain the presentation state from the session . Override if you want different behaviour .