auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void mucTest() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest-"); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); final String mucMessage = "Smack Integration Test MUC Test Message " + randomString; final ResultSyncPoint<String, Exception> resultSyncPoint = new ResultSyncPoint<>(); mucAsSeenByTwo.addMessageListener(new MessageListener() { @Override public void processMessage(Message message) { String body = message.getBody(); if (mucMessage.equals(body)) { resultSyncPoint.signal(body); } } }); MucCreateConfigFormHandle handle = mucAsSeenByOne.createOrJoin(Resourcepart.from("one-" + randomString)); try { if (handle != null) { handle.makeInstant(); } mucAsSeenByTwo.join(Resourcepart.from("two-" + randomString)); mucAsSeenByOne.sendMessage(mucMessage); resultSyncPoint.waitForResult(timeout); } finally { tryDestroy(mucAsSeenByOne); } }

Target:
public void mucTest() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); final String mucMessage = "Smack Integration Test MUC Test Message " + randomString; final ResultSyncPoint<String, Exception> resultSyncPoint = new ResultSyncPoint<>(); mucAsSeenByTwo.addMessageListener(new MessageListener() { @Override public void processMessage(Message message) { String body = message.getBody(); if (mucMessage.equals(body)) { resultSyncPoint.signal(body); } } }); createMUC(mucAsSeenByOne, "one-" + randomString); mucAsSeenByTwo.join(Resourcepart.from("two-" + randomString)); mucAsSeenByOne.sendMessage(mucMessage); try { resultSyncPoint.waitForResult(timeout); } catch (TimeoutException e) { throw new AssertionError("Failed to receive presence"); } finally { tryDestroy(mucAsSeenByOne); } }
Source:
public StructDefinition getContext() { if (fStreamContext == null) { return fEventContext; } if (fEventContext == null) { return (StructDefinition) fStreamContext; } StructDeclaration mergedDeclaration = new StructDeclaration(1); Builder<String> builder = ImmutableList.<String> builder(); List<Definition> fieldValues = new ArrayList<>(); for (String fieldName : fStreamContext.getFieldNames()) { Definition definition = fStreamContext.getDefinition(fieldName); mergedDeclaration.addField(fieldName, definition.getDeclaration()); builder.add(fieldName); fieldValues.add(definition); } ImmutableList<String> fieldNames = builder.build(); for (String fieldName : fEventContext.getFieldNames()) { Definition definition = fEventContext.getDefinition(fieldName); mergedDeclaration.addField(fieldName, definition.getDeclaration()); if (fieldNames.contains(fieldName)) { fieldValues.set((fieldNames.indexOf(fieldName)), definition); } else { builder.add(fieldName); fieldValues.add(definition); } } fieldNames = builder.build(); ICompositeDefinition mergedContext = new StructDefinition(mergedDeclaration, this, "context", fieldNames, fieldValues.toArray(new Definition[fieldValues.size()])); return (StructDefinition) mergedContext; }

Target:
public StructDefinition getContext() { if (fStreamContext == null) { return fEventContext; } if (fEventContext == null) { return fStreamContext; } StructDeclaration mergedDeclaration = new StructDeclaration(1); Builder<String> builder = ImmutableList.<String> builder(); List<Definition> fieldValues = new ArrayList<>(); for (String fieldName : fStreamContext.getFieldNames()) { Definition definition = fStreamContext.getDefinition(fieldName); mergedDeclaration.addField(fieldName, definition.getDeclaration()); builder.add(fieldName); fieldValues.add(definition); } ImmutableList<String> fieldNames = builder.build(); for (String fieldName : fEventContext.getFieldNames()) { Definition definition = fEventContext.getDefinition(fieldName); mergedDeclaration.addField(fieldName, definition.getDeclaration()); if (fieldNames.contains(fieldName)) { fieldValues.set((fieldNames.indexOf(fieldName)), definition); } else { builder.add(fieldName); fieldValues.add(definition); } } fieldNames = builder.build(); ICompositeDefinition mergedContext = new StructDefinition(mergedDeclaration, this, "context", fieldNames, fieldValues.toArray(new Definition[fieldValues.size()])); return (StructDefinition) mergedContext; }
Source:
private static void listInstances(ServiceDiscovery<InstanceDetails> serviceDiscovery) throws Exception { try { Collection<String> serviceNames = serviceDiscovery.queryForNames(); System.out.println(serviceNames.size() + " type(s)"); for ( String serviceName : serviceNames ) { Collection<ServiceInstance<InstanceDetails>> instances = serviceDiscovery.queryForInstances(serviceName); System.out.println(serviceName); for ( ServiceInstance<InstanceDetails> instance : instances ) { outputInstance(instance); } } } catch ( Exception e ) { if ( e instanceof KeeperException.NoNodeException ) { System.err.println("There are no registered instances."); return; } CloseableUtils.closeQuietly(serviceDiscovery); } }

Target:
private static void listInstances(ServiceDiscovery<InstanceDetails> serviceDiscovery) throws Exception { try { Collection<String> serviceNames = serviceDiscovery.queryForNames(); System.out.println(serviceNames.size() + " type(s)"); for ( String serviceName : serviceNames ) { Collection<ServiceInstance<InstanceDetails>> instances = serviceDiscovery.queryForInstances(serviceName); System.out.println(serviceName); for ( ServiceInstance<InstanceDetails> instance : instances ) { outputInstance(instance); } } } catch ( KeeperException.NoNodeException e ) { System.err.println("There are no registered instances."); } finally { CloseableUtils.closeQuietly(serviceDiscovery); } }
Source:
public VM get() { VM vm = performGet(VdcQueryType.GetVmByVmId, new GetVmByVmIdParameters(guid)); setPayload(vm); return vm; }

Target:
public VM get() { VM vm = performGet(VdcQueryType.GetVmByVmId, new GetVmByVmIdParameters(guid)); return vm; }
Source:
public void testIsValid() { NumberManager numberManager = new NumberManager(); assertEquals(numberManager, FormatUtilities.isValid(numberManager)); try { FormatUtilities.isValid(new BadManager1()); fail("Should reject a manager without an identifier"); } catch (NullPointerException e) { } try { FormatUtilities.isValid(new BadManager2()); fail("Should reject a manager without a managed class"); } catch (NullPointerException e) { } }

