repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/http/HttpInputStream.java | HttpInputStream.read | public int read() throws IOException
{
if ( total >= limit )
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", "Over the limit: -1");
}
return -1;
}
if ( pos >= count )
{
fill();
if ( pos >= count )
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", pos+" >= "+count+" : -1");
}
return -1;
}
}
total++;
return buf[pos++] & 0xff;
} | java | public int read() throws IOException
{
if ( total >= limit )
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", "Over the limit: -1");
}
return -1;
}
if ( pos >= count )
{
fill();
if ( pos >= count )
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", pos+" >= "+count+" : -1");
}
return -1;
}
}
total++;
return buf[pos++] & 0xff;
} | [
"public",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"total",
">=",
"limit",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"read\"",
",",
"\"Over the limit: -1\"",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"pos",
">=",
"count",
")",
"{",
"fill",
"(",
")",
";",
"if",
"(",
"pos",
">=",
"count",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"read\"",
",",
"pos",
"+",
"\" >= \"",
"+",
"count",
"+",
"\" : -1\"",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"}",
"total",
"++",
";",
"return",
"buf",
"[",
"pos",
"++",
"]",
"&",
"0xff",
";",
"}"
] | Reads a byte of data. This method will block if no input is available.
@return the byte read, or -1 if the end of the stream is reached or
the content length has been exceeded
@exception IOException if an I/O error has occurred | [
"Reads",
"a",
"byte",
"of",
"data",
".",
"This",
"method",
"will",
"block",
"if",
"no",
"input",
"is",
"available",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/http/HttpInputStream.java#L221-L243 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/http/HttpInputStream.java | HttpInputStream.read | public int read(byte []read_buffer, int offset, int length) throws IOException {
// Copy as much as possible from the read buffer
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", "read length -->"+length);
}
if ( total >= limit )
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", "Over the limit: -1");
}
return -1;
}
int buf_len = count - pos;
if (buf_len > 0) {
if (buf_len >= length) {
// Copy part of read buffer
System.arraycopy(buf,pos,read_buffer,offset,length);
pos += length;
// begin 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer
this.total += length;
// end 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", "read returning -->"+length);
}
return length;
}
// Copy all read buffer
System.arraycopy(buf,pos,read_buffer,offset,buf_len);
count = pos = 0; // reset buffer
offset += buf_len;
length -= buf_len;
}
// Try to read remainder directly from the input stream into
// the caller's buffer, avoiding an extra copy
int bytes_read = buf_len;
int rtn = 0;
if(length>0)
{
rtn = in.read(read_buffer,offset,length);
}
if (rtn > 0) {
bytes_read += rtn;
}
// begin 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer
this.total += bytes_read;
// end 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer
if (bytes_read == 0) {
bytes_read = -1;
}
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", "read returning -->"+bytes_read+", total="+total+",limit="+limit);
}
return bytes_read;
} | java | public int read(byte []read_buffer, int offset, int length) throws IOException {
// Copy as much as possible from the read buffer
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", "read length -->"+length);
}
if ( total >= limit )
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", "Over the limit: -1");
}
return -1;
}
int buf_len = count - pos;
if (buf_len > 0) {
if (buf_len >= length) {
// Copy part of read buffer
System.arraycopy(buf,pos,read_buffer,offset,length);
pos += length;
// begin 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer
this.total += length;
// end 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", "read returning -->"+length);
}
return length;
}
// Copy all read buffer
System.arraycopy(buf,pos,read_buffer,offset,buf_len);
count = pos = 0; // reset buffer
offset += buf_len;
length -= buf_len;
}
// Try to read remainder directly from the input stream into
// the caller's buffer, avoiding an extra copy
int bytes_read = buf_len;
int rtn = 0;
if(length>0)
{
rtn = in.read(read_buffer,offset,length);
}
if (rtn > 0) {
bytes_read += rtn;
}
// begin 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer
this.total += bytes_read;
// end 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer
if (bytes_read == 0) {
bytes_read = -1;
}
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"read", "read returning -->"+bytes_read+", total="+total+",limit="+limit);
}
return bytes_read;
} | [
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"read_buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"// Copy as much as possible from the read buffer ",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"read\"",
",",
"\"read length -->\"",
"+",
"length",
")",
";",
"}",
"if",
"(",
"total",
">=",
"limit",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"read\"",
",",
"\"Over the limit: -1\"",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"int",
"buf_len",
"=",
"count",
"-",
"pos",
";",
"if",
"(",
"buf_len",
">",
"0",
")",
"{",
"if",
"(",
"buf_len",
">=",
"length",
")",
"{",
"// Copy part of read buffer",
"System",
".",
"arraycopy",
"(",
"buf",
",",
"pos",
",",
"read_buffer",
",",
"offset",
",",
"length",
")",
";",
"pos",
"+=",
"length",
";",
"// begin 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer ",
"this",
".",
"total",
"+=",
"length",
";",
"// end 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"read\"",
",",
"\"read returning -->\"",
"+",
"length",
")",
";",
"}",
"return",
"length",
";",
"}",
"// Copy all read buffer",
"System",
".",
"arraycopy",
"(",
"buf",
",",
"pos",
",",
"read_buffer",
",",
"offset",
",",
"buf_len",
")",
";",
"count",
"=",
"pos",
"=",
"0",
";",
"// reset buffer",
"offset",
"+=",
"buf_len",
";",
"length",
"-=",
"buf_len",
";",
"}",
"// Try to read remainder directly from the input stream into",
"// the caller's buffer, avoiding an extra copy",
"int",
"bytes_read",
"=",
"buf_len",
";",
"int",
"rtn",
"=",
"0",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"rtn",
"=",
"in",
".",
"read",
"(",
"read_buffer",
",",
"offset",
",",
"length",
")",
";",
"}",
"if",
"(",
"rtn",
">",
"0",
")",
"{",
"bytes_read",
"+=",
"rtn",
";",
"}",
"// begin 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer ",
"this",
".",
"total",
"+=",
"bytes_read",
";",
"// end 280584.2 java.io.IOException: SRVE0080E: Invalid content length WAS.webcontainer ",
"if",
"(",
"bytes_read",
"==",
"0",
")",
"{",
"bytes_read",
"=",
"-",
"1",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"read\"",
",",
"\"read returning -->\"",
"+",
"bytes_read",
"+",
"\", total=\"",
"+",
"total",
"+",
"\",limit=\"",
"+",
"limit",
")",
";",
"}",
"return",
"bytes_read",
";",
"}"
] | Reads into an array of bytes. This method will block until some input
is available.
@param b the buffer into which the data is read
@param off the start offset of the data
@param len the maximum number of bytes read
@return the actual number of bytes read, or -1 if the end of the
stream is reached
@exception IOException if an I/O error has occurred | [
"Reads",
"into",
"an",
"array",
"of",
"bytes",
".",
"This",
"method",
"will",
"block",
"until",
"some",
"input",
"is",
"available",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/http/HttpInputStream.java#L255-L315 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/http/HttpInputStream.java | HttpInputStream.readLine | public int readLine(byte[] b, int off, int len) throws IOException
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine");
}
if ( total >= limit )
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine Over the limit: -1");
}
return -1;
}
int avail; //bytes available in buffer
int readlen; //amount to be read by copyline
int remain = 0; //amount remaining to be read
int newlen; //amount read by copyline
int totalread; //total amount read so far
remain = len;
avail = count - pos;
if ( avail <= 0 )
{
fill();
avail = count - pos;
if ( avail <= 0 )
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine avail less than 0: -1");
}
return -1;
}
}
if ( avail < len )
{
readlen = avail;
}
else
{
readlen = len;
}
newlen = copyLine(buf, pos, b, off, readlen);
pos += newlen;
total += newlen;
remain -= newlen;
totalread = newlen;
if ( totalread == 0 )
{
//should never happen
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine totalRead is 0: -1");
}
return -1;
}
while ( remain > 0 && b[off+totalread-1] != '\n' )
{
//loop through until the conditions of the method are satisfied
fill();
avail = count - pos;
if ( avail <= 0 )
{
// The stream is finished, return what we have.
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine returning --> "+totalread);
}
return totalread;
}
if ( avail < remain )
{
readlen = avail;
}
else
{
readlen = remain;
}
newlen = copyLine(buf, pos, b, off+totalread, readlen);
pos += newlen;
total += newlen;
remain -= newlen;
totalread += newlen;
}
return totalread;
} | java | public int readLine(byte[] b, int off, int len) throws IOException
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine");
}
if ( total >= limit )
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine Over the limit: -1");
}
return -1;
}
int avail; //bytes available in buffer
int readlen; //amount to be read by copyline
int remain = 0; //amount remaining to be read
int newlen; //amount read by copyline
int totalread; //total amount read so far
remain = len;
avail = count - pos;
if ( avail <= 0 )
{
fill();
avail = count - pos;
if ( avail <= 0 )
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine avail less than 0: -1");
}
return -1;
}
}
if ( avail < len )
{
readlen = avail;
}
else
{
readlen = len;
}
newlen = copyLine(buf, pos, b, off, readlen);
pos += newlen;
total += newlen;
remain -= newlen;
totalread = newlen;
if ( totalread == 0 )
{
//should never happen
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine totalRead is 0: -1");
}
return -1;
}
while ( remain > 0 && b[off+totalread-1] != '\n' )
{
//loop through until the conditions of the method are satisfied
fill();
avail = count - pos;
if ( avail <= 0 )
{
// The stream is finished, return what we have.
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine returning --> "+totalread);
}
return totalread;
}
if ( avail < remain )
{
readlen = avail;
}
else
{
readlen = remain;
}
newlen = copyLine(buf, pos, b, off+totalread, readlen);
pos += newlen;
total += newlen;
remain -= newlen;
totalread += newlen;
}
return totalread;
} | [
"public",
"int",
"readLine",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"readLine\"",
",",
"\"readLine\"",
")",
";",
"}",
"if",
"(",
"total",
">=",
"limit",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"readLine\"",
",",
"\"readLine Over the limit: -1\"",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"int",
"avail",
";",
"//bytes available in buffer",
"int",
"readlen",
";",
"//amount to be read by copyline",
"int",
"remain",
"=",
"0",
";",
"//amount remaining to be read",
"int",
"newlen",
";",
"//amount read by copyline",
"int",
"totalread",
";",
"//total amount read so far",
"remain",
"=",
"len",
";",
"avail",
"=",
"count",
"-",
"pos",
";",
"if",
"(",
"avail",
"<=",
"0",
")",
"{",
"fill",
"(",
")",
";",
"avail",
"=",
"count",
"-",
"pos",
";",
"if",
"(",
"avail",
"<=",
"0",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"readLine\"",
",",
"\"readLine avail less than 0: -1\"",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"}",
"if",
"(",
"avail",
"<",
"len",
")",
"{",
"readlen",
"=",
"avail",
";",
"}",
"else",
"{",
"readlen",
"=",
"len",
";",
"}",
"newlen",
"=",
"copyLine",
"(",
"buf",
",",
"pos",
",",
"b",
",",
"off",
",",
"readlen",
")",
";",
"pos",
"+=",
"newlen",
";",
"total",
"+=",
"newlen",
";",
"remain",
"-=",
"newlen",
";",
"totalread",
"=",
"newlen",
";",
"if",
"(",
"totalread",
"==",
"0",
")",
"{",
"//should never happen",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"readLine\"",
",",
"\"readLine totalRead is 0: -1\"",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"while",
"(",
"remain",
">",
"0",
"&&",
"b",
"[",
"off",
"+",
"totalread",
"-",
"1",
"]",
"!=",
"'",
"'",
")",
"{",
"//loop through until the conditions of the method are satisfied",
"fill",
"(",
")",
";",
"avail",
"=",
"count",
"-",
"pos",
";",
"if",
"(",
"avail",
"<=",
"0",
")",
"{",
"// The stream is finished, return what we have.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"readLine\"",
",",
"\"readLine returning --> \"",
"+",
"totalread",
")",
";",
"}",
"return",
"totalread",
";",
"}",
"if",
"(",
"avail",
"<",
"remain",
")",
"{",
"readlen",
"=",
"avail",
";",
"}",
"else",
"{",
"readlen",
"=",
"remain",
";",
"}",
"newlen",
"=",
"copyLine",
"(",
"buf",
",",
"pos",
",",
"b",
",",
"off",
"+",
"totalread",
",",
"readlen",
")",
";",
"pos",
"+=",
"newlen",
";",
"total",
"+=",
"newlen",
";",
"remain",
"-=",
"newlen",
";",
"totalread",
"+=",
"newlen",
";",
"}",
"return",
"totalread",
";",
"}"
] | Reads into an array of bytes until all requested bytes have been
read or a '\n' is encountered, in which case the '\n' is read into
the array as well.
@param b the buffer where data is stored
@param off the start offset of the data
@param len the length of the data
@return the actual number of bytes read, or -1 if the end of the
stream is reached or the byte limit has been exceeded
@exception IOException if an I/O error has occurred | [
"Reads",
"into",
"an",
"array",
"of",
"bytes",
"until",
"all",
"requested",
"bytes",
"have",
"been",
"read",
"or",
"a",
"\\",
"n",
"is",
"encountered",
"in",
"which",
"case",
"the",
"\\",
"n",
"is",
"read",
"into",
"the",
"array",
"as",
"well",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/http/HttpInputStream.java#L329-L412 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/http/HttpInputStream.java | HttpInputStream.fill | protected void fill() throws IOException
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"fill", "fill");
}
// PK79219 Start
long longLeft = limit-total;
int len;
if (longLeft>Integer.MAX_VALUE)
len = buf.length;
else
len = Math.min(buf.length, (int)longLeft);
// PK79219 End
if ( len > 0 )
{
len = in.read(buf, 0, len);
if ( len > 0 )
{
pos = 0;
count = len;
}
}
} | java | protected void fill() throws IOException
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"fill", "fill");
}
// PK79219 Start
long longLeft = limit-total;
int len;
if (longLeft>Integer.MAX_VALUE)
len = buf.length;
else
len = Math.min(buf.length, (int)longLeft);
// PK79219 End
if ( len > 0 )
{
len = in.read(buf, 0, len);
if ( len > 0 )
{
pos = 0;
count = len;
}
}
} | [
"protected",
"void",
"fill",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"fill\"",
",",
"\"fill\"",
")",
";",
"}",
"// PK79219 Start",
"long",
"longLeft",
"=",
"limit",
"-",
"total",
";",
"int",
"len",
";",
"if",
"(",
"longLeft",
">",
"Integer",
".",
"MAX_VALUE",
")",
"len",
"=",
"buf",
".",
"length",
";",
"else",
"len",
"=",
"Math",
".",
"min",
"(",
"buf",
".",
"length",
",",
"(",
"int",
")",
"longLeft",
")",
";",
"// PK79219 End\t",
"if",
"(",
"len",
">",
"0",
")",
"{",
"len",
"=",
"in",
".",
"read",
"(",
"buf",
",",
"0",
",",
"len",
")",
";",
"if",
"(",
"len",
">",
"0",
")",
"{",
"pos",
"=",
"0",
";",
"count",
"=",
"len",
";",
"}",
"}",
"}"
] | Fills input buffer with more bytes. | [
"Fills",
"input",
"buffer",
"with",
"more",
"bytes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/http/HttpInputStream.java#L530-L554 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec.cdi/src/com/ibm/ws/security/javaeesec/cdi/beans/hash/Pbkdf2PasswordHashImpl.java | Pbkdf2PasswordHashImpl.parseData | private String[] parseData(String hashedPassword) throws IllegalArgumentException {
// <algorithm>:<iterations>:<base64(salt)>:<base64(hash)>
String[] items = hashedPassword.split(":");
String error = null;
if (items.length == 4) {
if (SUPPORTED_ALGORITHMS.contains(items[0])) {
try {
Integer.parseInt(items[1]);
return items; // good.
} catch (Exception e) {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ITERATION", items[1]);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the iterations is not a number : " + items[1]);
}
}
} else {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ALGORITHM", items[0]);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the hash algorithm is not supported : " + items[0]);
}
}
} else {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ELEMENTS", items.length);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the number of the elements is not 4 but " + items.length);
}
}
String message = Tr.formatMessage(tc, "JAVAEESEC_CDI_ERROR_PASSWORDHASH_INVALID_DATA", error);
Tr.error(tc, message);
throw new IllegalArgumentException(message);
} | java | private String[] parseData(String hashedPassword) throws IllegalArgumentException {
// <algorithm>:<iterations>:<base64(salt)>:<base64(hash)>
String[] items = hashedPassword.split(":");
String error = null;
if (items.length == 4) {
if (SUPPORTED_ALGORITHMS.contains(items[0])) {
try {
Integer.parseInt(items[1]);
return items; // good.
} catch (Exception e) {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ITERATION", items[1]);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the iterations is not a number : " + items[1]);
}
}
} else {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ALGORITHM", items[0]);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the hash algorithm is not supported : " + items[0]);
}
}
} else {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ELEMENTS", items.length);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the number of the elements is not 4 but " + items.length);
}
}
String message = Tr.formatMessage(tc, "JAVAEESEC_CDI_ERROR_PASSWORDHASH_INVALID_DATA", error);
Tr.error(tc, message);
throw new IllegalArgumentException(message);
} | [
"private",
"String",
"[",
"]",
"parseData",
"(",
"String",
"hashedPassword",
")",
"throws",
"IllegalArgumentException",
"{",
"// <algorithm>:<iterations>:<base64(salt)>:<base64(hash)>",
"String",
"[",
"]",
"items",
"=",
"hashedPassword",
".",
"split",
"(",
"\":\"",
")",
";",
"String",
"error",
"=",
"null",
";",
"if",
"(",
"items",
".",
"length",
"==",
"4",
")",
"{",
"if",
"(",
"SUPPORTED_ALGORITHMS",
".",
"contains",
"(",
"items",
"[",
"0",
"]",
")",
")",
"{",
"try",
"{",
"Integer",
".",
"parseInt",
"(",
"items",
"[",
"1",
"]",
")",
";",
"return",
"items",
";",
"// good.",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"error",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"JAVAEESEC_CDI_INVALID_ITERATION\"",
",",
"items",
"[",
"1",
"]",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Invalid format: the iterations is not a number : \"",
"+",
"items",
"[",
"1",
"]",
")",
";",
"}",
"}",
"}",
"else",
"{",
"error",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"JAVAEESEC_CDI_INVALID_ALGORITHM\"",
",",
"items",
"[",
"0",
"]",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Invalid format: the hash algorithm is not supported : \"",
"+",
"items",
"[",
"0",
"]",
")",
";",
"}",
"}",
"}",
"else",
"{",
"error",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"JAVAEESEC_CDI_INVALID_ELEMENTS\"",
",",
"items",
".",
"length",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Invalid format: the number of the elements is not 4 but \"",
"+",
"items",
".",
"length",
")",
";",
"}",
"}",
"String",
"message",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"JAVAEESEC_CDI_ERROR_PASSWORDHASH_INVALID_DATA\"",
",",
"error",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"message",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}"
] | Parse the data by colon.
Make sure that there are three colons, and algorithm is one of supported ones
and the 2nd param can be converted to the integer.
@param hashedPassword
@return | [
"Parse",
"the",
"data",
"by",
"colon",
".",
"Make",
"sure",
"that",
"there",
"are",
"three",
"colons",
"and",
"algorithm",
"is",
"one",
"of",
"supported",
"ones",
"and",
"the",
"2nd",
"param",
"can",
"be",
"converted",
"to",
"the",
"integer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec.cdi/src/com/ibm/ws/security/javaeesec/cdi/beans/hash/Pbkdf2PasswordHashImpl.java#L116-L146 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec.cdi/src/com/ibm/ws/security/javaeesec/cdi/beans/hash/Pbkdf2PasswordHashImpl.java | Pbkdf2PasswordHashImpl.parseParams | protected void parseParams(Map<String, String> params) {
generateAlgorithm = indexOf(PARAM_ALGORITHM, DEFAULT_ALGORITHM, SUPPORTED_ALGORITHMS, params.get(PARAM_ALGORITHM));
generateIterations = parseInt(PARAM_ITERATIONS, params.get(PARAM_ITERATIONS), DEFAULT_ITERATIONS, MINIMUM_ITERATIONS);
generateSaltSize = parseInt(PARAM_SALTSIZE, params.get(PARAM_SALTSIZE), DEFAULT_SALTSIZE, MINIMUM_SALTSIZE);
generateKeySize = parseInt(PARAM_KEYSIZE, params.get(PARAM_KEYSIZE), DEFAULT_KEYSIZE, MINIMUM_KEYSIZE);
} | java | protected void parseParams(Map<String, String> params) {
generateAlgorithm = indexOf(PARAM_ALGORITHM, DEFAULT_ALGORITHM, SUPPORTED_ALGORITHMS, params.get(PARAM_ALGORITHM));
generateIterations = parseInt(PARAM_ITERATIONS, params.get(PARAM_ITERATIONS), DEFAULT_ITERATIONS, MINIMUM_ITERATIONS);
generateSaltSize = parseInt(PARAM_SALTSIZE, params.get(PARAM_SALTSIZE), DEFAULT_SALTSIZE, MINIMUM_SALTSIZE);
generateKeySize = parseInt(PARAM_KEYSIZE, params.get(PARAM_KEYSIZE), DEFAULT_KEYSIZE, MINIMUM_KEYSIZE);
} | [
"protected",
"void",
"parseParams",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"generateAlgorithm",
"=",
"indexOf",
"(",
"PARAM_ALGORITHM",
",",
"DEFAULT_ALGORITHM",
",",
"SUPPORTED_ALGORITHMS",
",",
"params",
".",
"get",
"(",
"PARAM_ALGORITHM",
")",
")",
";",
"generateIterations",
"=",
"parseInt",
"(",
"PARAM_ITERATIONS",
",",
"params",
".",
"get",
"(",
"PARAM_ITERATIONS",
")",
",",
"DEFAULT_ITERATIONS",
",",
"MINIMUM_ITERATIONS",
")",
";",
"generateSaltSize",
"=",
"parseInt",
"(",
"PARAM_SALTSIZE",
",",
"params",
".",
"get",
"(",
"PARAM_SALTSIZE",
")",
",",
"DEFAULT_SALTSIZE",
",",
"MINIMUM_SALTSIZE",
")",
";",
"generateKeySize",
"=",
"parseInt",
"(",
"PARAM_KEYSIZE",
",",
"params",
".",
"get",
"(",
"PARAM_KEYSIZE",
")",
",",
"DEFAULT_KEYSIZE",
",",
"MINIMUM_KEYSIZE",
")",
";",
"}"
] | Parse the parameters. If the value is not set, set the default, if the value is invalid, throw InvalidArgumentException | [
"Parse",
"the",
"parameters",
".",
"If",
"the",
"value",
"is",
"not",
"set",
"set",
"the",
"default",
"if",
"the",
"value",
"is",
"invalid",
"throw",
"InvalidArgumentException"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec.cdi/src/com/ibm/ws/security/javaeesec/cdi/beans/hash/Pbkdf2PasswordHashImpl.java#L151-L156 | train |
OpenLiberty/open-liberty | dev/com.ibm.json4j/src/com/ibm/json/java/JSONObject.java | JSONObject.isValidType | public static boolean isValidType(Class clazz)
{
if (null == clazz) throw new IllegalArgumentException();
if (String.class == clazz) return true;
if (Boolean.class == clazz) return true;
if (JSONObject.class.isAssignableFrom(clazz)) return true;
if (JSONArray.class == clazz) return true;
if (Number.class.isAssignableFrom(clazz)) return true;
return false;
} | java | public static boolean isValidType(Class clazz)
{
if (null == clazz) throw new IllegalArgumentException();
if (String.class == clazz) return true;
if (Boolean.class == clazz) return true;
if (JSONObject.class.isAssignableFrom(clazz)) return true;
if (JSONArray.class == clazz) return true;
if (Number.class.isAssignableFrom(clazz)) return true;
return false;
} | [
"public",
"static",
"boolean",
"isValidType",
"(",
"Class",
"clazz",
")",
"{",
"if",
"(",
"null",
"==",
"clazz",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"if",
"(",
"String",
".",
"class",
"==",
"clazz",
")",
"return",
"true",
";",
"if",
"(",
"Boolean",
".",
"class",
"==",
"clazz",
")",
"return",
"true",
";",
"if",
"(",
"JSONObject",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
")",
"return",
"true",
";",
"if",
"(",
"JSONArray",
".",
"class",
"==",
"clazz",
")",
"return",
"true",
";",
"if",
"(",
"Number",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] | Return whether the class is a valid type of value for a property.
@param clazz The class type to check for validity as a JSON object type. | [
"Return",
"whether",
"the",
"class",
"is",
"a",
"valid",
"type",
"of",
"value",
"for",
"a",
"property",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.json4j/src/com/ibm/json/java/JSONObject.java#L60-L71 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/RootMembership.java | RootMembership.initialize | public final void initialize() throws PersistenceException, SevereMessageStoreException
{
PersistentMessageStore pm = _messageStore.getPersistentMessageStore();
final HashMap tupleMap = _buildTupleMap(pm);
_buildStreamTree(tupleMap);
_recoverStreamsWithInDoubts(pm);
} | java | public final void initialize() throws PersistenceException, SevereMessageStoreException
{
PersistentMessageStore pm = _messageStore.getPersistentMessageStore();
final HashMap tupleMap = _buildTupleMap(pm);
_buildStreamTree(tupleMap);
_recoverStreamsWithInDoubts(pm);
} | [
"public",
"final",
"void",
"initialize",
"(",
")",
"throws",
"PersistenceException",
",",
"SevereMessageStoreException",
"{",
"PersistentMessageStore",
"pm",
"=",
"_messageStore",
".",
"getPersistentMessageStore",
"(",
")",
";",
"final",
"HashMap",
"tupleMap",
"=",
"_buildTupleMap",
"(",
"pm",
")",
";",
"_buildStreamTree",
"(",
"tupleMap",
")",
";",
"_recoverStreamsWithInDoubts",
"(",
"pm",
")",
";",
"}"
] | This method essentially drives the initial loading of the cache layer from the
persistence layer.
@throws SevereMessageStoreException | [
"This",
"method",
"essentially",
"drives",
"the",
"initial",
"loading",
"of",
"the",
"cache",
"layer",
"from",
"the",
"persistence",
"layer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/cache/links/RootMembership.java#L307-L313 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/JCATranWrapperImpl.java | JCATranWrapperImpl.commit | public void commit() throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "commit", _txn);
// replay must have finished
if (_tranManager.isReplayComplete())
{
final int state = _txn.getTransactionState().getState();
switch (state)
{
case TransactionState.STATE_PREPARED :
try
{
// Suspend local transaction if present
suspend(); // @LIDB2110AA
try
{
// Resume imported transaction
_tranManager.resume(_txn);
}
catch (InvalidTransactionException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw InvalidTransactionException", e });
resume();
throw new XAException(XAException.XAER_RMERR);
}
catch (IllegalStateException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw IllegalStateException", e });
resume();
throw new XAException(XAException.XAER_PROTO);
} // @LIDB2110AA
_txn.getTransactionState().setState(TransactionState.STATE_COMMITTING);
_txn.internalCommit();
_txn.notifyCompletion();
}
catch (HeuristicMixedException e)
{
_heuristic = StatefulResource.HEURISTIC_MIXED;
}
catch (HeuristicHazardException e)
{
_heuristic = StatefulResource.HEURISTIC_HAZARD;
}
catch (HeuristicRollbackException e)
{
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
}
catch (SystemException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "internalCommit threw SystemException");
throw new XAException(XAException.XAER_RMERR);
}
finally // @LIDB2110AA
{
// Resume local transaction if we suspended it earlier
resume();
} // @LIDB2110AA
break;
case TransactionState.STATE_HEURISTIC_ON_ROLLBACK :
case TransactionState.STATE_HEURISTIC_ON_COMMIT :
// We had a heuristic on commit or rollback.
// Let's use whatever that was
_heuristic = _txn.getResources().getHeuristicOutcome();
if (tc.isDebugEnabled()) Tr.debug(tc, "Heuristic was: " + ResourceWrapper.printResourceStatus(_heuristic));
break;
case TransactionState.STATE_COMMITTED :
case TransactionState.STATE_COMMITTING :
// could be a retry, so just accept
break;
case TransactionState.STATE_ROLLING_BACK :
case TransactionState.STATE_ROLLED_BACK :
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
break;
case TransactionState.STATE_NONE :
// transaction has completed and has now finished
break;
default :
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "transaction is not in a prepared state");
throw new XAException(XAException.XAER_PROTO);
}
recordHeuristicOnCommit();
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "throwing XAER_RMFAIL");
throw new XAException(XAException.XAER_RMFAIL);
}
if (tc.isEntryEnabled()) Tr.exit(tc, "commit");
} | java | public void commit() throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "commit", _txn);
// replay must have finished
if (_tranManager.isReplayComplete())
{
final int state = _txn.getTransactionState().getState();
switch (state)
{
case TransactionState.STATE_PREPARED :
try
{
// Suspend local transaction if present
suspend(); // @LIDB2110AA
try
{
// Resume imported transaction
_tranManager.resume(_txn);
}
catch (InvalidTransactionException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw InvalidTransactionException", e });
resume();
throw new XAException(XAException.XAER_RMERR);
}
catch (IllegalStateException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw IllegalStateException", e });
resume();
throw new XAException(XAException.XAER_PROTO);
} // @LIDB2110AA
_txn.getTransactionState().setState(TransactionState.STATE_COMMITTING);
_txn.internalCommit();
_txn.notifyCompletion();
}
catch (HeuristicMixedException e)
{
_heuristic = StatefulResource.HEURISTIC_MIXED;
}
catch (HeuristicHazardException e)
{
_heuristic = StatefulResource.HEURISTIC_HAZARD;
}
catch (HeuristicRollbackException e)
{
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
}
catch (SystemException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "internalCommit threw SystemException");
throw new XAException(XAException.XAER_RMERR);
}
finally // @LIDB2110AA
{
// Resume local transaction if we suspended it earlier
resume();
} // @LIDB2110AA
break;
case TransactionState.STATE_HEURISTIC_ON_ROLLBACK :
case TransactionState.STATE_HEURISTIC_ON_COMMIT :
// We had a heuristic on commit or rollback.
// Let's use whatever that was
_heuristic = _txn.getResources().getHeuristicOutcome();
if (tc.isDebugEnabled()) Tr.debug(tc, "Heuristic was: " + ResourceWrapper.printResourceStatus(_heuristic));
break;
case TransactionState.STATE_COMMITTED :
case TransactionState.STATE_COMMITTING :
// could be a retry, so just accept
break;
case TransactionState.STATE_ROLLING_BACK :
case TransactionState.STATE_ROLLED_BACK :
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
break;
case TransactionState.STATE_NONE :
// transaction has completed and has now finished
break;
default :
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "transaction is not in a prepared state");
throw new XAException(XAException.XAER_PROTO);
}
recordHeuristicOnCommit();
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "throwing XAER_RMFAIL");
throw new XAException(XAException.XAER_RMFAIL);
}
if (tc.isEntryEnabled()) Tr.exit(tc, "commit");
} | [
"public",
"void",
"commit",
"(",
")",
"throws",
"XAException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"commit\"",
",",
"_txn",
")",
";",
"// replay must have finished",
"if",
"(",
"_tranManager",
".",
"isReplayComplete",
"(",
")",
")",
"{",
"final",
"int",
"state",
"=",
"_txn",
".",
"getTransactionState",
"(",
")",
".",
"getState",
"(",
")",
";",
"switch",
"(",
"state",
")",
"{",
"case",
"TransactionState",
".",
"STATE_PREPARED",
":",
"try",
"{",
"// Suspend local transaction if present",
"suspend",
"(",
")",
";",
"// @LIDB2110AA",
"try",
"{",
"// Resume imported transaction",
"_tranManager",
".",
"resume",
"(",
"_txn",
")",
";",
"}",
"catch",
"(",
"InvalidTransactionException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"prepare\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"resume threw InvalidTransactionException\"",
",",
"e",
"}",
")",
";",
"resume",
"(",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_RMERR",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"prepare\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"resume threw IllegalStateException\"",
",",
"e",
"}",
")",
";",
"resume",
"(",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_PROTO",
")",
";",
"}",
"// @LIDB2110AA",
"_txn",
".",
"getTransactionState",
"(",
")",
".",
"setState",
"(",
"TransactionState",
".",
"STATE_COMMITTING",
")",
";",
"_txn",
".",
"internalCommit",
"(",
")",
";",
"_txn",
".",
"notifyCompletion",
"(",
")",
";",
"}",
"catch",
"(",
"HeuristicMixedException",
"e",
")",
"{",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_MIXED",
";",
"}",
"catch",
"(",
"HeuristicHazardException",
"e",
")",
"{",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_HAZARD",
";",
"}",
"catch",
"(",
"HeuristicRollbackException",
"e",
")",
"{",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_ROLLBACK",
";",
"}",
"catch",
"(",
"SystemException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"commit\"",
",",
"\"internalCommit threw SystemException\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_RMERR",
")",
";",
"}",
"finally",
"// @LIDB2110AA",
"{",
"// Resume local transaction if we suspended it earlier",
"resume",
"(",
")",
";",
"}",
"// @LIDB2110AA",
"break",
";",
"case",
"TransactionState",
".",
"STATE_HEURISTIC_ON_ROLLBACK",
":",
"case",
"TransactionState",
".",
"STATE_HEURISTIC_ON_COMMIT",
":",
"// We had a heuristic on commit or rollback.",
"// Let's use whatever that was",
"_heuristic",
"=",
"_txn",
".",
"getResources",
"(",
")",
".",
"getHeuristicOutcome",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Heuristic was: \"",
"+",
"ResourceWrapper",
".",
"printResourceStatus",
"(",
"_heuristic",
")",
")",
";",
"break",
";",
"case",
"TransactionState",
".",
"STATE_COMMITTED",
":",
"case",
"TransactionState",
".",
"STATE_COMMITTING",
":",
"// could be a retry, so just accept",
"break",
";",
"case",
"TransactionState",
".",
"STATE_ROLLING_BACK",
":",
"case",
"TransactionState",
".",
"STATE_ROLLED_BACK",
":",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_ROLLBACK",
";",
"break",
";",
"case",
"TransactionState",
".",
"STATE_NONE",
":",
"// transaction has completed and has now finished",
"break",
";",
"default",
":",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"commit\"",
",",
"\"transaction is not in a prepared state\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_PROTO",
")",
";",
"}",
"recordHeuristicOnCommit",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"commit\"",
",",
"\"throwing XAER_RMFAIL\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_RMFAIL",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"commit\"",
")",
";",
"}"
] | Informs the object that the transaction is to be committed
@exception XAException thrown with the following error codes:
<ul><li>XA_HEURMIX - the transaction branch has been heuristically
committed and rolled back</li>
<li>XA_HEURRB - the transaction branch has been heuristically rolled back</li>
<li>XAER_PROTO - the routine was invoked in an inproper context</li>
<li>XA_RMERR - a resource manager error has occurred</li></ul>
@see javax.transaction.xa.XAException | [
"Informs",
"the",
"object",
"that",
"the",
"transaction",
"is",
"to",
"be",
"committed"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/JCATranWrapperImpl.java#L242-L342 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/JCATranWrapperImpl.java | JCATranWrapperImpl.commitOnePhase | public void commitOnePhase() throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "commitOnePhase", _txn);
final int state = _txn.getTransactionState().getState();
switch (state)
{
case TransactionState.STATE_ACTIVE :
// Suspend local transaction if present
suspend();
try
{
// Resume imported transaction
_tranManager.resume(_txn);
_txn.prolongFinish();
_txn.commit_one_phase();
_txn.notifyCompletion();
}
catch (RollbackException e)
{
_txn.notifyCompletion();
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase", "commit threw RollbackException");
throw new XAException(XAException.XA_RBROLLBACK);
}
catch (HeuristicMixedException e)
{
_heuristic = StatefulResource.HEURISTIC_MIXED;
}
catch (HeuristicHazardException e)
{
_heuristic = StatefulResource.HEURISTIC_HAZARD;
}
catch (HeuristicRollbackException e)
{
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
}
catch (IllegalStateException e)
{
_txn.notifyCompletion();
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase", "commit threw IllegalStateException");
throw new XAException(XAException.XAER_PROTO);
}
catch (InvalidTransactionException e) // tm.resume
{
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase", "commit threw InvalidTransactionException");
throw new XAException(XAException.XAER_RMERR);
}
catch (SystemException e)
{
_txn.notifyCompletion();
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase", "commit threw SystemException");
throw new XAException(XAException.XAER_RMERR);
}
finally
{
// Resume local transaction if we suspended it earlier
resume();
}
break;
case TransactionState.STATE_COMMITTING :
case TransactionState.STATE_COMMITTED :
// probably a retry, just accept
break;
case TransactionState.STATE_ROLLING_BACK :
case TransactionState.STATE_ROLLED_BACK :
case TransactionState.STATE_HEURISTIC_ON_ROLLBACK :
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
break;
case TransactionState.STATE_HEURISTIC_ON_COMMIT :
_heuristic = StatefulResource.HEURISTIC_COMMIT;
break;
case TransactionState.STATE_NONE :
// transaction has completed and is now finished
break;
default :
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase", "transaction is in an incorrect state");
throw new XAException(XAException.XAER_PROTO);
}
recordHeuristicOnCommitOnePhase();
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase");
} | java | public void commitOnePhase() throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "commitOnePhase", _txn);
final int state = _txn.getTransactionState().getState();
switch (state)
{
case TransactionState.STATE_ACTIVE :
// Suspend local transaction if present
suspend();
try
{
// Resume imported transaction
_tranManager.resume(_txn);
_txn.prolongFinish();
_txn.commit_one_phase();
_txn.notifyCompletion();
}
catch (RollbackException e)
{
_txn.notifyCompletion();
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase", "commit threw RollbackException");
throw new XAException(XAException.XA_RBROLLBACK);
}
catch (HeuristicMixedException e)
{
_heuristic = StatefulResource.HEURISTIC_MIXED;
}
catch (HeuristicHazardException e)
{
_heuristic = StatefulResource.HEURISTIC_HAZARD;
}
catch (HeuristicRollbackException e)
{
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
}
catch (IllegalStateException e)
{
_txn.notifyCompletion();
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase", "commit threw IllegalStateException");
throw new XAException(XAException.XAER_PROTO);
}
catch (InvalidTransactionException e) // tm.resume
{
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase", "commit threw InvalidTransactionException");
throw new XAException(XAException.XAER_RMERR);
}
catch (SystemException e)
{
_txn.notifyCompletion();
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase", "commit threw SystemException");
throw new XAException(XAException.XAER_RMERR);
}
finally
{
// Resume local transaction if we suspended it earlier
resume();
}
break;
case TransactionState.STATE_COMMITTING :
case TransactionState.STATE_COMMITTED :
// probably a retry, just accept
break;
case TransactionState.STATE_ROLLING_BACK :
case TransactionState.STATE_ROLLED_BACK :
case TransactionState.STATE_HEURISTIC_ON_ROLLBACK :
_heuristic = StatefulResource.HEURISTIC_ROLLBACK;
break;
case TransactionState.STATE_HEURISTIC_ON_COMMIT :
_heuristic = StatefulResource.HEURISTIC_COMMIT;
break;
case TransactionState.STATE_NONE :
// transaction has completed and is now finished
break;
default :
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase", "transaction is in an incorrect state");
throw new XAException(XAException.XAER_PROTO);
}
recordHeuristicOnCommitOnePhase();
if (tc.isEntryEnabled()) Tr.exit(tc, "commitOnePhase");
} | [
"public",
"void",
"commitOnePhase",
"(",
")",
"throws",
"XAException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"commitOnePhase\"",
",",
"_txn",
")",
";",
"final",
"int",
"state",
"=",
"_txn",
".",
"getTransactionState",
"(",
")",
".",
"getState",
"(",
")",
";",
"switch",
"(",
"state",
")",
"{",
"case",
"TransactionState",
".",
"STATE_ACTIVE",
":",
"// Suspend local transaction if present",
"suspend",
"(",
")",
";",
"try",
"{",
"// Resume imported transaction",
"_tranManager",
".",
"resume",
"(",
"_txn",
")",
";",
"_txn",
".",
"prolongFinish",
"(",
")",
";",
"_txn",
".",
"commit_one_phase",
"(",
")",
";",
"_txn",
".",
"notifyCompletion",
"(",
")",
";",
"}",
"catch",
"(",
"RollbackException",
"e",
")",
"{",
"_txn",
".",
"notifyCompletion",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"commitOnePhase\"",
",",
"\"commit threw RollbackException\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XA_RBROLLBACK",
")",
";",
"}",
"catch",
"(",
"HeuristicMixedException",
"e",
")",
"{",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_MIXED",
";",
"}",
"catch",
"(",
"HeuristicHazardException",
"e",
")",
"{",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_HAZARD",
";",
"}",
"catch",
"(",
"HeuristicRollbackException",
"e",
")",
"{",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_ROLLBACK",
";",
"}",
"catch",
"(",
"IllegalStateException",
"e",
")",
"{",
"_txn",
".",
"notifyCompletion",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"commitOnePhase\"",
",",
"\"commit threw IllegalStateException\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_PROTO",
")",
";",
"}",
"catch",
"(",
"InvalidTransactionException",
"e",
")",
"// tm.resume",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"commitOnePhase\"",
",",
"\"commit threw InvalidTransactionException\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_RMERR",
")",
";",
"}",
"catch",
"(",
"SystemException",
"e",
")",
"{",
"_txn",
".",
"notifyCompletion",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"commitOnePhase\"",
",",
"\"commit threw SystemException\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_RMERR",
")",
";",
"}",
"finally",
"{",
"// Resume local transaction if we suspended it earlier",
"resume",
"(",
")",
";",
"}",
"break",
";",
"case",
"TransactionState",
".",
"STATE_COMMITTING",
":",
"case",
"TransactionState",
".",
"STATE_COMMITTED",
":",
"// probably a retry, just accept",
"break",
";",
"case",
"TransactionState",
".",
"STATE_ROLLING_BACK",
":",
"case",
"TransactionState",
".",
"STATE_ROLLED_BACK",
":",
"case",
"TransactionState",
".",
"STATE_HEURISTIC_ON_ROLLBACK",
":",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_ROLLBACK",
";",
"break",
";",
"case",
"TransactionState",
".",
"STATE_HEURISTIC_ON_COMMIT",
":",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_COMMIT",
";",
"break",
";",
"case",
"TransactionState",
".",
"STATE_NONE",
":",
"// transaction has completed and is now finished",
"break",
";",
"default",
":",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"commitOnePhase\"",
",",
"\"transaction is in an incorrect state\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_PROTO",
")",
";",
"}",
"recordHeuristicOnCommitOnePhase",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"commitOnePhase\"",
")",
";",
"}"
] | Informs the object that the transaction is to be committed in one-phase
@exception XAException thrown with the following error codes:
<ul><li>XA_RBROLLBACK - the transaction has rolled back</li>
<li>XA_HEURHAZ - the transaction branch may have been heuristically committed</li>
<li>XA_HEURRB - the transaction branch has been heuristically rolled back</li>
<li>XAER_PROTO - the routine was invoked in an inproper context</li>
<li>XA_RMERR - a resource manager error has occurred</li></ul>
@see javax.transaction.xa.XAException | [
"Informs",
"the",
"object",
"that",
"the",
"transaction",
"is",
"to",
"be",
"committed",
"in",
"one",
"-",
"phase"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/JCATranWrapperImpl.java#L388-L479 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/JCATranWrapperImpl.java | JCATranWrapperImpl.rollback | public synchronized void rollback() throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "rollback", _txn);
// If we've been prepared then replay must
// have finished before we can rollback
if (_prepared && !_tranManager.isReplayComplete())
{
if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", "throwing XAER_RMFAIL(1)");
throw new XAException(XAException.XAER_RMFAIL);
}
final int state = _txn.getTransactionState().getState();
switch (state)
{
case TransactionState.STATE_ACTIVE :
case TransactionState.STATE_PREPARED :
try
{
// Suspend local transaction if present
suspend(); // @LIDB2110AA
try
{
// Resume imported transaction
_tranManager.resume(_txn);
}
catch (InvalidTransactionException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw InvalidTransactionException", e });
resume();
throw new XAException(XAException.XAER_RMERR);
}
catch (IllegalStateException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw IllegalStateException", e });
resume();
throw new XAException(XAException.XAER_PROTO);
} // @LIDB2110AA
_txn.getTransactionState().setState(TransactionState.STATE_ROLLING_BACK);
_txn.cancelAlarms();
_txn.internalRollback();
_txn.notifyCompletion();
}
catch (IllegalStateException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", "throwing XAER_PROTO(1)");
throw new XAException(XAException.XAER_PROTO);
}
catch (SystemException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", "throwing XAER_RMERR");
throw new XAException(XAException.XAER_RMERR);
}
catch (HeuristicMixedException e)
{
_heuristic = StatefulResource.HEURISTIC_MIXED;
}
catch (HeuristicHazardException e)
{
_heuristic = StatefulResource.HEURISTIC_HAZARD;
}
catch (HeuristicCommitException e)
{
_heuristic = StatefulResource.HEURISTIC_COMMIT;
}
finally // @LIDB2110AA
{
// Resume local transaction if we suspended it earlier
resume();
} // @LIDB2110AA
break;
case TransactionState.STATE_HEURISTIC_ON_COMMIT :
case TransactionState.STATE_HEURISTIC_ON_ROLLBACK :
_heuristic = _txn.getResources().getHeuristicOutcome();
break;
case TransactionState.STATE_ROLLING_BACK :
case TransactionState.STATE_ROLLED_BACK :
// probably a retry, just accept
break;
case TransactionState.STATE_NONE :
// transaction has completed and is now finished
break;
default :
_txn.notifyCompletion();
if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", "throwing XAER_PROTO(2)");
throw new XAException(XAException.XAER_PROTO);
}
recordHeuristicOnRollback();
if (tc.isEntryEnabled()) Tr.exit(tc, "rollback");
} | java | public synchronized void rollback() throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "rollback", _txn);
// If we've been prepared then replay must
// have finished before we can rollback
if (_prepared && !_tranManager.isReplayComplete())
{
if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", "throwing XAER_RMFAIL(1)");
throw new XAException(XAException.XAER_RMFAIL);
}
final int state = _txn.getTransactionState().getState();
switch (state)
{
case TransactionState.STATE_ACTIVE :
case TransactionState.STATE_PREPARED :
try
{
// Suspend local transaction if present
suspend(); // @LIDB2110AA
try
{
// Resume imported transaction
_tranManager.resume(_txn);
}
catch (InvalidTransactionException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw InvalidTransactionException", e });
resume();
throw new XAException(XAException.XAER_RMERR);
}
catch (IllegalStateException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw IllegalStateException", e });
resume();
throw new XAException(XAException.XAER_PROTO);
} // @LIDB2110AA
_txn.getTransactionState().setState(TransactionState.STATE_ROLLING_BACK);
_txn.cancelAlarms();
_txn.internalRollback();
_txn.notifyCompletion();
}
catch (IllegalStateException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", "throwing XAER_PROTO(1)");
throw new XAException(XAException.XAER_PROTO);
}
catch (SystemException e)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", "throwing XAER_RMERR");
throw new XAException(XAException.XAER_RMERR);
}
catch (HeuristicMixedException e)
{
_heuristic = StatefulResource.HEURISTIC_MIXED;
}
catch (HeuristicHazardException e)
{
_heuristic = StatefulResource.HEURISTIC_HAZARD;
}
catch (HeuristicCommitException e)
{
_heuristic = StatefulResource.HEURISTIC_COMMIT;
}
finally // @LIDB2110AA
{
// Resume local transaction if we suspended it earlier
resume();
} // @LIDB2110AA
break;
case TransactionState.STATE_HEURISTIC_ON_COMMIT :
case TransactionState.STATE_HEURISTIC_ON_ROLLBACK :
_heuristic = _txn.getResources().getHeuristicOutcome();
break;
case TransactionState.STATE_ROLLING_BACK :
case TransactionState.STATE_ROLLED_BACK :
// probably a retry, just accept
break;
case TransactionState.STATE_NONE :
// transaction has completed and is now finished
break;
default :
_txn.notifyCompletion();
if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", "throwing XAER_PROTO(2)");
throw new XAException(XAException.XAER_PROTO);
}
recordHeuristicOnRollback();
if (tc.isEntryEnabled()) Tr.exit(tc, "rollback");
} | [
"public",
"synchronized",
"void",
"rollback",
"(",
")",
"throws",
"XAException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"rollback\"",
",",
"_txn",
")",
";",
"// If we've been prepared then replay must",
"// have finished before we can rollback",
"if",
"(",
"_prepared",
"&&",
"!",
"_tranManager",
".",
"isReplayComplete",
"(",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"rollback\"",
",",
"\"throwing XAER_RMFAIL(1)\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_RMFAIL",
")",
";",
"}",
"final",
"int",
"state",
"=",
"_txn",
".",
"getTransactionState",
"(",
")",
".",
"getState",
"(",
")",
";",
"switch",
"(",
"state",
")",
"{",
"case",
"TransactionState",
".",
"STATE_ACTIVE",
":",
"case",
"TransactionState",
".",
"STATE_PREPARED",
":",
"try",
"{",
"// Suspend local transaction if present",
"suspend",
"(",
")",
";",
"// @LIDB2110AA",
"try",
"{",
"// Resume imported transaction",
"_tranManager",
".",
"resume",
"(",
"_txn",
")",
";",
"}",
"catch",
"(",
"InvalidTransactionException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"prepare\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"resume threw InvalidTransactionException\"",
",",
"e",
"}",
")",
";",
"resume",
"(",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_RMERR",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"prepare\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"resume threw IllegalStateException\"",
",",
"e",
"}",
")",
";",
"resume",
"(",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_PROTO",
")",
";",
"}",
"// @LIDB2110AA",
"_txn",
".",
"getTransactionState",
"(",
")",
".",
"setState",
"(",
"TransactionState",
".",
"STATE_ROLLING_BACK",
")",
";",
"_txn",
".",
"cancelAlarms",
"(",
")",
";",
"_txn",
".",
"internalRollback",
"(",
")",
";",
"_txn",
".",
"notifyCompletion",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"rollback\"",
",",
"\"throwing XAER_PROTO(1)\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_PROTO",
")",
";",
"}",
"catch",
"(",
"SystemException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"rollback\"",
",",
"\"throwing XAER_RMERR\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_RMERR",
")",
";",
"}",
"catch",
"(",
"HeuristicMixedException",
"e",
")",
"{",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_MIXED",
";",
"}",
"catch",
"(",
"HeuristicHazardException",
"e",
")",
"{",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_HAZARD",
";",
"}",
"catch",
"(",
"HeuristicCommitException",
"e",
")",
"{",
"_heuristic",
"=",
"StatefulResource",
".",
"HEURISTIC_COMMIT",
";",
"}",
"finally",
"// @LIDB2110AA",
"{",
"// Resume local transaction if we suspended it earlier",
"resume",
"(",
")",
";",
"}",
"// @LIDB2110AA",
"break",
";",
"case",
"TransactionState",
".",
"STATE_HEURISTIC_ON_COMMIT",
":",
"case",
"TransactionState",
".",
"STATE_HEURISTIC_ON_ROLLBACK",
":",
"_heuristic",
"=",
"_txn",
".",
"getResources",
"(",
")",
".",
"getHeuristicOutcome",
"(",
")",
";",
"break",
";",
"case",
"TransactionState",
".",
"STATE_ROLLING_BACK",
":",
"case",
"TransactionState",
".",
"STATE_ROLLED_BACK",
":",
"// probably a retry, just accept",
"break",
";",
"case",
"TransactionState",
".",
"STATE_NONE",
":",
"// transaction has completed and is now finished",
"break",
";",
"default",
":",
"_txn",
".",
"notifyCompletion",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"rollback\"",
",",
"\"throwing XAER_PROTO(2)\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_PROTO",
")",
";",
"}",
"recordHeuristicOnRollback",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"rollback\"",
")",
";",
"}"
] | Informs the object that the transaction is to be rolled back
@exception XAException thrown with the following error codes:
<ul><li>XA_HEURMIX - the transaction branch has been committed
and heuristically rolled back</li>
<li>XAER_PROTO - the routine was invoked in an inproper context</li>
<li>XA_RMERR - a resource manager error has occurred</li></ul>
@see javax.transaction.xa.XAException | [
"Informs",
"the",
"object",
"that",
"the",
"transaction",
"is",
"to",
"be",
"rolled",
"back"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/JCATranWrapperImpl.java#L518-L618 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/JCATranWrapperImpl.java | JCATranWrapperImpl.forget | public synchronized void forget() throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "forget", _txn);
// replay must have finished
if (_tranManager.isReplayComplete())
{
_heuristic = StatefulResource.NONE;
_txn.notifyCompletion();
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "forget", "throwing XAER_RMFAIL");
throw new XAException(XAException.XAER_RMFAIL);
}
if (tc.isEntryEnabled()) Tr.exit(tc, "forget");
} | java | public synchronized void forget() throws XAException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "forget", _txn);
// replay must have finished
if (_tranManager.isReplayComplete())
{
_heuristic = StatefulResource.NONE;
_txn.notifyCompletion();
}
else
{
if (tc.isEntryEnabled()) Tr.exit(tc, "forget", "throwing XAER_RMFAIL");
throw new XAException(XAException.XAER_RMFAIL);
}
if (tc.isEntryEnabled()) Tr.exit(tc, "forget");
} | [
"public",
"synchronized",
"void",
"forget",
"(",
")",
"throws",
"XAException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"forget\"",
",",
"_txn",
")",
";",
"// replay must have finished",
"if",
"(",
"_tranManager",
".",
"isReplayComplete",
"(",
")",
")",
"{",
"_heuristic",
"=",
"StatefulResource",
".",
"NONE",
";",
"_txn",
".",
"notifyCompletion",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"forget\"",
",",
"\"throwing XAER_RMFAIL\"",
")",
";",
"throw",
"new",
"XAException",
"(",
"XAException",
".",
"XAER_RMFAIL",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"forget\"",
")",
";",
"}"
] | Informs the object that the transaction is to be forgotten
@exception XAException | [
"Informs",
"the",
"object",
"that",
"the",
"transaction",
"is",
"to",
"be",
"forgotten"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/JCATranWrapperImpl.java#L657-L675 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.reset | public void reset()
{
_dstack.reset();
_current1.reset();
_last1.reset();
_eof = false;
_s = 0;
_p = null;
} | java | public void reset()
{
_dstack.reset();
_current1.reset();
_last1.reset();
_eof = false;
_s = 0;
_p = null;
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"_dstack",
".",
"reset",
"(",
")",
";",
"_current1",
".",
"reset",
"(",
")",
";",
"_last1",
".",
"reset",
"(",
")",
";",
"_eof",
"=",
"false",
";",
"_s",
"=",
"0",
";",
"_p",
"=",
"null",
";",
"}"
] | Reset to post construction state. | [
"Reset",
"to",
"post",
"construction",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L158-L166 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.findFirst | private void findFirst(
DeleteStack stack)
{
boolean x = optimisticFindFirst(stack);
if (x == pessimisticNeeded)
pessimisticFindFirst(stack);
} | java | private void findFirst(
DeleteStack stack)
{
boolean x = optimisticFindFirst(stack);
if (x == pessimisticNeeded)
pessimisticFindFirst(stack);
} | [
"private",
"void",
"findFirst",
"(",
"DeleteStack",
"stack",
")",
"{",
"boolean",
"x",
"=",
"optimisticFindFirst",
"(",
"stack",
")",
";",
"if",
"(",
"x",
"==",
"pessimisticNeeded",
")",
"pessimisticFindFirst",
"(",
"stack",
")",
";",
"}"
] | Find the first key in the index.
<p>Start by using a non-locking, optimistic search. If this
doesn't work then switch to a pessimistic search which locks the
index.</p>
@param stack The stack to use to record the traversal.
@return The first entry in the index. | [
"Find",
"the",
"first",
"key",
"in",
"the",
"index",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L179-L185 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.optimisticFindFirst | private boolean optimisticFindFirst(
DeleteStack stack)
{
Object q = null;
int v1 = _index.vno();
int x1 = _index.xno();
if ((v1&1) != 0)
return pessimisticNeeded;
synchronized(this)
{
}
try
{
q = getFirst(stack);
}
catch (NullPointerException npe)
{
//No FFDC Code Needed.
_nullPointerExceptions++;
return GBSTree.checkForPossibleIndexChange(v1, _index.vno(), npe, "optimisticFindFirst");
}
catch (OptimisticDepthException ode)
{
//No FFDC Code Needed.
_optimisticDepthExceptions++;
return GBSTree.checkForPossibleIndexChange(v1, _index.vno(), ode, "optimisticFindFirst");
}
if (v1 != _index.vno())
return pessimisticNeeded;
_current1.setLocation(q, v1, x1);
_optimisticFindFirsts++;
return optimisticWorked;
} | java | private boolean optimisticFindFirst(
DeleteStack stack)
{
Object q = null;
int v1 = _index.vno();
int x1 = _index.xno();
if ((v1&1) != 0)
return pessimisticNeeded;
synchronized(this)
{
}
try
{
q = getFirst(stack);
}
catch (NullPointerException npe)
{
//No FFDC Code Needed.
_nullPointerExceptions++;
return GBSTree.checkForPossibleIndexChange(v1, _index.vno(), npe, "optimisticFindFirst");
}
catch (OptimisticDepthException ode)
{
//No FFDC Code Needed.
_optimisticDepthExceptions++;
return GBSTree.checkForPossibleIndexChange(v1, _index.vno(), ode, "optimisticFindFirst");
}
if (v1 != _index.vno())
return pessimisticNeeded;
_current1.setLocation(q, v1, x1);
_optimisticFindFirsts++;
return optimisticWorked;
} | [
"private",
"boolean",
"optimisticFindFirst",
"(",
"DeleteStack",
"stack",
")",
"{",
"Object",
"q",
"=",
"null",
";",
"int",
"v1",
"=",
"_index",
".",
"vno",
"(",
")",
";",
"int",
"x1",
"=",
"_index",
".",
"xno",
"(",
")",
";",
"if",
"(",
"(",
"v1",
"&",
"1",
")",
"!=",
"0",
")",
"return",
"pessimisticNeeded",
";",
"synchronized",
"(",
"this",
")",
"{",
"}",
"try",
"{",
"q",
"=",
"getFirst",
"(",
"stack",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"npe",
")",
"{",
"//No FFDC Code Needed.",
"_nullPointerExceptions",
"++",
";",
"return",
"GBSTree",
".",
"checkForPossibleIndexChange",
"(",
"v1",
",",
"_index",
".",
"vno",
"(",
")",
",",
"npe",
",",
"\"optimisticFindFirst\"",
")",
";",
"}",
"catch",
"(",
"OptimisticDepthException",
"ode",
")",
"{",
"//No FFDC Code Needed.",
"_optimisticDepthExceptions",
"++",
";",
"return",
"GBSTree",
".",
"checkForPossibleIndexChange",
"(",
"v1",
",",
"_index",
".",
"vno",
"(",
")",
",",
"ode",
",",
"\"optimisticFindFirst\"",
")",
";",
"}",
"if",
"(",
"v1",
"!=",
"_index",
".",
"vno",
"(",
")",
")",
"return",
"pessimisticNeeded",
";",
"_current1",
".",
"setLocation",
"(",
"q",
",",
"v1",
",",
"x1",
")",
";",
"_optimisticFindFirsts",
"++",
";",
"return",
"optimisticWorked",
";",
"}"
] | Find first key in index using optimistic locking
@param stack The stack to use to record the traversal | [
"Find",
"first",
"key",
"in",
"index",
"using",
"optimistic",
"locking"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L193-L231 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.pessimisticFindFirst | private void pessimisticFindFirst(
DeleteStack stack)
{
Object q = null;
int v1 = 0;
int x1 = 0;
synchronized(_index)
{
q = getFirst(stack);
v1 = _index.vno();
x1 = _index.xno();
_pessimisticFindFirsts++;
}
_current1.setLocation(q, v1, x1);
} | java | private void pessimisticFindFirst(
DeleteStack stack)
{
Object q = null;
int v1 = 0;
int x1 = 0;
synchronized(_index)
{
q = getFirst(stack);
v1 = _index.vno();
x1 = _index.xno();
_pessimisticFindFirsts++;
}
_current1.setLocation(q, v1, x1);
} | [
"private",
"void",
"pessimisticFindFirst",
"(",
"DeleteStack",
"stack",
")",
"{",
"Object",
"q",
"=",
"null",
";",
"int",
"v1",
"=",
"0",
";",
"int",
"x1",
"=",
"0",
";",
"synchronized",
"(",
"_index",
")",
"{",
"q",
"=",
"getFirst",
"(",
"stack",
")",
";",
"v1",
"=",
"_index",
".",
"vno",
"(",
")",
";",
"x1",
"=",
"_index",
".",
"xno",
"(",
")",
";",
"_pessimisticFindFirsts",
"++",
";",
"}",
"_current1",
".",
"setLocation",
"(",
"q",
",",
"v1",
",",
"x1",
")",
";",
"}"
] | Find first key in index using pessimistic locking.
@param stack The stack to use to record the traversal | [
"Find",
"first",
"key",
"in",
"index",
"using",
"pessimistic",
"locking",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L238-L254 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.getFirst | private Object getFirst(
DeleteStack stack)
{
Object q = null;
GBSNode n = leftMostChild(stack);
if (n != null)
{
q = n.leftMostKey();
_current1.setLocation(n, 0);
}
return q;
} | java | private Object getFirst(
DeleteStack stack)
{
Object q = null;
GBSNode n = leftMostChild(stack);
if (n != null)
{
q = n.leftMostKey();
_current1.setLocation(n, 0);
}
return q;
} | [
"private",
"Object",
"getFirst",
"(",
"DeleteStack",
"stack",
")",
"{",
"Object",
"q",
"=",
"null",
";",
"GBSNode",
"n",
"=",
"leftMostChild",
"(",
"stack",
")",
";",
"if",
"(",
"n",
"!=",
"null",
")",
"{",
"q",
"=",
"n",
".",
"leftMostKey",
"(",
")",
";",
"_current1",
".",
"setLocation",
"(",
"n",
",",
"0",
")",
";",
"}",
"return",
"q",
";",
"}"
] | Return first key in the index in key order, if any.
<p>This also sets the node and index in _current1 if a key
is found.</p>
@param stack The stack to use to record the traversal.
@return The first key in the index in key order or null
if the index is empty. | [
"Return",
"first",
"key",
"in",
"the",
"index",
"in",
"key",
"order",
"if",
"any",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L267-L278 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.leftMostChild | private GBSNode leftMostChild(
DeleteStack stack)
{
GBSNode p;
p = _index.root(); /* Root of tree */
GBSNode lastl = null; /* Will point to left-most child */
if (p != null) /* Root is not null, we have a tree */
{
/* Remember father of root */
stack.start(_index.dummyTopNode(), "GBSIterator.leftMostChild");
lastl = leftMostChild(stack, p);
}
return lastl;
} | java | private GBSNode leftMostChild(
DeleteStack stack)
{
GBSNode p;
p = _index.root(); /* Root of tree */
GBSNode lastl = null; /* Will point to left-most child */
if (p != null) /* Root is not null, we have a tree */
{
/* Remember father of root */
stack.start(_index.dummyTopNode(), "GBSIterator.leftMostChild");
lastl = leftMostChild(stack, p);
}
return lastl;
} | [
"private",
"GBSNode",
"leftMostChild",
"(",
"DeleteStack",
"stack",
")",
"{",
"GBSNode",
"p",
";",
"p",
"=",
"_index",
".",
"root",
"(",
")",
";",
"/* Root of tree */",
"GBSNode",
"lastl",
"=",
"null",
";",
"/* Will point to left-most child */",
"if",
"(",
"p",
"!=",
"null",
")",
"/* Root is not null, we have a tree */",
"{",
"/* Remember father of root */",
"stack",
".",
"start",
"(",
"_index",
".",
"dummyTopNode",
"(",
")",
",",
"\"GBSIterator.leftMostChild\"",
")",
";",
"lastl",
"=",
"leftMostChild",
"(",
"stack",
",",
"p",
")",
";",
"}",
"return",
"lastl",
";",
"}"
] | Find the left-most child of the tree by following all of the
left children down to the bottom of the tree.
@param stack The DeleteStack that is used to record the traversal.
@return The left most child at the bottom of the tree or null
if the tree is empty.
@exception OptimisticDepthException if the depth of the traversal
exceeds GBSTree.maxDepth. | [
"Find",
"the",
"left",
"-",
"most",
"child",
"of",
"the",
"tree",
"by",
"following",
"all",
"of",
"the",
"left",
"children",
"down",
"to",
"the",
"bottom",
"of",
"the",
"tree",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L292-L306 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.findNextAfterEof | private void findNextAfterEof(
DeleteStack stack)
{
if ( !_eof )
throw new RuntimeException("findNextAfterEof called when _eof false.");
if (_current1._vno != _index.vno())
{
boolean state = pessimisticNeeded;
state = optimisticSearchNext(stack);
if (state == pessimisticNeeded)
pessimisticSearchNext(stack);
}
} | java | private void findNextAfterEof(
DeleteStack stack)
{
if ( !_eof )
throw new RuntimeException("findNextAfterEof called when _eof false.");
if (_current1._vno != _index.vno())
{
boolean state = pessimisticNeeded;
state = optimisticSearchNext(stack);
if (state == pessimisticNeeded)
pessimisticSearchNext(stack);
}
} | [
"private",
"void",
"findNextAfterEof",
"(",
"DeleteStack",
"stack",
")",
"{",
"if",
"(",
"!",
"_eof",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"findNextAfterEof called when _eof false.\"",
")",
";",
"if",
"(",
"_current1",
".",
"_vno",
"!=",
"_index",
".",
"vno",
"(",
")",
")",
"{",
"boolean",
"state",
"=",
"pessimisticNeeded",
";",
"state",
"=",
"optimisticSearchNext",
"(",
"stack",
")",
";",
"if",
"(",
"state",
"==",
"pessimisticNeeded",
")",
"pessimisticSearchNext",
"(",
"stack",
")",
";",
"}",
"}"
] | Find the next key in the index after an eof condition.
<p>The vno from the time of the eof condition is stored in
_current1. If the vno in the index has not changed then the
iterator is still stuck at the end and there is nothing to do. If
the vno in the index has changed then we do an optimistic search to
re-establish position followed by a pessimistic search if the
optimistic search failed.</p> | [
"Find",
"the",
"next",
"key",
"in",
"the",
"index",
"after",
"an",
"eof",
"condition",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L411-L424 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.optimisticSearchNext | private boolean optimisticSearchNext(
DeleteStack stack)
{
int v1 = _index.vno();
int x1 = _index.xno();
if ((v1&1) != 0)
return pessimisticNeeded;
synchronized(this)
{
}
try
{
internalSearchNext(stack, v1, x1);
}
catch (NullPointerException npe)
{
//No FFDC Code Needed.
_nullPointerExceptions++;
return GBSTree.checkForPossibleIndexChange(v1, _index.vno(), npe, "optimisticSearchNext");
}
catch (OptimisticDepthException ode)
{
//No FFDC Code Needed.
_optimisticDepthExceptions++;
return GBSTree.checkForPossibleIndexChange(v1, _index.vno(), ode, "optimisticSearchNext");
}
if (v1 != _index.vno())
{
_current1.setVersion(1);
return pessimisticNeeded;
}
_optimisticSearchNexts++;
return optimisticWorked;
} | java | private boolean optimisticSearchNext(
DeleteStack stack)
{
int v1 = _index.vno();
int x1 = _index.xno();
if ((v1&1) != 0)
return pessimisticNeeded;
synchronized(this)
{
}
try
{
internalSearchNext(stack, v1, x1);
}
catch (NullPointerException npe)
{
//No FFDC Code Needed.
_nullPointerExceptions++;
return GBSTree.checkForPossibleIndexChange(v1, _index.vno(), npe, "optimisticSearchNext");
}
catch (OptimisticDepthException ode)
{
//No FFDC Code Needed.
_optimisticDepthExceptions++;
return GBSTree.checkForPossibleIndexChange(v1, _index.vno(), ode, "optimisticSearchNext");
}
if (v1 != _index.vno())
{
_current1.setVersion(1);
return pessimisticNeeded;
}
_optimisticSearchNexts++;
return optimisticWorked;
} | [
"private",
"boolean",
"optimisticSearchNext",
"(",
"DeleteStack",
"stack",
")",
"{",
"int",
"v1",
"=",
"_index",
".",
"vno",
"(",
")",
";",
"int",
"x1",
"=",
"_index",
".",
"xno",
"(",
")",
";",
"if",
"(",
"(",
"v1",
"&",
"1",
")",
"!=",
"0",
")",
"return",
"pessimisticNeeded",
";",
"synchronized",
"(",
"this",
")",
"{",
"}",
"try",
"{",
"internalSearchNext",
"(",
"stack",
",",
"v1",
",",
"x1",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"npe",
")",
"{",
"//No FFDC Code Needed.",
"_nullPointerExceptions",
"++",
";",
"return",
"GBSTree",
".",
"checkForPossibleIndexChange",
"(",
"v1",
",",
"_index",
".",
"vno",
"(",
")",
",",
"npe",
",",
"\"optimisticSearchNext\"",
")",
";",
"}",
"catch",
"(",
"OptimisticDepthException",
"ode",
")",
"{",
"//No FFDC Code Needed.",
"_optimisticDepthExceptions",
"++",
";",
"return",
"GBSTree",
".",
"checkForPossibleIndexChange",
"(",
"v1",
",",
"_index",
".",
"vno",
"(",
")",
",",
"ode",
",",
"\"optimisticSearchNext\"",
")",
";",
"}",
"if",
"(",
"v1",
"!=",
"_index",
".",
"vno",
"(",
")",
")",
"{",
"_current1",
".",
"setVersion",
"(",
"1",
")",
";",
"return",
"pessimisticNeeded",
";",
"}",
"_optimisticSearchNexts",
"++",
";",
"return",
"optimisticWorked",
";",
"}"
] | Optimistically find the next key in the index after an eof condition. | [
"Optimistically",
"find",
"the",
"next",
"key",
"in",
"the",
"index",
"after",
"an",
"eof",
"condition",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L430-L467 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.pessimisticSearchNext | private void pessimisticSearchNext(
DeleteStack stack)
{
synchronized(_index)
{
internalSearchNext(stack, _index.vno(), _index.xno());
_pessimisticSearchNexts++;
}
} | java | private void pessimisticSearchNext(
DeleteStack stack)
{
synchronized(_index)
{
internalSearchNext(stack, _index.vno(), _index.xno());
_pessimisticSearchNexts++;
}
} | [
"private",
"void",
"pessimisticSearchNext",
"(",
"DeleteStack",
"stack",
")",
"{",
"synchronized",
"(",
"_index",
")",
"{",
"internalSearchNext",
"(",
"stack",
",",
"_index",
".",
"vno",
"(",
")",
",",
"_index",
".",
"xno",
"(",
")",
")",
";",
"_pessimisticSearchNexts",
"++",
";",
"}",
"}"
] | Pessimistically find the next key in the index after an eof condition. | [
"Pessimistically",
"find",
"the",
"next",
"key",
"in",
"the",
"index",
"after",
"an",
"eof",
"condition",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L472-L480 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.internalSearchNext | private void internalSearchNext(
DeleteStack stack,
int v1,
int x1)
{
SearchComparator comp = searchComparator(SearchComparator.GT);
_s = 0;
_p = null;
_eof = true;
_current1.setVersion(v1);
SearchNode sn = searchNode();
Object q = _index.iteratorFind(_dstack, comp, _last1.key(), sn);
if (q != null)
{
_current1.setLocation(sn.foundNode(), sn.foundIndex());
_current1.setLocation(sn.key(), v1, x1);
_s = NodeStack.VISIT_RIGHT;
_p = sn.foundNode();
_eof = false;
}
} | java | private void internalSearchNext(
DeleteStack stack,
int v1,
int x1)
{
SearchComparator comp = searchComparator(SearchComparator.GT);
_s = 0;
_p = null;
_eof = true;
_current1.setVersion(v1);
SearchNode sn = searchNode();
Object q = _index.iteratorFind(_dstack, comp, _last1.key(), sn);
if (q != null)
{
_current1.setLocation(sn.foundNode(), sn.foundIndex());
_current1.setLocation(sn.key(), v1, x1);
_s = NodeStack.VISIT_RIGHT;
_p = sn.foundNode();
_eof = false;
}
} | [
"private",
"void",
"internalSearchNext",
"(",
"DeleteStack",
"stack",
",",
"int",
"v1",
",",
"int",
"x1",
")",
"{",
"SearchComparator",
"comp",
"=",
"searchComparator",
"(",
"SearchComparator",
".",
"GT",
")",
";",
"_s",
"=",
"0",
";",
"_p",
"=",
"null",
";",
"_eof",
"=",
"true",
";",
"_current1",
".",
"setVersion",
"(",
"v1",
")",
";",
"SearchNode",
"sn",
"=",
"searchNode",
"(",
")",
";",
"Object",
"q",
"=",
"_index",
".",
"iteratorFind",
"(",
"_dstack",
",",
"comp",
",",
"_last1",
".",
"key",
"(",
")",
",",
"sn",
")",
";",
"if",
"(",
"q",
"!=",
"null",
")",
"{",
"_current1",
".",
"setLocation",
"(",
"sn",
".",
"foundNode",
"(",
")",
",",
"sn",
".",
"foundIndex",
"(",
")",
")",
";",
"_current1",
".",
"setLocation",
"(",
"sn",
".",
"key",
"(",
")",
",",
"v1",
",",
"x1",
")",
";",
"_s",
"=",
"NodeStack",
".",
"VISIT_RIGHT",
";",
"_p",
"=",
"sn",
".",
"foundNode",
"(",
")",
";",
"_eof",
"=",
"false",
";",
"}",
"}"
] | Search to re-establish current iterator position.
<p>This is called when the iterator can find no more entries and is
either known to have hit eof or is just about to confirm that fact.
It sets _eof true and saves the current index vno in _current1. If
the search succeeds it sets _eof false.</p> | [
"Search",
"to",
"re",
"-",
"establish",
"current",
"iterator",
"position",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L491-L511 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.pessimisticGetNext | private void pessimisticGetNext(
DeleteStack stack)
{
synchronized(_index)
{
internalGetNext(stack, _index.vno(), _index.xno());
_pessimisticGetNexts++;
}
} | java | private void pessimisticGetNext(
DeleteStack stack)
{
synchronized(_index)
{
internalGetNext(stack, _index.vno(), _index.xno());
_pessimisticGetNexts++;
}
} | [
"private",
"void",
"pessimisticGetNext",
"(",
"DeleteStack",
"stack",
")",
"{",
"synchronized",
"(",
"_index",
")",
"{",
"internalGetNext",
"(",
"stack",
",",
"_index",
".",
"vno",
"(",
")",
",",
"_index",
".",
"xno",
"(",
")",
")",
";",
"_pessimisticGetNexts",
"++",
";",
"}",
"}"
] | Get the next key pessimistically.
<p>Lock the whole index and call internalGetNext().</p>
@param stack The stack used to record the traversal. | [
"Get",
"the",
"next",
"key",
"pessimistically",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L595-L603 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.nextNode | private GBSNode nextNode(
DeleteStack stack)
{
if (_eof)
throw new RuntimeException("_eof is set on entry to nextNode()");
boolean done = false;
GBSNode q = null;
GBSNode nextp = null;
while ( !done )
{
if (stack.index() > GBSTree.maxDepth)
throw new OptimisticDepthException(
"maxDepth (" + GBSTree.maxDepth +
") exceeded in GBSIterator.nextNode().");
switch (_s)
{
case NodeStack.VISIT_LEFT:
_s = NodeStack.PROCESS_CURRENT;
q = _p.leftChild();
while (q != null)
{
stack.push(_s, _p, "GBSIterator.nextNode:VISIT_LEFT");
_p = q;
q = _p.leftChild();
}
break;
case NodeStack.PROCESS_CURRENT:
_s = NodeStack.VISIT_RIGHT;
done = true;
nextp = _p; /* Next node to visit */
break;
case NodeStack.VISIT_RIGHT:
_s = NodeStack.DONE_VISITS;
q = _p.rightChild();
if (q != null)
{
stack.push(_s, _p, "GBSIterator.nextNode:VISIT_RIGHT");
_s = NodeStack.VISIT_LEFT;
_p = _p.rightChild();
}
break;
case NodeStack.DONE_VISITS:
if (stack.index() <= 0) /* Have finally hit end of sub-tree */
done = true;
else
{
_s = stack.state();
_p = stack.node();
stack.pop();
}
break;
default:
throw new RuntimeException("Help!, _s = " + _s + ", _p = " + _p + ".");
} /* switch(_s) */
} /* while ( !done ) */
return nextp;
} | java | private GBSNode nextNode(
DeleteStack stack)
{
if (_eof)
throw new RuntimeException("_eof is set on entry to nextNode()");
boolean done = false;
GBSNode q = null;
GBSNode nextp = null;
while ( !done )
{
if (stack.index() > GBSTree.maxDepth)
throw new OptimisticDepthException(
"maxDepth (" + GBSTree.maxDepth +
") exceeded in GBSIterator.nextNode().");
switch (_s)
{
case NodeStack.VISIT_LEFT:
_s = NodeStack.PROCESS_CURRENT;
q = _p.leftChild();
while (q != null)
{
stack.push(_s, _p, "GBSIterator.nextNode:VISIT_LEFT");
_p = q;
q = _p.leftChild();
}
break;
case NodeStack.PROCESS_CURRENT:
_s = NodeStack.VISIT_RIGHT;
done = true;
nextp = _p; /* Next node to visit */
break;
case NodeStack.VISIT_RIGHT:
_s = NodeStack.DONE_VISITS;
q = _p.rightChild();
if (q != null)
{
stack.push(_s, _p, "GBSIterator.nextNode:VISIT_RIGHT");
_s = NodeStack.VISIT_LEFT;
_p = _p.rightChild();
}
break;
case NodeStack.DONE_VISITS:
if (stack.index() <= 0) /* Have finally hit end of sub-tree */
done = true;
else
{
_s = stack.state();
_p = stack.node();
stack.pop();
}
break;
default:
throw new RuntimeException("Help!, _s = " + _s + ", _p = " + _p + ".");
} /* switch(_s) */
} /* while ( !done ) */
return nextp;
} | [
"private",
"GBSNode",
"nextNode",
"(",
"DeleteStack",
"stack",
")",
"{",
"if",
"(",
"_eof",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"_eof is set on entry to nextNode()\"",
")",
";",
"boolean",
"done",
"=",
"false",
";",
"GBSNode",
"q",
"=",
"null",
";",
"GBSNode",
"nextp",
"=",
"null",
";",
"while",
"(",
"!",
"done",
")",
"{",
"if",
"(",
"stack",
".",
"index",
"(",
")",
">",
"GBSTree",
".",
"maxDepth",
")",
"throw",
"new",
"OptimisticDepthException",
"(",
"\"maxDepth (\"",
"+",
"GBSTree",
".",
"maxDepth",
"+",
"\") exceeded in GBSIterator.nextNode().\"",
")",
";",
"switch",
"(",
"_s",
")",
"{",
"case",
"NodeStack",
".",
"VISIT_LEFT",
":",
"_s",
"=",
"NodeStack",
".",
"PROCESS_CURRENT",
";",
"q",
"=",
"_p",
".",
"leftChild",
"(",
")",
";",
"while",
"(",
"q",
"!=",
"null",
")",
"{",
"stack",
".",
"push",
"(",
"_s",
",",
"_p",
",",
"\"GBSIterator.nextNode:VISIT_LEFT\"",
")",
";",
"_p",
"=",
"q",
";",
"q",
"=",
"_p",
".",
"leftChild",
"(",
")",
";",
"}",
"break",
";",
"case",
"NodeStack",
".",
"PROCESS_CURRENT",
":",
"_s",
"=",
"NodeStack",
".",
"VISIT_RIGHT",
";",
"done",
"=",
"true",
";",
"nextp",
"=",
"_p",
";",
"/* Next node to visit */",
"break",
";",
"case",
"NodeStack",
".",
"VISIT_RIGHT",
":",
"_s",
"=",
"NodeStack",
".",
"DONE_VISITS",
";",
"q",
"=",
"_p",
".",
"rightChild",
"(",
")",
";",
"if",
"(",
"q",
"!=",
"null",
")",
"{",
"stack",
".",
"push",
"(",
"_s",
",",
"_p",
",",
"\"GBSIterator.nextNode:VISIT_RIGHT\"",
")",
";",
"_s",
"=",
"NodeStack",
".",
"VISIT_LEFT",
";",
"_p",
"=",
"_p",
".",
"rightChild",
"(",
")",
";",
"}",
"break",
";",
"case",
"NodeStack",
".",
"DONE_VISITS",
":",
"if",
"(",
"stack",
".",
"index",
"(",
")",
"<=",
"0",
")",
"/* Have finally hit end of sub-tree */",
"done",
"=",
"true",
";",
"else",
"{",
"_s",
"=",
"stack",
".",
"state",
"(",
")",
";",
"_p",
"=",
"stack",
".",
"node",
"(",
")",
";",
"stack",
".",
"pop",
"(",
")",
";",
"}",
"break",
";",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"\"Help!, _s = \"",
"+",
"_s",
"+",
"\", _p = \"",
"+",
"_p",
"+",
"\".\"",
")",
";",
"}",
"/* switch(_s) */",
"}",
"/* while ( !done ) */",
"return",
"nextp",
";",
"}"
] | Find the next node in the tree in key order.
@param stack The stack being used for traversal.
@return the next node in key order. null if we have reached the end. | [
"Find",
"the",
"next",
"node",
"in",
"the",
"tree",
"in",
"key",
"order",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L669-L726 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java | GBSIterator.next | public Object next()
{
_current1.reset();
if (_last1.key() == null)
findFirst(_dstack);
else
{
findNext(_dstack);
if (_current1.key() == null)
_eof = true;
}
if (_current1.key() != null)
_last1.setLocation(_current1);
return _current1.key();
} | java | public Object next()
{
_current1.reset();
if (_last1.key() == null)
findFirst(_dstack);
else
{
findNext(_dstack);
if (_current1.key() == null)
_eof = true;
}
if (_current1.key() != null)
_last1.setLocation(_current1);
return _current1.key();
} | [
"public",
"Object",
"next",
"(",
")",
"{",
"_current1",
".",
"reset",
"(",
")",
";",
"if",
"(",
"_last1",
".",
"key",
"(",
")",
"==",
"null",
")",
"findFirst",
"(",
"_dstack",
")",
";",
"else",
"{",
"findNext",
"(",
"_dstack",
")",
";",
"if",
"(",
"_current1",
".",
"key",
"(",
")",
"==",
"null",
")",
"_eof",
"=",
"true",
";",
"}",
"if",
"(",
"_current1",
".",
"key",
"(",
")",
"!=",
"null",
")",
"_last1",
".",
"setLocation",
"(",
"_current1",
")",
";",
"return",
"_current1",
".",
"key",
"(",
")",
";",
"}"
] | Return the next element in the collection. | [
"Return",
"the",
"next",
"element",
"in",
"the",
"collection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSIterator.java#L731-L747 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/JFapAddress.java | JFapAddress.getLocalAddress | public InetSocketAddress getLocalAddress()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getLocalAddress");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getLocalAddress","rc="+null);
return null;
} | java | public InetSocketAddress getLocalAddress()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getLocalAddress");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getLocalAddress","rc="+null);
return null;
} | [
"public",
"InetSocketAddress",
"getLocalAddress",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getLocalAddress\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getLocalAddress\"",
",",
"\"rc=\"",
"+",
"null",
")",
";",
"return",
"null",
";",
"}"
] | Retrieve the address of the local NIC to bind to.
@see TCPConnectRequestContext#getLocalAddress() | [
"Retrieve",
"the",
"address",
"of",
"the",
"local",
"NIC",
"to",
"bind",
"to",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/JFapAddress.java#L57-L62 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/JFapAddress.java | JFapAddress.getRemoteAddress | public InetSocketAddress getRemoteAddress()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getRemoteAddress");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getRemoteAddress","rc="+remoteAddress);
return remoteAddress;
} | java | public InetSocketAddress getRemoteAddress()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getRemoteAddress");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getRemoteAddress","rc="+remoteAddress);
return remoteAddress;
} | [
"public",
"InetSocketAddress",
"getRemoteAddress",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getRemoteAddress\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getRemoteAddress\"",
",",
"\"rc=\"",
"+",
"remoteAddress",
")",
";",
"return",
"remoteAddress",
";",
"}"
] | Retrieves the address of the remote address to connect to.
@see TCPConnectRequestContext#getRemoteAddress() | [
"Retrieves",
"the",
"address",
"of",
"the",
"remote",
"address",
"to",
"connect",
"to",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/JFapAddress.java#L68-L73 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/Utils.java | Utils.convert | public static Number convert(Number value, Class<?> type) {
if (int.class.equals(type) || Integer.class.equals(type))
value = value.intValue();
else if (long.class.equals(type) || Long.class.equals(type))
value = value.longValue();
else if (short.class.equals(type) || Short.class.equals(type))
value = value.shortValue();
else if (byte.class.equals(type) || Byte.class.equals(type))
value = value.byteValue();
else if (double.class.equals(type) || Double.class.equals(type))
value = value.doubleValue();
else if (float.class.equals(type) || Float.class.equals(type))
value = value.floatValue();
return value;
} | java | public static Number convert(Number value, Class<?> type) {
if (int.class.equals(type) || Integer.class.equals(type))
value = value.intValue();
else if (long.class.equals(type) || Long.class.equals(type))
value = value.longValue();
else if (short.class.equals(type) || Short.class.equals(type))
value = value.shortValue();
else if (byte.class.equals(type) || Byte.class.equals(type))
value = value.byteValue();
else if (double.class.equals(type) || Double.class.equals(type))
value = value.doubleValue();
else if (float.class.equals(type) || Float.class.equals(type))
value = value.floatValue();
return value;
} | [
"public",
"static",
"Number",
"convert",
"(",
"Number",
"value",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"if",
"(",
"int",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Integer",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"value",
".",
"intValue",
"(",
")",
";",
"else",
"if",
"(",
"long",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Long",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"value",
".",
"longValue",
"(",
")",
";",
"else",
"if",
"(",
"short",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Short",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"value",
".",
"shortValue",
"(",
")",
";",
"else",
"if",
"(",
"byte",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Byte",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"value",
".",
"byteValue",
"(",
")",
";",
"else",
"if",
"(",
"double",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Double",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"value",
".",
"doubleValue",
"(",
")",
";",
"else",
"if",
"(",
"float",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Float",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"value",
".",
"floatValue",
"(",
")",
";",
"return",
"value",
";",
"}"
] | Converts a Number value to a Integer, Long, Short, Byte, Double, or Float.
If unable to convert, the original value is returned.
@param value a numeric value.
@param type the desired type, which should be one of (Integer, Long, Short, Byte, Double, Float).
@return converted value. | [
"Converts",
"a",
"Number",
"value",
"to",
"a",
"Integer",
"Long",
"Short",
"Byte",
"Double",
"or",
"Float",
".",
"If",
"unable",
"to",
"convert",
"the",
"original",
"value",
"is",
"returned",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/Utils.java#L54-L68 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/Utils.java | Utils.convert | public static Object convert(String str, Class<?> type) throws Exception {
Object value;
if (int.class.equals(type) || Integer.class.equals(type))
value = Integer.parseInt(str);
else if (boolean.class.equals(type) || Boolean.class.equals(type))
value = Boolean.parseBoolean(str);
else if (long.class.equals(type) || Long.class.equals(type))
value = Long.parseLong(str);
else if (short.class.equals(type) || Short.class.equals(type))
value = Short.parseShort(str);
else if (byte.class.equals(type) || Byte.class.equals(type))
value = Byte.parseByte(str);
else if (double.class.equals(type) || Double.class.equals(type))
value = Double.parseDouble(str);
else if (float.class.equals(type) || Float.class.equals(type))
value = Float.parseFloat(str);
else if (char.class.equals(type) || Character.class.equals(type))
value = str.charAt(0);
else
value = type.getConstructor(String.class).newInstance(str);
return value;
} | java | public static Object convert(String str, Class<?> type) throws Exception {
Object value;
if (int.class.equals(type) || Integer.class.equals(type))
value = Integer.parseInt(str);
else if (boolean.class.equals(type) || Boolean.class.equals(type))
value = Boolean.parseBoolean(str);
else if (long.class.equals(type) || Long.class.equals(type))
value = Long.parseLong(str);
else if (short.class.equals(type) || Short.class.equals(type))
value = Short.parseShort(str);
else if (byte.class.equals(type) || Byte.class.equals(type))
value = Byte.parseByte(str);
else if (double.class.equals(type) || Double.class.equals(type))
value = Double.parseDouble(str);
else if (float.class.equals(type) || Float.class.equals(type))
value = Float.parseFloat(str);
else if (char.class.equals(type) || Character.class.equals(type))
value = str.charAt(0);
else
value = type.getConstructor(String.class).newInstance(str);
return value;
} | [
"public",
"static",
"Object",
"convert",
"(",
"String",
"str",
",",
"Class",
"<",
"?",
">",
"type",
")",
"throws",
"Exception",
"{",
"Object",
"value",
";",
"if",
"(",
"int",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Integer",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"Integer",
".",
"parseInt",
"(",
"str",
")",
";",
"else",
"if",
"(",
"boolean",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Boolean",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"Boolean",
".",
"parseBoolean",
"(",
"str",
")",
";",
"else",
"if",
"(",
"long",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Long",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"Long",
".",
"parseLong",
"(",
"str",
")",
";",
"else",
"if",
"(",
"short",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Short",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"Short",
".",
"parseShort",
"(",
"str",
")",
";",
"else",
"if",
"(",
"byte",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Byte",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"Byte",
".",
"parseByte",
"(",
"str",
")",
";",
"else",
"if",
"(",
"double",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Double",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"Double",
".",
"parseDouble",
"(",
"str",
")",
";",
"else",
"if",
"(",
"float",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Float",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"Float",
".",
"parseFloat",
"(",
"str",
")",
";",
"else",
"if",
"(",
"char",
".",
"class",
".",
"equals",
"(",
"type",
")",
"||",
"Character",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"value",
"=",
"str",
".",
"charAt",
"(",
"0",
")",
";",
"else",
"value",
"=",
"type",
".",
"getConstructor",
"(",
"String",
".",
"class",
")",
".",
"newInstance",
"(",
"str",
")",
";",
"return",
"value",
";",
"}"
] | Converts a String value to the specified type.
@param str a String value.
@param type the desired type, which can be a primitive or primitive wrapper.
@return converted value. | [
"Converts",
"a",
"String",
"value",
"to",
"the",
"specified",
"type",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/Utils.java#L77-L98 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/Utils.java | Utils.serObjByte | public static byte[] serObjByte(Object pk) throws IOException {
final boolean trace = TraceComponent.isAnyTracingEnabled();
if (trace && tc.isEntryEnabled())
Tr.entry(tc, "serObjByte", pk == null ? null : pk.getClass());
byte[] b;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(bos);
out.writeObject(pk);
out.flush();
out.close();
b = bos.toByteArray();
} catch (IOException e) {
FFDCFilter.processException(e, Utils.class.getName(), "336");
if (trace && tc.isEntryEnabled())
Tr.exit(tc, "serObjByte", new Object[] { "Unable to serialize: " + pk, e });
throw e;
} catch (Error e) {
FFDCFilter.processException(e, Utils.class.getName(), "342");
if (trace && tc.isEntryEnabled())
Tr.exit(tc, "serObjByte", new Object[] { "Unable to serialize: " + pk, e });
throw e;
}
if (trace && tc.isEntryEnabled())
Tr.exit(tc, "serObjByte");
return b;
} | java | public static byte[] serObjByte(Object pk) throws IOException {
final boolean trace = TraceComponent.isAnyTracingEnabled();
if (trace && tc.isEntryEnabled())
Tr.entry(tc, "serObjByte", pk == null ? null : pk.getClass());
byte[] b;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(bos);
out.writeObject(pk);
out.flush();
out.close();
b = bos.toByteArray();
} catch (IOException e) {
FFDCFilter.processException(e, Utils.class.getName(), "336");
if (trace && tc.isEntryEnabled())
Tr.exit(tc, "serObjByte", new Object[] { "Unable to serialize: " + pk, e });
throw e;
} catch (Error e) {
FFDCFilter.processException(e, Utils.class.getName(), "342");
if (trace && tc.isEntryEnabled())
Tr.exit(tc, "serObjByte", new Object[] { "Unable to serialize: " + pk, e });
throw e;
}
if (trace && tc.isEntryEnabled())
Tr.exit(tc, "serObjByte");
return b;
} | [
"public",
"static",
"byte",
"[",
"]",
"serObjByte",
"(",
"Object",
"pk",
")",
"throws",
"IOException",
"{",
"final",
"boolean",
"trace",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"serObjByte\"",
",",
"pk",
"==",
"null",
"?",
"null",
":",
"pk",
".",
"getClass",
"(",
")",
")",
";",
"byte",
"[",
"]",
"b",
";",
"try",
"{",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"out",
"=",
"new",
"ObjectOutputStream",
"(",
"bos",
")",
";",
"out",
".",
"writeObject",
"(",
"pk",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"b",
"=",
"bos",
".",
"toByteArray",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"Utils",
".",
"class",
".",
"getName",
"(",
")",
",",
"\"336\"",
")",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"serObjByte\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Unable to serialize: \"",
"+",
"pk",
",",
"e",
"}",
")",
";",
"throw",
"e",
";",
"}",
"catch",
"(",
"Error",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"Utils",
".",
"class",
".",
"getName",
"(",
")",
",",
"\"342\"",
")",
";",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"serObjByte\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"Unable to serialize: \"",
"+",
"pk",
",",
"e",
"}",
")",
";",
"throw",
"e",
";",
"}",
"if",
"(",
"trace",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"serObjByte\"",
")",
";",
"return",
"b",
";",
"}"
] | Serialize an object to a byte array.
@param pk the object
@throws IOException if an error occurs during the serialization process. | [
"Serialize",
"an",
"object",
"to",
"a",
"byte",
"array",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/Utils.java#L232-L258 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/Utils.java | Utils.checkAccessibility | public static void checkAccessibility(String resourceName, String adapterName, String embeddedApp, String accessingApp,
boolean isEndpoint) throws ResourceException {
if (embeddedApp != null) {
if (!embeddedApp.equals(accessingApp)) {
String msg = null;
if (isEndpoint) {
if (accessingApp != null) {
msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8810.embedded.activation.failed",
new Object[] { resourceName, adapterName, embeddedApp, accessingApp },
"J2CA8810.embedded.activation.failed");
} else {
msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8812.embedded.activation.failed",
new Object[] { resourceName, adapterName, embeddedApp },
"J2CA8812.embedded.activation.failed");
}
} else {
if (accessingApp != null) {
msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8809.embedded.lookup.failed",
new Object[] { resourceName, adapterName, embeddedApp, accessingApp },
"J2CA8809.embedded.lookup.failed");
} else {
msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8811.embedded.lookup.failed",
new Object[] { resourceName, adapterName, embeddedApp },
"J2CA8811.embedded.lookup.failed");
}
}
throw new ResourceException(msg);
}
}
} | java | public static void checkAccessibility(String resourceName, String adapterName, String embeddedApp, String accessingApp,
boolean isEndpoint) throws ResourceException {
if (embeddedApp != null) {
if (!embeddedApp.equals(accessingApp)) {
String msg = null;
if (isEndpoint) {
if (accessingApp != null) {
msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8810.embedded.activation.failed",
new Object[] { resourceName, adapterName, embeddedApp, accessingApp },
"J2CA8810.embedded.activation.failed");
} else {
msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8812.embedded.activation.failed",
new Object[] { resourceName, adapterName, embeddedApp },
"J2CA8812.embedded.activation.failed");
}
} else {
if (accessingApp != null) {
msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8809.embedded.lookup.failed",
new Object[] { resourceName, adapterName, embeddedApp, accessingApp },
"J2CA8809.embedded.lookup.failed");
} else {
msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8811.embedded.lookup.failed",
new Object[] { resourceName, adapterName, embeddedApp },
"J2CA8811.embedded.lookup.failed");
}
}
throw new ResourceException(msg);
}
}
} | [
"public",
"static",
"void",
"checkAccessibility",
"(",
"String",
"resourceName",
",",
"String",
"adapterName",
",",
"String",
"embeddedApp",
",",
"String",
"accessingApp",
",",
"boolean",
"isEndpoint",
")",
"throws",
"ResourceException",
"{",
"if",
"(",
"embeddedApp",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"embeddedApp",
".",
"equals",
"(",
"accessingApp",
")",
")",
"{",
"String",
"msg",
"=",
"null",
";",
"if",
"(",
"isEndpoint",
")",
"{",
"if",
"(",
"accessingApp",
"!=",
"null",
")",
"{",
"msg",
"=",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"Utils",
".",
"class",
",",
"tc",
".",
"getResourceBundleName",
"(",
")",
",",
"\"J2CA8810.embedded.activation.failed\"",
",",
"new",
"Object",
"[",
"]",
"{",
"resourceName",
",",
"adapterName",
",",
"embeddedApp",
",",
"accessingApp",
"}",
",",
"\"J2CA8810.embedded.activation.failed\"",
")",
";",
"}",
"else",
"{",
"msg",
"=",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"Utils",
".",
"class",
",",
"tc",
".",
"getResourceBundleName",
"(",
")",
",",
"\"J2CA8812.embedded.activation.failed\"",
",",
"new",
"Object",
"[",
"]",
"{",
"resourceName",
",",
"adapterName",
",",
"embeddedApp",
"}",
",",
"\"J2CA8812.embedded.activation.failed\"",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"accessingApp",
"!=",
"null",
")",
"{",
"msg",
"=",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"Utils",
".",
"class",
",",
"tc",
".",
"getResourceBundleName",
"(",
")",
",",
"\"J2CA8809.embedded.lookup.failed\"",
",",
"new",
"Object",
"[",
"]",
"{",
"resourceName",
",",
"adapterName",
",",
"embeddedApp",
",",
"accessingApp",
"}",
",",
"\"J2CA8809.embedded.lookup.failed\"",
")",
";",
"}",
"else",
"{",
"msg",
"=",
"TraceNLS",
".",
"getFormattedMessage",
"(",
"Utils",
".",
"class",
",",
"tc",
".",
"getResourceBundleName",
"(",
")",
",",
"\"J2CA8811.embedded.lookup.failed\"",
",",
"new",
"Object",
"[",
"]",
"{",
"resourceName",
",",
"adapterName",
",",
"embeddedApp",
"}",
",",
"\"J2CA8811.embedded.lookup.failed\"",
")",
";",
"}",
"}",
"throw",
"new",
"ResourceException",
"(",
"msg",
")",
";",
"}",
"}",
"}"
] | Check accessibility of the resource adapter from the application.
@param resourceName The name of the resource
@param adapterName The name of the resource adapter
@param embeddedApp The name of the app in which the resource adapter is embedded
@param acessingApp The name of the app from which the resource is accessed
@param isEndpoint Whether the resource is an endpoint.
@throws ResourceException | [
"Check",
"accessibility",
"of",
"the",
"resource",
"adapter",
"from",
"the",
"application",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/Utils.java#L289-L318 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/registry/RegistryClaims.java | RegistryClaims.getUserinfoFromRegistryMap | private Map<String, Object> getUserinfoFromRegistryMap(Set<String> claims,
Map<String, Object> inputMap,
boolean isJson) throws Exception {
Map<String, Object> result = inputMap;
VMMService vmmService = JwtUtils.getVMMService();
if (vmmService != null) {
PropertyControl vmmServiceProps = new PropertyControl();
Properties claimsToVMMProperties = new Properties();
if (!claims.isEmpty()) {
// Properties claimsToVMMProps = jwtConfig.getClaimToUserRegistryMap(); //TODO
for (String claim : claims) {
String vmmProperty = claim;// claimsToVMMProps.getProperty(claim);
// if (vmmProperty == null) {
// vmmProperty = claim;
// if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "claim: " + claim + " is not mapped to a vmm property, using the claim name as the vmm property name");
// }
// }
// else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "claim: " + claim + " mapped to vmmProperty: " + vmmProperty);
// }
claimsToVMMProperties.put(claim, vmmProperty);
vmmServiceProps.getProperties().add(vmmProperty);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "claimsToVMMProperties: " + claimsToVMMProperties);
Tr.debug(tc, "getting VMM properties: " + vmmServiceProps.getProperties());
}
if (!vmmServiceProps.getProperties().isEmpty()) {
// Call VMM to get the user's properties
// IdentifierType id = new IdentifierType();
// String uniqueId = RegistryHelper.getUserRegistry(null).getUniqueUserId(userName);
// id.setUniqueName(uniqueId);
// Entity entity = new Entity();
// entity.setIdentifier(id);
// Root root = new Root();
// root.getEntities().add(entity);
// root.getControls().add(vmmServiceProps);
// root = vmmService.get(root);
// PersonAccount person = (PersonAccount) root.getEntities().get(0);
PersonAccount person = getUser(vmmService, vmmServiceProps);
// Now add the claims/values to the JSON
for (Entry<Object, Object> e : claimsToVMMProperties.entrySet()) {
String claim = (String) e.getKey();
String vmmProperty = (String) e.getValue();
Object value = person.get(vmmProperty);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "get for claim: " + claim + " vmmProperty: " + vmmProperty + ", returned: " + value);
}
String strValue = vmmPropertyToString(value);
if (strValue != null && !strValue.isEmpty()) {
result.put(claim, strValue);
// if (isJson && claim.equals("address")) {
// JSONObject addressJSON = new JSONObject();
// addressJSON.put("formatted", strValue);
// result.put(claim, addressJSON);
// } else {
// result.put(claim, strValue);
// }
}
}
}
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "VMM service not available - not returning any extra claims");
}
}
return result;
} | java | private Map<String, Object> getUserinfoFromRegistryMap(Set<String> claims,
Map<String, Object> inputMap,
boolean isJson) throws Exception {
Map<String, Object> result = inputMap;
VMMService vmmService = JwtUtils.getVMMService();
if (vmmService != null) {
PropertyControl vmmServiceProps = new PropertyControl();
Properties claimsToVMMProperties = new Properties();
if (!claims.isEmpty()) {
// Properties claimsToVMMProps = jwtConfig.getClaimToUserRegistryMap(); //TODO
for (String claim : claims) {
String vmmProperty = claim;// claimsToVMMProps.getProperty(claim);
// if (vmmProperty == null) {
// vmmProperty = claim;
// if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "claim: " + claim + " is not mapped to a vmm property, using the claim name as the vmm property name");
// }
// }
// else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "claim: " + claim + " mapped to vmmProperty: " + vmmProperty);
// }
claimsToVMMProperties.put(claim, vmmProperty);
vmmServiceProps.getProperties().add(vmmProperty);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "claimsToVMMProperties: " + claimsToVMMProperties);
Tr.debug(tc, "getting VMM properties: " + vmmServiceProps.getProperties());
}
if (!vmmServiceProps.getProperties().isEmpty()) {
// Call VMM to get the user's properties
// IdentifierType id = new IdentifierType();
// String uniqueId = RegistryHelper.getUserRegistry(null).getUniqueUserId(userName);
// id.setUniqueName(uniqueId);
// Entity entity = new Entity();
// entity.setIdentifier(id);
// Root root = new Root();
// root.getEntities().add(entity);
// root.getControls().add(vmmServiceProps);
// root = vmmService.get(root);
// PersonAccount person = (PersonAccount) root.getEntities().get(0);
PersonAccount person = getUser(vmmService, vmmServiceProps);
// Now add the claims/values to the JSON
for (Entry<Object, Object> e : claimsToVMMProperties.entrySet()) {
String claim = (String) e.getKey();
String vmmProperty = (String) e.getValue();
Object value = person.get(vmmProperty);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "get for claim: " + claim + " vmmProperty: " + vmmProperty + ", returned: " + value);
}
String strValue = vmmPropertyToString(value);
if (strValue != null && !strValue.isEmpty()) {
result.put(claim, strValue);
// if (isJson && claim.equals("address")) {
// JSONObject addressJSON = new JSONObject();
// addressJSON.put("formatted", strValue);
// result.put(claim, addressJSON);
// } else {
// result.put(claim, strValue);
// }
}
}
}
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "VMM service not available - not returning any extra claims");
}
}
return result;
} | [
"private",
"Map",
"<",
"String",
",",
"Object",
">",
"getUserinfoFromRegistryMap",
"(",
"Set",
"<",
"String",
">",
"claims",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"inputMap",
",",
"boolean",
"isJson",
")",
"throws",
"Exception",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
"=",
"inputMap",
";",
"VMMService",
"vmmService",
"=",
"JwtUtils",
".",
"getVMMService",
"(",
")",
";",
"if",
"(",
"vmmService",
"!=",
"null",
")",
"{",
"PropertyControl",
"vmmServiceProps",
"=",
"new",
"PropertyControl",
"(",
")",
";",
"Properties",
"claimsToVMMProperties",
"=",
"new",
"Properties",
"(",
")",
";",
"if",
"(",
"!",
"claims",
".",
"isEmpty",
"(",
")",
")",
"{",
"// Properties claimsToVMMProps = jwtConfig.getClaimToUserRegistryMap(); //TODO",
"for",
"(",
"String",
"claim",
":",
"claims",
")",
"{",
"String",
"vmmProperty",
"=",
"claim",
";",
"// claimsToVMMProps.getProperty(claim);",
"// if (vmmProperty == null) {",
"// vmmProperty = claim;",
"// if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {",
"// Tr.debug(tc, \"claim: \" + claim + \" is not mapped to a vmm property, using the claim name as the vmm property name\");",
"// }",
"// }",
"// else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {",
"// Tr.debug(tc, \"claim: \" + claim + \" mapped to vmmProperty: \" + vmmProperty);",
"// }",
"claimsToVMMProperties",
".",
"put",
"(",
"claim",
",",
"vmmProperty",
")",
";",
"vmmServiceProps",
".",
"getProperties",
"(",
")",
".",
"add",
"(",
"vmmProperty",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"claimsToVMMProperties: \"",
"+",
"claimsToVMMProperties",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getting VMM properties: \"",
"+",
"vmmServiceProps",
".",
"getProperties",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"vmmServiceProps",
".",
"getProperties",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"// Call VMM to get the user's properties",
"// IdentifierType id = new IdentifierType();",
"// String uniqueId = RegistryHelper.getUserRegistry(null).getUniqueUserId(userName);",
"// id.setUniqueName(uniqueId);",
"// Entity entity = new Entity();",
"// entity.setIdentifier(id);",
"// Root root = new Root();",
"// root.getEntities().add(entity);",
"// root.getControls().add(vmmServiceProps);",
"// root = vmmService.get(root);",
"// PersonAccount person = (PersonAccount) root.getEntities().get(0);",
"PersonAccount",
"person",
"=",
"getUser",
"(",
"vmmService",
",",
"vmmServiceProps",
")",
";",
"// Now add the claims/values to the JSON",
"for",
"(",
"Entry",
"<",
"Object",
",",
"Object",
">",
"e",
":",
"claimsToVMMProperties",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"claim",
"=",
"(",
"String",
")",
"e",
".",
"getKey",
"(",
")",
";",
"String",
"vmmProperty",
"=",
"(",
"String",
")",
"e",
".",
"getValue",
"(",
")",
";",
"Object",
"value",
"=",
"person",
".",
"get",
"(",
"vmmProperty",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"get for claim: \"",
"+",
"claim",
"+",
"\" vmmProperty: \"",
"+",
"vmmProperty",
"+",
"\", returned: \"",
"+",
"value",
")",
";",
"}",
"String",
"strValue",
"=",
"vmmPropertyToString",
"(",
"value",
")",
";",
"if",
"(",
"strValue",
"!=",
"null",
"&&",
"!",
"strValue",
".",
"isEmpty",
"(",
")",
")",
"{",
"result",
".",
"put",
"(",
"claim",
",",
"strValue",
")",
";",
"// if (isJson && claim.equals(\"address\")) {",
"// JSONObject addressJSON = new JSONObject();",
"// addressJSON.put(\"formatted\", strValue);",
"// result.put(claim, addressJSON);",
"// } else {",
"// result.put(claim, strValue);",
"// }",
"}",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"VMM service not available - not returning any extra claims\"",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Get the JSONObject that will be returned for userinfo endpoint from the user registry
@param jwtConfig
The JwtConfig
@param claims
The claims for this granted access
@param inputMap
@throws Exception
@throws IOException | [
"Get",
"the",
"JSONObject",
"that",
"will",
"be",
"returned",
"for",
"userinfo",
"endpoint",
"from",
"the",
"user",
"registry"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/registry/RegistryClaims.java#L133-L206 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/registry/RegistryClaims.java | RegistryClaims.vmmPropertyToString | @SuppressWarnings("rawtypes")
public String vmmPropertyToString(Object value) {
String result = null;
if (value == null || value instanceof String) {
result = (String) value;
}
else if (value instanceof List) {
StringBuffer strBuff = null;
for (Object element : (List) value) {
String elem = element.toString();
if (elem != null) {
if (strBuff == null) {
strBuff = new StringBuffer();
}
else {
strBuff.append(" ");
}
strBuff.append(elem);
}
}
if (strBuff != null) {
result = strBuff.toString();
}
}
else {
result = value.toString();
}
return result;
} | java | @SuppressWarnings("rawtypes")
public String vmmPropertyToString(Object value) {
String result = null;
if (value == null || value instanceof String) {
result = (String) value;
}
else if (value instanceof List) {
StringBuffer strBuff = null;
for (Object element : (List) value) {
String elem = element.toString();
if (elem != null) {
if (strBuff == null) {
strBuff = new StringBuffer();
}
else {
strBuff.append(" ");
}
strBuff.append(elem);
}
}
if (strBuff != null) {
result = strBuff.toString();
}
}
else {
result = value.toString();
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"String",
"vmmPropertyToString",
"(",
"Object",
"value",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
"instanceof",
"String",
")",
"{",
"result",
"=",
"(",
"String",
")",
"value",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"List",
")",
"{",
"StringBuffer",
"strBuff",
"=",
"null",
";",
"for",
"(",
"Object",
"element",
":",
"(",
"List",
")",
"value",
")",
"{",
"String",
"elem",
"=",
"element",
".",
"toString",
"(",
")",
";",
"if",
"(",
"elem",
"!=",
"null",
")",
"{",
"if",
"(",
"strBuff",
"==",
"null",
")",
"{",
"strBuff",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"}",
"else",
"{",
"strBuff",
".",
"append",
"(",
"\" \"",
")",
";",
"}",
"strBuff",
".",
"append",
"(",
"elem",
")",
";",
"}",
"}",
"if",
"(",
"strBuff",
"!=",
"null",
")",
"{",
"result",
"=",
"strBuff",
".",
"toString",
"(",
")",
";",
"}",
"}",
"else",
"{",
"result",
"=",
"value",
".",
"toString",
"(",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Convert the object to a String. If it's a list create a String of the
elements as Strings delimited by blanks.
@param value
@return | [
"Convert",
"the",
"object",
"to",
"a",
"String",
".",
"If",
"it",
"s",
"a",
"list",
"create",
"a",
"String",
"of",
"the",
"elements",
"as",
"Strings",
"delimited",
"by",
"blanks",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/registry/RegistryClaims.java#L215-L243 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspRuntimeLibrary.java | JspRuntimeLibrary.decode | public static String decode(String encoded) {
// speedily leave if we're not needed
if (encoded == null)
return null;
if (encoded.indexOf('%') == -1 && encoded.indexOf('+') == -1)
return encoded;
//allocate the buffer - use byte[] to avoid calls to new.
byte holdbuffer[] = new byte[encoded.length()];
char holdchar;
int bufcount = 0;
for (int count = 0; count < encoded.length(); count++) {
char cur = encoded.charAt(count);
if (cur == '%') {
holdbuffer[bufcount++] = (byte) Integer.parseInt(encoded.substring(count + 1, count + 3), 16);
if (count + 2 >= encoded.length())
count = encoded.length();
else
count += 2;
}
else if (cur == '+') {
holdbuffer[bufcount++] = (byte) ' ';
}
else {
holdbuffer[bufcount++] = (byte) cur;
}
}
// REVISIT -- remedy for Deprecated warning.
//return new String(holdbuffer,0,0,bufcount);
return new String(holdbuffer, 0, bufcount);
} | java | public static String decode(String encoded) {
// speedily leave if we're not needed
if (encoded == null)
return null;
if (encoded.indexOf('%') == -1 && encoded.indexOf('+') == -1)
return encoded;
//allocate the buffer - use byte[] to avoid calls to new.
byte holdbuffer[] = new byte[encoded.length()];
char holdchar;
int bufcount = 0;
for (int count = 0; count < encoded.length(); count++) {
char cur = encoded.charAt(count);
if (cur == '%') {
holdbuffer[bufcount++] = (byte) Integer.parseInt(encoded.substring(count + 1, count + 3), 16);
if (count + 2 >= encoded.length())
count = encoded.length();
else
count += 2;
}
else if (cur == '+') {
holdbuffer[bufcount++] = (byte) ' ';
}
else {
holdbuffer[bufcount++] = (byte) cur;
}
}
// REVISIT -- remedy for Deprecated warning.
//return new String(holdbuffer,0,0,bufcount);
return new String(holdbuffer, 0, bufcount);
} | [
"public",
"static",
"String",
"decode",
"(",
"String",
"encoded",
")",
"{",
"// speedily leave if we're not needed",
"if",
"(",
"encoded",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"encoded",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
"&&",
"encoded",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
")",
"return",
"encoded",
";",
"//allocate the buffer - use byte[] to avoid calls to new.",
"byte",
"holdbuffer",
"[",
"]",
"=",
"new",
"byte",
"[",
"encoded",
".",
"length",
"(",
")",
"]",
";",
"char",
"holdchar",
";",
"int",
"bufcount",
"=",
"0",
";",
"for",
"(",
"int",
"count",
"=",
"0",
";",
"count",
"<",
"encoded",
".",
"length",
"(",
")",
";",
"count",
"++",
")",
"{",
"char",
"cur",
"=",
"encoded",
".",
"charAt",
"(",
"count",
")",
";",
"if",
"(",
"cur",
"==",
"'",
"'",
")",
"{",
"holdbuffer",
"[",
"bufcount",
"++",
"]",
"=",
"(",
"byte",
")",
"Integer",
".",
"parseInt",
"(",
"encoded",
".",
"substring",
"(",
"count",
"+",
"1",
",",
"count",
"+",
"3",
")",
",",
"16",
")",
";",
"if",
"(",
"count",
"+",
"2",
">=",
"encoded",
".",
"length",
"(",
")",
")",
"count",
"=",
"encoded",
".",
"length",
"(",
")",
";",
"else",
"count",
"+=",
"2",
";",
"}",
"else",
"if",
"(",
"cur",
"==",
"'",
"'",
")",
"{",
"holdbuffer",
"[",
"bufcount",
"++",
"]",
"=",
"(",
"byte",
")",
"'",
"'",
";",
"}",
"else",
"{",
"holdbuffer",
"[",
"bufcount",
"++",
"]",
"=",
"(",
"byte",
")",
"cur",
";",
"}",
"}",
"// REVISIT -- remedy for Deprecated warning.",
"//return new String(holdbuffer,0,0,bufcount);",
"return",
"new",
"String",
"(",
"holdbuffer",
",",
"0",
",",
"bufcount",
")",
";",
"}"
] | Decode an URL formatted string.
@param s The string to decode.
@return The decoded string. | [
"Decode",
"an",
"URL",
"formatted",
"string",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspRuntimeLibrary.java#L642-L674 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspRuntimeLibrary.java | JspRuntimeLibrary.URLEncode | public static String URLEncode(String s, String enc) {
if (s == null) {
return "null";
}
if (enc == null) {
enc = "ISO-8859-1"; // Is this right?
}
StringBuffer out = new StringBuffer(s.length());
ByteArrayOutputStream buf = new ByteArrayOutputStream();
OutputStreamWriter writer = null;
try {
writer = new OutputStreamWriter(buf, enc);
} catch (java.io.UnsupportedEncodingException ex) {
// Use the default encoding?
writer = new OutputStreamWriter(buf);
}
for (int i = 0; i < s.length(); i++) {
int c = s.charAt(i);
if (c == ' ') {
out.append('+');
} else if (isSafeChar(c)) {
out.append((char)c);
} else {
// convert to external encoding before hex conversion
try {
writer.write(c);
writer.flush();
} catch(IOException e) {
buf.reset();
continue;
}
byte[] ba = buf.toByteArray();
for (int j = 0; j < ba.length; j++) {
out.append('%');
// Converting each byte in the buffer
out.append(Character.forDigit((ba[j]>>4) & 0xf, 16));
out.append(Character.forDigit(ba[j] & 0xf, 16));
}
buf.reset();
}
}
return out.toString();
} | java | public static String URLEncode(String s, String enc) {
if (s == null) {
return "null";
}
if (enc == null) {
enc = "ISO-8859-1"; // Is this right?
}
StringBuffer out = new StringBuffer(s.length());
ByteArrayOutputStream buf = new ByteArrayOutputStream();
OutputStreamWriter writer = null;
try {
writer = new OutputStreamWriter(buf, enc);
} catch (java.io.UnsupportedEncodingException ex) {
// Use the default encoding?
writer = new OutputStreamWriter(buf);
}
for (int i = 0; i < s.length(); i++) {
int c = s.charAt(i);
if (c == ' ') {
out.append('+');
} else if (isSafeChar(c)) {
out.append((char)c);
} else {
// convert to external encoding before hex conversion
try {
writer.write(c);
writer.flush();
} catch(IOException e) {
buf.reset();
continue;
}
byte[] ba = buf.toByteArray();
for (int j = 0; j < ba.length; j++) {
out.append('%');
// Converting each byte in the buffer
out.append(Character.forDigit((ba[j]>>4) & 0xf, 16));
out.append(Character.forDigit(ba[j] & 0xf, 16));
}
buf.reset();
}
}
return out.toString();
} | [
"public",
"static",
"String",
"URLEncode",
"(",
"String",
"s",
",",
"String",
"enc",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"\"null\"",
";",
"}",
"if",
"(",
"enc",
"==",
"null",
")",
"{",
"enc",
"=",
"\"ISO-8859-1\"",
";",
"// Is this right?",
"}",
"StringBuffer",
"out",
"=",
"new",
"StringBuffer",
"(",
"s",
".",
"length",
"(",
")",
")",
";",
"ByteArrayOutputStream",
"buf",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"OutputStreamWriter",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"buf",
",",
"enc",
")",
";",
"}",
"catch",
"(",
"java",
".",
"io",
".",
"UnsupportedEncodingException",
"ex",
")",
"{",
"// Use the default encoding?",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"buf",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"c",
"=",
"s",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"out",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"if",
"(",
"isSafeChar",
"(",
"c",
")",
")",
"{",
"out",
".",
"append",
"(",
"(",
"char",
")",
"c",
")",
";",
"}",
"else",
"{",
"// convert to external encoding before hex conversion",
"try",
"{",
"writer",
".",
"write",
"(",
"c",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"buf",
".",
"reset",
"(",
")",
";",
"continue",
";",
"}",
"byte",
"[",
"]",
"ba",
"=",
"buf",
".",
"toByteArray",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"ba",
".",
"length",
";",
"j",
"++",
")",
"{",
"out",
".",
"append",
"(",
"'",
"'",
")",
";",
"// Converting each byte in the buffer",
"out",
".",
"append",
"(",
"Character",
".",
"forDigit",
"(",
"(",
"ba",
"[",
"j",
"]",
">>",
"4",
")",
"&",
"0xf",
",",
"16",
")",
")",
";",
"out",
".",
"append",
"(",
"Character",
".",
"forDigit",
"(",
"ba",
"[",
"j",
"]",
"&",
"0xf",
",",
"16",
")",
")",
";",
"}",
"buf",
".",
"reset",
"(",
")",
";",
"}",
"}",
"return",
"out",
".",
"toString",
"(",
")",
";",
"}"
] | URL encodes a string, based on the supplied character encoding.
This performs the same function as java.next.URLEncode.encode
in J2SDK1.4, and should be removed if the only platform supported
is 1.4 or higher.
@param s The String to be URL encoded.
@param enc The character encoding
@return The URL encoded String | [
"URL",
"encodes",
"a",
"string",
"based",
"on",
"the",
"supplied",
"character",
"encoding",
".",
"This",
"performs",
"the",
"same",
"function",
"as",
"java",
".",
"next",
".",
"URLEncode",
".",
"encode",
"in",
"J2SDK1",
".",
"4",
"and",
"should",
"be",
"removed",
"if",
"the",
"only",
"platform",
"supported",
"is",
"1",
".",
"4",
"or",
"higher",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/org/apache/jasper/runtime/JspRuntimeLibrary.java#L1063-L1109 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/TransactionManagerService.java | TransactionManagerService.doStartup | public void doStartup(ConfigurationProvider cp, boolean isSQLRecoveryLog) {
if (tc.isDebugEnabled())
Tr.debug(tc, "doStartup with cp: " + cp + " and flag: " + isSQLRecoveryLog);
// Create an AppId that will be unique for this server to be used in the generation of Xids.
// Locate the user directory in the Liberty install
String userDirEnv = System.getenv("WLP_USER_DIR");
if (tc.isDebugEnabled())
Tr.debug(tc, "TMS, WLP_USER_DIR env variable is - " + userDirEnv);
// Retrieve the server name.
String serverName = cp.getServerName();
if (tc.isDebugEnabled())
Tr.debug(tc, "TMS, serverName is - " + serverName);
// Retrieve the host name
String hostName = "";
hostName = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
String theHost = "";
try {
InetAddress addr = InetAddress.getLocalHost();
theHost = addr.getCanonicalHostName().toLowerCase();
} catch (UnknownHostException e) {
theHost = "localhost";
}
return theHost;
}
});
byte[] theApplId = createApplicationId(userDirEnv, serverName, hostName);
cp.setApplId(theApplId);
if (tc.isDebugEnabled())
Tr.debug(tc, "TMS, cp - " + cp + " set applid - " + Util.toHexString(theApplId));
if (!xaFlowCallbacksInitialised) {
// -------------------------------------------------------
// Initialize the XA Flow callbacks by
// attempting to load the test class.
// -------------------------------------------------------
if (tc.isDebugEnabled())
Tr.debug(tc, "initialise the XA Flow callbacks");
XAFlowCallbackControl.initialize();
xaFlowCallbacksInitialised = true;
}
if (cp.isRecoverOnStartup()) {
try {
TMHelper.start(cp.isWaitForRecovery());
} catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.ws.transaction.services.TransactionManagerService.doStartup", "60", this);
}
}
} | java | public void doStartup(ConfigurationProvider cp, boolean isSQLRecoveryLog) {
if (tc.isDebugEnabled())
Tr.debug(tc, "doStartup with cp: " + cp + " and flag: " + isSQLRecoveryLog);
// Create an AppId that will be unique for this server to be used in the generation of Xids.
// Locate the user directory in the Liberty install
String userDirEnv = System.getenv("WLP_USER_DIR");
if (tc.isDebugEnabled())
Tr.debug(tc, "TMS, WLP_USER_DIR env variable is - " + userDirEnv);
// Retrieve the server name.
String serverName = cp.getServerName();
if (tc.isDebugEnabled())
Tr.debug(tc, "TMS, serverName is - " + serverName);
// Retrieve the host name
String hostName = "";
hostName = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
String theHost = "";
try {
InetAddress addr = InetAddress.getLocalHost();
theHost = addr.getCanonicalHostName().toLowerCase();
} catch (UnknownHostException e) {
theHost = "localhost";
}
return theHost;
}
});
byte[] theApplId = createApplicationId(userDirEnv, serverName, hostName);
cp.setApplId(theApplId);
if (tc.isDebugEnabled())
Tr.debug(tc, "TMS, cp - " + cp + " set applid - " + Util.toHexString(theApplId));
if (!xaFlowCallbacksInitialised) {
// -------------------------------------------------------
// Initialize the XA Flow callbacks by
// attempting to load the test class.
// -------------------------------------------------------
if (tc.isDebugEnabled())
Tr.debug(tc, "initialise the XA Flow callbacks");
XAFlowCallbackControl.initialize();
xaFlowCallbacksInitialised = true;
}
if (cp.isRecoverOnStartup()) {
try {
TMHelper.start(cp.isWaitForRecovery());
} catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.ws.transaction.services.TransactionManagerService.doStartup", "60", this);
}
}
} | [
"public",
"void",
"doStartup",
"(",
"ConfigurationProvider",
"cp",
",",
"boolean",
"isSQLRecoveryLog",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"doStartup with cp: \"",
"+",
"cp",
"+",
"\" and flag: \"",
"+",
"isSQLRecoveryLog",
")",
";",
"// Create an AppId that will be unique for this server to be used in the generation of Xids.",
"// Locate the user directory in the Liberty install",
"String",
"userDirEnv",
"=",
"System",
".",
"getenv",
"(",
"\"WLP_USER_DIR\"",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"TMS, WLP_USER_DIR env variable is - \"",
"+",
"userDirEnv",
")",
";",
"// Retrieve the server name.",
"String",
"serverName",
"=",
"cp",
".",
"getServerName",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"TMS, serverName is - \"",
"+",
"serverName",
")",
";",
"// Retrieve the host name",
"String",
"hostName",
"=",
"\"\"",
";",
"hostName",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"run",
"(",
")",
"{",
"String",
"theHost",
"=",
"\"\"",
";",
"try",
"{",
"InetAddress",
"addr",
"=",
"InetAddress",
".",
"getLocalHost",
"(",
")",
";",
"theHost",
"=",
"addr",
".",
"getCanonicalHostName",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"}",
"catch",
"(",
"UnknownHostException",
"e",
")",
"{",
"theHost",
"=",
"\"localhost\"",
";",
"}",
"return",
"theHost",
";",
"}",
"}",
")",
";",
"byte",
"[",
"]",
"theApplId",
"=",
"createApplicationId",
"(",
"userDirEnv",
",",
"serverName",
",",
"hostName",
")",
";",
"cp",
".",
"setApplId",
"(",
"theApplId",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"TMS, cp - \"",
"+",
"cp",
"+",
"\" set applid - \"",
"+",
"Util",
".",
"toHexString",
"(",
"theApplId",
")",
")",
";",
"if",
"(",
"!",
"xaFlowCallbacksInitialised",
")",
"{",
"// -------------------------------------------------------",
"// Initialize the XA Flow callbacks by",
"// attempting to load the test class.",
"// -------------------------------------------------------",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"initialise the XA Flow callbacks\"",
")",
";",
"XAFlowCallbackControl",
".",
"initialize",
"(",
")",
";",
"xaFlowCallbacksInitialised",
"=",
"true",
";",
"}",
"if",
"(",
"cp",
".",
"isRecoverOnStartup",
"(",
")",
")",
"{",
"try",
"{",
"TMHelper",
".",
"start",
"(",
"cp",
".",
"isWaitForRecovery",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.transaction.services.TransactionManagerService.doStartup\"",
",",
"\"60\"",
",",
"this",
")",
";",
"}",
"}",
"}"
] | This method will start log recovery processing.
@param cp | [
"This",
"method",
"will",
"start",
"log",
"recovery",
"processing",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/TransactionManagerService.java#L109-L164 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/TransactionManagerService.java | TransactionManagerService.doShutdown | public void doShutdown(boolean isSQLRecoveryLog) {
if (tc.isEntryEnabled())
Tr.entry(tc, "doShutdown with flag: " + isSQLRecoveryLog);
if (isSQLRecoveryLog) {
try {
TMHelper.shutdown();
} catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.ws.transaction.services.TransactionManagerService.doShutdown", "60", this);
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "doShutdown");
} | java | public void doShutdown(boolean isSQLRecoveryLog) {
if (tc.isEntryEnabled())
Tr.entry(tc, "doShutdown with flag: " + isSQLRecoveryLog);
if (isSQLRecoveryLog) {
try {
TMHelper.shutdown();
} catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.ws.transaction.services.TransactionManagerService.doShutdown", "60", this);
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "doShutdown");
} | [
"public",
"void",
"doShutdown",
"(",
"boolean",
"isSQLRecoveryLog",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"doShutdown with flag: \"",
"+",
"isSQLRecoveryLog",
")",
";",
"if",
"(",
"isSQLRecoveryLog",
")",
"{",
"try",
"{",
"TMHelper",
".",
"shutdown",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.transaction.services.TransactionManagerService.doShutdown\"",
",",
"\"60\"",
",",
"this",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"doShutdown\"",
")",
";",
"}"
] | This method will shutdown log recovery processing if we are working with transaction logs stored in
an RDBMS.
@param cp | [
"This",
"method",
"will",
"shutdown",
"log",
"recovery",
"processing",
"if",
"we",
"are",
"working",
"with",
"transaction",
"logs",
"stored",
"in",
"an",
"RDBMS",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/TransactionManagerService.java#L172-L185 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/TransactionManagerService.java | TransactionManagerService.createApplicationId | private byte[] createApplicationId(String userDir, String serverName, String hostName) {
final boolean traceOn = TraceComponent.isAnyTracingEnabled();
if (tc.isEntryEnabled())
Tr.entry(tc, "createApplicationId", new Object[] { userDir, serverName, hostName });
byte[] result;
try {
// tWAS - Create a dummy IOR based on this host's IP address and server's port
// tWAS - Note: the object must be remoteable, so use Current as an example.
// tWAS - String s = CORBAUtils.getORB().object_to_string(CurrentImpl.instance());
// On Liberty concatenate the user directory, the server name and the host name. Then add in the time.
String s = userDir + serverName + hostName + System.currentTimeMillis();
// Create a 20-byte hash value using a secure one-way hash function
result = java.security.MessageDigest.getInstance("SHA").digest(s.getBytes());
} catch (Throwable t) {
FFDCFilter.processException(t, "com.ibm.ws.transaction.createApplicationId", "608", this);
String tempStr = "j" + (System.currentTimeMillis() % 9997) + ":" + userDir + hostName;
result = tempStr.getBytes();
}
if (traceOn && tc.isEntryEnabled())
Tr.exit(tc, "createApplicationId", Util.toHexString(result));
return result;
} | java | private byte[] createApplicationId(String userDir, String serverName, String hostName) {
final boolean traceOn = TraceComponent.isAnyTracingEnabled();
if (tc.isEntryEnabled())
Tr.entry(tc, "createApplicationId", new Object[] { userDir, serverName, hostName });
byte[] result;
try {
// tWAS - Create a dummy IOR based on this host's IP address and server's port
// tWAS - Note: the object must be remoteable, so use Current as an example.
// tWAS - String s = CORBAUtils.getORB().object_to_string(CurrentImpl.instance());
// On Liberty concatenate the user directory, the server name and the host name. Then add in the time.
String s = userDir + serverName + hostName + System.currentTimeMillis();
// Create a 20-byte hash value using a secure one-way hash function
result = java.security.MessageDigest.getInstance("SHA").digest(s.getBytes());
} catch (Throwable t) {
FFDCFilter.processException(t, "com.ibm.ws.transaction.createApplicationId", "608", this);
String tempStr = "j" + (System.currentTimeMillis() % 9997) + ":" + userDir + hostName;
result = tempStr.getBytes();
}
if (traceOn && tc.isEntryEnabled())
Tr.exit(tc, "createApplicationId", Util.toHexString(result));
return result;
} | [
"private",
"byte",
"[",
"]",
"createApplicationId",
"(",
"String",
"userDir",
",",
"String",
"serverName",
",",
"String",
"hostName",
")",
"{",
"final",
"boolean",
"traceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"createApplicationId\"",
",",
"new",
"Object",
"[",
"]",
"{",
"userDir",
",",
"serverName",
",",
"hostName",
"}",
")",
";",
"byte",
"[",
"]",
"result",
";",
"try",
"{",
"// tWAS - Create a dummy IOR based on this host's IP address and server's port",
"// tWAS - Note: the object must be remoteable, so use Current as an example.",
"// tWAS - String s = CORBAUtils.getORB().object_to_string(CurrentImpl.instance());",
"// On Liberty concatenate the user directory, the server name and the host name. Then add in the time.",
"String",
"s",
"=",
"userDir",
"+",
"serverName",
"+",
"hostName",
"+",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"// Create a 20-byte hash value using a secure one-way hash function",
"result",
"=",
"java",
".",
"security",
".",
"MessageDigest",
".",
"getInstance",
"(",
"\"SHA\"",
")",
".",
"digest",
"(",
"s",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"t",
",",
"\"com.ibm.ws.transaction.createApplicationId\"",
",",
"\"608\"",
",",
"this",
")",
";",
"String",
"tempStr",
"=",
"\"j\"",
"+",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"%",
"9997",
")",
"+",
"\":\"",
"+",
"userDir",
"+",
"hostName",
";",
"result",
"=",
"tempStr",
".",
"getBytes",
"(",
")",
";",
"}",
"if",
"(",
"traceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"createApplicationId\"",
",",
"Util",
".",
"toHexString",
"(",
"result",
")",
")",
";",
"return",
"result",
";",
"}"
] | Returns an application identifier key which can be used as a unique component
within the global identifier and branch qualifier of an XID.
This method is derived from tWAS
@param name The server name.
@return The application identifier key. | [
"Returns",
"an",
"application",
"identifier",
"key",
"which",
"can",
"be",
"used",
"as",
"a",
"unique",
"component",
"within",
"the",
"global",
"identifier",
"and",
"branch",
"qualifier",
"of",
"an",
"XID",
".",
"This",
"method",
"is",
"derived",
"from",
"tWAS"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction/src/com/ibm/ws/transaction/services/TransactionManagerService.java#L484-L507 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java | JPAEMPool.createEntityManager | @Override
public EntityManager createEntityManager()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "createEntityManager : " + this);
EntityManager em = getEntityManager(false, false);
JPAPooledEntityManager pem = new JPAPooledEntityManager(this, em, ivAbstractJpaComponent, true);
return pem;
} | java | @Override
public EntityManager createEntityManager()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "createEntityManager : " + this);
EntityManager em = getEntityManager(false, false);
JPAPooledEntityManager pem = new JPAPooledEntityManager(this, em, ivAbstractJpaComponent, true);
return pem;
} | [
"@",
"Override",
"public",
"EntityManager",
"createEntityManager",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"createEntityManager : \"",
"+",
"this",
")",
";",
"EntityManager",
"em",
"=",
"getEntityManager",
"(",
"false",
",",
"false",
")",
";",
"JPAPooledEntityManager",
"pem",
"=",
"new",
"JPAPooledEntityManager",
"(",
"this",
",",
"em",
",",
"ivAbstractJpaComponent",
",",
"true",
")",
";",
"return",
"pem",
";",
"}"
] | Gets entity manager from pool and wraps it in an invocation type aware,
enlistment capable em. | [
"Gets",
"entity",
"manager",
"from",
"pool",
"and",
"wraps",
"it",
"in",
"an",
"invocation",
"type",
"aware",
"enlistment",
"capable",
"em",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java#L262-L271 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java | JPAEMPool.createEntityManager | @Override
public EntityManager createEntityManager(Map arg0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "createEntityManager : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | java | @Override
public EntityManager createEntityManager(Map arg0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "createEntityManager : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | [
"@",
"Override",
"public",
"EntityManager",
"createEntityManager",
"(",
"Map",
"arg0",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"createEntityManager : \"",
"+",
"this",
")",
";",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"This operation is not supported on a pooling EntityManagerFactory.\"",
")",
";",
"}"
] | Pooled entity managers have their properties already defined. A
provider exploiting the pool cannot use this method.
@throws UnsupportedOperationException | [
"Pooled",
"entity",
"managers",
"have",
"their",
"properties",
"already",
"defined",
".",
"A",
"provider",
"exploiting",
"the",
"pool",
"cannot",
"use",
"this",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java#L279-L285 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java | JPAEMPool.getCache | @Override
public Cache getCache()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getCache : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | java | @Override
public Cache getCache()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getCache : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | [
"@",
"Override",
"public",
"Cache",
"getCache",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getCache : \"",
"+",
"this",
")",
";",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"This operation is not supported on a pooling EntityManagerFactory.\"",
")",
";",
"}"
] | Prohibit access to the cache via the pool.
@throws UnsupportedOperationException | [
"Prohibit",
"access",
"to",
"the",
"cache",
"via",
"the",
"pool",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java#L292-L298 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java | JPAEMPool.getCriteriaBuilder | @Override
public CriteriaBuilder getCriteriaBuilder()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getCriteriaBuilder : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | java | @Override
public CriteriaBuilder getCriteriaBuilder()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getCriteriaBuilder : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | [
"@",
"Override",
"public",
"CriteriaBuilder",
"getCriteriaBuilder",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getCriteriaBuilder : \"",
"+",
"this",
")",
";",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"This operation is not supported on a pooling EntityManagerFactory.\"",
")",
";",
"}"
] | Prohibit access to the criteria builder via the pool.
@throws UnsupportedOperationException | [
"Prohibit",
"access",
"to",
"the",
"criteria",
"builder",
"via",
"the",
"pool",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java#L305-L311 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java | JPAEMPool.getMetamodel | @Override
public Metamodel getMetamodel()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getMetamodel : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | java | @Override
public Metamodel getMetamodel()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getMetamodel : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | [
"@",
"Override",
"public",
"Metamodel",
"getMetamodel",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getMetamodel : \"",
"+",
"this",
")",
";",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"This operation is not supported on a pooling EntityManagerFactory.\"",
")",
";",
"}"
] | Prohibit access to the metamodel via the pool.
@throws UnsupportedOperationException | [
"Prohibit",
"access",
"to",
"the",
"metamodel",
"via",
"the",
"pool",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java#L318-L324 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java | JPAEMPool.getPersistenceUnitUtil | @Override
public PersistenceUnitUtil getPersistenceUnitUtil()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getPersistenceUnitUtil : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | java | @Override
public PersistenceUnitUtil getPersistenceUnitUtil()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getPersistenceUnitUtil : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | [
"@",
"Override",
"public",
"PersistenceUnitUtil",
"getPersistenceUnitUtil",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getPersistenceUnitUtil : \"",
"+",
"this",
")",
";",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"This operation is not supported on a pooling EntityManagerFactory.\"",
")",
";",
"}"
] | Prohibit access to the persistence unit util via the pool.
@throws UnsupportedOperationException | [
"Prohibit",
"access",
"to",
"the",
"persistence",
"unit",
"util",
"via",
"the",
"pool",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java#L331-L337 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java | JPAEMPool.getProperties | @Override
public Map<String, Object> getProperties()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getProperties : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | java | @Override
public Map<String, Object> getProperties()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getProperties : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getProperties",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getProperties : \"",
"+",
"this",
")",
";",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"This operation is not supported on a pooling EntityManagerFactory.\"",
")",
";",
"}"
] | Prohibit access to factory properties via the pool.
@throws UnsupportedOperationException | [
"Prohibit",
"access",
"to",
"factory",
"properties",
"via",
"the",
"pool",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java#L344-L350 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSC100ReadCallback.java | HttpOSC100ReadCallback.complete | public void complete(VirtualConnection vc, TCPReadRequestContext rsc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "complete() called: vc=" + vc);
}
HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
// keep reading and handling new data until either we're done
// parsing headers or until we're waiting on a read to finish
// Note: parseMessage will allocate the read buffers
boolean rc = false;
while (!rc && null != vc) {
rc = handleNewData(mySC, vc);
// if we're not done parsing, then read more data
if (!rc) {
// read whatever is available
vc = rsc.read(1, this, false, mySC.getReadTimeout());
}
}
// if rc is false, then this callback will be used later on when
// the read completes, otherwise check the status code from the
// response message
if (rc) {
StatusCodes status = mySC.getResponse().getStatusCode();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "100-continue scenario received " + status);
}
if (status.equals(StatusCodes.CONTINUE)) {
// got the 100-continue
mySC.resetRead();
mySC.getAppWriteCallback().complete(vc);
} else {
// anything else, pass along the ExpectationFailedException
mySC.setPersistent(false);
mySC.getAppWriteCallback().error(vc, new ExpectationFailedException(status.getIntCode() + " " + mySC.getResponse().getReasonPhrase()));
}
}
} | java | public void complete(VirtualConnection vc, TCPReadRequestContext rsc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "complete() called: vc=" + vc);
}
HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
// keep reading and handling new data until either we're done
// parsing headers or until we're waiting on a read to finish
// Note: parseMessage will allocate the read buffers
boolean rc = false;
while (!rc && null != vc) {
rc = handleNewData(mySC, vc);
// if we're not done parsing, then read more data
if (!rc) {
// read whatever is available
vc = rsc.read(1, this, false, mySC.getReadTimeout());
}
}
// if rc is false, then this callback will be used later on when
// the read completes, otherwise check the status code from the
// response message
if (rc) {
StatusCodes status = mySC.getResponse().getStatusCode();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "100-continue scenario received " + status);
}
if (status.equals(StatusCodes.CONTINUE)) {
// got the 100-continue
mySC.resetRead();
mySC.getAppWriteCallback().complete(vc);
} else {
// anything else, pass along the ExpectationFailedException
mySC.setPersistent(false);
mySC.getAppWriteCallback().error(vc, new ExpectationFailedException(status.getIntCode() + " " + mySC.getResponse().getReasonPhrase()));
}
}
} | [
"public",
"void",
"complete",
"(",
"VirtualConnection",
"vc",
",",
"TCPReadRequestContext",
"rsc",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"complete() called: vc=\"",
"+",
"vc",
")",
";",
"}",
"HttpOutboundServiceContextImpl",
"mySC",
"=",
"(",
"HttpOutboundServiceContextImpl",
")",
"vc",
".",
"getStateMap",
"(",
")",
".",
"get",
"(",
"CallbackIDs",
".",
"CALLBACK_HTTPOSC",
")",
";",
"// keep reading and handling new data until either we're done",
"// parsing headers or until we're waiting on a read to finish",
"// Note: parseMessage will allocate the read buffers",
"boolean",
"rc",
"=",
"false",
";",
"while",
"(",
"!",
"rc",
"&&",
"null",
"!=",
"vc",
")",
"{",
"rc",
"=",
"handleNewData",
"(",
"mySC",
",",
"vc",
")",
";",
"// if we're not done parsing, then read more data",
"if",
"(",
"!",
"rc",
")",
"{",
"// read whatever is available",
"vc",
"=",
"rsc",
".",
"read",
"(",
"1",
",",
"this",
",",
"false",
",",
"mySC",
".",
"getReadTimeout",
"(",
")",
")",
";",
"}",
"}",
"// if rc is false, then this callback will be used later on when",
"// the read completes, otherwise check the status code from the",
"// response message",
"if",
"(",
"rc",
")",
"{",
"StatusCodes",
"status",
"=",
"mySC",
".",
"getResponse",
"(",
")",
".",
"getStatusCode",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"100-continue scenario received \"",
"+",
"status",
")",
";",
"}",
"if",
"(",
"status",
".",
"equals",
"(",
"StatusCodes",
".",
"CONTINUE",
")",
")",
"{",
"// got the 100-continue",
"mySC",
".",
"resetRead",
"(",
")",
";",
"mySC",
".",
"getAppWriteCallback",
"(",
")",
".",
"complete",
"(",
"vc",
")",
";",
"}",
"else",
"{",
"// anything else, pass along the ExpectationFailedException",
"mySC",
".",
"setPersistent",
"(",
"false",
")",
";",
"mySC",
".",
"getAppWriteCallback",
"(",
")",
".",
"error",
"(",
"vc",
",",
"new",
"ExpectationFailedException",
"(",
"status",
".",
"getIntCode",
"(",
")",
"+",
"\" \"",
"+",
"mySC",
".",
"getResponse",
"(",
")",
".",
"getReasonPhrase",
"(",
")",
")",
")",
";",
"}",
"}",
"}"
] | When the response has been received, we need to parse the status line
and verify that it was the "100 Continue". If it was, then pass along
the notification to the application channel. If it was anything else,
then pass an error up to the application channel using the specific
Expectation-Failed exception.
@param vc
@param rsc | [
"When",
"the",
"response",
"has",
"been",
"received",
"we",
"need",
"to",
"parse",
"the",
"status",
"line",
"and",
"verify",
"that",
"it",
"was",
"the",
"100",
"Continue",
".",
"If",
"it",
"was",
"then",
"pass",
"along",
"the",
"notification",
"to",
"the",
"application",
"channel",
".",
"If",
"it",
"was",
"anything",
"else",
"then",
"pass",
"an",
"error",
"up",
"to",
"the",
"application",
"channel",
"using",
"the",
"specific",
"Expectation",
"-",
"Failed",
"exception",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSC100ReadCallback.java#L89-L126 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSC100ReadCallback.java | HttpOSC100ReadCallback.error | public void error(VirtualConnection vc, TCPReadRequestContext rsc, IOException ioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "error() called: vc=" + vc + " ioe=" + ioe);
}
HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
mySC.setPersistent(false);
mySC.reConnect(vc, ioe);
} | java | public void error(VirtualConnection vc, TCPReadRequestContext rsc, IOException ioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "error() called: vc=" + vc + " ioe=" + ioe);
}
HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
mySC.setPersistent(false);
mySC.reConnect(vc, ioe);
} | [
"public",
"void",
"error",
"(",
"VirtualConnection",
"vc",
",",
"TCPReadRequestContext",
"rsc",
",",
"IOException",
"ioe",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"error() called: vc=\"",
"+",
"vc",
"+",
"\" ioe=\"",
"+",
"ioe",
")",
";",
"}",
"HttpOutboundServiceContextImpl",
"mySC",
"=",
"(",
"HttpOutboundServiceContextImpl",
")",
"vc",
".",
"getStateMap",
"(",
")",
".",
"get",
"(",
"CallbackIDs",
".",
"CALLBACK_HTTPOSC",
")",
";",
"mySC",
".",
"setPersistent",
"(",
"false",
")",
";",
"mySC",
".",
"reConnect",
"(",
"vc",
",",
"ioe",
")",
";",
"}"
] | Triggered when an error occurs during the read.
@param vc
@param rsc
@param ioe | [
"Triggered",
"when",
"an",
"error",
"occurs",
"during",
"the",
"read",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSC100ReadCallback.java#L135-L143 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/filter/WebAppFilterChain.java | WebAppFilterChain.doFilter | public void doFilter(ServletRequest request, ServletResponse response) throws ServletException, IOException {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "entry");
try {
// if there are no filters, just invoke the requested servlet
if (!_filtersDefined) {
invokeTarget(request, response);
}
else {
// increment the filter index
_currentFilterIndex++;
if (_currentFilterIndex < _numberOfFilters) {
// more filters to go...invoke the next one
FilterInstanceWrapper wrapper = ((FilterInstanceWrapper) _filters.get(_currentFilterIndex));
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ //306998.15
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "executing filter -->" + wrapper.getFilterName());
}
wrapper.doFilter(request, response, this);
}
else {
invokeTarget(request, response);
}
}
}
catch (UnavailableException e) {
throw e;
}
catch (IOException ioe) {
throw ioe;
}
catch (ServletException e) {
Throwable t = e.getCause();
if (t!=null && t instanceof FileNotFoundException) {
//don't log a FFDC
logger.logp(Level.FINE, CLASS_NAME, "doFilter", "FileNotFound");
}
else{
//start 140014
if(webapp.getDestroyed() != true)
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, "com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter", "82", this);
else if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "Can not invoke filter because application is destroyed", e);
//end 140014
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "exit");
throw e;
}
catch (RuntimeException re) {
throw re;
}
catch (Throwable th) {
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(th, "com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter", "89", this);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "exit");
throw new ServletErrorReport(th);
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "exit");
} | java | public void doFilter(ServletRequest request, ServletResponse response) throws ServletException, IOException {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "entry");
try {
// if there are no filters, just invoke the requested servlet
if (!_filtersDefined) {
invokeTarget(request, response);
}
else {
// increment the filter index
_currentFilterIndex++;
if (_currentFilterIndex < _numberOfFilters) {
// more filters to go...invoke the next one
FilterInstanceWrapper wrapper = ((FilterInstanceWrapper) _filters.get(_currentFilterIndex));
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ //306998.15
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "executing filter -->" + wrapper.getFilterName());
}
wrapper.doFilter(request, response, this);
}
else {
invokeTarget(request, response);
}
}
}
catch (UnavailableException e) {
throw e;
}
catch (IOException ioe) {
throw ioe;
}
catch (ServletException e) {
Throwable t = e.getCause();
if (t!=null && t instanceof FileNotFoundException) {
//don't log a FFDC
logger.logp(Level.FINE, CLASS_NAME, "doFilter", "FileNotFound");
}
else{
//start 140014
if(webapp.getDestroyed() != true)
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, "com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter", "82", this);
else if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "Can not invoke filter because application is destroyed", e);
//end 140014
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "exit");
throw e;
}
catch (RuntimeException re) {
throw re;
}
catch (Throwable th) {
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(th, "com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter", "89", this);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "exit");
throw new ServletErrorReport(th);
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"doFilter", "exit");
} | [
"public",
"void",
"doFilter",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"doFilter\"",
",",
"\"entry\"",
")",
";",
"try",
"{",
"// if there are no filters, just invoke the requested servlet",
"if",
"(",
"!",
"_filtersDefined",
")",
"{",
"invokeTarget",
"(",
"request",
",",
"response",
")",
";",
"}",
"else",
"{",
"// increment the filter index",
"_currentFilterIndex",
"++",
";",
"if",
"(",
"_currentFilterIndex",
"<",
"_numberOfFilters",
")",
"{",
"// more filters to go...invoke the next one",
"FilterInstanceWrapper",
"wrapper",
"=",
"(",
"(",
"FilterInstanceWrapper",
")",
"_filters",
".",
"get",
"(",
"_currentFilterIndex",
")",
")",
";",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"//306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"doFilter\"",
",",
"\"executing filter -->\"",
"+",
"wrapper",
".",
"getFilterName",
"(",
")",
")",
";",
"}",
"wrapper",
".",
"doFilter",
"(",
"request",
",",
"response",
",",
"this",
")",
";",
"}",
"else",
"{",
"invokeTarget",
"(",
"request",
",",
"response",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"UnavailableException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"ioe",
";",
"}",
"catch",
"(",
"ServletException",
"e",
")",
"{",
"Throwable",
"t",
"=",
"e",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"t",
"!=",
"null",
"&&",
"t",
"instanceof",
"FileNotFoundException",
")",
"{",
"//don't log a FFDC",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"doFilter\"",
",",
"\"FileNotFound\"",
")",
";",
"}",
"else",
"{",
"//start 140014",
"if",
"(",
"webapp",
".",
"getDestroyed",
"(",
")",
"!=",
"true",
")",
"com",
".",
"ibm",
".",
"wsspi",
".",
"webcontainer",
".",
"util",
".",
"FFDCWrapper",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter\"",
",",
"\"82\"",
",",
"this",
")",
";",
"else",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"doFilter\"",
",",
"\"Can not invoke filter because application is destroyed\"",
",",
"e",
")",
";",
"//end 140014",
"}",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"doFilter\"",
",",
"\"exit\"",
")",
";",
"throw",
"e",
";",
"}",
"catch",
"(",
"RuntimeException",
"re",
")",
"{",
"throw",
"re",
";",
"}",
"catch",
"(",
"Throwable",
"th",
")",
"{",
"com",
".",
"ibm",
".",
"wsspi",
".",
"webcontainer",
".",
"util",
".",
"FFDCWrapper",
".",
"processException",
"(",
"th",
",",
"\"com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter\"",
",",
"\"89\"",
",",
"this",
")",
";",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"doFilter\"",
",",
"\"exit\"",
")",
";",
"throw",
"new",
"ServletErrorReport",
"(",
"th",
")",
";",
"}",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"doFilter\"",
",",
"\"exit\"",
")",
";",
"}"
] | Causes the next filter in the chain to be invoked, or, if at the end
of the chain, causes the requested resource to be invoked
@return a String containing the filter name | [
"Causes",
"the",
"next",
"filter",
"in",
"the",
"chain",
"to",
"be",
"invoked",
"or",
"if",
"at",
"the",
"end",
"of",
"the",
"chain",
"causes",
"the",
"requested",
"resource",
"to",
"be",
"invoked"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/filter/WebAppFilterChain.java#L71-L134 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/JcaServiceUtilities.java | JcaServiceUtilities.beginContextClassLoader | public ClassLoader beginContextClassLoader(ClassLoader raClassLoader) {
return raClassLoader == null ? null
: AccessController.doPrivileged(new GetAndSetContextClassLoader(raClassLoader));
} | java | public ClassLoader beginContextClassLoader(ClassLoader raClassLoader) {
return raClassLoader == null ? null
: AccessController.doPrivileged(new GetAndSetContextClassLoader(raClassLoader));
} | [
"public",
"ClassLoader",
"beginContextClassLoader",
"(",
"ClassLoader",
"raClassLoader",
")",
"{",
"return",
"raClassLoader",
"==",
"null",
"?",
"null",
":",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"GetAndSetContextClassLoader",
"(",
"raClassLoader",
")",
")",
";",
"}"
] | Set context classloader to the one for the resource adapter
@param raClassLoader
@return the current classloader | [
"Set",
"context",
"classloader",
"to",
"the",
"one",
"for",
"the",
"resource",
"adapter"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/JcaServiceUtilities.java#L25-L28 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/JcaServiceUtilities.java | JcaServiceUtilities.endContextClassLoader | public void endContextClassLoader(ClassLoader raClassLoader, ClassLoader previousClassLoader) {
if (raClassLoader != null) {
AccessController.doPrivileged(new GetAndSetContextClassLoader(previousClassLoader));
}
} | java | public void endContextClassLoader(ClassLoader raClassLoader, ClassLoader previousClassLoader) {
if (raClassLoader != null) {
AccessController.doPrivileged(new GetAndSetContextClassLoader(previousClassLoader));
}
} | [
"public",
"void",
"endContextClassLoader",
"(",
"ClassLoader",
"raClassLoader",
",",
"ClassLoader",
"previousClassLoader",
")",
"{",
"if",
"(",
"raClassLoader",
"!=",
"null",
")",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"GetAndSetContextClassLoader",
"(",
"previousClassLoader",
")",
")",
";",
"}",
"}"
] | Restore current context class loader saved when the context class loader was set to the one
for the resource adapter.
@param raClassLoader
@param previousClassLoader | [
"Restore",
"current",
"context",
"class",
"loader",
"saved",
"when",
"the",
"context",
"class",
"loader",
"was",
"set",
"to",
"the",
"one",
"for",
"the",
"resource",
"adapter",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/JcaServiceUtilities.java#L37-L41 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionType.java | ConnectionType.getVCConnectionType | public static ConnectionType getVCConnectionType(VirtualConnection vc) {
if (vc == null) {
return null;
}
return (ConnectionType) vc.getStateMap().get(CONNECTION_TYPE_VC_KEY);
} | java | public static ConnectionType getVCConnectionType(VirtualConnection vc) {
if (vc == null) {
return null;
}
return (ConnectionType) vc.getStateMap().get(CONNECTION_TYPE_VC_KEY);
} | [
"public",
"static",
"ConnectionType",
"getVCConnectionType",
"(",
"VirtualConnection",
"vc",
")",
"{",
"if",
"(",
"vc",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"(",
"ConnectionType",
")",
"vc",
".",
"getStateMap",
"(",
")",
".",
"get",
"(",
"CONNECTION_TYPE_VC_KEY",
")",
";",
"}"
] | Get the connection type from the virtual connection.
@param vc
@return ConnectionType | [
"Get",
"the",
"connection",
"type",
"from",
"the",
"virtual",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionType.java#L34-L39 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionType.java | ConnectionType.setVCConnectionType | public static void setVCConnectionType(VirtualConnection vc, ConnectionType connType) {
if (vc == null || connType == null) {
return;
}
Map<Object, Object> map = vc.getStateMap();
// Internal connections are both inbound and outbound (they're connections
// to ourselves)
// so while we prevent setting Outbound ConnTypes for inbound connections
// and vice versa,
// we don't prevent internal types from being set as either.
if (vc instanceof InboundVirtualConnection && ConnectionType.isOutbound(connType.type)) {
throw new IllegalStateException("Cannot set outbound ConnectionType on inbound VirtualConnection");
} else if (vc instanceof OutboundVirtualConnection && ConnectionType.isInbound(connType.type)) {
throw new IllegalStateException("Cannot set inbound ConnectionType on outbound VirtualConnection");
}
map.put(CONNECTION_TYPE_VC_KEY, connType);
} | java | public static void setVCConnectionType(VirtualConnection vc, ConnectionType connType) {
if (vc == null || connType == null) {
return;
}
Map<Object, Object> map = vc.getStateMap();
// Internal connections are both inbound and outbound (they're connections
// to ourselves)
// so while we prevent setting Outbound ConnTypes for inbound connections
// and vice versa,
// we don't prevent internal types from being set as either.
if (vc instanceof InboundVirtualConnection && ConnectionType.isOutbound(connType.type)) {
throw new IllegalStateException("Cannot set outbound ConnectionType on inbound VirtualConnection");
} else if (vc instanceof OutboundVirtualConnection && ConnectionType.isInbound(connType.type)) {
throw new IllegalStateException("Cannot set inbound ConnectionType on outbound VirtualConnection");
}
map.put(CONNECTION_TYPE_VC_KEY, connType);
} | [
"public",
"static",
"void",
"setVCConnectionType",
"(",
"VirtualConnection",
"vc",
",",
"ConnectionType",
"connType",
")",
"{",
"if",
"(",
"vc",
"==",
"null",
"||",
"connType",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Map",
"<",
"Object",
",",
"Object",
">",
"map",
"=",
"vc",
".",
"getStateMap",
"(",
")",
";",
"// Internal connections are both inbound and outbound (they're connections",
"// to ourselves)",
"// so while we prevent setting Outbound ConnTypes for inbound connections",
"// and vice versa,",
"// we don't prevent internal types from being set as either.",
"if",
"(",
"vc",
"instanceof",
"InboundVirtualConnection",
"&&",
"ConnectionType",
".",
"isOutbound",
"(",
"connType",
".",
"type",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot set outbound ConnectionType on inbound VirtualConnection\"",
")",
";",
"}",
"else",
"if",
"(",
"vc",
"instanceof",
"OutboundVirtualConnection",
"&&",
"ConnectionType",
".",
"isInbound",
"(",
"connType",
".",
"type",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot set inbound ConnectionType on outbound VirtualConnection\"",
")",
";",
"}",
"map",
".",
"put",
"(",
"CONNECTION_TYPE_VC_KEY",
",",
"connType",
")",
";",
"}"
] | Set the connection type on the virtual connection. This will overlay
any preset value.
@param vc
VirtualConnection containing simple state for this connection
@param connType
ConnectionType for the VirtualConnection | [
"Set",
"the",
"connection",
"type",
"on",
"the",
"virtual",
"connection",
".",
"This",
"will",
"overlay",
"any",
"preset",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionType.java#L50-L69 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionType.java | ConnectionType.getConnectionType | public static ConnectionType getConnectionType(byte type) {
switch (type) {
case TYPE_OUTBOUND:
return OUTBOUND;
case TYPE_OUTBOUND_CR_TO_REMOTE:
return OUTBOUND_CR_TO_REMOTE;
case TYPE_OUTBOUND_SR_TO_CR_REMOTE:
return OUTBOUND_SR_TO_CR_REMOTE;
case TYPE_INBOUND:
return INBOUND;
case TYPE_INBOUND_CR:
return INBOUND_CR;
case TYPE_INTERNAL_CR_SR:
return INTERNAL_CR_SR;
}
return null;
} | java | public static ConnectionType getConnectionType(byte type) {
switch (type) {
case TYPE_OUTBOUND:
return OUTBOUND;
case TYPE_OUTBOUND_CR_TO_REMOTE:
return OUTBOUND_CR_TO_REMOTE;
case TYPE_OUTBOUND_SR_TO_CR_REMOTE:
return OUTBOUND_SR_TO_CR_REMOTE;
case TYPE_INBOUND:
return INBOUND;
case TYPE_INBOUND_CR:
return INBOUND_CR;
case TYPE_INTERNAL_CR_SR:
return INTERNAL_CR_SR;
}
return null;
} | [
"public",
"static",
"ConnectionType",
"getConnectionType",
"(",
"byte",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"TYPE_OUTBOUND",
":",
"return",
"OUTBOUND",
";",
"case",
"TYPE_OUTBOUND_CR_TO_REMOTE",
":",
"return",
"OUTBOUND_CR_TO_REMOTE",
";",
"case",
"TYPE_OUTBOUND_SR_TO_CR_REMOTE",
":",
"return",
"OUTBOUND_SR_TO_CR_REMOTE",
";",
"case",
"TYPE_INBOUND",
":",
"return",
"INBOUND",
";",
"case",
"TYPE_INBOUND_CR",
":",
"return",
"INBOUND_CR",
";",
"case",
"TYPE_INTERNAL_CR_SR",
":",
"return",
"INTERNAL_CR_SR",
";",
"}",
"return",
"null",
";",
"}"
] | Set the connection type on the virtual connection.
@param type
ConnectionType for the VirtualConnection
@return ConnectionType | [
"Set",
"the",
"connection",
"type",
"on",
"the",
"virtual",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionType.java#L134-L153 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.asInt | static public int asInt(byte[] array) {
if (null == array || 4 != array.length) {
throw new IllegalArgumentException("Length of the byte array should be 4");
}
return ((array[0] << 24)
+ ((array[1] & 255) << 16)
+ ((array[2] & 255) << 8) + (array[3] & 255));
} | java | static public int asInt(byte[] array) {
if (null == array || 4 != array.length) {
throw new IllegalArgumentException("Length of the byte array should be 4");
}
return ((array[0] << 24)
+ ((array[1] & 255) << 16)
+ ((array[2] & 255) << 8) + (array[3] & 255));
} | [
"static",
"public",
"int",
"asInt",
"(",
"byte",
"[",
"]",
"array",
")",
"{",
"if",
"(",
"null",
"==",
"array",
"||",
"4",
"!=",
"array",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Length of the byte array should be 4\"",
")",
";",
"}",
"return",
"(",
"(",
"array",
"[",
"0",
"]",
"<<",
"24",
")",
"+",
"(",
"(",
"array",
"[",
"1",
"]",
"&",
"255",
")",
"<<",
"16",
")",
"+",
"(",
"(",
"array",
"[",
"2",
"]",
"&",
"255",
")",
"<<",
"8",
")",
"+",
"(",
"array",
"[",
"3",
"]",
"&",
"255",
")",
")",
";",
"}"
] | Takes an array of 4 bytes and returns an integer that is
represented by them.
@param array
@return int that represents the 4 bytes
@throws IllegalArgumentException for invalid arguments | [
"Takes",
"an",
"array",
"of",
"4",
"bytes",
"and",
"returns",
"an",
"integer",
"that",
"is",
"represented",
"by",
"them",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L320-L329 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.asBytes | static public byte[] asBytes(int value) {
if (0 > value) {
throw new IllegalArgumentException("value cannot be less than zero");
}
byte[] result = new byte[4];
result[0] = (byte) ((value >>> 24) & 0xFF);
result[1] = (byte) ((value >>> 16) & 0xFF);
result[2] = (byte) ((value >>> 8) & 0xFF);
result[3] = (byte) ((value) & 0xFF);
return result;
} | java | static public byte[] asBytes(int value) {
if (0 > value) {
throw new IllegalArgumentException("value cannot be less than zero");
}
byte[] result = new byte[4];
result[0] = (byte) ((value >>> 24) & 0xFF);
result[1] = (byte) ((value >>> 16) & 0xFF);
result[2] = (byte) ((value >>> 8) & 0xFF);
result[3] = (byte) ((value) & 0xFF);
return result;
} | [
"static",
"public",
"byte",
"[",
"]",
"asBytes",
"(",
"int",
"value",
")",
"{",
"if",
"(",
"0",
">",
"value",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"value cannot be less than zero\"",
")",
";",
"}",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"result",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"value",
">>>",
"24",
")",
"&",
"0xFF",
")",
";",
"result",
"[",
"1",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"value",
">>>",
"16",
")",
"&",
"0xFF",
")",
";",
"result",
"[",
"2",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"value",
">>>",
"8",
")",
"&",
"0xFF",
")",
";",
"result",
"[",
"3",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"value",
")",
"&",
"0xFF",
")",
";",
"return",
"result",
";",
"}"
] | Returns an array of 4 bytes that represent the integer.
@param value the integer
@return the 4 byte array
@throws IllegalArgumentException if the argument is less than 0 | [
"Returns",
"an",
"array",
"of",
"4",
"bytes",
"that",
"represent",
"the",
"integer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L513-L525 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.getEnglishString | static public String getEnglishString(WsByteBuffer[] list) {
if (null == list) {
return null;
}
int size = 0;
int i;
for (i = 0; i < list.length && null != list[i]; i++) {
size += list[i].remaining();
}
if (0 == size) {
return null;
}
byte[] value = new byte[size];
int offset = 0;
for (int x = 0; x < i; x++) {
size = list[x].remaining();
list[x].get(value, offset, size);
offset += size;
list[x].position(0);
}
return getEnglishString(value);
} | java | static public String getEnglishString(WsByteBuffer[] list) {
if (null == list) {
return null;
}
int size = 0;
int i;
for (i = 0; i < list.length && null != list[i]; i++) {
size += list[i].remaining();
}
if (0 == size) {
return null;
}
byte[] value = new byte[size];
int offset = 0;
for (int x = 0; x < i; x++) {
size = list[x].remaining();
list[x].get(value, offset, size);
offset += size;
list[x].position(0);
}
return getEnglishString(value);
} | [
"static",
"public",
"String",
"getEnglishString",
"(",
"WsByteBuffer",
"[",
"]",
"list",
")",
"{",
"if",
"(",
"null",
"==",
"list",
")",
"{",
"return",
"null",
";",
"}",
"int",
"size",
"=",
"0",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"length",
"&&",
"null",
"!=",
"list",
"[",
"i",
"]",
";",
"i",
"++",
")",
"{",
"size",
"+=",
"list",
"[",
"i",
"]",
".",
"remaining",
"(",
")",
";",
"}",
"if",
"(",
"0",
"==",
"size",
")",
"{",
"return",
"null",
";",
"}",
"byte",
"[",
"]",
"value",
"=",
"new",
"byte",
"[",
"size",
"]",
";",
"int",
"offset",
"=",
"0",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"i",
";",
"x",
"++",
")",
"{",
"size",
"=",
"list",
"[",
"x",
"]",
".",
"remaining",
"(",
")",
";",
"list",
"[",
"x",
"]",
".",
"get",
"(",
"value",
",",
"offset",
",",
"size",
")",
";",
"offset",
"+=",
"size",
";",
"list",
"[",
"x",
"]",
".",
"position",
"(",
"0",
")",
";",
"}",
"return",
"getEnglishString",
"(",
"value",
")",
";",
"}"
] | Utility method to take a list of buffers and convert their data into
an English encoded string. These buffers are expected to be flipped
already, in that position is 0 and limit is the end of data in each
one.
@param list
@return String (null if input is null or no data is present in them) | [
"Utility",
"method",
"to",
"take",
"a",
"list",
"of",
"buffers",
"and",
"convert",
"their",
"data",
"into",
"an",
"English",
"encoded",
"string",
".",
"These",
"buffers",
"are",
"expected",
"to",
"be",
"flipped",
"already",
"in",
"that",
"position",
"is",
"0",
"and",
"limit",
"is",
"the",
"end",
"of",
"data",
"in",
"each",
"one",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L536-L557 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.dumpArrayToTraceLog | static public void dumpArrayToTraceLog(byte[] arr) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "[ ");
if (null == arr) {
Tr.debug(tc, "null");
} else {
for (int i = 0; i < arr.length; i++) {
Tr.debug(tc, arr[i] + " ");
}
}
Tr.debug(tc, "]");
}
} | java | static public void dumpArrayToTraceLog(byte[] arr) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "[ ");
if (null == arr) {
Tr.debug(tc, "null");
} else {
for (int i = 0; i < arr.length; i++) {
Tr.debug(tc, arr[i] + " ");
}
}
Tr.debug(tc, "]");
}
} | [
"static",
"public",
"void",
"dumpArrayToTraceLog",
"(",
"byte",
"[",
"]",
"arr",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"[ \"",
")",
";",
"if",
"(",
"null",
"==",
"arr",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"null\"",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"length",
";",
"i",
"++",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"arr",
"[",
"i",
"]",
"+",
"\" \"",
")",
";",
"}",
"}",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"]\"",
")",
";",
"}",
"}"
] | Writes the contents of the array to the trace log.
@param arr | [
"Writes",
"the",
"contents",
"of",
"the",
"array",
"to",
"the",
"trace",
"log",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L586-L598 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.expandByteArray | static public byte[] expandByteArray(byte[] src, byte[] dst) {
int srcLength = (null != src) ? src.length : 0;
int dstLength = (null != dst) ? dst.length : 0;
return expandByteArray(src, dst, 0, srcLength, 0, dstLength);
} | java | static public byte[] expandByteArray(byte[] src, byte[] dst) {
int srcLength = (null != src) ? src.length : 0;
int dstLength = (null != dst) ? dst.length : 0;
return expandByteArray(src, dst, 0, srcLength, 0, dstLength);
} | [
"static",
"public",
"byte",
"[",
"]",
"expandByteArray",
"(",
"byte",
"[",
"]",
"src",
",",
"byte",
"[",
"]",
"dst",
")",
"{",
"int",
"srcLength",
"=",
"(",
"null",
"!=",
"src",
")",
"?",
"src",
".",
"length",
":",
"0",
";",
"int",
"dstLength",
"=",
"(",
"null",
"!=",
"dst",
")",
"?",
"dst",
".",
"length",
":",
"0",
";",
"return",
"expandByteArray",
"(",
"src",
",",
"dst",
",",
"0",
",",
"srcLength",
",",
"0",
",",
"dstLength",
")",
";",
"}"
] | Generic method to copy the entire length of each buffer.
@param src
@param dst
@return byte[] | [
"Generic",
"method",
"to",
"copy",
"the",
"entire",
"length",
"of",
"each",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L696-L700 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.expandByteArray | static public byte[] expandByteArray(byte[] src, byte b) {
int srcLength = (null != src) ? src.length : 0;
int totalLen = srcLength + 1;
byte[] rc = new byte[totalLen];
try {
if (null != src) {
System.arraycopy(src, 0, rc, 0, srcLength);
}
rc[srcLength] = b;
} catch (Exception e) {
// no FFDC required
// any error from arraycopy, we'll just return null
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception " + e + " while copying.");
}
rc = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc,
"expandByteArray returning: [" + getEnglishString(rc) + "]");
}
return rc;
} | java | static public byte[] expandByteArray(byte[] src, byte b) {
int srcLength = (null != src) ? src.length : 0;
int totalLen = srcLength + 1;
byte[] rc = new byte[totalLen];
try {
if (null != src) {
System.arraycopy(src, 0, rc, 0, srcLength);
}
rc[srcLength] = b;
} catch (Exception e) {
// no FFDC required
// any error from arraycopy, we'll just return null
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception " + e + " while copying.");
}
rc = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc,
"expandByteArray returning: [" + getEnglishString(rc) + "]");
}
return rc;
} | [
"static",
"public",
"byte",
"[",
"]",
"expandByteArray",
"(",
"byte",
"[",
"]",
"src",
",",
"byte",
"b",
")",
"{",
"int",
"srcLength",
"=",
"(",
"null",
"!=",
"src",
")",
"?",
"src",
".",
"length",
":",
"0",
";",
"int",
"totalLen",
"=",
"srcLength",
"+",
"1",
";",
"byte",
"[",
"]",
"rc",
"=",
"new",
"byte",
"[",
"totalLen",
"]",
";",
"try",
"{",
"if",
"(",
"null",
"!=",
"src",
")",
"{",
"System",
".",
"arraycopy",
"(",
"src",
",",
"0",
",",
"rc",
",",
"0",
",",
"srcLength",
")",
";",
"}",
"rc",
"[",
"srcLength",
"]",
"=",
"b",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// no FFDC required",
"// any error from arraycopy, we'll just return null",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Exception \"",
"+",
"e",
"+",
"\" while copying.\"",
")",
";",
"}",
"rc",
"=",
"null",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"expandByteArray returning: [\"",
"+",
"getEnglishString",
"(",
"rc",
")",
"+",
"\"]\"",
")",
";",
"}",
"return",
"rc",
";",
"}"
] | Helper method to append a byte to a byte array.
@param src byte array
@param b byte to be appended to the src byte array
@return target byte array | [
"Helper",
"method",
"to",
"append",
"a",
"byte",
"to",
"a",
"byte",
"array",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L799-L822 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.getBytes | static public byte[] getBytes(StringBuffer data) {
if (null == data) {
return null;
}
int len = data.length();
char[] chars = new char[len];
data.getChars(0, len, chars, 0);
byte[] bytes = new byte[len];
for (int i = 0; i < len; i++) {
bytes[i] = (byte) chars[i];
}
return bytes;
} | java | static public byte[] getBytes(StringBuffer data) {
if (null == data) {
return null;
}
int len = data.length();
char[] chars = new char[len];
data.getChars(0, len, chars, 0);
byte[] bytes = new byte[len];
for (int i = 0; i < len; i++) {
bytes[i] = (byte) chars[i];
}
return bytes;
} | [
"static",
"public",
"byte",
"[",
"]",
"getBytes",
"(",
"StringBuffer",
"data",
")",
"{",
"if",
"(",
"null",
"==",
"data",
")",
"{",
"return",
"null",
";",
"}",
"int",
"len",
"=",
"data",
".",
"length",
"(",
")",
";",
"char",
"[",
"]",
"chars",
"=",
"new",
"char",
"[",
"len",
"]",
";",
"data",
".",
"getChars",
"(",
"0",
",",
"len",
",",
"chars",
",",
"0",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"bytes",
"[",
"i",
"]",
"=",
"(",
"byte",
")",
"chars",
"[",
"i",
"]",
";",
"}",
"return",
"bytes",
";",
"}"
] | Utility method to get the bytes from a StringBuffer. These bytes will
be in whatever encoding was in the original chars put into the string
buffer object.
@param data
@return byte[] | [
"Utility",
"method",
"to",
"get",
"the",
"bytes",
"from",
"a",
"StringBuffer",
".",
"These",
"bytes",
"will",
"be",
"in",
"whatever",
"encoding",
"was",
"in",
"the",
"original",
"chars",
"put",
"into",
"the",
"string",
"buffer",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L832-L844 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.getBytes | static public byte[] getBytes(String input) {
if (null != input) {
int length = input.length();
byte[] output = new byte[length];
for (int i = 0; i < length; i++) {
output[i] = (byte) input.charAt(i);
}
return output;
}
return null;
} | java | static public byte[] getBytes(String input) {
if (null != input) {
int length = input.length();
byte[] output = new byte[length];
for (int i = 0; i < length; i++) {
output[i] = (byte) input.charAt(i);
}
return output;
}
return null;
} | [
"static",
"public",
"byte",
"[",
"]",
"getBytes",
"(",
"String",
"input",
")",
"{",
"if",
"(",
"null",
"!=",
"input",
")",
"{",
"int",
"length",
"=",
"input",
".",
"length",
"(",
")",
";",
"byte",
"[",
"]",
"output",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"output",
"[",
"i",
"]",
"=",
"(",
"byte",
")",
"input",
".",
"charAt",
"(",
"i",
")",
";",
"}",
"return",
"output",
";",
"}",
"return",
"null",
";",
"}"
] | Simple utility to get the bytes from a String but handle a
null String as well.
@param input
@return byte[] | [
"Simple",
"utility",
"to",
"get",
"the",
"bytes",
"from",
"a",
"String",
"but",
"handle",
"a",
"null",
"String",
"as",
"well",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L875-L886 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.getEnglishString | static public String getEnglishString(byte[] data) {
if (null == data) {
return null;
}
char chars[] = new char[data.length];
for (int i = 0; i < data.length; i++) {
chars[i] = (char) (data[i] & 0xff);
}
return new String(chars);
} | java | static public String getEnglishString(byte[] data) {
if (null == data) {
return null;
}
char chars[] = new char[data.length];
for (int i = 0; i < data.length; i++) {
chars[i] = (char) (data[i] & 0xff);
}
return new String(chars);
} | [
"static",
"public",
"String",
"getEnglishString",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"null",
"==",
"data",
")",
"{",
"return",
"null",
";",
"}",
"char",
"chars",
"[",
"]",
"=",
"new",
"char",
"[",
"data",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"chars",
"[",
"i",
"]",
"=",
"(",
"char",
")",
"(",
"data",
"[",
"i",
"]",
"&",
"0xff",
")",
";",
"}",
"return",
"new",
"String",
"(",
"chars",
")",
";",
"}"
] | Utility method to get the ISO English string from the given bytes. If
this an unsupported encoding exception is thrown by the conversion, then
an IllegalArgumentException will be thrown.
@param data
@return String
@exception IllegalArgumentException | [
"Utility",
"method",
"to",
"get",
"the",
"ISO",
"English",
"string",
"from",
"the",
"given",
"bytes",
".",
"If",
"this",
"an",
"unsupported",
"encoding",
"exception",
"is",
"thrown",
"by",
"the",
"conversion",
"then",
"an",
"IllegalArgumentException",
"will",
"be",
"thrown",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L910-L919 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.formatHexData | static private StringBuilder formatHexData(StringBuilder buffer, byte[] data, int inOffset) {
int offset = inOffset;
int end = offset + 8;
if (offset >= data.length) {
// have nothing, just print empty chars
buffer.append(" ");
return buffer;
}
buffer.append(convertHex((0xff & data[offset]) / 16));
buffer.append(convertHex((0xff & data[offset]) % 16));
for (++offset; offset < end; offset++) {
if (offset >= data.length) {
buffer.append(" ");
continue;
}
buffer.append(' ');
buffer.append(convertHex((0xff & data[offset]) / 16));
buffer.append(convertHex((0xff & data[offset]) % 16));
}
return buffer;
} | java | static private StringBuilder formatHexData(StringBuilder buffer, byte[] data, int inOffset) {
int offset = inOffset;
int end = offset + 8;
if (offset >= data.length) {
// have nothing, just print empty chars
buffer.append(" ");
return buffer;
}
buffer.append(convertHex((0xff & data[offset]) / 16));
buffer.append(convertHex((0xff & data[offset]) % 16));
for (++offset; offset < end; offset++) {
if (offset >= data.length) {
buffer.append(" ");
continue;
}
buffer.append(' ');
buffer.append(convertHex((0xff & data[offset]) / 16));
buffer.append(convertHex((0xff & data[offset]) % 16));
}
return buffer;
} | [
"static",
"private",
"StringBuilder",
"formatHexData",
"(",
"StringBuilder",
"buffer",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"inOffset",
")",
"{",
"int",
"offset",
"=",
"inOffset",
";",
"int",
"end",
"=",
"offset",
"+",
"8",
";",
"if",
"(",
"offset",
">=",
"data",
".",
"length",
")",
"{",
"// have nothing, just print empty chars",
"buffer",
".",
"append",
"(",
"\" \"",
")",
";",
"return",
"buffer",
";",
"}",
"buffer",
".",
"append",
"(",
"convertHex",
"(",
"(",
"0xff",
"&",
"data",
"[",
"offset",
"]",
")",
"/",
"16",
")",
")",
";",
"buffer",
".",
"append",
"(",
"convertHex",
"(",
"(",
"0xff",
"&",
"data",
"[",
"offset",
"]",
")",
"%",
"16",
")",
")",
";",
"for",
"(",
"++",
"offset",
";",
"offset",
"<",
"end",
";",
"offset",
"++",
")",
"{",
"if",
"(",
"offset",
">=",
"data",
".",
"length",
")",
"{",
"buffer",
".",
"append",
"(",
"\" \"",
")",
";",
"continue",
";",
"}",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"buffer",
".",
"append",
"(",
"convertHex",
"(",
"(",
"0xff",
"&",
"data",
"[",
"offset",
"]",
")",
"/",
"16",
")",
")",
";",
"buffer",
".",
"append",
"(",
"convertHex",
"(",
"(",
"0xff",
"&",
"data",
"[",
"offset",
"]",
")",
"%",
"16",
")",
")",
";",
"}",
"return",
"buffer",
";",
"}"
] | Format the next 8 bytes of the input data starting from the offset as
2 digit hex characters.
@param buffer
@param data
@param inOffset
@return StringBuilder | [
"Format",
"the",
"next",
"8",
"bytes",
"of",
"the",
"input",
"data",
"starting",
"from",
"the",
"offset",
"as",
"2",
"digit",
"hex",
"characters",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L957-L978 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.formatTextData | static private StringBuilder formatTextData(StringBuilder buffer, byte[] data, int inOffset) {
int offset = inOffset;
int end = offset + 16;
for (; offset < end; offset++) {
if (offset >= data.length) {
buffer.append(" ");
continue;
}
if (Character.isLetterOrDigit(data[offset])) {
buffer.append((char) data[offset]);
} else {
buffer.append('.');
}
}
return buffer;
} | java | static private StringBuilder formatTextData(StringBuilder buffer, byte[] data, int inOffset) {
int offset = inOffset;
int end = offset + 16;
for (; offset < end; offset++) {
if (offset >= data.length) {
buffer.append(" ");
continue;
}
if (Character.isLetterOrDigit(data[offset])) {
buffer.append((char) data[offset]);
} else {
buffer.append('.');
}
}
return buffer;
} | [
"static",
"private",
"StringBuilder",
"formatTextData",
"(",
"StringBuilder",
"buffer",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"inOffset",
")",
"{",
"int",
"offset",
"=",
"inOffset",
";",
"int",
"end",
"=",
"offset",
"+",
"16",
";",
"for",
"(",
";",
"offset",
"<",
"end",
";",
"offset",
"++",
")",
"{",
"if",
"(",
"offset",
">=",
"data",
".",
"length",
")",
"{",
"buffer",
".",
"append",
"(",
"\" \"",
")",
";",
"continue",
";",
"}",
"if",
"(",
"Character",
".",
"isLetterOrDigit",
"(",
"data",
"[",
"offset",
"]",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"(",
"char",
")",
"data",
"[",
"offset",
"]",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"}",
"return",
"buffer",
";",
"}"
] | Format the next 16 bytes of the input data starting from the input offset
as ASCII characters. Non-ASCII bytes will be printed as a period symbol.
@param buffer
@param data
@param inOffset
@return StringBuilder | [
"Format",
"the",
"next",
"16",
"bytes",
"of",
"the",
"input",
"data",
"starting",
"from",
"the",
"input",
"offset",
"as",
"ASCII",
"characters",
".",
"Non",
"-",
"ASCII",
"bytes",
"will",
"be",
"printed",
"as",
"a",
"period",
"symbol",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L989-L1004 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.skipToChar | static public int skipToChar(byte[] data, int start, byte target) {
int index = start;
while (index < data.length && target != data[index]) {
index++;
}
return index;
} | java | static public int skipToChar(byte[] data, int start, byte target) {
int index = start;
while (index < data.length && target != data[index]) {
index++;
}
return index;
} | [
"static",
"public",
"int",
"skipToChar",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
",",
"byte",
"target",
")",
"{",
"int",
"index",
"=",
"start",
";",
"while",
"(",
"index",
"<",
"data",
".",
"length",
"&&",
"target",
"!=",
"data",
"[",
"index",
"]",
")",
"{",
"index",
"++",
";",
"}",
"return",
"index",
";",
"}"
] | Utility method to skip past data in an array until it runs out of space
or finds the target character.
@param data
@param start
@param target
@return int (return index, equals data.length if not found) | [
"Utility",
"method",
"to",
"skip",
"past",
"data",
"in",
"an",
"array",
"until",
"it",
"runs",
"out",
"of",
"space",
"or",
"finds",
"the",
"target",
"character",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L1087-L1093 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.skipToChars | static public int skipToChars(byte[] data, int start, byte[] targets) {
int index = start;
int y = 0;
byte current;
for (; index < data.length; index++) {
current = data[index];
for (y = 0; y < targets.length; y++) {
if (current == targets[y]) {
return index;
}
}
}
return index;
} | java | static public int skipToChars(byte[] data, int start, byte[] targets) {
int index = start;
int y = 0;
byte current;
for (; index < data.length; index++) {
current = data[index];
for (y = 0; y < targets.length; y++) {
if (current == targets[y]) {
return index;
}
}
}
return index;
} | [
"static",
"public",
"int",
"skipToChars",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
",",
"byte",
"[",
"]",
"targets",
")",
"{",
"int",
"index",
"=",
"start",
";",
"int",
"y",
"=",
"0",
";",
"byte",
"current",
";",
"for",
"(",
";",
"index",
"<",
"data",
".",
"length",
";",
"index",
"++",
")",
"{",
"current",
"=",
"data",
"[",
"index",
"]",
";",
"for",
"(",
"y",
"=",
"0",
";",
"y",
"<",
"targets",
".",
"length",
";",
"y",
"++",
")",
"{",
"if",
"(",
"current",
"==",
"targets",
"[",
"y",
"]",
")",
"{",
"return",
"index",
";",
"}",
"}",
"}",
"return",
"index",
";",
"}"
] | Utility method to skip past data in an array until it runs out of space
or finds one of the the target characters.
@param data
@param start
@param targets
@return int (return index, equals data.length if not found) | [
"Utility",
"method",
"to",
"skip",
"past",
"data",
"in",
"an",
"array",
"until",
"it",
"runs",
"out",
"of",
"space",
"or",
"finds",
"one",
"of",
"the",
"the",
"target",
"characters",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L1104-L1117 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.skipWhiteSpace | static public int skipWhiteSpace(byte[] data, int start) {
int index = start + 1;
while (index < data.length && BNFHeaders.SPACE == data[index]) {
index++;
}
return index;
} | java | static public int skipWhiteSpace(byte[] data, int start) {
int index = start + 1;
while (index < data.length && BNFHeaders.SPACE == data[index]) {
index++;
}
return index;
} | [
"static",
"public",
"int",
"skipWhiteSpace",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
")",
"{",
"int",
"index",
"=",
"start",
"+",
"1",
";",
"while",
"(",
"index",
"<",
"data",
".",
"length",
"&&",
"BNFHeaders",
".",
"SPACE",
"==",
"data",
"[",
"index",
"]",
")",
"{",
"index",
"++",
";",
"}",
"return",
"index",
";",
"}"
] | Simple method to skip past any space characters from the starting
index onwards, until it finds a non-space character or the end of the
buffer. Returns the index it stopped on.
@param data
@param start
@return int | [
"Simple",
"method",
"to",
"skip",
"past",
"any",
"space",
"characters",
"from",
"the",
"starting",
"index",
"onwards",
"until",
"it",
"finds",
"a",
"non",
"-",
"space",
"character",
"or",
"the",
"end",
"of",
"the",
"buffer",
".",
"Returns",
"the",
"index",
"it",
"stopped",
"on",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L1128-L1134 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.sizeOf | static public int sizeOf(WsByteBuffer[] list) {
if (null == list) {
return 0;
}
int size = 0;
for (int i = 0; i < list.length; i++) {
if (null != list[i]) {
size += list[i].remaining();
}
}
return size;
} | java | static public int sizeOf(WsByteBuffer[] list) {
if (null == list) {
return 0;
}
int size = 0;
for (int i = 0; i < list.length; i++) {
if (null != list[i]) {
size += list[i].remaining();
}
}
return size;
} | [
"static",
"public",
"int",
"sizeOf",
"(",
"WsByteBuffer",
"[",
"]",
"list",
")",
"{",
"if",
"(",
"null",
"==",
"list",
")",
"{",
"return",
"0",
";",
"}",
"int",
"size",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"null",
"!=",
"list",
"[",
"i",
"]",
")",
"{",
"size",
"+=",
"list",
"[",
"i",
"]",
".",
"remaining",
"(",
")",
";",
"}",
"}",
"return",
"size",
";",
"}"
] | Utility method to count the total number of "used" bytes in the list of
buffers. This would represent the size of the data if it was printed
out.
@param list
@return int | [
"Utility",
"method",
"to",
"count",
"the",
"total",
"number",
"of",
"used",
"bytes",
"in",
"the",
"list",
"of",
"buffers",
".",
"This",
"would",
"represent",
"the",
"size",
"of",
"the",
"data",
"if",
"it",
"was",
"printed",
"out",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L1164-L1175 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.readValue | static public byte[] readValue(ObjectInput in, int len) throws IOException {
int bytesRead = 0;
byte[] data = new byte[len];
for (int offset = 0; offset < len; offset += bytesRead) {
bytesRead = in.read(data, offset, len - offset);
if (bytesRead == -1) {
throw new IOException("Could not retrieve ");
}
}
return data;
} | java | static public byte[] readValue(ObjectInput in, int len) throws IOException {
int bytesRead = 0;
byte[] data = new byte[len];
for (int offset = 0; offset < len; offset += bytesRead) {
bytesRead = in.read(data, offset, len - offset);
if (bytesRead == -1) {
throw new IOException("Could not retrieve ");
}
}
return data;
} | [
"static",
"public",
"byte",
"[",
"]",
"readValue",
"(",
"ObjectInput",
"in",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"int",
"bytesRead",
"=",
"0",
";",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"for",
"(",
"int",
"offset",
"=",
"0",
";",
"offset",
"<",
"len",
";",
"offset",
"+=",
"bytesRead",
")",
"{",
"bytesRead",
"=",
"in",
".",
"read",
"(",
"data",
",",
"offset",
",",
"len",
"-",
"offset",
")",
";",
"if",
"(",
"bytesRead",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Could not retrieve \"",
")",
";",
"}",
"}",
"return",
"data",
";",
"}"
] | Encapsulate the logic to read an entire byte array from the input stream.
@param in
@param len
@return new array read from stream
@throws IOException | [
"Encapsulate",
"the",
"logic",
"to",
"read",
"an",
"entire",
"byte",
"array",
"from",
"the",
"input",
"stream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L1185-L1195 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.blockContents | static public String blockContents(byte[] value) {
if (null == value) {
return null;
}
char[] data = new char[value.length];
for (int i = 0; i < data.length; i++) {
data[i] = '*';
}
return new String(data);
} | java | static public String blockContents(byte[] value) {
if (null == value) {
return null;
}
char[] data = new char[value.length];
for (int i = 0; i < data.length; i++) {
data[i] = '*';
}
return new String(data);
} | [
"static",
"public",
"String",
"blockContents",
"(",
"byte",
"[",
"]",
"value",
")",
"{",
"if",
"(",
"null",
"==",
"value",
")",
"{",
"return",
"null",
";",
"}",
"char",
"[",
"]",
"data",
"=",
"new",
"char",
"[",
"value",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"data",
"[",
"i",
"]",
"=",
"'",
"'",
";",
"}",
"return",
"new",
"String",
"(",
"data",
")",
";",
"}"
] | Create a string that is the same length as the input, but filled with
characters.
@param value
@return String | [
"Create",
"a",
"string",
"that",
"is",
"the",
"same",
"length",
"as",
"the",
"input",
"but",
"filled",
"with",
"characters",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L1229-L1238 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/jaas/modules/CertificateLoginModule.java | CertificateLoginModule.handleCollectiveLogin | private void handleCollectiveLogin(X509Certificate certChain[], CollectiveAuthenticationPlugin plugin,
boolean collectiveCert) throws InvalidNameException, AuthenticationException, Exception {
// If the chain is not authenticated, it will throw an AuthenticationException
plugin.authenticateCertificateChain(certChain, collectiveCert);
X509Certificate cert = certChain[0];
X500Principal x509Subject = cert.getSubjectX500Principal();
String accessId = AccessIdUtil.createAccessId(AccessIdUtil.TYPE_SERVER,
"collective",
x509Subject.getName());
username = x509Subject.getName();
authenticatedId = x509Subject.getName();
addCredentials(accessId);
} | java | private void handleCollectiveLogin(X509Certificate certChain[], CollectiveAuthenticationPlugin plugin,
boolean collectiveCert) throws InvalidNameException, AuthenticationException, Exception {
// If the chain is not authenticated, it will throw an AuthenticationException
plugin.authenticateCertificateChain(certChain, collectiveCert);
X509Certificate cert = certChain[0];
X500Principal x509Subject = cert.getSubjectX500Principal();
String accessId = AccessIdUtil.createAccessId(AccessIdUtil.TYPE_SERVER,
"collective",
x509Subject.getName());
username = x509Subject.getName();
authenticatedId = x509Subject.getName();
addCredentials(accessId);
} | [
"private",
"void",
"handleCollectiveLogin",
"(",
"X509Certificate",
"certChain",
"[",
"]",
",",
"CollectiveAuthenticationPlugin",
"plugin",
",",
"boolean",
"collectiveCert",
")",
"throws",
"InvalidNameException",
",",
"AuthenticationException",
",",
"Exception",
"{",
"// If the chain is not authenticated, it will throw an AuthenticationException",
"plugin",
".",
"authenticateCertificateChain",
"(",
"certChain",
",",
"collectiveCert",
")",
";",
"X509Certificate",
"cert",
"=",
"certChain",
"[",
"0",
"]",
";",
"X500Principal",
"x509Subject",
"=",
"cert",
".",
"getSubjectX500Principal",
"(",
")",
";",
"String",
"accessId",
"=",
"AccessIdUtil",
".",
"createAccessId",
"(",
"AccessIdUtil",
".",
"TYPE_SERVER",
",",
"\"collective\"",
",",
"x509Subject",
".",
"getName",
"(",
")",
")",
";",
"username",
"=",
"x509Subject",
".",
"getName",
"(",
")",
";",
"authenticatedId",
"=",
"x509Subject",
".",
"getName",
"(",
")",
";",
"addCredentials",
"(",
"accessId",
")",
";",
"}"
] | Handles a collective certificate login.
@param certChain
@param x509Subject
@throws InvalidNameException
@throws AuthenticationException
@throws Exception | [
"Handles",
"a",
"collective",
"certificate",
"login",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/jaas/modules/CertificateLoginModule.java#L228-L240 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/jaas/modules/CertificateLoginModule.java | CertificateLoginModule.addCredentials | private void addCredentials(String accessId) throws Exception {
temporarySubject = new Subject();
Hashtable<String, Object> hashtable = new Hashtable<String, Object>();
hashtable.put(AttributeNameConstants.WSCREDENTIAL_UNIQUEID, AccessIdUtil.getUniqueId(accessId));
temporarySubject.getPublicCredentials().add(hashtable);
setWSPrincipal(temporarySubject, username, accessId, WSPrincipal.AUTH_METHOD_CERTIFICATE);
setCredentials(temporarySubject, username, username);
temporarySubject.getPublicCredentials().remove(hashtable);
} | java | private void addCredentials(String accessId) throws Exception {
temporarySubject = new Subject();
Hashtable<String, Object> hashtable = new Hashtable<String, Object>();
hashtable.put(AttributeNameConstants.WSCREDENTIAL_UNIQUEID, AccessIdUtil.getUniqueId(accessId));
temporarySubject.getPublicCredentials().add(hashtable);
setWSPrincipal(temporarySubject, username, accessId, WSPrincipal.AUTH_METHOD_CERTIFICATE);
setCredentials(temporarySubject, username, username);
temporarySubject.getPublicCredentials().remove(hashtable);
} | [
"private",
"void",
"addCredentials",
"(",
"String",
"accessId",
")",
"throws",
"Exception",
"{",
"temporarySubject",
"=",
"new",
"Subject",
"(",
")",
";",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"hashtable",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"hashtable",
".",
"put",
"(",
"AttributeNameConstants",
".",
"WSCREDENTIAL_UNIQUEID",
",",
"AccessIdUtil",
".",
"getUniqueId",
"(",
"accessId",
")",
")",
";",
"temporarySubject",
".",
"getPublicCredentials",
"(",
")",
".",
"add",
"(",
"hashtable",
")",
";",
"setWSPrincipal",
"(",
"temporarySubject",
",",
"username",
",",
"accessId",
",",
"WSPrincipal",
".",
"AUTH_METHOD_CERTIFICATE",
")",
";",
"setCredentials",
"(",
"temporarySubject",
",",
"username",
",",
"username",
")",
";",
"temporarySubject",
".",
"getPublicCredentials",
"(",
")",
".",
"remove",
"(",
"hashtable",
")",
";",
"}"
] | Add unique ID and call setPrincipalAndCredentials
@param accessId
@throws Exception | [
"Add",
"unique",
"ID",
"and",
"call",
"setPrincipalAndCredentials"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/jaas/modules/CertificateLoginModule.java#L248-L256 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/jaas/modules/CertificateLoginModule.java | CertificateLoginModule.handleUserLogin | private void handleUserLogin(X509Certificate certChain[]) throws RegistryException, CertificateMapNotSupportedException, CertificateMapFailedException, EntryNotFoundException, Exception {
UserRegistry userRegistry = getUserRegistry();
username = userRegistry.mapCertificate(certChain);
authenticatedId = userRegistry.getUniqueUserId(username);
securityName = userRegistry.getUserSecurityName(authenticatedId);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "username=[" + username +
"] authenticatedId=[" + authenticatedId +
"] securityName=[" + securityName + "]");
}
setUpTemporarySubject();
} | java | private void handleUserLogin(X509Certificate certChain[]) throws RegistryException, CertificateMapNotSupportedException, CertificateMapFailedException, EntryNotFoundException, Exception {
UserRegistry userRegistry = getUserRegistry();
username = userRegistry.mapCertificate(certChain);
authenticatedId = userRegistry.getUniqueUserId(username);
securityName = userRegistry.getUserSecurityName(authenticatedId);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "username=[" + username +
"] authenticatedId=[" + authenticatedId +
"] securityName=[" + securityName + "]");
}
setUpTemporarySubject();
} | [
"private",
"void",
"handleUserLogin",
"(",
"X509Certificate",
"certChain",
"[",
"]",
")",
"throws",
"RegistryException",
",",
"CertificateMapNotSupportedException",
",",
"CertificateMapFailedException",
",",
"EntryNotFoundException",
",",
"Exception",
"{",
"UserRegistry",
"userRegistry",
"=",
"getUserRegistry",
"(",
")",
";",
"username",
"=",
"userRegistry",
".",
"mapCertificate",
"(",
"certChain",
")",
";",
"authenticatedId",
"=",
"userRegistry",
".",
"getUniqueUserId",
"(",
"username",
")",
";",
"securityName",
"=",
"userRegistry",
".",
"getUserSecurityName",
"(",
"authenticatedId",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"username=[\"",
"+",
"username",
"+",
"\"] authenticatedId=[\"",
"+",
"authenticatedId",
"+",
"\"] securityName=[\"",
"+",
"securityName",
"+",
"\"]\"",
")",
";",
"}",
"setUpTemporarySubject",
"(",
")",
";",
"}"
] | Handles a non-collective certificate login.
Note:
In distributed env, both username and securityName in this method are the same.
In zOS env, username has platform cred appended while securityName does not.
username : TESTUSER::c2c2c70001013....00
securityName: TESTUSER
@param certChain
@throws RegistryException
@throws CertificateMapNotSupportedException
@throws CertificateMapFailedException
@throws EntryNotFoundException
@throws Exception | [
"Handles",
"a",
"non",
"-",
"collective",
"certificate",
"login",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/jaas/modules/CertificateLoginModule.java#L275-L286 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/BeanDeploymentArchiveImpl.java | BeanDeploymentArchiveImpl.getBeanDiscoveryMode | private BeanDiscoveryMode getBeanDiscoveryMode() {
if (beanDiscoveryMode == null) {
BeansXml beansXml = getBeansXml();
beanDiscoveryMode = BeanDiscoveryMode.ANNOTATED;
if (beansXml != null) {
beanDiscoveryMode = beansXml.getBeanDiscoveryMode();
} else if ((cdiRuntime.isImplicitBeanArchivesScanningDisabled(this.archive) || isExtension())) {
// If the server.xml has the configuration of enableImplicitBeanArchives sets to false, we will not scan the implicit bean archives
beanDiscoveryMode = BeanDiscoveryMode.NONE;
}
}
return beanDiscoveryMode;
} | java | private BeanDiscoveryMode getBeanDiscoveryMode() {
if (beanDiscoveryMode == null) {
BeansXml beansXml = getBeansXml();
beanDiscoveryMode = BeanDiscoveryMode.ANNOTATED;
if (beansXml != null) {
beanDiscoveryMode = beansXml.getBeanDiscoveryMode();
} else if ((cdiRuntime.isImplicitBeanArchivesScanningDisabled(this.archive) || isExtension())) {
// If the server.xml has the configuration of enableImplicitBeanArchives sets to false, we will not scan the implicit bean archives
beanDiscoveryMode = BeanDiscoveryMode.NONE;
}
}
return beanDiscoveryMode;
} | [
"private",
"BeanDiscoveryMode",
"getBeanDiscoveryMode",
"(",
")",
"{",
"if",
"(",
"beanDiscoveryMode",
"==",
"null",
")",
"{",
"BeansXml",
"beansXml",
"=",
"getBeansXml",
"(",
")",
";",
"beanDiscoveryMode",
"=",
"BeanDiscoveryMode",
".",
"ANNOTATED",
";",
"if",
"(",
"beansXml",
"!=",
"null",
")",
"{",
"beanDiscoveryMode",
"=",
"beansXml",
".",
"getBeanDiscoveryMode",
"(",
")",
";",
"}",
"else",
"if",
"(",
"(",
"cdiRuntime",
".",
"isImplicitBeanArchivesScanningDisabled",
"(",
"this",
".",
"archive",
")",
"||",
"isExtension",
"(",
")",
")",
")",
"{",
"// If the server.xml has the configuration of enableImplicitBeanArchives sets to false, we will not scan the implicit bean archives",
"beanDiscoveryMode",
"=",
"BeanDiscoveryMode",
".",
"NONE",
";",
"}",
"}",
"return",
"beanDiscoveryMode",
";",
"}"
] | Determine the bean deployment archive scanning mode
If there is a beans.xml, the bean discovery mode will be used.
If there is no beans.xml, the mode will be annotated, unless the enableImplicitBeanArchives is configured as false via the server.xml.
If there is no beans.xml and the enableImplicitBeanArchives attribute on cdi12 is configured to false, the scanning mode is none.
If there is no beans.xml and this archive is an extension, the bean discovery mode is none.
@return | [
"Determine",
"the",
"bean",
"deployment",
"archive",
"scanning",
"mode",
"If",
"there",
"is",
"a",
"beans",
".",
"xml",
"the",
"bean",
"discovery",
"mode",
"will",
"be",
"used",
".",
"If",
"there",
"is",
"no",
"beans",
".",
"xml",
"the",
"mode",
"will",
"be",
"annotated",
"unless",
"the",
"enableImplicitBeanArchives",
"is",
"configured",
"as",
"false",
"via",
"the",
"server",
".",
"xml",
".",
"If",
"there",
"is",
"no",
"beans",
".",
"xml",
"and",
"the",
"enableImplicitBeanArchives",
"attribute",
"on",
"cdi12",
"is",
"configured",
"to",
"false",
"the",
"scanning",
"mode",
"is",
"none",
".",
"If",
"there",
"is",
"no",
"beans",
".",
"xml",
"and",
"this",
"archive",
"is",
"an",
"extension",
"the",
"bean",
"discovery",
"mode",
"is",
"none",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/BeanDeploymentArchiveImpl.java#L233-L247 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/BeanDeploymentArchiveImpl.java | BeanDeploymentArchiveImpl.removeVetoedClasses | private void removeVetoedClasses(Set<Class<?>> classes) {
//get hold of classnames
Set<String> classNames = new HashSet<String>();
for (Class<?> clazz : classes) {
classNames.add(clazz.getName());
}
// take into considerations of the exclude in beans.xml
Collection<String> includedClasses = WeldCDIUtils.filterClassesBasedOnBeansXML(this.beansXml, this.resourceLoader, classNames);
Iterator<Class<?>> iterator = classes.iterator();
while (iterator.hasNext()) {
Class<?> clazz = iterator.next();
if (WeldCDIUtils.isClassVetoed(clazz)) {
iterator.remove();
} else if (!includedClasses.contains(clazz.getName())) {
iterator.remove();
}
}
} | java | private void removeVetoedClasses(Set<Class<?>> classes) {
//get hold of classnames
Set<String> classNames = new HashSet<String>();
for (Class<?> clazz : classes) {
classNames.add(clazz.getName());
}
// take into considerations of the exclude in beans.xml
Collection<String> includedClasses = WeldCDIUtils.filterClassesBasedOnBeansXML(this.beansXml, this.resourceLoader, classNames);
Iterator<Class<?>> iterator = classes.iterator();
while (iterator.hasNext()) {
Class<?> clazz = iterator.next();
if (WeldCDIUtils.isClassVetoed(clazz)) {
iterator.remove();
} else if (!includedClasses.contains(clazz.getName())) {
iterator.remove();
}
}
} | [
"private",
"void",
"removeVetoedClasses",
"(",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
")",
"{",
"//get hold of classnames",
"Set",
"<",
"String",
">",
"classNames",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"clazz",
":",
"classes",
")",
"{",
"classNames",
".",
"add",
"(",
"clazz",
".",
"getName",
"(",
")",
")",
";",
"}",
"// take into considerations of the exclude in beans.xml",
"Collection",
"<",
"String",
">",
"includedClasses",
"=",
"WeldCDIUtils",
".",
"filterClassesBasedOnBeansXML",
"(",
"this",
".",
"beansXml",
",",
"this",
".",
"resourceLoader",
",",
"classNames",
")",
";",
"Iterator",
"<",
"Class",
"<",
"?",
">",
">",
"iterator",
"=",
"classes",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"WeldCDIUtils",
".",
"isClassVetoed",
"(",
"clazz",
")",
")",
"{",
"iterator",
".",
"remove",
"(",
")",
";",
"}",
"else",
"if",
"(",
"!",
"includedClasses",
".",
"contains",
"(",
"clazz",
".",
"getName",
"(",
")",
")",
")",
"{",
"iterator",
".",
"remove",
"(",
")",
";",
"}",
"}",
"}"
] | Need to removed the vetoed classes from the set so that we can ignore them
@param classes | [
"Need",
"to",
"removed",
"the",
"vetoed",
"classes",
"from",
"the",
"set",
"so",
"that",
"we",
"can",
"ignore",
"them"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/weld/BeanDeploymentArchiveImpl.java#L516-L534 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/runtime/impl/Topicspace.java | Topicspace.getSubscription | private ControllableSubscription getSubscription(String id)
throws SIMPControllableNotFoundException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getSubscription", id);
//id is assumed to be SIBUuid12
SIBUuid12 uuid = new SIBUuid12(id);
SubscriptionTypeFilter filter = new SubscriptionTypeFilter();
filter.LOCAL = Boolean.TRUE;
ControllableSubscription sub = getSubscriptionIndex().findByUuid(uuid, filter);
// If the sub is null, throw an exception
if (sub == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(
tc,
"getLocalSubscriptionControlByID",
"SIMPControllableNotFoundException");
throw new SIMPControllableNotFoundException(
nls.getFormattedMessage(
"SUBSCRIPTION_NOT_FOUND_ERROR_CWSIP0271",
new Object[]{id},
null));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getSubscription", sub);
return sub;
} | java | private ControllableSubscription getSubscription(String id)
throws SIMPControllableNotFoundException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getSubscription", id);
//id is assumed to be SIBUuid12
SIBUuid12 uuid = new SIBUuid12(id);
SubscriptionTypeFilter filter = new SubscriptionTypeFilter();
filter.LOCAL = Boolean.TRUE;
ControllableSubscription sub = getSubscriptionIndex().findByUuid(uuid, filter);
// If the sub is null, throw an exception
if (sub == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(
tc,
"getLocalSubscriptionControlByID",
"SIMPControllableNotFoundException");
throw new SIMPControllableNotFoundException(
nls.getFormattedMessage(
"SUBSCRIPTION_NOT_FOUND_ERROR_CWSIP0271",
new Object[]{id},
null));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getSubscription", sub);
return sub;
} | [
"private",
"ControllableSubscription",
"getSubscription",
"(",
"String",
"id",
")",
"throws",
"SIMPControllableNotFoundException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getSubscription\"",
",",
"id",
")",
";",
"//id is assumed to be SIBUuid12",
"SIBUuid12",
"uuid",
"=",
"new",
"SIBUuid12",
"(",
"id",
")",
";",
"SubscriptionTypeFilter",
"filter",
"=",
"new",
"SubscriptionTypeFilter",
"(",
")",
";",
"filter",
".",
"LOCAL",
"=",
"Boolean",
".",
"TRUE",
";",
"ControllableSubscription",
"sub",
"=",
"getSubscriptionIndex",
"(",
")",
".",
"findByUuid",
"(",
"uuid",
",",
"filter",
")",
";",
"// If the sub is null, throw an exception",
"if",
"(",
"sub",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getLocalSubscriptionControlByID\"",
",",
"\"SIMPControllableNotFoundException\"",
")",
";",
"throw",
"new",
"SIMPControllableNotFoundException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"SUBSCRIPTION_NOT_FOUND_ERROR_CWSIP0271\"",
",",
"new",
"Object",
"[",
"]",
"{",
"id",
"}",
",",
"null",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getSubscription\"",
",",
"sub",
")",
";",
"return",
"sub",
";",
"}"
] | Gets and returns the subscription based on the id.
@param id
@return
@throws SIMPControllableNotFoundException | [
"Gets",
"and",
"returns",
"the",
"subscription",
"based",
"on",
"the",
"id",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/runtime/impl/Topicspace.java#L190-L222 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpPipelineEventHandler.java | HttpPipelineEventHandler.activate | @SuppressWarnings("unused")
@Activate
protected void activate(ComponentContext context) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Activating the HTTP pipeline event handler");
}
} | java | @SuppressWarnings("unused")
@Activate
protected void activate(ComponentContext context) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Activating the HTTP pipeline event handler");
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"@",
"Activate",
"protected",
"void",
"activate",
"(",
"ComponentContext",
"context",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Activating the HTTP pipeline event handler\"",
")",
";",
"}",
"}"
] | DS method for activation of this service component.
@param context | [
"DS",
"method",
"for",
"activation",
"of",
"this",
"service",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpPipelineEventHandler.java#L52-L58 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpPipelineEventHandler.java | HttpPipelineEventHandler.deactivate | @SuppressWarnings("unused")
@Deactivate
protected void deactivate(ComponentContext context) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Deactivating the HTTP pipeline event handler");
}
} | java | @SuppressWarnings("unused")
@Deactivate
protected void deactivate(ComponentContext context) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Deactivating the HTTP pipeline event handler");
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"@",
"Deactivate",
"protected",
"void",
"deactivate",
"(",
"ComponentContext",
"context",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Deactivating the HTTP pipeline event handler\"",
")",
";",
"}",
"}"
] | DS method for deactivation of this service component.
@param context | [
"DS",
"method",
"for",
"deactivation",
"of",
"this",
"service",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpPipelineEventHandler.java#L65-L71 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/HttpChannelUtils.java | HttpChannelUtils.getEnglishBytes | static public byte[] getEnglishBytes(String data) {
if (null == data) {
return null;
}
char[] chars = data.toCharArray();
byte[] bytes = new byte[chars.length];
for (int i = 0; i < chars.length; i++) {
bytes[i] = (byte) chars[i];
}
return bytes;
} | java | static public byte[] getEnglishBytes(String data) {
if (null == data) {
return null;
}
char[] chars = data.toCharArray();
byte[] bytes = new byte[chars.length];
for (int i = 0; i < chars.length; i++) {
bytes[i] = (byte) chars[i];
}
return bytes;
} | [
"static",
"public",
"byte",
"[",
"]",
"getEnglishBytes",
"(",
"String",
"data",
")",
"{",
"if",
"(",
"null",
"==",
"data",
")",
"{",
"return",
"null",
";",
"}",
"char",
"[",
"]",
"chars",
"=",
"data",
".",
"toCharArray",
"(",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"chars",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"chars",
".",
"length",
";",
"i",
"++",
")",
"{",
"bytes",
"[",
"i",
"]",
"=",
"(",
"byte",
")",
"chars",
"[",
"i",
"]",
";",
"}",
"return",
"bytes",
";",
"}"
] | Utility method to get ISO english encoded bytes from the input string.
@param data
@return byte[] | [
"Utility",
"method",
"to",
"get",
"ISO",
"english",
"encoded",
"bytes",
"from",
"the",
"input",
"string",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/HttpChannelUtils.java#L135-L145 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/HttpChannelUtils.java | HttpChannelUtils.getEnglishString | static public String getEnglishString(byte[] data, int start, int end) {
int len = end - start;
if (0 >= len || null == data) {
return null;
}
char chars[] = new char[len];
for (int i = start; i < end; i++) {
chars[i] = (char) (data[i] & 0xff);
}
return new String(chars);
} | java | static public String getEnglishString(byte[] data, int start, int end) {
int len = end - start;
if (0 >= len || null == data) {
return null;
}
char chars[] = new char[len];
for (int i = start; i < end; i++) {
chars[i] = (char) (data[i] & 0xff);
}
return new String(chars);
} | [
"static",
"public",
"String",
"getEnglishString",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"len",
"=",
"end",
"-",
"start",
";",
"if",
"(",
"0",
">=",
"len",
"||",
"null",
"==",
"data",
")",
"{",
"return",
"null",
";",
"}",
"char",
"chars",
"[",
"]",
"=",
"new",
"char",
"[",
"len",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"i",
"++",
")",
"{",
"chars",
"[",
"i",
"]",
"=",
"(",
"char",
")",
"(",
"data",
"[",
"i",
"]",
"&",
"0xff",
")",
";",
"}",
"return",
"new",
"String",
"(",
"chars",
")",
";",
"}"
] | Utility method to get the ISO English string from the given bytes.
@param data
@param start
@param end
@return String | [
"Utility",
"method",
"to",
"get",
"the",
"ISO",
"English",
"string",
"from",
"the",
"given",
"bytes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/HttpChannelUtils.java#L172-L182 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InterceptorMetaData.java | InterceptorMetaData.createInterceptorInstances | public void createInterceptorInstances(InjectionEngine injectionEngine,
Object[] interceptors,
ManagedObjectContext managedObjectContext,
ManagedBeanOBase targetContext) throws Exception {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "createInterceptorInstances");
}
if (ivInterceptorClasses != null) {
int numberOfInterceptors = ivInterceptorClasses.length;
for (int i = 0; i < numberOfInterceptors; i++) {
if (ivInterceptorFactories == null || ivInterceptorFactories[i] == null) {
interceptors[i] = createInterceptorInstanceUsingConstructor(injectionEngine, ivInterceptorClasses[i], ivInterceptorInjectionTargets[i], targetContext);
} else {
interceptors[i] = createInterceptorInstancesUsingMOF(ivInterceptorInjectionTargets[i], managedObjectContext, targetContext, ivInterceptorFactories[i]);
}
}
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "createInterceptorInstances");
}
} | java | public void createInterceptorInstances(InjectionEngine injectionEngine,
Object[] interceptors,
ManagedObjectContext managedObjectContext,
ManagedBeanOBase targetContext) throws Exception {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "createInterceptorInstances");
}
if (ivInterceptorClasses != null) {
int numberOfInterceptors = ivInterceptorClasses.length;
for (int i = 0; i < numberOfInterceptors; i++) {
if (ivInterceptorFactories == null || ivInterceptorFactories[i] == null) {
interceptors[i] = createInterceptorInstanceUsingConstructor(injectionEngine, ivInterceptorClasses[i], ivInterceptorInjectionTargets[i], targetContext);
} else {
interceptors[i] = createInterceptorInstancesUsingMOF(ivInterceptorInjectionTargets[i], managedObjectContext, targetContext, ivInterceptorFactories[i]);
}
}
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "createInterceptorInstances");
}
} | [
"public",
"void",
"createInterceptorInstances",
"(",
"InjectionEngine",
"injectionEngine",
",",
"Object",
"[",
"]",
"interceptors",
",",
"ManagedObjectContext",
"managedObjectContext",
",",
"ManagedBeanOBase",
"targetContext",
")",
"throws",
"Exception",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"createInterceptorInstances\"",
")",
";",
"}",
"if",
"(",
"ivInterceptorClasses",
"!=",
"null",
")",
"{",
"int",
"numberOfInterceptors",
"=",
"ivInterceptorClasses",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numberOfInterceptors",
";",
"i",
"++",
")",
"{",
"if",
"(",
"ivInterceptorFactories",
"==",
"null",
"||",
"ivInterceptorFactories",
"[",
"i",
"]",
"==",
"null",
")",
"{",
"interceptors",
"[",
"i",
"]",
"=",
"createInterceptorInstanceUsingConstructor",
"(",
"injectionEngine",
",",
"ivInterceptorClasses",
"[",
"i",
"]",
",",
"ivInterceptorInjectionTargets",
"[",
"i",
"]",
",",
"targetContext",
")",
";",
"}",
"else",
"{",
"interceptors",
"[",
"i",
"]",
"=",
"createInterceptorInstancesUsingMOF",
"(",
"ivInterceptorInjectionTargets",
"[",
"i",
"]",
",",
"managedObjectContext",
",",
"targetContext",
",",
"ivInterceptorFactories",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"createInterceptorInstances\"",
")",
";",
"}",
"}"
] | Create the interceptor instances associated with this
enterprise bean instance. The lifetime of interceptor instances
is identical to lifetime of the EJB instance.
@param injectionEngine the injection engine
@param interceptors the array of interceptor instances to populate
@param managedObjectContext the managed object context for the bean associated with these interceptors
@param targetContext the injection target context | [
"Create",
"the",
"interceptor",
"instances",
"associated",
"with",
"this",
"enterprise",
"bean",
"instance",
".",
"The",
"lifetime",
"of",
"interceptor",
"instances",
"is",
"identical",
"to",
"lifetime",
"of",
"the",
"EJB",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InterceptorMetaData.java#L180-L204 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/StopChainTask.java | StopChainTask.run | public void run() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "run");
}
try {
framework.stopChain(chainName, 0L);
} catch (Exception e) {
FFDCFilter.processException(e, getClass().getName() + ".run", "68",
this, new Object[] { chainName });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "run");
}
} | java | public void run() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "run");
}
try {
framework.stopChain(chainName, 0L);
} catch (Exception e) {
FFDCFilter.processException(e, getClass().getName() + ".run", "68",
this, new Object[] { chainName });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "run");
}
} | [
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"run\"",
")",
";",
"}",
"try",
"{",
"framework",
".",
"stopChain",
"(",
"chainName",
",",
"0L",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\".run\"",
",",
"\"68\"",
",",
"this",
",",
"new",
"Object",
"[",
"]",
"{",
"chainName",
"}",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"run\"",
")",
";",
"}",
"}"
] | This method will be called when the secondsToWait expires after this task
has been placed in the channel framework's timer.
@see java.lang.Runnable#run() | [
"This",
"method",
"will",
"be",
"called",
"when",
"the",
"secondsToWait",
"expires",
"after",
"this",
"task",
"has",
"been",
"placed",
"in",
"the",
"channel",
"framework",
"s",
"timer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/StopChainTask.java#L63-L78 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/schema/AttributeDefinitionSpecification.java | AttributeDefinitionSpecification.getOptionValues | @Override
public String[] getOptionValues() {
String[] values = new String[valueOptions.size()];
for (int i = 0; i < values.length; i++) {
values[i] = valueOptions.get(i)[0];
}
return values;
} | java | @Override
public String[] getOptionValues() {
String[] values = new String[valueOptions.size()];
for (int i = 0; i < values.length; i++) {
values[i] = valueOptions.get(i)[0];
}
return values;
} | [
"@",
"Override",
"public",
"String",
"[",
"]",
"getOptionValues",
"(",
")",
"{",
"String",
"[",
"]",
"values",
"=",
"new",
"String",
"[",
"valueOptions",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"values",
".",
"length",
";",
"i",
"++",
")",
"{",
"values",
"[",
"i",
"]",
"=",
"valueOptions",
".",
"get",
"(",
"i",
")",
"[",
"0",
"]",
";",
"}",
"return",
"values",
";",
"}"
] | return only values from option | [
"return",
"only",
"values",
"from",
"option"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/schema/AttributeDefinitionSpecification.java#L198-L205 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/schema/AttributeDefinitionSpecification.java | AttributeDefinitionSpecification.getOptionLabels | @Override
public String[] getOptionLabels() {
String[] labels = new String[valueOptions.size()];
for (int i = 0; i < labels.length; i++) {
labels[i] = valueOptions.get(i)[1];
}
return labels;
} | java | @Override
public String[] getOptionLabels() {
String[] labels = new String[valueOptions.size()];
for (int i = 0; i < labels.length; i++) {
labels[i] = valueOptions.get(i)[1];
}
return labels;
} | [
"@",
"Override",
"public",
"String",
"[",
"]",
"getOptionLabels",
"(",
")",
"{",
"String",
"[",
"]",
"labels",
"=",
"new",
"String",
"[",
"valueOptions",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"labels",
".",
"length",
";",
"i",
"++",
")",
"{",
"labels",
"[",
"i",
"]",
"=",
"valueOptions",
".",
"get",
"(",
"i",
")",
"[",
"1",
"]",
";",
"}",
"return",
"labels",
";",
"}"
] | return only labels from option | [
"return",
"only",
"labels",
"from",
"option"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/schema/AttributeDefinitionSpecification.java#L210-L217 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java | SubscriptionMessageHandler.createSubscriptionMessage | private SubscriptionMessage createSubscriptionMessage()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "createSubscriptionMessage");
ControlMessageFactory factory = null;
SubscriptionMessage subscriptionMessage = null;
try
{
factory = MessageProcessor.getControlMessageFactory();
subscriptionMessage = factory.createNewSubscriptionMessage();
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.SubscriptionMessageHandler.createSubscriptionMessage",
"1:162:1.34",
this);
SibTr.exception(tc, e);
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "createSubscriptionMessage", subscriptionMessage);
return subscriptionMessage;
} | java | private SubscriptionMessage createSubscriptionMessage()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "createSubscriptionMessage");
ControlMessageFactory factory = null;
SubscriptionMessage subscriptionMessage = null;
try
{
factory = MessageProcessor.getControlMessageFactory();
subscriptionMessage = factory.createNewSubscriptionMessage();
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.SubscriptionMessageHandler.createSubscriptionMessage",
"1:162:1.34",
this);
SibTr.exception(tc, e);
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "createSubscriptionMessage", subscriptionMessage);
return subscriptionMessage;
} | [
"private",
"SubscriptionMessage",
"createSubscriptionMessage",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createSubscriptionMessage\"",
")",
";",
"ControlMessageFactory",
"factory",
"=",
"null",
";",
"SubscriptionMessage",
"subscriptionMessage",
"=",
"null",
";",
"try",
"{",
"factory",
"=",
"MessageProcessor",
".",
"getControlMessageFactory",
"(",
")",
";",
"subscriptionMessage",
"=",
"factory",
".",
"createNewSubscriptionMessage",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.proxyhandler.SubscriptionMessageHandler.createSubscriptionMessage\"",
",",
"\"1:162:1.34\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createSubscriptionMessage\"",
",",
"subscriptionMessage",
")",
";",
"return",
"subscriptionMessage",
";",
"}"
] | This method creates the subscription control message
@return The SubscriptionMessage created | [
"This",
"method",
"creates",
"the",
"subscription",
"control",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java#L107-L135 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java | SubscriptionMessageHandler.reset | private void reset()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "reset");
if (iInitialised)
{
// Reset the ArrayLists associated with this message
iTopics.clear();
iTopicSpaces.clear();
iTopicSpaceMappings.clear();
// Create a new message to send to this Neighbour.
iSubscriptionMessage = createSubscriptionMessage();
}
else
{
iInitialised = true;
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "reset");
} | java | private void reset()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "reset");
if (iInitialised)
{
// Reset the ArrayLists associated with this message
iTopics.clear();
iTopicSpaces.clear();
iTopicSpaceMappings.clear();
// Create a new message to send to this Neighbour.
iSubscriptionMessage = createSubscriptionMessage();
}
else
{
iInitialised = true;
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "reset");
} | [
"private",
"void",
"reset",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"reset\"",
")",
";",
"if",
"(",
"iInitialised",
")",
"{",
"// Reset the ArrayLists associated with this message ",
"iTopics",
".",
"clear",
"(",
")",
";",
"iTopicSpaces",
".",
"clear",
"(",
")",
";",
"iTopicSpaceMappings",
".",
"clear",
"(",
")",
";",
"// Create a new message to send to this Neighbour.",
"iSubscriptionMessage",
"=",
"createSubscriptionMessage",
"(",
")",
";",
"}",
"else",
"{",
"iInitialised",
"=",
"true",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"reset\"",
")",
";",
"}"
] | Resets the complete message state | [
"Resets",
"the",
"complete",
"message",
"state"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java#L140-L162 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java | SubscriptionMessageHandler.resetCreateSubscriptionMessage | protected void resetCreateSubscriptionMessage(MESubscription subscription, boolean isLocalBus)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "resetCreateSubscriptionMessage", new Object[]{subscription, new Boolean(isLocalBus)});
// Reset the state
reset();
// Indicate that this is a create message
iSubscriptionMessage.setSubscriptionMessageType(
SubscriptionMessageType.CREATE);
// Add the subscription related information.
iTopics.add(subscription.getTopic());
if(isLocalBus)
{
//see defect 267686:
//local bus subscriptions expect the subscribing ME's
//detination uuid to be set in the iTopicSpaces field
iTopicSpaces.add(subscription.getTopicSpaceUuid().toString());
}
else
{
//see defect 267686:
//foreign bus subscriptions need to set the subscribers's topic space name.
//This is because the messages sent to this topic over the link
//will need to have a routing destination set, which requires
//this value.
iTopicSpaces.add(subscription.getTopicSpaceName().toString());
}
iTopicSpaceMappings.add(subscription.getForeignTSName());
if (tc.isEntryEnabled())
SibTr.exit(tc, "resetCreateSubscriptionMessage");
} | java | protected void resetCreateSubscriptionMessage(MESubscription subscription, boolean isLocalBus)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "resetCreateSubscriptionMessage", new Object[]{subscription, new Boolean(isLocalBus)});
// Reset the state
reset();
// Indicate that this is a create message
iSubscriptionMessage.setSubscriptionMessageType(
SubscriptionMessageType.CREATE);
// Add the subscription related information.
iTopics.add(subscription.getTopic());
if(isLocalBus)
{
//see defect 267686:
//local bus subscriptions expect the subscribing ME's
//detination uuid to be set in the iTopicSpaces field
iTopicSpaces.add(subscription.getTopicSpaceUuid().toString());
}
else
{
//see defect 267686:
//foreign bus subscriptions need to set the subscribers's topic space name.
//This is because the messages sent to this topic over the link
//will need to have a routing destination set, which requires
//this value.
iTopicSpaces.add(subscription.getTopicSpaceName().toString());
}
iTopicSpaceMappings.add(subscription.getForeignTSName());
if (tc.isEntryEnabled())
SibTr.exit(tc, "resetCreateSubscriptionMessage");
} | [
"protected",
"void",
"resetCreateSubscriptionMessage",
"(",
"MESubscription",
"subscription",
",",
"boolean",
"isLocalBus",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"resetCreateSubscriptionMessage\"",
",",
"new",
"Object",
"[",
"]",
"{",
"subscription",
",",
"new",
"Boolean",
"(",
"isLocalBus",
")",
"}",
")",
";",
"// Reset the state",
"reset",
"(",
")",
";",
"// Indicate that this is a create message ",
"iSubscriptionMessage",
".",
"setSubscriptionMessageType",
"(",
"SubscriptionMessageType",
".",
"CREATE",
")",
";",
"// Add the subscription related information.",
"iTopics",
".",
"add",
"(",
"subscription",
".",
"getTopic",
"(",
")",
")",
";",
"if",
"(",
"isLocalBus",
")",
"{",
"//see defect 267686:",
"//local bus subscriptions expect the subscribing ME's",
"//detination uuid to be set in the iTopicSpaces field",
"iTopicSpaces",
".",
"add",
"(",
"subscription",
".",
"getTopicSpaceUuid",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"//see defect 267686:",
"//foreign bus subscriptions need to set the subscribers's topic space name.",
"//This is because the messages sent to this topic over the link",
"//will need to have a routing destination set, which requires",
"//this value.",
"iTopicSpaces",
".",
"add",
"(",
"subscription",
".",
"getTopicSpaceName",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"iTopicSpaceMappings",
".",
"add",
"(",
"subscription",
".",
"getForeignTSName",
"(",
")",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"resetCreateSubscriptionMessage\"",
")",
";",
"}"
] | Method to reset the Subscription message object and
reinitialise it as a create proxy subscription message
@param subscription The subscription to add to the message.
@param isLocalBus The subscription is being sent to a the local bus | [
"Method",
"to",
"reset",
"the",
"Subscription",
"message",
"object",
"and",
"reinitialise",
"it",
"as",
"a",
"create",
"proxy",
"subscription",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java#L172-L208 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java | SubscriptionMessageHandler.resetDeleteSubscriptionMessage | protected void resetDeleteSubscriptionMessage()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "resetDeleteSubscriptionMessage");
// Reset the state
reset();
// Indicate that this is a create message
iSubscriptionMessage.setSubscriptionMessageType(
SubscriptionMessageType.DELETE);
if (tc.isEntryEnabled())
SibTr.exit(tc, "resetDeleteSubscriptionMessage");
} | java | protected void resetDeleteSubscriptionMessage()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "resetDeleteSubscriptionMessage");
// Reset the state
reset();
// Indicate that this is a create message
iSubscriptionMessage.setSubscriptionMessageType(
SubscriptionMessageType.DELETE);
if (tc.isEntryEnabled())
SibTr.exit(tc, "resetDeleteSubscriptionMessage");
} | [
"protected",
"void",
"resetDeleteSubscriptionMessage",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"resetDeleteSubscriptionMessage\"",
")",
";",
"// Reset the state",
"reset",
"(",
")",
";",
"// Indicate that this is a create message ",
"iSubscriptionMessage",
".",
"setSubscriptionMessageType",
"(",
"SubscriptionMessageType",
".",
"DELETE",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"resetDeleteSubscriptionMessage\"",
")",
";",
"}"
] | Method to reset the Subscription message object and
reinitialise it as a delete proxy subscription message.
This empty delete message that is created tells the Neighbouring
ME that this is the last message that it will receive from it. | [
"Method",
"to",
"reset",
"the",
"Subscription",
"message",
"object",
"and",
"reinitialise",
"it",
"as",
"a",
"delete",
"proxy",
"subscription",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java#L262-L276 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java | SubscriptionMessageHandler.resetResetSubscriptionMessage | protected void resetResetSubscriptionMessage()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "resetResetSubscriptionMessage");
// Reset the state
reset();
// Indicate that this is a create message
iSubscriptionMessage.setSubscriptionMessageType(
SubscriptionMessageType.RESET);
if (tc.isEntryEnabled())
SibTr.exit(tc, "resetResetSubscriptionMessage");
} | java | protected void resetResetSubscriptionMessage()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "resetResetSubscriptionMessage");
// Reset the state
reset();
// Indicate that this is a create message
iSubscriptionMessage.setSubscriptionMessageType(
SubscriptionMessageType.RESET);
if (tc.isEntryEnabled())
SibTr.exit(tc, "resetResetSubscriptionMessage");
} | [
"protected",
"void",
"resetResetSubscriptionMessage",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"resetResetSubscriptionMessage\"",
")",
";",
"// Reset the state",
"reset",
"(",
")",
";",
"// Indicate that this is a create message ",
"iSubscriptionMessage",
".",
"setSubscriptionMessageType",
"(",
"SubscriptionMessageType",
".",
"RESET",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"resetResetSubscriptionMessage\"",
")",
";",
"}"
] | Method to reset the Subscription message object and
reinitialise it as a Reset proxy subscription message | [
"Method",
"to",
"reset",
"the",
"Subscription",
"message",
"object",
"and",
"reinitialise",
"it",
"as",
"a",
"Reset",
"proxy",
"subscription",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java#L282-L296 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java | SubscriptionMessageHandler.resetReplySubscriptionMessage | protected void resetReplySubscriptionMessage()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "resetReplySubscriptionMessage");
// Reset the state
reset();
// Indicate that this is a create message
iSubscriptionMessage.setSubscriptionMessageType(
SubscriptionMessageType.REPLY);
if (tc.isEntryEnabled())
SibTr.exit(tc, "resetReplySubscriptionMessage");
} | java | protected void resetReplySubscriptionMessage()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "resetReplySubscriptionMessage");
// Reset the state
reset();
// Indicate that this is a create message
iSubscriptionMessage.setSubscriptionMessageType(
SubscriptionMessageType.REPLY);
if (tc.isEntryEnabled())
SibTr.exit(tc, "resetReplySubscriptionMessage");
} | [
"protected",
"void",
"resetReplySubscriptionMessage",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"resetReplySubscriptionMessage\"",
")",
";",
"// Reset the state",
"reset",
"(",
")",
";",
"// Indicate that this is a create message ",
"iSubscriptionMessage",
".",
"setSubscriptionMessageType",
"(",
"SubscriptionMessageType",
".",
"REPLY",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"resetReplySubscriptionMessage\"",
")",
";",
"}"
] | Method to reset the Subscription message object and
reinitialise it as a Reply proxy subscription message | [
"Method",
"to",
"reset",
"the",
"Subscription",
"message",
"object",
"and",
"reinitialise",
"it",
"as",
"a",
"Reply",
"proxy",
"subscription",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java#L302-L316 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java | SubscriptionMessageHandler.addSubscriptionToMessage | protected void addSubscriptionToMessage(MESubscription subscription, boolean isLocalBus)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "addSubscriptionToMessage", new Object[]{subscription, new Boolean(isLocalBus)});
// Add the subscription related information.
iTopics.add(subscription.getTopic());
if(isLocalBus)
{
//see defect 267686:
//local bus subscriptions expect the subscribing ME's
//detination uuid to be set in the iTopicSpaces field
iTopicSpaces.add(subscription.getTopicSpaceUuid().toString());
}
else
{
//see defect 267686:
//foreign bus subscriptions need to set the subscribers's topic space name.
//This is because the messages sent to this topic over the link
//will need to have a routing destination set, which requires
//this value.
iTopicSpaces.add(subscription.getTopicSpaceName().toString());
}
iTopicSpaceMappings.add(subscription.getForeignTSName());
if (tc.isEntryEnabled())
SibTr.exit(tc, "addSubscriptionToMessage");
} | java | protected void addSubscriptionToMessage(MESubscription subscription, boolean isLocalBus)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "addSubscriptionToMessage", new Object[]{subscription, new Boolean(isLocalBus)});
// Add the subscription related information.
iTopics.add(subscription.getTopic());
if(isLocalBus)
{
//see defect 267686:
//local bus subscriptions expect the subscribing ME's
//detination uuid to be set in the iTopicSpaces field
iTopicSpaces.add(subscription.getTopicSpaceUuid().toString());
}
else
{
//see defect 267686:
//foreign bus subscriptions need to set the subscribers's topic space name.
//This is because the messages sent to this topic over the link
//will need to have a routing destination set, which requires
//this value.
iTopicSpaces.add(subscription.getTopicSpaceName().toString());
}
iTopicSpaceMappings.add(subscription.getForeignTSName());
if (tc.isEntryEnabled())
SibTr.exit(tc, "addSubscriptionToMessage");
} | [
"protected",
"void",
"addSubscriptionToMessage",
"(",
"MESubscription",
"subscription",
",",
"boolean",
"isLocalBus",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"addSubscriptionToMessage\"",
",",
"new",
"Object",
"[",
"]",
"{",
"subscription",
",",
"new",
"Boolean",
"(",
"isLocalBus",
")",
"}",
")",
";",
"// Add the subscription related information.",
"iTopics",
".",
"add",
"(",
"subscription",
".",
"getTopic",
"(",
")",
")",
";",
"if",
"(",
"isLocalBus",
")",
"{",
"//see defect 267686:",
"//local bus subscriptions expect the subscribing ME's",
"//detination uuid to be set in the iTopicSpaces field",
"iTopicSpaces",
".",
"add",
"(",
"subscription",
".",
"getTopicSpaceUuid",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"//see defect 267686:",
"//foreign bus subscriptions need to set the subscribers's topic space name.",
"//This is because the messages sent to this topic over the link",
"//will need to have a routing destination set, which requires",
"//this value.",
"iTopicSpaces",
".",
"add",
"(",
"subscription",
".",
"getTopicSpaceName",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"iTopicSpaceMappings",
".",
"add",
"(",
"subscription",
".",
"getForeignTSName",
"(",
")",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"addSubscriptionToMessage\"",
")",
";",
"}"
] | Adds a subscription to the proxy message that is to be sent.
This will either be a delete or reset message.
Reset will add messages to the list to resync with the Neighbour
and the Delete will send it on due to receiving a Reset.
@param subscription The MESubscription to add to the message.
@param isLocalBus The message is for the messaging engine's local bus | [
"Adds",
"a",
"subscription",
"to",
"the",
"proxy",
"message",
"that",
"is",
"to",
"be",
"sent",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java#L328-L355 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java | SubscriptionMessageHandler.getSubscriptionMessage | protected SubscriptionMessage getSubscriptionMessage()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "getSubscriptionMessage");
// Set the values in the message
iSubscriptionMessage.setTopics(iTopics);
iSubscriptionMessage.setMEName(iMEName);
iSubscriptionMessage.setMEUUID(iMEUUID.toByteArray());
iSubscriptionMessage.setBusName(iBusName);
iSubscriptionMessage.setReliability(Reliability.ASSURED_PERSISTENT); //PK36530
iSubscriptionMessage.setTopicSpaces(iTopicSpaces);
iSubscriptionMessage.setTopicSpaceMappings(iTopicSpaceMappings);
if (tc.isEntryEnabled())
SibTr.exit(tc, "getSubscriptionMessage", new Object[] {
iTopics, iMEName, iMEUUID, iBusName, iTopicSpaces, iTopicSpaceMappings});
return iSubscriptionMessage;
} | java | protected SubscriptionMessage getSubscriptionMessage()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "getSubscriptionMessage");
// Set the values in the message
iSubscriptionMessage.setTopics(iTopics);
iSubscriptionMessage.setMEName(iMEName);
iSubscriptionMessage.setMEUUID(iMEUUID.toByteArray());
iSubscriptionMessage.setBusName(iBusName);
iSubscriptionMessage.setReliability(Reliability.ASSURED_PERSISTENT); //PK36530
iSubscriptionMessage.setTopicSpaces(iTopicSpaces);
iSubscriptionMessage.setTopicSpaceMappings(iTopicSpaceMappings);
if (tc.isEntryEnabled())
SibTr.exit(tc, "getSubscriptionMessage", new Object[] {
iTopics, iMEName, iMEUUID, iBusName, iTopicSpaces, iTopicSpaceMappings});
return iSubscriptionMessage;
} | [
"protected",
"SubscriptionMessage",
"getSubscriptionMessage",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getSubscriptionMessage\"",
")",
";",
"// Set the values in the message ",
"iSubscriptionMessage",
".",
"setTopics",
"(",
"iTopics",
")",
";",
"iSubscriptionMessage",
".",
"setMEName",
"(",
"iMEName",
")",
";",
"iSubscriptionMessage",
".",
"setMEUUID",
"(",
"iMEUUID",
".",
"toByteArray",
"(",
")",
")",
";",
"iSubscriptionMessage",
".",
"setBusName",
"(",
"iBusName",
")",
";",
"iSubscriptionMessage",
".",
"setReliability",
"(",
"Reliability",
".",
"ASSURED_PERSISTENT",
")",
";",
"//PK36530",
"iSubscriptionMessage",
".",
"setTopicSpaces",
"(",
"iTopicSpaces",
")",
";",
"iSubscriptionMessage",
".",
"setTopicSpaceMappings",
"(",
"iTopicSpaceMappings",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getSubscriptionMessage\"",
",",
"new",
"Object",
"[",
"]",
"{",
"iTopics",
",",
"iMEName",
",",
"iMEUUID",
",",
"iBusName",
",",
"iTopicSpaces",
",",
"iTopicSpaceMappings",
"}",
")",
";",
"return",
"iSubscriptionMessage",
";",
"}"
] | Method to return the Subscription Message to be sent
to the Neighbouring ME's
This also assigns all the Lists to the message.
@return SubscriptionMessage The subscription message to be
sent to the Neighbouring ME.
@param isForeignBus The subscription is being sent to a foreign bus | [
"Method",
"to",
"return",
"the",
"Subscription",
"Message",
"to",
"be",
"sent",
"to",
"the",
"Neighbouring",
"ME",
"s"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java#L367-L387 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.request.probe.audit.servlet/src/com/ibm/ws/request/probe/audit/servlet/AuditPE.java | AuditPE.auditEventSafAuthDetails | private void auditEventSafAuthDetails(Object[] methodParams) {
// Getting object array which have audit fields
Object[] varargs = (Object[]) methodParams[1];
// Get audit fields and convert them to respective type
int safReturnCode = (Integer) varargs[0];
int racfReturnCode = (Integer) varargs[1];
int racfReasonCode = (Integer) varargs[2];
String userSecurityName = (String) varargs[3];
String safProfile = (String) varargs[4];
String safClass = (String) varargs[5];
Boolean authDecision = (Boolean) varargs[6];
String principalName = (String) varargs[7];
String applid = (String) varargs[8];
if (auditServiceRef.getService() != null
&& auditServiceRef.getService().isAuditRequired(AuditConstants.SECURITY_SAF_AUTHZ_DETAILS,
AuditConstants.SUCCESS)) {
// Create audit event
SAFAuthorizationDetailsEvent safAuthDetails = new SAFAuthorizationDetailsEvent(safReturnCode,
racfReturnCode, racfReasonCode, userSecurityName, applid, safProfile, safClass, authDecision,
principalName);
auditServiceRef.getService().sendEvent(safAuthDetails);
}
} | java | private void auditEventSafAuthDetails(Object[] methodParams) {
// Getting object array which have audit fields
Object[] varargs = (Object[]) methodParams[1];
// Get audit fields and convert them to respective type
int safReturnCode = (Integer) varargs[0];
int racfReturnCode = (Integer) varargs[1];
int racfReasonCode = (Integer) varargs[2];
String userSecurityName = (String) varargs[3];
String safProfile = (String) varargs[4];
String safClass = (String) varargs[5];
Boolean authDecision = (Boolean) varargs[6];
String principalName = (String) varargs[7];
String applid = (String) varargs[8];
if (auditServiceRef.getService() != null
&& auditServiceRef.getService().isAuditRequired(AuditConstants.SECURITY_SAF_AUTHZ_DETAILS,
AuditConstants.SUCCESS)) {
// Create audit event
SAFAuthorizationDetailsEvent safAuthDetails = new SAFAuthorizationDetailsEvent(safReturnCode,
racfReturnCode, racfReasonCode, userSecurityName, applid, safProfile, safClass, authDecision,
principalName);
auditServiceRef.getService().sendEvent(safAuthDetails);
}
} | [
"private",
"void",
"auditEventSafAuthDetails",
"(",
"Object",
"[",
"]",
"methodParams",
")",
"{",
"// Getting object array which have audit fields",
"Object",
"[",
"]",
"varargs",
"=",
"(",
"Object",
"[",
"]",
")",
"methodParams",
"[",
"1",
"]",
";",
"// Get audit fields and convert them to respective type",
"int",
"safReturnCode",
"=",
"(",
"Integer",
")",
"varargs",
"[",
"0",
"]",
";",
"int",
"racfReturnCode",
"=",
"(",
"Integer",
")",
"varargs",
"[",
"1",
"]",
";",
"int",
"racfReasonCode",
"=",
"(",
"Integer",
")",
"varargs",
"[",
"2",
"]",
";",
"String",
"userSecurityName",
"=",
"(",
"String",
")",
"varargs",
"[",
"3",
"]",
";",
"String",
"safProfile",
"=",
"(",
"String",
")",
"varargs",
"[",
"4",
"]",
";",
"String",
"safClass",
"=",
"(",
"String",
")",
"varargs",
"[",
"5",
"]",
";",
"Boolean",
"authDecision",
"=",
"(",
"Boolean",
")",
"varargs",
"[",
"6",
"]",
";",
"String",
"principalName",
"=",
"(",
"String",
")",
"varargs",
"[",
"7",
"]",
";",
"String",
"applid",
"=",
"(",
"String",
")",
"varargs",
"[",
"8",
"]",
";",
"if",
"(",
"auditServiceRef",
".",
"getService",
"(",
")",
"!=",
"null",
"&&",
"auditServiceRef",
".",
"getService",
"(",
")",
".",
"isAuditRequired",
"(",
"AuditConstants",
".",
"SECURITY_SAF_AUTHZ_DETAILS",
",",
"AuditConstants",
".",
"SUCCESS",
")",
")",
"{",
"// Create audit event",
"SAFAuthorizationDetailsEvent",
"safAuthDetails",
"=",
"new",
"SAFAuthorizationDetailsEvent",
"(",
"safReturnCode",
",",
"racfReturnCode",
",",
"racfReasonCode",
",",
"userSecurityName",
",",
"applid",
",",
"safProfile",
",",
"safClass",
",",
"authDecision",
",",
"principalName",
")",
";",
"auditServiceRef",
".",
"getService",
"(",
")",
".",
"sendEvent",
"(",
"safAuthDetails",
")",
";",
"}",
"}"
] | Handles audit event for SECURITY_SAF_AUTH_DETAILS
@param methodParams | [
"Handles",
"audit",
"event",
"for",
"SECURITY_SAF_AUTH_DETAILS"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.request.probe.audit.servlet/src/com/ibm/ws/request/probe/audit/servlet/AuditPE.java#L685-L710 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.rest.handler/src/com/ibm/ws/rest/handler/internal/service/RESTHandlerContainerImpl.java | RESTHandlerContainerImpl.getValues | private String[] getValues(Object propValue) {
String[] keys = null;
if (propValue instanceof String) {
keys = new String[] { (String) propValue };
} else if (propValue instanceof String[]) {
keys = (String[]) propValue;
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Ignoring property with value: " + propValue);
}
return null;
}
for (String key : keys) {
// Ensure it starts with a slash ('/')
if (!key.startsWith("/")) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Ignoring property with value: " + key + " as it does not start with slash ('/')");
}
return null;
}
// Ensure its longer than just slash ('/')
if (key.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Ignoring proerty with value: " + key + " as it is empty");
}
return null;
}
}
return keys;
} | java | private String[] getValues(Object propValue) {
String[] keys = null;
if (propValue instanceof String) {
keys = new String[] { (String) propValue };
} else if (propValue instanceof String[]) {
keys = (String[]) propValue;
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Ignoring property with value: " + propValue);
}
return null;
}
for (String key : keys) {
// Ensure it starts with a slash ('/')
if (!key.startsWith("/")) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Ignoring property with value: " + key + " as it does not start with slash ('/')");
}
return null;
}
// Ensure its longer than just slash ('/')
if (key.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Ignoring proerty with value: " + key + " as it is empty");
}
return null;
}
}
return keys;
} | [
"private",
"String",
"[",
"]",
"getValues",
"(",
"Object",
"propValue",
")",
"{",
"String",
"[",
"]",
"keys",
"=",
"null",
";",
"if",
"(",
"propValue",
"instanceof",
"String",
")",
"{",
"keys",
"=",
"new",
"String",
"[",
"]",
"{",
"(",
"String",
")",
"propValue",
"}",
";",
"}",
"else",
"if",
"(",
"propValue",
"instanceof",
"String",
"[",
"]",
")",
"{",
"keys",
"=",
"(",
"String",
"[",
"]",
")",
"propValue",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Ignoring property with value: \"",
"+",
"propValue",
")",
";",
"}",
"return",
"null",
";",
"}",
"for",
"(",
"String",
"key",
":",
"keys",
")",
"{",
"// Ensure it starts with a slash ('/')",
"if",
"(",
"!",
"key",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Ignoring property with value: \"",
"+",
"key",
"+",
"\" as it does not start with slash ('/')\"",
")",
";",
"}",
"return",
"null",
";",
"}",
"// Ensure its longer than just slash ('/')",
"if",
"(",
"key",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Ignoring proerty with value: \"",
"+",
"key",
"+",
"\" as it is empty\"",
")",
";",
"}",
"return",
"null",
";",
"}",
"}",
"return",
"keys",
";",
"}"
] | Gets a set of values for a given property
@param handler
@return | [
"Gets",
"a",
"set",
"of",
"values",
"for",
"a",
"given",
"property"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.rest.handler/src/com/ibm/ws/rest/handler/internal/service/RESTHandlerContainerImpl.java#L119-L152 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.rest.handler/src/com/ibm/ws/rest/handler/internal/service/RESTHandlerContainerImpl.java | RESTHandlerContainerImpl.getHandler | public HandlerInfo getHandler(String requestURL) {
Iterator<HandlerPath> keys = handlerKeys.iterator();
if (requestURL == null || keys == null) {
return null;
}
// Check to see if we have a direct hit
Iterator<ServiceAndServiceReferencePair<RESTHandler>> itr = handlerMap.getServicesWithReferences(requestURL);
if (itr != null && itr.hasNext()) {
ServiceAndServiceReferencePair<RESTHandler> handler = itr.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Found direct URL match: " + handler);
}
return new HandlerInfo(handler.getService(), handler.getServiceReference());
}
// If no direct match, then try to match each one. Longest match wins.
HandlerPath bestMatchRoot = null;
while (keys.hasNext()) {
HandlerPath key = keys.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Checking HandlerPath: " + key.getRegisteredPath() + " | length: " + key.length());
}
if (key.matches(requestURL)) {
if (bestMatchRoot == null || key.length() > bestMatchRoot.length()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "New best match: " + key.getRegisteredPath());
}
bestMatchRoot = key;
}
}
}
// If we found a match...
if (bestMatchRoot != null) {
// Get the iterator. We MUST check hasNext first, because of how
// the underlying implementation is written.
itr = handlerMap.getServicesWithReferences(bestMatchRoot.getRegisteredPath());
if (itr != null && itr.hasNext()) {
ServiceAndServiceReferencePair<RESTHandler> handler = itr.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Final best handler: " + handler);
}
return new HandlerInfo(handler.getService(), handler.getServiceReference(), bestMatchRoot);
}
}
return null;
} | java | public HandlerInfo getHandler(String requestURL) {
Iterator<HandlerPath> keys = handlerKeys.iterator();
if (requestURL == null || keys == null) {
return null;
}
// Check to see if we have a direct hit
Iterator<ServiceAndServiceReferencePair<RESTHandler>> itr = handlerMap.getServicesWithReferences(requestURL);
if (itr != null && itr.hasNext()) {
ServiceAndServiceReferencePair<RESTHandler> handler = itr.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Found direct URL match: " + handler);
}
return new HandlerInfo(handler.getService(), handler.getServiceReference());
}
// If no direct match, then try to match each one. Longest match wins.
HandlerPath bestMatchRoot = null;
while (keys.hasNext()) {
HandlerPath key = keys.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Checking HandlerPath: " + key.getRegisteredPath() + " | length: " + key.length());
}
if (key.matches(requestURL)) {
if (bestMatchRoot == null || key.length() > bestMatchRoot.length()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "New best match: " + key.getRegisteredPath());
}
bestMatchRoot = key;
}
}
}
// If we found a match...
if (bestMatchRoot != null) {
// Get the iterator. We MUST check hasNext first, because of how
// the underlying implementation is written.
itr = handlerMap.getServicesWithReferences(bestMatchRoot.getRegisteredPath());
if (itr != null && itr.hasNext()) {
ServiceAndServiceReferencePair<RESTHandler> handler = itr.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Final best handler: " + handler);
}
return new HandlerInfo(handler.getService(), handler.getServiceReference(), bestMatchRoot);
}
}
return null;
} | [
"public",
"HandlerInfo",
"getHandler",
"(",
"String",
"requestURL",
")",
"{",
"Iterator",
"<",
"HandlerPath",
">",
"keys",
"=",
"handlerKeys",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"requestURL",
"==",
"null",
"||",
"keys",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// Check to see if we have a direct hit",
"Iterator",
"<",
"ServiceAndServiceReferencePair",
"<",
"RESTHandler",
">",
">",
"itr",
"=",
"handlerMap",
".",
"getServicesWithReferences",
"(",
"requestURL",
")",
";",
"if",
"(",
"itr",
"!=",
"null",
"&&",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"ServiceAndServiceReferencePair",
"<",
"RESTHandler",
">",
"handler",
"=",
"itr",
".",
"next",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Found direct URL match: \"",
"+",
"handler",
")",
";",
"}",
"return",
"new",
"HandlerInfo",
"(",
"handler",
".",
"getService",
"(",
")",
",",
"handler",
".",
"getServiceReference",
"(",
")",
")",
";",
"}",
"// If no direct match, then try to match each one. Longest match wins.",
"HandlerPath",
"bestMatchRoot",
"=",
"null",
";",
"while",
"(",
"keys",
".",
"hasNext",
"(",
")",
")",
"{",
"HandlerPath",
"key",
"=",
"keys",
".",
"next",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Checking HandlerPath: \"",
"+",
"key",
".",
"getRegisteredPath",
"(",
")",
"+",
"\" | length: \"",
"+",
"key",
".",
"length",
"(",
")",
")",
";",
"}",
"if",
"(",
"key",
".",
"matches",
"(",
"requestURL",
")",
")",
"{",
"if",
"(",
"bestMatchRoot",
"==",
"null",
"||",
"key",
".",
"length",
"(",
")",
">",
"bestMatchRoot",
".",
"length",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"New best match: \"",
"+",
"key",
".",
"getRegisteredPath",
"(",
")",
")",
";",
"}",
"bestMatchRoot",
"=",
"key",
";",
"}",
"}",
"}",
"// If we found a match...",
"if",
"(",
"bestMatchRoot",
"!=",
"null",
")",
"{",
"// Get the iterator. We MUST check hasNext first, because of how",
"// the underlying implementation is written.",
"itr",
"=",
"handlerMap",
".",
"getServicesWithReferences",
"(",
"bestMatchRoot",
".",
"getRegisteredPath",
"(",
")",
")",
";",
"if",
"(",
"itr",
"!=",
"null",
"&&",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"ServiceAndServiceReferencePair",
"<",
"RESTHandler",
">",
"handler",
"=",
"itr",
".",
"next",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Final best handler: \"",
"+",
"handler",
")",
";",
"}",
"return",
"new",
"HandlerInfo",
"(",
"handler",
".",
"getService",
"(",
")",
",",
"handler",
".",
"getServiceReference",
"(",
")",
",",
"bestMatchRoot",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Try to find the appropriate RESTHandler and HandlerPath pair for the given URL. Return null if no match found.
May return null for the HandlerPath field if the RESTHandler matched an URL that did not contain variables.
@param requestURL The URL from the HTTP request. This is the URL that needs to be matched. | [
"Try",
"to",
"find",
"the",
"appropriate",
"RESTHandler",
"and",
"HandlerPath",
"pair",
"for",
"the",
"given",
"URL",
".",
"Return",
"null",
"if",
"no",
"match",
"found",
".",
"May",
"return",
"null",
"for",
"the",
"HandlerPath",
"field",
"if",
"the",
"RESTHandler",
"matched",
"an",
"URL",
"that",
"did",
"not",
"contain",
"variables",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.rest.handler/src/com/ibm/ws/rest/handler/internal/service/RESTHandlerContainerImpl.java#L325-L383 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.rest.handler/src/com/ibm/ws/rest/handler/internal/service/RESTHandlerContainerImpl.java | RESTHandlerContainerImpl.registeredKeys | @Override
public Iterator<String> registeredKeys() {
Iterator<HandlerPath> paths = handlerKeys.iterator();
List<String> registeredKeys = new ArrayList<String>(handlerKeys.size());
while (paths.hasNext()) {
HandlerPath path = paths.next();
if (!path.isHidden()) {
registeredKeys.add(path.getRegisteredPath());
}
}
return registeredKeys.iterator();
} | java | @Override
public Iterator<String> registeredKeys() {
Iterator<HandlerPath> paths = handlerKeys.iterator();
List<String> registeredKeys = new ArrayList<String>(handlerKeys.size());
while (paths.hasNext()) {
HandlerPath path = paths.next();
if (!path.isHidden()) {
registeredKeys.add(path.getRegisteredPath());
}
}
return registeredKeys.iterator();
} | [
"@",
"Override",
"public",
"Iterator",
"<",
"String",
">",
"registeredKeys",
"(",
")",
"{",
"Iterator",
"<",
"HandlerPath",
">",
"paths",
"=",
"handlerKeys",
".",
"iterator",
"(",
")",
";",
"List",
"<",
"String",
">",
"registeredKeys",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"handlerKeys",
".",
"size",
"(",
")",
")",
";",
"while",
"(",
"paths",
".",
"hasNext",
"(",
")",
")",
"{",
"HandlerPath",
"path",
"=",
"paths",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"path",
".",
"isHidden",
"(",
")",
")",
"{",
"registeredKeys",
".",
"add",
"(",
"path",
".",
"getRegisteredPath",
"(",
")",
")",
";",
"}",
"}",
"return",
"registeredKeys",
".",
"iterator",
"(",
")",
";",
"}"
] | Return our registered keys. | [
"Return",
"our",
"registered",
"keys",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.rest.handler/src/com/ibm/ws/rest/handler/internal/service/RESTHandlerContainerImpl.java#L388-L400 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/HashedArray.java | HashedArray.get | synchronized public Element get(long index) {
int bind = ((int)index & Integer.MAX_VALUE) % buckets.length;
Element[] bucket = buckets[bind];
if (bucket == null)
return null;
for (int i = 0; i < counts[bind]; i++)
if (bucket[i].getIndex() == index)
return bucket[i];
return null;
} | java | synchronized public Element get(long index) {
int bind = ((int)index & Integer.MAX_VALUE) % buckets.length;
Element[] bucket = buckets[bind];
if (bucket == null)
return null;
for (int i = 0; i < counts[bind]; i++)
if (bucket[i].getIndex() == index)
return bucket[i];
return null;
} | [
"synchronized",
"public",
"Element",
"get",
"(",
"long",
"index",
")",
"{",
"int",
"bind",
"=",
"(",
"(",
"int",
")",
"index",
"&",
"Integer",
".",
"MAX_VALUE",
")",
"%",
"buckets",
".",
"length",
";",
"Element",
"[",
"]",
"bucket",
"=",
"buckets",
"[",
"bind",
"]",
";",
"if",
"(",
"bucket",
"==",
"null",
")",
"return",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"counts",
"[",
"bind",
"]",
";",
"i",
"++",
")",
"if",
"(",
"bucket",
"[",
"i",
"]",
".",
"getIndex",
"(",
")",
"==",
"index",
")",
"return",
"bucket",
"[",
"i",
"]",
";",
"return",
"null",
";",
"}"
] | Get an element from the array | [
"Get",
"an",
"element",
"from",
"the",
"array"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/HashedArray.java#L66-L75 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/HashedArray.java | HashedArray.set | synchronized public void set(Element value) {
int bind = ((int)value.getIndex() & Integer.MAX_VALUE) % buckets.length;
Element[] bucket = buckets[bind];
int count = counts[bind];
if (bucket == null)
buckets[bind] = bucket = new Element[initBucketSize];
else if (bucket.length == count) {
bucket = new Element[count * 2];
System.arraycopy(buckets[bind], 0, bucket, 0, count);
buckets[bind] = bucket;
}
bucket[count] = value;
counts[bind] = count + 1;
totalSize += 1;
} | java | synchronized public void set(Element value) {
int bind = ((int)value.getIndex() & Integer.MAX_VALUE) % buckets.length;
Element[] bucket = buckets[bind];
int count = counts[bind];
if (bucket == null)
buckets[bind] = bucket = new Element[initBucketSize];
else if (bucket.length == count) {
bucket = new Element[count * 2];
System.arraycopy(buckets[bind], 0, bucket, 0, count);
buckets[bind] = bucket;
}
bucket[count] = value;
counts[bind] = count + 1;
totalSize += 1;
} | [
"synchronized",
"public",
"void",
"set",
"(",
"Element",
"value",
")",
"{",
"int",
"bind",
"=",
"(",
"(",
"int",
")",
"value",
".",
"getIndex",
"(",
")",
"&",
"Integer",
".",
"MAX_VALUE",
")",
"%",
"buckets",
".",
"length",
";",
"Element",
"[",
"]",
"bucket",
"=",
"buckets",
"[",
"bind",
"]",
";",
"int",
"count",
"=",
"counts",
"[",
"bind",
"]",
";",
"if",
"(",
"bucket",
"==",
"null",
")",
"buckets",
"[",
"bind",
"]",
"=",
"bucket",
"=",
"new",
"Element",
"[",
"initBucketSize",
"]",
";",
"else",
"if",
"(",
"bucket",
".",
"length",
"==",
"count",
")",
"{",
"bucket",
"=",
"new",
"Element",
"[",
"count",
"*",
"2",
"]",
";",
"System",
".",
"arraycopy",
"(",
"buckets",
"[",
"bind",
"]",
",",
"0",
",",
"bucket",
",",
"0",
",",
"count",
")",
";",
"buckets",
"[",
"bind",
"]",
"=",
"bucket",
";",
"}",
"bucket",
"[",
"count",
"]",
"=",
"value",
";",
"counts",
"[",
"bind",
"]",
"=",
"count",
"+",
"1",
";",
"totalSize",
"+=",
"1",
";",
"}"
] | Set an element into the array | [
"Set",
"an",
"element",
"into",
"the",
"array"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/HashedArray.java#L80-L94 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/HashedArray.java | HashedArray.toArray | synchronized public Object[] toArray(Object[] values) {
int count = 0;
for (int bind = 0; bind < buckets.length; bind++) {
if (counts[bind] > 0)
System.arraycopy(buckets[bind], 0, values, count, counts[bind]);
count += counts[bind];
}
return values;
} | java | synchronized public Object[] toArray(Object[] values) {
int count = 0;
for (int bind = 0; bind < buckets.length; bind++) {
if (counts[bind] > 0)
System.arraycopy(buckets[bind], 0, values, count, counts[bind]);
count += counts[bind];
}
return values;
} | [
"synchronized",
"public",
"Object",
"[",
"]",
"toArray",
"(",
"Object",
"[",
"]",
"values",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"bind",
"=",
"0",
";",
"bind",
"<",
"buckets",
".",
"length",
";",
"bind",
"++",
")",
"{",
"if",
"(",
"counts",
"[",
"bind",
"]",
">",
"0",
")",
"System",
".",
"arraycopy",
"(",
"buckets",
"[",
"bind",
"]",
",",
"0",
",",
"values",
",",
"count",
",",
"counts",
"[",
"bind",
"]",
")",
";",
"count",
"+=",
"counts",
"[",
"bind",
"]",
";",
"}",
"return",
"values",
";",
"}"
] | Return the contents of the HashedArray as an array | [
"Return",
"the",
"contents",
"of",
"the",
"HashedArray",
"as",
"an",
"array"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/HashedArray.java#L110-L118 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/ApplicationManager.java | ApplicationManager.getProperty | @SuppressWarnings("unchecked")
private <T> T getProperty(Map<String, Object> properties, String name, T deflt) {
T value = deflt;
try {
T prop = (T) properties.get(name);
if (prop != null) {
value = prop;
}
} catch (ClassCastException e) {
//auto FFDC and allow the default value to be returned so that the server still starts
}
return value;
} | java | @SuppressWarnings("unchecked")
private <T> T getProperty(Map<String, Object> properties, String name, T deflt) {
T value = deflt;
try {
T prop = (T) properties.get(name);
if (prop != null) {
value = prop;
}
} catch (ClassCastException e) {
//auto FFDC and allow the default value to be returned so that the server still starts
}
return value;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"T",
"getProperty",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"String",
"name",
",",
"T",
"deflt",
")",
"{",
"T",
"value",
"=",
"deflt",
";",
"try",
"{",
"T",
"prop",
"=",
"(",
"T",
")",
"properties",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"prop",
"!=",
"null",
")",
"{",
"value",
"=",
"prop",
";",
"}",
"}",
"catch",
"(",
"ClassCastException",
"e",
")",
"{",
"//auto FFDC and allow the default value to be returned so that the server still starts",
"}",
"return",
"value",
";",
"}"
] | get a property and if not set, use the supplied default | [
"get",
"a",
"property",
"and",
"if",
"not",
"set",
"use",
"the",
"supplied",
"default"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/ApplicationManager.java#L71-L83 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.