proj_name stringclasses 26
values | relative_path stringlengths 42 165 | class_name stringlengths 3 46 | func_name stringlengths 2 44 | masked_class stringlengths 80 7.9k | func_body stringlengths 76 5.98k | len_input int64 30 1.88k | len_output int64 25 1.43k | total int64 73 2.03k | initial_context stringclasses 74
values |
|---|---|---|---|---|---|---|---|---|---|
javamelody_javamelody | javamelody/javamelody-core/src/main/java/net/bull/javamelody/SpringDataSourceBeanPostProcessor.java | SpringDataSourceBeanPostProcessor | postProcessAfterInitialization | class SpringDataSourceBeanPostProcessor implements BeanPostProcessor, PriorityOrdered {
private Set<String> excludedDatasources;
// l'interface PriorityOrdered place la priorité assez haute dans le contexte Spring
// quelle que soit la valeur de order
private int order = LOWEST_PRECEDENCE;
private final Cla... |
if (bean instanceof DataSource) {
// on ne teste isExcludedDataSource que si on est sur une datasource
if (isExcludedDataSource(beanName) || Parameters.isNoDatabase()
|| isDelegatingDataSourceAndAlreadyProxied(bean, beanName)) {
return bean;
}
final DataSource dataSource = (DataSource) ... | 1,046 | 928 | 1,974 | |
mapstruct_mapstruct | mapstruct/processor/src/main/java/org/mapstruct/ap/spi/StripSuffixEnumTransformationStrategy.java | StripSuffixEnumTransformationStrategy | transform | class StripSuffixEnumTransformationStrategy implements EnumTransformationStrategy {
@Override
public String getStrategyName() {
return "stripSuffix";
}
@Override
public String transform(String value, String configuration) {<FILL_FUNCTION_BODY>}
} |
if ( value.endsWith( configuration ) ) {
return value.substring( 0, value.length() - configuration.length() );
}
return value;
| 76 | 45 | 121 | |
jeecgboot_jeecg-boot | jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/util/RandImageUtil.java | RandImageUtil | getRandColor | class RandImageUtil {
public static final String KEY = "JEECG_LOGIN_KEY";
/**
* 定义图形大小
*/
private static final int WIDTH = 105;
/**
* 定义图形大小
*/
private static final int HEIGHT = 35;
/**
* 定义干扰线数量
*/
private static final int COUNT = 200;
/**
* 干扰线的长度... | // 取得给定范围随机颜色
final Random random = new Random();
int length = 255;
if (fc > length) {
fc = length;
}
if (bc > length) {
bc = length;
}
final int r = fc + random.nextInt(bc - fc);
final int g = fc + random.nextInt(bc - fc);
... | 1,313 | 139 | 1,452 | |
houbb_sensitive-word | sensitive-word/src/main/java/com/github/houbb/sensitive/word/support/result/WordTagsDto.java | WordTagsDto | toString | class WordTagsDto implements Serializable {
private String word;
private Set<String> tags;
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public Set<String> getTags() {
return tags;
}
public void setTags(S... |
return "WordTagsDto{" +
"word='" + word + '\'' +
", tags=" + tags +
'}';
| 141 | 39 | 180 | |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/factory/RemoveRequestParameterGatewayFilterFactory.java | RemoveRequestParameterGatewayFilterFactory | apply | class RemoveRequestParameterGatewayFilterFactory
extends AbstractGatewayFilterFactory<AbstractGatewayFilterFactory.NameConfig> {
public RemoveRequestParameterGatewayFilterFactory() {
super(NameConfig.class);
}
@Override
public List<String> shortcutFieldOrder() {
return Arrays.asList(NAME_KEY);
}
@Overrid... |
return new GatewayFilter() {
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
ServerHttpRequest request = exchange.getRequest();
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>(request.getQueryParams());
queryParams.remove(config.getNa... | 119 | 236 | 355 | |
docker-java_docker-java | docker-java/docker-java-core/src/main/java/com/github/dockerjava/core/command/ResizeExecCmdImpl.java | ResizeExecCmdImpl | withExecId | class ResizeExecCmdImpl extends AbstrDockerCmd<ResizeExecCmd, Void> implements ResizeExecCmd {
private String execId;
private Integer height;
private Integer width;
public ResizeExecCmdImpl(ResizeExecCmd.Exec exec, String execId) {
super(exec);
withExecId(execId);
}
@Overrid... |
this.execId = Objects.requireNonNull(execId, "execId was not specified");
return this;
| 283 | 32 | 315 | |
jeecgboot_jeecg-boot | jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysRolePermissionServiceImpl.java | SysRolePermissionServiceImpl | saveRolePermission | class SysRolePermissionServiceImpl extends ServiceImpl<SysRolePermissionMapper, SysRolePermission> implements ISysRolePermissionService {
@Override
public void saveRolePermission(String roleId, String permissionIds) {<FILL_FUNCTION_BODY>}
@Override
public void saveRolePermission(String roleId, String permissionId... |
String ip = "";
try {
//获取request
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
//获取IP地址
ip = IpUtils.getIpAddr(request);
} catch (Exception e) {
ip = "127.0.0.1";
}
LambdaQueryWrapper<SysRolePermission> query = new QueryWrapper<SysRolePermission>().lambda().eq(SysRo... | 691 | 271 | 962 | |
pmd_pmd | pmd/pmd-core/src/main/java/net/sourceforge/pmd/cache/internal/AnalysisCacheListener.java | AnalysisCacheListener | startFileAnalysis | class AnalysisCacheListener implements GlobalAnalysisListener {
private final AnalysisCache cache;
public AnalysisCacheListener(AnalysisCache cache, RuleSets ruleSets, ClassLoader classLoader,
Collection<? extends TextFile> textFiles) {
this.cache = cache;
cach... |
// AnalysisCache instances are handled specially in PmdRunnable
return FileAnalysisListener.noop();
| 144 | 28 | 172 | |
mapstruct_mapstruct | mapstruct/processor/src/main/java/org/mapstruct/ap/internal/conversion/PrimitiveToStringConversion.java | PrimitiveToStringConversion | getFromExpression | class PrimitiveToStringConversion extends AbstractNumberToStringConversion {
private final Class<?> sourceType;
private final Class<?> wrapperType;
public PrimitiveToStringConversion(Class<?> sourceType) {
super( NativeTypes.isNumber( sourceType ) );
if ( !sourceType.isPrimitive() ) {
... |
if ( requiresDecimalFormat( conversionContext ) ) {
StringBuilder sb = new StringBuilder();
appendDecimalFormatter( sb, conversionContext );
sb.append( ".parse( <SOURCE> )." );
sb.append( sourceType.getSimpleName() );
sb.append( "Value()" );
... | 569 | 138 | 707 | /**
* Abstract base class for {@link PrimitiveToStringConversion}, {@link WrapperToStringConversion}, {@link BigDecimalToStringConversion} and {@link BigIntegerToStringConversion}Contains shared utility methods.
* @author Ciaran Liedeman
*/
public abstract class AbstractNumberToStringConversion extends SimpleConv... |
javamelody_javamelody | javamelody/javamelody-core/src/main/java/net/bull/javamelody/internal/web/html/HtmlSpringContextReport.java | HtmlSpringContextReport | writeBean | class HtmlSpringContextReport extends HtmlAbstractReport {
private final SpringContext springContext;
HtmlSpringContextReport(SpringContext springContext, Writer writer) {
super(writer);
assert springContext != null;
this.springContext = springContext;
}
@Override
void toHtml() throws IOException... |
write("<td class='wrappedText'>");
writeDirectly(htmlEncodeButNotSpace(beanName));
write("</td><td class='wrappedText'>");
writeDirectly(HtmlSourceReport.addLinkToClassName(beanClass.getName()));
write("</td><td class='wrappedText'>");
writeDirectly(htmlEncodeButNotSpace(beanToString));
write("</t... | 542 | 131 | 673 | /**
* Parent abstrait des classes de rapport html.
* @author Emeric Vernat
*/
public abstract class HtmlAbstractReport {
private static final boolean CSRF_PROTECTION_ENABLED=Parameter.CSRF_PROTECTION_ENABLED.getValueAsBoolean();
private final Writer writer;
class HtmlTable {
private boolean firstRow=true;
... |
google_truth | truth/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java | UsingCorrespondence | delegate | class UsingCorrespondence<M extends Message>
implements IterableOfProtosUsingCorrespondence<M> {
private final IterableOfProtosSubject<M> subject;
private final @Nullable Function<? super M, ? extends Object> keyFunction;
UsingCorrespondence(
IterableOfProtosSubject<M> subject,
@Nulla... |
IterableSubject.UsingCorrespondence<M, M> usingCorrespondence =
subject.comparingElementsUsing(
subject
.config
.withExpectedMessages(messages)
.<M>toCorrespondence(FieldScopeUtil.getSingleDescriptor(subject.actual)));
if (keyFun... | 949 | 116 | 1,065 | |
google_truth | truth/core/src/main/java/com/google/common/truth/IterableSubject.java | Pairer | pair | class Pairer {
private final Function<? super A, ?> actualKeyFunction;
private final Function<? super E, ?> expectedKeyFunction;
Pairer(Function<? super A, ?> actualKeyFunction, Function<? super E, ?> expectedKeyFunction) {
this.actualKeyFunction = actualKeyFunction;
this.expectedKey... |
Pairing pairing = new Pairing();
// Populate expectedKeys with the keys of the corresponding elements of expectedValues.
// We do this ahead of time to avoid invoking the key function twice for each element.
List<@Nullable Object> expectedKeys = new ArrayList<>(expectedValues.size());
... | 503 | 501 | 1,004 | |
orientechnologies_orientdb | orientdb/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateVertex.java | OCommandExecutorSQLCreateVertex | execute | class OCommandExecutorSQLCreateVertex extends OCommandExecutorSQLSetAware
implements OCommandDistributedReplicateRequest {
public static final String NAME = "CREATE VERTEX";
private OClass clazz;
private String clusterName;
private List<OPair<String, Object>> fields;
@SuppressWarnings("unchecked")
publ... |
if (clazz == null)
throw new OCommandExecutionException(
"Cannot execute the command because it has not been parsed yet");
// CREATE VERTEX DOES NOT HAVE TO BE IN TX
final OVertex vertex = getDatabase().newVertex(clazz);
if (fields != null)
// EVALUATE FIELDS
for (final OP... | 921 | 243 | 1,164 | /**
* @author Luca Molino (molino.luca--at--gmail.com)
*/
public abstract class OCommandExecutorSQLSetAware extends OCommandExecutorSQLAbstract {
protected static final String KEYWORD_SET="SET";
protected static final String KEYWORD_CONTENT="CONTENT";
protected ODocument content=null;
protected int paramete... |
ainilili_ratel | ratel/landlords-client/src/main/java/org/nico/ratel/landlords/client/event/ClientEventListener_CODE_GAME_READY.java | ClientEventListener_CODE_GAME_READY | call | class ClientEventListener_CODE_GAME_READY extends ClientEventListener {
@Override
public void call(Channel channel, String data) {<FILL_FUNCTION_BODY>}
static void gameReady(Channel channel) {
SimplePrinter.printNotice("\nDo you want to continue the game? [Y/N]");
String line = SimpleWriter... |
Map<String, Object> map = MapHelper.parser(data);
if (SimpleClient.id == (int) map.get("clientId")) {
SimplePrinter.printNotice("you are ready to play game.");
return;
}
SimplePrinter.printNotice(map.get("clientNickName").toString() + " is ready to play game.");
... | 185 | 91 | 276 | public abstract class ClientEventListener {
public abstract void call( Channel channel, String data);
public final static Map<ClientEventCode,ClientEventListener> LISTENER_MAP=new HashMap<>();
private final static String LISTENER_PREFIX="org.nico.ratel.landlords.client.event.ClientEventListener_";
protected s... |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/routing/DirectionResolverResult.java | DirectionResolverResult | getOutEdge | class DirectionResolverResult {
private static final DirectionResolverResult UNRESTRICTED = new DirectionResolverResult(ANY_EDGE, ANY_EDGE, ANY_EDGE, ANY_EDGE);
private static final DirectionResolverResult IMPOSSIBLE = new DirectionResolverResult(NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE);
private final int inEdg... |
if (curbside.trim().isEmpty()) {
curbside = CURBSIDE_ANY;
}
switch (curbside) {
case CURBSIDE_RIGHT:
return directionResolverResult.getOutEdgeRight();
case CURBSIDE_LEFT:
return directionResolverResult.getOutEdgeLeft();
... | 1,145 | 175 | 1,320 | |
jeecgboot_jeecg-boot | jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/filters/ResourceCheckFilter.java | ResourceCheckFilter | onAccessDenied | class ResourceCheckFilter extends AccessControlFilter {
private String errorUrl;
public String getErrorUrl() {
return errorUrl;
}
public void setErrorUrl(String errorUrl) {
this.errorUrl = errorUrl;
}
/**
* 表示是否允许访问 ,如果允许访问返回true,否则false;
*
* @param servletRequ... |
log.info("当 isAccessAllowed 返回 false 的时候,才会执行 method onAccessDenied ");
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
response.sendRedirect(request.getContextPath() + this.errorUrl);
// 返... | 398 | 126 | 524 | |
YunaiV_ruoyi-vue-pro | ruoyi-vue-pro/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigServiceImpl.java | DataSourceConfigServiceImpl | getDataSourceConfigList | class DataSourceConfigServiceImpl implements DataSourceConfigService {
@Resource
private DataSourceConfigMapper dataSourceConfigMapper;
@Resource
private DynamicDataSourceProperties dynamicDataSourceProperties;
@Override
public Long createDataSourceConfig(DataSourceConfigSaveReqVO createReqVO... |
List<DataSourceConfigDO> result = dataSourceConfigMapper.selectList();
// 补充 master 数据源
result.add(0, buildMasterDataSourceConfig());
return result;
| 695 | 50 | 745 | |
PlayEdu_PlayEdu | PlayEdu/playedu-api/src/main/java/xyz/playedu/api/controller/backend/AdminUserController.java | AdminUserController | Index | class AdminUserController {
@Autowired private AdminUserService adminUserService;
@Autowired private AdminRoleService roleService;
@BackendPermission(slug = BPermissionConstant.ADMIN_USER_INDEX)
@GetMapping("/index")
@Log(title = "管理员-列表", businessType = BusinessTypeConstant.GET)
public JsonR... |
Integer page = MapUtils.getInteger(params, "page", 1);
Integer size = MapUtils.getInteger(params, "size", 10);
String name = MapUtils.getString(params, "name");
Integer roleId = MapUtils.getInteger(params, "role_id");
AdminUserPaginateFilter filter = new AdminUserPaginateFilter... | 852 | 332 | 1,184 | |
javamelody_javamelody | javamelody/javamelody-spring-boot-starter/src/main/java/net/bull/javamelody/MonitoringEndpoint.java | MonitoringEndpoint | report | class MonitoringEndpoint {
private final ReportServlet reportServlet;
/**
* Constructor.
* @param servletContext ServletContext
*/
public MonitoringEndpoint(ServletContext servletContext) {
reportServlet = new ReportServlet();
final ServletConfig servletConfig = new ServletConfig() {
// only getServlet... |
final ServletRequestAttributes currentRequestAttributes = (ServletRequestAttributes) RequestContextHolder
.currentRequestAttributes();
final HttpServletRequest httpServletRequest = currentRequestAttributes.getRequest();
final HttpServletResponse httpResponse = currentRequestAttributes.getResponse();
repor... | 291 | 114 | 405 | |
elunez_eladmin | eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuDto.java | MenuDto | equals | class MenuDto extends BaseDTO implements Serializable {
private Long id;
private List<MenuDto> children;
private Integer type;
private String permission;
private String title;
private Integer menuSort;
private String path;
private String component;
private Long pid;
pri... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MenuDto menuDto = (MenuDto) o;
return Objects.equals(id, menuDto.id);
| 241 | 79 | 320 | /**
* @author Zheng Jie
* @date 2019年10月24日20:48:53
*/
@Getter @Setter public class BaseDTO implements Serializable {
private String createBy;
private String updateBy;
private Timestamp createTime;
private Timestamp updateTime;
@Override public String toString();
}
|
houbb_sensitive-word | sensitive-word/src/main/java/com/github/houbb/sensitive/word/support/allow/WordAllowInit.java | WordAllowInit | allow | class WordAllowInit implements IWordAllow {
/**
* 初始化列表
*
* @param pipeline 当前列表泳道
* @since 0.0.13
*/
protected abstract void init(final Pipeline<IWordAllow> pipeline);
@Override
public List<String> allow() {<FILL_FUNCTION_BODY>}
} |
Pipeline<IWordAllow> pipeline = new DefaultPipeline<>();
this.init(pipeline);
List<String> results = new ArrayList<>();
List<IWordAllow> wordAllows = pipeline.list();
for (IWordAllow wordAllow : wordAllows) {
List<String> allowList = wordAllow.allow();
r... | 100 | 106 | 206 | |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/handler/RoutePredicateHandlerMapping.java | RoutePredicateHandlerMapping | getHandlerInternal | class RoutePredicateHandlerMapping extends AbstractHandlerMapping {
private final FilteringWebHandler webHandler;
private final RouteLocator routeLocator;
private final Integer managementPort;
private final ManagementPortType managementPortType;
public RoutePredicateHandlerMapping(FilteringWebHandler webHandl... |
// don't handle requests on management port if set and different than server port
if (this.managementPortType == DIFFERENT && this.managementPort != null
&& exchange.getRequest().getLocalAddress() != null
&& exchange.getRequest().getLocalAddress().getPort() == this.managementPort) {
return Mono.empty();... | 1,213 | 410 | 1,623 | |
PlexPt_chatgpt-java | chatgpt-java/src/main/java/com/plexpt/chatgpt/Test.java | Test | main | class Test {
public static void main(String[] args) {<FILL_FUNCTION_BODY>}
} |
Proxy proxys = Proxys.http("127.0.0.1",10809);
Images images = Images.builder()
.proxy(proxys)
.apiKey("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")
.apiHost("https://api.openai.com/")
.timeout(900)
.build()
... | 30 | 520 | 550 | |
jeecgboot_jeecg-boot | jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/SysDepart.java | SysDepart | equals | class SysDepart implements Serializable {
private static final long serialVersionUID = 1L;
/**ID*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**父机构ID*/
private String parentId;
/**机构/部门名称*/
@Excel(name="机构/部门名称",width=15)
private String departName;
/**英文名*/
@Excel(name="英文名",width=15)
pri... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
SysDepart depart = (SysDepart) o;
return Objects.equals(id, depart.id) &&
Objects.equals(parentId, depart.parentI... | 993 | 424 | 1,417 | |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java | XmlBeanDefinitionReader | doLoadBeanDefinitions | class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
public static final String BEAN_ELEMENT = "bean";
public static final String PROPERTY_ELEMENT = "property";
public static final String ID_ATTRIBUTE = "id";
public static final String NAME_ATTRIBUTE = "name";
public static final String CLASS_ATTR... |
SAXReader reader = new SAXReader();
Document document = reader.read(inputStream);
Element root = document.getRootElement();
//解析context:component-scan标签并扫描指定包中的类,提取类信息,组装成BeanDefinition
Element componentScan = root.element(COMPONENT_SCAN_ELEMENT);
if (componentScan != null) {
String scanPath = compone... | 602 | 876 | 1,478 | /**
* @author derekyi
* @date 2020/11/26
*/
public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader {
private final BeanDefinitionRegistry registry;
private ResourceLoader resourceLoader;
protected AbstractBeanDefinitionReader( BeanDefinitionRegistry registry);
public AbstractBea... |
jitsi_jitsi | jitsi/modules/impl/protocol-sip/src/main/java/net/java/sip/communicator/impl/protocol/sip/xcap/model/commonpolicy/TransformationsType.java | TransformationsType | getAny | class TransformationsType
{
/**
* The service-permissions element.
*/
private ProvideServicePermissionType servicePermission;
/**
* The person-permissions element.
*/
private ProvidePersonPermissionType personPermission;
/**
* The device-permissions element.
*/
pr... |
if (any == null)
{
any = new ArrayList<Element>();
}
return any;
| 548 | 32 | 580 | |
jitsi_jitsi | jitsi/modules/service/certificate/src/main/java/net/java/sip/communicator/impl/certificate/CertificateVerificationActivator.java | CertificateVerificationActivator | getResources | class CertificateVerificationActivator
extends DependentActivator
{
/**
* The bundle context for this bundle.
*/
protected static BundleContext bundleContext;
/**
* The configuration service.
*/
private static ConfigurationService configService;
/**
* The service givin... |
if (resourcesService == null)
{
resourcesService
= ServiceUtils.getService(
bundleContext,
ResourceManagementService.class);
}
return resourcesService;
| 883 | 50 | 933 | /**
* Bundle activator that will start the bundle when the requested dependent services are available.
*/
public abstract class DependentActivator implements BundleActivator, ServiceTrackerCustomizer<Object,Object> {
private static final Map<BundleActivator,Set<Class<?>>> openTrackers=Collections.synchronizedMap(n... |
graphhopper_graphhopper | graphhopper/reader-gtfs/src/main/java/com/conveyal/gtfs/model/Calendar.java | Loader | loadOneRow | class Loader extends Entity.Loader<Calendar> {
private final Map<String, Service> services;
/**
* Create a loader. The map parameter should be an in-memory map that will be modified. We can't write directly
* to MapDB because we modify services as we load calendar dates, and this cre... |
/* Calendars and Fares are special: they are stored as joined tables rather than simple maps. */
String service_id = getStringField("service_id", true); // TODO service_id can reference either calendar or calendar_dates.
Service service = services.computeIfAbsent(service_id, Servic... | 180 | 440 | 620 | |
qiujiayu_AutoLoadCache | AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-hessian/src/main/java/com/jarvis/cache/serializer/hession/WeakReferenceDeserializer.java | WeakReferenceDeserializer | readObject | class WeakReferenceDeserializer extends AbstractMapDeserializer {
@Override
public Object readObject(AbstractHessianInput in, Object[] fields) throws IOException {<FILL_FUNCTION_BODY>}
protected WeakReference<Object> instantiate() throws Exception {
Object obj = new Object();
return new We... |
try {
WeakReference<Object> obj = instantiate();
in.addRef(obj);
Object value = in.readObject();
obj = null;
return new WeakReference<Object>(value);
} catch (IOException e) {
throw e;
} catch (Exception e) {
th... | 96 | 94 | 190 | |
jitsi_jitsi | jitsi/modules/impl/gui/src/main/java/net/java/sip/communicator/impl/gui/main/chat/OutgoingMessageStyle.java | OutgoingMessageStyle | createIndicatorStyle | class OutgoingMessageStyle
extends IncomingMessageStyle
{
/**
* The outgoing message background image path.
*/
private final static String OUTGOING_MESSAGE_IMAGE_PATH
= GuiActivator.getResources().getImageURL(
"service.gui.lookandfeel.OUTGOING_MESSAGE_BACKGROUND").toString();
... |
return "style =\""
+ "width:9px;"
+ " height:19px;"
+ " background-image: url('"
+OUTGOING_MESSAGE_INDICATOR_PATH+"');"
+ " background-repeat: no-repeat;"
+ " background-position: top left;"
+ "\"";
... | 1,632 | 90 | 1,722 | /**
* Defines the CSS style of an incoming chat message elements.
* @author Yana Stamcheva
*/
public class IncomingMessageStyle {
/**
* The incoming message background image path.
*/
private final static String INCOMING_MESSAGE_IMAGE_PATH=GuiActivator.getResources().getImageURL("service.gui.lookandfeel.INCOM... |
logfellow_logstash-logback-encoder | logstash-logback-encoder/src/main/java/net/logstash/logback/composite/AbstractCompositeJsonFormatter.java | DisconnectedOutputStream | decorateGenerator | class DisconnectedOutputStream extends ProxyOutputStream {
DisconnectedOutputStream() {
super(null);
}
public void connect(OutputStream out) {
this.delegate = out;
}
public void disconnect() {
this.delegate = null;
}
... |
JsonGenerator decorated = jsonGeneratorDecorator.decorate(new SimpleObjectJsonGeneratorDelegate(generator))
/*
* Don't let the json generator close the underlying outputStream and let the
* encoder managed it.
*/
.disable(JsonGe... | 772 | 201 | 973 | |
orientechnologies_orientdb | orientdb/core/src/main/java/com/orientechnologies/orient/core/command/traverse/OTraverseContext.java | OTraverseContext | addTraversed | class OTraverseContext extends OBasicCommandContext {
private Memory memory = new StackMemory();
private Set<ORID> history = new HashSet<ORID>();
private OTraverseAbstractProcess<?> currentProcess;
public void push(final OTraverseAbstractProcess<?> iProcess) {
memory.add(iProcess);
}
public Map<Strin... |
history.add(identity.getIdentity());
// final int[] l = history.get(identity.getIdentity());
// if (l == null) {
// final int[] array = new int[BUCKET_SIZE];
// array[0] = iLevel;
// Arrays.fill(array, 1, BUCKET_SIZE, -1);
// history.put(identity.getIdentity(), array);
// } else {
... | 1,422 | 298 | 1,720 | /**
* Basic implementation of OCommandContext interface that stores variables in a map. Supports parent/child context to build a tree of contexts. If a variable is not found on current object the search is applied recursively on child contexts.
* @author Luca Garulli (l.garulli--(at)--orientdb.com)
*/
public class ... |
orientechnologies_orientdb | orientdb/client/src/main/java/com/orientechnologies/orient/client/remote/message/OSubscribeLiveQueryRequest.java | OSubscribeLiveQueryRequest | write | class OSubscribeLiveQueryRequest implements OBinaryRequest<OSubscribeLiveQueryResponse> {
private String query;
private Map<String, Object> params;
private boolean namedParams;
public OSubscribeLiveQueryRequest(String query, Map<String, Object> params) {
this.query = query;
this.params = params;
t... |
ORecordSerializerNetworkV37Client serializer = new ORecordSerializerNetworkV37Client();
network.writeString(query);
// params
ODocument parms = new ODocument();
parms.field("params", this.params);
byte[] bytes = OMessageHelper.getRecordBytes(parms, serializer);
network.writeBytes(bytes);
... | 483 | 103 | 586 | |
pmd_pmd | pmd/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/LexException.java | LexException | makeReason | class LexException extends FileAnalysisException {
private final int line;
private final int column;
/**
* Create a new exception.
*
* @param line Line number
* @param column Column number
* @param filename Filename. If unknown, it can be completed with {@link #setFileId(Fil... |
String message;
if (eofseen) {
message = "<EOF> ";
} else {
message = "\"" + StringUtil.escapeJava(String.valueOf(curChar)) + "\"" + " (" + (int) curChar + "), ";
}
message += "after : \"" + StringUtil.escapeJava(errorAfter) + "\" (in lexical state " + le... | 534 | 115 | 649 | /**
* An exception that occurs while processing a file. Subtypes include <ul> <li> {@link LexException}: lexical syntax errors <li> {@link ParseException}: syntax errors <li> {@link SemanticException}: exceptions occurring after the parsing phase, because the source code is semantically invalid </ul>
*/
public class... |
joelittlejohn_jsonschema2pojo | jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/RequiredArrayRule.java | RequiredArrayRule | updateGetterSetterJavaDoc | class RequiredArrayRule implements Rule<JDefinedClass, JDefinedClass> {
private final RuleFactory ruleFactory;
public static final String REQUIRED_COMMENT_TEXT = "\n(Required)";
protected RequiredArrayRule(RuleFactory ruleFactory) {
this.ruleFactory = ruleFactory;
}
@Override
public ... |
for (Iterator<JMethod> methods = jclass.methods().iterator(); methods.hasNext();) {
JMethod method = methods.next();
if (requiredFieldMethods.contains(method.name())) {
addJavaDoc(method);
}
}
| 755 | 67 | 822 | |
ainilili_ratel | ratel/landlords-client/src/main/java/org/nico/ratel/landlords/client/SimpleClient.java | SimpleClient | main | class SimpleClient {
public static int id = -1;
public final static String VERSION = Features.VERSION_1_3_0;
public static String serverAddress;
public static int port = 1024;
public static String protocol = "pb";
private final static String[] serverAddressSource = new String[]{
"https://raw.githubuserco... |
if (args != null && args.length > 0) {
for (int index = 0; index < args.length; index = index + 2) {
if (index + 1 < args.length) {
if (args[index].equalsIgnoreCase("-p") || args[index].equalsIgnoreCase("-port")) {
port = Integer.parseInt(args[index + 1]);
}
if (args[index].equalsIgnoreCa... | 452 | 598 | 1,050 | |
pmd_pmd | pmd/pmd-core/src/main/java/net/sourceforge/pmd/cpd/VSRenderer.java | VSRenderer | render | class VSRenderer implements CPDReportRenderer {
@Override
public void render(CPDReport report, Writer writer) throws IOException {<FILL_FUNCTION_BODY>}
} |
for (Match match: report.getMatches()) {
for (Mark mark : match) {
FileLocation loc = mark.getLocation();
writer.append(report.getDisplayName(loc.getFileId()))
.append('(').append(String.valueOf(loc.getStartLine())).append("):")
... | 49 | 147 | 196 | |
Kong_unirest-java | unirest-java/unirest-modules-mocks/src/main/java/kong/unirest/core/MockListener.java | MockListener | assertIsClosed | class MockListener implements WebSocket.Listener {
private List<Message> messagesReceived = new ArrayList<>();
private ByteBuffer ping;
private ByteBuffer pong;
private boolean open = false;
private int closedStatus;
private String closedMessage;
@Override
public void onOpen(WebSocket w... |
if(open){
throw new UnirestAssertion("Expected to be closed but was not");
} else if (closedStatus != status || !Objects.equals(closedMessage, message)){
throw new UnirestAssertion("Incorrect Closed Status/Message. Expected [%s : %s] but got [%s : %s]",
statu... | 915 | 101 | 1,016 | |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | AbstractBeanFactory | getObjectForBeanInstance | class AbstractBeanFactory extends DefaultSingletonBeanRegistry implements ConfigurableBeanFactory {
private final List<BeanPostProcessor> beanPostProcessors = new ArrayList<>();
private final Map<String, Object> factoryBeanObjectCache = new HashMap<>();
private final List<StringValueResolver> embeddedValueResolve... |
Object object = beanInstance;
if (beanInstance instanceof FactoryBean) {
FactoryBean factoryBean = (FactoryBean) beanInstance;
try {
if (factoryBean.isSingleton()) {
//singleton作用域bean,从缓存中获取
object = this.factoryBeanObjectCache.get(beanName);
if (object == null) {
object = factoryBe... | 653 | 202 | 855 | /**
* @author derekyi
* @date 2020/11/22
*/
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {
/**
* 一级缓存
*/
private Map<String,Object> singletonObjects=new HashMap<>();
/**
* 二级缓存
*/
private Map<String,Object> earlySingletonObjects=new HashMap<>();
/**
* 三级缓存
*/
priva... |
javamelody_javamelody | javamelody/javamelody-core/src/main/java/net/bull/javamelody/internal/model/PID.java | PID | getPIDFromOS | class PID {
private PID() {
super();
}
/**
* @return PID du process java
*/
public static String getPID() {
String pid = System.getProperty("pid");
if (pid == null) {
// first, reliable with sun jdk (http://golesny.de/wiki/code:javahowtogetpid)
final RuntimeMXBean rtb = ManagementFactor... |
String pid;
// following is not always reliable as is (for example, see issue 3 on solaris 10
// or http://blog.igorminar.com/2007/03/how-java-application-can-discover-its.html)
// Author: Santhosh Kumar T, https://github.com/santhosh-tekuri/jlibs, licence LGPL
// Author getpids.exe: Daniel Scheibli, ht... | 440 | 695 | 1,135 | |
jitsi_jitsi | jitsi/modules/impl/protocol-irc/src/main/java/net/java/sip/communicator/impl/protocol/irc/ProtocolIconIrcImpl.java | ProtocolIconIrcImpl | getImageInBytes | class ProtocolIconIrcImpl
implements ProtocolIcon
{
/**
* The <tt>Logger</tt> used by the <tt>ProtocolIconIrcImpl</tt> class and
* its instances for logging output.
*/
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ProtocolIconIrcImpl.class);
/**
* ... |
ResourceManagementService res = IrcActivator.getResources();
if (res == null)
{
return null;
}
InputStream in = res.getImageInputStream(imageID);
byte[] image = null;
if (in != null)
{
try
{
image = ne... | 1,305 | 142 | 1,447 | |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server-mvc/src/main/java/org/springframework/cloud/gateway/server/mvc/filter/CircuitBreakerFilterFunctions.java | CircuitBreakerFilterFunctions | circuitBreaker | class CircuitBreakerFilterFunctions {
private CircuitBreakerFilterFunctions() {
}
@Shortcut
public static HandlerFilterFunction<ServerResponse, ServerResponse> circuitBreaker(String id) {
return circuitBreaker(config -> config.setId(id));
}
public static HandlerFilterFunction<ServerResponse, ServerResponse> ... |
Set<HttpStatusCode> failureStatuses = config.getStatusCodes().stream()
.map(status -> HttpStatusHolder.valueOf(status).resolve()).collect(Collectors.toSet());
return (request, next) -> {
CircuitBreakerFactory<?, ?> circuitBreakerFactory = MvcUtils.getApplicationContext(request)
.getBean(CircuitBreakerF... | 851 | 667 | 1,518 | |
javamelody_javamelody | javamelody/javamelody-core/src/main/java/net/bull/javamelody/internal/web/pdf/PdfCounterErrorReport.java | PdfCounterErrorReport | toPdf | class PdfCounterErrorReport extends PdfAbstractTableReport {
private final Counter counter;
private final DateFormat dateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT,
DateFormat.MEDIUM, I18N.getCurrentLocale());
private final Font severeFont = PdfFonts.SEVERE_CELL.getFont();
private final Fo... |
final List<CounterError> errors = counter.getErrors();
if (errors.isEmpty()) {
addToDocument(new Phrase(getString("Aucune_erreur"), normalFont));
} else {
writeErrors(errors);
}
| 933 | 75 | 1,008 | /**
* Parent abstrait des classes de rapport pdf avec un tableau.
* @author Emeric Vernat
*/
abstract class PdfAbstractTableReport extends PdfAbstractReport {
private final Font cellFont=PdfFonts.TABLE_CELL.getFont();
private PdfPTable table;
private boolean oddRow;
PdfAbstractTableReport( Document documen... |
subhra74_snowflake | snowflake/muon-jediterm/src/main/java/com/jediterm/terminal/util/Pair.java | Pair | equals | class Pair<A, B> {
public final A first;
public final B second;
//
public static <A, B> Pair<A, B> create(A first, B second) {
return new Pair<A, B>(first, second);
}
public static <T> T getFirst(Pair<T, ?> pair) {
return pair != null ? pair.first : null;
}
public static <T> T getSecond(Pair<... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Pair pair = (Pair)o;
if (first != null ? !first.equals(pair.first) : pair.first != null) return false;
if (second != null ? !second.equals(pair.second) : pair.second != null) return false;
return true;
| 406 | 112 | 518 | |
orientechnologies_orientdb | orientdb/distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/OLocalKeySource.java | OLocalKeySource | getUniqueKeys | class OLocalKeySource implements OLockKeySource {
private final OTransactionId txId;
private final OTransactionInternal iTx;
private final ODatabaseDocumentDistributed database;
public OLocalKeySource(
OTransactionId txId, OTransactionInternal iTx, ODatabaseDocumentDistributed database) {
this.txId =... |
TreeSet<OTransactionUniqueKey> uniqueIndexKeys = new TreeSet<>();
iTx.getIndexOperations()
.forEach(
(index, changes) -> {
OIndexInternal resolvedIndex =
changes.resolveAssociatedIndex(
index, database.getMetadata().getIndexManagerIntern... | 254 | 210 | 464 | |
PlayEdu_PlayEdu | PlayEdu/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java | LdapUser | equals | class LdapUser implements Serializable {
/** */
@TableId(type = IdType.AUTO)
private Integer id;
/** 唯一特征值 */
private String uuid;
/** 用户ID */
private Integer userId;
/** cn */
private String cn;
/** dn */
private String dn;
/** ou */
private String ou;
/** ... |
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
LdapUser other = (LdapUser) that;
return (this.getId() == null ? other.getId() == null : this.g... | 1,311 | 460 | 1,771 | |
pmd_pmd | pmd/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/ASTInput.java | ASTInput | addExcludedLineRange | class ASTInput extends AbstractPLSQLNode implements RootNode {
private AstInfo<ASTInput> astInfo;
ASTInput(int id) {
super(id);
}
@Override
public AstInfo<ASTInput> getAstInfo() {
return astInfo;
}
ASTInput addTaskInfo(ParserTask task) {
this.astInfo = new AstInfo... |
excludedLinesCount += last - first + 1;
excludedRangesCount += 1;
| 335 | 25 | 360 | |
docker-java_docker-java | docker-java/docker-java-core/src/main/java/com/github/dockerjava/core/command/InspectContainerCmdImpl.java | InspectContainerCmdImpl | withContainerId | class InspectContainerCmdImpl extends AbstrDockerCmd<InspectContainerCmd, InspectContainerResponse> implements
InspectContainerCmd {
private String containerId;
private boolean size;
public InspectContainerCmdImpl(InspectContainerCmd.Exec exec, String containerId) {
super(exec);
wi... |
this.containerId = Objects.requireNonNull(containerId, "containerId was not specified");
return this;
| 253 | 32 | 285 | |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server-mvc/src/main/java/org/springframework/cloud/gateway/server/mvc/filter/LoadBalancerHandlerSupplier.java | LoadBalancerHandlerSupplier | lb | class LoadBalancerHandlerSupplier implements HandlerSupplier {
@Override
public Collection<Method> get() {
return Arrays.asList(getClass().getMethods());
}
public static HandlerDiscoverer.Result lb(RouteProperties routeProperties) {
return lb(routeProperties.getUri());
}
public static HandlerDiscoverer.Res... |
// TODO: how to do something other than http
return new HandlerDiscoverer.Result(HandlerFunctions.http(),
Collections.singletonList(LoadBalancerFilterFunctions.lb(uri.getHost())));
| 111 | 57 | 168 | |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/actuate/GatewayEndpointInfo.java | GatewayEndpointInfo | equals | class GatewayEndpointInfo {
private String href;
private List<String> methods;
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public String[] getMethods() {
return methods.stream().toArray(String[]::new);
}
GatewayEndpointInfo(String href, String met... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GatewayEndpointInfo that = (GatewayEndpointInfo) o;
return Objects.equals(href, that.href) && Objects.equals(methods, that.methods);
| 217 | 92 | 309 | |
qiujiayu_AutoLoadCache | AutoLoadCache/autoload-cache-manager/autoload-cache-manager-jedis/src/main/java/com/jarvis/cache/redis/RetryableJedisClusterPipeline.java | RetryableJedisClusterPipeline | syncAndReturnAll | class RetryableJedisClusterPipeline {
/**
* 部分字段没有对应的获取方法,只能采用反射来做
* 也可以去继承JedisCluster和JedisSlotBasedConnectionHandler来提供访问接口
**/
private static final Field FIELD_CONNECTION_HANDLER;
private static final Field FIELD_CACHE;
private static final Logger log = LoggerFactory.getLogger(JedisU... |
try {
JedisClusterPipeline pipeline = new JedisClusterPipeline(clusterInfoCache);
execute(pipeline);
return pipeline.syncAndReturnAll();
} catch (JedisMovedDataException jre) {
// if MOVED redirection occurred, rebuilds cluster's slot cache,
/... | 806 | 155 | 961 | |
joelittlejohn_jsonschema2pojo | jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/PropertiesRule.java | PropertiesRule | apply | class PropertiesRule implements Rule<JDefinedClass, JDefinedClass> {
private final RuleFactory ruleFactory;
protected PropertiesRule(RuleFactory ruleFactory) {
this.ruleFactory = ruleFactory;
}
/**
* Applies this schema rule to take the required code generation steps.
* <p>
* F... |
if (node == null) {
node = JsonNodeFactory.instance.objectNode();
}
for (Iterator<String> properties = node.fieldNames(); properties.hasNext(); ) {
String property = properties.next();
ruleFactory.getPropertyRule().apply(property, node.get(property), node, ... | 569 | 181 | 750 | |
zhkl0228_unidbg | unidbg/unidbg-android/src/main/java/com/github/unidbg/file/linux/LinuxFileSystem.java | LinuxFileSystem | open | class LinuxFileSystem extends BaseFileSystem<AndroidFileIO> implements FileSystem<AndroidFileIO>, IOConstants {
public LinuxFileSystem(Emulator<AndroidFileIO> emulator, File rootDir) {
super(emulator, rootDir);
}
@Override
public FileResult<AndroidFileIO> open(String pathname, int oflags) {<FI... |
if ("/dev/tty".equals(pathname)) {
return FileResult.<AndroidFileIO>success(new NullFileIO(pathname));
}
if ("/proc/self/maps".equals(pathname) || ("/proc/" + emulator.getPid() + "/maps").equals(pathname) ||
("/proc/self/task/" + emulator.getPid() + "/maps").equals(p... | 541 | 169 | 710 | |
zhkl0228_unidbg | unidbg/unidbg-android/src/main/java/com/github/unidbg/linux/android/AndroidARM64Unwinder.java | AndroidARM64Unwinder | unw_step | class AndroidARM64Unwinder extends SimpleARM64Unwinder {
private static final Log log = LogFactory.getLog(AndroidARM64Unwinder.class);
private final DwarfCursor context;
public AndroidARM64Unwinder(Emulator<?> emulator) {
super(emulator);
this.context = new DwarfCursor64(emulator);
}
... |
try {
LinuxModule module = (LinuxModule) emulator.getMemory().findModuleByAddress(this.context.ip);
MemoizedObject<GnuEhFrameHeader> ehFrameHeader = module == null ? null : module.ehFrameHeader;
if (ehFrameHeader != null) {
long fun = this.context.ip - module... | 146 | 224 | 370 | public class SimpleARM64Unwinder extends Unwinder {
public SimpleARM64Unwinder( Emulator<?> emulator);
@Override protected String getBaseFormat();
@Override public Frame createFrame( UnidbgPointer ip, UnidbgPointer fp);
private Frame initFrame( Emulator<?> emulator);
@Override protected Frame unw_step( E... |
pmd_pmd | pmd/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/SymbolicValueHelper.java | SymbolicValueHelper | equalsModuloWrapper | class SymbolicValueHelper {
private SymbolicValueHelper() {
// utility class
}
static boolean equalsModuloWrapper(SymbolicValue sv, Object other) {<FILL_FUNCTION_BODY>}
} |
if (other instanceof SymbolicValue) {
return sv.equals(other);
} else {
return sv.valueEquals(other);
}
| 59 | 41 | 100 | |
graphhopper_graphhopper | graphhopper/example/src/main/java/com/graphhopper/example/RoutingExample.java | RoutingExample | createGraphHopperInstance | class RoutingExample {
public static void main(String[] args) {
String relDir = args.length == 1 ? args[0] : "";
GraphHopper hopper = createGraphHopperInstance(relDir + "core/files/andorra.osm.pbf");
routing(hopper);
speedModeVersusFlexibleMode(hopper);
alternativeRoute(hoppe... |
GraphHopper hopper = new GraphHopper();
hopper.setOSMFile(ghLoc);
// specify where to store graphhopper files
hopper.setGraphHopperLocation("target/routing-graph-cache");
// add all encoded values that are used in the custom model, these are also available as path details or fo... | 1,646 | 248 | 1,894 | |
PlayEdu_PlayEdu | PlayEdu/playedu-api/src/main/java/xyz/playedu/api/listener/UserLearnCourseUpdateListener.java | UserLearnCourseUpdateListener | storeLearnDuration | class UserLearnCourseUpdateListener {
@Autowired private UserLearnDurationRecordService userLearnDurationRecordService;
@Autowired private UserLearnDurationStatsService userLearnDurationStatsService;
@EventListener
public void storeLearnDuration(UserLearnCourseUpdateEvent event) {<FILL_FUNCTION_BODY>... |
// 观看时长统计
userLearnDurationStatsService.storeOrUpdate(
event.getUserId(), event.getStartAt(), event.getEndAt());
// 观看记录
userLearnDurationRecordService.store(
event.getUserId(),
event.getCourseId(),
event.getHourId(),
... | 83 | 103 | 186 | |
PlayEdu_PlayEdu | PlayEdu/playedu-api/src/main/java/xyz/playedu/api/controller/backend/AdminLogController.java | AdminLogController | detail | class AdminLogController {
@Autowired private AdminLogService adminLogService;
@Autowired private BackendBus backendBus;
@BackendPermission(slug = BPermissionConstant.ADMIN_LOG)
@GetMapping("/index")
@Log(title = "管理员日志-列表", businessType = BusinessTypeConstant.GET)
public JsonResponse index(@... |
Integer adminId = 0;
if (!backendBus.isSuperAdmin()) {
adminId = BCtx.getId();
}
AdminLog log = adminLogService.find(id, adminId);
if (log == null) {
throw new ServiceException("日志不存在");
}
return JsonResponse.data(log);
| 605 | 90 | 695 | |
YunaiV_ruoyi-vue-pro | ruoyi-vue-pro/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notice/NoticeController.java | NoticeController | push | class NoticeController {
@Resource
private NoticeService noticeService;
@Resource
private WebSocketSenderApi webSocketSenderApi;
@PostMapping("/create")
@Operation(summary = "创建通知公告")
@PreAuthorize("@ss.hasPermission('system:notice:create')")
public CommonResult<Long> createNotice(@Va... |
NoticeDO notice = noticeService.getNotice(id);
Assert.notNull(notice, "公告不能为空");
// 通过 websocket 推送给在线的用户
webSocketSenderApi.sendObject(UserTypeEnum.ADMIN.getValue(), "notice-push", notice);
return success(true);
| 710 | 82 | 792 | |
jeecgboot_jeecg-boot | jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysRoleServiceImpl.java | SysRoleServiceImpl | importExcelCheckRoleCode | class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
@Autowired
SysRoleMapper sysRoleMapper;
@Autowired
SysUserMapper sysUserMapper;
@Override
public Page<SysRole> listAllSysRole(Page<SysRole> page, SysRole role) {
return page.setRecords... |
List<Object> listSysRoles = ExcelImportUtil.importExcel(file.getInputStream(), SysRole.class, params);
int totalCount = listSysRoles.size();
List<String> errorStrs = new ArrayList<>();
// 去除 listSysRoles 中重复的数据
for (int i = 0; i < listSysRoles.size(); i++) {
String ... | 622 | 409 | 1,031 | |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server-mvc/src/main/java/org/springframework/cloud/gateway/server/mvc/invoke/reflect/OperationMethodParameters.java | OperationMethodParameters | getOperationParameters | class OperationMethodParameters implements OperationParameters {
private final List<OperationParameter> operationParameters;
/**
* Create a new {@link OperationMethodParameters} instance.
* @param method the source method
* @param parameterNameDiscoverer the parameter name discoverer
*/
OperationMethodPara... |
List<OperationParameter> operationParameters = new ArrayList<>(parameters.length);
for (int i = 0; i < names.length; i++) {
operationParameters.add(new OperationMethodParameter(names[i], parameters[i]));
}
return Collections.unmodifiableList(operationParameters);
| 348 | 80 | 428 | |
YunaiV_ruoyi-vue-pro | ruoyi-vue-pro/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java | JobLogServiceImpl | updateJobLogResultAsync | class JobLogServiceImpl implements JobLogService {
@Resource
private JobLogMapper jobLogMapper;
@Override
public Long createJobLog(Long jobId, LocalDateTime beginTime,
String jobHandlerName, String jobHandlerParam, Integer executeIndex) {
JobLogDO log = JobLogDO.bu... |
try {
JobLogDO updateObj = JobLogDO.builder().id(logId).endTime(endTime).duration(duration)
.status(success ? JobLogStatusEnum.SUCCESS.getStatus() : JobLogStatusEnum.FAILURE.getStatus())
.result(result).build();
jobLogMapper.updateById(updateObj);... | 462 | 147 | 609 | |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/reader/osm/conditional/DateRangeParser.java | DateRangeParser | createCalendar | class DateRangeParser implements ConditionalValueParser {
private static final DateFormat YEAR_MONTH_DAY_DF = create3CharMonthFormatter("yyyy MMM dd");
private static final DateFormat MONTH_DAY_DF = create3CharMonthFormatter("MMM dd");
private static final DateFormat MONTH_DAY2_DF = createFormatter("dd.MM")... |
// Use locale US as exception here (instead of UK) to match week order "Su-Sa" used in Calendar for day_of_week.
// Inconsistent but we should not use US for other date handling stuff like strange default formatting, related to #647.
return Calendar.getInstance(Helper.UTC, Locale.US);
| 1,354 | 83 | 1,437 | |
Kong_unirest-java | unirest-java/unirest/src/main/java/kong/unirest/core/java/MonitoringInputStream.java | MonitoringInputStream | updateProgress | class MonitoringInputStream extends InputStream {
private final InputStream in;
private volatile long totalNumBytesRead = 0;
private ProgressMonitor monitor;
public MonitoringInputStream(InputStream value, ProgressMonitor monitor) {
this.in = value;
this.monitor = monitor;
}
@... |
if (numBytesRead > 0) {
this.totalNumBytesRead += numBytesRead;
monitor.accept("body", null, numBytesRead, totalNumBytesRead);
}
return numBytesRead;
| 372 | 57 | 429 | |
qiujiayu_AutoLoadCache | AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-protobuf/src/main/java/com/jarvis/cache/serializer/protobuf/ReadByteBuf.java | ReadByteBuf | readableBytes | class ReadByteBuf {
private byte[] array;
private int readerIndex;
public ReadByteBuf(byte[] array) {
this.array = array;
this.readerIndex = 0;
}
public byte readByte() {
byte value = HeapByteBufUtil.getByte(array, readerIndex);
readerIndex += 1;
return val... |
byte[] newArray = new byte[array.length - readerIndex];
System.arraycopy(array, readerIndex, newArray, 0, newArray.length);
return newArray;
| 209 | 49 | 258 | |
subhra74_snowflake | snowflake/muon-app/src/main/java/muon/app/ssh/GraphicalHostKeyVerifier.java | GraphicalHostKeyVerifier | hostKeyChangedAction | class GraphicalHostKeyVerifier extends OpenSSHKnownHosts {
/**
* @throws IOException
*
*/
public GraphicalHostKeyVerifier(File knownHostFile) throws IOException {
super(knownHostFile);
}
@Override
protected boolean hostKeyUnverifiableAction(String hostname, PublicKey key) {
final KeyType typ... |
final KeyType type = KeyType.fromKey(key);
final String fp = SecurityUtils.getFingerprint(key);
final String path = getFile().getAbsolutePath();
String msg = String.format("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
+ "@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @\n"
... | 480 | 326 | 806 | |
elunez_eladmin | eladmin/eladmin-common/src/main/java/me/zhengjie/exception/EntityNotFoundException.java | EntityNotFoundException | generateMessage | class EntityNotFoundException extends RuntimeException {
public EntityNotFoundException(Class clazz, String field, String val) {
super(EntityNotFoundException.generateMessage(clazz.getSimpleName(), field, val));
}
private static String generateMessage(String entity, String field, String val) {<FIL... |
return StringUtils.capitalize(entity)
+ " with " + field + " "+ val + " does not exist";
| 88 | 34 | 122 | |
joelittlejohn_jsonschema2pojo | jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/DescriptionRule.java | DescriptionRule | apply | class DescriptionRule implements Rule<JDocCommentable, JDocComment> {
protected DescriptionRule() {
}
/**
* Applies this schema rule to take the required code generation steps.
* <p>
* When a description node is found and applied with this rule, the value of
* the description is added ... |
JDocComment javadoc = generatableType.javadoc();
String descriptionText = node.asText();
if(StringUtils.isNotBlank(descriptionText)) {
String[] lines = node.asText().split("/\r?\n/");
for(String line : lines) {
javadoc.append(line);
}
... | 243 | 101 | 344 | |
subhra74_snowflake | snowflake/muon-app/src/main/java/muon/app/ui/components/session/files/view/DndTransferData.java | DndTransferData | toString | class DndTransferData implements Serializable {
public enum DndSourceType {
SSH, SFTP, FTP, LOCAL
}
public enum TransferAction {
DragDrop, Cut, Copy
}
private int sessionHashcode;
private FileInfo[] files;
private String currentDirectory;
private int source;
private TransferAction transfer... |
return "DndTransferData{" + "sessionHashcode=" + sessionHashcode
+ ", files=" + Arrays.toString(files) + ", currentDirectory='"
+ currentDirectory + '\'' + '}';
| 513 | 61 | 574 | |
zhkl0228_unidbg | unidbg/unidbg-api/src/main/java/com/github/unidbg/TraceMemoryHook.java | TraceMemoryHook | hook | class TraceMemoryHook implements ReadHook, WriteHook, TraceHook {
private final boolean read;
private final DateFormat dateFormat = new SimpleDateFormat("[HH:mm:ss SSS]");
public TraceMemoryHook(boolean read) {
this.read = read;
}
private PrintStream redirect;
TraceReadListener traceR... |
if (!read) {
return;
}
try {
byte[] data = size == 0 ? new byte[0] : backend.mem_read(address, size);
String value;
switch (data.length) {
case 1:
value = String.format("0x%02x", ByteBuffer.wrap(data).order(Byt... | 846 | 408 | 1,254 | |
qiujiayu_AutoLoadCache | AutoLoadCache/autoload-cache-manager/autoload-cache-manager-jedis/src/main/java/com/jarvis/cache/redis/ShardedJedisCacheManager.java | ShardedJedisClient | delete | class ShardedJedisClient implements IRedis {
private static final Logger LOGGER = LoggerFactory.getLogger(ShardedJedisClient.class);
private final ShardedJedis shardedJedis;
private final AbstractRedisCacheManager cacheManager;
public ShardedJedisClient(ShardedJedis shardedJedis, Abs... |
ShardedJedisPipeline pipeline = new ShardedJedisPipeline();
pipeline.setShardedJedis(shardedJedis);
JedisUtil.executeDelete(pipeline, keys);
pipeline.sync();
| 842 | 61 | 903 | |
obsidiandynamics_kafdrop | kafdrop/src/main/java/kafdrop/config/ini/IniFilePropertySource.java | IniFilePropertySource | loadPropertiesForIniFile | class IniFilePropertySource extends MapPropertySource {
public IniFilePropertySource(String name, IniFileProperties source, String[] activeProfiles) {
super(name, loadPropertiesForIniFile(source, activeProfiles));
}
private static Map<String, Object> loadPropertiesForIniFile(IniFileProperties iniProperties,
... |
final Map<String, Object> properties = Maps.newLinkedHashMap();
properties.putAll(iniProperties.getDefaultProperties());
if (activeProfiles != null && activeProfiles.length > 0) {
for (String profile : activeProfiles) {
final Map<String, String> sectionProperties = iniProperties.getSectionPr... | 109 | 127 | 236 | |
PlayEdu_PlayEdu | PlayEdu/playedu-common/src/main/java/xyz/playedu/common/service/impl/CategoryServiceImpl.java | CategoryServiceImpl | updateParentChain | class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category>
implements CategoryService {
@Override
public List<Category> listByParentId(Integer id) {
return list(query().getWrapper().eq("parent_id", id).orderByAsc("sort"));
}
@Override
public List<Category> all() {
... |
List<Category> children =
list(query().getWrapper().like("parent_chain", oldChildrenPC + "%"));
if (children.size() == 0) {
return;
}
ArrayList<Category> updateRows = new ArrayList<>();
for (Category tmpResourceCategory : children) {
Cate... | 1,231 | 318 | 1,549 | |
YunaiV_ruoyi-vue-pro | ruoyi-vue-pro/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/MapUtils.java | MapUtils | convertMap | class MapUtils {
/**
* 从哈希表表中,获得 keys 对应的所有 value 数组
*
* @param multimap 哈希表
* @param keys keys
* @return value 数组
*/
public static <K, V> List<V> getList(Multimap<K, V> multimap, Collection<K> keys) {
List<V> result = new ArrayList<>();
keys.forEach(k -> {
... |
Map<K, V> map = Maps.newLinkedHashMapWithExpectedSize(keyValues.size());
keyValues.forEach(keyValue -> map.put(keyValue.getKey(), keyValue.getValue()));
return map;
| 414 | 61 | 475 | |
houbb_sensitive-word | sensitive-word/src/main/java/com/github/houbb/sensitive/word/support/deny/WordDenys.java | WordDenys | chains | class WordDenys {
private WordDenys(){}
/**
* 责任链
* @param wordDeny 拒绝
* @param others 其他
* @return 结果
* @since 0.0.13
*/
public static IWordDeny chains(final IWordDeny wordDeny,
final IWordDeny... others) {<FILL_FUNCTION_BODY>}
/**
... |
return new WordDenyInit() {
@Override
protected void init(Pipeline<IWordDeny> pipeline) {
pipeline.addLast(wordDeny);
if(ArrayUtil.isNotEmpty(others)) {
for(IWordDeny other : others) {
pipeline.addLast(other);
... | 166 | 94 | 260 | |
jeecgboot_jeecg-boot | jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/AbstractQueryBlackListHandler.java | AbstractQueryBlackListHandler | isPass | class AbstractQueryBlackListHandler {
/**
* key-表名
* value-字段名,多个逗号隔开
* 两种配置方式-- 全部配置成小写
* ruleMap.put("sys_user", "*")sys_user所有的字段不支持查询
* ruleMap.put("sys_user", "username,password")sys_user中的username和password不支持查询
*/
public static Map<String, String> ruleMap = new HashMap<>();
... |
List<QueryTable> list = null;
//【jeecg-boot/issues/4040】在线报表不支持子查询,解析报错 #4040
try {
list = this.getQueryTableInfo(sql.toLowerCase());
} catch (Exception e) {
log.warn("校验sql语句,解析报错:{}",e.getMessage());
}
if(list==null){
return... | 1,425 | 378 | 1,803 | |
eirslett_frontend-maven-plugin | frontend-maven-plugin/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/InstallBunMojo.java | InstallBunMojo | execute | class InstallBunMojo extends AbstractFrontendMojo {
/**
* The version of Bun to install. IMPORTANT! Most Bun version names start with 'v', for example
* 'v1.0.0'
*/
@Parameter(property = "bunVersion", required = true)
private String bunVersion;
/**
* Server Id for download username... |
ProxyConfig proxyConfig = MojoUtils.getProxyConfig(this.session, this.decrypter);
Server server = MojoUtils.decryptServer(this.serverId, this.session, this.decrypter);
if (null != server) {
factory.getBunInstaller(proxyConfig).setBunVersion(this.bunVersion).setUserName(server.getUse... | 307 | 150 | 457 | public abstract class AbstractFrontendMojo extends AbstractMojo {
@Component protected MojoExecution execution;
/**
* Whether you should skip while running in the test phase (default is false)
*/
@Parameter(property="skipTests",required=false,defaultValue="false") protected Boolean skipTests;
/**
* Set thi... |
PlayEdu_PlayEdu | PlayEdu/playedu-course/src/main/java/xyz/playedu/course/service/impl/CourseChapterServiceImpl.java | CourseChapterServiceImpl | findOrFail | class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, CourseChapter>
implements CourseChapterService {
@Override
public void create(Integer courseId, String name, Integer sort) {
CourseChapter chapter = new CourseChapter();
chapter.setCourseId(courseId);
chapte... |
CourseChapter chapter = getOne(query().getWrapper().eq("id", id).eq("course_id", courseId));
if (chapter == null) {
throw new NotFoundException("章节不存在");
}
return chapter;
| 520 | 63 | 583 | |
javamelody_javamelody | javamelody/javamelody-core/src/main/java/net/bull/javamelody/JpaPersistence.java | JavaMelodyPersistenceProviderResolver | initJpaCounter | class JavaMelodyPersistenceProviderResolver
implements PersistenceProviderResolver {
private final PersistenceProviderResolver delegate;
JavaMelodyPersistenceProviderResolver(PersistenceProviderResolver delegate) {
super();
this.delegate = delegate;
}
@Override
public List<PersistenceProv... |
// quand cette classe est utilisée, le compteur est affiché
// sauf si le paramètre displayed-counters dit le contraire
JPA_COUNTER.setDisplayed(!COUNTER_HIDDEN);
// setUsed(true) nécessaire ici si le contexte jpa est initialisé avant FilterContext
// sinon les statistiques jpa ne sont pas affichées
... | 615 | 147 | 762 | |
jeecgboot_jeecg-boot | jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/message/handle/impl/QywxSendMsgHandle.java | QywxSendMsgHandle | sendMsg | class QywxSendMsgHandle implements ISendMsgHandle {
@Autowired
private ThirdAppWechatEnterpriseServiceImpl wechatEnterpriseService;
@Override
public void sendMsg(String esReceiver, String esTitle, String esContent) {<FILL_FUNCTION_BODY>}
@Override
public void sendMessage(MessageDTO messageDTO) {
wechatEnterp... |
log.info("发微信消息模板");
MessageDTO messageDTO = new MessageDTO();
messageDTO.setToUser(esReceiver);
messageDTO.setTitle(esTitle);
messageDTO.setContent(esContent);
messageDTO.setToAll(false);
sendMessage(messageDTO);
| 113 | 95 | 208 | |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/route/RedisRouteDefinitionRepository.java | RedisRouteDefinitionRepository | delete | class RedisRouteDefinitionRepository implements RouteDefinitionRepository {
private static final Logger log = LoggerFactory.getLogger(RedisRouteDefinitionRepository.class);
/**
* Key prefix for RouteDefinition queries to redis.
*/
private static final String ROUTEDEFINITION_REDIS_KEY_PREFIX_QUERY = "routedefin... |
return routeId.flatMap(id -> routeDefinitionReactiveValueOperations.delete(createKey(id)).flatMap(success -> {
if (success) {
return Mono.empty();
}
return Mono.defer(() -> Mono.error(new NotFoundException(
String.format("Could not remove route from redis repository with id: %s", routeId))));
}))... | 532 | 105 | 637 | |
orientechnologies_orientdb | orientdb/core/src/main/java/com/orientechnologies/orient/core/sql/executor/FetchTemporaryFromTxStep.java | FetchTemporaryFromTxStep | deserialize | class FetchTemporaryFromTxStep extends AbstractExecutionStep {
private String className;
private Object order;
public FetchTemporaryFromTxStep(OCommandContext ctx, String className, boolean profilingEnabled) {
super(ctx, profilingEnabled);
this.className = className;
}
@Override
public OExecutio... |
try {
OExecutionStepInternal.basicDeserialize(fromResult, this);
className = fromResult.getProperty("className");
} catch (Exception e) {
throw OException.wrapException(new OCommandExecutionException(""), e);
}
| 1,195 | 66 | 1,261 | /**
* @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com)
*/
public abstract class AbstractExecutionStep implements OExecutionStepInternal {
protected final OCommandContext ctx;
protected Optional<OExecutionStepInternal> prev=Optional.empty();
protected Optional<OExecutionStepInternal> next=Optional.em... |
PlayEdu_PlayEdu | PlayEdu/playedu-common/src/main/java/xyz/playedu/common/domain/AdminUserRole.java | AdminUserRole | hashCode | class AdminUserRole implements Serializable {
@JsonProperty("admin_id")
private Integer adminId;
@JsonProperty("role_id")
private Integer roleId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@Override
public boolean equals(Object that) {
if (this... |
final int prime = 31;
int result = 1;
result = prime * result + ((getAdminId() == null) ? 0 : getAdminId().hashCode());
result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode());
return result;
| 393 | 78 | 471 | |
YunaiV_ruoyi-vue-pro | ruoyi-vue-pro/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/demo/demo02/Demo02CategoryServiceImpl.java | Demo02CategoryServiceImpl | validateParentDemo02Category | class Demo02CategoryServiceImpl implements Demo02CategoryService {
@Resource
private Demo02CategoryMapper demo02CategoryMapper;
@Override
public Long createDemo02Category(Demo02CategorySaveReqVO createReqVO) {
// 校验父级编号的有效性
validateParentDemo02Category(null, createReqVO.getParentId());... |
if (parentId == null || Demo02CategoryDO.PARENT_ID_ROOT.equals(parentId)) {
return;
}
// 1. 不能设置自己为父示例分类
if (Objects.equals(id, parentId)) {
throw exception(DEMO02_CATEGORY_PARENT_ERROR);
}
// 2. 父示例分类不存在
Demo02CategoryDO parentDemo02Categ... | 916 | 427 | 1,343 | |
logfellow_logstash-logback-encoder | logstash-logback-encoder/src/main/java/net/logstash/logback/composite/loggingevent/LogstashMarkersJsonProvider.java | LogstashMarkersJsonProvider | writeLogstashMarkerIfNecessary | class LogstashMarkersJsonProvider extends AbstractJsonProvider<ILoggingEvent> {
@Override
public void writeTo(JsonGenerator generator, ILoggingEvent event) throws IOException {
writeLogstashMarkerIfNecessary(generator, event.getMarkerList());
}
private void writeLogstashMarkerIfNecessary(J... |
if (marker != null) {
if (isLogstashMarker(marker)) {
((LogstashMarker) marker).writeTo(generator);
}
if (marker.hasReferences()) {
for (Iterator<?> i = marker.iterator(); i.hasNext();) {
Marker next = (Marker)... | 217 | 119 | 336 | |
eirslett_frontend-maven-plugin | frontend-maven-plugin/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/BowerMojo.java | BowerMojo | getProxyConfig | class BowerMojo extends AbstractFrontendMojo {
/**
* Bower arguments. Default is "install".
*/
@Parameter(defaultValue = "install", property = "frontend.bower.arguments", required = false)
private String arguments;
/**
* Skips execution of this mojo.
*/
@Parameter(property = "s... |
if (bowerInheritsProxyConfigFromMaven) {
return MojoUtils.getProxyConfig(session, decrypter);
} else {
getLog().info("bower not inheriting proxy config from Maven");
return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList());
}
| 336 | 83 | 419 | public abstract class AbstractFrontendMojo extends AbstractMojo {
@Component protected MojoExecution execution;
/**
* Whether you should skip while running in the test phase (default is false)
*/
@Parameter(property="skipTests",required=false,defaultValue="false") protected Boolean skipTests;
/**
* Set thi... |
orientechnologies_orientdb | orientdb/client/src/main/java/com/orientechnologies/orient/client/remote/message/ODeleteRecordRequest.java | ODeleteRecordRequest | read | class ODeleteRecordRequest implements OBinaryAsyncRequest<ODeleteRecordResponse> {
private ORecordId rid;
private int version;
private byte mode;
public ODeleteRecordRequest(ORecordId iRid, int iVersion) {
this.rid = iRid;
this.version = iVersion;
}
public ODeleteRecordRequest() {}
@Override
... |
rid = channel.readRID();
version = channel.readVersion();
mode = channel.readByte();
| 395 | 31 | 426 | |
zhkl0228_unidbg | unidbg/unidbg-ios/src/main/java/com/github/unidbg/ios/file/LocalDarwinUdpSocket.java | LocalDarwinUdpSocket | connect | class LocalDarwinUdpSocket extends LocalUdpSocket {
private static final Log log = LogFactory.getLog(LocalDarwinUdpSocket.class);
public LocalDarwinUdpSocket(Emulator<?> emulator) {
super(emulator);
}
@Override
public int connect(Pointer addr, int addrlen) {<FILL_FUNCTION_BODY>}
@Ove... |
String path = addr.getString(2);
log.debug("connect path=" + path);
return connect(path);
| 227 | 35 | 262 | public abstract class LocalUdpSocket extends SocketIO implements FileIO {
private static final Log log=LogFactory.getLog(LocalUdpSocket.class);
protected interface UdpHandler {
void handle( byte[] request) throws IOException ;
}
protected final Emulator<?> emulator;
protected LocalUdpSocket( Emulator<?>... |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server-mvc/src/main/java/org/springframework/cloud/gateway/server/mvc/filter/Bucket4jFilterFunctions.java | RateLimitConfig | setTokens | class RateLimitConfig {
Function<RateLimitConfig, BucketConfiguration> configurationBuilder = DEFAULT_CONFIGURATION_BUILDER;
long capacity;
Duration period;
Function<ServerRequest, String> keyResolver;
HttpStatusCode statusCode = HttpStatus.TOO_MANY_REQUESTS;
Duration timeout;
int tokens = 1;
St... |
Assert.isTrue(tokens > 0, "tokens must be greater than zero");
this.tokens = tokens;
return this;
| 602 | 39 | 641 | |
ainilili_ratel | ratel/landlords-common/src/main/java/org/nico/ratel/landlords/transfer/TransferProtocolUtils.java | TransferProtocolUtils | unserialize | class TransferProtocolUtils {
/**
* A protocol header that represents the beginning of an available stream of data
*/
public static final byte PROTOCOL_HAED = "#".getBytes()[0];
/**
* The end of the protocol used to represent the end of an available stream of data
*/
public static final byte PROTOCOL_TAI... |
ByteKit bk = new ByteKit(bytes);
int start = -1;
int end = -1;
int index = bk.indexOf(PROTOCOL_HAED, 0);
if (index != -1) start = index + 1;
index = bk.indexOf(PROTOCOL_TAIL, 0);
if (index != -1) end = index;
if (start != -1 && end != -1 && start > end) {
throw new LandlordException("Message form... | 289 | 205 | 494 | |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java | DefaultSingletonBeanRegistry | getSingleton | class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {
/**
* 一级缓存
*/
private Map<String, Object> singletonObjects = new HashMap<>();
/**
* 二级缓存
*/
private Map<String, Object> earlySingletonObjects = new HashMap<>();
/**
* 三级缓存
*/
private Map<String, ObjectFactory<?>> singlet... |
Object singletonObject = singletonObjects.get(beanName);
if (singletonObject == null) {
singletonObject = earlySingletonObjects.get(beanName);
if (singletonObject == null) {
ObjectFactory<?> singletonFactory = singletonFactories.get(beanName);
if (singletonFactory != null) {
singletonObject = si... | 456 | 167 | 623 | |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/aop/framework/CglibAopProxy.java | DynamicAdvisedInterceptor | intercept | class DynamicAdvisedInterceptor implements MethodInterceptor {
private final AdvisedSupport advised;
private DynamicAdvisedInterceptor(AdvisedSupport advised) {
this.advised = advised;
}
@Override
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwab... |
// 获取目标对象
Object target = advised.getTargetSource().getTarget();
Class<?> targetClass = target.getClass();
Object retVal = null;
List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass);
CglibMethodInvocation methodInvocation = new CglibMethodInvocation(proxy... | 101 | 176 | 277 | |
google_truth | truth/core/src/main/java/com/google/common/truth/OptionalIntSubject.java | OptionalIntSubject | hasValue | class OptionalIntSubject extends Subject {
private final OptionalInt actual;
OptionalIntSubject(
FailureMetadata failureMetadata,
@Nullable OptionalInt subject,
@Nullable String typeDescription) {
super(failureMetadata, subject, typeDescription);
this.actual = subject;
}
/** Fails if... |
if (actual == null) {
failWithActual("expected an optional with value", expected);
} else if (!actual.isPresent()) {
failWithoutActual(fact("expected to have value", expected), simpleFact("but was absent"));
} else {
checkNoNeedToDisplayBothValues("getAsInt()").that(actual.getAsInt()).isE... | 549 | 97 | 646 | /**
* An object that lets you perform checks on the value under test. For example, {@code Subject}contains {@link #isEqualTo(Object)} and {@link #isInstanceOf(Class)}, and {@link StringSubject}contains {@link StringSubject#startsWith startsWith(String)}. <p>To create a {@code Subject} instance, most users will c... |
javamelody_javamelody | javamelody/javamelody-core/src/main/java/net/bull/javamelody/SpringDataSourceFactoryBean.java | SpringDataSourceFactoryBean | createInstance | class SpringDataSourceFactoryBean extends AbstractFactoryBean<DataSource> {
private String targetName;
// exemple :
// <bean id="wrappedDataSource" class="net.bull.javamelody.SpringDataSourceFactoryBean">
// <property name="targetName" value="targetDataSource" />
// </bean>
//
// <bean id="targetDataSo... |
if (targetName == null) {
throw new IllegalStateException("targetName must not be null");
}
final BeanFactory beanFactory = getBeanFactory();
assert beanFactory != null;
final DataSource dataSource = beanFactory.getBean(targetName, DataSource.class);
JdbcWrapper.registerSpringDataSource(targetNam... | 289 | 164 | 453 | |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/factory/SecureHeadersProperties.java | SecureHeadersProperties | toString | class SecureHeadersProperties {
/**
* Xss-Protection header default.
*/
public static final String X_XSS_PROTECTION_HEADER_DEFAULT = "1 ; mode=block";
/**
* Strict transport security header default.
*/
public static final String STRICT_TRANSPORT_SECURITY_HEADER_DEFAULT = "max-age=631138519";
/**
* Fra... |
final StringBuffer sb = new StringBuffer("SecureHeadersProperties{");
sb.append("xssProtectionHeader='").append(xssProtectionHeader).append('\'');
sb.append(", strictTransportSecurity='").append(strictTransportSecurity).append('\'');
sb.append(", frameOptions='").append(frameOptions).append('\'');
sb.append(... | 1,111 | 258 | 1,369 | |
mapstruct_mapstruct | mapstruct/processor/src/main/java/org/mapstruct/ap/internal/model/BuilderFinisherMethodResolver.java | BuilderFinisherMethodResolver | getBuilderFinisherMethod | class BuilderFinisherMethodResolver {
private static final String DEFAULT_BUILD_METHOD_NAME = "build";
private static final Extractor<ExecutableElement, String> EXECUTABLE_ELEMENT_NAME_EXTRACTOR =
executableElement -> {
StringBuilder sb = new StringBuilder( executableElement.getSimpleName(... |
Collection<ExecutableElement> buildMethods = builderType.getBuildMethods();
if ( buildMethods.isEmpty() ) {
//If we reach this method this should never happen
return null;
}
BuilderGem builder = method.getOptions().getBeanMapping().getBuilder();
if ( bui... | 202 | 444 | 646 | |
joelittlejohn_jsonschema2pojo | jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jsonschema2Pojo.java | Jsonschema2Pojo | generate | class Jsonschema2Pojo {
/**
* Reads the contents of the given source and initiates schema generation.
*
* @param config
* the configuration options (including source and target paths,
* and other behavioural options) that will control code
* generation
... |
Annotator annotator = getAnnotator(config);
RuleFactory ruleFactory = createRuleFactory(config);
ruleFactory.setAnnotator(annotator);
ruleFactory.setGenerationConfig(config);
ruleFactory.setLogger(logger);
ruleFactory.setSchemaStore(new SchemaStore(createContentResolver... | 1,483 | 438 | 1,921 | |
jitsi_jitsi | jitsi/modules/service/desktop/src/main/java/net/java/sip/communicator/impl/osdependent/systemtray/awt/AWTSystemTray.java | AWTSystemTray | addTrayIcon | class AWTSystemTray
extends SystemTray
{
private final java.awt.SystemTray impl;
/**
* Creates a new instance of this class.
*/
public AWTSystemTray()
{
impl = java.awt.SystemTray.getSystemTray();
}
@Override
public void addTrayIcon(TrayIcon trayIcon)
throws I... |
try
{
impl.add(((AWTTrayIcon) trayIcon).getImpl());
}
catch (AWTException e)
{
throw new IllegalArgumentException(e);
}
| 253 | 54 | 307 | /**
* Base class for all wrappers of <tt>SystemTray</tt> implementations.
*/
public abstract class SystemTray {
private static final org.slf4j.Logger logger=org.slf4j.LoggerFactory.getLogger(SystemTray.class);
private static SystemTray systemTray;
private static final String DISABLED_TRAY_MODE="disabled";
/*... |
docker-java_docker-java | docker-java/docker-java-core/src/main/java/com/github/dockerjava/core/command/BuildImageResultCallback.java | BuildImageResultCallback | getImageId | class BuildImageResultCallback extends ResultCallbackTemplate<BuildImageResultCallback, BuildResponseItem> {
private static final Logger LOGGER = LoggerFactory.getLogger(BuildImageResultCallback.class);
private String imageId;
private String error;
@Override
public void onNext(BuildResponseItem ... |
if (imageId != null) {
return imageId;
}
if (error == null) {
throw new DockerClientException("Could not build image");
}
throw new DockerClientException("Could not build image: " + error);
| 393 | 69 | 462 | |
javamelody_javamelody | javamelody/javamelody-core/src/main/java/net/bull/javamelody/internal/model/CounterStorage.java | CounterOutputStream | deleteObsoleteCounterFiles | class CounterOutputStream extends OutputStream {
int dataLength;
private final OutputStream output;
CounterOutputStream(OutputStream output) {
super();
this.output = output;
}
@Override
public void write(int b) throws IOException {
output.write(b);
dataLength++;
}
@Override... |
final Calendar nowMinusOneYearAndADay = Calendar.getInstance();
nowMinusOneYearAndADay.add(Calendar.DAY_OF_YEAR, -getObsoleteStatsDays());
nowMinusOneYearAndADay.add(Calendar.DAY_OF_YEAR, -1);
// filtre pour ne garder que les fichiers d'extension .ser.gz et pour éviter d'instancier des File inutiles
lon... | 1,241 | 277 | 1,518 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.