_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q24900 | Util.isNewerThan | train | public static boolean isNewerThan(final Version left, final Version right) {
// major
if (left.getMajor() > right.getMajor()) return true;
if (left.getMajor() < right.getMajor()) return false;
// minor
if (left.getMinor() > right.getMinor()) return true;
if (left.getMinor() < right.getMinor()) return false;
/... | java | {
"resource": ""
} |
q24901 | Cryptor.encrypt | train | public static byte[] encrypt(byte[] input, String key, String algorithm, byte[] ivOrSalt, int iterations) throws PageException {
return crypt(input, key, algorithm, ivOrSalt, iterations, false);
} | java | {
"resource": ""
} |
q24902 | Cryptor.encrypt | train | public static String encrypt(String input, String key, String algorithm, byte[] ivOrSalt, int iterations, String encoding, String charset) throws PageException {
try {
if (charset == null) charset = DEFAULT_CHARSET;
if (encoding == null) encoding = DEFAULT_ENCODING;
byte[] baInput = input.getBytes(ch... | java | {
"resource": ""
} |
q24903 | Cryptor.decrypt | train | public static byte[] decrypt(byte[] input, String key, String algorithm, byte[] ivOrSalt, int iterations) throws PageException {
return crypt(input, key, algorithm, ivOrSalt, iterations, true);
} | java | {
"resource": ""
} |
q24904 | Cryptor.decrypt | train | public static String decrypt(String input, String key, String algorithm, byte[] ivOrSalt, int iterations, String encoding, String charset) throws PageException {
try {
if (charset == null) charset = DEFAULT_CHARSET;
if (encoding == null) encoding = DEFAULT_ENCODING;
byte[] baInput = Coder.decode(enco... | java | {
"resource": ""
} |
q24905 | DatasourceResourceProvider.release | train | void release(DatasourceConnection dc) {
if (dc != null) {
try {
dc.getConnection().commit();
dc.getConnection().setAutoCommit(true);
dc.getConnection().setTransactionIsolation(Connection.TRANSACTION_NONE);
}
catch (SQLException e) {}
getManager().releaseConnection(ThreadLocalPageContext.get... | java | {
"resource": ""
} |
q24906 | RestUtil.matchPath | train | public static int matchPath(Struct variables, Path[] restPath, String[] callerPath) {
if (restPath.length > callerPath.length) return -1;
int index = 0;
for (; index < restPath.length; index++) {
if (!restPath[index].match(variables, callerPath[index])) return -1;
}
return index - 1;
} | java | {
"resource": ""
} |
q24907 | GatewayEngineImpl.sendMessage | train | public String sendMessage(String gatewayId, Struct data) throws PageException, IOException {
Gateway g = getGateway(gatewayId);
if (g.getState() != Gateway.RUNNING) throw new GatewayException("Gateway [" + gatewayId + "] is not running");
return g.sendMessage(data);
} | java | {
"resource": ""
} |
q24908 | GatewayEngineImpl.stopAll | train | public void stopAll() {
Iterator<GatewayEntry> it = getEntries().values().iterator();
Gateway g;
while (it.hasNext()) {
g = it.next().getGateway();
if (g != null) stop(g);
}
} | java | {
"resource": ""
} |
q24909 | CompressUtil.compressGZip | train | private static void compressGZip(Resource source, Resource target) throws IOException {
if (source.isDirectory()) {
throw new IOException("you can only create a GZIP File from a single source file, use TGZ (TAR-GZIP) to first TAR multiple files");
}
InputStream is = null;
OutputStream os = null;
try {
is... | java | {
"resource": ""
} |
q24910 | CompressUtil._compressBZip2 | train | private static void _compressBZip2(InputStream source, OutputStream target) throws IOException {
InputStream is = IOUtil.toBufferedInputStream(source);
OutputStream os = new BZip2CompressorOutputStream(IOUtil.toBufferedOutputStream(target));
IOUtil.copy(is, os, true, true);
} | java | {
"resource": ""
} |
q24911 | WeakFieldStorage.getFields | train | public Field[] getFields(Class clazz, String fieldname) {
Struct fieldMap;
Object o;
synchronized (map) {
o = map.get(clazz);
if (o == null) {
fieldMap = store(clazz);
}
else fieldMap = (Struct) o;
}
o = fieldMap.get(fieldname, null);
if (o == null) return null;
return (Field[]) o;
} | java | {
"resource": ""
} |
q24912 | MappingImpl.cloneReadOnly | train | public MappingImpl cloneReadOnly(ConfigImpl config) {
return new MappingImpl(config, virtual, strPhysical, strArchive, inspect, physicalFirst, hidden, true, topLevel, appMapping, ignoreVirtual, appListener, listenerMode,
listenerType);
} | java | {
"resource": ""
} |
q24913 | FDCaster.serialize | train | public static String serialize(Object object) {
if (object == null) return "[null]";
try {
return new ScriptConverter().serialize(object);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return object.toString();
}
} | java | {
"resource": ""
} |
q24914 | MemberUtil.callWithNamedValues | train | public static Object callWithNamedValues(PageContext pc, Object coll, Collection.Key methodName, Struct args, short type, String strType) throws PageException {
Map<Key, FunctionLibFunction> members = getMembers(pc, type);
FunctionLibFunction member = members.get(methodName);
if (member != null) {
List<Functio... | java | {
"resource": ""
} |
q24915 | TimeZoneUtil.toTimeZone | train | public static TimeZone toTimeZone(String strTimezone, TimeZone defaultValue) {
if (strTimezone == null) return defaultValue;
String strTimezoneTrimmed = StringUtil.replace(strTimezone.trim().toLowerCase(), " ", "", false);
TimeZone tz = getTimeZoneFromIDS(strTimezoneTrimmed);
if (tz != null) return tz;
// parse ... | java | {
"resource": ""
} |
q24916 | InterpreterContext.getValueAsString | train | public String getValueAsString(Expression expr) throws PageException {
expr.writeOut(this, Expression.MODE_REF);
return Caster.toString(stack.pop());
} | java | {
"resource": ""
} |
q24917 | StringUtil.repeatString | train | public static String repeatString(String str, int count) {
if (count <= 0) return "";
char[] chars = str.toCharArray();
char[] rtn = new char[chars.length * count];
int pos = 0;
for (int i = 0; i < count; i++) {
for (int y = 0; y < chars.length; y++)
rtn[pos++] = chars[y];
// rtn.append(str);
}
retur... | java | {
"resource": ""
} |
q24918 | StringUtil.reqExpEscape | train | public static String reqExpEscape(String str) {
char[] arr = str.toCharArray();
StringBuilder sb = new StringBuilder(str.length() * 2);
for (int i = 0; i < arr.length; i++) {
sb.append('\\');
sb.append(arr[i]);
}
return sb.toString();
} | java | {
"resource": ""
} |
q24919 | StringUtil.toIdentityVariableName | train | public static String toIdentityVariableName(String varName) {
char[] chars = varName.toCharArray();
long changes = 0;
StringBuilder rtn = new StringBuilder(chars.length + 2);
rtn.append("CF");
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z... | java | {
"resource": ""
} |
q24920 | StringUtil.toClassName | train | public static String toClassName(String str) {
StringBuilder rtn = new StringBuilder();
String[] arr = str.split("[\\\\|//]");
for (int i = 0; i < arr.length; i++) {
if (arr[i].length() == 0) continue;
if (rtn.length() != 0) rtn.append('.');
char[] chars = arr[i].toCharArray();
long changes = 0;
... | java | {
"resource": ""
} |
q24921 | StringUtil.ltrim | train | public static String ltrim(String str, String defaultValue) {
if (str == null) return defaultValue;
int len = str.length();
int st = 0;
while ((st < len) && (str.charAt(st) <= ' ')) {
st++;
}
return ((st > 0)) ? str.substring(st) : str;
} | java | {
"resource": ""
} |
q24922 | StringUtil.rtrim | train | public static String rtrim(String str, String defaultValue) {
if (str == null) return defaultValue;
int len = str.length();
while ((0 < len) && (str.charAt(len - 1) <= ' ')) {
len--;
}
return (len < str.length()) ? str.substring(0, len) : str;
} | java | {
"resource": ""
} |
q24923 | StringUtil.trim | train | public static String trim(String str, String defaultValue) {
if (str == null) return defaultValue;
return str.trim();
} | java | {
"resource": ""
} |
q24924 | StringUtil.trim | train | public static String trim(String str, boolean removeBOM, boolean removeSpecialWhiteSpace, String defaultValue) {
if (str == null) return defaultValue;
if (str.isEmpty()) return str;
// remove leading BOM Marks
if (removeBOM) {
// UTF-16, big-endian
if (str.charAt(0) == '\uFEFF') str = str.substring(1);
... | java | {
"resource": ""
} |
q24925 | StringUtil.hasLineFeed | train | public static boolean hasLineFeed(String str) {
int len = str.length();
char c;
for (int i = 0; i < len; i++) {
c = str.charAt(i);
if (c == '\n' || c == '\r') return true;
}
return false;
} | java | {
"resource": ""
} |
q24926 | StringUtil.suppressWhiteSpace | train | public static String suppressWhiteSpace(String str) {
int len = str.length();
StringBuilder sb = new StringBuilder(len);
// boolean wasWS=false;
char c;
char buffer = 0;
for (int i = 0; i < len; i++) {
c = str.charAt(i);
if (c == '\n' || c == '\r') buffer = '\n';
else if (isWhiteSpace(c)) {
if (... | java | {
"resource": ""
} |
q24927 | StringUtil.replace | train | public static String replace(String input, String find, String repl, boolean firstOnly, boolean ignoreCase) {
int findLen = find.length();
if (findLen == 0) return input;
// String scan = input;
/*
* if ( ignoreCase ) { scan = scan.toLowerCase(); find = find.toLowerCase(); } else
*/ if (!ignoreCase && findL... | java | {
"resource": ""
} |
q24928 | StringUtil.startsWith | train | public static boolean startsWith(String str, char prefix) {
return str != null && str.length() > 0 && str.charAt(0) == prefix;
} | java | {
"resource": ""
} |
q24929 | StringUtil.endsWith | train | public static boolean endsWith(String str, char suffix) {
return str != null && str.length() > 0 && str.charAt(str.length() - 1) == suffix;
} | java | {
"resource": ""
} |
q24930 | StringUtil.startsWithIgnoreCase | train | public static boolean startsWithIgnoreCase(final String base, final String start) {
if (base.length() < start.length()) {
return false;
}
return base.regionMatches(true, 0, start, 0, start.length());
} | java | {
"resource": ""
} |
q24931 | StringUtil.endsWithIgnoreCase | train | public static boolean endsWithIgnoreCase(final String base, final String end) {
if (base.length() < end.length()) {
return false;
}
return base.regionMatches(true, base.length() - end.length(), end, 0, end.length());
} | java | {
"resource": ""
} |
q24932 | StringUtil.toLowerCase | train | public static String toLowerCase(String str) {
int len = str.length();
char c;
for (int i = 0; i < len; i++) {
c = str.charAt(i);
if (!((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'))) {
return str.toLowerCase();
}
}
return str;
} | java | {
"resource": ""
} |
q24933 | StringUtil.lastChar | train | public static char lastChar(String str) {
if (str == null || str.length() == 0) return 0;
return str.charAt(str.length() - 1);
} | java | {
"resource": ""
} |
q24934 | StringUtil.isAllAlpha | train | public static boolean isAllAlpha(String str) {
if (str == null) return false;
for (int i = str.length() - 1; i >= 0; i--) {
if (!Character.isLetter(str.charAt(i))) return false;
}
return true;
} | java | {
"resource": ""
} |
q24935 | StringUtil.isAllUpperCase | train | public static boolean isAllUpperCase(String str) {
if (str == null) return false;
boolean hasLetters = false;
char c;
for (int i = str.length() - 1; i >= 0; i--) {
c = str.charAt(i);
if (Character.isLetter(c)) {
if (!Character.isUpperCase(c)) return false;
hasLetters = true;
}
}
return h... | java | {
"resource": ""
} |
q24936 | StringUtil.substring | train | public static String substring(String str, int off, int len) {
return str.substring(off, off + len);
} | java | {
"resource": ""
} |
q24937 | Video.setNameconflict | train | public void setNameconflict(String nameconflict) throws PageException {
nameconflict = nameconflict.toLowerCase().trim();
if ("error".equals(nameconflict)) this.nameconflict = NAMECONFLICT_ERROR;
else if ("skip".equals(nameconflict)) this.nameconflict = NAMECONFLICT_SKIP;
else if ("overwrite".equals(nameconflict)) ... | java | {
"resource": ""
} |
q24938 | QueryColumnRef.touch | train | public Object touch(int row) throws PageException {
Object o = query.getAt(columnName, row, NullSupportHelper.NULL());
if (o != NullSupportHelper.NULL()) return o;
return query.setAt(columnName, row, new StructImpl());
} | java | {
"resource": ""
} |
q24939 | IPRangeCollection.findFast | train | public IPRangeNode findFast(String addr) {
InetAddress iaddr;
try {
iaddr = InetAddress.getByName(addr);
}
catch (UnknownHostException ex) {
return null;
}
return findFast(iaddr);
} | java | {
"resource": ""
} |
q24940 | Invoker.getConstructorParameterPairIgnoreCase | train | public static ConstructorParameterPair getConstructorParameterPairIgnoreCase(Class clazz, Object[] parameters) throws NoSuchMethodException {
// set all values
// Class objectClass=object.getClass();
if (parameters == null) parameters = new Object[0];
// set parameter classes
Class[] parameterClasses = new Class[... | java | {
"resource": ""
} |
q24941 | Invoker.callMethod | train | public static Object callMethod(Object object, String methodName, Object[] parameters)
throws NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
MethodParameterPair pair = getMethodParameterPairIgnoreCase(object.getClass(), methodName, parameters);
return pair.g... | java | {
"resource": ""
} |
q24942 | Invoker.getMethodParameterPairIgnoreCase | train | public static MethodParameterPair getMethodParameterPairIgnoreCase(Class objectClass, String methodName, Object[] parameters) throws NoSuchMethodException {
// set all values
if (parameters == null) parameters = new Object[0];
// set parameter classes
Class[] parameterClasses = new Class[parameters.length];
for (... | java | {
"resource": ""
} |
q24943 | Invoker.compareClasses | train | private static Object compareClasses(Object parameter, Class trgClass) {
Class srcClass = parameter.getClass();
trgClass = primitiveToWrapperType(trgClass);
try {
if (parameter instanceof ObjectWrap) parameter = ((ObjectWrap) parameter).getEmbededObject();
// parameter is already ok
if (srcClass == ... | java | {
"resource": ""
} |
q24944 | Invoker.primitiveToWrapperType | train | private static Class primitiveToWrapperType(Class clazz) {
// boolean, byte, char, short, int, long, float, and double
if (clazz == null) return null;
else if (clazz.isPrimitive()) {
if (clazz.getName().equals("boolean")) return Boolean.class;
else if (clazz.getName().equals("byte")) return Byte.class;
... | java | {
"resource": ""
} |
q24945 | Invoker.getProperty | train | public static Object getProperty(Object o, String prop) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
Field f = getFieldIgnoreCase(o.getClass(), prop);
return f.get(o);
} | java | {
"resource": ""
} |
q24946 | Invoker.setProperty | train | public static void setProperty(Object o, String prop, Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException {
getFieldIgnoreCase(o.getClass(), prop).set(o, value);
} | java | {
"resource": ""
} |
q24947 | Invoker.callStaticMethod | train | public static Object callStaticMethod(Class staticClass, String methodName, Object[] values) throws PageException {
if (values == null) values = new Object[0];
MethodParameterPair mp;
try {
mp = getMethodParameterPairIgnoreCase(staticClass, methodName, values);
}
catch (NoSuchMethodException e) {
throw ... | java | {
"resource": ""
} |
q24948 | CFMLFactoryImpl.resetPageContext | train | @Override
public void resetPageContext() {
SystemOut.printDate(config.getOutWriter(), "Reset " + pcs.size() + " Unused PageContexts");
pcs.clear();
Iterator<PageContextImpl> it = runningPcs.values().iterator();
while (it.hasNext()) {
it.next().reset();
}
} | java | {
"resource": ""
} |
q24949 | CFMLFactoryImpl.checkTimeout | train | @Override
public void checkTimeout() {
if (!engine.allowRequestTimeout()) return;
// print.e(MonitorState.checkForBlockedThreads(runningPcs.values()));
// print.e(MonitorState.checkForBlockedThreads(runningChildPcs.values()));
// synchronized (runningPcs) {
// int len=runningPcs.size();
// we only terminate... | java | {
"resource": ""
} |
q24950 | DebugResponse.printResults | train | public void printResults() {
System.out.println("[ --- Lucee Debug Response --- ]");
System.out.println();
System.out.println("----------------------------");
System.out.println("| Output |");
System.out.println("----------------------------");
System.out.println(write);
System.out.println();
... | java | {
"resource": ""
} |
q24951 | DebugResponse.printQuery | train | public void printQuery(final Query query) {
if (query != null) {
final String[] cols = query.getColumns();
final int rows = query.getRowCount();
System.out.println("[Query:" + query.getName() + "]");
for (int i = 0; i < cols.length; i++) {
if (i > 0) System.out.print(", ");
System.out.print(col... | java | {
"resource": ""
} |
q24952 | Module.toRealPath | train | private static String[] toRealPath(Config config, String dotPath) throws ExpressionException {
dotPath = dotPath.trim();
while (dotPath.indexOf('.') == 0) {
dotPath = dotPath.substring(1);
}
int len = -1;
while ((len = dotPath.length()) > 0 && dotPath.lastIndexOf('.') == len - 1) {
dotPath = dotPath.sub... | java | {
"resource": ""
} |
q24953 | DateCaster.toDateTime | train | public static DateTime toDateTime(Locale locale, String str, TimeZone tz, boolean useCommomDateParserAsWell) throws PageException {
DateTime dt = toDateTime(locale, str, tz, null, useCommomDateParserAsWell);
if (dt == null) {
String prefix = locale.getLanguage() + "-" + locale.getCountry() + "-";
throw new... | java | {
"resource": ""
} |
q24954 | DateCaster.toDateTime | train | public static DateTime toDateTime(Locale locale, String str, TimeZone tz, DateTime defaultValue, boolean useCommomDateParserAsWell) {
str = str.trim();
tz = ThreadLocalPageContext.getTimeZone(tz);
DateFormat[] df;
// get Calendar
Calendar c = JREDateTimeUtil.getThreadCalendar(locale, tz);
// datetime
ParsePosi... | java | {
"resource": ""
} |
q24955 | DateCaster.toTime | train | public static Time toTime(TimeZone timeZone, Object o) throws PageException {
if (o instanceof Time) return (Time) o;
else if (o instanceof Date) return new TimeImpl((Date) o);
else if (o instanceof Castable) return new TimeImpl(((Castable) o).castToDateTime());
else if (o instanceof String) {
Time dt = toTime... | java | {
"resource": ""
} |
q24956 | DateCaster.toTime | train | public static Time toTime(TimeZone timeZone, String str, Time defaultValue) {
if (str == null || str.length() < 3) {
return defaultValue;
}
DateString ds = new DateString(str);
// Timestamp
if (ds.isCurrent('{') && ds.isLast('}')) {
// Time
// "^\\{t '([0-9]{1,2}):([0-9]{1,2}):([0-9]{2})'\\}$"
... | java | {
"resource": ""
} |
q24957 | DateCaster.parseDateTime | train | private static DateTime parseDateTime(String str, DateString ds, short convertingType, boolean alsoMonthString, TimeZone timeZone, DateTime defaultValue) {
int month = 0;
int first = ds.readDigits();
// first
if (first == -1) {
if (!alsoMonthString) return defaultValue;
first = ds.readMonthString();
... | java | {
"resource": ""
} |
q24958 | DateCaster.readOffset | train | private static DateTime readOffset(boolean isPlus, TimeZone timeZone, DateTime dt, int years, int months, int days, int hours, int minutes, int seconds, int milliSeconds,
DateString ds, boolean checkAfterLast, DateTime defaultValue) {
// timeZone=ThreadLocalPageContext.getTimeZone(timeZone);
if (timeZone == null... | java | {
"resource": ""
} |
q24959 | CFMLWriterWSPref.printBuffer | train | synchronized void printBuffer() throws IOException { // TODO: is synchronized really needed here?
int len = sb.length();
if (len > 0) {
char[] chars = new char[len];
sb.getChars(0, len, chars, 0);
sb.setLength(0);
super.write(chars, 0, chars.length);
}
} | java | {
"resource": ""
} |
q24960 | CFMLWriterWSPref.addToBuffer | train | boolean addToBuffer(char c) throws IOException {
int len = sb.length();
if (len == 0 && c != CHAR_LT) return false; // buffer must starts with '<'
sb.append(c); // if we reached this point then we will return true
if (++len >= minTagLen) { // increment len as it was sampled before we appended c
boolean isClos... | java | {
"resource": ""
} |
q24961 | CFMLWriterWSPref.print | train | @Override
public void print(char c) throws IOException {
boolean isWS = Character.isWhitespace(c);
if (isWS) {
if (isFirstChar) // ignore all WS before non-WS content
return;
if (c == CHAR_RETURN) // ignore Carriage-Return chars
return;
if (sb.length() > 0) {
printBuffer(); // buffer should n... | java | {
"resource": ""
} |
q24962 | HtmlEmailImpl.setTextMsg | train | public HtmlEmailImpl setTextMsg(String aText) throws EmailException {
if (StringUtil.isEmpty(aText)) {
throw new EmailException("Invalid message supplied");
}
this.text = aText;
return this;
} | java | {
"resource": ""
} |
q24963 | HtmlEmailImpl.setHtmlMsg | train | public HtmlEmailImpl setHtmlMsg(String aHtml) throws EmailException {
if (StringUtil.isEmpty(aHtml)) {
throw new EmailException("Invalid message supplied");
}
this.html = aHtml;
return this;
} | java | {
"resource": ""
} |
q24964 | HtmlEmailImpl.embed | train | public void embed(URL url, String cid, String name) throws EmailException {
// verify that the URL is valid
try {
InputStream is = url.openStream();
is.close();
}
catch (IOException e) {
throw new EmailException("Invalid URL");
}
MimeBodyPart mbp = new MimeBodyPart();
try {
mbp.setDataHandl... | java | {
"resource": ""
} |
q24965 | HtmlEmailImpl.buildMimeMessage | train | @Override
public void buildMimeMessage() throws EmailException {
try {
// if the email has attachments then the base type is mixed,
// otherwise it should be related
if (this.isBoolHasAttachments()) {
this.buildAttachments();
}
else {
this.buildNoAttachments();
}
}
catch (Messa... | java | {
"resource": ""
} |
q24966 | IPSettings.put | train | public synchronized void put(IPRangeNode<Map> ipr, boolean doCheck) {
IPRangeNode parent = ipr.isV4() ? ipv4 : ipv6;
parent.addChild(ipr, doCheck);
version++;
isSorted = false;
} | java | {
"resource": ""
} |
q24967 | IPSettings.get | train | public IPRangeNode get(InetAddress addr) {
if (version == 0) // no data was added
return null;
IPRangeNode node = isV4(addr) ? ipv4 : ipv6;
if (!this.isSorted) this.optimize();
return node.findFast(addr);
} | java | {
"resource": ""
} |
q24968 | ComponentProperties.getWsdlFile | train | public String getWsdlFile() {
if (meta == null) return null;
return (String) meta.get(WSDL_FILE, null);
} | java | {
"resource": ""
} |
q24969 | NtpMessage.toByteArray | train | public byte[] toByteArray() {
// All bytes are automatically set to 0
byte[] p = new byte[48];
p[0] = (byte) (leapIndicator << 6 | version << 3 | mode);
p[1] = (byte) stratum;
p[2] = pollInterval;
p[3] = precision;
// root delay is a signed 16.16-bit FP, in Java an int is 32-bits
int l = (int) (rootDelay * 65... | java | {
"resource": ""
} |
q24970 | NtpMessage.encodeTimestamp | train | public static void encodeTimestamp(byte[] array, int pointer, double timestamp) {
// Converts a double into a 64-bit fixed point
for (int i = 0; i < 8; i++) {
// 2^24, 2^16, 2^8, .. 2^-32
double base = Math.pow(2, (3 - i) * 8);
// Capture byte value
array[pointer + i] = (byte) (timestamp / base);... | java | {
"resource": ""
} |
q24971 | NtpMessage.referenceIdentifierToString | train | public static String referenceIdentifierToString(byte[] ref, short stratum, byte version) {
// From the RFC 2030:
// In the case of NTP Version 3 or Version 4 stratum-0 (unspecified)
// or stratum-1 (primary) servers, this is a four-character ASCII
// string, left justified and zero padded to 32 bits.
if (stratum ... | java | {
"resource": ""
} |
q24972 | Operator.compare | train | public static int compare(Object left, Object right) throws PageException {
// print.dumpStack();
if (left instanceof String) return compare((String) left, right);
else if (left instanceof Number) return compare(((Number) left).doubleValue(), right);
else if (left instanceof Boolean) return compare(((Boolean) left)... | java | {
"resource": ""
} |
q24973 | Operator.compare | train | public static int compare(String left, String right) {
if (Decision.isNumber(left)) {
if (Decision.isNumber(right)) {
// long numbers
if (left.length() > 9 || right.length() > 9) {
try {
return new BigDecimal(left).compareTo(new BigDecimal(right));
}
catch (Throwable t) {
ExceptionUtil... | java | {
"resource": ""
} |
q24974 | Operator.compare | train | public static int compare(String left, double right) {
if (Decision.isNumber(left)) {
if (left.length() > 9) {
try {
return new BigDecimal(left).compareTo(new BigDecimal(Caster.toString(right)));
}
catch (Exception e) {}
}
return compare(Caster.toDoubleValue(left, Double.NaN), right);
}
if... | java | {
"resource": ""
} |
q24975 | Operator.compare | train | public static int compare(Date left, String right) throws PageException {
if (Decision.isNumber(right)) return compare(left.getTime() / 1000, Caster.toDoubleValue(right));
DateTime dt = DateCaster.toDateAdvanced(right, DateCaster.CONVERTING_TYPE_OFFSET, null, null);
if (dt != null) {
return compare(left.getTime... | java | {
"resource": ""
} |
q24976 | Operator.compare | train | public static int compare(Date left, double right) {
return compare(left.getTime() / 1000, DateTimeUtil.getInstance().toDateTime(right).getTime() / 1000);
} | java | {
"resource": ""
} |
q24977 | Operator.compare | train | public static int compare(Date left, Date right) {
return compare(left.getTime() / 1000, right.getTime() / 1000);
} | java | {
"resource": ""
} |
q24978 | Operator.exponent | train | public static double exponent(Object left, Object right) throws PageException {
return StrictMath.pow(Caster.toDoubleValue(left), Caster.toDoubleValue(right));
} | java | {
"resource": ""
} |
q24979 | Operator.concat | train | public static CharSequence concat(CharSequence left, CharSequence right) {
if (left instanceof Appendable) {
try {
((Appendable) left).append(right);
return left;
}
catch (IOException e) {}
}
return new StringBuilder(left).append(right);
} | java | {
"resource": ""
} |
q24980 | ExpressionUtil.visitLine | train | public static void visitLine(BytecodeContext bc, Position pos) {
if (pos != null) {
visitLine(bc, pos.line);
}
} | java | {
"resource": ""
} |
q24981 | ExpressionUtil.writeOutSilent | train | public static void writeOutSilent(Expression value, BytecodeContext bc, int mode) throws TransformerException {
Position start = value.getStart();
Position end = value.getEnd();
value.setStart(null);
value.setEnd(null);
value.writeOut(bc, mode);
value.setStart(start);
value.setEnd(end);
} | java | {
"resource": ""
} |
q24982 | TagUtil.addTagMetaData | train | public static void addTagMetaData(ConfigWebImpl cw, lucee.commons.io.log.Log log) {
if (true) return;
PageContextImpl pc = null;
try {
pc = ThreadUtil.createPageContext(cw, DevNullOutputStream.DEV_NULL_OUTPUT_STREAM, "localhost", "/", "", new Cookie[0], new Pair[0], null, new Pair[0], new StructImpl(),
f... | java | {
"resource": ""
} |
q24983 | TagUtil.invokeBIF | train | public static Object invokeBIF(PageContext pc, Object[] args, String className, String bundleName, String bundleVersion) throws PageException {
try {
Class<?> clazz = ClassUtil.loadClassByBundle(className, bundleName, bundleVersion, pc.getConfig().getIdentification());
BIF bif;
if (Reflector.isInstaneOf... | java | {
"resource": ""
} |
q24984 | LDAPClient.setCredential | train | public void setCredential(String username, String password) {
if (username != null) {
env.put("java.naming.security.principal", username);
env.put("java.naming.security.credentials", password);
}
else {
env.remove("java.naming.security.principal");
env.remove("java.naming.security.credentials");
... | java | {
"resource": ""
} |
q24985 | LDAPClient.setSecureLevel | train | public void setSecureLevel(short secureLevel) throws ClassException {
// Security
if (secureLevel == SECURE_CFSSL_BASIC) {
env.put("java.naming.security.protocol", "ssl");
env.put("java.naming.ldap.factory.socket", "javax.net.ssl.SSLSocketFactory");
ClassUtil.loadClass("com.sun.net.ssl.internal.ssl.Pro... | java | {
"resource": ""
} |
q24986 | LDAPClient.setReferral | train | public void setReferral(int referral) {
if (referral > 0) {
env.put("java.naming.referral", "follow");
env.put("java.naming.ldap.referral.limit", Caster.toString(referral));
}
else {
env.put("java.naming.referral", "ignore");
env.remove("java.naming.ldap.referral.limit");
}
} | java | {
"resource": ""
} |
q24987 | LDAPClient.add | train | public void add(String dn, String attributes, String delimiter, String seperator) throws NamingException, PageException {
DirContext ctx = new InitialDirContext(env);
ctx.createSubcontext(dn, toAttributes(attributes, delimiter, seperator));
ctx.close();
} | java | {
"resource": ""
} |
q24988 | LDAPClient.delete | train | public void delete(String dn) throws NamingException {
DirContext ctx = new InitialDirContext(env);
ctx.destroySubcontext(dn);
ctx.close();
} | java | {
"resource": ""
} |
q24989 | LDAPClient.modifydn | train | public void modifydn(String dn, String attributes) throws NamingException {
DirContext ctx = new InitialDirContext(env);
ctx.rename(dn, attributes);
ctx.close();
} | java | {
"resource": ""
} |
q24990 | SpoolerEngineImpl.execute | train | @Override
public PageException execute(String id) {
SpoolerTask task = getTaskById(openDirectory, id);
if (task == null) task = getTaskById(closedDirectory, id);
if (task != null) {
return execute(task);
}
return null;
} | java | {
"resource": ""
} |
q24991 | SMTPClient.add | train | protected static InternetAddress[] add(InternetAddress[] oldArr, InternetAddress newValue) {
if (oldArr == null) return new InternetAddress[] { newValue };
// else {
InternetAddress[] tmp = new InternetAddress[oldArr.length + 1];
for (int i = 0; i < oldArr.length; i++) {
tmp[i] = oldArr[i];
}
tmp[oldArr.leng... | java | {
"resource": ""
} |
q24992 | SMTPClient.clean | train | private static void clean(Config config, Attachment[] attachmentz) {
if (attachmentz != null) for (int i = 0; i < attachmentz.length; i++) {
if (attachmentz[i].isRemoveAfterSend()) {
Resource res = config.getResource(attachmentz[i].getAbsolutePath());
ResourceUtil.removeEL(res, true);
}
}
} | java | {
"resource": ""
} |
q24993 | RWKeyLock.isWriteLocked | train | public Boolean isWriteLocked(K token) {
RWLock<K> lock = locks.get(token);
if (lock == null) return null;
return lock.isWriteLocked();
} | java | {
"resource": ""
} |
q24994 | FormatUtil.getCFMLFormats | train | public static DateFormat[] getCFMLFormats(TimeZone tz, boolean lenient) {
String id = "cfml-" + Locale.ENGLISH.toString() + "-" + tz.getID() + "-" + lenient;
DateFormat[] df = formats.get(id);
if (df == null) {
df = new SimpleDateFormat[] { new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH), new... | java | {
"resource": ""
} |
q24995 | Directory.setMode | train | public void setMode(String mode) throws PageException {
try {
this.mode = ModeUtil.toOctalMode(mode);
}
catch (IOException e) {
throw Caster.toPageException(e);
}
} | java | {
"resource": ""
} |
q24996 | Directory.setNameconflict | train | public void setNameconflict(String nameconflict) throws ApplicationException {
this.nameconflict = FileUtil.toNameConflict(nameconflict, NAMECONFLICT_UNDEFINED | NAMECONFLICT_ERROR | NAMECONFLICT_OVERWRITE, NAMECONFLICT_DEFAULT);
} | java | {
"resource": ""
} |
q24997 | Directory.actionRename | train | public static void actionRename(PageContext pc, Resource directory, String strNewdirectory, String serverPassword, boolean createPath, Object acl, String storage)
throws PageException {
// check directory
SecurityManager securityManager = pc.getConfig().getSecurityManager();
securityManager.checkFileLocation(pc... | java | {
"resource": ""
} |
q24998 | CharBuffer.append | train | public void append(String str) {
if (str == null) return;
int restLength = buffer.length - pos;
if (str.length() < restLength) {
str.getChars(0, str.length(), buffer, pos);
pos += str.length();
}
else {
str.getChars(0, restLength, buffer, pos);
curr.next = new Entity(buffer);
curr = curr.n... | java | {
"resource": ""
} |
q24999 | CharBuffer.toCharArray | train | public char[] toCharArray() {
Entity e = root;
char[] chrs = new char[size()];
int off = 0;
while (e.next != null) {
e = e.next;
System.arraycopy(e.data, 0, chrs, off, e.data.length);
off += e.data.length;
}
System.arraycopy(buffer, 0, chrs, off, pos);
return chrs;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.