proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/ConnectionMultiplexerSessionTask.java | ConnectionMultiplexerSessionTask | toString | class ConnectionMultiplexerSessionTask extends RemoteSessionTask {
private JID address;
public ConnectionMultiplexerSessionTask() {
}
protected ConnectionMultiplexerSessionTask(JID address, Operation operation) {
super(operation);
this.address = address;
}
Session getSession(... |
return super.toString() + " operation: " + operation + " address: " + address;
| 127 | 25 | 152 | <methods>public void <init>() ,public java.lang.Object getResult() ,public void readExternal(java.io.ObjectInput) throws java.io.IOException, java.lang.ClassNotFoundException,public void run() ,public void writeExternal(java.io.ObjectOutput) throws java.io.IOException<variables>private static final Logger Log,protected... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/DeliverRawTextTask.java | DeliverRawTextTask | writeExternal | class DeliverRawTextTask implements ClusterTask<Void> {
private static final Logger Log = LoggerFactory.getLogger(DeliverRawTextTask.class);
private SessionType sessionType;
private JID address;
private StreamID streamID;
private String text;
public DeliverRawTextTask() {
super();
... |
ExternalizableUtil.getInstance().writeSafeUTF(out, text);
ExternalizableUtil.getInstance().writeInt(out, sessionType.ordinal());
ExternalizableUtil.getInstance().writeBoolean(out, address != null);
if (address != null) {
ExternalizableUtil.getInstance().writeSerializable(out... | 871 | 145 | 1,016 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/DomainPair.java | DomainPair | equals | class DomainPair implements java.io.Serializable {
private final String local;
private final String remote;
private static final long serialVersionUID = 1L;
public DomainPair(String local, String remote) {
this.local = local;
this.remote = remote;
}
public String toString() {
... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DomainPair that = (DomainPair) o;
if (!local.equals(that.local)) return false;
return remote.equals(that.remote);
| 212 | 76 | 288 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/GetSessionsCountTask.java | GetSessionsCountTask | run | class GetSessionsCountTask implements ClusterTask<Integer> {
private Boolean authenticated;
private Integer count;
public GetSessionsCountTask() {
}
public GetSessionsCountTask(Boolean authenticated) {
this.authenticated = authenticated;
}
@Override
public Integer getResult() ... |
if (authenticated) {
// Get count of authenticated sessions
count = SessionManager.getInstance().getUserSessionsCount(true);
}
else {
// Get count of connected sessions (authenticated or not)
count = SessionManager.getInstance().getConnectionsCoun... | 200 | 79 | 279 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/IncomingServerSessionInfo.java | IncomingServerSessionInfo | toString | class IncomingServerSessionInfo implements Externalizable
{
private NodeID nodeID;
private Set<String> validatedDomains;
public IncomingServerSessionInfo() {
}
public NodeID getNodeID() {
return nodeID;
}
public Set<String> getValidatedDomains() {
return validatedDomains;
... |
return "IncomingServerSessionInfo{" +
"nodeID=" + nodeID +
", validatedDomains=" + validatedDomains +
'}';
| 335 | 45 | 380 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/IncomingServerSessionTask.java | IncomingServerSessionTask | run | class IncomingServerSessionTask extends RemoteSessionTask {
private StreamID streamID;
public IncomingServerSessionTask() {
super();
}
protected IncomingServerSessionTask(Operation operation, StreamID streamID) {
super(operation);
this.streamID = streamID;
}
Session ge... |
super.run();
switch (operation) {
case getLocalDomain:
result = ((IncomingServerSession) getSession()).getLocalDomain();
break;
case getAddress:
result = getSession().getAddress();
break;
case getAuth... | 269 | 131 | 400 | <methods>public void <init>() ,public java.lang.Object getResult() ,public void readExternal(java.io.ObjectInput) throws java.io.IOException, java.lang.ClassNotFoundException,public void run() ,public void writeExternal(java.io.ObjectOutput) throws java.io.IOException<variables>private static final Logger Log,protected... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/LocalComponentSession.java | LocalExternalComponent | processPacket | class LocalExternalComponent implements ComponentSession.ExternalComponent {
/**
* Keeps track of the IQ (get/set) packets that were sent from a given component's connection. This
* information will be used to ensure that the IQ reply will be sent to the same component's connection.
*... |
if (packet instanceof IQ) {
IQ iq = (IQ) packet;
if (iq.getType() == IQ.Type.result || iq.getType() == IQ.Type.error) {
// Check if this IQ reply belongs to a specific component and route
// reply to that specific component (if it exis... | 961 | 199 | 1,160 | <methods>public void <init>(java.lang.String, org.jivesoftware.openfire.Connection, org.jivesoftware.openfire.StreamID, java.util.Locale) ,public void close() ,public void deliverRawText(java.lang.String) ,public JID getAddress() ,public abstract List<Element> getAvailableStreamFeatures() ,public java.lang.String getCi... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/LocalServerSession.java | LocalServerSession | getConnection | class LocalServerSession extends LocalSession implements ServerSession {
/**
* The method that was used to authenticate this session. Null when the session is not authenticated.
*/
protected AuthenticationMethod authenticationMethod = null;
public LocalServerSession(String serverName, Connection... |
final Connection connection = super.getConnection();
// valid only as long as stream management for s2s is not implemented (OF-2425). Remove this override when it is.
assert connection != null; // Openfire does not implement stream management for s2s (OF-2425). Therefor, the connection cannot b... | 639 | 89 | 728 | <methods>public void <init>(java.lang.String, org.jivesoftware.openfire.Connection, org.jivesoftware.openfire.StreamID, java.util.Locale) ,public void close() ,public void deliverRawText(java.lang.String) ,public JID getAddress() ,public abstract List<Element> getAvailableStreamFeatures() ,public java.lang.String getCi... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/OutgoingServerSessionTask.java | OutgoingServerSessionTask | toString | class OutgoingServerSessionTask extends RemoteSessionTask {
protected DomainPair domainPair;
public OutgoingServerSessionTask() {
}
protected OutgoingServerSessionTask(DomainPair domainPair, Operation operation) {
super(operation);
this.domainPair = domainPair;
}
Session getSe... |
return super.toString() + " operation: " + operation + " domain pair: " + domainPair;
| 312 | 27 | 339 | <methods>public void <init>() ,public java.lang.Object getResult() ,public void readExternal(java.io.ObjectInput) throws java.io.IOException, java.lang.ClassNotFoundException,public void run() ,public void writeExternal(java.io.ObjectOutput) throws java.io.IOException<variables>private static final Logger Log,protected... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/ProcessPacketTask.java | ProcessPacketTask | getSession | class ProcessPacketTask implements ClusterTask<Void> {
private static final Logger Log = LoggerFactory.getLogger(ProcessPacketTask.class);
private SessionType sessionType;
private JID address;
private StreamID streamID;
private Packet packet;
public ProcessPacketTask() {
super();
}... |
if (sessionType == SessionType.client) {
return XMPPServer.getInstance().getRoutingTable().getClientRoute(address);
}
else if (sessionType == SessionType.component) {
return SessionManager.getInstance().getComponentSession(address.getDomain());
}
else if ... | 966 | 229 | 1,195 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/RemoteIncomingServerSession.java | RemoteIncomingServerSession | getAuthenticationMethod | class RemoteIncomingServerSession extends RemoteSession implements IncomingServerSession {
private String localDomain;
private AuthenticationMethod authenticationMethod;
private Collection<String> validatedDomains;
public RemoteIncomingServerSession(byte[] nodeID, StreamID streamID) {
super(no... |
if (authenticationMethod == null) {
ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.getAuthenticationMethod);
authenticationMethod = (AuthenticationMethod) doSynchronousClusterTask(task);
}
return authenticationMethod;
| 447 | 62 | 509 | <methods>public void <init>(byte[], JID) ,public void close() ,public void deliverRawText(java.lang.String) ,public JID getAddress() ,public java.lang.String getCipherSuiteName() ,public java.util.Date getCreationDate() ,public java.lang.String getHostAddress() throws java.net.UnknownHostException,public java.lang.Stri... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/RemoteOutgoingServerSession.java | RemoteOutgoingServerSession | getAuthenticationMethod | class RemoteOutgoingServerSession extends RemoteSession implements OutgoingServerSession {
private AuthenticationMethod authenticationMethod;
private final DomainPair pair;
public RemoteOutgoingServerSession(byte[] nodeID, DomainPair address) {
super(nodeID, new JID(null, address.getRemote(), null... |
if (authenticationMethod == null) {
ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.getAuthenticationMethod);
authenticationMethod = (AuthenticationMethod) doSynchronousClusterTask(task);
}
return authenticationMethod;
| 995 | 62 | 1,057 | <methods>public void <init>(byte[], JID) ,public void close() ,public void deliverRawText(java.lang.String) ,public JID getAddress() ,public java.lang.String getCipherSuiteName() ,public java.util.Date getCreationDate() ,public java.lang.String getHostAddress() throws java.net.UnknownHostException,public java.lang.Stri... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/RemoteSession.java | RemoteSession | doClusterTask | class RemoteSession implements Session {
protected byte[] nodeID;
protected JID address;
// Cache content that never changes
protected StreamID streamID;
private Date creationDate;
private String serverName;
private String hostAddress;
private String hostName;
public RemoteSession... |
ClusterNodeInfo info = CacheFactory.getClusterNodeInfo(nodeID);
if (info == null && task instanceof RemoteSessionTask) { // clean up invalid session
Session remoteSession = ((RemoteSessionTask)task).getSession();
if (remoteSession instanceof ClientSession) {
Sess... | 1,785 | 116 | 1,901 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/RemoteSessionTask.java | RemoteSessionTask | writeExternal | class RemoteSessionTask implements ClusterTask<Object> {
private static final Logger Log = LoggerFactory.getLogger(RemoteSessionTask.class);
protected Object result;
protected Operation operation;
public RemoteSessionTask() {
}
protected RemoteSessionTask(Operation operation) {
this.o... |
ExternalizableUtil.getInstance().writeBoolean(out, operation != null);
if (operation != null) {
ExternalizableUtil.getInstance().writeInt(out, operation.ordinal());
}
| 1,567 | 54 | 1,621 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/SoftwareServerVersionManager.java | SoftwareServerVersionManager | sessionCreated | class SoftwareServerVersionManager extends BasicModule implements ServerSessionEventListener {
private static final Logger Log = LoggerFactory.getLogger(SoftwareServerVersionManager.class);
public SoftwareServerVersionManager() {
super("Software Server Version Manager");
}
@Override
public... |
try {
IQ versionRequest = new IQ(IQ.Type.get);
versionRequest.setTo(session.getAddress());
versionRequest.setFrom(session.getServerName());
versionRequest.setChildElement("query", "jabber:iq:version");
session.process(versionRequest);
} catch ... | 189 | 116 | 305 | <methods>public void <init>(java.lang.String) ,public void destroy() ,public java.lang.String getName() ,public void initialize(org.jivesoftware.openfire.XMPPServer) ,public void start() throws java.lang.IllegalStateException,public void stop() <variables>private java.lang.String name |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/session/SoftwareVersionManager.java | SoftwareVersionManager | resourceBound | class SoftwareVersionManager extends BasicModule implements SessionEventListener {
private static final Logger Log = LoggerFactory.getLogger(SoftwareVersionManager.class);
public static final SystemProperty<Boolean> VERSION_QUERY_ENABLED = SystemProperty.Builder.ofType( Boolean.class )
.setKey("xmpp.cl... |
if (!VERSION_QUERY_ENABLED.getValue()) {
return;
}
// Prevent retaining a reference to the session object, while waiting for the right time to execute the query.
// There's (unproven) concern that this is a factor in issue OF-2367. Better safe than sorry.
final JID ... | 414 | 388 | 802 | <methods>public void <init>(java.lang.String) ,public void destroy() ,public java.lang.String getName() ,public void initialize(org.jivesoftware.openfire.XMPPServer) ,public void start() throws java.lang.IllegalStateException,public void stop() <variables>private java.lang.String name |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/spi/BasicStreamIDFactory.java | BasicStreamID | getCachedSize | class BasicStreamID implements StreamID, Cacheable {
String id;
public BasicStreamID(String id) {
if ( id == null || id.isEmpty() ) {
throw new IllegalArgumentException( "Argument 'id' cannot be null." );
}
this.id = StringEscapeUtils.escapeXml10( id ... |
// Approximate the size of the object in bytes by calculating the size of each field.
int size = 0;
size += CacheSizes.sizeOfObject(); // overhead of object
size += CacheSizes.sizeOfString(id); // id
return size;
| 257 | 69 | 326 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/spi/ClientRoute.java | ClientRoute | readExternal | class ClientRoute implements Cacheable, Externalizable {
private NodeID nodeID;
private boolean available;
public ClientRoute() {
}
public NodeID getNodeID() {
return nodeID;
}
public void setNodeID( final NodeID nodeID )
{
this.nodeID = nodeID;
}
public boo... |
byte[] bytes = ExternalizableUtil.getInstance().readByteArray(in);
// Retrieve the NodeID but try to use the singleton instance
if (XMPPServer.getInstance().getNodeID().equals(bytes)) {
nodeID = XMPPServer.getInstance().getNodeID();
}
else {
nodeID = Node... | 395 | 112 | 507 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/spi/LocalRoutingTable.java | LocalRoutingTable | addRoute | class LocalRoutingTable {
private static final Logger Log = LoggerFactory.getLogger(LocalRoutingTable.class);
Map<DomainPair, RoutableChannelHandler> routes = new ConcurrentHashMap<>();
/**
* Adds a route of a local {@link RoutableChannelHandler}
*
* @param pair DomainPair associated t... |
final boolean result = routes.put(pair, route) != route;
Log.trace( "Route '{}' (for pair: '{}') {}", route.getAddress(), pair, result ? "added" : "not added (was already present)." );
return result;
| 1,448 | 69 | 1,517 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/spi/NettyServerInitializer.java | NettyServerInitializer | initChannel | class NettyServerInitializer extends ChannelInitializer<SocketChannel> {
private static final Logger Log = LoggerFactory.getLogger(NettyServerInitializer.class);
/**
* Controls the write timeout time in seconds to handle stalled sessions and prevent DoS
*/
public static final SystemProperty<Dura... |
boolean isClientConnection = configuration.getType() == ConnectionType.SOCKET_C2S;
NettyConnectionHandler businessLogicHandler = NettyConnectionHandlerFactory.createConnectionHandler(configuration);
Duration maxIdleTimeBeforeClosing = businessLogicHandler.getMaxIdleTime().isNegative() ? Durat... | 399 | 435 | 834 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/spi/PacketDelivererImpl.java | PacketDelivererImpl | deliver | class PacketDelivererImpl extends BasicModule implements PacketDeliverer {
/**
* The handler that does the actual delivery (could be a channel instead)
*/
protected SocketPacketWriteHandler deliverHandler;
public PacketDelivererImpl() {
super("Packet Delivery");
}
@Override
... |
if (packet == null) {
throw new PacketException("Packet was null");
}
if (deliverHandler == null) {
throw new PacketException("Could not send packet - no route" + packet.toString());
}
// Let the SocketPacketWriteHandler process the packet. SocketPacketWr... | 195 | 115 | 310 | <methods>public void <init>(java.lang.String) ,public void destroy() ,public java.lang.String getName() ,public void initialize(org.jivesoftware.openfire.XMPPServer) ,public void start() throws java.lang.IllegalStateException,public void stop() <variables>private java.lang.String name |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/spi/PacketRouterImpl.java | PacketRouterImpl | route | class PacketRouterImpl extends BasicModule implements PacketRouter {
private IQRouter iqRouter;
private PresenceRouter presenceRouter;
private MessageRouter messageRouter;
/**
* Constructs a packet router.
*/
public PacketRouterImpl() {
super("XMPP Packet Router");
}
/**... |
if (packet instanceof Message) {
route((Message)packet);
}
else if (packet instanceof Presence) {
route((Presence)packet);
}
else if (packet instanceof IQ) {
route((IQ)packet);
}
else {
throw new IllegalArgumentExce... | 372 | 89 | 461 | <methods>public void <init>(java.lang.String) ,public void destroy() ,public java.lang.String getName() ,public void initialize(org.jivesoftware.openfire.XMPPServer) ,public void start() throws java.lang.IllegalStateException,public void stop() <variables>private java.lang.String name |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/spi/PacketTransporterImpl.java | PacketTransporterImpl | deliver | class PacketTransporterImpl extends BasicModule {
private static final Logger Log = LoggerFactory.getLogger(PacketTransporterImpl.class);
/**
* The handler that does the actual delivery (could be a channel instead)
*/
private TransportHandler transportHandler;
/**
* deliverer for xmpp... |
if (packet == null) {
throw new NullPointerException();
}
if (xmppServer != null && xmppServer.isLocal(packet.getTo())) {
deliverer.deliver(packet);
}
else if (transportHandler != null) {
transportHandler.process(packet);
}
el... | 505 | 123 | 628 | <methods>public void <init>(java.lang.String) ,public void destroy() ,public java.lang.String getName() ,public void initialize(org.jivesoftware.openfire.XMPPServer) ,public void start() throws java.lang.IllegalStateException,public void stop() <variables>private java.lang.String name |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/spi/XMPPServerInfoImpl.java | XMPPServerInfoImpl | getHostname | class XMPPServerInfoImpl implements XMPPServerInfo {
private static final Logger Log = LoggerFactory.getLogger( XMPPServerInfoImpl.class );
private final Date startDate;
public static final Version VERSION = new Version(4, 9, 0, Version.ReleaseStatus.Alpha, -1 );
/**
* Simple constructor
*... |
final String fqdn = JiveGlobals.getXMLProperty( "fqdn" );
if ( fqdn != null && !fqdn.trim().isEmpty() )
{
return fqdn.trim().toLowerCase();
}
try
{
return InetAddress.getLocalHost().getCanonicalHostName().toLowerCase();
}
catch (U... | 383 | 136 | 519 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/stanzaid/StanzaIDUtil.java | StanzaIDUtil | ensureUniqueAndStableStanzaID | class StanzaIDUtil
{
private static final Logger Log = LoggerFactory.getLogger( StanzaIDUtil.class );
/**
* Modifies the stanza that's passed as a packet by adding a Stanza ID on behalf of what is assumed to be a local
* entity.
*
* @param packet The inbound packet (cannot be null).
* ... |
if ( !JiveGlobals.getBooleanProperty( "xmpp.sid.enabled", true ) )
{
return packet;
}
if ( packet instanceof IQ && !JiveGlobals.getBooleanProperty( "xmpp.sid.iq.enabled", false ) )
{
return packet;
}
if ( packet instanceof Message && !Ji... | 598 | 677 | 1,275 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/stats/StatisticsManager.java | StatisticsManager | addMultiStatistic | class StatisticsManager {
private static StatisticsManager instance = new StatisticsManager();
public static StatisticsManager getInstance() {
return instance;
}
private final Map<String, Statistic> statistics = new ConcurrentHashMap<>();
private final Map<String, List<String>> multiStatG... |
addStatistic(statKey, statistic);
List<String> group = multiStatGroups.get(groupName);
if(group == null) {
group = new ArrayList<>();
multiStatGroups.put(groupName, group);
}
group.add(statKey);
keyToGroupMap.put(statKey, groupName);
| 511 | 89 | 600 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/stats/i18nStatistic.java | i18nStatistic | retrieveValue | class i18nStatistic implements Statistic {
private String resourceKey;
private String pluginName;
private Type statisticType;
public i18nStatistic(String resourceKey, Statistic.Type statisticType) {
this(resourceKey, null, statisticType);
}
public i18nStatistic(String resourceKey, Str... |
String wholeKey = "stat." + resourceKey + "." + key;
if (pluginName != null) {
return LocaleUtils.getLocalizedString(wholeKey, pluginName);
}
else {
return LocaleUtils.getLocalizedString(wholeKey);
}
| 266 | 75 | 341 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/transport/TransportHandler.java | TransportHandler | process | class TransportHandler extends BasicModule implements ChannelHandler {
private static final Logger Log = LoggerFactory.getLogger(TransportHandler.class);
private Map<String, Channel<Packet>> transports = new ConcurrentHashMap<>();
private PacketDeliverer deliverer;
public TransportHandler() {
... |
boolean handled = false;
String host = packet.getTo().getDomain();
for (Channel<Packet> channel : transports.values()) {
if (channel.getName().equalsIgnoreCase(host)) {
channel.add(packet);
handled = true;
}
}
if (!handled)... | 203 | 202 | 405 | <methods>public void <init>(java.lang.String) ,public void destroy() ,public java.lang.String getName() ,public void initialize(org.jivesoftware.openfire.XMPPServer) ,public void start() throws java.lang.IllegalStateException,public void stop() <variables>private java.lang.String name |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/update/AvailablePlugin.java | AvailablePlugin | getInstance | class AvailablePlugin extends PluginMetadata
{
private static final Logger Log = LoggerFactory.getLogger( AvailablePlugin.class );
private static final DateFormat RELEASE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
private static final DateFormat RELEASE_DATE_DISPLAY_FORMAT = DateFormat.getDateInstanc... |
String pluginName = plugin.attributeValue("name");
Version latestVersion = null;
String latestVersionValue = plugin.attributeValue("latest");
if ( latestVersionValue != null && !latestVersionValue.isEmpty() )
{
latestVersion = new Version( latestVersionValue );
... | 509 | 1,111 | 1,620 | <methods>public void <init>(java.lang.String, java.lang.String, java.lang.String, org.jivesoftware.util.Version, java.lang.String, java.net.URL, java.net.URL, java.net.URL, java.lang.String, org.jivesoftware.util.Version, org.jivesoftware.util.Version, org.jivesoftware.util.JavaSpecVersion, boolean) ,public java.lang.S... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/update/PluginDownloadManager.java | PluginDownloadManager | installPlugin | class PluginDownloadManager {
private static final Logger Log = LoggerFactory.getLogger(PluginDownloadManager.class);
/**
* Starts the download process of a given plugin with it's URL.
*
* @param url the url of the plugin to download.
* @return the Update.
*/
public Update downloa... |
UpdateManager updateManager = XMPPServer.getInstance().getUpdateManager();
boolean worked = updateManager.downloadPlugin(url);
final DownloadStatus status = new DownloadStatus();
status.setHashCode(hashCode);
status.setVersion(version);
status.setSuccessfull(worked);
... | 543 | 93 | 636 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/user/AuthorizationBasedUserProviderMapper.java | AuthorizationBasedUserProviderMapper | getUserProvider | class AuthorizationBasedUserProviderMapper implements UserProviderMapper
{
/**
* Name of the property of which the value is expected to be the classname of the UserProvider which will serve the
* administrative users.
*/
public static final String PROPERTY_ADMINPROVIDER_CLASSNAME = "authorization... |
// TODO add optional caching, to prevent retrieving the administrative users upon every invocation.
final JID jid = XMPPServer.getInstance().createJID( username, null );
final boolean isAdmin = AdminManager.getAdminProvider().getAdmins().contains( jid );
if ( isAdmin )
{
... | 577 | 105 | 682 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/user/HybridUserProvider.java | HybridUserProvider | deleteUser | class HybridUserProvider extends UserMultiProvider
{
private static final Logger Log = LoggerFactory.getLogger( HybridUserProvider.class );
private final List<UserProvider> userProviders = new ArrayList<>();
public HybridUserProvider()
{
// Migrate user provider properties
JiveGlobals.... |
// all providers are read-only
if ( isReadOnly() )
{
throw new UnsupportedOperationException();
}
for ( final UserProvider provider : getUserProviders() )
{
if ( provider.isReadOnly() )
{
continue;
}
... | 1,782 | 88 | 1,870 | <methods>public non-sealed void <init>() ,public Collection<org.jivesoftware.openfire.user.User> findUsers(Set<java.lang.String>, java.lang.String) throws java.lang.UnsupportedOperationException,public Collection<org.jivesoftware.openfire.user.User> findUsers(Set<java.lang.String>, java.lang.String, int, int) throws ja... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/user/MappedUserProvider.java | MappedUserProvider | loadUser | class MappedUserProvider extends UserMultiProvider
{
/**
* Name of the property of which the value is expected to be the classname of the UserProviderMapper instance to be
* used by instances of this class.
*/
public static final String PROPERTY_MAPPER_CLASSNAME = "mappedUserProvider.mapper.class... |
final UserProvider userProvider;
try{
userProvider = getUserProvider( username );
} catch (RuntimeException e){
throw new UserNotFoundException("Unable to identify user provider for username "+username, e);
}
return userProvider.loadUser( username );
| 709 | 71 | 780 | <methods>public non-sealed void <init>() ,public Collection<org.jivesoftware.openfire.user.User> findUsers(Set<java.lang.String>, java.lang.String) throws java.lang.UnsupportedOperationException,public Collection<org.jivesoftware.openfire.user.User> findUsers(Set<java.lang.String>, java.lang.String, int, int) throws ja... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/user/PresenceEventDispatcher.java | PresenceEventDispatcher | addListener | class PresenceEventDispatcher {
private static final Logger Log = LoggerFactory.getLogger(PresenceEventDispatcher.class);
private static List<PresenceEventListener> listeners =
new CopyOnWriteArrayList<>();
/**
* Registers a listener to receive events.
*
* @param listener the li... |
if (listener == null) {
throw new NullPointerException();
}
listeners.add(listener);
| 1,149 | 33 | 1,182 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/user/PropertyBasedUserProviderMapper.java | PropertyBasedUserProviderMapper | getUserProvider | class PropertyBasedUserProviderMapper implements UserProviderMapper
{
protected final Map<String, UserProvider> providersByPrefix = new HashMap<>();
protected UserProvider fallbackProvider;
public PropertyBasedUserProviderMapper()
{
// Migrate properties.
JiveGlobals.migratePropertyTre... |
for ( final Map.Entry<String, UserProvider> entry : providersByPrefix.entrySet() )
{
final String usersProperty = JiveGlobals.getProperty( entry.getKey() + ".members.propertyName" );
if ( usersProperty != null )
{
final List<String> usersInSet = JiveG... | 411 | 146 | 557 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/user/UserCollection.java | UserIterator | next | class UserIterator implements Iterator<User> {
private int currentIndex = -1;
private User nextElement = null;
@Override
public boolean hasNext() {
// If we are at the end of the list, there can't be any more elements
// to iterate through.
if (curre... |
User element;
if (nextElement != null) {
element = nextElement;
nextElement = null;
}
else {
element = getNextElement();
if (element == null) {
throw new NoSuchElementException();
... | 392 | 77 | 469 | <methods>public boolean add(org.jivesoftware.openfire.user.User) ,public boolean addAll(Collection<? extends org.jivesoftware.openfire.user.User>) ,public void clear() ,public boolean contains(java.lang.Object) ,public boolean containsAll(Collection<?>) ,public boolean isEmpty() ,public abstract Iterator<org.jivesoftwa... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/user/UserNameManager.java | UserNameManager | getUserName | class UserNameManager {
private static XMPPServer server = XMPPServer.getInstance();
/**
* Map that keeps the UserNameProvider to use for each specific domain.
*/
private static Map<String, UserNameProvider> providersByDomain =
new ConcurrentHashMap<>();
private UserNameManager()... |
if (server.isLocal(entity)) {
// Contact is a local entity so search for his user name
User localUser = UserManager.getInstance().getUser(entity.getNode());
return !localUser.isNameVisible() || "".equals(localUser.getName()) ? entity.getNode() : localUser.getName();
... | 697 | 193 | 890 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/user/property/DefaultUserPropertyProvider.java | DefaultUserPropertyProvider | insertProperty | class DefaultUserPropertyProvider implements UserPropertyProvider
{
private static final Logger Log = LoggerFactory.getLogger( DefaultUserPropertyProvider.class );
private static final String LOAD_PROPERTIES = "SELECT name, propValue FROM ofUserProp WHERE username=?";
private static final String LOAD_PROPE... |
Connection con = null;
PreparedStatement pstmt = null;
try
{
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement( INSERT_PROPERTY );
pstmt.setString( 1, username );
pstmt.setString( 2, propName );
pstmt.setS... | 1,057 | 156 | 1,213 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/user/property/HybridUserPropertyProvider.java | HybridUserPropertyProvider | updateProperty | class HybridUserPropertyProvider implements UserPropertyProvider
{
private static final Logger Log = LoggerFactory.getLogger( HybridUserPropertyProvider.class );
private final List<UserPropertyProvider> providers = new ArrayList<>();
public HybridUserPropertyProvider()
{
// Migrate user provid... |
for ( final UserPropertyProvider provider : providers )
{
try
{
if ( provider.loadProperty( username, propName ) != null )
{
provider.updateProperty( username, propName, propValue );
return;
... | 1,762 | 203 | 1,965 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/user/property/JDBCUserPropertyProvider.java | JDBCUserPropertyProvider | loadProperty | class JDBCUserPropertyProvider implements UserPropertyProvider
{
private static final Logger Log = LoggerFactory.getLogger( JDBCUserPropertyProvider.class );
private String loadPropertySQL;
private String loadPropertiesSQL;
private String connectionString;
private boolean useConnectionProvider;
... |
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
// OF-1837: When the database does not hold escaped data, our query should use unescaped values in the 'where' clause.
final String queryValue = assumePersistedDataIsEscaped() ? username : JID.unescapeN... | 1,151 | 246 | 1,397 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/user/property/MappedUserPropertyProvider.java | MappedUserPropertyProvider | instantiate | class MappedUserPropertyProvider implements UserPropertyProvider
{
/**
* Name of the property of which the value is expected to be the classname of the UserPropertyProviderMapper
* instance to be used by instances of this class.
*/
public static final String PROPERTY_MAPPER_CLASSNAME = "mappedUse... |
final String className = JiveGlobals.getProperty( propertyName );
if ( className == null )
{
Log.debug( "Property '{}' is undefined. Skipping.", propertyName );
return null;
}
Log.debug( "About to to instantiate an UserPropertyProvider '{}' based on the v... | 962 | 206 | 1,168 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/vcard/DefaultVCardProvider.java | DefaultVCardProvider | createVCard | class DefaultVCardProvider implements VCardProvider {
private static final Logger Log = LoggerFactory.getLogger(DefaultVCardProvider.class);
private static final Interner<JID> userBaseMutex = Interners.newWeakInterner();
private static final String LOAD_PROPERTIES =
"SELECT vcard FROM ofVCard... |
if (loadVCard(username) != null) {
// The user already has a vCard
throw new AlreadyExistsException("Username " + username + " already has a vCard");
}
if ( JiveGlobals.getBooleanProperty( PhotoResizer.PROPERTY_RESIZE_ON_CREATE, PhotoResizer.PROPERTY_RESIZE_ON_CREATE_DE... | 1,112 | 271 | 1,383 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/vcard/PhotoResizer.java | PhotoResizer | cropAndShrink | class PhotoResizer
{
private static final Logger Log = LoggerFactory.getLogger( PhotoResizer.class );
// Property that, when 'true' causes avatars that are being loaded from backend storage to be resized, prior to be
// processed and send to entities.
public static final String PROPERTY_RESIZE_ON_LOAD ... |
Log.debug( "Original image size: {} bytes.", bytes.length );
BufferedImage avatar;
try ( final ByteArrayInputStream stream = new ByteArrayInputStream( bytes ) )
{
avatar = ImageIO.read( stream );
if ( avatar.getWidth() <= targetDimension && avatar.getHeight() <... | 858 | 922 | 1,780 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/vcard/VCardEventDispatcher.java | VCardEventDispatcher | dispatchVCardCreated | class VCardEventDispatcher {
private static final Logger Log = LoggerFactory.getLogger(VCardEventDispatcher.class);
/**
* List of listeners that will be notified when vCards are created, updated or deleted.
*/
private static List<VCardListener> listeners = new CopyOnWriteArrayList<>();
/**
... |
for (VCardListener listener : listeners) {
try {
listener.vCardCreated(user, vCard);
} catch (Exception e) {
Log.warn("An exception occurred while dispatching a 'vCardCreated' event!", e);
}
}
| 598 | 70 | 668 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/websocket/OpenfireWebSocketServlet.java | OpenfireWebSocketServlet | configure | class OpenfireWebSocketServlet extends JettyWebSocketServlet {
private static final long serialVersionUID = 1074354600476010708L;
private static final Logger Log = LoggerFactory.getLogger(OpenfireWebSocketServlet.class);
@Override
public void destroy()
{
// terminate any active websocket s... |
if (!WebSocketClientConnectionHandler.isCompressionEnabled()) {
factory.getAvailableExtensionNames().remove("permessage-deflate");
}
final int messageSize = JiveGlobals.getIntProperty("xmpp.parser.buffer.size", 1048576);
factory.setMaxTextMessageSize(messageSize);
/... | 665 | 446 | 1,111 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/websocket/StreamManagementPacketRouter.java | StreamManagementPacketRouter | route | class StreamManagementPacketRouter extends SessionPacketRouter {
public static final String SM_UNSOLICITED_ACK_FREQUENCY = "stream.management.unsolicitedAckFrequency";
static {
JiveGlobals.migrateProperty(SM_UNSOLICITED_ACK_FREQUENCY);
}
private int unsolicitedAckFrequency = JiveGlobals.getInt... |
if (StreamManager.NAMESPACE_V3.equals(wrappedElement.getNamespace().getStringValue())) {
session.getStreamManager().process(wrappedElement);
} else if (CsiManager.isStreamManagementNonza(wrappedElement)) {
session.getCsiManager().process(wrappedElement);
} else {
... | 267 | 130 | 397 | <methods>public void <init>(org.jivesoftware.openfire.session.LocalClientSession) ,public static boolean isInvalidStanzaSentPriorToResourceBinding(Packet, org.jivesoftware.openfire.session.ClientSession) ,public void route(Element) throws org.jivesoftware.openfire.multiplex.UnknownStanzaException,public void route(Pack... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/websocket/WebSocketClientConnectionHandler.java | XmppSessionIdleTask | run | class XmppSessionIdleTask extends TimerTask {
private Instant pendingPingSentAt = null;
@Override
public void run()
{<FILL_FUNCTION_BODY>}
private void sendPing()
{
// Ping the connection to see if it is alive.
final JID entity = wsConnection.get... |
if (!isWebSocketOpen() || getMaxIdleTime().isNegative() || getMaxIdleTime().isZero()) {
TaskEngine.getInstance().cancelScheduledTask(websocketFramePingTask);
TaskEngine.getInstance().cancelScheduledTask(xmppSessionIdleTask);
return;
}
... | 445 | 432 | 877 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/websocket/WebSocketClientStanzaHandler.java | WebSocketClientStanzaHandler | createSession | class WebSocketClientStanzaHandler extends ClientStanzaHandler
{
private static final Logger Log = LoggerFactory.getLogger(WebSocketClientStanzaHandler.class);
public static final String STREAM_HEADER = "open";
public static final String STREAM_FOOTER = "close";
public static final String FRAMING_NAM... |
for (int eventType = xpp.getEventType(); eventType != XmlPullParser.START_TAG;) {
eventType = xpp.next();
}
final String serverName = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
String host = xpp.getAttributeValue("", "to");
try {
// Check... | 1,463 | 505 | 1,968 | <methods>public void <init>(org.jivesoftware.openfire.PacketRouter, org.jivesoftware.openfire.Connection) <variables>private static final Logger Log |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/websocket/WebSocketConnection.java | WebSocketConnection | getConfiguration | class WebSocketConnection extends VirtualConnection
{
private static final Logger Log = LoggerFactory.getLogger(WebSocketConnection.class);
private InetSocketAddress remotePeer;
private WebSocketClientConnectionHandler socket;
private PacketDeliverer backupDeliverer;
private ConnectionConfiguration... |
if (configuration == null) {
final ConnectionManager connectionManager = XMPPServer.getInstance().getConnectionManager();
configuration = connectionManager.getListener( connectionType, true ).generateConnectionConfiguration();
}
return configuration;
| 1,555 | 58 | 1,613 | <methods>public non-sealed void <init>() ,public void addCompression() ,public void close(StreamError, boolean) ,public abstract void closeVirtualConnection(StreamError) ,public java.security.cert.Certificate[] getLocalCertificates() ,public org.jivesoftware.openfire.PacketDeliverer getPacketDeliverer() ,public java.se... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/openfire/websocket/XMPPPPacketReaderFactory.java | XMPPPPacketReaderFactory | create | class XMPPPPacketReaderFactory extends BasePooledObjectFactory<XMPPPacketReader> {
private static Logger Log = LoggerFactory.getLogger( XMPPPPacketReaderFactory.class );
private static XmlPullParserFactory xppFactory = null;
static {
try {
xppFactory = XmlPullParserFactory.newInstance(... |
XMPPPacketReader parser = new XMPPPacketReader();
parser.setXPPFactory( xppFactory );
return parser;
| 359 | 39 | 398 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/AesEncryptor.java | AesEncryptor | editKey | class AesEncryptor implements Encryptor {
private static final Logger log = LoggerFactory.getLogger(AesEncryptor.class);
private static final String ALGORITHM = "AES/CBC/PKCS7Padding";
private static final byte[] INIT_PARM =
{
(byte)0xcd, (byte)0x91, (byte)0xa7, (byte)0xc5,
(byte)0x27,... |
if (key == null) { return null; }
byte [] result = new byte [DEFAULT_KEY.length];
for (int x=0; x<DEFAULT_KEY.length; x++)
{
result[x] = x < key.length ? key[x] : DEFAULT_KEY[x];
}
return result;
| 1,562 | 86 | 1,648 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/AutoCloseableReentrantLock.java | AutoCloseableReentrantLock | close | class AutoCloseableReentrantLock {
// This is a WeakHashMap - when there are no references to the key, the entry will be removed
private static final Map<String, ReentrantLock> LOCK_MAP = Collections.synchronizedMap(new WeakHashMap<>());
private final ReentrantLock lock;
private final AutoCloseableLock... |
lock.unlock();
// Clear the reference to the key so the GC can remove the entry from the WeakHashMap if no-one else has it
if (!lock.isHeldByCurrentThread()) {
key = null;
}
| 1,064 | 61 | 1,125 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/ByteFormat.java | ByteFormat | format | class ByteFormat extends Format {
/**
* Formats a long which represent a number of bytes.
* @param bytes the number of bytes to format
* @return the formatted string
*/
public String format(long bytes) {
return super.format(bytes);
}
/**
* Formats a long which represen... |
if (obj instanceof Long) {
long numBytes = (Long) obj;
if (numBytes < 1024 * 1024) {
DecimalFormat formatter = new DecimalFormat("#,##0.0");
buf.append(formatter.format((double)numBytes / 1024.0)).append(" K");
}
else {
... | 349 | 163 | 512 | <methods>public java.lang.Object clone() ,public final java.lang.String format(java.lang.Object) ,public abstract java.lang.StringBuffer format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition) ,public java.text.AttributedCharacterIterator formatToCharacterIterator(java.lang.Object) ,public java.lang.O... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/CacheableOptional.java | CacheableOptional | getCachedSize | class CacheableOptional<T extends Serializable> implements Cacheable {
private final T value;
private CacheableOptional(T value) {
this.value = value;
}
public static <T extends Serializable> CacheableOptional<T> of(final T value) {
return new CacheableOptional<>(value);
}
@S... |
final int sizeOfValue = CacheSizes.sizeOfAnything(value);
if (value == null) {
// 94 bytes seems to be the overhead of a CacheableOptional representing absent value
return 94 + sizeOfValue;
} else {
// 72 bytes seems to be the overhead of a CacheableOptional<... | 442 | 120 | 562 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/ClassUtils.java | ClassUtils | loadClass | class ClassUtils {
private static ClassUtils instance = new ClassUtils();
/**
* Loads the class with the specified name.
*
* @param className the name of the class
* @return the resulting <code>Class</code> object
* @throws ClassNotFoundException if the class was not found
*/
... |
Class theClass = null;
try {
theClass = Class.forName(className);
}
catch (ClassNotFoundException e1) {
try {
theClass = Thread.currentThread().getContextClassLoader().loadClass(className);
}
catch (ClassNotFoundException e... | 353 | 108 | 461 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/CollectionUtils.java | CollectionUtils | distinctByKey | class CollectionUtils
{
/**
* Returns a stateful stream filter that, once applied to a stream, returns a stream consisting
* of the distinct elements (according to the specified key).
* <p>
* The implementation of {@link Stream#distinct()} can be used to return a stream that has distinct
* ... |
final Map<Object, Boolean> seen = new ConcurrentHashMap<>();
return t -> seen.putIfAbsent( keyExtractor.apply( t ), Boolean.TRUE ) == null;
| 484 | 49 | 533 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/CookieUtils.java | CookieUtils | setCookie | class CookieUtils {
/**
* Returns the specified cookie, or {@code null} if the cookie
* does not exist. Note: because of the way that cookies are implemented
* it's possible for multiple cookies with the same name to exist (but with
* different domain values). This method will return the first ... |
// Check to make sure the new value is not null (appservers like Tomcat
// 4 blow up if the value is null).
if (value == null) {
value = "";
}
String path = request.getContextPath() == null ? "/" : request.getContextPath();
if ("".equals(path)) {
... | 1,006 | 152 | 1,158 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/FastDateFormat.java | Pair | compareTo | class Pair implements Comparable, java.io.Serializable {
private final Object mObj1;
private final Object mObj2;
public Pair(Object obj1, Object obj2) {
mObj1 = obj1;
mObj2 = obj2;
}
@Override
public int compareTo(Object obj) {<FILL_FUNCTION_BODY... |
if (this == obj) {
return 0;
}
Pair other = (Pair)obj;
Object a = mObj1;
Object b = other.mObj1;
firstTest: {
if (a == null) {
if (b != null) {
return 1;
... | 330 | 281 | 611 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/FaviconServlet.java | FaviconServlet | getImage | class FaviconServlet extends HttpServlet {
private static final Logger LOGGER = LoggerFactory.getLogger(FaviconServlet.class);
/**
* The content-type of the images to return.
*/
private static final String CONTENT_TYPE = "image/x-icon";
/**
* Bytes of the default favicon to return when ... |
final Set<URI> urls = new HashSet<>();
try {
// Using a builder to reduce the impact of using user-provided values to generate a URL request.
urls.add(new URIBuilder().setScheme("https").setHost(host).setPath("favicon.ico").build());
urls.add(new URIBuilder().setSch... | 1,434 | 466 | 1,900 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/GraphicsUtils.java | GraphicsUtils | isImage | class GraphicsUtils
{
private static final Logger Log = LoggerFactory.getLogger( GraphicsUtils.class );
/**
* Checks if the provided input stream represents an image.
*
* @param stream The data to be parsed. Cannot be null.
* @return true if the provided data is successfully identified as a... |
try
{
// This attempts to read the bytes as an image, returning null if it cannot parse the bytes as an image.
return null != ImageIO.read( stream );
}
catch ( IOException e )
{
Log.debug( "An exception occurred while determining if data repre... | 241 | 88 | 329 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/HTTPConnectionException.java | HTTPConnectionException | getMessage | class HTTPConnectionException extends Exception {
private int errorCode;
public HTTPConnectionException(int errorCode) {
super();
this.errorCode = errorCode;
}
public int getErrorCode() {
return errorCode;
}
@Override
public String getMessage() {<FILL_FUNCTION_BOD... |
if (errorCode == 400) {
return "400 Bad Request";
}
else if (errorCode == 401) {
return "401 Unauthorized";
}
else if (errorCode == 402) {
return "402 Payment Required";
}
else if (errorCode == 403) {
return "403 Fo... | 92 | 516 | 608 | <methods>public void <init>() ,public void <init>(java.lang.String) ,public void <init>(java.lang.Throwable) ,public void <init>(java.lang.String, java.lang.Throwable) <variables>static final long serialVersionUID |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/JavaSpecVersion.java | JavaSpecVersion | getVersionString | class JavaSpecVersion implements Comparable<JavaSpecVersion> {
private static final Pattern PATTERN_SINGLE = Pattern.compile( "(\\d+)");
private static final Pattern PATTERN_DOUBLE = Pattern.compile( "(\\d+)\\.(\\d+)");
/**
* The major number (ie 1.x).
*/
private final int major;
/**
... |
if ( major > 0 ) {
return major + "." + minor;
} else {
return String.valueOf( minor );
}
| 783 | 40 | 823 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/JiveBeanInfo.java | JiveBeanInfo | getBeanDescriptor | class JiveBeanInfo implements BeanInfo {
private static final Logger Log = LoggerFactory.getLogger(JiveBeanInfo.class);
private ResourceBundle bundle;
public JiveBeanInfo() {
//Get the locale that should be used, then load the resource bundle.
Locale currentLocale = JiveGlobals.getLocale(... |
BeanDescriptor descriptor = new BeanDescriptor(getBeanClass());
try {
// Attempt to load the displayName and shortDescription explicitly.
String displayName = bundle.getString("displayName");
if (displayName != null) {
descriptor.setDisplayName(displa... | 779 | 256 | 1,035 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/LinkedList.java | LinkedList | toString | class LinkedList<E> {
/**
* The root of the list keeps a reference to both the first and last
* elements of the list.
*/
private LinkedListNode<E> head;
/**
* Creates a new linked list.
*/
public LinkedList() {
head = new LinkedListNode<>();
}
/**
* Retur... |
LinkedListNode<E> node = head.next;
StringBuilder buf = new StringBuilder();
while (node != head) {
buf.append(node.toString()).append(", ");
node = node.next;
}
return buf.toString();
| 846 | 69 | 915 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/LinkedListNode.java | LinkedListNode | remove | class LinkedListNode<E> {
public LinkedListNode<E> previous;
public LinkedListNode<E> next;
public E object;
/**
* This class is further customized for the CoolServlets cache system. It
* maintains a timestamp of when a Cacheable object was first added to
* cache. Timestamps are stored ... |
previous.next = next;
next.previous = previous;
previous = next = null;
return this;
| 700 | 32 | 732 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/LocaleFilter.java | LocaleFilter | doFilter | class LocaleFilter implements Filter {
private ServletContext context;
@Override
public void init(FilterConfig config) throws ServletException {
this.context = config.getServletContext();
}
/**
* Ssets the locale context-wide based on a call to {@link JiveGlobals#getLocale()}.
*... |
final String pathInfo = ((HttpServletRequest)request).getPathInfo();
if (pathInfo == null) {
// Note, putting the locale in the application at this point is a little overkill
// (ie, every user who hits this filter will do this). Eventually, it might make
// sense t... | 160 | 422 | 582 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/Log.java | Log | setDebugEnabled | class Log {
private static final org.slf4j.Logger Logger = org.slf4j.LoggerFactory.getLogger(Log.class);
public static final SystemProperty<Boolean> DEBUG_ENABLED = SystemProperty.Builder.ofType(Boolean.class)
.setKey("log.debug.enabled")
.setDefaultValue(false)
.setDynamic(true)
... |
if (enabled && getRootLogLevel().isMoreSpecificThan(Level.DEBUG)) {
lastLogLevel = getRootLogLevel();
setLogLevel(Level.DEBUG);
} else if (!enabled && getRootLogLevel().isLessSpecificThan(Level.DEBUG)) {
setLogLevel(lastLogLevel != Level.DEBUG ? lastLogLevel : Level.... | 1,354 | 109 | 1,463 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/NamedThreadFactory.java | NamedThreadFactory | newThread | class NamedThreadFactory implements ThreadFactory
{
private final AtomicInteger threadNumber = new AtomicInteger(1);
private final String threadNamePrefix;
private final ThreadFactory delegate;
private final Boolean daemon;
private final Integer priority;
private final Long stackSize;
priva... |
final String name = threadNamePrefix + threadNumber.incrementAndGet();
final Thread thread;
if ( delegate != null )
{
thread = delegate.newThread( runnable );
thread.setName( name );
}
else
{
if ( stackSize != null )
... | 762 | 213 | 975 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/PropertyClusterEventTask.java | PropertyClusterEventTask | writeExternal | class PropertyClusterEventTask implements ClusterTask<Void> {
private Type event;
private String key;
private String value;
private boolean isEncrypted;
public static PropertyClusterEventTask createPutTask(String key, String value, boolean isEncrypted) {
PropertyClusterEventTask task = new ... |
ExternalizableUtil.getInstance().writeInt(out, event.ordinal());
ExternalizableUtil.getInstance().writeSafeUTF(out, key);
ExternalizableUtil.getInstance().writeBoolean(out, value != null);
if (value != null) {
ExternalizableUtil.getInstance().writeSafeUTF(out, value);
... | 496 | 106 | 602 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/PropertyEventDispatcher.java | PropertyEventDispatcher | addListener | class PropertyEventDispatcher {
private static final Logger Log = LoggerFactory.getLogger(PropertyEventDispatcher.class);
private static Set<PropertyEventListener> listeners =
new CopyOnWriteArraySet<>();
private PropertyEventDispatcher() {
// Not instantiable.
}
/**
* R... |
if (listener == null) {
throw new NullPointerException();
}
listeners.add(listener);
| 560 | 33 | 593 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/S2STestService.java | S2SInterceptor | interceptPacket | class S2SInterceptor implements PacketInterceptor {
private final StringBuilder xml = new StringBuilder();
private final IQ ping;
/**
* @param ping The IQ ping request that was used to initiate the test.
*/
public S2SInterceptor( IQ ping )
{
this.p... |
if (ping.getTo() == null || packet.getFrom() == null || packet.getTo() == null) {
return;
}
if (!processed
&& (ping.getTo().getDomain().equals(packet.getFrom().getDomain()) || ping.getTo().getDomain().equals(packet.getTo().getDomain()))) {
... | 209 | 262 | 471 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/SAXReaderUtil.java | ParserTask | call | class ParserTask implements Callable<Document>
{
private static final ThreadLocal<SAXReader> localSAXReader = ThreadLocal.withInitial(()-> {
try {
return constructNewReader();
} catch (SAXException e) {
Log.error("Unable to construct a new XML parser."... |
if (stream != null) {
return localSAXReader.get().read(stream);
} else if (reader != null) {
return localSAXReader.get().read(reader);
} else if (file != null) {
return localSAXReader.get().read(file);
} else {
... | 283 | 135 | 418 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/SimpleSSLSocketFactory.java | DummyTrustManager | isServerTrusted | class DummyTrustManager implements X509TrustManager {
public boolean isClientTrusted(X509Certificate[] cert) {
return true;
}
public boolean isServerTrusted(X509Certificate[] cert) {<FILL_FUNCTION_BODY>}
@Override
public void checkClientTrusted(java.security.cert.X... |
try {
cert[0].checkValidity();
return true;
}
catch (CertificateExpiredException e) {
return false;
}
catch (CertificateNotYetValidException e) {
return false;
}
| 216 | 66 | 282 | <methods>public void <init>() ,public java.net.Socket createSocket(java.net.Socket, java.io.InputStream, boolean) throws java.io.IOException,public abstract java.net.Socket createSocket(java.net.Socket, java.lang.String, int, boolean) throws java.io.IOException,public static javax.net.SocketFactory getDefault() ,public... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/SmsService.java | SmsTask | run | class SmsTask implements Runnable
{
private final ObjectPool<SMPPSession> sessionPool;
// Settings that apply to source of an SMS message.
private final TypeOfNumber sourceTon = JiveGlobals.getEnumProperty( "sms.smpp.source.ton", TypeOfNumber.class, TypeOfNumber.UNKNOWN );
private f... |
try
{
sendMessage();
}
catch ( Exception e )
{
Log.error( "An exception occurred while sending a SMS message (to '{}')", destinationAddress, e );
}
| 758 | 57 | 815 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/WebBean.java | WebBean | init | class WebBean {
public HttpSession session;
public HttpServletRequest request;
public HttpServletResponse response;
public ServletContext application;
public JspWriter out;
public void init(HttpServletRequest request, HttpServletResponse response,
HttpSession session, ServletContex... |
this.request = (HttpServletRequest)pageContext.getRequest();
this.response = (HttpServletResponse)pageContext.getResponse();
this.session = pageContext.getSession();
this.application = pageContext.getServletContext();
this.out = pageContext.getOut();
| 215 | 74 | 289 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/XMPPDateTimeFormat.java | XMPPDateTimeFormat | parseString | class XMPPDateTimeFormat {
/**
* Date/time format for use by SimpleDateFormat. The format conforms to
* <a href="http://www.xmpp.org/extensions/xep-0082.html">XEP-0082</a>, which defines
* a unified date/time format for XMPP.
*/
public static final String XMPP_DATETIME_FORMAT = "yyyy-MM-dd'T... |
Matcher xep82WoMillisMatcher = xep80DateTimeWoMillisPattern.matcher(dateString);
Matcher xep82Matcher = xep80DateTimePattern.matcher(dateString);
if (xep82WoMillisMatcher.matches() || xep82Matcher.matches()) {
String rfc822Date;
// Convert the ISO 8601 time zone string ... | 1,199 | 505 | 1,704 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/cache/CacheSizes.java | CacheSizes | sizeOfAnything | class CacheSizes {
/**
* Returns the size in bytes of a basic Object. This method should only
* be used for actual Object objects and not classes that extend Object.
*
* @return the size of an Object.
*/
public static int sizeOfObject() {
return 4;
}
/**
* Returns... |
// If the object is Cacheable, ask it its size.
if (object == null) {
return 0;
}
if (object instanceof Cacheable) {
return ((Cacheable)object).getCachedSize();
}
// Check for other common types of objects put into cache.
else if (object i... | 1,205 | 448 | 1,653 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/cache/ComponentCacheWrapper.java | ComponentCacheWrapper | clear | class ComponentCacheWrapper<K extends Serializable, V extends Serializable> extends CacheWrapper<K, V> {
public ComponentCacheWrapper(Cache<K, V> cache) {
super(cache);
}
@Override
public void clear() {<FILL_FUNCTION_BODY>}
} |
// no-op; we don't want to clear the components cache
| 77 | 20 | 97 | <methods>public java.lang.String addClusteredCacheEntryListener(ClusteredCacheEntryListener<K,V>, boolean, boolean) ,public void clear() ,public boolean containsKey(java.lang.Object) ,public boolean containsValue(java.lang.Object) ,public Set<Entry<K,V>> entrySet() ,public V get(java.lang.Object) ,public long getCacheH... |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/cache/ConsistencyMonitor.java | Task | run | class Task extends TimerTask
{
@Override
public void run()
{<FILL_FUNCTION_BODY>}
} |
final Instant start = Instant.now();
Log.debug("Starting new cache consistency check.");
final RoutingTableImpl routingTable = (RoutingTableImpl) XMPPServer.getInstance().getRoutingTable();
final SessionManager sessionManager = XMPPServer.getInstance().getSessionManager... | 38 | 971 | 1,009 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/cache/DefaultLocalCacheStrategy.java | DefaultLocalCacheStrategy | createCache | class DefaultLocalCacheStrategy implements CacheFactoryStrategy {
/**
* Keep track of the locks that are currently being used.
*/
private Map<CacheKey, LockAndCount> locks = new ConcurrentHashMap<>();
private Interner<CacheKey> interner = Interners.newWeakInterner();
public DefaultLocalCach... |
// Get cache configuration from system properties or default (hardcoded) values
long maxSize = CacheFactory.getMaxCacheSize(name);
long lifetime = CacheFactory.getMaxCacheLifetime(name);
// Create cache with located properties
return new DefaultCache(name, maxSize, lifetime);
... | 1,574 | 75 | 1,649 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/cache/ReverseLookupComputingCacheEntryListener.java | ReverseLookupComputingCacheEntryListener | entryRemoved | class ReverseLookupComputingCacheEntryListener<K, V> implements ClusteredCacheEntryListener<K, V>
{
private final Map<NodeID, Set<K>> reverseCacheRepresentation;
private final Function<V, Set<NodeID>> ownageDeducer;
public ReverseLookupComputingCacheEntryListener(@Nonnull final Map<NodeID, Set<K>> reverseC... |
final Iterator<Map.Entry<NodeID, Set<K>>> iter = reverseCacheRepresentation.entrySet().iterator();
while (iter.hasNext()) {
final Map.Entry<NodeID, Set<K>> existingEntry = iter.next();
existingEntry.getValue().remove(key);
if (existingEntry.getValue().isEmpty()) {
... | 947 | 100 | 1,047 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/cache/ReverseLookupUpdatingCacheEntryListener.java | ReverseLookupUpdatingCacheEntryListener | entryRemoved | class ReverseLookupUpdatingCacheEntryListener<K, V> implements ClusteredCacheEntryListener<K, V> {
private final ConcurrentMap<NodeID, Set<K>> reverseCacheRepresentation;
public ReverseLookupUpdatingCacheEntryListener(@Nonnull final ConcurrentMap<NodeID, Set<K>> reverseCacheRepresentation) {
this.rever... |
reverseCacheRepresentation.computeIfPresent(nodeID, (k, v) -> {
v.remove(key);
return v;
});
| 443 | 42 | 485 | <no_super_class> |
igniterealtime_Openfire | Openfire/xmppserver/src/main/java/org/jivesoftware/util/cert/CNCertificateIdentityMapping.java | CNCertificateIdentityMapping | mapIdentity | class CNCertificateIdentityMapping implements CertificateIdentityMapping {
private static Pattern cnPattern = Pattern.compile("(?i)(cn=)([^,]*)");
/**
* Maps certificate CommonName as identity credentials
*
* @param certificate the certificates to map
* @return A List of names.
*... |
String name = certificate.getSubjectDN().getName();
Matcher matcher = cnPattern.matcher(name);
// Create an array with the detected identities
List<String> names = new ArrayList<>();
while (matcher.find()) {
names.add(matcher.group(2));
}
ret... | 179 | 89 | 268 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/ArraySwap.java | ArraySwap | swap | class ArraySwap {
private OperateData[] operateDataArray;
private int start;
public int length;
public void swap(OperateData[] operateDataArray, int start, int length) {<FILL_FUNCTION_BODY>}
public OperateData get(int i) {
return this.operateDataArray[i + start];
}
} |
this.operateDataArray = operateDataArray;
this.start = start;
this.length = length;
| 95 | 32 | 127 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/DefaultExpressResourceLoader.java | DefaultExpressResourceLoader | loadExpress | class DefaultExpressResourceLoader implements IExpressResourceLoader {
@Override
public String loadExpress(String expressName) throws Exception {<FILL_FUNCTION_BODY>}
} |
expressName = expressName.replace('.', '/') + ".ql";
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(expressName);
if (inputStream == null) {
throw new QLException("不能找到表达式文件:" + expressName);
}
BufferedReader bufferedRead... | 47 | 176 | 223 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/DynamicParamsUtil.java | DynamicParamsUtil | maybeDynamicParams | class DynamicParamsUtil {
public static boolean supportDynamicParams = false;
private DynamicParamsUtil() {
throw new IllegalStateException("Utility class");
}
public static Object[] transferDynamicParams(InstructionSetContext context, ArraySwap list,
Class<?>[] declaredParamsClasses, ... |
//长度不一致,有可能
if (declaredParamsClasses.length != list.length) {
return true;
}
//长度一致的不定参数:不定参数的数组,只输入了一个参数并且为array,有可能
int length = list.length;
Object lastParam = list.get(length - 1).getObject(context);
return lastParam != null && !lastParam.getCla... | 687 | 112 | 799 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/ExportItem.java | ExportItem | toString | class ExportItem {
public static final String TYPE_ALIAS = "alias";
public static final String TYPE_DEF = "def";
public static final String TYPE_FUNCTION = "function";
public static final String TYPE_MACRO = "macro";
private String globeName;
String name;
/**
* def, alias
*/
p... |
return this.globeName + "[" + this.type + ":" + this.name + " " + this.desc + "]";
| 387 | 36 | 423 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/ExpressLoader.java | ExpressLoader | getExportInfo | class ExpressLoader {
private final ConcurrentHashMap<String, InstructionSet> expressInstructionSetCache = new ConcurrentHashMap<>();
final ExpressRunner expressRunner;
public ExpressLoader(ExpressRunner expressRunner) {
this.expressRunner = expressRunner;
}
public InstructionSet loadExpre... |
Map<String, ExportItem> result = new TreeMap<>();
for (InstructionSet instructionSet : expressInstructionSetCache.values()) {
String globeName = instructionSet.getGlobeName();
for (ExportItem exportItem : instructionSet.getExportDef()) {
exportItem.setGlobeName(g... | 565 | 181 | 746 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/ExpressRemoteCacheRunner.java | ExpressRemoteCacheRunner | execute | class ExpressRemoteCacheRunner {
public void loadCache(String expressName, String text) {
InstructionSet instructionSet;
try {
instructionSet = getExpressRunner().parseInstructionSet(text);
CacheObject cache = new CacheObject();
cache.setExpressName(expressName);
... |
try {
CacheObject cache = (CacheObject)this.getCache(name);
if (cache == null) {
throw new RuntimeException("未获取到缓存对象.");
}
ExpressRunner expressRunner = getExpressRunner();
return expressRunner.execute(cache.getInstructionSet(), conte... | 318 | 124 | 442 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/InstructionSetContext.java | InstructionSetContext | clear | class InstructionSetContext implements IExpressContext<String, Object> {
/**
* 没有知道数据类型的变量定义是否传递到最外层的Context
*/
private boolean isExpandToParent = true;
private IExpressContext<String, Object> parent = null;
private Map<String, Object> content;
/**
* 符号表
*/
private final Ma... |
isExpandToParent = true;
parent = null;
content = null;
expressLoader = null;
isSupportDynamicFieldName = false;
runner = null;
symbolTable.clear();
| 1,240 | 55 | 1,295 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/InstructionSetRunner.java | InstructionSetRunner | executeOuter | class InstructionSetRunner {
private InstructionSetRunner() {
throw new IllegalStateException("Utility class");
}
public static Object executeOuter(ExpressRunner runner, InstructionSet instructionSet, ExpressLoader loader,
IExpressContext<String, Object> iExpressContext, List<String> error... |
try {
OperateDataCacheManager.push(runner);
return execute(runner, instructionSet, loader, iExpressContext, errorList, isTrace, isCatchException,
true, isSupportDynamicFieldName,
timeoutMills != -1?
// 优先使用参数传入
... | 642 | 168 | 810 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/OperateData.java | OperateData | toJavaCode | class OperateData {
protected Object dataObject;
protected Class<?> type;
public OperateData(Object obj, Class<?> type) {
this.type = type;
this.dataObject = obj;
}
/**
* 给对象缓存接口使用
*
* @param obj
* @param type
*/
public void initial(Object obj, Class<?... |
if (!this.getClass().equals(OperateData.class)) {
throw new RuntimeException(this.getClass().getName() + "没有实现:toJavaCode()");
}
String result = "new " + OperateData.class.getName() + "(";
if (String.class.equals(this.type)) {
result = result + "\"" + this.dataOb... | 655 | 221 | 876 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/Operator.java | Operator | compareData | class Operator extends OperatorBase {
@Override
public OperateData executeInner(InstructionSetContext parent, ArraySwap list) throws Exception {
Object[] parameters = new Object[list.length];
for (int i = 0; i < list.length; i++) {
if (list.get(i) == null && QLExpressRunStrategy.isAv... |
if (op1 == op2) {
return 0;
}
int compareResult;
if (op1 instanceof String) {
compareResult = ((String)op1).compareTo(op2.toString());
} else if (op2 instanceof String) {
compareResult = op1.toString().compareTo((String)op2);
} else ... | 759 | 439 | 1,198 | <methods>public non-sealed void <init>() ,public com.ql.util.express.OperateData execute(com.ql.util.express.InstructionSetContext, com.ql.util.express.ArraySwap, List<java.lang.String>) throws java.lang.Exception,public abstract com.ql.util.express.OperateData executeInner(com.ql.util.express.InstructionSetContext, co... |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/QLambda.java | QLambda | call | class QLambda {
private final InstructionSet functionSet;
private final RunEnvironment environment;
private final List<String> errorList;
public QLambda(InstructionSet functionSet, RunEnvironment environment, List<String> errorList) {
this.functionSet = functionSet;
this.environment ... |
InstructionSetContext context = OperateDataCacheManager.fetchInstructionSetContext(
true, environment.getContext().getExpressRunner(), environment.getContext(),
environment.getContext().getExpressLoader(), environment.getContext().isSupportDynamicFieldName());
OperateDataLocalVa... | 274 | 251 | 525 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/QLambdaInvocationHandler.java | QLambdaInvocationHandler | invoke | class QLambdaInvocationHandler implements InvocationHandler {
private final QLambda qLambda;
public QLambdaInvocationHandler(QLambda qLambda) {
this.qLambda = qLambda;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {<FILL_FUNCTION_BODY>}
} |
return Modifier.isAbstract(method.getModifiers()) ? qLambda.call(args) :
// 为了应对 toString 方法
method.getReturnType() == String.class ? "QLambdaProxy" : null;
| 90 | 58 | 148 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/RunEnvironment.java | RunEnvironment | ensureCapacity | class RunEnvironment {
private static final int INIT_DATA_LENGTH = 15;
private boolean isTrace;
private int point = -1;
int programPoint = 0;
private OperateData[] dataContainer;
private final ArraySwap arraySwap = new ArraySwap();
private boolean isExit = false;
private Object returnVa... |
int oldCapacity = this.dataContainer.length;
if (minCapacity > oldCapacity) {
int newCapacity = (oldCapacity * 3) / 2 + 1;
if (newCapacity < minCapacity) {
newCapacity = minCapacity;
}
OperateData[] tempList = new OperateData[newCapacity];... | 1,132 | 133 | 1,265 | <no_super_class> |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/instruction/BlockInstructionFactory.java | BlockInstructionFactory | createInstruction | class BlockInstructionFactory extends InstructionFactory {
@Override
public boolean createInstruction(ExpressRunner expressRunner, InstructionSet result,
Stack<ForRelBreakContinue> forStack, ExpressNode node, boolean isRoot) throws Exception {<FILL_FUNCTION_BODY>}
} |
if (node.isTypeEqualsOrChild("STAT_SEMICOLON") && result.getCurrentPoint() >= 0 && !(result.getInstruction(
result.getCurrentPoint()) instanceof InstructionClearDataStack)) {
result.addInstruction(new InstructionClearDataStack().setLine(node.getLine()));
}
boolean needO... | 72 | 280 | 352 | <methods>public non-sealed void <init>() ,public abstract boolean createInstruction(com.ql.util.express.ExpressRunner, com.ql.util.express.InstructionSet, Stack<com.ql.util.express.instruction.ForRelBreakContinue>, com.ql.util.express.parse.ExpressNode, boolean) throws java.lang.Exception,public static com.ql.util.expr... |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/instruction/BreakInstructionFactory.java | BreakInstructionFactory | createInstruction | class BreakInstructionFactory extends InstructionFactory {
@Override
public boolean createInstruction(ExpressRunner expressRunner, InstructionSet result,
Stack<ForRelBreakContinue> forStack, ExpressNode node, boolean isRoot) {<FILL_FUNCTION_BODY>}
} |
InstructionGoTo breakInstruction = new InstructionGoTo(result.getCurrentPoint() + 1);
breakInstruction.setName("break");
forStack.peek().breakList.add(breakInstruction);
result.addInstruction(breakInstruction.setLine(node.getLine()));
return false;
| 70 | 81 | 151 | <methods>public non-sealed void <init>() ,public abstract boolean createInstruction(com.ql.util.express.ExpressRunner, com.ql.util.express.InstructionSet, Stack<com.ql.util.express.instruction.ForRelBreakContinue>, com.ql.util.express.parse.ExpressNode, boolean) throws java.lang.Exception,public static com.ql.util.expr... |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/instruction/CallFunctionInstructionFactory.java | CallFunctionInstructionFactory | createInstruction | class CallFunctionInstructionFactory extends InstructionFactory {
@Override
public boolean createInstruction(ExpressRunner expressRunner, InstructionSet result,
Stack<ForRelBreakContinue> forStack, ExpressNode node, boolean isRoot) throws Exception {<FILL_FUNCTION_BODY>}
} |
ExpressNode[] children = node.getChildrenArray();
String functionName = children[0].getValue();
boolean returnVal = false;
children = node.getChildrenArray();
for (int i = 1; i < children.length; i++) {
boolean tmpHas = expressRunner.createInstructionSetPrivate(resul... | 73 | 224 | 297 | <methods>public non-sealed void <init>() ,public abstract boolean createInstruction(com.ql.util.express.ExpressRunner, com.ql.util.express.InstructionSet, Stack<com.ql.util.express.instruction.ForRelBreakContinue>, com.ql.util.express.parse.ExpressNode, boolean) throws java.lang.Exception,public static com.ql.util.expr... |
alibaba_QLExpress | QLExpress/src/main/java/com/ql/util/express/instruction/CastInstructionFactory.java | CastInstructionFactory | createInstruction | class CastInstructionFactory extends InstructionFactory {
@Override
public boolean createInstruction(ExpressRunner expressRunner, InstructionSet result,
Stack<ForRelBreakContinue> forStack, ExpressNode node, boolean isRoot) throws Exception {<FILL_FUNCTION_BODY>}
} |
boolean returnVal = false;
OperatorBase op = expressRunner.getOperatorFactory().newInstance(node);
ExpressNode[] children = node.getChildrenArray();
if (children.length == 0) {
throw new QLException("扩展类型不存在");
} else if (children.length > 2) {
throw new ... | 72 | 252 | 324 | <methods>public non-sealed void <init>() ,public abstract boolean createInstruction(com.ql.util.express.ExpressRunner, com.ql.util.express.InstructionSet, Stack<com.ql.util.express.instruction.ForRelBreakContinue>, com.ql.util.express.parse.ExpressNode, boolean) throws java.lang.Exception,public static com.ql.util.expr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.