auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String httpGet(URL url) throws IOException { int currentTry; HttpURLConnection conn; int delaySeconds = 1; for (currentTry = 0; currentTry < NUMBER_OF_RETRIES; currentTry++) { conn = Util.getHttpConnection(url, TIMEOUT); try (BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()))) { if (conn.getResponseCode() != HTTP_OK) { log.warn("HTTP error fetching url {}. Returned status code {}", url.toString(), conn.getResponseCode()); throw new IOException(String.format("HTTP error fetching url %s. Returned status code %d", url.toString(), conn.getResponseCode())); } else { return br.lines().collect(Collectors.joining()); } } catch (Exception e) { try { Thread.sleep(TimeUnit.SECONDS.toMillis(delaySeconds)); delaySeconds = delaySeconds * BACKOFF_MULTIPLIER; } catch (InterruptedException ignored) { } } } throw new IOException("Could not get a response from the container heartbeat endpoint"); }

Target:
String httpGet(URL url) throws IOException { HttpURLConnection conn; int delayMillis = 1000; for (int currentTry = 0; currentTry < NUM_RETRIES; currentTry++) { conn = Util.getHttpConnection(url, TIMEOUT_MS); try (BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()))) { if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) { throw new IOException(String.format("HTTP error fetching url %s. Returned status code %d", url.toString(), conn.getResponseCode())); } else { return br.lines().collect(Collectors.joining()); } } catch (Exception e) { LOG.error("Error in heartbeat request", e); sleepUninterruptibly(delayMillis); delayMillis = delayMillis * BACKOFF_MULTIPLIER; } } throw new IOException(String.format("Error fetching url: %s. Tried %d time(s).", url.toString(), NUM_RETRIES)); }
Source:
public Iterable<Template> listImages() { Set<String> projects = ImmutableSet.copyOf(transform(projectSupplier.get().values(), new Function<Project, String>() { @Override public String apply(Project project) { return project.getId(); } })); return filter(concat(transform(ImmutableSet.<String> builder().addAll(projects).add("").build(), allTemplatesForProject())), isReady()); }

Target:
public Iterable<Template> listImages() { TemplateApi templateApi = client.getTemplateApi(); ImmutableSet.Builder<Template> templates = ImmutableSet.builder(); templates.addAll(templateApi.listTemplates()); for (String project : projectSupplier.get().keySet()) { templates.addAll(templateApi.listTemplates(ListTemplatesOptions.Builder.projectId(project))); } return filter(templates.build(), isReady()); }
Source:
public void execute(final Object message) throws Exception { final MediaGroupResponse<CollectedResult> asrResponse = (MediaGroupResponse<CollectedResult>) message; final List<NameValuePair> parameters = parameters(); parameters.add(new BasicNameValuePair("UnstableSpeechResult", asrResponse.get().getResult())); final NotificationsDao notifications = storage.getNotificationsDao(); execHttpRequest(notifications, verb.attribute(GatherAttributes.ATTRIBUTE_PARTIAL_RESULT_CALLBACK), verb.attribute(GatherAttributes.ATTRIBUTE_PARTIAL_RESULT_CALLBACK_METHOD), parameters); }

Target:
public void execute(final Object message) throws Exception { if (verb.attribute(GatherAttributes.ATTRIBUTE_PARTIAL_RESULT_CALLBACK) != null && !StringUtils.isEmpty(verb.attribute(GatherAttributes.ATTRIBUTE_PARTIAL_RESULT_CALLBACK).value())) { final MediaGroupResponse<CollectedResult> asrResponse = (MediaGroupResponse<CollectedResult>) message; final List<NameValuePair> parameters = parameters(); parameters.add(new BasicNameValuePair("UnstableSpeechResult", asrResponse.get().getResult())); final NotificationsDao notifications = storage.getNotificationsDao(); execHttpRequest(notifications, verb.attribute(GatherAttributes.ATTRIBUTE_PARTIAL_RESULT_CALLBACK), verb.attribute(GatherAttributes.ATTRIBUTE_PARTIAL_RESULT_CALLBACK_METHOD), parameters); } }
Source:
private MessageInfo delete(MockId idToDelete) throws StoreException { MessageInfo putMsgInfo = allKeys.get(idToDelete).getFirst(); MessageInfo info = new MessageInfo(idToDelete, DELETE_RECORD_SIZE, putMsgInfo.getAccountId(), putMsgInfo.getContainerId(), Utils.Infinite_Time); ByteBuffer buffer = ByteBuffer.allocate(DELETE_RECORD_SIZE); store.delete(new MockMessageWriteSet(Collections.singletonList(info), Collections.singletonList(buffer))); deletedKeys.add(idToDelete); return info; }