Target:
public void testIsValid() { NumberManager numberManager = new NumberManager(); assertEquals(numberManager, FormatUtilities.isValid(numberManager)); try { FormatUtilities.isValid(new BadManagerNoIdentifierType()); fail("Should reject a manager without an identifier"); } catch (NullPointerException e) { } try { FormatUtilities.isValid(new BadManagerNoManagedClass()); fail("Should reject a manager without a managed class"); } catch (NullPointerException e) { } }
Source:
public void dispose() { super.dispose(); getConsoleManager().removeConsoleListener(this); if (fDisplayConsoleAction != null) { fDisplayConsoleAction.dispose(); fDisplayConsoleAction = null; } }

Target:
public void dispose() { super.dispose(); getConsoleManager().removeConsoleListener(this); getViewSite().getPage().removePartListener((IPartListener2) this); if (fDisplayConsoleAction != null) { fDisplayConsoleAction.dispose(); fDisplayConsoleAction = null; } }
Source:
public void textualConfigurationTests() { MqttService service = new MqttService(); Dictionary<String, String> properties = new Hashtable<>(); properties.put("bam.name", "brokername"); properties.put("bam.url", "tcp://123.123.123.123"); Map<String, Map<String, Object>> map = service.extractBrokerConfigurations(properties); assertNotNull(map); assertEquals(map.size(), 1); Map<String, Object> data = map.get("bam"); assertNotNull(data); assertTrue("brokername".equals(data.get("name"))); assertTrue("tcp://123.123.123.123".equals(data.get("url"))); assertEquals(service.getAllBrokerConnections().size(), 0); try { service.addBrokerConnection(data); } catch (ConfigurationException | MqttException e) { fail(e.getMessage()); } assertEquals(service.getAllBrokerConnections().size(), 1); assertNotNull(service.getBrokerConnection("brokername")); }

Target:
public void textualConfigurationTests() throws ConfigurationException, MqttException { MqttService service = new MqttService(); Dictionary<String, String> properties = new Hashtable<>(); properties.put("bam.name", "brokername"); properties.put("bam.url", "tcp://123.123.123.123"); Map<String, Map<String, String>> map = service.extractBrokerConfigurations(properties); assertEquals(map.size(), 1); Map<String, String> data = map.get("bam"); assertNotNull(data); assertEquals("brokername", data.get("name")); assertEquals("tcp://123.123.123.123", data.get("url")); assertThat(service.getAllBrokerConnections(), hasSize(0)); service.addBrokerConnection(data); assertThat(service.getAllBrokerConnections(), hasSize(1)); assertNotNull(service.getBrokerConnection("brokername")); }
Source:
public RtFilmProcessor rtFilmProcessor() { return new RtFilmProcessor(contentResolver, contentWriter, peopleWriter, log, queuingPersonWriter); }

Target:
public RtFilmProcessor rtFilmProcessor() { try { return new RtFilmProcessor( contentResolver, contentWriter, peopleWriter, log, queuingPersonWriter ); } catch (Exception e) { LOGGER.error(" RtFilmModule problem with rtFilmProcessor()", e); return null; } }
Source:
public void testGetConfiguration() throws Exception { TaskRepository repository = actualFixture.repository(); BugzillaRestClient client = BugzillaRestConnector.getDefault().getClient(repository); BugzillaRestConfiguration configuration = client.getConfiguration(repository, new NullOperationMonitor()); Collection<Field> fields = configuration.getFields(); assertConfigurationFieldNames(fields); String ss = new Gson().toJson(configuration).replaceAll(repository.getRepositoryUrl(), "<LINK_0>"); assertEquals( IOUtils.toString(CommonTestUtil.getResource(this, "testdata/" + actualFixture.getVersion() + "/configuration.json")), new Gson().toJson(configuration).replaceAll(repository.getRepositoryUrl(), "<LINK_0>")); }

Target:
public void testGetConfiguration() throws Exception { TaskRepository repository = actualFixture.repository(); BugzillaRestClient client = BugzillaRestConnector.getDefault().getClient(repository); BugzillaRestConfiguration configuration = client.getConfiguration(repository, new NullOperationMonitor()); Map<String, Field> fields = client.getFields(new NullOperationMonitor()); Collection<Field> fieldCollection = fields.values(); assertConfigurationFieldNames(fieldCollection); assertEquals( IOUtils.toString(CommonTestUtil.getResource(this, "testdata/" + actualFixture.getVersion() + "/configuration.json")), new Gson().toJson(configuration).replaceAll(repository.getRepositoryUrl(), "<LINK_0>")); }
Source:
public String toString() { return "Name: " + name + " LabelNames: " + labels.keySet() + " labelValues: " + labels.values() + " Value: " + value; }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(name); if (labels != null && !labels.isEmpty()) { sb.append('{'); final Map<String, String> sortedLabels = new TreeMap<String, String>(labels); for (Map.Entry<String, String> label : sortedLabels.entrySet()) { sb.append(label.getKey()) .append('=') .append('\"') .append(escapeLabelValue(label.getValue())) .append("\","); } sb.append('}'); } sb.append(' ').append(doubleToGoString(value)); return sb.toString(); }
Source:
private static void generateHelp (File addon, String name, String icon, String intro) { if (! addon.isDirectory()) { System.out.println(addon.getAbsolutePath() + " is not a directory"); return; } File resdir = new File (addon, "resources"); File helpdir = new File (resdir, "help"); if (helpdir.isDirectory()) { System.out.println(addon.getName() + " appears to already have help, aborting."); return; } if (helpdir.mkdirs()) { System.out.println("Created " + helpdir.getAbsolutePath()); } else { System.out.println("Failed to create " + helpdir.getAbsolutePath()); } Map<String, String> tokens = new HashMap<String, String>(); tokens.put("@@name@@", name); tokens.put("@@addon@@", addon.getName()); tokens.put("@@intro@@", intro); if (icon == null) { tokens.put("@@icon@@", ""); tokens.put("@@icon-map@@", ""); tokens.put("@@icon-image@@", ""); } else { tokens.put("@@icon@@", icon); tokens.put("@@icon-map@@", "<mapID target=\"" + addon.getName() + "-icon\" url=\"contents/images/" + icon + "\" />"); tokens.put("@@icon-image@@", "image=\"" + addon.getName() + "-icon\""); } recursiveCopy(TEMPLATE_DIR, helpdir, tokens); File f = null; try { f = new File(addon, "/resources/help/contents/" + addon.getName() + ".html"); FileUtils.moveFile( new File(addon, "/resources/help/contents/addon.html"), f); } catch (IOException e) { System.out.println("Failed to move file to " + f.getAbsolutePath()); e.printStackTrace(); } }

