private void validateCreateRequest(String path, CreateMode createMode, Request request, long ttl) throws KeeperException { if (createMode.isTTL() && !EphemeralType.extendedEphemeralTypesEnabled()) { throw new KeeperException.UnimplementedException(); } try { EphemeralType.validateTTL(createMode, ttl); } catch (IllegalArgumentException e) { throw new BadArgumentsException(path); } if (createMode.isEphemeral()) { // Exception is set when local session failed to upgrade // so we just need to report the error if (request.getException() != null) { throw request.getException(); } zks.sessionTracker.checkGlobalSession(request.sessionId, request.getOwner()); } else { zks.sessionTracker.checkSession(request.sessionId, request.getOwner()); } }
/** * It tests that PrepRequestProcessor will return BadArgument KeeperException * if the request path (if it exists) is not valid, e.g. empty string. */ @Test public void testInvalidPath() throws Exception { pLatch = new CountDownLatch(1); processor = new PrepRequestProcessor(zks, new MyRequestProcessor()); SetDataRequest record = new SetDataRequest("", new byte[0], -1); Request req = createRequest(record, OpCode.setData); processor.pRequest(req); pLatch.await(); Assert.assertEquals(outcome.getHdr().getType(), OpCode.error); Assert.assertEquals(outcome.getException().code(), KeeperException.Code.BADARGUMENTS); }
if (request.getException() != null) { throw request.getException(); } else { throw KeeperException.create(KeeperException.Code KeeperException ke = request.getException(); if (ke instanceof SessionMovedException) { throw ke;
KeeperException ke = request.getException(); if (ke != null && request.type != OpCode.multi) { throw ke;
KeeperException ke = request.getException(); if (ke != null) { throw ke;