Target:
private MessageInfo delete(MockId idToDelete) throws StoreException { MessageInfo putMsgInfo = allKeys.get(idToDelete).getFirst(); MessageInfo info = new MessageInfo(idToDelete, DELETE_RECORD_SIZE, putMsgInfo.getAccountId(), putMsgInfo.getContainerId(), time.milliseconds()); ByteBuffer buffer = ByteBuffer.allocate(DELETE_RECORD_SIZE); store.delete(new MockMessageWriteSet(Collections.singletonList(info), Collections.singletonList(buffer))); deletedKeys.add(idToDelete); return info; }
Source:
public void renameSupplementaryFolder(String newName) { IFolder oldSupplFolder = getTraceSupplementaryFolder(getResourceName()); IFolder newSupplFolder = getTraceSupplementaryFolder(newName + getSuffix()); if (oldSupplFolder.exists()) { try { oldSupplFolder.move(newSupplFolder.getFullPath(), true, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError("Error renaming supplementary folder " + oldSupplFolder, e); } } }

Target:
public void renameSupplementaryFolder(String newName) { IFolder oldSupplFolder = getTraceSupplementaryFolder(getResourceName()); IFolder newSupplFolder = getTraceSupplementaryFolder(newName + getSuffix()); if (oldSupplFolder.exists()) { try { oldSupplFolder.move(newSupplFolder.getFullPath(), true, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError(Messages.TmfCommonProjectElement_ErrorRenamingSF + oldSupplFolder, e); } } }
Source:
public void preStart() throws Exception { super.preStart(); final String actorName = getSelf().path().name(); final Optional<JobRef<?>> ref = _refSerializer.entityIDtoJobRef(actorName); if (ref.isPresent()) { final JobRef<T> castRef = unsafeJobRefCast(ref.get()); LOGGER.info() .setMessage("inferred job ref from name, triggering reload") .addData("jobRef", castRef.toString()) .log(); reload(new Reload.Builder<T>().setJobRef(castRef).build()); return; } LOGGER.warn() .setMessage("could not infer job ref from name, refSerializer could be configured incorrectly.") .addData("actorName", actorName) .log(); }

Target:
public void preStart() throws Exception { super.preStart(); final String actorName = getSelf().path().name(); try { final JobRef<T> ref = unsafeJobRefCast(_refDeserializer.deserialize(actorName)); LOGGER.info() .setMessage("inferred job ref from name, triggering reload") .addData("jobRef", ref.toString()) .log(); getSelf().tell(new Reload.Builder<T>().setJobRef(ref).build(), getSelf()); } catch (final DeserializationException e) { LOGGER.warn() .setMessage("could not infer job ref from name, the actor could have been started incorrectly.") .setThrowable(e) .addData("actorName", actorName) .log(); killSelf(); } }
Source:
public void testRebalanceWithFirstNodeStop() throws Exception { try { verifyRebalanceWith3rdNode(); setAttribute(provider(0), LOCAL_TOPOLOGY_MANAGER, REBALANCE_ENABLED_ATTR_NAME, false); controller.stop(CONTAINER1); checkRpcManagerStatistics(new String[]{"N/A", OWNERS_2_MEMBERS_NODE2_NODE3}, OWNERS_2_MEMBERS_NODE2_NODE3, provider(1), provider(2)); checkRebalanceStatus(false, provider(1), provider(2)); assertTrue(numEntries(server2, HOTROD_CACHE_NAME) < NUMBER_ENTRIES); assertTrue(numEntries(server3, HOTROD_CACHE_NAME) < NUMBER_ENTRIES); assertTrue(numEntries(server2, MEMCACHED_CACHE_NAME) < NUMBER_ENTRIES); assertTrue(numEntries(server3, MEMCACHED_CACHE_NAME) < NUMBER_ENTRIES); setAttribute(provider(1), LOCAL_TOPOLOGY_MANAGER, REBALANCE_ENABLED_ATTR_NAME, true); checkRebalanceStatus(true, provider(1), provider(2)); checkRpcManagerStatistics(new String[]{"N/A", OWNERS_2_MEMBERS_NODE2_NODE3}, OWNERS_2_MEMBERS_NODE2_NODE3, provider(1), provider(2)); assertTrue(numEntries(server2, HOTROD_CACHE_NAME) == NUMBER_ENTRIES); assertTrue(numEntries(server3, HOTROD_CACHE_NAME) == NUMBER_ENTRIES); assertTrue(numEntries(server2, MEMCACHED_CACHE_NAME) == NUMBER_ENTRIES); assertTrue(numEntries(server3, MEMCACHED_CACHE_NAME) == NUMBER_ENTRIES); } finally { controller.stop(CONTAINER3); } }

Target:
public void testRebalanceWithFirstNodeStop() throws Exception { try { verifyRebalanceWith3rdNode(); setAttribute(provider(0), LOCAL_TOPOLOGY_MANAGER, REBALANCE_ENABLED_ATTR_NAME, false); controller.stop(CONTAINER1); checkRpcManagerStatistics(new String[]{"null", OWNERS_2_MEMBERS_NODE2_NODE3}, OWNERS_2_MEMBERS_NODE2_NODE3, provider(1), provider(2)); checkRebalanceStatus(false, provider(1), provider(2)); assertTrue(numEntries(server2, HOTROD_CACHE_NAME) < NUMBER_ENTRIES); assertTrue(numEntries(server3, HOTROD_CACHE_NAME) < NUMBER_ENTRIES); assertTrue(numEntries(server2, MEMCACHED_CACHE_NAME) < NUMBER_ENTRIES); assertTrue(numEntries(server3, MEMCACHED_CACHE_NAME) < NUMBER_ENTRIES); setAttribute(provider(1), LOCAL_TOPOLOGY_MANAGER, REBALANCE_ENABLED_ATTR_NAME, true); checkRebalanceStatus(true, provider(1), provider(2)); checkRpcManagerStatistics(new String[]{"null", OWNERS_2_MEMBERS_NODE2_NODE3}, OWNERS_2_MEMBERS_NODE2_NODE3, provider(1), provider(2)); assertTrue(numEntries(server2, HOTROD_CACHE_NAME) == NUMBER_ENTRIES); assertTrue(numEntries(server3, HOTROD_CACHE_NAME) == NUMBER_ENTRIES); assertTrue(numEntries(server2, MEMCACHED_CACHE_NAME) == NUMBER_ENTRIES); assertTrue(numEntries(server3, MEMCACHED_CACHE_NAME) == NUMBER_ENTRIES); } finally { controller.stop(CONTAINER3); } }
Source:
private boolean checkForDeterministicAndRerunTestQueriesIfNeeded() { int hashPartitionCount = defaultHashPartitionCount; if (sessionProperties.containsKey(HASH_PARTITION_COUNT) && sessionProperties.get(HASH_PARTITION_COUNT) != null) { hashPartitionCount = Integer.parseInt(sessionProperties.get(HASH_PARTITION_COUNT)); } if (hashPartitionCount > 1) { hasNewSessionProperties = true; Map<String, String> mutableCopy = new HashMap<>(sessionProperties); mutableCopy.put(HASH_PARTITION_COUNT, String.valueOf(hashPartitionCount - 1)); sessionPropertiesTemp = ImmutableMap.copyOf(mutableCopy); } for (int i = 0; i < 3; i++) { QueryResult results = executeQueryControl(); if (results.getState() != State.SUCCESS) { return false; } if (!resultsMatch(controlResult, results, precision)) { deterministic = false; return false; } } for (int i = 0; i < 3; i++) { testResult = executeQueryTest(); if (testResult.getState() != State.SUCCESS) { return false; } if (!resultsMatch(controlResult, testResult, precision)) { return false; } } return true; }

Target:
private boolean checkForDeterministicAndRerunTestQueriesIfNeeded() { int hashPartitionCount = defaultHashPartitionCount; Map<String, String> sessionPropertiesOverride = null; if (sessionProperties.get(HASH_PARTITION_COUNT) != null) { hashPartitionCount = Integer.parseInt(sessionProperties.get(HASH_PARTITION_COUNT)); } if (hashPartitionCount > 1) { sessionPropertiesOverride = new HashMap<>(sessionProperties); sessionPropertiesOverride.put(HASH_PARTITION_COUNT, String.valueOf(hashPartitionCount - 1)); } for (int i = 0; i < 3; i++) { QueryResult results = executeQueryControl(sessionPropertiesOverride); if (results.getState() != State.SUCCESS) { return false; } if (!resultsMatch(controlResult, results, precision)) { deterministic = false; return false; } } for (int i = 0; i < 3; i++) { testResult = executeQueryTest(sessionPropertiesOverride); if (testResult.getState() != State.SUCCESS) { return false; } if (!resultsMatch(controlResult, testResult, precision)) { return false; } } return true; }
Source:
public void start() throws InstantiationException { logger.info("Netty server starting up"); bossGroup = new NioEventLoopGroup(serverConfig.getBossThreadCount()); workerGroup = new NioEventLoopGroup(serverConfig.getWorkerThreadCount()); try { AtomicReference<Exception> startupException = new AtomicReference<Exception>(); NettyServerDeployer nettyServerDeployer = new NettyServerDeployer(startupException); Thread deploymentThread = new Thread(nettyServerDeployer); deploymentThread.start(); long startWaitSecs = serverConfig.getStartupWaitSeconds(); if (!(nettyServerDeployer.awaitStartup(startWaitSecs, TimeUnit.SECONDS))) { throw new InstantiationException("Netty server failed to start in " + startWaitSecs + " seconds"); } else if (startupException.get() != null) { throw new InstantiationException("Netty server start failed - " + startupException.get()); } } catch (InterruptedException e) { logger.error("Netty server start might have failed - " + e); throw new InstantiationException("Netty server start might have failed - " + e); } }

Target:
public void start() throws InstantiationException { if (!nettyServerDeployerThread.isAlive()) { logger.info("Starting NettyServer.."); try { nettyServerDeployerThread.start(); if (!(nettyServerDeployer.awaitStartup(nettyConfig.nettyServerStartupWaitSeconds, TimeUnit.SECONDS))) { throw new InstantiationException( "NettyServer failed to start in " + nettyConfig.nettyServerStartupWaitSeconds + " seconds"); } else if (nettyServerDeployer.getException() != null) { throw new InstantiationException("NettyServer start failed - " + nettyServerDeployer.getException()); } } catch (InterruptedException e) { logger.error("NettyServer start await was interrupted. It might not have started", e); throw new InstantiationException("Netty server start might have failed - " + e); } } }
Source:
public void createProject() throws ProjectCreationFailedException { validateParameters(); try { final Project.NameKey nameKey = createProjectArgs.getProject(); final String head = createProjectArgs.permissionsOnly ? GitRepositoryManager.REF_CONFIG : createProjectArgs.branch; final Repository repo = repoManager.createRepository(nameKey); try { rq.replicateNewProject(nameKey, head); final RefUpdate u = repo.updateRef(Constants.HEAD); u.disableRefLog(); u.link(head); createProjectConfig(); if (!createProjectArgs.permissionsOnly && createProjectArgs.createEmptyCommit) { createEmptyCommit(repo, nameKey, createProjectArgs.branch); } } finally { repo.close(); } } catch (IllegalStateException e) { handleRepositoryExistsException(createProjectArgs.getProject(), e); } catch (RepositoryCaseMismatchException ee) { handleRepositoryExistsException(ee.getNameOfExistingProject(), ee); } catch (Exception e) { throw new ProjectCreationFailedException("Cannot create " + createProjectArgs.getProject(), e); } }

Target:
public void createProject() throws ProjectCreationFailedException { validateParameters(); try { final Project.NameKey nameKey = createProjectArgs.getProject(); final String head = createProjectArgs.permissionsOnly ? GitRepositoryManager.REF_CONFIG : createProjectArgs.branch; final Repository repo = repoManager.createRepository(nameKey); try { rq.replicateNewProject(nameKey, head); final RefUpdate u = repo.updateRef(Constants.HEAD); u.disableRefLog(); u.link(head); createProjectConfig(); if (!createProjectArgs.permissionsOnly && createProjectArgs.createEmptyCommit) { createEmptyCommit(repo, nameKey, createProjectArgs.branch); } } finally { repo.close(); } } catch (IllegalStateException e) { handleRepositoryExistsException(createProjectArgs.getProject(), e); } catch (RepositoryCaseMismatchException ee) { handleRepositoryExistsException(ee.getNameOfExistingProject(), ee); } catch (Exception e) { final String msg = "Cannot create " + createProjectArgs.getProject(); log.error(msg, e); throw new ProjectCreationFailedException(msg, e); } }
Source:
public void testCommitNrt() throws Exception { final String metacardTitle = "testCommitNrt"; deleteAll(provider); MetacardType nrtMetacardType = new MetacardTypeImpl( COMMIT_NRT_TYPE, MetacardImpl.BASIC_METACARD.getAttributeDescriptors()); MockMetacard metacard = new MockMetacard(Library.getFlagstaffRecord(), nrtMetacardType); metacard.setTitle(metacardTitle); CreateResponse createResponse = create(metacard, provider); Optional<String> id = createResponse.getCreatedMetacards().stream().map(Metacard::getId).findFirst(); if (!id.isPresent()) { Assert.fail("Metacard creation failed for metacard with title: " + metacardTitle); } RetryPolicy policy = new RetryPolicy() .retryIf((SourceResponse response) -> response.getResults().size() == 0) .withDelay(100, TimeUnit.MILLISECONDS) .withMaxDuration(30, TimeUnit.SECONDS); Query query = new QueryImpl( getFilterBuilder().attribute(Metacard.TITLE).is().equalTo().text(metacardTitle)); QueryRequest request = new QueryRequestImpl(query); SourceResponse response = Failsafe.with(policy).get(() -> provider.query(request)); assertThat(response.getResults().size()).isEqualTo(1); }

Target:
public void testCommitNrt() throws Exception { final String nrtTitle = "testCommitNrt"; final String nonNrtTitle = "testCommitNonNrt"; deleteAll(provider); MetacardType nrtMetacardType = new MetacardTypeImpl( COMMIT_NRT_TYPE, MetacardImpl.BASIC_METACARD.getAttributeDescriptors()); MockMetacard nrtMetacard = new MockMetacard(Library.getFlagstaffRecord(), nrtMetacardType); nrtMetacard.setTitle(nrtTitle); MockMetacard nonNrtMetacard = new MockMetacard(Library.getFlagstaffRecord()); nonNrtMetacard.setTitle(nonNrtTitle); create(Lists.newArrayList(nrtMetacard, nonNrtMetacard), provider); QueryRequest request = new QueryRequestImpl( new QueryImpl( getFilterBuilder().attribute(Metacard.TITLE).is().like().text("testCommit*Nrt"))); await() .pollInterval(100, TimeUnit.MILLISECONDS) .atMost(30, TimeUnit.SECONDS) .until(() -> provider.query(request).getResults().size() == 2); }
Source:
private OnHeapValueHolder<V> newCreateValueHolder(K key, V value, long now, StoreEventSink<K, V> eventSink) { Objects.requireNonNull(value); Duration duration = ExpiryUtils.getExpiryForCreation(key, value, expiry); if(duration == null) { return null; } long expirationTime = isExpiryDurationInfinite(duration) ? ValueHolder.NO_EXPIRE : ExpiryUtils.getExpirationMillis(now, duration); OnHeapValueHolder<V> holder = null; try { holder = makeValue(key, value, now, expirationTime, this.valueCopier); eventSink.created(key, value); } catch (LimitExceededException e) { LOG.warn(e.getMessage()); } return holder; }

Target:
private OnHeapValueHolder<V> newCreateValueHolder(K key, V value, long now, StoreEventSink<K, V> eventSink) { Objects.requireNonNull(value); Duration duration = ExpiryUtils.getExpiryForCreation(key, value, expiry); if(duration.isZero()) { return null; } long expirationTime = isExpiryDurationInfinite(duration) ? ValueHolder.NO_EXPIRE : ExpiryUtils.getExpirationMillis(now, duration); OnHeapValueHolder<V> holder = null; try { holder = makeValue(key, value, now, expirationTime, this.valueCopier); eventSink.created(key, value); } catch (LimitExceededException e) { LOG.warn(e.getMessage()); } return holder; }
Source:
private void handleFlowControlEvent(String key, Payload payload, FlowParameters flowParameters, String flowChainId) throws TransactionExecutionException { String flowId = flowParameters.getFlowId(); LOGGER.debug("flow control event arrived: key: {}, flowid: {}, usercrn: {}, payload: {}", key, flowId, flowParameters.getFlowTriggerUserCrn(), payload); Flow flow = runningFlows.get(flowId); if (flow != null) { MutableBoolean isFlowCancelled = new MutableBoolean(false); transactionService.required(() -> { Optional<FlowLog> lastFlowLog = flowLogService.getLastFlowLog(flow.getFlowId()); lastFlowLog.ifPresent(flowLog -> { String nodeId = nodeConfig.getId(); if (flowLog.getCloudbreakNodeId() == null || flowLog.getCloudbreakNodeId().equals(nodeId)) { updateFlowLogStatus(key, payload, flowChainId, flow, flowLog, flowParameters); } else { LOGGER.warn("Flow was handled by another node {}, current node ID is {}, abandoning.", flow.getFlowId(), flowLog.getCloudbreakNodeId(), nodeId); inMemoryCleanup.cancelFlowWithoutDbUpdate(flow.getFlowId()); isFlowCancelled.setTrue(); } }); }); if (!isFlowCancelled.booleanValue()) { flow.sendEvent(key, flowParameters.getFlowTriggerUserCrn(), payload, flowParameters.getSpanContext()); } } else { LOGGER.debug("Cancelled flow finished running. Stack ID {}, flow ID {}, event {}", payload.getResourceId(), flowId, key); } }

Target:
private void handleFlowControlEvent(String key, Payload payload, FlowParameters flowParameters, String flowChainId) throws TransactionExecutionException { String flowId = flowParameters.getFlowId(); LOGGER.debug("flow control event arrived: key: {}, flowid: {}, usercrn: {}, payload: {}", key, flowId, flowParameters.getFlowTriggerUserCrn(), payload); Flow flow = runningFlows.get(flowId); if (flow != null) { MutableBoolean flowCancelled = new MutableBoolean(false); transactionService.required(() -> { Optional<FlowLog> lastFlowLog = flowLogService.getLastFlowLog(flow.getFlowId()); lastFlowLog.ifPresent(flowLog -> { String nodeId = nodeConfig.getId(); if (flowLog.getCloudbreakNodeId() == null || flowLog.getCloudbreakNodeId().equals(nodeId)) { updateFlowLogStatus(key, payload, flowChainId, flow, flowLog, flowParameters); } else { LOGGER.info("Flow was handled by another node {}, current node ID is {}, abandoning.", flow.getFlowId(), flowLog.getCloudbreakNodeId(), nodeId); inMemoryCleanup.cancelFlowWithoutDbUpdate(flow.getFlowId()); flowCancelled.setTrue(); } }); }); if (!flowCancelled.booleanValue()) { flow.sendEvent(key, flowParameters.getFlowTriggerUserCrn(), payload, flowParameters.getSpanContext()); } } else { LOGGER.debug("Cancelled flow finished running. Stack ID {}, flow ID {}, event {}", payload.getResourceId(), flowId, key); } }
Source:
public IndexedMultiValue<IndexedInts> get() { return new CompressedVSizeIndexed(offsetSupplier.get(), valueSupplier.get()); }

Target:
public IndexedMultivalue<IndexedInts> get() { return new CompressedVSizeIndexed(offsetSupplier.get(), valueSupplier.get()); }
Source:
public RaygunEnvironmentMessage() { try { OperatingSystemMXBean osMXBean = ManagementFactory.getOperatingSystemMXBean(); com.sun.management.OperatingSystemMXBean sunMxBean = (com.sun.management.OperatingSystemMXBean) osMXBean; architecture = sunMxBean.getArch(); processorCount = Runtime.getRuntime().availableProcessors(); windowBoundsWidth = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().width; windowBoundsHeight = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().height; locale = Locale.getDefault().getLanguage() + "-" + Locale.getDefault().getCountry(); utcOffset = Calendar.getInstance().getTimeZone().getOffset(Calendar.getInstance().getTimeInMillis()) / 3600000; availablePhysicalMemory = sunMxBean.getFreePhysicalMemorySize(); totalPhysicalMemory = sunMxBean.getTotalPhysicalMemorySize(); totalVirtualMemory = sunMxBean.getTotalSwapSpaceSize(); availableVirtualMemory = sunMxBean.getFreeSwapSpaceSize(); processorCount = sunMxBean.getAvailableProcessors(); osVersion = sunMxBean.getName() + " - " +sunMxBean.getVersion(); } catch (Exception e) { } }

Target:
public RaygunEnvironmentMessage() { try { OperatingSystemMXBean osMXBean = ManagementFactory.getOperatingSystemMXBean(); com.sun.management.OperatingSystemMXBean sunMxBean = (com.sun.management.OperatingSystemMXBean) osMXBean; architecture = sunMxBean.getArch(); processorCount = Runtime.getRuntime().availableProcessors(); windowBoundsWidth = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().width; windowBoundsHeight = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().height; locale = Locale.getDefault().getLanguage() + "-" + Locale.getDefault().getCountry(); utcOffset = TimeZone.getDefault().getRawOffset() / 3600000.0; availablePhysicalMemory = sunMxBean.getFreePhysicalMemorySize(); totalPhysicalMemory = sunMxBean.getTotalPhysicalMemorySize(); totalVirtualMemory = sunMxBean.getTotalSwapSpaceSize(); availableVirtualMemory = sunMxBean.getFreeSwapSpaceSize(); processorCount = sunMxBean.getAvailableProcessors(); osVersion = sunMxBean.getName() + " - " +sunMxBean.getVersion(); } catch (Exception e) { } }
Source:
protected void finishWrite() throws Exception { sequenceFile.hflush(); sequenceFile.close(); super.finishWrite(); LOG.info("Closing writer with " + counter.get() + " items"); }

Target:
protected void finishWrite() throws Exception { sequenceFile.hflush(); sequenceFile.close(); super.finishWrite(); LOG.debug("Closing writer with " + counter.get() + " items"); }
Source:
public static void validateCacheName(String name) throws IllegalArgumentException { A.ensure(name != null && !name.isEmpty(), "Cache name must not be null or empty."); A.ensure(name.length() <= MAX_FILE_NAME_LENGTH, "Length of cache name can not exceed "+ MAX_FILE_NAME_LENGTH +"."); }

Target:
public static void validateCacheName(String name) throws IllegalArgumentException { A.ensure(name != null && !name.isEmpty(), "Cache name must not be null or empty."); A.ensure(name.length() <= CACHE_NAME_MAX_LENGTH, "Length of cache name can not exceed " + CACHE_NAME_MAX_LENGTH + "."); }
Source:
private KeyStore saveSecretsStore(final KeyStore keyStore) { final File secretStoreFile = new File(secretsKeyStorePath); final File secretStoreFileTmp = new File(secretStoreFile.getParent(), "dotSecretsStore_" + System.currentTimeMillis() + ".p12.tmp"); secretStoreFileTmp.getParentFile().mkdirs(); try (OutputStream fos = Files.newOutputStream(secretStoreFileTmp.toPath())) { keyStore.store(fos, loadStorePassword()); FileUtil.copyFile(secretStoreFileTmp, secretStoreFile); secretStoreFileTmp.delete(); } catch (Exception e) { Logger.warn(this.getClass(), "unable to save secrets store " + secretStoreFileTmp + ": " + e); throw new DotRuntimeException(e); } return keyStore; }

Target:
private KeyStore saveSecretsStore(final KeyStore keyStore) { final File secretStoreFile = new File(secretsKeyStorePath); final File secretStoreFileTmp = new File(secretStoreFile.getParent(), "dotSecretsStore_" + System.currentTimeMillis() + ".p12.tmp"); secretStoreFileTmp.getParentFile().mkdirs(); try (OutputStream fos = Files.newOutputStream(secretStoreFileTmp.toPath())) { keyStore.store(fos, loadStorePassword()); FileUtil.copyFile(secretStoreFileTmp, secretStoreFile); secretStoreFileTmp.delete(); } catch (Exception e) { Logger.error(this.getClass(), "unable to save secrets store " + secretStoreFileTmp + ": " + e); throw new DotRuntimeException(e); } return keyStore; }
Source:
public void parseArguments(List<String> args) throws Exception { args.remove(0); ArgumentsParser parser; try (InputStream stream = getClass().getResourceAsStream("arguments.properties")) { parser = new ArgumentsParser(stream, "module"); } parser.parse(args); moduleArgs = parser.getArgMap(); if((Boolean)moduleArgs.get("help")) { printUsage(parser); throw new ExitException("Help", 0); } if(args.size() < 1) { logger.error("Please provide action."); throw new ExitException("Action not provided", 1); } String action = args.remove(0); actionMethod = actions.get(action); if(actionMethod == null) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } try (InputStream stream = getClass().getResourceAsStream("arguments.properties")) { parser = new ArgumentsParser(stream, action); } parser.parse(args); actionArgs = parser.getArgMap(); List<Throwable> actionErrors = parser.getErrors(); if((Boolean)actionArgs.get("help")) { printUsage(parser); throw new ExitException("Help", 0); } else if(!actionErrors.isEmpty()) { for(Throwable t : actionErrors) { logger.error(t.getMessage()); logger.debug(t.getMessage(), t); } throw new ExitException("Parsing error", 1); } logger.debug( "Using action arguments: extension-name='{}' message='{}' level={}", actionArgs.get("extension-name"), actionArgs.get("message"), actionArgs.get("level") ); }

Target:
public void parseArguments(List<String> args) throws Exception { args.remove(0); ArgumentsParser parser; try (InputStream stream = getClass().getResourceAsStream("arguments.properties")) { parser = new ArgumentsParser(stream, "module"); } parser.parse(args); moduleArgs = parser.getParsedArgs(); if((Boolean)moduleArgs.get("help")) { printUsage(parser); throw new ExitException("Help", 0); } if(!parser.getErrors().isEmpty()) { for(Throwable t : parser.getErrors()) { logger.error(t.getMessage()); logger.debug(t.getMessage(), t); } throw new ExitException("Parsing error", 1); } if(args.size() < 1) { logger.error("Please provide action."); throw new ExitException("Action not provided", 1); } String action = args.remove(0); actionMethod = actions.get(action); if(actionMethod == null) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } try (InputStream stream = getClass().getResourceAsStream("arguments.properties")) { parser = new ArgumentsParser(stream, action); } parser.parse(args); actionArgs = parser.getParsedArgs(); if((Boolean)actionArgs.get("help")) { printUsage(parser); throw new ExitException("Help", 0); } if(!parser.getErrors().isEmpty()) { for(Throwable t : parser.getErrors()) { logger.error(t.getMessage()); logger.debug(t.getMessage(), t); } throw new ExitException("Parsing error", 1); } logger.debug( "Using action arguments: extension-name='{}' message='{}' level={}", actionArgs.get("extension-name"), actionArgs.get("message"), actionArgs.get("level") ); }
Source:
void initTable(final ApplicationConstants constants) { getTable().addColumn(new HostStatusColumn(), constants.empty(), "30px"); TextColumnWithTooltip<VDS> nameColumn = new TextColumnWithTooltip<VDS>() { @Override public String getValue(VDS object) { return object.getvds_name(); } }; getTable().addColumn(nameColumn, constants.nameClusterHost()); TextColumnWithTooltip<VDS> hostColumn = new TextColumnWithTooltip<VDS>() { @Override public String getValue(VDS object) { return object.gethost_name(); } }; getTable().addColumn(hostColumn, constants.hostIpClusterHost()); TextColumnWithTooltip<VDS> statusColumn = new EnumColumn<VDS, VDSStatus>() { @Override public VDSStatus getRawValue(VDS object) { return object.getstatus(); } }; getTable().addColumn(statusColumn, constants.statusClusterHost()); if (ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) { TextColumnWithTooltip<VDS> loadColumn = new TextColumnWithTooltip<VDS>() { @Override public String getValue(VDS object) { return object.getvm_active() + " " + constants.vmsClusterHost(); } }; getTable().addColumn(loadColumn, constants.loadClusterHost()); } }