Target:
private static void generateHelp (File addon, String name, String icon, String intro) throws IOException { if (! addon.isDirectory()) { System.out.println(addon.getAbsolutePath() + " is not a directory"); return; } File resdir = new File (addon, "resources"); File helpdir = new File (resdir, "help"); if (helpdir.isDirectory()) { System.out.println(addon.getName() + " appears to already have help, aborting."); return; } if (helpdir.mkdirs()) { System.out.println("Created " + helpdir.getAbsolutePath()); } else { System.out.println("Failed to create " + helpdir.getAbsolutePath()); return; } Map<String, String> tokens = new HashMap<String, String>(); tokens.put("@@name@@", name); tokens.put("@@addon@@", addon.getName()); tokens.put("@@intro@@", intro); if (icon == null) { tokens.put("@@icon@@", ""); tokens.put("@@icon-map@@", ""); tokens.put("@@icon-image@@", ""); } else { tokens.put("@@icon@@", icon); tokens.put("@@icon-map@@", "<mapID target=\"" + addon.getName() + "-icon\" url=\"contents/images/" + icon + "\" />"); tokens.put("@@icon-image@@", "image=\"" + addon.getName() + "-icon\""); } recursiveCopy(TEMPLATE_DIR, helpdir, tokens); File f = null; try { f = new File(addon, "/resources/help/contents/" + addon.getName() + ".html"); FileUtils.moveFile( new File(addon, "/resources/help/contents/addon.html"), f); } catch (IOException e) { System.out.println("Failed to move file to " + f.getAbsolutePath()); e.printStackTrace(); } }
Source:
public void testGetAllView() throws Exception { Set<String> expViews = new HashSet<>(Arrays.asList( "BASELINE_NODES", "INDEXES", "LOCAL_CACHE_GROUPS_IO", "LOCAL_SQL_QUERY_HISTORY", "LOCAL_SQL_RUNNING_QUERIES", "NODES", "NODE_ATTRIBUTES", "NODE_METRICS", "SCHEMAS", "TABLES" )); Set<String> actViews = new HashSet<>(); try (Connection conn = DriverManager.getConnection(BASE_URL)) { DatabaseMetaData meta = conn.getMetaData(); ResultSet rs = meta.getTables(null, null, "%", new String[]{"VIEW"}); while (rs.next()) { assertEquals("VIEW", rs.getString("TABLE_TYPE")); assertEquals(JdbcUtils.CATALOG_NAME, rs.getString("TABLE_CAT")); assertEquals(QueryUtils.SCHEMA_SYS, rs.getString("TABLE_SCHEM")); actViews.add(rs.getString("TABLE_NAME")); } assertFalse(rs.next()); assertEquals(expViews, actViews); } }

Target:
public void testGetAllView() throws Exception { Set<String> expViews = new HashSet<>(Arrays.asList( "BASELINE_NODES", "CACHES", "CACHE_GROUPS", "INDEXES", "LOCAL_CACHE_GROUPS_IO", "LOCAL_SQL_QUERY_HISTORY", "LOCAL_SQL_RUNNING_QUERIES", "NODES", "NODE_ATTRIBUTES", "NODE_METRICS", "SCHEMAS", "TABLES", "TASKS", "SERVICES" )); Set<String> actViews = new HashSet<>(); try (Connection conn = DriverManager.getConnection(BASE_URL)) { DatabaseMetaData meta = conn.getMetaData(); ResultSet rs = meta.getTables(null, null, "%", new String[]{"VIEW"}); while (rs.next()) { assertEquals("VIEW", rs.getString("TABLE_TYPE")); assertEquals(JdbcUtils.CATALOG_NAME, rs.getString("TABLE_CAT")); assertEquals(QueryUtils.SCHEMA_SYS, rs.getString("TABLE_SCHEM")); actViews.add(rs.getString("TABLE_NAME")); } assertFalse(rs.next()); assertEquals(expViews, actViews); } }
Source:
public Map<FieldName, Object> extractRawInputs(Tuple tuple) { LOG.debug("Extracting raw inputs from tuple: = [{}]", tuple); Object event = tuple.getValueByField(StreamlineEvent.STREAMLINE_EVENT); final Map<FieldName, Object> rawInputs = new LinkedHashMap<>(); if(event instanceof StreamlineEvent) { StreamlineEvent streamlineEvent = (StreamlineEvent) event; for (FieldName fieldName : getActiveFields()) { rawInputs.put(fieldName, streamlineEvent.get(fieldName.getValue())); } } else { LOG.debug("Received invalid input tuple:[{}] with streamline event:[{}] and it is not processed.", tuple, event); } LOG.debug("Raw inputs = [{}]", rawInputs); return rawInputs; }

Target:
public Map<FieldName, Object> extractRawInputs(Tuple tuple) { LOG.debug("Extracting raw inputs from tuple: = [{}]", tuple); Object event = tuple.getValueByField(StreamlineEvent.STREAMLINE_EVENT); final Map<FieldName, Object> rawInputs = new LinkedHashMap<>(); if(event instanceof StreamlineEvent) { StreamlineEvent streamlineEvent = (StreamlineEvent) event; for (FieldName fieldName : getActiveFields()) { if (streamlineEvent.containsKey(fieldName.getValue())) { rawInputs.put(fieldName, streamlineEvent.get(fieldName.getValue())); } } } else { LOG.debug("Not processing invalid input tuple:[{}] with streamline event:[{}]", tuple, event); } LOG.debug("Raw inputs = [{}]", rawInputs); return rawInputs; }
Source:
private void close(SelectionKey key) { if (key == null) { return; } SocketChannel socketChannel = channel(key); Transmissions transmissions = transmissions(key); if (transmissions != null) { logger.debug("Closing connection from {}", transmissions.connectionId); this.disconnected.add(transmissions.connectionId); this.keyMap.remove(transmissions.connectionId); activeConnections.set(this.keyMap.size()); transmissions.clearReceive(); transmissions.clearSend(); } key.attach(null); key.cancel(); try { socketChannel.socket().close(); socketChannel.close(); } catch (IOException e) { logger.error("Exception closing connection to node {}:", transmissions.connectionId, e); } this.metrics.selectorConnectionClosed.inc(); }

