repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbConnection.java
MariaDbConnection.getWarnings
public SQLWarning getWarnings() throws SQLException { if (warningsCleared || isClosed() || !protocol.hasWarnings()) { return null; } SQLWarning last = null; SQLWarning first = null; try (Statement st = this.createStatement()) { try (ResultSet rs = st.executeQuery("show warnings")) { // returned result set has 'level', 'code' and 'message' columns, in this order. while (rs.next()) { int code = rs.getInt(2); String message = rs.getString(3); SQLWarning warning = new SQLWarning(message, ExceptionMapper.mapCodeToSqlState(code), code); if (first == null) { first = warning; last = warning; } else { last.setNextWarning(warning); last = warning; } } } } return first; }
java
public SQLWarning getWarnings() throws SQLException { if (warningsCleared || isClosed() || !protocol.hasWarnings()) { return null; } SQLWarning last = null; SQLWarning first = null; try (Statement st = this.createStatement()) { try (ResultSet rs = st.executeQuery("show warnings")) { // returned result set has 'level', 'code' and 'message' columns, in this order. while (rs.next()) { int code = rs.getInt(2); String message = rs.getString(3); SQLWarning warning = new SQLWarning(message, ExceptionMapper.mapCodeToSqlState(code), code); if (first == null) { first = warning; last = warning; } else { last.setNextWarning(warning); last = warning; } } } } return first; }
[ "public", "SQLWarning", "getWarnings", "(", ")", "throws", "SQLException", "{", "if", "(", "warningsCleared", "||", "isClosed", "(", ")", "||", "!", "protocol", ".", "hasWarnings", "(", ")", ")", "{", "return", "null", ";", "}", "SQLWarning", "last", "=", ...
<p>Retrieves the first warning reported by calls on this <code>Connection</code> object. If there is more than one warning, subsequent warnings will be chained to the first one and can be retrieved by calling the method <code>SQLWarning.getNextWarning</code> on the warning that was retrieved previously.</p> <p>This method may not be called on a closed connection; doing so will cause an <code>SQLException</code> to be thrown.</p> <p><B>Note:</B> Subsequent warnings will be chained to this SQLWarning.</p> @return the first <code>SQLWarning</code> object or <code>null</code> if there are none @throws SQLException if a database access error occurs or this method is called on a closed connection @see SQLWarning
[ "<p", ">", "Retrieves", "the", "first", "warning", "reported", "by", "calls", "on", "this", "<code", ">", "Connection<", "/", "code", ">", "object", ".", "If", "there", "is", "more", "than", "one", "warning", "subsequent", "warnings", "will", "be", "chaine...
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbConnection.java#L997-L1024
graphhopper/graphhopper
core/src/main/java/com/graphhopper/routing/subnetwork/SubnetworkStorage.java
SubnetworkStorage.setSubnetwork
public void setSubnetwork(int nodeId, int subnetwork) { if (subnetwork > 127) throw new IllegalArgumentException("Number of subnetworks is currently limited to 127 but requested " + subnetwork); byte[] bytes = new byte[1]; bytes[0] = (byte) subnetwork; da.setBytes(nodeId, bytes, bytes.length); }
java
public void setSubnetwork(int nodeId, int subnetwork) { if (subnetwork > 127) throw new IllegalArgumentException("Number of subnetworks is currently limited to 127 but requested " + subnetwork); byte[] bytes = new byte[1]; bytes[0] = (byte) subnetwork; da.setBytes(nodeId, bytes, bytes.length); }
[ "public", "void", "setSubnetwork", "(", "int", "nodeId", ",", "int", "subnetwork", ")", "{", "if", "(", "subnetwork", ">", "127", ")", "throw", "new", "IllegalArgumentException", "(", "\"Number of subnetworks is currently limited to 127 but requested \"", "+", "subnetwo...
This method sets the subnetwork if of the specified nodeId. Default is 0 and means subnetwork was too small to be useful to be stored.
[ "This", "method", "sets", "the", "subnetwork", "if", "of", "the", "specified", "nodeId", ".", "Default", "is", "0", "and", "means", "subnetwork", "was", "too", "small", "to", "be", "useful", "to", "be", "stored", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/subnetwork/SubnetworkStorage.java#L54-L61
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/transform/Transformation.java
Transformation.addOutputProperty
public void addOutputProperty(String name, String value) { if (name == null) { throw new IllegalArgumentException("name must not be null"); } if (value == null) { throw new IllegalArgumentException("value must not be null"); } output.setProperty(name, value); }
java
public void addOutputProperty(String name, String value) { if (name == null) { throw new IllegalArgumentException("name must not be null"); } if (value == null) { throw new IllegalArgumentException("value must not be null"); } output.setProperty(name, value); }
[ "public", "void", "addOutputProperty", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"name must not be null\"", ")", ";", "}", "if", "(", "value", "==", ...
Add a named output property. @param name name of the property - must not be null @param value value of the property - must not be null
[ "Add", "a", "named", "output", "property", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/transform/Transformation.java#L84-L92
weld/core
environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/WeldServletLifecycle.java
WeldServletLifecycle.findContainer
protected Container findContainer(ContainerContext ctx, StringBuilder dump) { Container container = null; // 1. Custom container class String containerClassName = ctx.getServletContext().getInitParameter(Container.CONTEXT_PARAM_CONTAINER_CLASS); if (containerClassName != null) { try { Class<Container> containerClass = Reflections.classForName(resourceLoader, containerClassName); container = SecurityActions.newInstance(containerClass); WeldServletLogger.LOG.containerDetectionSkipped(containerClassName); } catch (Exception e) { WeldServletLogger.LOG.unableToInstantiateCustomContainerClass(containerClassName); WeldServletLogger.LOG.catchingDebug(e); } } if (container == null) { // 2. Service providers Iterable<Container> extContainers = ServiceLoader.load(Container.class, getClass().getClassLoader()); container = checkContainers(ctx, dump, extContainers); if (container == null) { // 3. Built-in containers in predefined order container = checkContainers(ctx, dump, Arrays.asList(TomcatContainer.INSTANCE, JettyContainer.INSTANCE, UndertowContainer.INSTANCE, GwtDevHostedModeContainer.INSTANCE)); } } return container; }
java
protected Container findContainer(ContainerContext ctx, StringBuilder dump) { Container container = null; // 1. Custom container class String containerClassName = ctx.getServletContext().getInitParameter(Container.CONTEXT_PARAM_CONTAINER_CLASS); if (containerClassName != null) { try { Class<Container> containerClass = Reflections.classForName(resourceLoader, containerClassName); container = SecurityActions.newInstance(containerClass); WeldServletLogger.LOG.containerDetectionSkipped(containerClassName); } catch (Exception e) { WeldServletLogger.LOG.unableToInstantiateCustomContainerClass(containerClassName); WeldServletLogger.LOG.catchingDebug(e); } } if (container == null) { // 2. Service providers Iterable<Container> extContainers = ServiceLoader.load(Container.class, getClass().getClassLoader()); container = checkContainers(ctx, dump, extContainers); if (container == null) { // 3. Built-in containers in predefined order container = checkContainers(ctx, dump, Arrays.asList(TomcatContainer.INSTANCE, JettyContainer.INSTANCE, UndertowContainer.INSTANCE, GwtDevHostedModeContainer.INSTANCE)); } } return container; }
[ "protected", "Container", "findContainer", "(", "ContainerContext", "ctx", ",", "StringBuilder", "dump", ")", "{", "Container", "container", "=", "null", ";", "// 1. Custom container class", "String", "containerClassName", "=", "ctx", ".", "getServletContext", "(", ")...
Find container env. @param ctx the container context @param dump the exception dump @return valid container or null
[ "Find", "container", "env", "." ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/WeldServletLifecycle.java#L341-L366
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hylafax/HylaFaxClientSpi.java
HylaFaxClientSpi.cancelFaxJob
protected void cancelFaxJob(HylaFaxJob faxJob,HylaFAXClient client) throws Exception { //get job Job job=faxJob.getHylaFaxJob(); //cancel job client.kill(job); }
java
protected void cancelFaxJob(HylaFaxJob faxJob,HylaFAXClient client) throws Exception { //get job Job job=faxJob.getHylaFaxJob(); //cancel job client.kill(job); }
[ "protected", "void", "cancelFaxJob", "(", "HylaFaxJob", "faxJob", ",", "HylaFAXClient", "client", ")", "throws", "Exception", "{", "//get job", "Job", "job", "=", "faxJob", ".", "getHylaFaxJob", "(", ")", ";", "//cancel job", "client", ".", "kill", "(", "job",...
This function will cancel an existing fax job. @param client The client instance @param faxJob The fax job object containing the needed information @throws Exception Any exception
[ "This", "function", "will", "cancel", "an", "existing", "fax", "job", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxClientSpi.java#L491-L498
mygreen/excel-cellformatter
src/main/java/com/github/mygreen/cellformatter/lang/MessageResolver.java
MessageResolver.loadDefaultResource
private MessageResource loadDefaultResource(final boolean allowedNoDefault, final boolean appendUserResource) { final String path = getPropertyPath(); Properties props = new Properties(); try { props.load(new InputStreamReader(MessageResolver.class.getResourceAsStream(path), "UTF-8")); } catch (NullPointerException | IOException e) { if(allowedNoDefault) { return MessageResource.NULL_OBJECT; } else { throw new RuntimeException("fail default properties. :" + path, e); } } final MessageResource resource = new MessageResource(); final Enumeration<?> keys = props.propertyNames(); while(keys.hasMoreElements()) { String key = (String) keys.nextElement(); String value = props.getProperty(key); resource.addMessage(key, value); } // ユーザのリソースの読み込み if(appendUserResource) { resource.addMessage(loadUserResource(path)); } return resource; }
java
private MessageResource loadDefaultResource(final boolean allowedNoDefault, final boolean appendUserResource) { final String path = getPropertyPath(); Properties props = new Properties(); try { props.load(new InputStreamReader(MessageResolver.class.getResourceAsStream(path), "UTF-8")); } catch (NullPointerException | IOException e) { if(allowedNoDefault) { return MessageResource.NULL_OBJECT; } else { throw new RuntimeException("fail default properties. :" + path, e); } } final MessageResource resource = new MessageResource(); final Enumeration<?> keys = props.propertyNames(); while(keys.hasMoreElements()) { String key = (String) keys.nextElement(); String value = props.getProperty(key); resource.addMessage(key, value); } // ユーザのリソースの読み込み if(appendUserResource) { resource.addMessage(loadUserResource(path)); } return resource; }
[ "private", "MessageResource", "loadDefaultResource", "(", "final", "boolean", "allowedNoDefault", ",", "final", "boolean", "appendUserResource", ")", "{", "final", "String", "path", "=", "getPropertyPath", "(", ")", ";", "Properties", "props", "=", "new", "Propertie...
プロパティファイルから取得する。 <p>プロパティ名を補完する。 @param path プロパティファイルのパス名 @param allowedNoDefault デフォルトのメッセージがない場合を許可するかどうか。 @param appendUserResource クラスパスのルートにあるユーザ定義のメッセージソースも読み込むかどうか指定します。 @return
[ "プロパティファイルから取得する。", "<p", ">", "プロパティ名を補完する。" ]
train
https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/lang/MessageResolver.java#L128-L158
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.removeVolumes
public void removeVolumes(Configuration conf, List<File> directories) throws Exception { if (directories == null || directories.isEmpty()) { DataNode.LOG.warn("There were no directories to remove. Exiting "); return; } List<FSVolume> volArray = null; lock.readLock().lock(); try { volArray = volumes.removeBVolumes(directories); } finally { lock.readLock().unlock(); } // remove related blocks long mlsec = System.currentTimeMillis(); lock.writeLock().lock(); try { volumeMap.removeUnhealthyVolumes(volArray); } finally { lock.writeLock().unlock(); } mlsec = System.currentTimeMillis() - mlsec; DataNode.LOG.warn(">>>>>>>>>Removing these blocks took " + mlsec + " millisecs in refresh<<<<<<<<<<<<<<< "); StringBuilder sb = new StringBuilder(); for(FSVolume fv : volArray) { sb.append(fv.toString() + ";"); } throw new DiskErrorException("These volumes were removed: " + sb); }
java
public void removeVolumes(Configuration conf, List<File> directories) throws Exception { if (directories == null || directories.isEmpty()) { DataNode.LOG.warn("There were no directories to remove. Exiting "); return; } List<FSVolume> volArray = null; lock.readLock().lock(); try { volArray = volumes.removeBVolumes(directories); } finally { lock.readLock().unlock(); } // remove related blocks long mlsec = System.currentTimeMillis(); lock.writeLock().lock(); try { volumeMap.removeUnhealthyVolumes(volArray); } finally { lock.writeLock().unlock(); } mlsec = System.currentTimeMillis() - mlsec; DataNode.LOG.warn(">>>>>>>>>Removing these blocks took " + mlsec + " millisecs in refresh<<<<<<<<<<<<<<< "); StringBuilder sb = new StringBuilder(); for(FSVolume fv : volArray) { sb.append(fv.toString() + ";"); } throw new DiskErrorException("These volumes were removed: " + sb); }
[ "public", "void", "removeVolumes", "(", "Configuration", "conf", ",", "List", "<", "File", ">", "directories", ")", "throws", "Exception", "{", "if", "(", "directories", "==", "null", "||", "directories", ".", "isEmpty", "(", ")", ")", "{", "DataNode", "."...
remove directories that are given from the list of volumes to use. This function also makes sure to remove all the blocks that belong to these volumes.
[ "remove", "directories", "that", "are", "given", "from", "the", "list", "of", "volumes", "to", "use", ".", "This", "function", "also", "makes", "sure", "to", "remove", "all", "the", "blocks", "that", "belong", "to", "these", "volumes", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2873-L2902