auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public GDAXTrades getGDAXTradesExtended(CurrencyPair currencyPair, Long after, Integer limit) throws IOException { for (;;) { try { if (rateLimited) { long delta = Duration.between(lastCall, Instant.now()).toMillis(); log.debug("Last call ms ago", delta); if (delta < 333) { try { log.debug("Sleeping for {}ms", 333-delta); Thread.sleep(333-delta); } catch (InterruptedException e) { e.printStackTrace(); } } else if (delta > 3000) { log.debug("Clearing rate limiter"); rateLimited = false; } } lastCall = Instant.now(); GDAXTrades gdaxTrades = this.gdax.getTradesPageable( currencyPair.base.getCurrencyCode(), currencyPair.counter.getCurrencyCode(), after, limit); log.debug("GDAXTrades: earliest={}, latest={}, {}", gdaxTrades.getEarliestTradeId(), gdaxTrades.getLatestTradeId(), gdaxTrades); return gdaxTrades; } catch (GDAXException e) { if (e.getHttpStatusCode() == 429) { log.debug("Rate limit exceeded, sleeping for 1000ms"); rateLimited = true; try { Thread.sleep(1000); } catch (InterruptedException e1) { e1.printStackTrace(); } log.debug("Retrying"); } else { e.printStackTrace(); throw handleError(e); } } } }

Target:
public GDAXTrades getGDAXTradesExtended(CurrencyPair currencyPair, Long after, Integer limit) throws IOException { for (; ; ) { try { if (rateLimited) { long delta = Duration.between(lastCall, Instant.now()).toMillis(); log.debug("Last call ms ago", delta); if (delta < 333) { try { log.debug("Sleeping for {}ms", 333 - delta); Thread.sleep(333 - delta); } catch (InterruptedException e) { log.debug("Unexpected exception in getGDAXTradesExtended", e); } } else if (delta > 3000) { log.debug("Clearing rate limiter"); rateLimited = false; } } lastCall = Instant.now(); GDAXTrades gdaxTrades = this.gdax.getTradesPageable( currencyPair.base.getCurrencyCode(), currencyPair.counter.getCurrencyCode(), after, limit); log.debug( "GDAXTrades: earliest={}, latest={}, {}", gdaxTrades.getEarliestTradeId(), gdaxTrades.getLatestTradeId(), gdaxTrades); return gdaxTrades; } catch (GDAXException e) { if (e.getHttpStatusCode() == 429) { log.debug("Rate limit exceeded, sleeping for 1000ms"); rateLimited = true; try { Thread.sleep(1000); } catch (InterruptedException e1) { log.debug("Unexpected exception in getGDAXTradesExtended", e1); } log.debug("Retrying"); } else { log.debug("Uncaught exception in getGDAXTradesExtended", e); throw handleError(e); } } } }
Source:
public FormValidation doCheckEndPointUrl(@QueryParameter String value) { Jenkins.getActiveInstance().checkPermission(Jenkins.ADMINISTER); if (Util.fixEmpty(value) == null) return FormValidation.validateRequired(value); try { new URL(value); } catch (MalformedURLException ex) { return FormValidation.error(ex, "The endpoint must be URL"); } return FormValidation.ok(); }

Target:
public FormValidation doCheckEndPointUrl(@QueryParameter String value) { Jenkins.get().checkPermission(Jenkins.ADMINISTER); if (Util.fixEmpty(value) == null) return FormValidation.validateRequired(value); try { new URL(value); } catch (MalformedURLException ex) { return FormValidation.error(ex, "The endpoint must be URL"); } return FormValidation.ok(); }
Source:
private void testOldClientNewServer() throws Exception { if (!config.mvStore) { return; } Server server = org.h2.tools.Server.createTcpServer(); server.start(); int port = server.getPort(); assertThrows(ErrorCode.DRIVER_VERSION_ERROR_2, driver).connect( "jdbc:h2:tcp://localhost:" + port + "/mem:test", null); server.stop(); Class<?> serverClass = cl.loadClass("org.h2.tools.Server"); Method m; m = serverClass.getMethod("createTcpServer", String[].class); Object serverOld = m.invoke(null, new Object[] { new String[] { "-tcpPort", "" + port } }); m = serverOld.getClass().getMethod("start"); m.invoke(serverOld); Connection conn; conn = org.h2.Driver.load().connect("jdbc:h2:mem:", null); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("call 1"); rs.next(); assertEquals(1, rs.getInt(1)); conn.close(); m = serverOld.getClass().getMethod("stop"); m.invoke(serverOld); }

Target:
private void testOldClientNewServer() throws Exception { Server server = org.h2.tools.Server.createTcpServer(); server.start(); int port = server.getPort(); assertThrows(ErrorCode.DRIVER_VERSION_ERROR_2, driver).connect( "jdbc:h2:tcp://localhost:" + port + "/mem:test", null); server.stop(); Class<?> serverClass = cl.loadClass("org.h2.tools.Server"); Method m; m = serverClass.getMethod("createTcpServer", String[].class); Object serverOld = m.invoke(null, new Object[] { new String[] { "-tcpPort", "" + port } }); m = serverOld.getClass().getMethod("start"); m.invoke(serverOld); Connection conn; conn = org.h2.Driver.load().connect("jdbc:h2:mem:", null); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("call 1"); rs.next(); assertEquals(1, rs.getInt(1)); conn.close(); m = serverOld.getClass().getMethod("stop"); m.invoke(serverOld); }
Source:
public abstract List<FindResult> getAll() throws IOException; public abstract long getLastModifiedTime(UUID id) throws IOException; public abstract VideoInfo getVideoInfo(UUID id) throws IOException; public abstract Video getVideo(UUID id) throws IOException; public abstract void save(Video video) throws IOException; public abstract void delete(UUID id) throws IOException; public void invalidate(UUID id) { }