Target:
private void close(SelectionKey key) { SocketChannel socketChannel = channel(key); Transmissions transmissions = transmissions(key); if (transmissions != null) { logger.debug("Closing connection from {}", transmissions.connectionId); this.disconnected.add(transmissions.connectionId); this.keyMap.remove(transmissions.connectionId); activeConnections.set(this.keyMap.size()); transmissions.clearReceive(); transmissions.clearSend(); } key.attach(null); key.cancel(); try { socketChannel.socket().close(); socketChannel.close(); } catch (IOException e) { metrics.selectorCloseSocketErrorCount.inc(); logger.error("Exception closing connection to node {}:", transmissions.connectionId, e); } this.metrics.selectorConnectionClosed.inc(); }
Source:
public Builder userDataDirectory(File userDataDirectory) throws IOException { this.userDataDirectory = userDataDirectory; return this; }

Target:
public Builder userDataDirectory(File userDataDirectory) { this.userDataDirectory = userDataDirectory; return this; }
Source:
public void testProxyExpire() { CookieProxy proxy = ProxyBuilder.builder(CookieProxy.class, client.target(generateURL("/"))).build(); Response response = proxy.expire(); String res = response.readEntity(String.class); System.out.println(res); MultivaluedMap<String, String> headers = response.getStringHeaders(); System.out.println(headers.get("Set-Cookie")); Assert.assertTrue("Unexpected cookie expires:" + res, headers.get("Set-Cookie").contains(res)); response.close(); }

Target:
public void testProxyExpire() { CookieProxy proxy = ProxyBuilder.builder(CookieProxy.class, client.target(generateURL("/"))).build(); Response response = proxy.expire(); String res = response.readEntity(String.class); MultivaluedMap<String, String> headers = response.getStringHeaders(); Assert.assertTrue("Unexpected cookie expires:" + res, headers.get("Set-Cookie").contains(res)); response.close(); }
Source:
public String[] getDisabledRuntimeDetectors() { String enabledDetectors = getPreferences().get(DISABLED_DETECTORS,null); return enabledDetectors == null ? null : enabledDetectors.split(","); }

Target:
public String[] getDisabledRuntimeDetectors() { String disabledDetectors = getPreferences().get(DISABLED_DETECTORS,null); return disabledDetectors == null ? null : disabledDetectors.split(","); }
Source:
public boolean getAllCleared() { synchronized (_listTasks) { for (EntityAsyncTask task : _listTasks.values()) { if (!taskWasCleared(task)) { log.infoFormat("[within thread]: Some of the entity {0} were not cleared yet (Task {1} is in state {2}).", getContainerId(), task.getTaskID(), task.getState()); return false; } } } return true; }

Target:
public boolean getAllCleared() { synchronized (_listTasks) { for (EntityAsyncTask task : _listTasks.values()) { if (!taskWasCleared(task)) { log.infoFormat("[within thread]: Some of the tasks related to entity {0} were not cleared yet (Task {1} is in state {2}).", getContainerId(), task.getTaskID(), task.getState()); return false; } } } return true; }
Source:
public void futureDateExpression() throws ParseException { SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE MMM dd HH:mm:ss z yyyy", new Locale("test") ); Date now = new Date(); Date nowPlus10Days = new Date( now.getTime() + MILLIS_IN_A_DAY * 10 ); Date date = dateFormat.parse( fakeValuesService.expression( "#{date.future '10','TimeUnit.DAYS'}", faker )); assertThat( date.getTime(), greaterThan( now.getTime() )); assertThat( date.getTime(), lessThan( nowPlus10Days.getTime() )); }

Target:
public void futureDateExpression() throws ParseException { SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE MMM dd HH:mm:ss z yyyy"); Date now = new Date(); Date nowPlus10Days = new Date( now.getTime() + MILLIS_IN_A_DAY * 10 ); Date date = dateFormat.parse( fakeValuesService.expression( "#{date.future '10','TimeUnit.DAYS'}", faker )); assertThat( date.getTime(), greaterThan( now.getTime() )); assertThat( date.getTime(), lessThan( nowPlus10Days.getTime() )); }
Source:
public static ImmutableList<Struct> getStructsOrderedList(final ImmutableList<Struct> allStructs, final ImmutableSet<String> enumNames) throws ParseException { final Queue<Struct> structsQueue = new LinkedList<>(allStructs); final Set<String> existingStructs = new HashSet<>(); final ImmutableList.Builder<Struct> orderedStructsBuilder = ImmutableList.builder(); int skippedStructsCount = 0; while (!structsQueue.isEmpty()) { final int structsQueueSize = structsQueue.size(); final Struct structEntry = structsQueue.remove(); if (!StructHelper.requiresNewCustomParser(structEntry, existingStructs, enumNames)) { existingStructs.add(structEntry.getName()); LOG.info(structEntry.toString()); orderedStructsBuilder.add(structEntry); } else { structsQueue.add(structEntry); } if (structsQueueSize == structsQueue.size()) { skippedStructsCount++; if (skippedStructsCount == structsQueueSize) { LOG.warn("Unable to progress on remaining structs, aborting!"); LOG.warn(" Remaining structs[" + structsQueue.size() + "]"); for (final Struct struct : allStructs) { LOG.warn(" " + struct.toString() + "\n"); } throw new ParseException("Unable to parse API Contract.", 0); } } else { skippedStructsCount = 0; } } return orderedStructsBuilder.build(); }

Target:
public static ImmutableList<Struct> getStructsOrderedList(final ImmutableList<Struct> allStructs, final ImmutableSet<String> enumNames) throws ParseException { final Queue<Struct> structsQueue = new LinkedList<>(allStructs); final Set<String> existingStructs = new HashSet<>(); final ImmutableList.Builder<Struct> orderedStructsBuilder = ImmutableList.builder(); int skippedStructsCount = 0; while (!structsQueue.isEmpty()) { final int structsQueueSize = structsQueue.size(); final Struct structEntry = structsQueue.remove(); if (!StructHelper.requiresNewCustomParser(structEntry, existingStructs, enumNames)) { existingStructs.add(structEntry.getName()); LOG.info(structEntry.toString()); orderedStructsBuilder.add(structEntry); } else { structsQueue.add(structEntry); } if (structsQueueSize == structsQueue.size()) { skippedStructsCount++; if (skippedStructsCount == structsQueueSize) { LOG.warn("Unable to progress on remaining structs, aborting!"); LOG.warn(" Remaining structs[" + structsQueue.size() + "]"); for (final Struct struct : allStructs) { LOG.warn(" " + struct.toString() + "\n"); } throw new ParseException("Unable to Order provided structs.", 0); } } else { skippedStructsCount = 0; } } return orderedStructsBuilder.build(); }
Source:
public String resolve() { FilePropertyLoader fileLoaderObject = FilePropertyLoader.getFileLoaderInstance(); fileLoaderObject.setFileValue(input); String filePropertyValue = fileLoaderObject.getFileValue(); LOG.debug("resolving PropertiesFile value "+filePropertyValue); if (filePropertyValue == null) { throw new ResolverException("File Property variable could not be found"); } return filePropertyValue; }

Target:
public String resolve() { FilePropertyLoader propertyLoader = FilePropertyLoader.getInstance(); String PropertyValue = propertyLoader.getValue(input); if (LOG.isDebugEnabled()) { LOG.debug("Resolving File Property value " + PropertyValue); } if (PropertyValue == null) { throw new ResolverException("File Property variable could not be found"); } return PropertyValue; }
Source:
Mono<Response<KeyVaultKey>> createKeyWithResponse(CreateKeyOptions createKeyOptions, Context context) { Objects.requireNonNull(createKeyOptions, "The key create options parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() .setKty(createKeyOptions.getKeyType()) .setKeyOps(createKeyOptions.keyOperations()) .setKeyAttributes(new KeyRequestAttributes(createKeyOptions)); return service.createKey(endpoint, createKeyOptions.getName(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Creating key - {}", createKeyOptions.getName())) .doOnSuccess(response -> logger.info("Created key - {}", response.getValue().getName())) .doOnError(error -> logger.warning("Failed to create key - {}", createKeyOptions.getName(), error)); }

Target:
Mono<Response<KeyVaultKey>> createKeyWithResponse(CreateKeyOptions createKeyOptions, Context context) { Objects.requireNonNull(createKeyOptions, "The key create options parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() .setKty(createKeyOptions.getKeyType()) .setKeyOps(createKeyOptions.getKeyOperations()) .setKeyAttributes(new KeyRequestAttributes(createKeyOptions)); return service.createKey(vaultUrl, createKeyOptions.getName(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Creating key - {}", createKeyOptions.getName())) .doOnSuccess(response -> logger.info("Created key - {}", response.getValue().getName())) .doOnError(error -> logger.warning("Failed to create key - {}", createKeyOptions.getName(), error)); }
Source:
public void apply() throws InterruptedException { synchronized (workerThread) { final Map<K, PendingPull> pendingPulls = workerThread.pendingPulls; PendingPull pendingPull = pendingPulls.get(encodedKey.getKey()); if (pendingPull == null) { while (pendingPulls.size() >= MAX_PENDING_PULL_COUNT_PER_THREAD) { workerThread.wait(); } this.pullStartTime = ticker.read(); workerThread.pendingStat.put(pullStartTime - enqueueTime); final int requestId = workerThread.getNewRequestId(); pendingPull = new PendingPull(workerThread, encodedKey, requestId); pendingPulls.put(encodedKey.getKey(), pendingPull); sendPullMsg(encodedKey, requestId); } else { this.pullStartTime = ticker.read(); workerThread.pendingStat.put(pullStartTime - enqueueTime); } pendingPull.addPendingOp(this); } }