Target:
void initTable(final ApplicationConstants constants) { getTable().addColumn(new HostStatusColumn(), constants.empty(), "30px"); TextColumnWithTooltip<VDS> nameColumn = new TextColumnWithTooltip<VDS>() { @Override public String getValue(VDS object) { return object.getvds_name(); } }; getTable().addColumn(nameColumn, constants.nameClusterHost()); TextColumnWithTooltip<VDS> hostColumn = new TextColumnWithTooltip<VDS>() { @Override public String getValue(VDS object) { return object.gethost_name(); } }; getTable().addColumn(hostColumn, constants.hostIpClusterHost()); TextColumnWithTooltip<VDS> statusColumn = new EnumColumn<VDS, VDSStatus>() { @Override public VDSStatus getRawValue(VDS object) { return object.getstatus(); } }; getTable().addColumn(statusColumn, constants.statusClusterHost()); if (ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)) { TextColumnWithTooltip<VDS> loadColumn = new TextColumnWithTooltip<VDS>() { @Override public String getValue(VDS object) { return object.getvm_active() + " " + constants.vmsClusterHost(); } }; getTable().addColumn(loadColumn, constants.loadClusterHost()); } }
Source:
protected void traceAddAnnotation(Event event, Tracer tracer, long elapsed, String listener) { Map<String, AttributeValue> attributes = new HashMap<>(); attributes.put("event", AttributeValue.stringAttributeValue(event.getName())); attributes.put("listener", AttributeValue.stringAttributeValue(listener)); attributes.put("duration_ms", AttributeValue.longAttributeValue(elapsed)); EventContext eventContext = event.getContext(); if (eventContext instanceof DocumentEventContext) { DocumentEventContext docContext = ((DocumentEventContext) eventContext); if (docContext.getSourceDocument() != null) { Path docPath = docContext.getSourceDocument().getPath(); if (docPath != null) { attributes.put("doc", AttributeValue.stringAttributeValue(docPath.toString())); } String id = docContext.getSourceDocument().getId(); if (id != null) { attributes.put("doc_id", AttributeValue.stringAttributeValue(docContext.getSourceDocument().getId())); } } } tracer.getCurrentSpan().addAnnotation("Event fired", attributes); }