Target:
public abstract FindResults getAll() throws IOException; public abstract long getLastModifiedTime(UUID id) throws IOException; public abstract VideoInfo getVideoInfo(UUID id) throws IOException; public abstract Video getVideo(UUID id) throws IOException; public abstract void save(Video video) throws IOException; public abstract void delete(UUID id) throws IOException; public void invalidate(UUID id) { }
Source:
protected DefaultRecord(int sizeInBytes, byte attributes, long offset, long timestamp, int sequence, ByteBuffer key, ByteBuffer value, Header[] headers) { this.sizeInBytes = sizeInBytes; this.attributes = attributes; this.offset = offset; this.timestamp = timestamp; this.sequence = sequence; this.key = key; this.value = value; this.headers = headers; }

Target:
DefaultRecord(int sizeInBytes, byte attributes, long offset, long timestamp, int sequence, ByteBuffer key, ByteBuffer value, Header[] headers) { this.sizeInBytes = sizeInBytes; this.attributes = attributes; this.offset = offset; this.timestamp = timestamp; this.sequence = sequence; this.key = key; this.value = value; this.headers = headers; }
Source:
private boolean isTryStatementResource(VariableTree variable) { final TryStatementTree tryStatement = getEnclosingTryStatement(variable); return tryStatement != null && tryStatement.resources().contains(variable); }

Target:
private static boolean isTryStatementResource(VariableTree variable) { final TryStatementTree tryStatement = getEnclosingTryStatement(variable); return tryStatement != null && tryStatement.resources().contains(variable); }
Source:
protected Factory<?> createValueFactory(final Parameter parameter) { final Class<?> classType = parameter.getRawType(); Auth auth = parameter.getAnnotation(Auth.class); if (auth == null) { return null; } if (classType.isAssignableFrom(this.factory.getGeneratedClass())) { return this.factory.clone(auth.required()); } else { return null; } }

Target:
protected Factory<?> createValueFactory(final Parameter parameter) { final Class<?> classType = parameter.getRawType(); final Auth auth = parameter.getAnnotation(Auth.class); if (auth != null && classType.isAssignableFrom(factory.getGeneratedClass())) { return factory.clone(auth.required()); } else { return null; } }
Source:
public byte[] toBinary() { return new byte[] { (byte) maxVertices, (byte) simpVertMin, (byte) tolerance }; }

Target:
public byte[] toBinary() { final byte[] backingBuffer = new byte[Integer.BYTES * 2 + Double.BYTES]; ByteBuffer buf = ByteBuffer.wrap(backingBuffer); buf.putInt( maxVertices).putInt( simpVertMin).putDouble( tolerance); return backingBuffer; }
Source:
public EndNode onboardEndnodeWithGateway( @NonNull PendingEndNode pendingEndNode, @NonNull String endnodePassword, @Nullable OnboardEndnodeWithGatewayOptions options) throws ThingIFException { return thingIfApi.onboardEndnodeWithGateway(pendingEndNode, endnodePassword, options); }

Target:
public EndNode onboardEndnodeWithGateway( @NonNull PendingEndNode pendingEndNode, @NonNull String endnodePassword, @Nullable OnboardEndnodeWithGatewayOptions options) throws ThingIFException { return this.thingIfApi.onboardEndnodeWithGateway(pendingEndNode, endnodePassword, options); }
Source:
public abstract InterpreterResult interpret(String st, InterpreterContext context) throws InterpreterException; @ZeppelinApi public abstract void cancel(InterpreterContext context) throws InterpreterException; @ZeppelinApi public abstract FormType getFormType() throws InterpreterException; @ZeppelinApi public abstract int getProgress(InterpreterContext context) throws InterpreterException; @ZeppelinApi public List<InterpreterCompletion> completion(String buf, int cursor, InterpreterContext interpreterContext) throws InterpreterException { return new ArrayList<>(); }

Target:
public abstract InterpreterResult interpret(String st, InterpreterContext context) throws InterpreterException; @ZeppelinApi public abstract void cancel(InterpreterContext context) throws InterpreterException; @ZeppelinApi public abstract FormType getFormType() throws InterpreterException; @ZeppelinApi public abstract int getProgress(InterpreterContext context) throws InterpreterException; @ZeppelinApi public List<InterpreterCompletion> completion(String buf, int cursor, InterpreterContext interpreterContext) throws InterpreterException { return Collections.emptyList(); }
Source:
private void updatePresenceStatusForXmppProviders() { SipGateway sipGateway= ServiceUtils.getService( osgiContext, SipGateway.class); TranscriptionGateway transcriptionGateway = ServiceUtils.getService( osgiContext, TranscriptionGateway.class); int participants = 0; int sessions = 0; if(sipGateway != null) { for(SipGatewaySession ses : sipGateway.getActiveSessions()) { participants += ses.getJvbChatRoom().getMembersCount(); sessions++; } } if(transcriptionGateway != null) { for(TranscriptionGatewaySession ses : transcriptionGateway.getActiveSessions()) { participants += ses.getJvbChatRoom().getMembersCount(); sessions++; } } Collection<ServiceReference<ProtocolProviderService>> refs = ServiceUtils.getServiceReferences( osgiContext, ProtocolProviderService.class); for (ServiceReference<ProtocolProviderService> ref : refs) { updatePresenceStatusForXmppProvider( osgiContext.getService(ref), participants, sessions); } }

Target:
private void updatePresenceStatusForXmppProviders() { Collection<ServiceReference<ProtocolProviderService>> refs = ServiceUtils.getServiceReferences( osgiContext, ProtocolProviderService.class); for (ServiceReference<ProtocolProviderService> ref : refs) { updatePresenceStatusForXmppProvider(osgiContext.getService(ref)); } }
Source:
public void required_mustRequestFromUpstreamForElementsThatHaveBeenRequestedLongAgo() throws Throwable { optionalMultipleSubscribersTest(2, new Function<Long,TestSetup>() { @Override public TestSetup apply(Long subscribers) throws Throwable { return new TestSetup(env, processorBufferSize) {{ ManualSubscriber<T> sub1 = newSubscriber(); sub1.request(20); long totalRequests = expectRequest(); final T x = sendNextTFromUpstream(); expectNextElement(sub1, x); if (totalRequests == 1) { totalRequests += expectRequest(); } final T y = sendNextTFromUpstream(); expectNextElement(sub1, y); if (totalRequests == 2) { totalRequests += expectRequest(); } final ManualSubscriber<T> sub2 = newSubscriber(); if (doesCoordinatedEmission()) { sub2.expectNone(); sub2.request(1); final T z = sendNextTFromUpstream(); expectNextElement(sub1, z); expectNextElement(sub2, z); if (totalRequests == 3) { expectRequest(); } } else { final T z = sendNextTFromUpstream(); expectNextElement(sub1, z); sub2.expectNone(); sub2.request(1); expectNextElement(sub2, z); if (totalRequests == 3) { expectRequest(); } } sendCompletion(); sub1.expectCompletion(env.defaultTimeoutMillis()); sub2.expectCompletion(env.defaultTimeoutMillis()); env.verifyNoAsyncErrorsNoDelay(); }}; } }); }