Target:
public void apply() throws InterruptedException { synchronized (workerThread) { final Map<K, PullRequest> pendingPullRequests = workerThread.pendingPullRequests; PullRequest pullRequest = pendingPullRequests.get(encodedKey.getKey()); if (pullRequest == null) { while (pendingPullRequests.size() >= maxPendingPullsPerThread) { workerThread.wait(); } this.pullStartTime = ticker.read(); workerThread.waitingStat.put(pullStartTime - enqueueTime); pullRequest = new PullRequest(workerThread, encodedKey, this); requestId = pullRequest.getRequestId(); pendingPullRequests.put(encodedKey.getKey(), pullRequest); sendPullMsg(encodedKey, requestId); } else { this.pullStartTime = ticker.read(); workerThread.waitingStat.put(pullStartTime - enqueueTime); pullRequest.addPendingOp(this); } } }
Source:
protected String validateURL(String url) throws MalformedURLException { if (url == null) { throw new MalformedURLException(); } if(url.equals("")) { return url; } url = url.trim(); if (url.indexOf ("://") == -1) { url = "http://" + url; } try { URL u = new URL(url); } catch (MalformedURLException e1) { try { Pattern pattern = Pattern.compile("\\s*([a-zA-Z0-9]+)://([^\\n]+)"); Matcher matcher = pattern.matcher(url); if(matcher.matches()) { URL test = new URL("http://" + matcher.group(2)); } else { throw e1; } } catch (MalformedURLException e2) { throw e1; } } return url; }

Target:
protected String validateURL(String url) throws MalformedURLException { if (url == null) { throw new MalformedURLException(); } if(url.trim().equals("")) { return url; } url = url.trim(); if (url.indexOf ("://") == -1) { url = "http://" + url; } try { URL u = new URL(url); } catch (MalformedURLException e1) { try { Pattern pattern = Pattern.compile("\\s*([a-zA-Z0-9]+)://([^\\n]+)"); Matcher matcher = pattern.matcher(url); if(matcher.matches()) { URL test = new URL("http://" + matcher.group(2)); } else { throw e1; } } catch (MalformedURLException e2) { throw e1; } } return url; }
Source:
public Page getNextPage() { try { pageId++; int currentPageSize = rcFileReader.advance(); if (currentPageSize < 0) { close(); return null; } Block[] blocks = new Block[hiveColumnIndexes.length]; for (int fieldId = 0; fieldId < blocks.length; fieldId++) { if (constantBlocks[fieldId] != null) { blocks[fieldId] = new RunLengthEncodedBlock(constantBlocks[fieldId], currentPageSize); } else { blocks[fieldId] = createBlock(currentPageSize, fieldId); } } Page page = new Page(currentPageSize, blocks); return page; } catch (PrestoException e) { closeWithSuppression(e); throw e; } catch (RcFileCorruptionException e) { closeWithSuppression(e); throw new PrestoException(HIVE_BAD_DATA, e); } catch (IOException | RuntimeException e) { closeWithSuppression(e); throw new PrestoException(HIVE_CURSOR_ERROR, e.getMessage() + ": " + rcFileReader.getDataSourceInfo(), e); } }

