idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
29,600
protected String normalize ( CharSequence sequence ) { if ( isCaseSensitive ( ) ) { return sequence . toString ( ) ; } return sequence . toString ( ) . toLowerCase ( ) ; }
Normalize string .
29,601
public static int inconsistentCompare ( MimeType o1 , MimeType o2 ) { if ( ( o1 == null ) && ( o2 == null ) ) { return 0 ; } if ( o1 == null ) { return 1 ; } if ( o2 == null ) { return - 1 ; } int wilchCharComparison = compareByWildCardCount ( o1 , o2 ) ; if ( wilchCharComparison == 0 ) { float q1 = getQ ( o1 ) ; float q2 = getQ ( o2 ) ; if ( q1 == q2 ) { return fallBackCompare ( o1 , o2 ) ; } if ( q1 > q2 ) { return - 1 ; } else { return 1 ; } } else { return wilchCharComparison ; } }
this is not consistent with equals
29,602
public static double computeEuclidean ( DoubleTuple t0 , DoubleTuple t1 ) { return Math . sqrt ( computeEuclideanSquared ( t0 , t1 ) ) ; }
Computes the Euclidean distance between the given tuples
29,603
private static double computeCosineSimilarity ( DoubleTuple t0 , DoubleTuple t1 ) { Utils . checkForEqualSize ( t0 , t1 ) ; double dot = DoubleTuples . dot ( t0 , t1 ) ; final double epsilon = 1e-10 ; if ( Math . abs ( dot ) < epsilon ) { return 0 ; } double tt0 = DoubleTuples . computeL2 ( t0 ) ; double tt1 = DoubleTuples . computeL2 ( t1 ) ; double tt = tt0 * tt1 ; double result = clamp ( dot / tt , - 1.0 , 1.0 ) ; return result ; }
Computes the cosine similarity between the given tuples
29,604
static double computeAngularSimilarity ( DoubleTuple t0 , DoubleTuple t1 ) { return 1 - Math . acos ( computeCosineSimilarity ( t0 , t1 ) ) / Math . PI ; }
Computes the angular similarity between the given tuples
29,605
public Integer getKeySize ( ) { if ( keySize == null ) { switch ( algorithm ) { case DES : keySize = DEFAULT_DES_KEY_SIZE ; break ; default : keySize = DEFAULT_AES_KEY_SIZE ; break ; } } return keySize ; }
Get the keysize . If no key size specified this will return the default key size .
29,606
public void addMappings ( Mappings other ) { mappings . getKeywords ( ) . addAll ( other . getKeywords ( ) ) ; mappings . getClasses ( ) . addAll ( other . getClasses ( ) ) ; mappings . getNamespaces ( ) . addAll ( other . getNamespaces ( ) ) ; }
Add a mappings configuration bean to the actual context .
29,607
public static < T > Class < T > forceInit ( Class < T > c ) { try { Class . forName ( c . getName ( ) , true , c . getClassLoader ( ) ) ; } catch ( ClassNotFoundException cause ) { throw new AssertionError ( cause ) ; } return c ; }
Forces that the specified class is initialized .
29,608
public static Process openUri ( final String uri ) { if ( SystemUtils . IS_OS_MAC_OSX ) { return openSiteMac ( uri ) ; } else if ( SystemUtils . IS_OS_WINDOWS ) { return openSiteWindows ( uri ) ; } return null ; }
Opens the specified URI using the native file system . Currently only HTTP URIs are officially supported .
29,609
public static void addTray ( final Image image , final String name , final PopupMenu popup ) { final Class [ ] trayIconArgTypes = new Class [ ] { java . awt . Image . class , java . lang . String . class , java . awt . PopupMenu . class } ; try { final Class trayIconClass = Class . forName ( "java.awt.TrayIcon" ) ; final Constructor trayIconConstructor = trayIconClass . getConstructor ( trayIconArgTypes ) ; final Object trayIcon = trayIconConstructor . newInstance ( image , name , popup ) ; final Class trayClass = Class . forName ( "java.awt.SystemTray" ) ; final Object obj = trayClass . getDeclaredMethod ( "getSystemTray" ) . invoke ( null ) ; final Class [ ] trayAddArgTypes = new Class [ ] { trayIconClass } ; trayClass . getDeclaredMethod ( "add" , trayAddArgTypes ) . invoke ( obj , trayIcon ) ; } catch ( final Exception e ) { LOG . warn ( "Reflection error" , e ) ; } }
Adds a tray icon using reflection . This succeeds if the underlying JVM is 1 . 6 and supports the system tray failing otherwise .
29,610
public static boolean supportsTray ( ) { try { final Class trayClass = Class . forName ( "java.awt.SystemTray" ) ; final Boolean bool = ( Boolean ) trayClass . getDeclaredMethod ( "isSupported" ) . invoke ( null ) ; return bool . booleanValue ( ) ; } catch ( final Exception e ) { LOG . warn ( "Reflection error" , e ) ; return false ; } }
Uses reflection to determine whether or not this operating system and java version supports the system tray .
29,611
public boolean isEmpty ( ) throws IOException { Closer closer = Closer . create ( ) ; try { InputStream in = closer . register ( openStream ( ) ) ; return in . read ( ) == - 1 ; } catch ( Throwable e ) { throw closer . rethrow ( e ) ; } finally { closer . close ( ) ; } }
Returns whether the source has zero bytes . The default implementation is to open a stream and check for EOF .
29,612
private long countBySkipping ( InputStream in ) throws IOException { long count = 0 ; while ( true ) { long skipped = in . skip ( Math . min ( in . available ( ) , Integer . MAX_VALUE ) ) ; if ( skipped <= 0 ) { if ( in . read ( ) == - 1 ) { return count ; } else if ( count == 0 && in . available ( ) == 0 ) { throw new IOException ( ) ; } count ++ ; } else { count += skipped ; } } }
Counts the bytes in the given input stream using skip if possible . Returns SKIP_FAILED if the first call to skip threw in which case skip may just not be supported .
29,613
public void in ( Object key , Object value , Integer type ) throws SQLException { if ( key instanceof Integer ) { if ( type == null ) { base . setObject ( ( Integer ) key , value ) ; } else { base . setObject ( ( Integer ) key , value , type ) ; } } else { if ( type == null ) { base . setObject ( ( String ) key , value ) ; } else { base . setObject ( ( String ) key , value , type ) ; } } }
Registers an input parameter into the statement .
29,614
public void out ( Object key , int type , String struct ) throws SQLException { if ( key instanceof Integer ) { if ( struct == null ) { base . registerOutParameter ( ( Integer ) key , type ) ; } else { base . registerOutParameter ( ( Integer ) key , type , struct ) ; } } else { if ( struct == null ) { base . registerOutParameter ( ( String ) key , type ) ; } else { base . registerOutParameter ( ( String ) key , type , struct ) ; } } }
Registers an output parameter into the statement .
29,615
public Object read ( Object key ) throws SQLException { if ( key instanceof Integer ) { return base . getObject ( ( Integer ) key ) ; } else { return base . getObject ( ( String ) key ) ; } }
Reads an output parameter value from the statement .
29,616
public int getCount ( ) { if ( metadata != null && metadata . get ( "count" ) != null ) { return Integer . parseInt ( metadata . get ( "count" ) ) ; } if ( entities == null && entity != null ) { return 1 ; } return 0 ; }
Count ithe number of record returned
29,617
public void setClassDefinition ( String name , byte [ ] def ) { classDefs . put ( name , ByteBuffer . wrap ( def ) ) ; }
Sets the definition of a class .
29,618
private SimpleJob addBigJoinJob ( SimpleJob job ) throws IOException { Configuration conf = job . getConfiguration ( ) ; String [ ] labels = conf . getStrings ( SimpleJob . LABELS ) ; String separator = conf . get ( SimpleJob . SEPARATOR ) ; boolean regex = conf . getBoolean ( SimpleJob . SEPARATOR_REGEX , false ) ; boolean formatIgnored = conf . getBoolean ( SimpleJob . FORMAT_IGNORED , false ) ; SimpleJob joinJob = new SimpleJob ( conf , jobName , true ) ; setConfiguration ( joinJob , labels , separator , formatIgnored , regex ) ; int type = conf . getInt ( SimpleJob . READER_TYPE , - 1 ) ; Configuration joinConf = joinJob . getConfiguration ( ) ; joinConf . setInt ( SimpleJob . READER_TYPE , type ) ; joinConf . setStrings ( SimpleJob . MASTER_LABELS , conf . getStrings ( SimpleJob . MASTER_LABELS ) ) ; if ( type == SimpleJob . SINGLE_COLUMN_JOIN_READER ) { joinConf . set ( SimpleJob . JOIN_MASTER_COLUMN , conf . get ( SimpleJob . JOIN_MASTER_COLUMN ) ) ; joinConf . set ( SimpleJob . JOIN_DATA_COLUMN , conf . get ( SimpleJob . JOIN_DATA_COLUMN ) ) ; } else if ( type == SimpleJob . SOME_COLUMN_JOIN_READER ) { joinConf . setStrings ( SimpleJob . JOIN_MASTER_COLUMN , conf . getStrings ( SimpleJob . JOIN_MASTER_COLUMN ) ) ; joinConf . setStrings ( SimpleJob . JOIN_DATA_COLUMN , conf . getStrings ( SimpleJob . JOIN_DATA_COLUMN ) ) ; } joinConf . set ( SimpleJob . MASTER_PATH , conf . get ( SimpleJob . MASTER_PATH ) ) ; joinConf . set ( SimpleJob . MASTER_SEPARATOR , conf . get ( SimpleJob . MASTER_SEPARATOR ) ) ; joinJob . setMapOutputKeyClass ( Key . class ) ; joinJob . setMapOutputValueClass ( Value . class ) ; joinJob . setPartitionerClass ( SimplePartitioner . class ) ; joinJob . setGroupingComparatorClass ( SimpleGroupingComparator . class ) ; joinJob . setSortComparatorClass ( SimpleSortComparator . class ) ; joinJob . setSummarizer ( JoinSummarizer . class ) ; if ( ! job . isMapper ( ) && ! job . isReducer ( ) ) { joinConf . setBoolean ( SimpleJob . ONLY_JOIN , true ) ; joinJob . setOutputKeyClass ( Value . class ) ; joinJob . setOutputValueClass ( NullWritable . class ) ; } else { joinJob . setOutputKeyClass ( Key . class ) ; joinJob . setOutputValueClass ( Value . class ) ; } return joinJob ; }
create big join SimpleJob
29,619
public void parseAndInject ( String [ ] args , T injectee ) throws InvalidCommandException { this . injectee = injectee ; pendingInjections . clear ( ) ; Iterator < String > argsIter = Iterators . forArray ( args ) ; ImmutableList . Builder < String > builder = ImmutableList . builder ( ) ; while ( argsIter . hasNext ( ) ) { String arg = argsIter . next ( ) ; if ( arg . equals ( "--" ) ) { break ; } else if ( arg . startsWith ( "--" ) ) { parseLongOption ( arg , argsIter ) ; } else if ( arg . startsWith ( "-" ) ) { parseShortOptions ( arg , argsIter ) ; } else { builder . add ( arg ) ; } } for ( PendingInjection pi : pendingInjections ) { pi . injectableOption . inject ( pi . value , injectee ) ; } ImmutableList < String > leftovers = builder . addAll ( argsIter ) . build ( ) ; invokeMethod ( injectee , injectionMap . leftoversMethod , leftovers ) ; }
Parses the command - line arguments args setting the
29,620
public static Sprite circle ( int diameter , int color , int lineWidth ) { int [ ] pix = new int [ diameter * diameter ] ; for ( int i = 0 ; i < lineWidth ; i ++ ) { drawCircle ( pix , diameter - i , diameter , color ) ; } return new Sprite ( diameter , diameter , pix ) ; }
Creates a new Sprite with a cicle drawn onto it
29,621
public static Sprite scale ( Sprite original , float scale , ScalingMethod method ) { if ( scale == 1.0f ) return original . copy ( ) ; switch ( method ) { case NEAREST : return scaleNearest ( original , scale ) ; case BILINEAR : return scaleBilinear ( original , scale ) ; } return null ; }
Scales an image by a factor using the given method
29,622
@ SuppressWarnings ( "PMD.PreserveStackTrace" ) public static void checkService ( final Context context , final ComponentName service ) { final PackageManager packageManager = context . getPackageManager ( ) ; try { packageManager . getServiceInfo ( service , 0 ) ; } catch ( PackageManager . NameNotFoundException e ) { throw new IllegalStateException ( "Service " + service . getClassName ( ) + " hasn't been declared in AndroidManifest.xml" ) ; } }
Checks is a service has been described in the AndroidManifest . xml file .
29,623
public static boolean hasMetadata ( final Context context , final String metadataKey ) { if ( TextUtils . isEmpty ( metadataKey ) ) { throw new IllegalArgumentException ( "Meta data key can't be null or empty." ) ; } try { final PackageInfo info = context . getPackageManager ( ) . getPackageInfo ( context . getPackageName ( ) , PackageManager . GET_META_DATA ) ; final Bundle metaData = info . applicationInfo . metaData ; if ( metaData != null && metaData . get ( metadataKey ) != null ) { return true ; } } catch ( PackageManager . NameNotFoundException e ) { } return false ; }
Checks if metadata is added in AndroidManifest . xml file .
29,624
protected static ArrayList getSoilLayer ( HashMap data ) { if ( data . containsKey ( "soil" ) || ! data . containsKey ( "soilLayer" ) ) { return MapUtil . getBucket ( data , "soil" ) . getDataList ( ) ; } else { return new BucketEntry ( data ) . getDataList ( ) ; } }
Get soil layer data array from data holder .
29,625
public static void copyBufferedStream ( BufferedInputStream sourceStream , BufferedOutputStream destinationStream , boolean closeStreams ) throws IOException { byte [ ] buffer = new byte [ 8192 ] ; int bytesRead = 0 ; try { while ( ( bytesRead = sourceStream . read ( buffer ) ) != - 1 ) { destinationStream . write ( buffer , 0 , bytesRead ) ; } } finally { if ( closeStreams ) { sourceStream . close ( ) ; destinationStream . close ( ) ; } } }
Kopiert den Inhalt eines Datenstroms in einen anderen .
29,626
public static byte [ ] getBytes ( InputStream sourceStream , boolean closeStream ) throws IOException { ByteArrayOutputStream destinationStream = new ByteArrayOutputStream ( ) ; Streams . copyStream ( sourceStream , destinationStream , closeStream ) ; return destinationStream . toByteArray ( ) ; }
Kopiert den Inhalt eines Datenstroms in ein ByteArray .
29,627
public void setCtx ( ApplicationContext _ctx ) { if ( LambdaSpringUtil . ctx == null ) { LambdaSpringUtil . ctx = _ctx ; } }
Sets application context
29,628
public static void wireInSpring ( Object o , String myBeanName ) { if ( ctx == null ) { synchronized ( lck ) { if ( ctx == null ) { LOG . info ( "LamdaSpringUtil CTX is null - initialising spring" ) ; ctx = new ClassPathXmlApplicationContext ( globalRootContextPath ) ; } } } else { LOG . debug ( "LamdaSpringUtil CTX is not null - not initialising spring" ) ; } AutowireCapableBeanFactory factory = ctx . getAutowireCapableBeanFactory ( ) ; factory . autowireBean ( o ) ; factory . initializeBean ( 0 , myBeanName ) ; }
wires spring into the passed in bean
29,629
public static final String join ( CharSequence delimiter , CharSequence ... strs ) { return StringUtils . join ( strs , delimiter . toString ( ) ) ; }
not deprecated because this allows vargs
29,630
private void exploreClass ( Class < ? > clazzToAdd ) throws IntrospectionException { List < InnerPropertyDescriptor > classList = getProperties ( clazzToAdd ) ; for ( InnerPropertyDescriptor descriptor : classList ) { map . put ( descriptor . getName ( ) , descriptor ) ; } this . list . addAll ( classList ) ; Class < ? > superClazz = clazzToAdd . getSuperclass ( ) ; if ( superClazz != null ) { exploreClass ( superClazz ) ; } }
Add the proerties of this class and the parent class
29,631
public void writeBean ( ThirdPartyParseable bean , OutputStream os ) { writeBean ( bean , new EndianAwareDataOutputStream ( new DataOutputStream ( os ) ) ) ; }
Write ThirdPartyParseable bean to the given OutputStream .
29,632
public void writeBean ( ThirdPartyParseable bean , EndianAwareDataOutputStream os ) { if ( bean == null ) throw new NullPointerException ( ) ; ensureContextInstantiatedForWriting ( os , bean ) ; try { bean . describeFormat ( this ) ; } catch ( UnrecognizedFormatException e ) { e . printStackTrace ( ) ; } popBean ( ) ; }
Write ThirdPartyParseable bean to the given EndianAwareDataOutputStream .
29,633
public void bytesOfCount ( final int count , @ SuppressWarnings ( "rawtypes" ) final PropertyDestination dest ) { new RWHelper ( ) { @ SuppressWarnings ( "unchecked" ) public void read ( EndianAwareDataInputStream is , ThirdPartyParseable bean ) throws IOException { byte [ ] data = new byte [ count ] ; if ( count > 1 ) { is . readFully ( data ) ; dest . set ( data , bean ) ; } else if ( count == 1 ) { is . readFully ( data ) ; dest . set ( data [ 0 ] , bean ) ; } } public void write ( EndianAwareDataOutputStream os , ThirdPartyParseable bean ) throws IOException { Object obj = dest . get ( bean ) ; if ( obj instanceof byte [ ] ) { os . write ( ( byte [ ] ) obj ) ; } else { os . write ( new byte [ ] { ( Byte ) obj } ) ; } } } . go ( ) ; }
Informs the Parser that the current position in the description contains a block of raw bytes of given length which should be mapped to this bean s property .
29,634
protected Object doExec ( Element element , Object scope , String propertyPath , Object ... arguments ) throws IOException , TemplateException { if ( ! propertyPath . equals ( "." ) && ConverterRegistry . hasType ( scope . getClass ( ) ) ) { throw new TemplateException ( "Operand is property path but scope is not an object." ) ; } if ( element . hasChildren ( ) ) { throw new TemplateException ( "Illegal TEXT operator on element with children." ) ; } Format format = ( Format ) arguments [ 0 ] ; String text = content . getString ( scope , propertyPath , format ) ; if ( text != null ) { serializer . writeTextContent ( text ) ; } return null ; }
Execute TEXT operator . Uses property path to extract content value convert it to string and set element text content . Note that this operator operates on element without children . Failing to obey this constraint rise templates exception ; anyway validation tool catches this condition .
29,635
public Object format ( Object value ) { if ( value == null ) { return nullStringValue ; } if ( value . getClass ( ) . isArray ( ) ) { return asList ( value ) ; } else if ( value instanceof Date ) { Date date = ( Date ) value ; if ( date . getTime ( ) % ONE_DAY_IN_MILLIS == 0 ) { return new SimpleDateFormat ( datePattern ) . format ( date ) ; } else { return new SimpleDateFormat ( dateTimePattern ) . format ( date ) ; } } else if ( value instanceof CompositeData ) { return toMap ( ( CompositeData ) value ) ; } else if ( value instanceof Element ) { return parseXmlElement ( ( Element ) value ) ; } return value ; }
Returns a formatted representation for the value .
29,636
private String parseXmlElement ( Element element ) { if ( element . getFirstChild ( ) instanceof Text ) { Text text = ( Text ) element . getFirstChild ( ) ; return text . getData ( ) ; } return toXml ( element ) ; }
Returns the XML Element as a String .
29,637
private String toXml ( Node node ) { try { Transformer transformer = TransformerFactory . newInstance ( ) . newTransformer ( ) ; StreamResult result = new StreamResult ( new StringWriter ( ) ) ; DOMSource source = new DOMSource ( node ) ; transformer . transform ( source , result ) ; return result . getWriter ( ) . toString ( ) ; } catch ( TransformerException ex ) { throw new IllegalArgumentException ( "Could not transform " + node + " to XML" , ex ) ; } }
Returns the XML node as String of XML .
29,638
private Object asList ( Object value ) { Class < ? > componentClass = value . getClass ( ) . getComponentType ( ) ; if ( componentClass . isPrimitive ( ) ) { if ( componentClass . equals ( int . class ) ) { return asIntList ( value ) ; } else if ( componentClass . equals ( long . class ) ) { return asLongList ( value ) ; } else if ( componentClass . equals ( boolean . class ) ) { return asBooleanList ( value ) ; } else if ( componentClass . equals ( short . class ) ) { return asShortList ( value ) ; } else if ( componentClass . equals ( byte . class ) ) { return asByteList ( value ) ; } else { return asCharList ( value ) ; } } else { return asList ( value , componentClass ) ; } }
Returns the array value as a List .
29,639
private List < Integer > asIntList ( Object value ) { int [ ] values = ( int [ ] ) value ; List < Integer > list = new ArrayList < Integer > ( values . length ) ; for ( int integer : values ) { list . add ( integer ) ; } return list ; }
Returns value as an Integer List .
29,640
private List < Long > asLongList ( Object value ) { long [ ] values = ( long [ ] ) value ; List < Long > list = new ArrayList < Long > ( values . length ) ; for ( long longValue : values ) { list . add ( longValue ) ; } return list ; }
Returns value as a Long List .
29,641
private List < Short > asShortList ( Object value ) { short [ ] values = ( short [ ] ) value ; List < Short > list = new ArrayList < Short > ( values . length ) ; for ( short shortValue : values ) { list . add ( shortValue ) ; } return list ; }
Returns value as a Short List .
29,642
private List < Byte > asByteList ( Object value ) { byte [ ] values = ( byte [ ] ) value ; List < Byte > list = new ArrayList < Byte > ( values . length ) ; for ( byte byteValue : values ) { list . add ( byteValue ) ; } return list ; }
Returns value as a Byte List .
29,643
private List < Character > asCharList ( Object value ) { char [ ] values = ( char [ ] ) value ; List < Character > list = new ArrayList < Character > ( values . length ) ; for ( char charValue : values ) { list . add ( charValue ) ; } return list ; }
Returns value as a Character List .
29,644
private List < Boolean > asBooleanList ( Object value ) { boolean [ ] values = ( boolean [ ] ) value ; List < Boolean > list = new ArrayList < Boolean > ( values . length ) ; for ( boolean booleanValue : values ) { list . add ( booleanValue ) ; } return list ; }
Returns value as a Boolean List .
29,645
private < T > List < T > asList ( Object value , Class < T > ofClass ) { @ SuppressWarnings ( "unchecked" ) T [ ] values = ( T [ ] ) value ; return Arrays . asList ( values ) ; }
Returns value as a T List .
29,646
@ SuppressWarnings ( "PMD.UnusedPrivateMethod" ) private static void log ( final int level , final String messageFormat , final Object ... args ) { if ( shouldLog ( level ) ) { Log . println ( level , TAG , String . format ( messageFormat , args ) ) ; } }
Seems like PMD bug
29,647
public static void logMethod ( final Object ... args ) { if ( shouldLog ( DEBUG ) ) { Log . println ( DEBUG , TAG , getMethodLog ( args ) ) ; } }
Logs a class and a method names .
29,648
public IValidator appendError ( IValidator validator ) { if ( validator == null ) return this ; if ( ! ( validator instanceof WebValidator ) ) { throw new IllegalArgumentException ( "Must WebValidator." ) ; } WebValidator valid = ( WebValidator ) validator ; if ( valid . isSuccess ( ) ) return this ; if ( this . success ) { this . msg = valid . msg ; this . success = valid . success ; } else { msg . append ( "<br>" ) . append ( valid . getMsg ( ) ) ; } return this ; }
Only append Error . Not append validator if success .
29,649
public SearchCriteria setOrders ( final List < ? extends Order > orders ) { if ( orders == getOrders ( ) ) { return this ; } if ( orders == null || orders . size ( ) == 0 ) { clearOrders ( ) ; return this ; } synchronized ( orders ) { for ( Order order : orders ) { if ( order == null ) { throw new IllegalArgumentException ( "null element" ) ; } } clearOrders ( ) ; for ( Order order : orders ) { addOrder ( order ) ; } } return this ; }
Sets the specified ordering criteria to sort the result objects .
29,650
public SearchCriteria addOrder ( final Order order ) { if ( order == null ) { throw new IllegalArgumentException ( "no order specified" ) ; } _orders . add ( order ) ; return this ; }
Appends the specified ordering criterion .
29,651
public SearchCriteria setProjections ( final List < ? extends Projection > projections ) { if ( projections == null || projections . size ( ) == 0 ) { clearProjections ( ) ; return this ; } synchronized ( projections ) { for ( Projection proj : projections ) { if ( proj == null ) { throw new IllegalArgumentException ( "null element" ) ; } } clearProjections ( ) ; for ( Projection proj : projections ) { addProjection ( proj ) ; } } return this ; }
Sets the specified projection to restrict the result values .
29,652
public SearchCriteria addProjection ( final Projection projection ) { if ( projection == null ) { throw new IllegalArgumentException ( "no projection specified" ) ; } _projections . add ( projection ) ; return this ; }
Appends the projection .
29,653
private static void resetJavaLibraryPath ( ) { synchronized ( Runtime . getRuntime ( ) ) { try { Field field = ClassLoader . class . getDeclaredField ( "usr_paths" ) ; field . setAccessible ( true ) ; field . set ( null , null ) ; field = ClassLoader . class . getDeclaredField ( "sys_paths" ) ; field . setAccessible ( true ) ; field . set ( null , null ) ; } catch ( NoSuchFieldException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } } }
Delete the cache of java . library . path . This will force the classloader to recheck the modified value the next time we load libraries .
29,654
protected final void setProperty ( Synset synset , PropertyName name , Property property ) { Cast . as ( synset , SynsetImpl . class ) . setProperty ( name , property ) ; }
Set property .
29,655
public static void emptyAndDelete ( File fileOrDir ) { if ( fileOrDir . isDirectory ( ) ) { File [ ] files = fileOrDir . listFiles ( ) ; for ( File file : files ) { emptyAndDelete ( file ) ; } } fileOrDir . delete ( ) ; }
Deletes a file or directory .
29,656
public static List < File > listFilesRecursively ( File dir ) { List < File > fileList = newArrayList ( ) ; addFilesRecursively ( dir , fileList ) ; return fileList ; }
Creates a List of all the files in a directory and it s subdirectories .
29,657
public static void addFilesRecursively ( File dir , Collection < File > fileCollection ) { log . debug ( "Adding files from {}" , dir . getPath ( ) ) ; File [ ] files = dir . listFiles ( ) ; for ( File file : files ) { if ( file . isDirectory ( ) ) addFilesRecursively ( file , fileCollection ) ; else { fileCollection . add ( file ) ; } } }
Adds all files in a directory and it s subdirectories to the supplied Collection .
29,658
public static String sha1 ( URL url ) { InputStream is = null ; try { is = url . openStream ( ) ; return sha1 ( is ) ; } catch ( IOException ioe ) { log . warn ( "Error occourred while reading from URL: " + url , ioe ) ; throw new RuntimeIOException ( ioe ) ; } finally { if ( is != null ) { try { is . close ( ) ; } catch ( IOException ioe ) { log . warn ( "Failed to close stream for URL: " + url , ioe ) ; throw new RuntimeIOException ( ioe ) ; } } } }
Calculates SHA1 for the contents referred to by the supplied URL .
29,659
public void unloadClass ( String className ) { if ( logger . isLoggable ( Level . FINEST ) ) { logger . finest ( "Unloading class " + className ) ; } if ( classes . containsKey ( className ) ) { if ( logger . isLoggable ( Level . FINEST ) ) { logger . finest ( "Removing loaded class " + className ) ; } classes . remove ( className ) ; try { classpathResources . unload ( formatClassName ( className ) ) ; } catch ( ResourceNotFoundException e ) { throw new JclException ( "Something is very wrong!!!" + "The locally loaded classes must be in synch with ClasspathResources" , e ) ; } } else { try { classpathResources . unload ( formatClassName ( className ) ) ; } catch ( ResourceNotFoundException e ) { throw new JclException ( "Class could not be unloaded " + "[Possible reason: Class belongs to the system]" , e ) ; } } }
Attempts to unload class it only unloads the locally loaded classes by JCL
29,660
public void setDAO ( final Collection < ? extends DAO < ? , ? > > dao_list ) { if ( dao_list == null ) { return ; } for ( DAO < ? , ? > dao : dao_list ) { if ( dao == null ) { continue ; } Class < ? > entityClass = dao . getEntityClass ( ) ; _LOG_ . debug ( "adding DAO: " + entityClass ) ; _daoMap . put ( entityClass , dao ) ; if ( dao instanceof BaseDAO ) { BaseDAO . class . cast ( dao ) . setDAORegistry ( this ) ; } } }
DAO list injection point .
29,661
private synchronized void fireProgressUpdated ( TableRowProgressMonitor source ) { int row = monitors . indexOf ( source ) ; if ( row >= 0 ) { fireTableCellUpdated ( row , PROGRESS_COLUMN ) ; } }
Indicate that the progress for a particular monitor has been updated .
29,662
private synchronized void fireStatusUpdated ( TableRowProgressMonitor source ) { int row = monitors . indexOf ( source ) ; if ( row >= 0 ) { fireTableCellUpdated ( row , STATUS_COLUMN ) ; } }
Indicate that the status for a particular monitor has been updated .
29,663
@ SuppressWarnings ( "rawtypes" ) protected RESTBaseElementV1 < ? > getEntity ( final Object entity ) { if ( entity instanceof ProxyObject ) { final MethodHandler handler = ( ( ProxyObject ) entity ) . getHandler ( ) ; if ( handler instanceof RESTBaseEntityV1ProxyHandler ) { return ( ( RESTBaseEntityV1ProxyHandler ) handler ) . getEntity ( ) ; } } return ( RESTBaseElementV1 < ? > ) entity ; }
Get the non proxied version of a REST Entity .
29,664
public void register ( Object locator , IComponentFactory factory ) { if ( locator == null ) throw new NullPointerException ( "Locator cannot be null" ) ; if ( factory == null ) throw new NullPointerException ( "Factory cannot be null" ) ; _registrations . add ( new Registration ( locator , factory ) ) ; }
Registers a component using a factory method .
29,665
public DynamicMBean getMBeanFor ( Object object ) throws IllegalStateException { JmxBean jmxBean = AnnotationUtils . getAnnotation ( object . getClass ( ) , JmxBean . class ) ; if ( jmxBean == null ) { throw new IllegalArgumentException ( "Could not find annotation " + JmxBean . class + " on " + object . getClass ( ) ) ; } try { ClassIntrospector classIntrospector = new ClassIntrospectorImpl ( object . getClass ( ) ) ; DynamicMBeanImpl mbean = new DynamicMBeanImpl ( object ) ; mbean . setmBeanInfo ( getInfo ( object , classIntrospector ) ) ; Map < String , Method > getters = new HashMap < String , Method > ( ) ; Map < String , Method > setters = new HashMap < String , Method > ( ) ; resolveGettersAndSetters ( classIntrospector , getters , setters ) ; mbean . setGetters ( getters ) ; mbean . setSetters ( setters ) ; mbean . setOperations ( getOperationsMap ( classIntrospector ) ) ; return mbean ; } catch ( Exception e ) { throw new IllegalStateException ( "Could not create DynamicMBean for " + object , e ) ; } }
Returns a DynamicMBean generated for the supplied object
29,666
private MBeanInfo getInfo ( Object object , ClassIntrospector classIntrospector ) throws IntrospectionException { JmxBean jmxBean = AnnotationUtils . getAnnotation ( object . getClass ( ) , JmxBean . class ) ; MBeanInfo beanInfo = new MBeanInfo ( object . getClass ( ) . getName ( ) , jmxBean . description ( ) , getAttributes ( classIntrospector ) , getConstructors ( classIntrospector ) , getOperations ( classIntrospector ) , getNotifications ( object ) ) ; return beanInfo ; }
Create and return a MBeanInfo instance for the supplied object .
29,667
@ SuppressWarnings ( "unused" ) public static String convertDomToString ( Document doc ) throws CloudException , InternalException { try { if ( doc == null ) return null ; StringWriter stw = new StringWriter ( ) ; Transformer serializer = TransformerFactory . newInstance ( ) . newTransformer ( ) ; serializer . transform ( new DOMSource ( doc ) , new StreamResult ( stw ) ) ; if ( stw != null ) { return stw . toString ( ) ; } return null ; } catch ( TransformerConfigurationException e ) { throw new InternalException ( e ) ; } catch ( TransformerFactoryConfigurationError e ) { throw new InternalException ( e ) ; } catch ( TransformerException e ) { throw new InternalException ( e ) ; } }
Convert a xml document to string
29,668
protected Object doExec ( Element element , Object scope , String propertyPath , Object ... arguments ) throws TemplateException { if ( ! ( propertyPath . equals ( "." ) || isStrictObject ( scope ) ) ) { throw new TemplateException ( "OBJECT operator on element |%s| requires object scope but got value type |%s|." , element , scope . getClass ( ) ) ; } Object value = content . getObject ( scope , propertyPath ) ; if ( value == null ) { log . warn ( "Null scope for property |%s| on element |%s|." , propertyPath , element ) ; } else if ( ! ( propertyPath . equals ( "." ) || isStrictObject ( value ) ) ) { throw new TemplateException ( propertyPath , "Invalid content type. Expected strict object but got |%s|." , value . getClass ( ) ) ; } return value ; }
Execute object operator . This operator just returns the new object scope to be used by templates engine . Throws content exception if given property path does not designate an existing object . If requested object is null warn the event and return the null value . Templates engine consider returned null as fully processed branch signal .
29,669
private boolean bestStyle ( Node node , boolean bestStyle ) { if ( node instanceof ScalarNode ) { ScalarNode scalar = ( ScalarNode ) node ; if ( scalar . getStyle ( ) == null ) { return false ; } } return bestStyle ; }
Gets the best style for the supplied node .
29,670
public static < T > Supplier < T > newInstance ( Constructor < T > constructor , Object ... parameters ) { return new ConstructorNewInstanceSupplier < T > ( constructor , parameters ) ; }
Returns a supplier that always supplies new instance with given parameter types
29,671
public static < R > Supplier < R > call ( Object target , Method method , Object ... parameters ) { return new MethodSupplier < R > ( target , method , parameters ) ; }
Returns a supplier that always supplies the given method invoke result
29,672
protected PreprocessorList < Sequence > getPreprocessors ( ) { if ( minFeatureCount > 1 ) { return PreprocessorList . create ( new MinCountFilter ( minFeatureCount ) . asSequenceProcessor ( ) ) ; } return PreprocessorList . empty ( ) ; }
Gets preprocessors .
29,673
public MailSendResult send ( MailMessage message ) { Assert . notNull ( message , "Missing mail message!" ) ; Properties props = new Properties ( ) ; props . put ( "mail.transport.protocol" , "smtp" ) ; props . put ( "mail.smtp.host" , smtpHost ) ; props . put ( "mail.smtp.port" , smtpPort ) ; Session session = getSession ( props , smtpUsername , smtpPassword ) ; try { Message msg = message . getMessage ( session ) ; Enumeration enumer = msg . getAllHeaders ( ) ; while ( enumer . hasMoreElements ( ) ) { Header header = ( Header ) enumer . nextElement ( ) ; log . info ( header . getName ( ) + ": " + header . getValue ( ) ) ; } log . info ( "Getting transport..." ) ; Transport transport = session . getTransport ( "smtp" ) ; log . info ( "Connecting to SMTP server: " + smtpHost + ":" + smtpPort ) ; transport . connect ( ) ; transport . sendMessage ( msg , msg . getAllRecipients ( ) ) ; log . info ( "Closing transport..." ) ; transport . close ( ) ; } catch ( Exception e ) { log . error ( e . getMessage ( ) , e ) ; return MailSendResult . fail ( ) ; } return MailSendResult . ok ( ) ; }
Sends message out via SMTP
29,674
public T first ( ) { Iterator < T > iterator = iterator ( ) ; return ( iterator . hasNext ( ) ? iterator . next ( ) : null ) ; }
Returns the first item of this iterable .
29,675
public static boolean isRunnable ( Method method , String [ ] filters ) { RoxableTest mAnnotation = method . getAnnotation ( RoxableTest . class ) ; RoxableTestClass cAnnotation = method . getDeclaringClass ( ) . getAnnotation ( RoxableTestClass . class ) ; if ( mAnnotation != null || cAnnotation != null ) { return isRunnable ( new FilterTargetData ( method , mAnnotation , cAnnotation ) , filters ) ; } return true ; }
Define if a test is runnable or not based on a method
29,676
private String attemptDecryption ( String key , String property ) { try { if ( StringUtils . endsWithIgnoreCase ( key , ENCRYPTED_SUFFIX ) ) { if ( encryptionProvider == null ) throw new RuntimeCryptoException ( "No encryption provider configured" ) ; return encryptionProvider . decrypt ( property ) ; } else { return property ; } } catch ( MissingParameterException e ) { throw new RuntimeCryptoException ( "No value to encrypt specified" ) ; } }
Utility method which will determine if a requested property needs to be decrypted . If property key ends in - encrypted and the encryption provider is configured this method will return the decrypted property value . If the key does not include - encrypted then the property value will be returned .
29,677
private String attemptEncryption ( String key , String property ) { try { if ( StringUtils . endsWithIgnoreCase ( key , UNENCRYPTED_SUFFIX ) ) { if ( encryptionProvider == null ) throw new RuntimeCryptoException ( "No encryption provider configured" ) ; return encryptionProvider . encrypt ( property ) ; } else { return property ; } } catch ( MissingParameterException mpre ) { throw new RuntimeCryptoException ( "No value to decrypt specified." ) ; } }
Utility method which will determine if a requested property needs to be encrypted . If property key ends in - unencrypted and the encryption provider is configured this method will return the encrypted property value . If the key does not include - unencrypted then the property value will be returned .
29,678
private void initializeEncryptionProvider ( ) { if ( key != null ) { try { encryptionProvider = EncryptionProviderFactory . getProvider ( key ) ; } catch ( UnsupportedKeySizeException e ) { throw new RuntimeCryptoException ( e . getMessage ( ) , e ) ; } catch ( UnsupportedAlgorithmException e ) { throw new RuntimeCryptoException ( e . getMessage ( ) , e ) ; } } }
Method which will create a new Encryption provider using the already specified key .
29,679
private void loadKeystore ( ) { String keypath = this . getProperty ( KEY_PATH_PROPERTY_KEY ) ; String keyEntryName = this . getProperty ( ENTRY_NAME_PROPERTY_KEY ) ; String keyStorePassword = this . getProperty ( KEYSTORE_PASSWORD_PROPERTY_KEY ) ; loadKeystore ( keypath , keyStorePassword , keyEntryName ) ; }
Method will load the KeyStore from file using the key path entry name and keystore password from the properties file .
29,680
public void setElements ( final List < ? extends Binding > bindings ) { if ( bindings == null || bindings . size ( ) == 0 ) { clear ( ) ; return ; } for ( Binding binding : bindings ) { if ( binding == null ) { throw new IllegalArgumentException ( "null elemnt" ) ; } } clear ( ) ; for ( Binding binding : bindings ) { addElement ( binding ) ; } }
Sets the element bindings of this binding .
29,681
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) protected Enum getEnumParameter ( String name ) { return context . getConfiguration ( ) . getEnum ( name , null ) ; }
Get Job Enum parameter
29,682
public static void add ( Id id , Map < String , Object > data ) { DDSCluster . call ( new MessageBean ( MongoDBDDS . class , id . getDatabase ( ) , id . getCollection ( ) , id . getEntity ( ) , "add" , data ) ) ; }
Add record to collection
29,683
private Iterator < String > getIterator ( ) { final Set < String > copy = getPrefixes ( ) ; final Iterator < String > copyIt = copy . iterator ( ) ; return new Iterator < String > ( ) { private String lastOne = null ; public boolean hasNext ( ) { return copyIt . hasNext ( ) ; } public String next ( ) { if ( copyIt . hasNext ( ) ) { lastOne = copyIt . next ( ) ; } else { throw new NoSuchElementException ( ) ; } return lastOne ; } public void remove ( ) { try { lock . writeLock ( ) . lock ( ) ; prefixes . remove ( lastOne ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } } } ; }
Gets the iterator .
29,684
public void setPrefix ( final String prefixString ) { lock . writeLock ( ) . lock ( ) ; try { if ( prefixString == null || StringUtils . isBlank ( prefixString ) ) { localPrefix . remove ( ) ; } else { if ( prefixes != null ) { if ( ! prefixes . contains ( prefixString ) ) { throw new IllegalArgumentException ( "The given prefix is not part of the prefixes." ) ; } } localPrefix . set ( prefixString ) ; } } finally { lock . writeLock ( ) . unlock ( ) ; } }
Sets the prefix for the current thread .
29,685
protected void setPrefixes ( final Collection < String > prefixesToSet ) { if ( prefixesToSet == null ) { throw new IllegalArgumentException ( "The given prefixSet is not allowed to be null." ) ; } final Set < String > newPrefixes = new TreeSet < String > ( ) ; for ( final String prefixString : prefixesToSet ) { if ( StringUtils . isNotBlank ( prefixString ) ) { newPrefixes . add ( prefixString ) ; } } lock . writeLock ( ) . lock ( ) ; try { prefixes = newPrefixes ; if ( getPrefix ( ) != null && ! prefixes . contains ( getPrefix ( ) ) ) { defaultPrefix = null ; localPrefix . remove ( ) ; } } finally { lock . writeLock ( ) . unlock ( ) ; } }
Sets the prefixes .
29,686
@ SuppressWarnings ( "unchecked" ) public static < E > ImmutableMultiset < E > of ( E e1 , E e2 ) { return copyOfInternal ( e1 , e2 ) ; }
Returns an immutable multiset containing the given elements in order .
29,687
protected Map < PropertyKey , Object > properties ( ) { if ( properties == null ) { properties = new EnumMap < > ( PropertyKey . class ) ; } return properties ; }
Returns a map of properties .
29,688
public Map < Object , Object > getBootstrapProperties ( ResolverWrapper resolver ) { if ( resolver . bootstrap ( ) == null ) { return Collections . emptyMap ( ) ; } ConfigurationWrapper wrapper = WrapperFactory . wrap ( resolver . bootstrap ( ) ) ; if ( wrapper . sources ( ) == null || wrapper . sources ( ) . length == 0 ) { return Collections . emptyMap ( ) ; } CommonsConfigurationProducer instance = this . producer . get ( ) ; org . apache . commons . configuration . Configuration config = instance . getConfiguration ( wrapper ) ; ConfigurationMap map = new ConfigurationMap ( config ) ; return map ; }
Get the properties used to bootstrap the resolver
29,689
public Map < Object , Object > getDefaultProperties ( ResolverWrapper resolver ) { if ( resolver == null || resolver . properties ( ) == null || resolver . properties ( ) . length == 0 ) { return Collections . emptyMap ( ) ; } DefaultProperty [ ] properties = resolver . properties ( ) ; Map < Object , Object > propertyMap = new HashMap < > ( properties . length ) ; for ( DefaultProperty property : properties ) { if ( property . key ( ) == null || property . key ( ) . isEmpty ( ) || property . value ( ) == null ) { continue ; } if ( propertyMap . containsKey ( property . key ( ) ) ) { continue ; } propertyMap . put ( property . key ( ) , property . value ( ) ) ; } return propertyMap ; }
Get the properties that should be used as defaults when no other properties are found for that value
29,690
public static MonitorAndManagementSettings newInstance ( URL settingsXml ) throws IOException , JAXBException { InputStream istream = settingsXml . openStream ( ) ; JAXBContext ctx = JAXBContext . newInstance ( MonitorAndManagementSettings . class ) ; return ( MonitorAndManagementSettings ) ctx . createUnmarshaller ( ) . unmarshal ( istream ) ; }
Creates a new instance of MonitorAndManagementSettings from an URL to xml settings file .
29,691
public static MonitorAndManagementSettings newInstance ( String settingsXml ) throws JAXBException { InputStream istream = MonitorAndManagementSettings . class . getResourceAsStream ( settingsXml ) ; JAXBContext ctx = JAXBContext . newInstance ( MonitorAndManagementSettings . class ) ; return ( MonitorAndManagementSettings ) ctx . createUnmarshaller ( ) . unmarshal ( istream ) ; }
Creates a new instance of MonitorAndManagementSettings from a classpath resource xml settings file .
29,692
public static String urlFormDecode ( final String s ) { if ( StringUtils . isBlank ( s ) ) { LOG . warn ( "Could not encode blank string" ) ; throw new IllegalArgumentException ( "Blank string" ) ; } try { return URLDecoder . decode ( s , "UTF-8" ) ; } catch ( final UnsupportedEncodingException e ) { LOG . error ( "Could not encode: " + s , e ) ; return s ; } }
Returns a string that has been decoded .
29,693
public static Pair < String , String > pair ( final String s1 , final String s2 ) { if ( StringUtils . isBlank ( s1 ) ) { LOG . warn ( "Blank first arg" ) ; } if ( StringUtils . isBlank ( s2 ) ) { LOG . warn ( "Blank second arg for: " + s1 ) ; } return new PairImpl < String , String > ( s1 , s2 ) ; }
Returns a pair of strings created from two strings .
29,694
public static Pair < String , String > pair ( final String name , final boolean value ) { return pair ( name , String . valueOf ( value ) ) ; }
Returns a pair of strings created from a string name and a boolean value .
29,695
public static Pair < String , String > pair ( final String name , final URI value ) { return pair ( name , value . toASCIIString ( ) ) ; }
Returns a pair of strings created from a string name and a URI value .
29,696
public boolean execDelete ( Class < ? extends D6Model > modelObj ) { boolean retVal = false ; final D6CrudDeleteHelper dh = new D6CrudDeleteHelper ( modelObj ) ; final String updateSQL = dh . createDeleteAllPreparedSQLStatement ( ) ; log ( "#execDelete model=" + modelObj + " deleteSQL=" + updateSQL ) ; final Connection conn = createConnection ( ) ; try { PreparedStatement preparedStmt = null ; conn . setAutoCommit ( false ) ; preparedStmt = conn . prepareStatement ( updateSQL ) ; preparedStmt . executeUpdate ( ) ; conn . commit ( ) ; retVal = true ; } catch ( SQLException e ) { loge ( "#execDelete" , e ) ; retVal = false ; } finally { try { conn . close ( ) ; } catch ( SQLException e ) { retVal = false ; loge ( "#execDelete" , e ) ; } } return retVal ; }
Delete the appropriate line in the specified model object
29,697
public boolean execDelete ( D6Model [ ] modelObjs ) { if ( modelObjs == null || modelObjs . length == 0 ) { return false ; } boolean retVal = false ; final D6CrudDeleteHelper dh = new D6CrudDeleteHelper ( modelObjs [ 0 ] . getClass ( ) ) ; final String deleteSQL = dh . createDeletePreparedSQLStatement ( ) ; log ( "#execDelete modelObjs=" + modelObjs + " delete SQL=" + deleteSQL ) ; final Connection conn = createConnection ( ) ; try { PreparedStatement preparedStmt = null ; conn . setAutoCommit ( false ) ; preparedStmt = conn . prepareStatement ( deleteSQL ) ; for ( D6Model modelObj : modelObjs ) { dh . map ( modelObj , preparedStmt ) ; preparedStmt . executeUpdate ( ) ; } conn . commit ( ) ; retVal = true ; } catch ( SQLException e ) { loge ( "#execDelete" , e ) ; retVal = false ; } catch ( D6Exception e ) { loge ( "#execDelete" , e ) ; retVal = false ; } finally { try { conn . close ( ) ; } catch ( SQLException e ) { retVal = false ; loge ( "#execDelete" , e ) ; } } return retVal ; }
Delete the appropriate lines in specified model objects
29,698
public boolean execUpdate ( D6Model modelObj , D6Inex includeExcludeColumnNames ) { boolean retVal = false ; if ( modelObj == null ) { return retVal ; } final D6CrudUpdateHelper d6CrudUpdateHelper = new D6CrudUpdateHelper ( modelObj . getClass ( ) ) ; final String updateSQL = d6CrudUpdateHelper . createUpdatePreparedSQLStatement ( includeExcludeColumnNames ) ; log ( "#execUpdate updateSQL=" + updateSQL ) ; final Connection conn = createConnection ( ) ; try { PreparedStatement preparedStmt = null ; conn . setAutoCommit ( false ) ; preparedStmt = conn . prepareStatement ( updateSQL ) ; d6CrudUpdateHelper . map ( modelObj , preparedStmt , includeExcludeColumnNames ) ; preparedStmt . executeUpdate ( ) ; conn . commit ( ) ; retVal = true ; } catch ( SQLException e ) { loge ( "#execUpdate" , e ) ; retVal = false ; } catch ( D6Exception e ) { loge ( "#execUpdate" , e ) ; retVal = false ; } finally { try { conn . close ( ) ; } catch ( SQLException e ) { retVal = false ; loge ( "#execUpdate" , e ) ; } } return retVal ; }
Update Model Object
29,699
public boolean execUpdateByRawSQL ( String preparedSQL , Object [ ] preparedValues ) { boolean retVal = false ; final Connection conn = createConnection ( ) ; try { PreparedStatement preparedStmt = null ; conn . setAutoCommit ( false ) ; preparedStmt = conn . prepareStatement ( preparedSQL ) ; final StringBuilder logSb = new StringBuilder ( ) ; if ( preparedValues != null ) { logSb . append ( "/ " ) ; for ( int i = 0 ; i < preparedValues . length ; i ++ ) { setObject ( ( i + 1 ) , preparedStmt , preparedValues [ i ] ) ; logSb . append ( "key(" + ( i + 1 ) + ")=" + preparedValues [ i ] ) ; logSb . append ( " " ) ; } } log ( "#execUpdateWithRawSQL SQL=" + preparedSQL + " " + logSb . toString ( ) ) ; preparedStmt . executeUpdate ( ) ; conn . commit ( ) ; retVal = true ; } catch ( SQLException e ) { loge ( "#execUpdate" , e ) ; retVal = false ; } finally { try { conn . close ( ) ; } catch ( SQLException e ) { retVal = false ; loge ( "#execUpdate" , e ) ; } } return retVal ; }
Update by raw SQL