Target:
public void required_mustRequestFromUpstreamForElementsThatHaveBeenRequestedLongAgo() throws Throwable { optionalMultipleSubscribersTest(2, new Function<Long,TestSetup>() { @Override public TestSetup apply(Long subscribers) throws Throwable { return new TestSetup(env, processorBufferSize) {{ ManualSubscriber<T> sub1 = newSubscriber(); sub1.request(20); long totalRequests = expectRequest(); final T x = sendNextTFromUpstream(); expectNextElement(sub1, x); if (totalRequests == 1) { totalRequests += expectRequest(); } final T y = sendNextTFromUpstream(); expectNextElement(sub1, y); if (totalRequests == 2) { totalRequests += expectRequest(); } final ManualSubscriber<T> sub2 = newSubscriber(); if (doesCoordinatedEmission()) { sub2.expectNone(); sub2.request(1); final T z = sendNextTFromUpstream(); expectNextElement(sub1, z); expectNextElement(sub2, z); } else { final T z = sendNextTFromUpstream(); expectNextElement(sub1, z, "If the Processor coordinates requests/emissions when having multiple Subscribers" + " at once, please override doesCoordinatedEmission() to return true in this " + "IdentityProcessorVerification to allow this test to pass."); sub2.expectNone(); sub2.request(1); expectNextElement(sub2, z); } if (totalRequests == 3) { expectRequest(); } sendCompletion(); sub1.expectCompletion(env.defaultTimeoutMillis()); sub2.expectCompletion(env.defaultTimeoutMillis()); env.verifyNoAsyncErrorsNoDelay(); }}; } }); }
Source:
private TupleBatchBuffer fillInputTbb(final int numTuples) { final Schema schema = new Schema(ImmutableList.of(Type.INT_TYPE, Type.DOUBLE_TYPE, Type.FLOAT_TYPE, Type.LONG_TYPE, Type.DATETIME_TYPE, Type.STRING_TYPE, Type.BOOLEAN_TYPE, Type.LONG_TYPE), ImmutableList.of("Int", "Double", "Float", "Long", "Datetime", "String", "Boolean", "value")); final TupleBatchBuffer source = new TupleBatchBuffer(schema); for (int i = 0; i < numTuples; i++) { int value = i / (numTuples / 10); source.putInt(0, value); source.putDouble(1, value); source.putFloat(2, value); source.putLong(3, value); source.putDateTime(4, new DateTime(2010 + value, 1, 1, 0, 0)); source.putString(5, "" + value); source.putBoolean(6, (i / (numTuples / 2) == 0)); source.putLong(7, 2L); } return source; }

Target:
private TupleBatchBuffer fillInputTbb(final int numTuples) { final Schema schema = Schema.ofFields(Type.INT_TYPE, "Int", Type.DOUBLE_TYPE, "Double", Type.FLOAT_TYPE, "Float", Type.LONG_TYPE, "Long", Type.DATETIME_TYPE, "Datetime", Type.STRING_TYPE, "String", Type.BOOLEAN_TYPE, "Boolean", Type.LONG_TYPE, "value"); final TupleBatchBuffer source = new TupleBatchBuffer(schema); for (int i = 0; i < numTuples; i++) { int value = i / (numTuples / 10); source.putInt(0, value); source.putDouble(1, value); source.putFloat(2, value); source.putLong(3, value); source.putDateTime(4, new DateTime(2010 + value, 1, 1, 0, 0)); source.putString(5, "" + value); source.putBoolean(6, (i / (numTuples / 2) == 0)); source.putLong(7, 2L); } return source; }
Source:
public void testRequestToken() { Map<String, String> userDTO = new HashMap<>(); userDTO.put("username", user.getUsername()); userDTO.put("password", userCleartextPassword); given(). when(). content(userDTO).contentType(ContentType.JSON). post("/token"). then(). statusCode(HttpStatus.SC_OK); AuthenticationToken authenticationToken1 = authenticationTokenRepository.findByUserUsername(user.getUsername()).orElse(null); given(). when(). content(userDTO).contentType(ContentType.JSON). post("/token"). then(). statusCode(HttpStatus.SC_OK); AuthenticationToken authenticationToken2 = authenticationTokenRepository.findByUserUsername(user.getUsername()).orElse(null); Assert.assertFalse(authenticationToken1.equals(authenticationToken2)); }

Target:
public void testRequestToken() { Map<String, String> userDTO = new HashMap<>(); userDTO.put("username", user.getUsername()); userDTO.put("password", userCleartextPassword); Response response = given(). when(). content(userDTO).contentType(ContentType.JSON). post("/token"); Optional<AuthenticationToken> authenticationToken = authenticationTokenRepository.findByUserUsername(user.getUsername()); Assert.assertTrue(authenticationToken.isPresent()); response.then().statusCode(HttpStatus.SC_OK).body("object", containsString(authenticationToken.get().getToken())); }
Source:
public T deserialize(TypeToken<?> type, ConfigurationNode value) throws ObjectMappingException { return this.dataTranslator.translate(ConfigurateTranslator.instance().translateFrom(value)); }