Target:
public Page getNextPage() { try { pageId++; int currentPageSize = rcFileReader.advance(); if (currentPageSize < 0) { close(); return null; } Block[] blocks = new Block[hiveColumnIndexes.length]; for (int fieldId = 0; fieldId < blocks.length; fieldId++) { if (constantBlocks[fieldId] != null) { blocks[fieldId] = new RunLengthEncodedBlock(constantBlocks[fieldId], currentPageSize); } else { blocks[fieldId] = createBlock(currentPageSize, fieldId); } } Page page = new Page(currentPageSize, blocks); return page; } catch (PrestoException e) { closeWithSuppression(e); throw e; } catch (RcFileCorruptionException e) { closeWithSuppression(e); throw new PrestoException(HIVE_BAD_DATA, format("Corrupted RC file: %s", rcFileReader.getId()), e); } catch (IOException | RuntimeException e) { closeWithSuppression(e); throw new PrestoException(HIVE_CURSOR_ERROR, format("Failed to read RC file: %s", rcFileReader.getId()), e); } }
Source:
public List<AndroidManifest> getAllManifests() { Set<AndroidManifest> unique = new HashSet<>(); List<AndroidManifest> list = new ArrayList<>(); addTransitiveManifests(unique, list); return list; }

Target:
public List<AndroidManifest> getAllManifests() { Set<AndroidManifest> seenManifests = new HashSet<>(); List<AndroidManifest> uniqueManifests = new ArrayList<>(); addTransitiveManifests(seenManifests, uniqueManifests); return uniqueManifests; }
Source:
public String encode(Class<?> fieldClass, long value){ initializeSalts(); String hashedValue = ""; switch (fieldClass.getTypeName()){ case "svc.models.Municipality": hashedValue = municipalityHashids.encode(value); break; case "svc.models.Judge": hashedValue = judgeHashids.encode(value); break; case "svc.models.Court": hashedValue = courtHashids.encode(value); break; } return hashedValue; }

Target:
public String encode(Class<?> fieldClass, long value){ initializeSalts(); String hashedValue = ""; switch (fieldClass.getSimpleName()){ case "Municipality": hashedValue = municipalityHashids.encode(value); break; case "Judge": hashedValue = judgeHashids.encode(value); break; case "Court": hashedValue = courtHashids.encode(value); break; } return hashedValue; }
Source:
AllProjectsCreator( GitRepositoryManager mgr, AllProjectsName allProjectsName, @GerritPersonIdent PersonIdent serverUser) { this.mgr = mgr; this.allProjectsName = allProjectsName; this.serverUser = serverUser; this.anonymous = SystemGroupBackend.getGroup(ANONYMOUS_USERS); this.registered = SystemGroupBackend.getGroup(REGISTERED_USERS); this.owners = SystemGroupBackend.getGroup(PROJECT_OWNERS); this.owners = SystemGroupBackend.getGroup(CHANGE_OWNER); }

Target:
AllProjectsCreator( GitRepositoryManager mgr, AllProjectsName allProjectsName, @GerritPersonIdent PersonIdent serverUser) { this.mgr = mgr; this.allProjectsName = allProjectsName; this.serverUser = serverUser; this.anonymous = SystemGroupBackend.getGroup(ANONYMOUS_USERS); this.registered = SystemGroupBackend.getGroup(REGISTERED_USERS); this.owners = SystemGroupBackend.getGroup(PROJECT_OWNERS); this.changeOwner = SystemGroupBackend.getGroup(CHANGE_OWNER); }
Source:
public LifecycleInjector createInjector(Stage stage, Module module) { final GovernatorFeatureSetImpl featureSet = new GovernatorFeatureSetImpl(features); final LifecycleManager manager = new LifecycleManager(); try { onBeforeInjectorCreated(); Injector injector = Guice.createInjector( stage, module, new LifecycleModule(), new LegacyScopesModule(), new AbstractModule() { @Override protected void configure() { bind(GovernatorFeatureSet.class).toInstance(featureSet); bind(LifecycleManager.class).toInstance(manager); bind(new TypeLiteral<Set<String>>() {}).annotatedWith(Profiles.class).toInstance(profiles); bind(String[].class).annotatedWith(Arguments.class).toInstance(args); requestInjection(LifecycleInjectorCreator.this); } }); manager.notifyStarted(); return LifecycleInjector.wrapInjector(injector, manager); } catch (ProvisionException|CreationException|ConfigurationException e) { LOG.error("Failed to create injector", e); try { manager.notifyStartFailed(e); } catch (Exception e2) { LOG.error("Failed to notify injector creation failure", e2 ); } if (!featureSet.get(GovernatorFeatures.SHUTDOWN_ON_ERROR)) { return LifecycleInjector.createFailedInjector(manager); } else { throw e; } } finally { onAfterInjectorCreated(); } }

Target:
public LifecycleInjector createInjector(Stage stage, Module module) { final GovernatorFeatureSetImpl featureSet = new GovernatorFeatureSetImpl(features); final LifecycleManager manager = new LifecycleManager(); try { onBeforeInjectorCreate(); Injector injector = Guice.createInjector( stage, module, new LifecycleModule(), new LegacyScopesModule(), new AbstractModule() { @Override protected void configure() { bind(GovernatorFeatureSet.class).toInstance(featureSet); bind(LifecycleManager.class).toInstance(manager); bind(new TypeLiteral<Set<String>>() {}).annotatedWith(Profiles.class).toInstance(profiles); bind(String[].class).annotatedWith(Arguments.class).toInstance(args); requestInjection(LifecycleInjectorCreator.this); } }); manager.notifyStarted(); LifecycleInjector lifecycleInjector = LifecycleInjector.wrapInjector(injector, manager); onSuccessfulInjectorCreate(); return lifecycleInjector; } catch (Exception e) { LOG.error("Failed to create injector", e); onFailedInjectorCreate(e); try { manager.notifyStartFailed(e); } catch (Exception e2) { LOG.error("Failed to notify injector creation failure", e2 ); } if (!featureSet.get(GovernatorFeatures.SHUTDOWN_ON_ERROR)) { return LifecycleInjector.createFailedInjector(manager); } else { throw e; } } finally { onCompletedInjectorCreate(); } }
Source:
public void setDefaults(ILaunchConfigurationWorkingCopy configuration, boolean isJUnit) { configuration.setAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, !isJUnit); boolean useDefaultArea = !isJUnit || LaunchArgumentsHelper.getDefaultJUnitWorkspaceIsContainer(); configuration.setAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, useDefaultArea); String location; if (isJUnit && !useDefaultArea) { location = LaunchArgumentsHelper.getDefaultJUnitConfigurationLocation(); } else { location = DEFAULT_DIR + configuration.getName(); } configuration.setAttribute(IPDELauncherConstants.CONFIG_LOCATION, location); }