Target:
protected void traceAddAnnotation(Event event, Tracer tracer, long elapsed, String listener) { Map<String, AttributeValue> attributes = new HashMap<>(); attributes.put("event", AttributeValue.stringAttributeValue(event.getName())); attributes.put("listener", AttributeValue.stringAttributeValue(listener)); attributes.put("duration_ms", AttributeValue.longAttributeValue(elapsed)); EventContext eventContext = event.getContext(); if (eventContext instanceof DocumentEventContext) { DocumentEventContext docContext = (DocumentEventContext) eventContext; if (docContext.getSourceDocument() != null) { Path docPath = docContext.getSourceDocument().getPath(); if (docPath != null) { attributes.put("doc", AttributeValue.stringAttributeValue(docPath.toString())); } String id = docContext.getSourceDocument().getId(); if (id != null) { attributes.put("doc_id", AttributeValue.stringAttributeValue(id)); } } } tracer.getCurrentSpan().addAnnotation("EventService#fireEvent Event fired", attributes); }
Source:
private Iterable<ThriftStructFieldInfo> getFieldInfos(ThriftStructCodec c) { Class<? extends ThriftStructCodec> klass = c.getClass(); if (isUnion(klass)){ return getFieldInfosForUnion(klass); } else { try { Object r = klass.getMethod("fieldInfos").invoke(c); Iterable<ThriftStructFieldInfo> a = JavaConversions$.MODULE$.asJavaIterable((scala.collection.Iterable<ThriftStructFieldInfo>)r); return a; } catch (Exception e) { throw new RuntimeException("can not get field Info from: " + c.toString(), e); } } }