Target:
public T deserialize(TypeToken<?> type, ConfigurationNode value) throws ObjectMappingException { try { return this.dataTranslator.translate(ConfigurateTranslator.instance().translateFrom(value)); } catch (InvalidDataException e) { return null; } }
Source:
public ByteBuffer encode(BaseOperation<K> operation) { if (!(operation instanceof PutOperation)) { throw new AssertionError(this.getClass().getName() + " can only decode " + PutOperation.class.getName()); } PutOperation<K, V> putOperation = (PutOperation<K, V>)operation; K key = putOperation.getKey(); V value = putOperation.getValue(); ByteBuffer keyBuf = keySerializer.serialize(key); ByteBuffer valueBuf = valueSerializer.serialize(value); ByteBuffer buffer = ByteBuffer.allocate(BYTE_SIZE_BYTES + INT_SIZE_BYTES + keyBuf.remaining() + INT_SIZE_BYTES + valueBuf.remaining()); buffer.put(PUT.getValue()); buffer.putInt(keyBuf.remaining()); buffer.put(keyBuf); buffer.putInt(valueBuf.remaining()); buffer.put(valueBuf); buffer.flip(); return buffer; }

Target:
public ByteBuffer encode(BaseOperation<K> operation) { if (!(operation instanceof PutOperation)) { throw new IllegalArgumentException(this.getClass().getName() + " can only decode " + PutOperation.class.getName()); } PutOperation<K, V> putOperation = (PutOperation<K, V>)operation; K key = putOperation.getKey(); V value = putOperation.getValue(); ByteBuffer keyBuf = keySerializer.serialize(key); ByteBuffer valueBuf = valueSerializer.serialize(value); ByteBuffer buffer = ByteBuffer.allocate(BYTE_SIZE_BYTES + INT_SIZE_BYTES + keyBuf.remaining() + INT_SIZE_BYTES + valueBuf.remaining()); buffer.put(PUT.getValue()); buffer.putInt(keyBuf.remaining()); buffer.put(keyBuf); buffer.putInt(valueBuf.remaining()); buffer.put(valueBuf); buffer.flip(); return buffer; }
Source:
public void onMessage(final ByteBuffer buffer) { final Request req = AbstractServerWebSocketHandler.Decoder.parseRequest(buffer); LOG.error("Error: {}", req.getSessionInfo()); final String[] sessionInfo = req.getSessionInfo().split("\\+"); LOG.error("Error: {}", sessionInfo[1]); final AnswerConnectionState state = (AnswerConnectionState) getStateFromId(sessionInfo[1]); LOG.error("State: {}", state); if (req.getRequestType() == MessageType.DATA_REQUEST) { final Request.Builder builder = Request.newBuilder(req); builder.setSessionInfo(sessionInfo[0]); this.getParentServer().send(getConnectionFromState(state), builder.build()); } else if (req.getRequestType() == MessageType.SUBMISSION) { final Request.Builder builder = Request.newBuilder(req); builder.setSessionInfo(sessionInfo[0]); final SocketSession connection = getConnectionFromState(state); if (connection == null) { LOG.error("SOCKET IS NULL"); } this.getParentServer().send(getConnectionFromState(state), builder.build()); } }

Target:
public void onMessage(final ByteBuffer buffer) { final Request req = AbstractServerWebSocketHandler.Decoder.parseRequest(buffer); final String[] sessionInfo = req.getSessionInfo().split("\\+"); final AnswerConnectionState state = (AnswerConnectionState) getStateFromId(sessionInfo[1]); if (req.getRequestType() == MessageType.DATA_REQUEST) { final Request.Builder builder = Request.newBuilder(req); builder.setSessionInfo(sessionInfo[0]); this.getParentServer().send(getConnectionFromState(state), builder.build()); } else if (req.getRequestType() == MessageType.SUBMISSION) { final Request.Builder builder = Request.newBuilder(req); builder.setSessionInfo(sessionInfo[0]); final SocketSession connection = getConnectionFromState(state); if (connection == null) { LOG.error("SOCKET IS NULL"); } this.getParentServer().send(getConnectionFromState(state), builder.build()); } }
Source:
public void initialize() throws Exception { super.initialize(); if (initializer == null) { initializer = new DefaultInitializer(sessionSPI); } try { brokerConsumer = initializer.init(this); onflowControlReady = brokerConsumer::promptDelivery; } catch (ActiveMQAMQPResourceLimitExceededException e1) { throw e1; } catch (ActiveMQSecurityException e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(e.getMessage()); } catch (ActiveMQQueueMaxConsumerLimitReached e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.errorCreatingConsumer(e.getMessage()); } catch (ActiveMQException e) { throw e; } catch (Exception e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.errorCreatingConsumer(e.getMessage()); } }

Target:
public void initialize() throws Exception { super.initialize(); if (controller == null) { controller = new DefaultController(sessionSPI); } try { brokerConsumer = controller.init(this); onflowControlReady = brokerConsumer::promptDelivery; } catch (ActiveMQAMQPResourceLimitExceededException e1) { throw e1; } catch (ActiveMQSecurityException e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(e.getMessage()); } catch (ActiveMQQueueMaxConsumerLimitReached e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.errorCreatingConsumer(e.getMessage()); } catch (ActiveMQException e) { throw e; } catch (Exception e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.errorCreatingConsumer(e.getMessage()); } }
Source:
public QueryRequest createQueryRequest(String localSource, FilterBuilder filterBuilder) { List<SortBy> sortBys = sorts .stream() .filter( s -> StringUtils.isNotEmpty(s.getAttribute()) && StringUtils.isNotEmpty(s.getDirection())) .map(s -> parseSort(s.getAttribute(), s.getDirection())) .collect(Collectors.toList()); if (sortBys.isEmpty()) { sortBys.add(new SortByImpl(Result.TEMPORAL, DEFAULT_SORT_ORDER)); } Query query = new QueryImpl(createFilter(filterBuilder), start, count, sortBys.get(0), true, timeout); String source = parseSrc(localSource); QueryRequest queryRequest; if (CACHE_SOURCE.equals(source)) { queryRequest = new QueryRequestImpl(query, true); queryRequest.getProperties().put("mode", CACHE_SOURCE); } else { queryRequest = new QueryRequestImpl(query, Collections.singleton(source)); queryRequest.getProperties().put("mode", "update"); } queryRequest.getProperties().put("id", this.getId()); if (excludeUnnecessaryAttributes) { queryRequest .getProperties() .put("excludeAttributes", Sets.newHashSet(Metacard.METADATA, "lux")); } if (sortBys.size() > 1) { queryRequest .getProperties() .put(ADDITIONAL_SORT_BYS, sortBys.subList(1, sortBys.size()).toArray(new SortBy[0])); } if (StringUtils.isNotEmpty(queryType)) { queryRequest.getProperties().put("queryType", queryType); } return queryRequest; }

