Examples of MalformedRequestException


Examples of org.apache.hedwig.exceptions.PubSubException.MalformedRequestException

    public static void sendErrorResponseToMalformedRequest(Channel channel, long txnId, String msg) {
        if (logger.isDebugEnabled()) {
            logger.debug("Malformed request from " + channel.getRemoteAddress() + " msg, = " + msg);
        }
        MalformedRequestException mre = new MalformedRequestException(msg);
        PubSubResponse response = PubSubResponseUtils.getResponseForException(mre, txnId);
        channel.write(response);
    }
View Full Code Here

Examples of org.apache.hedwig.exceptions.PubSubException.MalformedRequestException

        channel.close();
    }

    public static void sendErrorResponseToMalformedRequest(Channel channel, long txnId, String msg) {
        logger.debug("Malformed request from {}, msg = {}", channel.getRemoteAddress(), msg);
        MalformedRequestException mre = new MalformedRequestException(msg);
        PubSubResponse response = PubSubResponseUtils.getResponseForException(mre, txnId);
        channel.write(response);
    }
View Full Code Here

Examples of org.apache.hedwig.exceptions.PubSubException.MalformedRequestException

    public static void sendErrorResponseToMalformedRequest(Channel channel, long txnId, String msg) {
        if (logger.isDebugEnabled()) {
            logger.debug("Malformed request from " + channel.getRemoteAddress() + " msg, = " + msg);
        }
        MalformedRequestException mre = new MalformedRequestException(msg);
        PubSubResponse response = PubSubResponseUtils.getResponseForException(mre, txnId);
        channel.write(response);
    }
View Full Code Here

Examples of org.bladerunnerjs.model.exception.request.MalformedRequestException

public class MalformedBundlerRequestExceptionTest {

  @Test
  public void testCreatingExceptionWithAllArgsProvided() throws Exception {
    try {
      MalformedRequestException ex = new MalformedRequestException("foo.bundle", "oops, there was a problem");
      ex.setCharacterNumber(4);
      throw ex;
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException when processing the request 'foo.bundle'.", exceptionLines[0] );
      assertEquals( "Invalid character at position 4: foo.bundle", exceptionLines[1] );
      assertEquals( "                                    ^", exceptionLines[2] );
      assertEquals( "oops, there was a problem", exceptionLines[3] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[4] );
View Full Code Here

Examples of org.bladerunnerjs.model.exception.request.MalformedRequestException

  }
 
  @Test
  public void testCreatingExceptionWithoutMessage() throws Exception {
    try {
      MalformedRequestException ex = new MalformedRequestException("foo.bundle", null);
      ex.setCharacterNumber(4);
      throw ex;
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException when processing the request 'foo.bundle'.", exceptionLines[0] );
      assertEquals( "Invalid character at position 4: foo.bundle", exceptionLines[1] );
      assertEquals( "                                    ^", exceptionLines[2] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[3] );
      assertTrue( exceptionLines[4].contains(getCurrentClassAndMethod()) );
View Full Code Here

Examples of org.bladerunnerjs.model.exception.request.MalformedRequestException

  }
 
  @Test
  public void testCreatingExceptionWithoutCharNumber() throws Exception {
    try {
      throw new MalformedRequestException("foo.bundle", "oops, there was a problem");
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException when processing the request 'foo.bundle'.", exceptionLines[0] );
      assertEquals( "oops, there was a problem", exceptionLines[1] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[2] );
View Full Code Here

Examples of org.bladerunnerjs.model.exception.request.MalformedRequestException

  }
 
  @Test
  public void testCreatingExceptionWithoutUrl() throws Exception {
    try {
      MalformedRequestException ex = new MalformedRequestException(null, "oops, there was a problem");
      ex.setCharacterNumber(4);
      throw ex;
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException.", exceptionLines[0] );
      assertEquals( "oops, there was a problem", exceptionLines[1] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[2] );
      assertTrue( exceptionLines[3].contains(getCurrentClassAndMethod()) );
    }
View Full Code Here

Examples of org.bladerunnerjs.model.exception.request.MalformedRequestException

  }
 
  @Test
  public void testCreatingExceptionWithOnlyAMessage() throws Exception {
    try {
      throw new MalformedRequestException(null, "oops, there was a problem");
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException.", exceptionLines[0] );
      assertEquals( "oops, there was a problem", exceptionLines[1] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[2] );
View Full Code Here

Examples of org.bladerunnerjs.model.exception.request.MalformedRequestException

  }
 
  @Test
  public void testCreatingExceptionWithoutUrlCharNumberOrMessage() throws Exception {
    try {
      throw new MalformedRequestException(null, null);
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException.", exceptionLines[0] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[1] );
    }   
View Full Code Here

Examples of org.bladerunnerjs.model.exception.request.MalformedRequestException

          lastMatchPos = requestLastMatchPos;
        }
      }
    }

    MalformedRequestException ex = new MalformedRequestException(request, "Request did not match " + requestFormPatterns);
    ex.setCharacterNumber(lastMatchPos + 1);
    throw ex;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.