Target:
private Iterable<ThriftStructFieldInfo> getFieldInfos(ThriftStructCodec c) { Class<? extends ThriftStructCodec> klass = c.getClass(); if (isUnion(klass)){ return getFieldInfosForUnion(klass); } else { try { Object r = klass.getMethod("fieldInfos").invoke(c); Iterable<ThriftStructFieldInfo> a = JavaConversions$.MODULE$.asJavaIterable((scala.collection.Iterable<ThriftStructFieldInfo>)r); return a; } catch (ReflectiveOperationException e) { throw new ScroogeSchemaConversionException("can not get field Info from: " + c.toString(), e); } } }
Source:
GHGistUpdater(GHGist base) { this.base = base; this.builder = base.root.retrieve().method("POST"); files = new LinkedHashMap<>(); }

Target:
GHGistUpdater(GHGist base) { this.base = base; this.builder = base.root.createRequest(); files = new LinkedHashMap<>(); }
Source:
<T> Mono<Response<T>> getDocumentWithResponse(String key, Class<T> modelClass, List<String> selectedFields, RequestOptions requestOptions, Context context) { try { return restClient.documents() .getWithRestResponseAsync(key, selectedFields, RequestOptionsConverter.map(requestOptions), context) .onErrorMap(DocumentResponseConversions::exceptionMapper) .map(res -> { SearchObjectMapper.getInstance().setSerializationInclusion(JsonInclude.Include.ALWAYS); if (SearchDocument.class.getTypeName().equals(modelClass.getTypeName())) { TypeReference<Map<String, Object>> typeReference = new TypeReference<Map<String, Object>>() { }; SearchDocument doc = new SearchDocument(SearchObjectMapper.getInstance() .convertValue(res.getValue(), typeReference)); return new SimpleResponse<T>(res, (T) doc); } T document = SearchObjectMapper.getInstance().convertValue(res.getValue(), modelClass); return new SimpleResponse<>(res, document); }) .map(Function.identity()); } catch (RuntimeException ex) { return monoError(logger, ex); } }