Target:
public QueryRequest createQueryRequest(String localSource, FilterBuilder filterBuilder) { List<SortBy> sortBys = sorts .stream() .filter( s -> StringUtils.isNotEmpty(s.getAttribute()) && StringUtils.isNotEmpty(s.getDirection())) .map(s -> parseSort(s.getAttribute(), s.getDirection())) .collect(Collectors.toList()); if (sortBys.isEmpty()) { sortBys.add(new SortByImpl(Result.TEMPORAL, DEFAULT_SORT_ORDER)); } Query query = new QueryImpl(createFilter(filterBuilder), start, count, sortBys.get(0), true, timeout); String source = parseSrc(localSource); QueryRequest queryRequest; if (CACHE_SOURCE.equals(source)) { queryRequest = new QueryRequestImpl(query, true); queryRequest.getProperties().put("mode", CACHE_SOURCE); } else { queryRequest = new QueryRequestImpl(query, Collections.singleton(source)); queryRequest.getProperties().put("mode", "update"); } queryRequest.getProperties().put("id", getId()); if (excludeUnnecessaryAttributes) { queryRequest .getProperties() .put("excludeAttributes", Sets.newHashSet(Metacard.METADATA, "lux")); } if (sortBys.size() > 1) { queryRequest .getProperties() .put(ADDITIONAL_SORT_BYS, sortBys.subList(1, sortBys.size()).toArray(new SortBy[0])); } if (StringUtils.isNotEmpty(queryType)) { queryRequest.getProperties().put("queryType", queryType); } return queryRequest; }
Source:
public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); ContextHolder.init(); ContextHolder.setServerName(client.getHostname()); ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); } }

Target:
public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); ContextHolder.init(); ContextHolder.setServerName(client.getHostname()); ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); if (request != null) { send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); } } }
Source:
private void cleanConnection(StorageServerConnections connection, Guid hostId) { if (connection.getid()!=null && !connection.getid().equalsIgnoreCase("")) { Frontend.RunAction(VdcActionType.RemoveStorageServerConnection, new StorageServerConnectionParametersBase(connection, hostId), null, this); } }

Target:
private void cleanConnection(StorageServerConnections connection, Guid hostId) { if (connection.getid() != null && !connection.getid().equals("")) { Frontend.RunAction(VdcActionType.RemoveStorageServerConnection, new StorageServerConnectionParametersBase(connection, hostId), null, this); } }
Source:
public static void stopSequentially(Iterable<? extends Startable> entities) { List<Exception> exceptions = Lists.newArrayList(); List<Startable> failedEntities = Lists.newArrayList(); for (final Startable entity : entities) { Task<Object> task = Tasks.builder() .name("stopping "+entity) .body(new Runnable() { @Override public void run() { DynamicTasks.markInessential(); entity.stop(); }}) .build(); try { DynamicTasks.queueIfPossible(task).orSubmitAsync((Entity)entity).andWaitForSuccess(); } catch (Exception e) { log.warn("Error stopping "+entity+"; continuing with shutdown", e); exceptions.add(e); failedEntities.add(entity); } } if (exceptions.size() > 0) { throw new CompoundRuntimeException("Error stopping "+(failedEntities.size() > 1 ? "entities" : "entity")+": "+failedEntities, exceptions); } }

Target:
public static void stopSequentially(Iterable<? extends Startable> entities) { List<Exception> exceptions = Lists.newArrayList(); List<Startable> failedEntities = Lists.newArrayList(); for (final Startable entity : entities) { try { TaskAdaptable<Void> task = TaskTags.markInessential(Effectors.invocation((Entity)entity, Startable.STOP, Collections.emptyMap())); DynamicTasks.queueIfPossible(task).orSubmitAsync((Entity)entity).andWaitForSuccess(); } catch (Exception e) { log.warn("Error stopping "+entity+"; continuing with shutdown", e); exceptions.add(e); failedEntities.add(entity); } } if (exceptions.size() > 0) { throw new CompoundRuntimeException("Error stopping "+(failedEntities.size() > 1 ? "entities" : "entity")+": "+failedEntities, exceptions); } }
Source:
public static String escape(String text) { String specials = "&<>\'\""; String[] replacements = new String[]{"&amp;", "&lt;", "&gt;", "&#39;", "&quot;"}; StringBuilder sb = null; int low = 0; for (int i = 0; i < text.length(); ++i) { int s = specials.indexOf(text.charAt(i)); if (s != -1) { if (sb == null) { sb = new StringBuilder(); } sb.append(text.substring(low, i)); sb.append(replacements[s]); low = i + 1; } } if (sb == null) { return text; } sb.append(text.substring(low)); return sb.toString(); }

