id
stringlengths
7
14
text
stringlengths
1
37.2k
514315_100
@POST @Path("/{clazz}/{keyName}") @Produces({MediaType.APPLICATION_JSON, RexsterMediaType.APPLICATION_REXSTER_JSON, RexsterMediaType.APPLICATION_REXSTER_TYPED_JSON}) @Timed(name = "http.rest.key-indices.class.object.post", absolute = true) public Response postIndexKey(@PathParam("graphname") final String graphName, @Pa...
520116_111
public void printUsage() { HelpFormatter formatter = new HelpFormatter(); String usage = "java -classpath path com.bc.ceres.standalone.MetadataEngineMain -t /path/targetItem.suff -v templateX=/path/metadata.txt.vm [-v templateY=/path/report.xml.vm] [optional options] [arg1] [arg2] ..."; formatter.printHelp(...
520146_100
@Override public long getBinIndex(double lat, double lon) { final int row = getRowIndex(lat); final int col = getColIndex(lon, row); return baseBin[row] + col; }
525255_0
public void visit(IndexVisitor<Key, Value> visitor) { root().visit(this, visitor); }
526139_189
boolean hasValidArea() { return area != null && !area.isEmpty(); }
533032_1
public void orWith(DocIdSetCardinality other) { min = Math.max(min, other.min); max = Math.min(1.0, max + other.max); }
536958_2
Node createFilterNode(Document doc) { Node filterNode = doc.createElement("filter"); Node filterNameNode = doc.createElement("filter-name"); filterNameNode.appendChild(doc.createTextNode("infrared")); Node filterClassNode = doc.createElement("filter-class"); filterClassNode.appendChild(doc.createTextNode(FILTER_CL...
540945_11
public static Context context(int ioThreads) { return new Context(ioThreads); }
542927_85
public Object[] getJobIds() { return workflow.getJobIds(); }
551254_19
public static File createTempDirectory() throws IOException { File tmp = File.createTempFile("bpelunit", ""); tmp.delete(); tmp.mkdir(); return tmp; }
558963_40
public HTTPResponse execute(final HTTPRequest request) { return execute(request, helper.isEndToEndReloadRequest(request)); }
574877_37
@Override public AmazonServiceException handle(HttpResponse response) throws Exception { JsonContent jsonContent = JsonContent.createJsonContent(response, jsonFactory); byte[] rawContent = jsonContent.getRawContent(); String errorCode = errorCodeParser.parseErrorCode(response, jsonContent); AmazonServ...
578435_68
public static String dasherize(String word) { return word.replaceAll("_", "-"); }
581866_1
public static IOTransition.IOLetter fullLetter(String message) { Matcher matcher = lettersPattern.matcher(message); if (matcher.matches()) { if (matcher.group(1).equals("^")) { if (matcher.group(2) == null) { return new IOTransition.IOLetter(new Message(matcher.group(5), matcher.group(5), matcher...
585380_4
public boolean isCloserTo(KUID key, KUID otherId) { return compareTo(key, otherId) < 0; }
589869_0
public void reset(int i, int j) { this.i = i; this.j = j; x = 0; y = 0; detector = 0; view_zenith = 0.0; sun_zenith = 0.0; delta_azimuth = 0.0; sun_azimuth = 0.0; mus = 0.0; muv = 0.0; airMass = 0.0; altitude = 0.0; windu = 0.0; windv = 0.0; press_ecmwf =...
590532_4
public static String encode(String raw) { String[] parts = parseId(raw); return shorten(toBigInteger(parts[0])) + "-" + shorten(toBigInteger(parts[1], parts[2])) + "-" + shorten(new BigInteger(parts[3])); }
591784_24
public void checkMetadata( RepositorySystemSession session, UpdateCheck<Metadata, MetadataTransferException> check ) { if ( check.getLocalLastUpdated() != 0 && !isUpdatedRequired( session, check.getLocalLastUpdated(), check.getPolicy() ) ) { if ( logger.isDebugEnabled() ) { l...
597631_48
@Override public int getMinScore() { return 0; }
608316_15
@Override public boolean isNew(Persistent persistent) { return isNew; }
608843_3
public native void setIntArray(int address, int[] ints, int offset, throws NullPointerException, ;
618103_0
@Override protected Void doInBackground(final String... args) { errors = new ArrayList<>(); List<Bank> banks; if (bankId != -1) { banks = new ArrayList<>(); banks.add(getBankFromDb(bankId, parent)); } else { banks = getBanksFromDb(parent); } getDialog().setMax(banks.size(...
618492_55
public static double bytesToDouble(final byte[] bytes) { if (bytes.length < 8) { throw new IllegalArgumentException("Byte array must be 8 bytes wide."); } return Double.longBitsToDouble(bytesToLong(bytes)); }
618681_8
@Override public List<String> loadNBSP(String lang) { if (lang == null || lang.isEmpty()) { throw new IllegalArgumentException("Lang must be filled to search for file!"); } List<String> result = loadForKey(lang); if (result == null) { int index = lang.indexOf('_'); if (index < 0) return null; // cannot split ...
620505_0
private List<String> getHosts(List<NodeMetadata> nodes) { return Lists.transform(Lists.newArrayList(nodes), ew Function<NodeMetadata, String>() { @Override public String apply(NodeMetadata node) { tring publicIp = Iterables.get(node.getPublicAddresses(), 0) .getHostName(); eturn String.format("%s:%d", publi...
625665_0
protected void resize(int newcount) { byte newbuf[] = new byte[Math.max(buf.length << 1, newcount)]; System.arraycopy(buf, 0, newbuf, 0, pos); buf = newbuf; }
643234_13
public void show(String scenario, String step) { sendContextMessage(step); }
651333_3
public static Expression parse(String text) { text = text.replaceAll("\\s*,\\s*", ","); StringTokenizer st = new StringTokenizer(text, "$%,\'[])", true); MethodExpression root = new MethodExpression("eval"); Stack<MethodExpression> stack = new Stack<MethodExpression>(); stack.push(root); try { ...
657157_0
@Override public org.apache.lucene.search.Query parse(String query) throws ParseException { String q = ""; for (int i = 0; i < query.length(); i++) { if (query.charAt(i) == '"' && i + 1 < query.length() && !Character.isWhitespace(query.charAt(i + 1))) { if (i > 0 && !Character.isWhitespace(q...
662539_11
public static void validateSourceProducts(String[] sourceFilePaths) throws IOException { final int sourceProductLength = sourceFilePaths[0].length(); for (String sourceFilePath : sourceFilePaths) { if (sourceFilePath.length() != sourceProductLength) { throw new IOException("Inconsistent sour...
663418_71
@Override public String toString(Object obj) { if(obj==null) return "null"; if(obj.toString().trim().equals("")) return "blank"; return obj.toString(); }
666662_0
public void append(char c) { if (isFull()) { removeFirst(); } insertLast(c); }
667236_1
protected String extractPackageNameFromAndroidManifest(File androidManifestFile) throws MojoExecutionException { final URL xmlURL; try { xmlURL = androidManifestFile.toURI().toURL(); } catch (MalformedURLException e) { throw new MojoExecutionException("Error while trying to figure out packag...
678267_10
public static DateTime parseXSDDateTime(String input) { Matcher m = XSD_DATETIME.matcher(input); if (!m.find()) { throw new IllegalArgumentException(input + " is not a valid XML Schema 1.1 dateTime."); } int year = Integer.parseInt(m.group(1)); int month = Integer.parseInt(m...
684382_1
public static boolean validateMinJREVersion(String runtimeVersion, String minVersion){ String[] requestedVersioning = minVersion.split("\\."); String[] clientVersioning = runtimeVersion.split("\\."); if (requestedVersioning.length < 3 || clientVersioning.length < 3) return false; // First major update if (Inte...
688360_72
@Override public void writePublicKey(PublicKey key, String comment, OutputStream out) throws IOException, GeneralSecurityException { StringBuilder b = new StringBuilder(82); PublicKeyEntry.appendPublicKeyEntry(b, key); // Append first line of comment - if available String line = firstLine(commen...
690050_71
protected String generateCode() { return UUID.randomUUID().toString(); }
692484_7
@Override public int getPartition(GramKey key, Gram value, int numPartitions) { // see: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/lib/partition/BinaryPartitioner.java?revision=816664&view=markup int length = key.getLength()-1; int right = (offset + length) % length...
697210_2
public String[] readNext() throws IOException { while (recordsQueue.isEmpty() && !eof) { char[] data = new char[CHUNK_SIZE]; int size = r.read(data); if (size == -1) { break; } processChunk(data, size); } if (recordsQueue.isEmpty()) { if (wasEscape...
702991_21
public static void closeDocumentQuietly(COSDocument document) { try { if (document != null) { document.close(); } } catch (IOException e) { logger.warn("Error occured during the close of a COSDocument : " + e.getMessage()); } }
710733_1
@Override public byte[] create(T value) throws AvroBaseException { switch (createType) { case CUSTOM: { // loop until we don't get an ID collision byte[] row; do { row = keygen.get(); } while (!put(row, value, 0)); return row; } case RANDOM: { // loop until we d...
711931_2
public boolean checkAuth() { throw new RuntimeException("This method is not available on this protocol"); }
726694_18
@Override public double findMaximumDistanceToLeaf() { return this.findMaximumDistanceToLeaf(0.0); }
747707_9
public static void writeBytes(PrintStream print, byte[] bytes) { writeBytes(print, bytes, 0, bytes.length); }
749137_19
protected static JSONObject parseJsonPart(Reader reader) throws JSONException { return (JSONObject)(new JSONTokener(reader).nextValue()); }
762097_13
public static void bind(AnnotationBindingContext bindingContext) { List<AnnotationInstance> annotations = bindingContext.getIndex().getAnnotations( JPADotNames.NAMED_QUERY ); for ( AnnotationInstance query : annotations ) { bindNamedQuery( bindingContext.getMetadataImplementor(), query ); } annotations = binding...
763770_9
@Override public List<TopicModelImpl> fetchTopicsByPropertyRange(String propUri, Number from, Number to) { return buildTopics(queryIndexByPropertyRange(topicIndex, propUri, from, to)); }
766240_36
public void tick(final double progress) { if (progress < 0 || progress > 1.0) { throw new IllegalStateException("New progress must be between 0 and 1"); } if (isCancelled()) { throw new IllegalStateException("Animation is cancelled"); } if (!isRunning()) { throw new IllegalStateException("Animatio...
766548_687
private Principal getPrincipal() { try { SecurityContext securityCtx = SecurityContextHolder.getContext(); if (securityCtx == null) { throw new AuthorizationException("No security context available."); } Authentication auth = securityCtx.getAuthentication(); ...
771158_3
@Override public int compare(Statement first, Statement second) { // Cannot use Statement.equals as it does not take Context into account, // but can check for reference equality (==) if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (fi...
774619_99
public static void validate(String xml) { byte[] bytes = null; String encoding = getEncoding(xml); if (encoding != null) { try { bytes = xml.getBytes(encoding); } catch (UnsupportedEncodingException e) { // ignore, handled below } } if (bytes == null) ...
774658_11
static Protocol determineProtocol(String server) { checkNotNull(server); String[] splitServer = server.split(":"); Protocol protocol = Protocol.HTTPS; if (splitServer.length > 1) { String port = splitServer[1]; String protocolInTheUrl = splitServer[0].toLowerCase(); if (splitSe...
782257_47
@Override public Connection open( final String aName ) throws IOException { return open( aName, ConnectorService.READ_WRITE ); }
790859_125
public void destroy() { _log.debug("Destroying deployment " + getName()); // Clean up our list of activations, just in case something's left _serviceBindings.clear(); _components.clear(); _referenceBindings.clear(); getValidatorRegistryLoader().unregisterValidators(); getTransformerReg...
806019_7
@Override public Short getShort() { return value.shortValue(); }
811072_0
public String sayHelloEJB(String name) { return "Hello " + name; }
812511_8
public static X500Principal toPrincipal(String globusID) { if (globusID == null) { return null; } String id = globusID.trim(); StringBuilder buf = new StringBuilder(id.length()); if (!id.isEmpty()) { final int IDLE = 0; final int VALUE = 1; final int KEY = 2; ...
816192_4
public String getName() { return "BeanShell Plugin"; }
819907_5
static String annotationToString(Annotation annotation) { StringBuilder string = new StringBuilder(); string.append('@').append(annotation.annotationType().getName()).append('('); String classAffix = ".class"; String quotationMark = "\""; try { List<Method> methods = Arrays.asList(annotatio...
828909_18
@Override public void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> e, final Store store, final List<StoreFile> candidates) throws IOException { requirePermission(getTableName(e.getEnvironment()), null, null, Action.ADMIN); }
832025_13
public Blog getBlogEntries() throws IOException { Response<BlogFeedDto> response = blogApi.getBlogEntries().execute(); return response.body().toBlog(); }
832676_97
void addFeatureRepositories(Object featureService) throws MojoExecutionException { if (featureRepositories != null) { try { Class<? extends Object> serviceClass = featureService.getClass(); Method addRepositoryMethod = serviceClass.getMethod("addRepository", URI.class); for (S...
832679_7
@Override public String render(OsFamily arg0) { return exec( "git clone " + (vcsBranch != null ? "-b " + vcsBranch + " " : "") + url + " " + MODULES_DIR + module).render(arg0); }
832680_187
@Override public synchronized Class loadClass( String name ) throws ClassNotFoundException { if ( childDelegation ) { Class<?> c = findLoadedClass( name ); if ( c == null ) { try { c = findClass( name ); } catch ( Class...
834344_39
public static boolean isZipCode(final String zipCode) { if (zipCode != null) { return zipCode.matches("\\d{5}((-| +)\\d{4})?$"); } return false; }
844592_1
public ExceptionHandlingStrategy makeExceptionHandlingStrategy( final Level logLevel, final PrintStream originalPrintStream) { return new LogPerLineExceptionHandlingStrategy(logLevel); }
846296_0
public SourceTemplate(Writer writer, String className, List<BsonDocumentObjectElement> annotatedElements) { this.writer = writer; this.className = className; this.annotatedElements = annotatedElements; }
851175_3
static boolean mfgAlbedoFileNameMatches(String fileName) { if (!(fileName.matches("MSA_Albedo_L2.0_V[0-9].[0-9]{2}_[0-9]{3}_[0-9]{4}_[0-9]{3}_[0-9]{3}.(?i)(hdf)"))) { throw new IllegalArgumentException("Input file name '" + fileName + "' does not match nami...
859322_0
public static byte[] execute(URL url, InputStream input, String encoding) throws IOException { byte[] bytes; try { StringBuilder sb = new StringBuilder(); UnicodeReader reader = new UnicodeReader(input, encoding); try { char[] cbuf = new char[32]; int r; while ((r = reader.read(cbuf, 0, 3...
860694_1
public static void zipDir(final File zipFile, final File srcDir, final String prefix) throws IOException { ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile)); try { addZipPrefixes(srcDir, out, prefix); addZipDir(srcDir, out, prefix); } finally { // C...
860937_24
@Override public final DoubleVector subtractFrom(double v) { DenseDoubleVector newv = new DenseDoubleVector(vector.length); for (int i = 0; i < vector.length; i++) { newv.set(i, v - vector[i]); } return newv; }
862445_0
@Override public Iterator<Document> iterator() { if (inputStream != null) { throw new IllegalStateException("already fetched inputStream!"); } return new MultiXmlDocumentIterator(); }
870849_0
public static RuntimeException exceptionWithFriendlyMessageFor(Exception e) { Throwable cause = getRootCause(e); String message = cause.getMessage(); if (message == null) { message = cause.getClass().getSimpleName(); } if (cause instanceof JSchException) { message = "SSH: " + message...
876766_2
@Override public void execute() throws MojoExecutionException, MojoFailureException { client = new DefaultHttpClient(); if (hasProxy()) { enableAxisProxy(); configureHttpClientProxy(); } initializeConfluenceTemplate(); boolean isVersion30AndAbove = isConfluenceVersion30andAbove(); ...
884758_0
public static GrizzlyExecutorService createInstance() { return createInstance(ThreadPoolConfig.DEFAULT); }
889932_13
@Override public String getSignatureMethod() { return METHOD; }
892275_5
@SuppressWarnings("ConstantConditions") // Guarding public API nullability. public static RxJava3CallAdapterFactory createWithScheduler(Scheduler scheduler) { if (scheduler == null) throw new NullPointerException("scheduler == null"); return new RxJava3CallAdapterFactory(scheduler, false); }
899555_4
static Collection<String> elemental2ElementTags(final MetaClass type) { final Collection<String> customElementTags = customElementTags(type); if (!customElementTags.isEmpty()) { return customElementTags; } return Elemental2TagMapping.getTags(type.asClass()); }
901534_1
@Override public UmlModel loadModel(File modelFile) throws UmlModelException { if (modelFile == null) { return new UmlModel(UmlModelProducer.getInstance().createUmlModel(null)); } try { Model model = getUmlRootModel(modelFile); UmlModel umlModel = new UmlModel(model); ret...
904044_3
;
904873_9
public String getResourceName() { return m_resourceName; }
905232_85
public void register( final String[] protocols, final URLStreamHandlerService urlStreamHandlerService ) { LOGGER.debug( "Registering protocols [" + Arrays.toString( protocols ) + "] to service [" + urlStreamHandlerService + "]" ); NullArgumentException.validateNotEmptyContent( protocols, true, "Prot...
906854_11
public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); }
907274_29
public <T extends EventBus> T register(Class<T> busType, Object subscriber) { return this.register(busType,subscriber,null); }
908709_29
public static String cleanTerm(String term) { term = term.toLowerCase().trim(); if (term.matches("[0-9\\-\\.:]+")) return "<NUM>"; if (term.startsWith("http:") || term.startsWith("ftp:")) return "<URL>"; while (term.length() > 0 && term.startsWith("-")) term = term.s...
909809_66
void addFreeMarker(final Marker marker, final double xPos, final double yPos) { markers.add(new FreeMarker(marker, xPos, yPos)); }
912291_21
public byte[] encode(String val, String delimiters) { return codecs[0].encode(val); }
915029_21
@Override public E remove(final int index) { return d_inner.remove((int) d_indices.get(index)); }
917362_1
Solve() { }
917947_24
public boolean canProxy(final Class<?> type) { return !Modifier.isFinal(type.getModifiers()); }
918574_14
public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; }
921110_24
@Override public DatabagItem apply(String from) { DatabagItem bootstrapConfig = api.getDatabagItem(databag, from); checkState(bootstrapConfig != null, "databag item %s/%s not found", databag, from); return bootstrapConfig; }
922437_16
@Override public Contribution addContribution(final BigDecimal amount, final String comment) throws NotEnoughMoneyException, UnauthorizedOperationException { tryAccess(new RgtFeature.Contribute(), Action.WRITE); // For exception safety keep the order. if (AuthToken.getAsTeam() != null) { if (AuthTok...
922501_4
public static List<String> getEntries(File root) { return walk(root.toURI(), root); }
927454_3
static boolean waitUntil(Duration timeout, BooleanSupplier condition) throws InterruptedException { int waited = 0; while (!condition.getAsBoolean() && waited < timeout.toMillis()) { Thread.sleep(100L); waited = +100; } return condition.getAsBoolean(); }
936063_9
public void process(ISO9660Config iso9660Config, RockRidgeConfig rrConfig, JolietConfig jolietConfig, ElToritoConfig elToritoConfig) throws HandlerException { if (iso9660Config == null) { throw new NullPointerException("Cannot create ISO without ISO9660Config."); } ((LogicalSecto...
940337_6
static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) { ArrayList<String> basePath = getPathComponents(canonicalBaseFile); ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize); //if the roots aren't the same (i.e. different drives on a wi...
944926_18
public void register(Object object) { subscribeAll(finder.findAllSubscribers(object)); }
947990_0
@Override public boolean isValid(Asociado asociado, ConstraintValidatorContext context) { if (asociado == null || asociado.getFechaNacimiento() == null) return true; context.disableDefaultConstraintViolation(); if (Strings.isNullOrEmpty(asociado.getDni())) { boolean mayorDeEdad = a...
952585_7
public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; }