Target:
<T> Mono<Response<T>> getDocumentWithResponse(String key, Class<T> modelClass, List<String> selectedFields, RequestOptions requestOptions, Context context) { try { return restClient.documents() .getWithRestResponseAsync(key, selectedFields, RequestOptionsConverter.map(requestOptions), context) .onErrorMap(DocumentResponseConversions::exceptionMapper) .map(res -> { if (SearchDocument.class == modelClass) { TypeReference<Map<String, Object>> typeReference = new TypeReference<Map<String, Object>>() { }; SearchDocument doc = new SearchDocument(MAPPER.convertValue(res.getValue(), typeReference)); return new SimpleResponse<T>(res, (T) doc); } T document = MAPPER.convertValue(res.getValue(), modelClass); return new SimpleResponse<>(res, document); }) .map(Function.identity()); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
public void run() { final Display display = Display.getDefault(); if ((display == null) || display.isDisposed()) { return; } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!display.isDisposed()) { scrollView.scrollBy(deltaX, deltaY); } } }); }

Target:
public void run() { final Display display = Display.getDefault(); if ((display == null) || display.isDisposed()) { return; } display.asyncExec(new Runnable() { @Override public void run() { if (!scrollView.isDisposed()) { scrollView.scrollBy(deltaX, deltaY); } } }); }
Source:
public void acquireToken(Activity activity, String resource, String clientId, String redirectUri, String loginHint, String extraQueryParameters, AuthenticationCallback<AuthenticationResult> callback) { redirectUri = checkInputParameters(resource, clientId, redirectUri, callback); final APIEvent apiEvent = new APIEvent(EventStrings.API_EVENT, mContext, clientId); final String requestId = Telemetry.registerNewRequest(); apiEvent.setRequestId(requestId); apiEvent.setAPIId(EventStrings.ACQUIRE_TOKEN_2); apiEvent.setAuthority(getAuthority()); Telemetry.getInstance().startEvent(requestId, apiEvent.getEventName()); final AuthenticationRequest request = new AuthenticationRequest(mAuthority, resource, clientId, redirectUri, loginHint, PromptBehavior.Auto, extraQueryParameters, getRequestCorrelationId(), getExtendedLifetimeEnabled()); request.setUserIdentifierType(UserIdentifierType.LoginHint); request.setTelemetryRequestId(requestId); createAcquireTokenRequest(apiEvent).acquireToken(wrapActivity(activity), false, request, callback); }