Target:
public static String escape(String text) { String specials = "&<>\'\""; String[] replacements = new String[]{"&amp;", "&lt;", "&gt;", "&apos;", "&quot;"}; StringBuilder sb = null; int low = 0; for (int i = 0; i < text.length(); ++i) { int s = specials.indexOf(text.charAt(i)); if (s != -1) { if (sb == null) { sb = new StringBuilder(); } sb.append(text.substring(low, i)); sb.append(replacements[s]); low = i + 1; } } if (sb == null) { return text; } sb.append(text.substring(low)); return sb.toString(); }
Source:
public boolean isHammingSimilar(RoaringBitmap other, int tolerance) { final int size1 = highLowContainer.size(); final int size2 = other.highLowContainer.size(); int pos1 = 0; int pos2 = 0; int budget = tolerance; while(budget >= 0 && pos1 < size1 && pos2 < size2) { final short key1 = this.highLowContainer.getKeyAtIndex(pos1); final short key2 = other.highLowContainer.getKeyAtIndex(pos2); Container left = highLowContainer.getContainerAtIndex(pos1); Container right = other.highLowContainer.getContainerAtIndex(pos2); if(key1 == key2) { budget -= (left.getCardinality() + right.getCardinality() - (2 * left.andCardinality(right))); ++pos1; ++pos2; } else if(key1 < key2) { budget -= left.getCardinality(); ++pos1; } else { budget -= right.getCardinality(); ++pos2; } } while(budget >= 0 && pos1 < size1) { Container container = highLowContainer.getContainerAtIndex(pos1++); budget -= container.getCardinality(); } while(budget >= 0 && pos2 < size2) { Container container = other.highLowContainer.getContainerAtIndex(pos2++); budget -= container.getCardinality(); } return budget >= 0; }

Target:
public boolean isHammingSimilar(RoaringBitmap other, int tolerance) { final int size1 = highLowContainer.size(); final int size2 = other.highLowContainer.size(); int pos1 = 0; int pos2 = 0; int budget = tolerance; while(budget >= 0 && pos1 < size1 && pos2 < size2) { final short key1 = this.highLowContainer.getKeyAtIndex(pos1); final short key2 = other.highLowContainer.getKeyAtIndex(pos2); Container left = highLowContainer.getContainerAtIndex(pos1); Container right = other.highLowContainer.getContainerAtIndex(pos2); if(key1 == key2) { budget -= left.xorCardinality(right); ++pos1; ++pos2; } else if(Util.compareUnsigned(key1, key2) < 0) { budget -= left.getCardinality(); ++pos1; } else { budget -= right.getCardinality(); ++pos2; } } while(budget >= 0 && pos1 < size1) { Container container = highLowContainer.getContainerAtIndex(pos1++); budget -= container.getCardinality(); } while(budget >= 0 && pos2 < size2) { Container container = other.highLowContainer.getContainerAtIndex(pos2++); budget -= container.getCardinality(); } return budget >= 0; }
Source:
public static Map<String, String> loadFromFile(final File secretsFile) throws DotRuntimeException { if (!secretsFile.exists()) { throw new DotRuntimeException( "Unable to read secrets from file at [" + secretsFile.toPath() + "]"); } final Map<String, String> secrets = new HashMap<>(); try { final List<String> lines = Files.readAllLines(secretsFile.toPath(), Charset.defaultCharset()); for (String line : lines) { final int index = line.indexOf("="); if (index < 0) { throw new DotRuntimeException( "Invalid secrets in file at [" + secretsFile.toPath() + "]"); } final String key = line.substring(0, index); final String value = line.substring(index + 1); secrets.put(key, value); } } catch (IOException e) { throw new DotRuntimeException( "Unable to read secrets from file at [" + secretsFile.toPath() + "]"); } return secrets; }

Target:
public static Map<String, String> loadFromFile(final File secretsFile) throws DotRuntimeException { if (!secretsFile.exists() || !secretsFile.canRead()) { throw new DotRuntimeException( "Unable to read secrets from file at [" + secretsFile.toPath() + "]"); } final Map<String, String> secrets = new HashMap<>(); try { final List<String> lines = Files.readAllLines(secretsFile.toPath(), Charset.defaultCharset()); for (final String line : lines) { final int index = line.indexOf('='); if (index < 0) { throw new DotRuntimeException( "Invalid secrets in file at [" + secretsFile.toPath() + "]"); } final String key = line.substring(0, index); final String value = line.substring(index + 1); secrets.put(key, value); } } catch (IOException e) { throw new DotRuntimeException( "Unable to read secrets from file at [" + secretsFile.toPath() + "]"); } return secrets; }
Source:
public void resourceChanged(IResourceChangeEvent event) { try { if (event.getType() == IResourceChangeEvent.POST_CHANGE){ event.getDelta().accept(new IResourceDeltaVisitor(){ @Override public boolean visit(IResourceDelta delta) throws CoreException { if (delta.getKind() == IResourceDelta.REMOVED) { Set<IMarker> markerSet = fixitResourceMap.get(delta.getResource()); if (markerSet != null) { for (IMarker marker : markerSet) { deleteMarker(marker); } return false; } return true; } return false; } }); } } catch (CoreException e) { e.printStackTrace(); } }

Target:
public void resourceChanged(IResourceChangeEvent event) { try { if (event.getType() == IResourceChangeEvent.POST_CHANGE){ event.getDelta().accept(new IResourceDeltaVisitor(){ @Override public boolean visit(IResourceDelta delta) throws CoreException { if (delta.getKind() == IResourceDelta.REMOVED) { Set<IMarker> markerSet = fixitResourceMap.get(delta.getResource()); if (markerSet != null) { for (IMarker marker : markerSet) { deleteMarker(marker); } return false; } return true; } return false; } }); } } catch (CoreException e) { CCorePlugin.log(e); } }
Source:
protected void init() { setContentView(R.layout.wallpaper_cropper); mCropView = (CropView) findViewById(R.id.cropView); Intent cropIntent = getIntent(); final Uri imageUri = cropIntent.getData(); if (imageUri == null) { Log.e(LOGTAG, "No URI passed in intent, exiting WallpaperCropActivity"); finish(); return; } final ActionBar actionBar = getActionBar(); actionBar.setCustomView(R.layout.actionbar_set_wallpaper); actionBar.getCustomView().setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { boolean finishActivityWhenDone = true; if (isClick == false) { isClick = true; cropImageAndSetWallpaper(imageUri, null, finishActivityWhenDone); } } }); mSetWallpaperButton = findViewById(R.id.set_wallpaper_button); final BitmapRegionTileSource.UriBitmapSource bitmapSource = new BitmapRegionTileSource.UriBitmapSource(this, imageUri, 1024); mSetWallpaperButton.setVisibility(View.INVISIBLE); Runnable onLoad = new Runnable() { public void run() { if (bitmapSource.getLoadingState() != BitmapSource.State.LOADED) { Toast.makeText(WallpaperCropActivity.this, getString(R.string.wallpaper_load_fail), Toast.LENGTH_LONG).show(); finish(); } else { mSetWallpaperButton.setVisibility(View.VISIBLE); } } }; setCropViewTileSource(bitmapSource, true, false, onLoad); }

