List of usage examples for org.apache.http.util Args notNull
public static <T> T notNull(T t, String str)
From source file:com.ok2c.lightmtp.impl.protocol.ServiceShutdownCodec.java
public ServiceShutdownCodec(final SMTPBuffers iobuffers) { super();//from w ww .j a va2s .c o m Args.notNull(iobuffers, "IO buffers"); this.iobuffers = iobuffers; this.writer = new SMTPReplyWriter(true); }
From source file:com.ok2c.lightmtp.util.InetAddressRangeParser.java
public InetAddressRange parse(final CharArrayBuffer buffer, final ParserCursor cursor, final char[] delimiters) throws ParseException, UnknownHostException { Args.notNull(buffer, "Char array buffer"); Args.notNull(cursor, "Parser cursor"); int pos = cursor.getPos(); int indexFrom = cursor.getPos(); int indexTo = cursor.getUpperBound(); while (pos < indexTo) { char ch = buffer.charAt(pos); if (ch == '/') { break; }/*from w w w. j ava2 s . co m*/ if (isOneOf(ch, delimiters)) { break; } pos++; } InetAddress address = InetAddress.getByName(buffer.substringTrimmed(indexFrom, pos)); int mask = 0; if (pos < indexTo && buffer.charAt(pos) == '/') { pos++; indexFrom = pos; while (pos < indexTo) { char ch = buffer.charAt(pos); if (isOneOf(ch, delimiters)) { break; } pos++; } try { mask = Integer.parseInt(buffer.substringTrimmed(indexFrom, pos)); if (mask < 0) { throw new ParseException("Negative range mask", indexFrom); } } catch (NumberFormatException ex) { throw new ParseException("Invalid range mask", indexFrom); } } cursor.updatePos(pos); return new InetAddressRange(address, mask); }
From source file:com.ok2c.lightmtp.impl.protocol.cmd.DefaultProtocolHandler.java
public void register(final String cmd, final CommandHandler<ServerState> handler) { Args.notNull(cmd, "Command name"); Args.notNull(handler, "Command handler"); this.map.put(cmd.toUpperCase(Locale.US), handler); }
From source file:org.archive.modules.fetcher.BasicExecutionAwareRequest.java
/** * Creates an instance of this class using the given request method * and URI.//from w ww . ja v a 2 s . co m * * @param method request method. * @param uri request URI. */ public BasicExecutionAwareRequest(final String method, final String uri) { super(); this.method = Args.notNull(method, "Method name"); this.uri = Args.notNull(uri, "Request URI"); this.requestline = null; }
From source file:org.fcrepo.client.RequestBuilder.java
/** * Instantiate builder. Throws an IllegalArgumentException if either the uri or client are null. * /* w ww . ja v a2s .co m*/ * @param uri uri of the resource this request is being made to * @param client the client */ protected RequestBuilder(final URI uri, final FcrepoClient client) { Args.notNull(uri, "uri"); Args.notNull(client, "client"); this.targetUri = uri; this.client = client; this.request = createRequest(); }
From source file:com.ok2c.lightmtp.agent.SessionEndpoint.java
public SessionEndpoint(final SocketAddress localAddress, final SocketAddress remoteAddress) { super();/*from w w w .j a v a2s .co m*/ Args.notNull(remoteAddress, "Remote address"); this.localAddress = localAddress; this.remoteAddress = remoteAddress; }
From source file:com.ok2c.lightmtp.SMTPReply.java
public SMTPReply(final int code, final SMTPCode enhancedCode, final String line) { super();/*from w ww.j ava 2 s. c o m*/ if (code <= 0) { throw new IllegalArgumentException("Code may not be nagtive or zero"); } Args.notNull(line, "Line"); this.code = code; this.enhancedCode = enhancedCode; List<String> lines = new ArrayList<String>(); lines.add(line); this.lines = Collections.unmodifiableList(new ArrayList<String>(lines)); }
From source file:com.ok2c.lightmtp.impl.protocol.ServerSession.java
public ServerSession(final IOSession iosession, final SMTPBuffers iobuffers, final ProtocolCodecs<ServerState> codecs) { super();/*from w ww . ja v a 2s. c om*/ Args.notNull(iosession, "IO session"); Args.notNull(iobuffers, "IO buffers"); Args.notNull(codecs, "Protocol codecs"); this.iosession = iosession; this.iobuffers = iobuffers; this.iosession.setBufferStatus(this.iobuffers); this.sessionState = new ServerState("LightMTP SMTP"); this.codecs = codecs; this.state = ProtocolState.INIT; }
From source file:com.microsoft.azure.keyvault.authentication.BearerCredentialsProvider.java
public BearerCredentialsProvider(BearerCredentialsSupport bearerSupport) { Args.notNull(bearerSupport, "bearerSupport"); this.bearerSupport = bearerSupport; }
From source file:com.ok2c.lightmtp.impl.protocol.ClientSessionFactory.java
public ClientSessionFactory(final DeliveryRequestHandler deliveryRequestHandler, final String heloName, final String username, final String password) { super();//from w w w . j a va2 s . co m Args.notNull(deliveryRequestHandler, "Delivery request handler"); this.deliveryRequestHandler = deliveryRequestHandler; this.heloName = heloName; this.username = username; this.password = password; }