Target:
public void acquireToken(Activity activity, String resource, String clientId, String redirectUri, String loginHint, String extraQueryParameters, AuthenticationCallback<AuthenticationResult> callback) { if (checkPreRequirements(resource, clientId, callback)) { final String requestId = Telemetry.registerNewRequest(); final APIEvent apiEvent = createApiEvent(mContext, clientId, requestId, EventStrings.ACQUIRE_TOKEN_2); apiEvent.setLoginHint(loginHint); redirectUri = getRedirectUri(redirectUri); final AuthenticationRequest request = new AuthenticationRequest(mAuthority, resource, clientId, redirectUri, loginHint, PromptBehavior.Auto, extraQueryParameters, getRequestCorrelationId(), getExtendedLifetimeEnabled()); request.setUserIdentifierType(UserIdentifierType.LoginHint); request.setTelemetryRequestId(requestId); createAcquireTokenRequest(apiEvent).acquireToken(wrapActivity(activity), false, request, callback); } }
Source:
public void pidFilePreventsStart() throws Exception { Node node1 = TestUtils.createSwarmClient( j, processDestroyer, temporaryFolder, "-pidFile", getPidFile().getAbsolutePath()); TestUtils.SwarmClientProcessWrapper node2 = TestUtils.runSwarmClient( "agent_fail", j, processDestroyer, temporaryFolder, "-pidFile", getPidFile().getAbsolutePath()); node2.process.waitFor(5, TimeUnit.SECONDS); assertFalse("Second client should fail to start", node2.process.isAlive()); assertEquals("Exit code", 1, node2.process.exitValue()); assertTrue("Log message mentions 'already exists'", Files.readAllLines(node2.stderr.toPath()).stream().anyMatch(line -> line.contains("already exists"))); }

Target:
public void pidFilePreventsStart() throws Exception { File pidFile = getPidFile(); TestUtils.createSwarmClient( j, processDestroyer, temporaryFolder, "-pidFile", pidFile.getAbsolutePath()); int firstClientPid = readPidFromFile(pidFile); TestUtils.SwarmClientProcessWrapper node2 = TestUtils.runSwarmClient( "agent_fail", j, processDestroyer, temporaryFolder, "-pidFile", pidFile.getAbsolutePath()); node2.process.waitFor(); assertFalse("Second client should fail to start", node2.process.isAlive()); assertEquals("Exit code", 1, node2.process.exitValue()); assertTrue( "Log message mentions 'already exists' in: " + Files.readAllLines(node2.stderr.toPath()), Files.readAllLines(node2.stderr.toPath()).stream() .anyMatch(line -> line.contains("already exists"))); assertNotNull("Original client should still be running", os.getProcess(firstClientPid)); assertEquals("PID in PID file should not change", firstClientPid, readPidFromFile(pidFile)); }
Source:
private void constructFeatureModel(MultiFeatureModel fm) { fm.reset(); IFeature root; if (rootModel.getRootFeatures().length == 1) { final Feature f = rootModel.getRootFeatures()[0]; root = parseFeature(fm, null, f); } else { root = MultiFeatureModelFactory.getInstance().createFeature(fm, "Root"); Arrays.asList(rootModel.getRootFeatures()).forEach(f -> parseFeature(fm, root, f)); } fm.getStructure().setRoot(root.getStructure()); final List<Object> ownConstraints = Arrays.asList(rootModel.getOwnConstraints()); Arrays.asList(rootModel.getConstraints()).stream().filter(c -> !ownConstraints.contains(c)).forEach(c -> parseConstraint(fm, c)); ownConstraints.forEach(c -> parseOwnConstraint(fm, c)); Arrays.asList(rootModel.getImports()).forEach(i -> parseImport(fm, i)); fm.addAttribute(NS_ATTRIBUTE_FEATURE, NS_ATTRIBUTE_NAME, rootModel.getNamespace()); }

Target:
private void constructFeatureModel(MultiFeatureModel fm) { fm.reset(); IFeature root; if (rootModel.getRootFeatures().length == 1) { final Feature f = rootModel.getRootFeatures()[0]; root = parseFeature(fm, null, f); } else { root = MultiFeatureModelFactory.getInstance().createFeature(fm, "Root"); Arrays.stream(rootModel.getRootFeatures()).forEach(f -> parseFeature(fm, root, f)); } fm.getStructure().setRoot(root.getStructure()); final List<Object> ownConstraints = Arrays.asList(rootModel.getOwnConstraints()); Arrays.stream(rootModel.getConstraints()).filter(c -> !ownConstraints.contains(c)).forEach(c -> parseConstraint(fm, c)); ownConstraints.forEach(c -> parseOwnConstraint(fm, c)); Arrays.stream(rootModel.getImports()).forEach(i -> parseImport(fm, i)); fm.addAttribute(NS_ATTRIBUTE_FEATURE, NS_ATTRIBUTE_NAME, rootModel.getNamespace()); }
Source:
public static MSLevel[] cropValues() { MSLevel[] values = MSLevel.values(); MSLevel[] array = new MSLevel[values.length - 1]; for (int i = 0; i < array.length; i++) array[i] = values[i]; return array; }

