Codota Logo
MalformedInputException.<init>
Code IndexAdd Codota to your IDE (free)

How to use
ro.polak.http.protocol.parser.MalformedInputException
constructor

Best Java code snippets using ro.polak.http.protocol.parser.MalformedInputException.<init> (Showing top 7 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: piotrpolak/android-http-server

  private Range getRange(final String[] values) throws MalformedInputException {
    try {
      return new Range(Long.parseLong(values[0].trim()), Long.parseLong(values[1].trim()));
    } catch (NumberFormatException e) {
      throw new MalformedInputException("Invalid range value, unable to parse numeric values " + e.getMessage());
    }
  }
}
origin: piotrpolak/android-http-server

/**
 * {@inheritDoc}
 */
@Override
public List<Range> parse(final String input) throws MalformedInputException {
  List<Range> rangeList = new ArrayList<>();
  String inputNormalized = input.toLowerCase().trim();
  if (!inputNormalized.startsWith(START_WORD)) {
    throw new MalformedInputException("Header value must start with bytes=");
  }
  String[] rangesString = inputNormalized.substring(START_WORD.length()).split(RANGES_SEPARATOR);
  for (String rangeString : rangesString) {
    if (rangeString.indexOf(RANGE_SEPARATOR) == -1) {
      throw new MalformedInputException("Invalid range value " + rangeString);
    }
    String[] values = rangeString.split(RANGE_SEPARATOR);
    if (values.length != 2) {
      throw new MalformedInputException("Invalid range value " + rangeString);
    }
    rangeList.add(getRange(values));
  }
  return rangeList;
}
origin: piotrpolak/android-http-server

int quotationMarkPosition = name.indexOf("\"");
if (quotationMarkPosition == -1) {
  throw new MalformedInputException("Malformed header, unable to detect value beginning");
} else {
  name = name.substring(0, quotationMarkPosition);
  throw new MalformedInputException("Malformed header, unable to detect value end");
} else {
  fileName = fileName.substring(0, quotationMark2Position);
origin: piotrpolak/android-http-server

throw new MalformedInputException("Input status string should be composed out of "
    + NUMBER_OF_CHUNKS + " chunks. Received " + input);
origin: piotrpolak/android-http-server

@Test(expected = ProtocolException.class)
public void shouldThrowProtocolExceptionOnMalformedHeaders() throws Exception {
  when(headersParser.parse(any(String.class))).thenThrow(new MalformedInputException("ANY"));
  factory.createFromSocket(socket);
}
origin: piotrpolak/android-http-server

@Test
public void shouldAssignNoCookieOnMalformedCookieString() throws Exception {
  headers.setHeader(Headers.HEADER_COOKIE, "ANYTHING");
  when(cookieParser.parse(any(String.class))).thenThrow(new MalformedInputException("ANY"));
  HttpServletRequestImpl request = factory.createFromSocket(socket);
  assertThat(request.getCookies().length, is(0));
  verify(cookieParser, times(1)).parse(any(String.class));
}
origin: piotrpolak/android-http-server

private void handlePostRequest(final HttpServletRequestImpl.Builder builder,
                final InputStream in,
                final Headers headers)
    throws IOException, MalformedInputException {
  int postLength;
  if (headers.containsHeader(Headers.HEADER_CONTENT_LENGTH)) {
    try {
      postLength = Integer.parseInt(headers.getHeader(Headers.HEADER_CONTENT_LENGTH));
    } catch (NumberFormatException e) {
      throw new MalformedInputException(e.getMessage());
    }
  } else {
    throw new LengthRequiredException();
  }
  // Only if post length is greater than 0
  // Keep 0 value - makes no sense to parse the data
  if (postLength < 1) {
    return;
  }
  if (postLength > POST_MAX_LENGTH) {
    throw new PayloadTooLargeProtocolException("Payload of " + postLength + "b exceeds the limit of "
        + POST_MAX_LENGTH + "b");
  }
  if (isMultipartRequest(headers)) {
    handlePostMultipartRequest(builder, headers, in, postLength);
  } else {
    handlePostPlainRequest(builder, in, postLength);
  }
}
ro.polak.http.protocol.parserMalformedInputException<init>

Popular methods of MalformedInputException

  • getMessage

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (Timer)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getContentResolver (Context)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • JFrame (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now