id
stringlengths
7
14
text
stringlengths
1
106k
1795594_6
static void buildCanonicalQueryString(Map<String,String> parameters, StringBuilder sb) { boolean firstParam = true; for (String parameter : Ordering.natural().sortedCopy(parameters.keySet())) { // Ignore signature parameters if (SecurityParameter.X_Amz_Signature.parameter().equals(parameter)) continue...
1795594_7
static void buildCanonicalQueryString(Map<String,String> parameters, StringBuilder sb) { boolean firstParam = true; for (String parameter : Ordering.natural().sortedCopy(parameters.keySet())) { // Ignore signature parameters if (SecurityParameter.X_Amz_Signature.parameter().equals(parameter)) continue...
1795594_8
static StringBuilder buildCanonicalRequest(MappingHttpRequest request, String signedHeaders, String payloadHash) { StringBuilder sb = new StringBuilder(512); // Request method sb.append(request.getMethod().getName()); sb.append('\n'); // Resource path sb.append(buildCanonicalResourcePath(request.getServiceP...
1795594_9
static StringBuilder buildCanonicalRequest(MappingHttpRequest request, String signedHeaders, String payloadHash) { StringBuilder sb = new StringBuilder(512); // Request method sb.append(request.getMethod().getName()); sb.append('\n'); // Resource path sb.append(buildCanonicalResourcePath(request.getServiceP...
1797376_0
@Override public Number getValue(int row, int column) { Number result = null; DefaultKeyedValues rowData = this.rows.get(row); if (rowData != null) { Comparable columnKey = this.columnKeys.get(column); // the row may not have an entry for this key, in which case the // return value i...
1797376_1
public void addValue(Number value, Comparable rowKey, Comparable columnKey) { // defer argument checking setValue(value, rowKey, columnKey); }
1797376_2
@Override public boolean equals(Object o) { if (o == null) { return false; } if (o == this) { return true; } if (!(o instanceof KeyedValues2D)) { return false; } KeyedValues2D kv2D = (KeyedValues2D) o; if (!getRowKeys().equals(kv2D.getRowKeys())) { return ...
1797376_3
@Override public Comparable getRowKey(int row) { return this.rowKeys.get(row); }
1797376_4
@Override public Comparable getColumnKey(int column) { return this.columnKeys.get(column); }
1797376_5
public void removeValue(Comparable rowKey, Comparable columnKey) { setValue(null, rowKey, columnKey); // 1. check whether the row is now empty. boolean allNull = true; int rowIndex = getRowIndex(rowKey); DefaultKeyedValues row = this.rows.get(rowIndex); for (int item = 0, itemCount = row.getItem...
1797376_6
public void removeRow(int rowIndex) { this.rowKeys.remove(rowIndex); this.rows.remove(rowIndex); }
1797376_7
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof SimpleHistogramDataset)) { return false; } SimpleHistogramDataset that = (SimpleHistogramDataset) obj; if (!this.key.equals(that.key)) { return false; } if (this.a...
1797376_8
public void clearObservations() { for (SimpleHistogramBin bin : this.bins) { bin.setItemCount(0); } notifyListeners(new DatasetChangeEvent(this, this)); }
1797376_9
public void removeAllBins() { this.bins = new ArrayList<SimpleHistogramBin>(); notifyListeners(new DatasetChangeEvent(this, this)); }
1810705_0
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); return true; }
1810705_1
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); return true; }
1810705_2
@Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); filterChain.doFilter(request...
1810705_3
public boolean isRequestForSite(HttpServletRequest request) { String requestURI = request.getRequestURI(); if (hasMobilePath() && (requestURI.startsWith(getFullMobilePath()) || requestURI.equals(getCleanMobilePath()))) { return false; } else if (hasTabletPath() && (requestURI.startsWith(getFullTabletPath()) || req...
1810705_4
public boolean isRequestForSite(HttpServletRequest request) { String requestURI = request.getRequestURI(); if (hasMobilePath() && (requestURI.startsWith(getFullMobilePath()) || requestURI.equals(getCleanMobilePath()))) { return false; } else if (hasTabletPath() && (requestURI.startsWith(getFullTabletPath()) || req...
1810705_5
public boolean isRequestForSite(HttpServletRequest request) { String requestURI = request.getRequestURI(); if (hasMobilePath() && (requestURI.startsWith(getFullMobilePath()) || requestURI.equals(getCleanMobilePath()))) { return false; } else if (hasTabletPath() && (requestURI.startsWith(getFullTabletPath()) || req...
1810705_6
public boolean isRequestForSite(HttpServletRequest request) { String requestURI = request.getRequestURI(); if (hasMobilePath() && (requestURI.startsWith(getFullMobilePath()) || requestURI.equals(getCleanMobilePath()))) { return false; } else if (hasTabletPath() && (requestURI.startsWith(getFullTabletPath()) || req...
1810705_7
public boolean isRequestForSite(HttpServletRequest request) { String requestURI = request.getRequestURI(); if (hasMobilePath() && (requestURI.startsWith(getFullMobilePath()) || requestURI.equals(getCleanMobilePath()))) { return false; } else if (hasTabletPath() && (requestURI.startsWith(getFullTabletPath()) || req...
1810705_8
public boolean isRequestForSite(HttpServletRequest request) { String requestURI = request.getRequestURI(); if (hasMobilePath() && (requestURI.startsWith(getFullMobilePath()) || requestURI.equals(getCleanMobilePath()))) { return false; } else if (hasTabletPath() && (requestURI.startsWith(getFullTabletPath()) || req...
1810705_9
public boolean isRequestForSite(HttpServletRequest request) { String requestURI = request.getRequestURI(); if (hasMobilePath() && (requestURI.startsWith(getFullMobilePath()) || requestURI.equals(getCleanMobilePath()))) { return false; } else if (hasTabletPath() && (requestURI.startsWith(getFullTabletPath()) || req...
1810897_0
@RequestMapping(value = "states", method = RequestMethod.GET, produces = "application/json") public @ResponseBody List<State> fetchStatesJson() { logger.info("fetching JSON states"); return getStates(); }
1810897_1
@RequestMapping(value = "sendmessage", method = RequestMethod.POST, consumes = "text/plain") public @ResponseBody String sendMessage(@RequestBody String message) { logger.info("String message: " + message); return "String message received! Your message: " + message; }
1812602_0
public static String constructPackageName(GetUserInfoResult userInfo) { String orgName = userInfo.getOrganizationName(); if (orgName != null) { String orgNameDenorm = userInfo.getOrganizationName().replaceAll("(,|\\.|\\s)", "").toLowerCase(); return "com." + orgNameDenorm + ".model"; } ...
1812602_1
@Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { List<DescribeSObjectResult> filteredResult = new ArrayList<DescribeSObjectResult>(); for (DescribeSObjectResult dsr : dsrs) { // include => objectNames.contains(name) // exclude => !objectNames.contains(name)...
1812602_2
@Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { List<DescribeSObjectResult> filteredResult = new ArrayList<DescribeSObjectResult>(); for (DescribeSObjectResult dsr : dsrs) { // include => objectNames.contains(name) // exclude => !objectNames.contains(name)...
1812602_3
@Override public List<Field> filter(DescribeSObjectResult dsr) { if (dsr.isCustom()) { // Skip all fields common to Force.com custom objects return filterInternal(dsr, CUSTOM_OBJECT_COMMON_FIELDS); } else if (ForceJPAClassGeneratorUtils.hasAllCommonFields(dsr)) { // Skip all fields commo...
1812602_4
@Override public List<Field> filter(DescribeSObjectResult dsr) { if (dsr.isCustom()) { // Skip all fields common to Force.com custom objects return filterInternal(dsr, CUSTOM_OBJECT_COMMON_FIELDS); } else if (ForceJPAClassGeneratorUtils.hasAllCommonFields(dsr)) { // Skip all fields commo...
1812602_5
@Override public List<Field> filter(DescribeSObjectResult dsr) { if (dsr.isCustom()) { // Skip all fields common to Force.com custom objects return filterInternal(dsr, CUSTOM_OBJECT_COMMON_FIELDS); } else if (ForceJPAClassGeneratorUtils.hasAllCommonFields(dsr)) { // Skip all fields commo...
1812602_6
@Override public List<Field> filter(DescribeSObjectResult dsr) { if (dsr.isCustom()) { // Skip all fields common to Force.com custom objects return filterInternal(dsr, CUSTOM_OBJECT_COMMON_FIELDS); } else if (ForceJPAClassGeneratorUtils.hasAllCommonFields(dsr)) { // Skip all fields commo...
1812602_7
@Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { return dsrs; }
1812602_8
@Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { return dsrs; }
1812602_9
@Override public List<Field> filter(DescribeSObjectResult dsr) { List<Field> fieldList = Lists.newArrayList(dsr.getFields()); Iterator<Field> fieldIter = fieldList.iterator(); while (fieldIter.hasNext()) { Field field = fieldIter.next(); if (field.getType() == FieldType.referen...
1814028_0
public synchronized Connection createConnection(String address) { if (connectionFactory==null) { throw new IllegalStateException("Connection not expected. You have to call expectCall() or useConnectionFactory() first."); } return connectionFactory.createConnection(address); }
1814028_1
public synchronized static UniversalMockRecorder expectCall() { if (getConnectionFactory()==null) { UniversalMockConnectionFactory mockConnection = new UniversalMockConnectionFactory(); useConnectionFactory(mockConnection); return mockConnection; } else { throw new IllegalArgumentException("Can not call ex...
1814028_2
public static UniversalMockRecorder expectCall() { return StaticConnectionFactory.expectCall(); }
1814028_3
public static UniversalMockRecorder expectCall() { return StaticConnectionFactory.expectCall(); }
1839196_0
public MultipleBeanSource(Object... sources) throws IllegalArgumentException { this.sources = sources; List<Class> declaringClasses = new ArrayList<Class>(); for (Object o : sources) { if (declaringClasses.contains(o.getClass())) { throw new IllegalArgumentException("You can't give two beans of the same type.")...
1839196_1
@Override public Element create(Field field) throws FormException { Element element = null; if (field.getDeclaringClass().isAnnotationPresent(Accessor.class) && (Accessor.AccessType.METHOD == field.getDeclaringClass().getAnnotation(Accessor.class).value())) { try { Method propert...
1839196_2
@Override public void setValue(WrappedType wrappedType) { getProperty().setValue(wrappedType); }
1839196_3
public List<Element> filter(List<Element> toFilter) throws FilterException { List<Element> filtered = new ArrayList<Element>(toFilter); for (String name : names) { extractFieldByName(filtered, name); } return filtered; }
1839196_4
public List<Element> filter(List<Element> toFilter) throws FilterException { List<Element> remaining = new ArrayList<Element>(toFilter); List<Element> filtered = new ArrayList<Element>(); for (String name : names) { filtered.add(extractFieldByName(remaining, name)); } filtered.addAll(remaining); return filtered...
1839196_5
public List<Element> filter(List<Element> toFilter) throws FilterException { List<Element> remaining = new ArrayList<Element>(toFilter); List<Element> filtered = new ArrayList<Element>(); for (String name : names) { filtered.add(extractFieldByName(remaining, name)); } return filtered; }
1839196_6
public List<Element> filter(List<Element> toFilter) { List<Element> filtered = new ArrayList<Element>(); for (Element field : toFilter) { if (field.getAnnotation(NonVisual.class) == null) { filtered.add(field); } } return filtered; }
1839196_7
public void setSource(T source) { this.source.set(source); }
1839196_8
public void setSource(T source) { this.source.set(source); }
1839196_9
public boolean handle(Element element) { try { return element.getWrappedType().isEnum(); } catch (Exception e) { } return false; }
1860892_0
protected void fireStartTask() { fireEvent(new Event() { @Override public void fire(final Listener listener) { listener.startTask(); } }); }
1860892_1
@Override public void execute(final Runnable command) { delegate.execute(command); }
1860892_2
@Override public String command(String command) { String filtered = command.replaceAll("GET /", ""); filtered = filtered.replaceAll(" HTTP/1.1", ""); filtered = filtered.replaceAll("%5B", "["); filtered = filtered.replaceAll("%5D", "]"); filtered = filtered.replaceAll("%20", " "); return delegate.command(filtered...
1860892_3
public TaskNameFactory(final TaskNames names) { this.names = names; }
1860892_4
public CreateTaskPersistence(final CreateTaskDelegate delegate, final EventsConsumer consumer, final IdProvider provider, JiraEventFactory jiraEventFactory) { this.delegate = delegate; this.consumer = consumer; this.provider = provider; this.jiraEventFactory = jiraEventFactory; }
1860892_5
public List<String> check(Class<?> class1) { List<String> errors = new ArrayList<String>(); internalDetect(class1, errors, 0); return errors; }
1860892_6
public Adapter(Source<IN> in, final Functor<IN, OUT> functor){ output = new Source<OUT>(functor.evaluate(in.currentValue())); in.addReceiver(new Receiver<IN>() { @Override public void receive(IN value) { output.supply(functor.evaluate(value)); } }); }
1862490_0
public static String resolve(final Properties props, final String expression) { if (expression == null) return null; final StringBuilder builder = new StringBuilder(); final char[] chars = expression.toCharArray(); final int len = chars.length; int state = 0; int start = -1; int nameStart = ...
1862490_1
public static String resolve(final Properties props, final String expression) { if (expression == null) return null; final StringBuilder builder = new StringBuilder(); final char[] chars = expression.toCharArray(); final int len = chars.length; int state = 0; int start = -1; int nameStart = ...
1862490_2
public static String resolve(final Properties props, final String expression) { if (expression == null) return null; final StringBuilder builder = new StringBuilder(); final char[] chars = expression.toCharArray(); final int len = chars.length; int state = 0; int start = -1; int nameStart = ...
1862490_3
public static int compareVersion(final String version1, final String version2) { return INSTANCE.compare(version1, version2); }
1862492_0
public void setWriter(final Writer writer) { synchronized (outputLock) { super.setWriter(writer); final OutputStream oldStream = this.outputStream; outputStream = null; safeFlush(oldStream); safeClose(oldStream); } }
1862492_1
public void setWriter(final Writer writer) { synchronized (outputLock) { super.setWriter(writer); final OutputStream oldStream = this.outputStream; outputStream = null; safeFlush(oldStream); safeClose(oldStream); } }
1863627_0
@Override public ClusterNode assignClusterNode() { lock.lock(); try { while (!currentlyOwningTask.get()) { taskAcquired.awaitUninterruptibly(); } } catch (Exception e) { logger.error("Exception while waiting for task to be acquired"); return null; } finally { ...
1867246_0
@Override public boolean isAuthenticated() { if (tokenExpiration != null && new Date().compareTo(tokenExpiration) >= 0) { return false; } else { return super.isAuthenticated(); } }
1867246_1
@Override public boolean isAuthenticated() { if (tokenExpiration != null && new Date().compareTo(tokenExpiration) >= 0) { return false; } else { return super.isAuthenticated(); } }
1867246_2
@Override public boolean isAuthenticated() { if (tokenExpiration != null && new Date().compareTo(tokenExpiration) >= 0) { return false; } else { return super.isAuthenticated(); } }
1867246_3
@Override public boolean isAuthenticated() { if (tokenExpiration != null && new Date().compareTo(tokenExpiration) >= 0) { return false; } else { return super.isAuthenticated(); } }
1867246_4
public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!supports(authentication.getClass())) { throw new IllegalArgumentException("Only SAMLAuthenticationToken is supported, " + authentication.getClass() + " was attempted"); } SAMLAuthenticationToken t...
1867246_5
public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!supports(authentication.getClass())) { throw new IllegalArgumentException("Only SAMLAuthenticationToken is supported, " + authentication.getClass() + " was attempted"); } SAMLAuthenticationToken t...
1867246_6
public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!supports(authentication.getClass())) { throw new IllegalArgumentException("Only SAMLAuthenticationToken is supported, " + authentication.getClass() + " was attempted"); } SAMLAuthenticationToken t...
1867246_7
public String getIdpSelectionPath() { return idpSelectionPath; }
1867246_8
protected boolean processFilter(HttpServletRequest request) { return SAMLUtil.processFilter(filterProcessesUrl, request); }
1867246_9
protected boolean processFilter(HttpServletRequest request) { return SAMLUtil.processFilter(filterProcessesUrl, request); }
1870998_0
public static <T> T sendAndReceive(String soapUrl, String soapAction, String msgTpl, Object[] msgArgs, WSConverter<T> converter) { if (msgArgs != null && msgArgs.length > 0) msgTpl = java.text.MessageFormat.format(msgTpl, msgArgs); StreamSource source = new StreamSource(new St...
1870998_1
public static <T> T sendAndReceive(String soapUrl, String soapAction, String msgTpl, Object[] msgArgs, WSConverter<T> converter) { if (msgArgs != null && msgArgs.length > 0) msgTpl = java.text.MessageFormat.format(msgTpl, msgArgs); StreamSource source = new StreamSource(new St...
1870998_2
public Object format(Object context, Object value) { // 判断是否应该格式化链接 if (!this.isLinkable(context, value)) { return value != null ? value.toString() : ""; } Object _value; if (value instanceof Formater) { _value = ((Formater<?>) value).format(context, value); } else { _value = value; } String...
1870998_3
public Object format(Object context, Object value) { // 判断是否应该格式化链接 if (!this.isLinkable(context, value)) { return value != null ? value.toString() : ""; } Object _value; if (value instanceof Formater) { _value = ((Formater<?>) value).format(context, value); } else { _value = value; } String...
1870998_4
@Override public Object format(Object context, Object value) { StringBuffer v = new StringBuffer(); // 前置图标 appendIcons(this.getIconsBeforeText(context, value), v); // 显示的文本 Object _value = this.formatValue(context, value); if (_value != null) v.append(_value); // 后置图标 appendIcons(this.getIconsAfter...
1870998_5
public IconTextFormater addIconBeforeText(Icon icon) { this.getIconsBeforeText().add(icon); return this; }
1870998_6
public IconTextFormater addIconAfterText(Icon icon) { this.getIconsAfterText().add(icon); return this; }
1870998_7
public Object parse(Object data) { if (this.tpl == null) return null; return FreeMarkerUtils.format(this.tpl, data); }
1870998_8
public Actor loadByCode(String actorCode) { return this.actorDao.loadByCode(actorCode); }
1870998_9
public List<Actor> findFollower(Long masterId, Integer[] relationTypes, Integer[] followerTypes) { return this.actorDao.findFollower(masterId, relationTypes, followerTypes); }
1872106_0
static boolean nameIsValid(String name) { return name.matches("[\\p{L}-]+"); }
1875775_0
InputStream getStream() { return this.getClass().getResourceAsStream("/META-INF/bootstrap.taglib.xml"); }
1875775_1
public FaceletTaglibType getTaglib() { return taglib; }
1878370_0
protected List<Range> getRangeMatches(String line, String[] words) { List<Range> ranges = new ArrayList<Range>(); if (words == null) { return ranges; } String lowerline = line.toLowerCase(); int idx = 0; int end = 0; for (String word : words) { idx = lowerline.indexOf(word, i...
1878370_1
protected List<Range> getRangeMatches(String line, String[] words) { List<Range> ranges = new ArrayList<Range>(); if (words == null) { return ranges; } String lowerline = line.toLowerCase(); int idx = 0; int end = 0; for (String word : words) { idx = lowerline.indexOf(word, i...
1878370_2
protected void testLine(Report report, int linenum, String line) { List<Range> includedRanges = getRangeMatches(line, included); List<Range> excludedRanges = getRangeMatches(line, excluded); for (Range range : includedRanges) { if (range.overlaps(excludedRanges)) { continue; // Excluded:...
1878370_3
public void check(Report report, File file) { FileReader reader = null; BufferedReader buf = null; report.fileStart(file); try { reader = new FileReader(file); buf = new BufferedReader(reader); int linenum = 0; String line; while ((line = buf.readLine()) != null) ...
1878370_4
public void check(Report report, File file) { FileReader reader = null; BufferedReader buf = null; report.fileStart(file); try { reader = new FileReader(file); buf = new BufferedReader(reader); int linenum = 0; String line; while ((line = buf.readLine()) != null) ...
1878370_5
@Override public void check(Report report, File file) { header.check(report, file); }
1878370_6
@Override public void check(Report report, File file) { header.check(report, file); }
1878370_7
@Override public void check(Report report, File file) { header.check(report, file); }
1878370_8
public void check(Report report, File file) { try { String fileHeader[] = readFileHeader(file); int maxLines = Math.min(header.length, fileHeader.length); for (int fileIdx = 0, regexIdx = 0; regexIdx < maxLines; fileIdx++, regexIdx++) { while (!fileHeader[fileIdx].matches(header[...
1878370_9
public static JavaClass assertIsInterface(File java) throws IOException { JavaDocBuilder builder = new JavaDocBuilder(); JavaSource src = builder.addSource(java); JavaClass jc = getClassName(src, java); Assert.assertThat("Failed to parse java source: " + java.getAbsolutePath(), jc, notNullValue()); ...
1886360_0
public static String reverse(String s) { return new StringBuilder(s).reverse().toString(); }
1886360_1
public static boolean isPalindrome(String s) { return s.equals(reverse(s)); }
1886360_2
public static boolean isPalindrome(String s) { return s.equals(reverse(s)); }