Target:
public void setDefaults(ILaunchConfigurationWorkingCopy configuration, boolean isJUnit) { configuration.setAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, true); boolean useDefaultArea = !isJUnit || LaunchArgumentsHelper.getDefaultJUnitWorkspaceIsContainer(); configuration.setAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, useDefaultArea); String location; if (isJUnit && !useDefaultArea) { location = LaunchArgumentsHelper.getDefaultJUnitConfigurationLocation(); } else { location = DEFAULT_DIR + configuration.getName(); } configuration.setAttribute(IPDELauncherConstants.CONFIG_LOCATION, location); }
Source:
protected Bitmap doInBackground(String... strings) { Bitmap mIcon11 = null; String url = strings[0]; try { InputStream in = new java.net.URL(url).openStream(); mIcon11 = BitmapFactory.decodeStream(in); } catch (Exception e) { Log.e(TAG, e.getMessage()); } return mIcon11; }

Target:
protected Bitmap doInBackground(String... strings) { Bitmap mIcon11 = null; String url = strings[0]; try { InputStream in = new URL(url).openStream(); mIcon11 = BitmapFactory.decodeStream(in); } catch (IOException e) { Log.e(TAG, e.getMessage()); } return mIcon11; }
Source:
public MyOHClient(String uuid, String secret) { mUUID = uuid; mSecret = secret; mRunningRequests = new HashMap<Integer, MyOHExchange>(); mJettyClient = new HttpClient(); mJettyClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); mJettyClient.setMaxConnectionsPerAddress(200); mJettyClient.setTimeout(30000); try { mJettyClient.start(); } catch (Exception e) { logger.error("Error starting JettyClient: {}", e.getMessage()); } }

Target:
public MyOHClient(String uuid, String secret) { mUUID = uuid; mSecret = secret; mRunningRequests = new HashMap<Integer, MyOHExchange>(); mJettyClient = new HttpClient(); mJettyClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); mJettyClient.setMaxConnectionsPerAddress(HTTP_CLIENT_MAX_CONNECTOPNS_PER_ADDRESS); mJettyClient.setTimeout(HTTP_CLIENT_TIMEOUT); try { mJettyClient.start(); } catch (Exception e) { logger.error("Error starting JettyClient: {}", e.getMessage()); } }
Source:
public Void visitWindow(WindowNode node, Void context) { visitPlan(node, context); node.getWindowFunctions().values().forEach( windowModeFunction -> windowModeFunction.getFunctionCall().getArguments().forEach(Visitor::checkNotOriginalExpression)); return null; }

Target:
public Void visitWindow(WindowNode node, Void context) { visitPlan(node, context); node.getWindowFunctions().values().forEach( windowNodeFunction -> windowNodeFunction.getFunctionCall().getArguments().forEach(Visitor::checkNotOriginalExpression)); return null; }
Source:
public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException { return null; }

Target:
public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException { throw new NotYetImplementedForExchangeException(); }
Source:
public void verifyNoVideo() { if(checkIfElementOnPage(mediaNode)) throw new AssertionError("Media Node is still on the page"); else PageObjectLogging.log("verifyNoVideo", "Verified no video is on page", true, driver); }

Target:
public void verifyNoVideo() { if(checkIfElementOnPage(mediaNode)) { throw new AssertionError("Media Node is still on the page"); } else { PageObjectLogging.log("verifyNoVideo", "Verified no video is on page", true, driver); } }
Source:
public CompactJavaSerializer(ClassLoader loader, StateRepository stateRepository) { this.loader = loader; this.readLookup = stateRepository.getPersistentConcurrentMap("readLookup"); if (!readLookup.isEmpty()) { for (Entry<Integer, ObjectStreamClass> entry : readLookup.entrySet()) { if (writeLookup.putIfAbsent(new SerializableDataKey(disconnect(entry.getValue()), true), entry.getKey()) != null) { throw new AssertionError("Corrupted data " + readLookup.toString()); } } } }

Target:
public CompactJavaSerializer(ClassLoader loader, StateRepository stateRepository) { this.loader = loader; this.readLookup = stateRepository.getPersistentConcurrentMap("CompactJavaSerializer-ObjectStreamClassIndex"); for (Entry<Integer, ObjectStreamClass> entry : readLookup.entrySet()) { Integer index = entry.getKey(); if (writeLookup.putIfAbsent(new SerializableDataKey(disconnect(entry.getValue()), true), index) != null) { throw new AssertionError("Corrupted data " + readLookup); } if (nextStreamIndex.get() < index + 1) { nextStreamIndex.set(index + 1); } } }
Source:
protected Void run() throws Exception { ExtendedEmailPublisher publisher = new ExtendedEmailPublisher(); publisher.configuredTriggers.clear(); AlwaysTrigger.DescriptorImpl descriptor = Jenkins.getInstance().getDescriptorByType(AlwaysTrigger.DescriptorImpl.class); publisher.configuredTriggers.add(descriptor.createDefault()); publisher.defaultSubject = step.subject; publisher.defaultContent = step.body; publisher.attachBuildLog = step.attachLog; publisher.compressBuildLog = step.compressLog; if(StringUtils.isNotBlank(step.to)) { publisher.recipientList = step.to; } if(StringUtils.isNotBlank(step.replyTo)) { publisher.replyTo = step.replyTo; } if(StringUtils.isNotBlank(step.attachmentsPattern)) { publisher.attachmentsPattern = step.attachmentsPattern; } if(StringUtils.isNotBlank(step.mimeType)) { publisher.contentType = step.mimeType; } final ExtendedEmailPublisherContext ctx = new ExtendedEmailPublisherContext(publisher, run, workspace, launcher, listener); final Multimap<String, EmailTrigger> triggered = ArrayListMultimap.create(); triggered.put(AlwaysTrigger.TRIGGER_NAME, publisher.configuredTriggers.get(0)); ctx.setTrigger(publisher.configuredTriggers.get(0)); publisher.sendMail(ctx); return null; }