Target:
public static MSLevel[] cropValues() { MSLevel[] values = MSLevel.values(); return Arrays.copyOf(values, values.length-1); }
Source:
public List<Snippet> getSnippets() throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "snippets"); List<Snippet> snippets = (response.readEntity(new GenericType<List<Snippet>>() {})); for (Snippet snippet : snippets) { snippet.setContent(getSnippetContent(snippet.getId())); } return snippets; }

Target:
public List<Snippet> getSnippets() throws GitLabApiException { return getSnippets(false); }
Source:
private Map<Long, Pair<ITmfStateSystem, Integer>> getSelectedEntries(Map<String, Object> fetchParameters) { Collection<Long> selectedItems = DataProviderParameterUtils.extractSelectedItems(fetchParameters); if (selectedItems == null) { return Collections.emptyMap(); } Map<Long, Pair<ITmfStateSystem, Integer>> IdToQuark = new HashMap<>(); for (Long id : selectedItems) { Pair<ITmfStateSystem, Integer> pair = fIDToDisplayQuark.get(id); if (pair != null) { IdToQuark.put(id, pair); } } return IdToQuark; }

Target:
private Map<Long, Pair<ITmfStateSystem, Integer>> getSelectedEntries(Map<String, Object> fetchParameters) { Collection<Long> selectedItems = DataProviderParameterUtils.extractSelectedItems(fetchParameters); if (selectedItems == null) { return Collections.emptyMap(); } Map<Long, Pair<ITmfStateSystem, Integer>> idToQuark = new HashMap<>(); for (Long id : selectedItems) { Pair<ITmfStateSystem, Integer> pair = fIDToDisplayQuark.get(id); if (pair != null) { idToQuark.put(id, pair); } } return idToQuark; }
Source:
private ColumnChunk readMap(GroupField field) throws IOException { List<Type> parameters = field.getType().getTypeParameters(); checkArgument(parameters.size() == 2, "Maps must have two type parameters, found %d", parameters.size()); Block[] blocks = new Block[parameters.size()]; ColumnChunk columnChunk = readColumnChunk(field.getChildren().get(0).get()); blocks[0] = columnChunk.getBlock(); blocks[1] = readColumnChunk(field.getChildren().get(1).get()).getBlock(); IntList offsets = new IntArrayList(); BooleanList valueIsNull = new BooleanArrayList(); ParquetListColumnReader.calculateCollectionOffsets(field, offsets, valueIsNull, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); Block mapBlock = ((MapType) field.getType()).createBlockFromKeyValue(valueIsNull.toBooleanArray(), offsets.toIntArray(), blocks[0], blocks[1]); return new ColumnChunk(mapBlock, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); }

Target:
private ColumnChunk readMap(GroupField field) throws IOException { List<Type> parameters = field.getType().getTypeParameters(); checkArgument(parameters.size() == 2, "Maps must have two type parameters, found %d", parameters.size()); Block[] blocks = new Block[parameters.size()]; ColumnChunk columnChunk = readColumnChunk(field.getChildren().get(0).get()); blocks[0] = columnChunk.getBlock(); blocks[1] = readColumnChunk(field.getChildren().get(1).get()).getBlock(); IntList offsets = new IntArrayList(); BooleanList valueIsNull = new BooleanArrayList(); calculateCollectionOffsets(field, offsets, valueIsNull, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); Block mapBlock = ((MapType) field.getType()).createBlockFromKeyValue(valueIsNull.toBooleanArray(), offsets.toIntArray(), blocks[0], blocks[1]); return new ColumnChunk(mapBlock, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); }
Source:
public SellerAsTakerProtocol(SellerAsTakerTrade trade) { super(trade); Offer offer = checkNotNull(trade.getOffer()); processModel.getTradingPeer().setPubKeyRing(offer.getPubKeyRing()); processModel.getTradeManager().requestPersistence(); }

Target:
public SellerAsTakerProtocol(SellerAsTakerTrade trade) { super(trade); Offer offer = checkNotNull(trade.getOffer()); processModel.getTradingPeer().setPubKeyRing(offer.getPubKeyRing()); }
Source:
public GraphQLException(final String message, final HttpResponse httpResponse) { super(message); }

Target:
public GraphQLException(final String message, final HttpResponse httpResponse) { super(message + "\n" + httpResponse.toString()); }
Source:
private void checkForExistingDOIForWorkflowVersion(WorkflowVersion workflowVersion) { String workflowVersionDoiURL = workflowVersion.getDoiURL(); if (workflowVersionDoiURL != null && !workflowVersionDoiURL.isEmpty()) { LOG.error("Workflow version " + workflowVersion.getName() + " already has DOI " + workflowVersionDoiURL + ". Dockstore will only create one DOI per version."); throw new CustomWebApplicationException("Workflow version " + workflowVersion.getName() + " already has DOI " + workflowVersionDoiURL + ". Dockstore will only create one DOI per version.", HttpStatus.SC_METHOD_NOT_ALLOWED); } }

Target:
private void checkForExistingDOIForWorkflowVersion(WorkflowVersion workflowVersion) { String workflowVersionDoiURL = workflowVersion.getDoiURL(); if (workflowVersionDoiURL != null && !workflowVersionDoiURL.isEmpty()) { LOG.error("Workflow version " + workflowVersion.getName() + " already has DOI " + workflowVersionDoiURL + ". Dockstore can only create one DOI per version."); throw new CustomWebApplicationException("Workflow version " + workflowVersion.getName() + " already has DOI " + workflowVersionDoiURL + ". Dockstore can only create one DOI per version.", HttpStatus.SC_METHOD_NOT_ALLOWED); } }
Source:
private Platform findPlatformByTarget(Target target) { for (Platform p : availablePlatforms) { if (p.apiLevel.equals(target.apiLevel)) { return p; } } return null; }

Target:
private Platform findPlatformByTarget(Target target) { for (Platform platform : availablePlatforms) { if (platform.apiLevel.equals(target.apiLevel)) { return platform; } } throw new AndroidContainerConfigurationException( String.format("Platform you are trying to find for target '%s' is unknown.", target)); }