Package ch.ethz.iks.slp

Examples of ch.ethz.iks.slp.ServiceLocationException


      return null;

    default:
      // this should never happen, message should already cause an
      // exception during parsing
      throw new ServiceLocationException(
          ServiceLocationException.NOT_IMPLEMENTED,
          "The message type " + SLPMessage.getType(msg.funcID)
              + " is not implemented");
    }
View Full Code Here


      final int timeStamp, final byte[] byteData, final byte[] signature)
      throws ServiceLocationException {
    this();

    if (bsd != 0x0002) {
      throw new ServiceLocationException(
          ServiceLocationException.NOT_IMPLEMENTED,
          "Only BSD 0x0002 (DSA) is supported.");
    }

    timestamp = timeStamp;
View Full Code Here

      signature.initSign(privateKey);
      signature.update(data);
      sig = signature.sign();
    } catch (Exception e) {
      SLPCore.platform.logError(e.getMessage(), e.fillInStackTrace());
      throw new ServiceLocationException(
          ServiceLocationException.AUTHENTICATION_FAILED,
          "Could not sign data");
    }
  }
View Full Code Here

            + spi);

      return success;
    } catch (Exception e) {
      SLPCore.platform.logError(e.getMessage(), e.fillInStackTrace());
      throw new ServiceLocationException(
          ServiceLocationException.AUTHENTICATION_FAILED,
          "Could not verify data with SPI: " + spi);
    }
  }
View Full Code Here

    short blockCount = (short) input.readByte();
    for (int i = 0; i < blockCount; i++) {
      AuthenticationBlock authBlock = new AuthenticationBlock();
      short bsd = (short) input.readShort();
      if (bsd != BSD_DSA) {
        throw new ServiceLocationException(
            ServiceLocationException.AUTHENTICATION_FAILED, "BSD "
                + bsd + " is not supported.");
      }
      int size = input.readShort();
      authBlock.timestamp = input.readInt();
      authBlock.spi = input.readUTF();
      authBlock.sig = new byte[size - 2 - 2 - 4 - 2
          - authBlock.spi.getBytes().length];
      try {
        input.readFully(authBlock.sig);
      } catch (IOException ioe) {
        throw new ServiceLocationException(
            ServiceLocationException.PARSE_ERROR, ioe.getMessage());
      }
      blocks.add(authBlock);
    }
View Full Code Here

    url = ServiceURL.fromBytes(input);
    attList = attributeStringToList(input.readUTF());

    if (SLPCore.CONFIG.getSecurityEnabled()) {
      if (!verify()) {
        throw new ServiceLocationException(
            ServiceLocationException.AUTHENTICATION_FAILED,
            "Authentication failed for " + toString());
      }
    }
  }
View Full Code Here

      dos.writeShort(temp.length);
      dos.write(temp);
      dos.writeInt(timestamp);
      return bos.toByteArray();
    } catch (IOException ioe) {
      throw new ServiceLocationException(
          ServiceLocationException.INTERNAL_SYSTEM_ERROR, ioe
              .getMessage());
    }
  }
View Full Code Here

        break;
      case SRVTYPERPLY:
        msg = new ServiceTypeReply(in);
        break;
      default:
        throw new ServiceLocationException(
            ServiceLocationException.PARSE_ERROR, "Message type "
                + getType(funcID) + " not supported");
      }

      // set the fields
      msg.address = senderAddr;
      msg.port = senderPort;
      msg.tcp = tcp;
      msg.multicast = ((flags & 0x2000) >> 13) == 1 ? true : false;
      msg.xid = xid;
      msg.funcID = funcID;
      msg.locale = locale;
      if (msg.getSize() != length) {
        SLPCore.platform.logError("Length of " + msg + " should be " + length + ", read "
                + msg.getSize());
//        throw new ServiceLocationException(
//            ServiceLocationException.INTERNAL_SYSTEM_ERROR,
//            "Length of " + msg + " should be " + length + ", read "
//                + msg.getSize());
      }
      return msg;
    } catch (ProtocolException pe) {
      throw pe;
    } catch (IOException ioe) {
      SLPCore.platform.logError("Network Error", ioe);
      throw new ServiceLocationException(
          ServiceLocationException.NETWORK_ERROR, ioe.getMessage());
    }
  }
View Full Code Here

        value <<= 8;
        value += input.readByte() & 0xff;
      }
      return value;
    } catch (IOException ioe) {
      throw new ServiceLocationException(
          ServiceLocationException.PARSE_ERROR, ioe.getMessage());
    }
  }
View Full Code Here

      Rule parse = parser.parse("attr-list", input);
      AttributeListVisitor visitor = new AttributeListVisitor();
      parse.visit(visitor);
      return visitor.getAttributes();
    } catch (IllegalArgumentException e) {
      throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, e.getMessage());
    } catch (ParserException e) {
      throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of ch.ethz.iks.slp.ServiceLocationException

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.