Target:
protected void init() { setContentView(R.layout.wallpaper_cropper); mCropView = (CropView) findViewById(R.id.cropView); Intent cropIntent = getIntent(); final Uri imageUri = cropIntent.getData(); if (imageUri == null) { Log.e(LOGTAG, "No URI passed in intent, exiting WallpaperCropActivity"); finish(); return; } final ActionBar actionBar = getActionBar(); actionBar.setCustomView(R.layout.actionbar_set_wallpaper); actionBar.getCustomView().setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { boolean finishActivityWhenDone = true; actionBar.getCustomView().setEnabled(false); cropImageAndSetWallpaper(imageUri, null, finishActivityWhenDone); } }); mSetWallpaperButton = findViewById(R.id.set_wallpaper_button); final BitmapRegionTileSource.UriBitmapSource bitmapSource = new BitmapRegionTileSource.UriBitmapSource(this, imageUri, 1024); mSetWallpaperButton.setVisibility(View.INVISIBLE); Runnable onLoad = new Runnable() { public void run() { if (bitmapSource.getLoadingState() != BitmapSource.State.LOADED) { Toast.makeText(WallpaperCropActivity.this, getString(R.string.wallpaper_load_fail), Toast.LENGTH_LONG).show(); finish(); } else { mSetWallpaperButton.setVisibility(View.VISIBLE); } } }; setCropViewTileSource(bitmapSource, true, false, onLoad); }
Source:
public void verifyUserLoggedIn(final String userName) { changeImplicitWait(0, TimeUnit.MILLISECONDS); try { if (driver.findElements(By.cssSelector("#PreviewFrame")).size() > 0) { driver.switchTo().frame("PreviewFrame"); } if (driver.findElements(MERCURY_SKIN).size() > 0) { wait.forElementPresent(MERCURY_NAV_ICON); driver.findElement(MERCURY_NAV_ICON).click(); } wait.forElementPresent(By .cssSelector(LOGGED_IN_USER_SELECTOR.replace("%userName%", userName.replace(" ", "_")))); if (driver.findElements(MERCURY_NAV_ICON).size() > 0) { wait.forElementClickable(MERCURY_NAV_ICON); driver.findElement(MERCURY_NAV_ICON).click(); } } finally { restoreDeaultImplicitWait(); driver.switchTo().defaultContent(); } PageObjectLogging.log("verifyUserLoggedIn", "user " + userName + " logged in", true); }

Target:
public void verifyUserLoggedIn(final String userName) { changeImplicitWait(0, TimeUnit.MILLISECONDS); try { if (driver.findElements(By.cssSelector("#PreviewFrame")).size() > 0) { driver.switchTo().frame("PreviewFrame"); } if (driver.findElements(MERCURY_SKIN).size() > 0) { wait.forElementClickable(MERCURY_NAV_ICON); driver.findElement(MERCURY_NAV_ICON).click(); } wait.forElementPresent(By .cssSelector(LOGGED_IN_USER_SELECTOR.replace("%userName%", userName.replace(" ", "_")))); if (driver.findElements(MERCURY_SKIN).size() > 0) { wait.forElementClickable(MERCURY_NAV_ICON); driver.findElement(MERCURY_NAV_ICON).click(); } } finally { restoreDeaultImplicitWait(); driver.switchTo().defaultContent(); } PageObjectLogging.log("verifyUserLoggedIn", "user " + userName + " logged in", true); }
Source:
private boolean matchesFilenames(LanguageDescription language, String path) { if (language.getFileNames() != null) { for (String name : language.getFileNames()) { if (name.equals(new File(path).getName())) { return true; } } } return false; }

Target:
private boolean matchesFilenames(LanguageDescription language, String path) { return language.getFileNames().stream().anyMatch(name->path.endsWith(name)); }
Source:
private UpdateEventResponse doHandle(UpdateEventRequest request) { String name = request.getName(); checkArgument(name == null || name.length() <= 100, "The name must not be longer then 100 characters."); try (DbSession dbSession = dbClient.openSession(false)) { return Stream .of(getDbEvent(dbSession, request)) .peek(checkPermissions()) .peek(checkModifiable()) .map(updateNameAndDescription(name)) .peek(checkNonConflictingOtherEvents(dbSession)) .peek(updateInDb(dbSession)) .map(toWsResponse()) .findAny() .orElseThrow(() -> new IllegalStateException("Event not found")); } }

Target:
private UpdateEventResponse doHandle(UpdateEventRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { return Stream .of(getDbEvent(dbSession, request)) .peek(checkPermissions()) .peek(checkModifiable()) .peek(checkVersionNameLength(request)) .map(updateNameAndDescription(request)) .peek(checkNonConflictingOtherEvents(dbSession)) .peek(updateInDb(dbSession)) .map(toWsResponse()) .findAny() .orElseThrow(() -> new IllegalStateException("Event not found")); } }
Source:
public void testValueOfJms() throws Exception{ ModelNode address = getAddress(); ModelNode operation = getOperation(address); try{ ModelNode result=executeOperation(operation); ModelNode value = result.get("java: contexts", "java:", "JmsXA","value"); Boolean val = !(value.equals(null)); Assert.assertTrue(val); } catch (MgmtOperationException e) { return; } }

Target:
public void testValueOfJms() throws Exception { ModelNode address = null; try { address = setup(); ModelNode addr = getAddress(); ModelNode operation = getOperation(addr); ModelNode result = executeOperation(operation); ModelNode value = result.get("java: contexts", "java:jboss", "Name3", "class-name"); Assert.assertEquals("org.jboss.as.test.integration.jca.rar.MultipleAdminObject1Impl", value.asString()); } finally { if (address != null) { remove(address); } } }
Source:
public String getPresentationValue() { return PhoneUtil.resolve(this); }

