Package net.ex337.scriptus.exceptions

Examples of net.ex337.scriptus.exceptions.ScriptusRuntimeException


     
      AuthProvider provider;
        try {
            provider = manager.connect(paramsMap);
        } catch (Exception e) {
            throw new ScriptusRuntimeException(e);
        }

        String tokenKey = provider.getAccessGrant().getKey();
        String tokenSecret = provider.getAccessGrant().getSecret();
View Full Code Here


            req.getSession().setAttribute(SOCIAL_AUTH_MANAGER, manager);

            resp.sendRedirect(url);
           
        } catch (Exception e) {
            throw new ScriptusRuntimeException(e);
        }
       
  }
View Full Code Here

        }
        if(transport == TransportType.Dummy){
            return dummy.send(userId, to, msg);
        }
       
        throw new ScriptusRuntimeException("transport type not recognised "+transport);
       
    }
View Full Code Here

      Cipher cipher = Cipher.getInstance(cipherScheme);
      cipher.init(Cipher.ENCRYPT_MODE, key);
      byte[] result = cipher.doFinal(plaintext);
      return result;
    } catch (Exception e) {
      throw new ScriptusRuntimeException("Problem with cipher", e);
    }
  }
View Full Code Here

    try {
      Cipher cipher = Cipher.getInstance(cipherScheme);
      cipher.init(Cipher.DECRYPT_MODE, key);
      return cipher.doFinal(ciphertext);
    } catch (Exception e) {
      throw new ScriptusRuntimeException("problem with cipher", e);
    }
  }
View Full Code Here

    return fromHex(hex, -1);
  }
  public static byte[] fromHex(String hex, int expectedLength) {
   
    if(hex == null) {
      throw new ScriptusRuntimeException("hex string should not be null");
    }
    if (hex.length() % 2 == 1) {
      RuntimeException e = new ScriptusRuntimeException("Hex.length="+hex.length());
      e.printStackTrace();
      throw e;
    }
    if(expectedLength != -1 && hex.length() / 2 != expectedLength) {
      throw new ScriptusRuntimeException("Expected "+expectedLength+" bytes, got "+hex.length() / 2);
    }
    byte[] result = new byte[hex.length() / 2];
    for (int i = 0; i != result.length; i++) {
      result[i] = Integer.valueOf(hex.substring(i * 2, i * 2 + 2), 16).byteValue();
    }
View Full Code Here

    try {
      MessageDigest md = MessageDigest.getInstance(hash);
      md.update(str);
      return md.digest();
    } catch (Exception e) {
      throw new ScriptusRuntimeException("probmem with hash", e);
    }
  }
View Full Code Here

        mac.init(key);

        return mac.doFinal(plaintext);
       
            } catch (Exception e) {
                throw new ScriptusRuntimeException("problem with mac", e);
            }
      
        }
View Full Code Here

   
    ScheduledScriptAction a;
    try {
      a = (ScheduledScriptAction) Class.forName(klazz).newInstance();
    } catch (InstantiationException e) {
      throw new ScriptusRuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new ScriptusRuntimeException(e);
    } catch (ClassNotFoundException e) {
      throw new ScriptusRuntimeException(e);
    }
    a.fromString(s);
   
    return a;
   
View Full Code Here

   
    String c = "tweet:"+Math.abs(r.nextInt());
        String f = "from:"+Math.abs(r.nextInt());
        String u = "user:"+Math.abs(r.nextInt());
   
    MessageCorrelation m = new MessageCorrelation(UUID.randomUUID(), f, c, System.currentTimeMillis(), TransportType.Dummy, u);
   
    datastore.registerMessageCorrelation(m);

    Set<MessageCorrelation> cc = datastore.getMessageCorrelations(c, f, u, TransportType.Dummy);
   
    assertTrue("correct pid returned", cc.contains(m));
   
    datastore.unregisterMessageCorrelation(m);
   
    assertTrue("nothing left", ! datastore.getMessageCorrelations(c, f, u, TransportType.Dummy).contains(m));

    //listen({to:"user", messageId:"foo"})
        MessageCorrelation both      = new MessageCorrelation(UUID.randomUUID(), f,    c,    System.currentTimeMillis(), TransportType.Dummy, u);
        //listen({to:"user"})
        MessageCorrelation byuser    = new MessageCorrelation(UUID.randomUUID(), f,    null, System.currentTimeMillis(), TransportType.Dummy, u);
        //listen({messageId:"foo"})
        MessageCorrelation messageId = new MessageCorrelation(UUID.randomUUID(), null, c,    System.currentTimeMillis(), TransportType.Dummy, u);
        //listen()
        MessageCorrelation byNull    = new MessageCorrelation(UUID.randomUUID(), null, null, System.currentTimeMillis(), TransportType.Dummy, u);

        MessageCorrelation byNullOtheruser    = new MessageCorrelation(UUID.randomUUID(), null, null, System.currentTimeMillis(), TransportType.Dummy, u+r.nextInt());

        datastore.registerMessageCorrelation(both);
        datastore.registerMessageCorrelation(byuser);
        datastore.registerMessageCorrelation(messageId);
        datastore.registerMessageCorrelation(byNull);
View Full Code Here

TOP

Related Classes of net.ex337.scriptus.exceptions.ScriptusRuntimeException

Copyright © 2018 www.massapicom. 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.