Target:
protected Void run() throws Exception { ExtendedEmailPublisher publisher = new ExtendedEmailPublisher(); publisher.configuredTriggers.clear(); AlwaysTrigger.DescriptorImpl descriptor = Jenkins.getActiveInstance().getDescriptorByType(AlwaysTrigger.DescriptorImpl.class); publisher.configuredTriggers.add(descriptor.createDefault()); publisher.defaultSubject = step.subject; publisher.defaultContent = step.body; publisher.attachBuildLog = step.attachLog; publisher.compressBuildLog = step.compressLog; if (StringUtils.isNotBlank(step.to)) { publisher.recipientList = step.to; } if (StringUtils.isNotBlank(step.replyTo)) { publisher.replyTo = step.replyTo; } if (StringUtils.isNotBlank(step.attachmentsPattern)) { publisher.attachmentsPattern = step.attachmentsPattern; } if (StringUtils.isNotBlank(step.mimeType)) { publisher.contentType = step.mimeType; } final ExtendedEmailPublisherContext ctx = new ExtendedEmailPublisherContext(publisher, run, workspace, launcher, listener); final Multimap<String, EmailTrigger> triggered = ArrayListMultimap.create(); triggered.put(AlwaysTrigger.TRIGGER_NAME, publisher.configuredTriggers.get(0)); ctx.setTrigger(publisher.configuredTriggers.get(0)); ctx.setTriggered(triggered); publisher.sendMail(ctx); return null; }
Source:
public static <T> Transformer<List<ChangeNotification<T>>, List<ChangeNotification<T>>> emitAndAggregateChanges( final Comparator<T> identityComparator, final long interval, final TimeUnit timeUnit, final Scheduler scheduler) { return new Transformer<List<ChangeNotification<T>>, List<ChangeNotification<T>>>() { @Override public Observable<List<ChangeNotification<T>>> call(final Observable<List<ChangeNotification<T>>> batchUpdates) { return batchUpdates.lift(new Operator<List<ChangeNotification<T>>, List<ChangeNotification<T>>>() { @Override public Subscriber<? super List<ChangeNotification<T>>> call(final Subscriber<? super List<ChangeNotification<T>>> subscriber) { final AtomicBoolean first = new AtomicBoolean(); final PublishSubject<List<ChangeNotification<T>>> aggregateSubject = PublishSubject.create(); return new Subscriber<List<ChangeNotification<T>>>() { @Override public void onCompleted() { subscriber.onCompleted(); } @Override public void onError(Throwable e) { subscriber.onError(e); } @Override public void onNext(List<ChangeNotification<T>> notifications) { if (!first.get()) { subscriber.onNext(collapse(notifications, identityComparator)); first.set(true); Transformer<List<ChangeNotification<T>>, List<ChangeNotification<T>>> transformer = aggregateChanges(identityComparator, interval, timeUnit, scheduler); aggregateSubject.compose(transformer).subscribe(subscriber); } else { aggregateSubject.onNext(notifications); } } }; } }); } }; }

Target:
public static <T> Transformer<List<ChangeNotification<T>>, List<ChangeNotification<T>>> emitAndAggregateChanges( final Comparator<T> identityComparator, final long interval, final TimeUnit timeUnit, final Scheduler scheduler) { return new Transformer<List<ChangeNotification<T>>, List<ChangeNotification<T>>>() { @Override public Observable<List<ChangeNotification<T>>> call(Observable<List<ChangeNotification<T>>> batchUpdates) { return batchUpdates.buffer(Observable.timer(0, interval, timeUnit, scheduler)).compose(collapseLists(identityComparator)); } }; }
Source:
public void writeBatch(Iterable<MarshalledEntry<? extends K, ? extends V>> marshalledEntries) { try { List<WriteBatch> writeBatches = new ArrayList<>(); int batchSize = 0; WriteBatch writeBatch = new WriteBatch(); for (MarshalledEntry entry : marshalledEntries) { writeBatch.put(marshall(entry.getKey()), marshall(entry)); batchSize++; if (batchSize == configuration.maxBatchSize()) { batchSize = 0; writeBatches.add(writeBatch); writeBatch = new WriteBatch(); } } if (batchSize != 0) writeBatches.add(writeBatch); semaphore.acquire(); try { if (stopped) throw new PersistenceException("RocksDB is stopped"); for (WriteBatch batch : writeBatches) db.write(dataWriteOptions(), batch); } finally { semaphore.release(); } for (MarshalledEntry entry : marshalledEntries) { InternalMetadata meta = entry.getMetadata(); if (meta != null && meta.expiryTime() > -1) addNewExpiry(entry); } } catch (Exception e) { throw new PersistenceException(e); } }

Target:
public void writeBatch(Iterable<MarshalledEntry<? extends K, ? extends V>> marshalledEntries) { try { int batchSize = 0; WriteBatch batch = new WriteBatch(); for (MarshalledEntry entry : marshalledEntries) { batch.put(marshall(entry.getKey()), marshall(entry)); batchSize++; if (batchSize == configuration.maxBatchSize()) { batchSize = 0; writeBatch(batch); batch = new WriteBatch(); } } if (batchSize != 0) writeBatch(batch); for (MarshalledEntry entry : marshalledEntries) { InternalMetadata meta = entry.getMetadata(); if (meta != null && meta.expiryTime() > -1) addNewExpiry(entry); } } catch (Exception e) { throw new PersistenceException(e); } }
Source:
public void login_and_logout() { User user = realm.signup().fullname(FULL_NAME).email(EMAIL).password(PWD).signup(NAME); jenkins.login().doLogin(user.id(), PWD); assertEquals(user, jenkins.getCurrentUser()); jenkins.logout(); try { jenkins.getCurrentUser().id(); fail("id() Should throw RuntimeException for logged-out user"); } catch (RuntimeException e) { } }

Target:
public void login_and_logout() { User user = realm.signup().fullname(FULL_NAME).email(EMAIL).password(PWD).signup(NAME); jenkins.login().doLogin(user.id(), PWD); assertEquals(user, jenkins.getCurrentUser()); jenkins.logout(); assertEquals(null, jenkins.getCurrentUser().id()); }