Target:
public String getPresentationValue() { final ContactResolver resolver = getResolver(getClass()); return resolver == null ? null : resolver.getPresentationValue(this); }
Source:
public GuiceBundle<T> build() { return new GuiceBundle<T>(Stage.PRODUCTION, autoConfig, modules, configurationClass); }

Target:
public GuiceBundle<T> build() { return build(Stage.PRODUCTION); }
Source:
protected void resolve(StyleInfo style) { setId(style); WorkspaceInfo resolved = ResolvingProxy.resolve(getCatalog(), style.getWorkspace()); if (resolved != null) { resolved = unwrap(resolved); style.setWorkspace(resolved); } else { System.out.println("this means the workspace has not yet been added to the catalog, keep the proxy around"); } }

Target:
protected void resolve(StyleInfo style) { setId(style); WorkspaceInfo resolved = ResolvingProxy.resolve(getCatalog(), style.getWorkspace()); if (resolved != null) { resolved = unwrap(resolved); style.setWorkspace(resolved); } else { LOGGER.log(Level.INFO, "Failed to resolve woekspace for style \""+style.getName()+ "\". This means the workspace has not yet been added to the catalog, keep the proxy around"); } }
Source:
private <T> T executeCall(String methodName, Class<T> returnType, Object[] params) throws ESException { if (client == null) { throw new ConnectionException(ConnectionManager.REMOTE); } if (Configuration.getClientBehavior().getChangePackageFragmentSize().isPresent()) { for (int i = 0; i < params.length; i++) { final Object param = params[i]; if (param instanceof AbstractChangePackage && !ChangePackageProxy.class.isInstance(param)) { params[i] = fragmentChangePackage( ESCollections.find(params, SessionId.class), ESCollections.find(params, ProjectId.class), AbstractChangePackage.class.cast(param)); } } } try { T result = (T) client.execute(serverInterface + "." + methodName, params); if (result instanceof Object[]) { final Object[] objects = (Object[]) result; final Optional<SessionId> maybeSession = ESCollections.find(params, SessionId.class); for (int i = 0; i < objects.length; i++) { final Object item = objects[i]; if (ChangePackageProxy.class.isInstance(item)) { objects[i] = aggregateChangePackageFragments((ChangePackageProxy) item, maybeSession); } } result = (T) objects; } return result; } catch (final XmlRpcException e) { if (e.getCause() instanceof ESException) { throw (ESException) e.getCause(); } else if (e.linkedException instanceof SAXException && ((SAXException) e.linkedException).getException() instanceof SerializationException) { final SerializationException serialE = (SerializationException) ((SAXException) e.linkedException) .getException(); throw new org.eclipse.emf.emfstore.internal.server.exceptions.SerializationException(serialE); } else { throw new ConnectionException(ConnectionManager.REMOTE + e.getMessage(), e); } } }

Target:
private <T> T executeCall(String methodName, Class<T> returnType, Object[] params) throws ESException { if (client == null) { throw new ConnectionException(ConnectionManager.REMOTE); } final Object[] adjustedParams = adjustParameters(params); try { final T result = (T) client.execute(serverInterface + "." + methodName, adjustedParams); return adjustResult(ESCollections.find(params, SessionId.class), result); } catch (final XmlRpcException e) { if (e.getCause() instanceof ESException) { throw (ESException) e.getCause(); } else if (e.linkedException instanceof SAXException && ((SAXException) e.linkedException).getException() instanceof SerializationException) { final SerializationException serialE = (SerializationException) ((SAXException) e.linkedException) .getException(); throw new org.eclipse.emf.emfstore.internal.server.exceptions.SerializationException(serialE); } else { throw new ConnectionException(ConnectionManager.REMOTE + e.getMessage(), e); } } }
Source:
protected RoleHierarchy getRoleHierarchy() { if(! roleHierarchySet && context != null) { RoleHierarchy contextRoleHierarchy = getSingleBeanOrNull(RoleHierarchy.class); if(contextRoleHierarchy != null){ roleHierarchy = contextRoleHierarchy; } roleHierarchySet = true; } return roleHierarchy; }

Target:
protected RoleHierarchy getRoleHierarchy() { if(roleHerarchyNotSetForValidContext()) { RoleHierarchy contextRoleHierarchy = getSingleBeanOrNull(RoleHierarchy.class); if(contextRoleHierarchy != null){ roleHierarchy = contextRoleHierarchy; } roleHierarchySet = true; } return roleHierarchy; }
Source:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateTimerEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertTimerEventEmpty(emptyTopEvent.getExecutionSet(), NON_CANCELLING, ""); }

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateTimerEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertTimerEventEmpty(emptyTopEvent.getExecutionSet(), NON_CANCELLING, EMPTY_VALUE); }
Source:
public List<? extends Module> getJacksonModules() { return Arrays.<Module>asList( new SimpleModule("FirehoseModule") .registerSubtypes( new NamedType(ClippedFirehoseFactory.class, "clipped"), new NamedType(TimedShutoffFirehoseFactory.class, "timed"), new NamedType(IrcFirehoseFactory.class, "irc"), new NamedType(LocalFirehoseFactory.class, "local"), new NamedType(ProtoBufInputRowParser.class, "protobuf"), new NamedType(EventReceiverFirehoseFactory.class, "receiver") ) ); }

Target:
public List<? extends Module> getJacksonModules() { return Arrays.<Module>asList( new SimpleModule("FirehoseModule") .registerSubtypes( new NamedType(ClippedFirehoseFactory.class, "clipped"), new NamedType(TimedShutoffFirehoseFactory.class, "timed"), new NamedType(IrcFirehoseFactory.class, "irc"), new NamedType(LocalFirehoseFactory.class, "local"), new NamedType(EventReceiverFirehoseFactory.class, "receiver") ) ); }