input
stringlengths
10
828
output
stringlengths
5
107
private boolean is locked dummy string path string if header return false
patched version of is locked original
protected string render size long size long left side size 1024 long right side size 1024 103 makes 1 digit if left side 0 right side 0 size 0 right side 1 return left side right side kb
render the specified file size in bytes
private ioexception copy range reader reader print writer writer copy the input stream to the output stream ioexception exception null char buffer new char input int len buffer length while true try len reader read buffer if len 1 break writer write buffer 0 len catch ioexception e exception e len 1 break return exception
copy the contents of the specified input stream to the specified
private string get isocreation date long creation date string builder creation date value new string builder creation date format format new date creation date int offset calendar get instance get time zone get raw offset 3600000 if offset 0 creation date value append offset offset else if offset 0 creation date value append if offset 0 if offset 10 creation date value append 0 creation date value append offset 00 else creation date value append z return creation date value to string
get creation date in iso format
public string to string string result type type n result scope scope n result depth depth n result owner owner n result expiration formats 0 format new date expires at n enumeration tokens list tokens elements while tokens list has more elements result token tokens list next element n return result
get a string representation of this lock token
public boolean has expired return system current time millis expires at
return true if the lock has expired
public boolean is exclusive return scope equals exclusive
return true if the lock is exclusive
public void to xml xmlwriter generated xml to xml generated xml true
get an xml representation of this lock token
public boolean exists return exists
test if the associated resource exists
protected void game started this end of game false this started true for p p this get player p game started
sets internal flags and informs all players that game is started
protected void game stopped this end of game true this started false for p p this get player p game stopped
sets internal flags and informs all players that game is stopped
public void log log record record this logger log record
logs the given
public void test bug3539 throws exception if version meets minimum 5 0 try this stmt execute update drop procedure if exists test bug3539 this stmt execute update create procedure test bug3539 n begin n select 1 end n this rs this conn get meta data get procedures null null test bug3539 assert true this rs next assert true test bug3539 equals this rs get string 3 finally this stmt execute update drop procedure if exists test bug3539
tests fix for bug 3539 get procedures does not return any procedures in
public void test bug9682 throws exception if version meets minimum 5 0 callable statement c stmt null try this stmt execute update drop procedure if exists test bug9682 this stmt execute update create procedure test bug9682 decimal param decimal 18 0 n begin n select 1 n end c stmt this conn prepare call call test bug9682 c stmt set double 1 18 0 c stmt execute finally if c stmt null c stmt close this stmt execute update drop procedure if exists test bug9682
tests fix for bug 9682 stored procedures with decimal parameters with
public void test bug12417 throws exception if version meets minimum 5 0 is server running on windows connection uc catalog conn null try this stmt execute update drop procedure if exists test bug12417 this stmt execute update create procedure test bug12417 n begin n select 1 end n uc catalog conn get connection with props null uc catalog conn set catalog this conn get catalog to upper case uc catalog conn prepare call call test bug12417 finally this stmt execute update drop procedure if exists test bug3539 if uc catalog conn null uc catalog conn close
tests fix for bug 12417 stored procedure catalog name is case sensitive
public void test bug21462 throws exception if version meets minimum 5 0 callable statement cstmt null try this stmt execute update drop procedure if exists test bug21462 this stmt execute update create procedure test bug21462 begin select 1 end cstmt this conn prepare call call test bug21462 cstmt execute finally if cstmt null cstmt close this stmt execute update drop procedure if exists test bug21462
tests fix for bug 21462 jdbc and odbc specifications allow no parenthesis
public void test bug10630 throws exception connection conn2 null statement stmt2 null try conn2 get connection with props null stmt2 conn2 create statement conn2 close stmt2 get warnings fail should ve caught an exception here catch sqlexception sql ex assert equals 08003 sql ex get sqlstate finally if stmt2 null stmt2 close if conn2 null conn2 close
tests fix for bug 10630 statement
public void test bug20650 throws exception connection closed conn null statement cancel stmt null try closed conn get connection with props null cancel stmt closed conn create statement closed conn close cancel stmt cancel finally if cancel stmt null cancel stmt close if closed conn null closed conn is closed closed conn close
tests fix for bug 20650 statement
public string get driver version throws java sql sqlexception return mysql cj full prod name date 2007 03 01 00 01 06 0100 thu 01 mar 2007 revision 6329
whats the version of this jdbc driver
public int get event duration millis return this event duration millis
returns the duration of the event in milliseconds
private void reclaim large reusable packet if this reusable packet null this reusable packet get capacity 1048576 this reusable packet new buffer this connection get net buffer length
dont hold on to overly large packets
private void set failed over state throws sqlexception if get fail over read only set read only true this queries issued failed over 0 this failed over true this master fail time millis system current time millis
sets state for a failed over connection
override protected void startup show new testview this
at startup create and show the main frame of the application
public void add link widget link if links get widget count 0 html seperaor new html links add seperaor links add link
add a link to the top of the page
public void set content title left string title content title left wrapper set html title
set the title of the content area
public void set content title right button button if button null content title right wrapper set widget new html todo override get short cut button content title layout set widget 0 1 new html nbsp nbsp todo override get short cut button else content title layout set widget 0 1 button content title right wrapper set widget button
set the title of the content area
private void create main menu setup the main menu application images tree images gwt create application images class main menu new tree tree images main menu set animation enabled true main menu add style name default style name menu main menu add tree listener new tree listener public void on tree item selected tree item item item set selected false if listener null listener on menu item selected item public void on tree item state changed tree item item
create the main menu
public void set value collection string new ids ids clear list clear if new ids null return if id null id trim length 0 return string a id split for int i 0 i a length i ids add a i ids add all new ids todo leon too slow consider combined to one server call for string id new ids new read service get bean bean id new read service listener public void on success bean object bean list add item bean get string name
the value format is a b c
public void add allowed type string type types add type to lower case
the type should be
public void set parameter string name string value boundary write name name newline newline writeln value
adds a string parameter to the request
private void display content widget content widget content if content null app set content content content refresh system out println app app
set the content to the
private string to string input stream input stream throws ioexception string string string builder output builder new string builder if input stream null buffered reader reader new buffered reader new input stream reader input stream utf 8 while null string reader read line output builder append string append n return output builder to string
writes the content of the input stream to a code string code
public string post item string token throws ioexception return extract item url from response make http request token items feed data item post http urlconnection http created
inserts code data item code by making a post request to
public boolean txupdate model object to try todo need not this populate id with po to return get dao update to catch exception e e print stack trace throw new runtime exception e
update only simple attributes
public void set properties map string object properties for string property properties key set set property properties get property
sets the properties
private int trailing chars to strip string content new string text int last newline index last new line index if last newline index 1 begin column 1 return 0 string substring content substring last newline index 1 if substring trim length 0 return 0 we look at the elements afterward on the same line to see if we should strip any whitespace after the last newline for template element elem this next terminal node elem null elem begin line this end line elem elem next terminal node if elem heeds trailing whitespace return 0 return substring length
figures out how many trailing whitespace characters to strip
private string non control string s int start string ret c pos s index of start if c pos 1 c pos s length return s substring start c pos
return a substring starting at code start code and ending at either
private string print oformat short x string sx null if x short min value sx 100000 else if x 0 string t integer to string x 1 short min value 8 switch t length case 1 sx 10000 t break case 2 sx 1000 t break case 3 sx 100 t break case 4 sx 10 t break case 5 sx 1 t break else sx integer to string int x 8 return print oformat sx
format method for the o conversion character and short argument
private void initialize this set title messages get string aboutbox window title non nls 1 this set size 326 280 this set content pane get jcontent pane
this method initializes this
private jbutton get ok btn if ok btn null ok btn new jbutton ok btn set bounds 110 202 97 27 ok btn set text messages get string aboutbox button close non nls 1 ok btn add action listener new java awt event action listener public void action performed java awt event action event e dispose return ok btn
this method initializes j button
private jtext pane get jtext pane if j text pane null j text pane new jtext pane j text pane set bounds new rectangle 33 61 251 94 j text pane set text messages get string aboutbox about text j text pane set font new font verdana font plain 14 j text pane set background system color control return j text pane
this method initializes j text pane
private void initialize url resource get class get resource img drill mini png non nls 1 if resource null this set icon image toolkit get default toolkit get image resource this set default close operation jframe exit on close this set resizable false this set bounds 0 0 590 535 this set content pane new drill form this set title messages get string standalone title non nls 1
this method initializes this
private jpanel get answers panel if answers panel null grid layout grid layout11 new grid layout answers panel new jpanel answers panel set layout grid layout11 answers panel set bounds 5 5 10 10 grid layout11 set rows 6 grid layout11 set columns 1 return answers panel
this method initializes j panel
private jbutton get exit btn if exit btn null exit btn new jbutton exit btn set bounds 441 429 138 34 exit btn set icon new image icon exit btn set text messages get string mainform close non nls 1 set icon exit btn close png non nls 1 exit btn add action listener new java awt event action listener public void action performed java awt event action event e set visible false system exit 0 return exit btn
this method initializes j button
private jbutton get load test btn if load test btn null load test btn new jbutton load test btn set bounds 441 382 138 34 set icon load test btn load png non nls 1 load test btn set text messages get string mainform load test non nls 1 load test btn add action listener new java awt event action listener public void action performed java awt event action event e open file return load test btn
this method initializes j button
private jtext pane get question text if question text null question text new jtext pane question text set editable false question text set content type text plain non nls 1 question text set font new java awt font verdana non nls 1 java awt font bold 14 return question text
this method initializes j text pane
private jscroll pane get jscroll pane if j scroll pane null j scroll pane new jscroll pane j scroll pane set bounds 24 203 535 165 j scroll pane set viewport view get answers panel return j scroll pane
this method initializes j scroll pane
private jscroll pane get jscroll pane1 if j scroll pane1 null j scroll pane1 new jscroll pane j scroll pane1 set bounds 24 77 536 118 j scroll pane1 set viewport view get question text return j scroll pane1
this method initializes j scroll pane1
private jbutton get about btn if about btn null about btn new jbutton about btn set bounds 510 17 69 40 about btn set text non nls 1 about btn set horizontal text position javax swing swing constants left set icon about btn about png non nls 1 about btn set horizontal alignment javax swing swing constants left about btn add action listener new java awt event action listener public void action performed java awt event action event e about box set visible true return about btn
this method initializes j button
private jcheck box get shuffle ans if shuffle ans null shuffle ans new jcheck box shuffle ans set bounds 20 405 172 21 shuffle ans set text messages get string mainform mix answers non nls 1 shuffle ans set selected get preference boolean shuffle answers property false non nls 1 shuffle ans add change listener new javax swing event change listener public void state changed javax swing event change event e set preference shuffle answers property shuffle ans non nls 1 is selected return shuffle ans
this method initializes j check box
private jtext field get next timeout if next timeout null next timeout new jtext field next timeout set bounds 154 430 37 20 next timeout set text get preference auto next timeout property 2 non nls 1 non nls 2 next timeout add key listener new java awt event key adapter public void key typed java awt event key event e set preference auto next timeout property next timeout get text non nls 1 return next timeout
this method initializes j text field
private jcheck box get auto next if auto next null auto next new jcheck box auto next set bounds 20 430 130 21 auto next set text messages get string mainform auto change non nls 1 auto next set selected get preference boolean use auto next property true non nls 1 auto next add item listener new java awt event item listener public void item state changed java awt event item event e next timeout set enabled auto next is selected set preference use auto next property auto next is selected non nls 1 return auto next
this method initializes j check box
private jbutton get go back if go back null go back new jbutton go back set bounds 262 455 88 33 go back set text messages get string mainform back non nls 1 set icon go back prev png non nls 1 go back add action listener new java awt event action listener public void action performed java awt event action event e next question if next question 0 next question questions count 1 prepare question questions get next question if timer set is selected start timer return go back
this method initializes j button
private jprogress bar get timer bar if timer bar null timer bar new jprogress bar timer bar set bounds 206 379 199 14 return timer bar
this method initializes j progress bar
private jtext field get timer val if timer val null timer val new jtext field timer val set bounds 153 455 37 20 timer val set text get preference question timeout value property 60 non nls 1 non nls 2 timer val add key listener new java awt event key adapter public void key typed java awt event key event e set preference question timeout value property timer val get text non nls 1 return timer val
this method initializes j text field
public void test randon string one string utils get random name string two string utils get random name string three string utils get random name assert equals size 12 one length assert false one equals two assert false one equals three assert false two equals three
test the random name method
public void test array to string boolean array new boolean boolean false boolean true boolean true boolean false string to string array utils array to string array assert equals to string false true true false to string
simple code to string code test
public void test array to string alternative seperator boolean array new boolean boolean false boolean true boolean true boolean false string to string array utils array to string array assert equals to string false true true false to string
simple code to string code test with alternative seperator
public void test to string map string boolean test map new linked hash map string boolean test map put a boolean false test map put b boolean true test map put c boolean true test map put d boolean false string to string map utils to string test map assert equals to string a false b true c true d false to string
simple to string test
public void test array to string empty boolean array new boolean string to string array utils array to string array assert equals to string to string array null to string array utils array to string array assert equals to string to string
simple code to string code test with empty and code null code array
public void test to string with array map string boolean test map new linked hash map string boolean test map put a new boolean boolean false boolean false test map put b new boolean boolean true boolean false test map put c new boolean boolean false boolean true test map put d new boolean boolean true boolean true string to string map utils to string test map assert equals to string a false false b true false c false true d true true to string
simple to string test with array values
public void test to string empty map string boolean test map new linked hash map string boolean string to string map utils to string test map assert equals to string to string
simple to string test
public void test to string null string to string map utils to string null assert equals to string to string
simple to string test
public java file get resulting java file return java file
retrieve the result of the parser
protected class create class type type if type instanceof void type return class void if type instanceof primitive type primitive type primitive primitive type type return new class primitive to string if type instanceof reference type return create class reference type type get type class or interface type class type class or interface type type class class new class class type get name if class type get type args null for iterator type iterator class type get type args iterator iterator has next class add generic create generic class iterator next return class
converts the supplied code type code to a code class code
protected declaration create declaration int modifiers declaration declaration new declaration declaration set abstract modifier set is abstract modifiers declaration set final modifier set is final modifiers declaration set static modifier set is static modifiers if modifier set is public modifiers declaration set scope scope public else if modifier set is protected modifiers declaration set scope scope protected else if modifier set is private modifiers declaration set scope scope private else declaration set scope scope default return declaration
creates a code declaration code object from the supplied modifiers
protected method create method japa parser ast body method declaration md method method new method handle method declaration method md handle body md get body method return method
creates a code method code based on the supplied code japa
protected void handle method declaration method declaration method declaration japa parser ast body method declaration md method declaration set name md get name method declaration set declaration create declaration md get modifiers method declaration set return type create class md get type if md get parameters null for iterator parameter iterator md get parameters iterator iterator has next parameter parameter iterator next method declaration add argument new argument create class parameter get type parameter get id to string handle annotations method declaration md get annotations
handle the conversion between a code japa
public void add argument argument argument insert argument arguments size argument
add an additional code argument code to the code method declaration code
public void add exception class exception if exception null throw new null pointer exception exceptions add exception
add an exception declaration to the code method code
public void add needed import import import needed imports add import import
add a code import code needed by the code method code
public declaration get declaration return declaration
retrieve the code declaration code of the code method code
public java doc get java doc if java doc null set java doc new java doc return java doc
retrieve the code java doc code of the code method declaration code
public class get return type return return type
retrieve the return type of the code method declaration code
public void insert argument int index argument argument if index arguments size for int i arguments size 1 i index i arguments add null if arguments get index null arguments add index argument arguments remove index 1 else arguments add index argument
inserts the supplied code argument code at the specified index
public void remove argument int index throws index out of bounds exception arguments remove index
removes the code argument code at the specified index
public void set declaration declaration declaration this declaration declaration
set the code declaration code of the code method code
public void set java doc java doc java doc this java doc java doc if java doc null java doc set parent method this
set the code java doc code of the code method code
public void set return type class return type this return type return type add needed imports return type to imports
set the return type of the code method declaration code
public class add generic generic class generic generics add generic return this
add a generic to the class
public int get array dimensions return array dimension
retrieve the number of dimensions of the array
public string get package name return package
retrives the complete packagename including the class name
public string get package path if package length class length return null return package substring 0 package length class length 1
retrieve the package path of the code class code
public boolean is array return array dimension 0
retrieve whether the code class code declares an code array code
public boolean is primitive if long equals class return true if int equals class return true if char equals class return true if boolean equals class return true if double equals class return true if float equals class return true if byte equals class return true if short equals class return true return false
retrieve whether the code class code defines a primitive class
public boolean is void return is void
retrieve whether the code class code declares code void code
public boolean requires import boolean requires does this require import if requires for iterator generic class iter generics iterator iter has next requires iter next requires import return requires
retrives information about whether this code class code requires to imported
public body container get body return body
retrieve the code body container code of the code method code
public void add import import import imports add import import
add an code import code to the code java file code
public string get file name return body get name java
retrieve the name of code java file code
public string get file path return package name replace
retrieve the file path of the code java file code
public imports list get imports imports add all body get needed imports return imports
retrieve the code imports code needed by the code java file code
public void set body abstract body body this body body this body set parent this
set or update the body of the code java file code
public void add annotation annotation annotation imports used by body add all annotation get needed imports annotations add annotation
add an code annotation code to the code abstract body code
public void add generics generic class generics this generics add generics
add the generic declaration to the body
public void add innerclass abstract body extends method declaration inner class inner classes add inner class
add an inner class to the code abstract body code
public void add method t method if this methods contains key method get name this methods put method get name new hash set t this methods get method get name add method
add a code method code or code method declaration code to the body
private string to seperated list collection class elements string seperator string buffer buf new string buffer for iterator class iter elements iterator iter has next buf append to java iter next if iter has next buf append seperator append return buf to string
converts the supplied code collection code of elements to a code string code
public void add needed import import import imports used by body add import import
adds an code import code to the body
public java doc get java doc if javadoc null set java doc new java doc return javadoc
retrieve the code java doc code of the code abstract body code