auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void hideItemElementIfParentIsCollapsed(final HTMLElement itemElement, final Element parent) { final boolean isCollapsed = isCollapsed(parent.querySelector("[data-field=\"arrow-button\"]")); final boolean isCollapsedParent = isHidden(parent); if (isCollapsed || isCollapsedParent) { hide(itemElement); } else { show(itemElement); } }

Target:
void hideItemElementIfParentIsCollapsed(final HTMLElement itemElement, final Element parent) { final boolean isCollapsedParent = isCollapsed(parent.querySelector(ARROW_BUTTON_SELECTOR)); final boolean isHiddenParent = isHidden(parent); if (isCollapsedParent || isHiddenParent) { hide(itemElement); } else { show(itemElement); } }
Source:
public ServiceTest(TOptions options) { super(options); String connectionString = System.getenv("STORAGE_CONNECTION_STRING"); if (CoreUtils.isNullOrEmpty(connectionString)) { System.out.println("Environment variable STORAGE_CONNECTION_STRING must be set"); System.exit(1); } shareServiceClient = new ShareServiceClientBuilder().connectionString(connectionString). buildClient(); shareServiceAsyncClient = new ShareServiceClientBuilder().connectionString(connectionString). buildAsyncClient(); }

Target:
public ServiceTest(TOptions options) { super(options); configuration = Configuration.getGlobalConfiguration().clone(); String connectionString = configuration.get("STORAGE_CONNECTION_STRING"); if (CoreUtils.isNullOrEmpty(connectionString)) { throw new IllegalStateException("Environment variable STORAGE_CONNECTION_STRING must be set"); } shareServiceClient = new ShareServiceClientBuilder().connectionString(connectionString). buildClient(); shareServiceAsyncClient = new ShareServiceClientBuilder().connectionString(connectionString). buildAsyncClient(); }
Source:
private void sortHelper(Task root, Comparator<Task> comparator) { Task[] tasks = getNestedTasks(root); for (int i = 0; i < tasks.length; i++) { for (int j = 1; j < tasks.length - i; j++) { if (comparator.compare(tasks[j - 1], tasks[j]) > 0) { swap(tasks[j - 1], tasks[j]); Task tmp = tasks[j - 1]; tasks[j - 1] = tasks[j]; tasks[j] = tmp; } } } for (Task t : tasks) { sortHelper(t, comparator); } }

Target:
private void sortHelper(Task root, Comparator<Task> comparator) { Task[] tasks = getNestedTasks(root); Arrays.sort(tasks, comparator); for (Task t : tasks) { myTree.getModel().removeNodeFromParent(myTask2treeNode.get(t)); } for (int i = 0; i < tasks.length; i++) { myTree.getModel().insertNodeInto(myTask2treeNode.get(tasks[i]), myTask2treeNode.get(root), i); sortHelper(tasks[i], comparator); } }
Source:
public void designDocCompare() throws MalformedURLException { DesignDocument designDoc1 = DesignDocumentManager.fromFile(designDocExample); designManager.put(designDoc1); DesignDocument designDoc11 = db.getDesignDocumentManager().get("_design/example"); assertEquals(designDoc1, designDoc11); }

Target:
public void designDocCompare() throws Exception { DesignDocument designDoc1 = DesignDocumentManager.fromFile(designDocExample); designManager.put(designDoc1); DesignDocument designDoc11 = db.getDesignDocumentManager().get("_design/example"); assertEquals(designDoc1, designDoc11); }
Source:
public DataStorageConfiguration setWalSegmentSize(int walSegmentSize) { if(walSegmentSize != 0){ A.ensure(walSegmentSize >= 512 * 1024, "WAL segment size must be between 512Kb and 2Gb."); } this.walSegmentSize = walSegmentSize; return this; }

Target:
public DataStorageConfiguration setWalSegmentSize(int walSegmentSize) { if (walSegmentSize != 0) A.ensure(walSegmentSize >= 512 * 1024, "WAL segment size must be between 512Kb and 2Gb."); this.walSegmentSize = walSegmentSize; return this; }
Source:
public Iterable<Container> listNodesByIds(final Iterable<String> ids) { return filter(listNodes(), new Predicate<Container>() { @Override public boolean apply(Container server) { return contains(ids, server.getId()); } }); }

Target:
public Iterable<Container> listNodesByIds(final Iterable<String> ids) { Set<Container> containers = Sets.newHashSet(); for (String id : ids) { containers.add(api.getRemoteApi().inspectContainer(id)); } return containers; }
Source:
public void shouldFailWithAdditionalInfosWhenMimeTypeIsNotSupportedByConverter() throws IOException { String converterName = cs.getConverterName("image/jpeg", "application/pdf"); DocumentBlobHolder documentBlobHolder = getDocumentBlob("test-docs/" + "hello.xls", "application/vnd.ms-excel"); try { cs.convert(converterName, documentBlobHolder, Collections.emptyMap()); } catch (ConversionException e) { assertTrue(e.getInfos().size() == 1); assertTrue(e.getInfos().get(0).contains(documentBlobHolder.getDocument().getId())); } }

Target:
public void shouldFailWithAdditionalInfosWhenMimeTypeIsNotSupportedByConverter() throws IOException { String converterName = cs.getConverterName("image/jpeg", "application/pdf"); DocumentBlobHolder documentBlobHolder = getDocumentBlob("test-docs/hello.xls", "application/vnd.ms-excel"); try { cs.convert(converterName, documentBlobHolder, Collections.emptyMap()); fail("Should have raised a ConversionException"); } catch (ConversionException e) { assertEquals(1, e.getInfos().size()); assertTrue(e.getInfos().get(0).contains(documentBlobHolder.getDocument().getId())); } }
Source:
public WorkspaceShare( SeleniumWebDriver seleniumWebDriver, SeleniumWebDriverHelper seleniumWebDriverHelper) { this.seleniumWebDriver = seleniumWebDriver; this.seleniumWebDriverHelper = seleniumWebDriverHelper; PageFactory.initElements(seleniumWebDriver, this); }

Target:
public WorkspaceShare( SeleniumWebDriver seleniumWebDriver, SeleniumWebDriverHelper seleniumWebDriverHelper) { this.seleniumWebDriverHelper = seleniumWebDriverHelper; PageFactory.initElements(seleniumWebDriver, this); }
Source:
public String toString() { String s = "schemaType = " + schemaType + ", pixelType = " + pixelType + ", filePosition = " + filePosition + ", filePart = " + filePart + ", compression = " + compression + ", pyramidType = " + pyramidType + ", dimensionCount = " + dimensionCount; if (dimensionCount > 0) { s += ", dimensions = ["; StringBuilder sb = new StringBuilder(s); for (int i=0; i<dimensionCount; i++) { sb.append(dimensionEntries[i]); if (i < dimensionCount - 1) { sb.append("; "); } } sb.append(']'); s = sb.toString(); } return s; }

Target:
public String toString() { String s = "schemaType = " + schemaType + ", pixelType = " + pixelType + ", filePosition = " + filePosition + ", filePart = " + filePart + ", compression = " + compression + ", pyramidType = " + pyramidType + ", dimensionCount = " + dimensionCount; if (dimensionCount > 0) { StringBuilder sb = new StringBuilder(s); sb.append(", dimensions = ["); for (int i=0; i<dimensionCount; i++) { sb.append(dimensionEntries[i]); if (i < dimensionCount - 1) { sb.append("; "); } } sb.append(']'); s = sb.toString(); } return s; }
Source:
private Observable<Map<String, CoinmateWebsocketBalance>> getCoinmateBalances() { String channelName = "channel/my-balances"; ObjectReader reader = StreamingObjectMapperHelper.getObjectMapper().readerFor(new TypeReference<Map<String, CoinmateWebsocketBalance>>() {}); CoinmateStreamingService service = serviceFactory.createAndConnect(channelName, true); return service.subscribeMessages() .map( (message) -> { Map<String, CoinmateWebsocketBalance> balanceMap = reader.readValue(message.get("balances")); return balanceMap; }); }

Target:
private Observable<Map<String, CoinmateWebsocketBalance>> getCoinmateBalances() { String channelName = "channel/my-balances"; ObjectReader reader = StreamingObjectMapperHelper.getObjectMapper().readerFor(new TypeReference<Map<String, CoinmateWebsocketBalance>>() {}); return serviceFactory.createConnection(channelName, true) .map((message) -> reader.readValue(message.get("balances"))); }
Source:
public void shouldUseBothAnalyzer() { elasticsearchTemplate.createIndex(Book.class); elasticsearchTemplate.putMapping(Book.class); Map mapping = elasticsearchTemplate.getMapping(Book.class); System.out.println(mapping); Map descriptionMapping = (Map) ((Map) mapping.get("properties")).get("description"); Map prefixDescription = (Map) ((Map) descriptionMapping.get("fields")).get("prefix"); assertThat(prefixDescription).hasSize(3); assertThat(prefixDescription.get("type")).isEqualTo("text"); assertThat(prefixDescription.get("analyzer")).isEqualTo("stop"); assertThat(prefixDescription.get("search_analyzer")).isEqualTo("standard"); assertThat(descriptionMapping.get("type")).isEqualTo("text"); assertThat(descriptionMapping.get("analyzer")).isEqualTo("whitespace"); }

Target:
public void shouldUseBothAnalyzer() { elasticsearchTemplate.createIndex(Book.class); elasticsearchTemplate.putMapping(Book.class); Map mapping = elasticsearchTemplate.getMapping(Book.class); Map descriptionMapping = (Map) ((Map) mapping.get("properties")).get("description"); Map prefixDescription = (Map) ((Map) descriptionMapping.get("fields")).get("prefix"); assertThat(prefixDescription).hasSize(3); assertThat(prefixDescription.get("type")).isEqualTo("text"); assertThat(prefixDescription.get("analyzer")).isEqualTo("stop"); assertThat(prefixDescription.get("search_analyzer")).isEqualTo("standard"); assertThat(descriptionMapping.get("type")).isEqualTo("text"); assertThat(descriptionMapping.get("analyzer")).isEqualTo("whitespace"); }
Source:
protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); removeEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE); installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new SiriusConnectionEndPointEditPolicy()); removeEditPolicy(EditPolicyRoles.PROPERTY_HANDLER_ROLE); installEditPolicy(EditPolicyRoles.PROPERTY_HANDLER_ROLE, new SiriusPropertyHandlerEditPolicy()); installEditPolicy(EditPolicy.CONNECTION_ROLE, new SiriusConnectionEditPolicy()); installEditPolicy(RequestConstants.REQ_LAUNCH_TOOL, new LaunchToolEditPolicy()); final EditPolicy currentSelectionEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); final EditPolicy selectionFeedBackEditPolicy = new DEdgeSelectionFeedbackEditPolicy(); if (currentSelectionEditPolicy != null) { final CompoundEditPolicy selectionCompoundEditPolicy = new CompoundEditPolicy(); selectionCompoundEditPolicy.addEditPolicy(currentSelectionEditPolicy); selectionCompoundEditPolicy.addEditPolicy(selectionFeedBackEditPolicy); removeEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionCompoundEditPolicy); } else { installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionFeedBackEditPolicy); } installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new SiriusSnapFeedbackPolicy()); installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new SiriusEdgeLabelSnapBackEditPolicy()); }

Target:
protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); removeEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE); installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new SiriusConnectionEndPointEditPolicy()); removeEditPolicy(EditPolicyRoles.PROPERTY_HANDLER_ROLE); installEditPolicy(EditPolicyRoles.PROPERTY_HANDLER_ROLE, new SiriusPropertyHandlerEditPolicy()); installEditPolicy(EditPolicy.CONNECTION_ROLE, new SiriusConnectionEditPolicy()); installEditPolicy(RequestConstants.REQ_LAUNCH_TOOL, new LaunchToolEditPolicy()); final EditPolicy currentSelectionEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); final EditPolicy selectionFeedBackEditPolicy = new DEdgeSelectionFeedbackEditPolicy(); if (currentSelectionEditPolicy != null) { final CompoundEditPolicy selectionCompoundEditPolicy = new CompoundEditPolicy(); selectionCompoundEditPolicy.addEditPolicy(currentSelectionEditPolicy); selectionCompoundEditPolicy.addEditPolicy(selectionFeedBackEditPolicy); removeEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionCompoundEditPolicy); } else { installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionFeedBackEditPolicy); } installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new SiriusEdgeLabelSnapBackEditPolicy()); }
Source:
private void removeStatelessVmUnmanagedDevices() { VM vm = getVm(); if (vm != null && vm.isStateless() || isRunOnce()) { final List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getUnmanagedDevicesByVmId(getVmId()); for (VmDevice device : vmDevices) { if (!VmDeviceCommonUtils.isInWhiteList(device.getType(), device.getDevice())) { DbFacade.getInstance().getVmDeviceDao().remove(device.getId()); } } } }

Target:
private void removeStatelessVmUnmanagedDevices() { if (getVm().isStateless() || isRunOnce()) { final List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getUnmanagedDevicesByVmId(getVmId()); for (VmDevice device : vmDevices) { if (!VmDeviceCommonUtils.isInWhiteList(device.getType(), device.getDevice())) { DbFacade.getInstance().getVmDeviceDao().remove(device.getId()); } } } }
Source:
public RtGithub( @NotNull(message = "user name can't be NULL") final String user, @NotNull(message = "password can't be NULL") final String pwd) { this(URI.create(DEFAULT_GITHUB_HOST), user, pwd); }

Target:
public RtGithub( @NotNull(message = "user name can't be NULL") final String user, @NotNull(message = "password can't be NULL") final String pwd) { this(URI.create(RtGithub.DEFAULT_HOST), user, pwd); }
Source:
private void putObject(WebContext ctx, Bucket bucket, String id, InputStreamHandler inputStream) throws IOException { StoredObject object = bucket.getObject(id); if (inputStream == null) { signalObjectError(ctx, bucket.getName(), id, S3ErrorCode.IncompleteBody, "No content posted"); return; } try (FileOutputStream out = new FileOutputStream(object.getFile())) { ByteStreams.copy(inputStream, out); } Map<String, String> properties = parseUploadProperties(ctx); HashCode hash = Files.asByteSource(object.getFile()).hash(Hashing.md5()); String md5 = BaseEncoding.base64().encode(hash.asBytes()); String contentMd5 = properties.get("Content-MD5"); if (properties.containsKey("Content-MD5") && !md5.equals(contentMd5)) { object.delete(); signalObjectError(ctx, bucket.getName(), id, S3ErrorCode.BadDigest, Strings.apply("Invalid MD5 checksum (Input: %s, Expected: %s)", contentMd5, md5)); return; } String etag = BaseEncoding.base16().encode(hash.asBytes()).toLowerCase(); properties.put(HTTP_HEADER_NAME_ETAG, etag); object.storeProperties(properties); Response response = ctx.respondWith(); response.addHeader(HTTP_HEADER_NAME_ETAG, etag(etag)).status(HttpResponseStatus.OK); response.addHeader(HttpHeaderNames.ACCESS_CONTROL_EXPOSE_HEADERS, HTTP_HEADER_NAME_ETAG); signalObjectSuccess(ctx); }

Target:
private void putObject(WebContext ctx, Bucket bucket, String id, InputStreamHandler inputStream) throws IOException { StoredObject object = bucket.getObject(id); if (inputStream == null) { signalObjectError(ctx, bucket.getName(), id, S3ErrorCode.IncompleteBody, "No content posted"); return; } try (FileOutputStream out = new FileOutputStream(object.getFile())) { ByteStreams.copy(inputStream, out); } Map<String, String> properties = parseUploadProperties(ctx); byte[] hash = Hasher.md5().hashFile(object.getFile()).toHash(); String md5 = BaseEncoding.base64().encode(hash); String contentMd5 = properties.get("Content-MD5"); if (properties.containsKey("Content-MD5") && !md5.equals(contentMd5)) { object.delete(); signalObjectError(ctx, bucket.getName(), id, S3ErrorCode.BadDigest, Strings.apply("Invalid MD5 checksum (Input: %s, Expected: %s)", contentMd5, md5)); return; } String etag = BaseEncoding.base16().encode(hash).toLowerCase(); properties.put(HTTP_HEADER_NAME_ETAG, etag); object.storeProperties(properties); Response response = ctx.respondWith(); response.addHeader(HTTP_HEADER_NAME_ETAG, etag(etag)).status(HttpResponseStatus.OK); response.addHeader(HttpHeaderNames.ACCESS_CONTROL_EXPOSE_HEADERS, HTTP_HEADER_NAME_ETAG); signalObjectSuccess(ctx); }
Source:
protected int logTransportErrorAndThrowExceptionIfNeeded(int i, HotRodClientException e) { String message = "Exception encountered. Retry %d out of %d"; if (i >= transportFactory.getMaxRetries() || transportFactory.getMaxRetries() < 0) { if (transportFactory.trySwitchCluster(cacheName)){ log.debug("Switched to a different cluster"); triedCompleteRestart = true; return -1; } else if (!triedCompleteRestart) { log.debug("Cluster might have completely shut down, try resetting transport layer and topology id", e); transportFactory.reset(cacheName); triedCompleteRestart = true; return -1; } else { log.exceptionAndNoRetriesLeft(i,transportFactory.getMaxRetries(), e); throw e; } } else { log.tracef(e, message, i, transportFactory.getMaxRetries()); return i; } }

Target:
protected int logTransportErrorAndThrowExceptionIfNeeded(int i, HotRodClientException e) { String message = "Exception encountered. Retry %d out of %d"; if (i >= transportFactory.getMaxRetries() || transportFactory.getMaxRetries() < 0) { if (transportFactory.trySwitchCluster(cacheName)){ triedCompleteRestart = true; return -1; } else if (!triedCompleteRestart) { log.debug("Cluster might have completely shut down, try resetting transport layer and topology id", e); transportFactory.reset(cacheName); triedCompleteRestart = true; return -1; } else { log.exceptionAndNoRetriesLeft(i,transportFactory.getMaxRetries(), e); throw e; } } else { log.tracef(e, message, i, transportFactory.getMaxRetries()); return i; } }
Source:
public void errorOnNullBoardSize() { try { grains.computeNumberOfGrainsOnSquare(0); fail("Grains#compute should have thrown"); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), "square must be between 1 and 64"); } }

Target:
public void errorOnNullBoardSize() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage(wrongSquareMessage); grains.computeNumberOfGrainsOnSquare(0); }
Source:
public static String indexPath(final Path path) { return indexFile(path.toAbsolutePath().toString()); }

Target:
public static Path indexPath(final Path path) { return path.getFileSystem().getPath(indexFile(path.toAbsolutePath().toString())); }
Source:
protected boolean doRollback() throws Exception { try { int size = 0; for (Set<ActionChange> cs : changeSets.values()) { size += cs.size(); } List<Delete> rollbackDeletes = new ArrayList<Delete>(size); for (Map.Entry<Long, Set<ActionChange>> entry : changeSets.entrySet()) { long transactionTimestamp = entry.getKey(); for (ActionChange change : entry.getValue()) { byte[] row = change.getRow(); byte[] family = change.getFamily(); byte[] qualifier = change.getQualifier(); Delete rollbackDelete = new Delete(row); rollbackDelete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]); switch (conflictLevel) { case ROW: case NONE: rollbackDelete.deleteFamilyVersion(change.getFamily(), transactionTimestamp); break; case COLUMN: if (family != null && qualifier == null) { rollbackDelete.deleteFamilyVersion(family, transactionTimestamp); } else if (family != null && qualifier != null) { rollbackDelete.deleteColumn(family, qualifier, transactionTimestamp); } break; default: throw new IllegalStateException("Unknown conflict detection level: " + conflictLevel); } rollbackDeletes.add(rollbackDelete); } } hTable.delete(rollbackDeletes); return true; } finally { try { hTable.flushCommits(); } catch (Exception e) { LOG.error("Could not flush HTable commits", e); } tx = null; changeSets.clear(); } }

Target:
protected boolean doRollback() throws Exception { try { int size = 0; for (Set<ActionChange> cs : changeSets.values()) { size += cs.size(); } List<Delete> rollbackDeletes = new ArrayList<>(size); for (Map.Entry<Long, Set<ActionChange>> entry : changeSets.entrySet()) { long transactionTimestamp = entry.getKey(); for (ActionChange change : entry.getValue()) { byte[] row = change.getRow(); byte[] family = change.getFamily(); byte[] qualifier = change.getQualifier(); Delete rollbackDelete = new Delete(row); rollbackDelete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]); switch (conflictLevel) { case ROW: case NONE: rollbackDelete.deleteFamilyVersion(change.getFamily(), transactionTimestamp); break; case COLUMN: if (family != null && qualifier == null) { rollbackDelete.deleteFamilyVersion(family, transactionTimestamp); } else if (family != null && qualifier != null) { rollbackDelete.deleteColumn(family, qualifier, transactionTimestamp); } break; default: throw new IllegalStateException("Unknown conflict detection level: " + conflictLevel); } rollbackDeletes.add(rollbackDelete); } } hTable.delete(rollbackDeletes); return true; } finally { try { hTable.flushCommits(); } catch (Exception e) { LOG.error("Could not flush HTable commits", e); } tx = null; changeSets.clear(); } }
Source:
private InsightCard createInsightCard(Map<String, AttributeValue> item) { InsightCard.Category category = InsightCard.Category.fromInteger(Integer.valueOf(item.get(CATEGORY_ATTRIBUTE_NAME).getN())); InsightCard.TimePeriod timePeriod = InsightCard.TimePeriod.fromString(item.get(TIME_PERIOD_ATTRIBUTE_NAME).getS()); return new InsightCard( Long.valueOf(item.get(ACCOUNT_ID_ATTRIBUTE_NAME).getN()), item.get(TITLE_ATTRIBUTE_NAME).getS(), item.get(MESSAGE_ATTRIBUTE_NAME).getS(), category, timePeriod, new DateTime(item.get(TIMESTAMP_UTC_ATTRIBUTE_NAME).getS(), DateTimeZone.UTC) ); }

Target:
private InsightCard createInsightCard(Map<String, AttributeValue> item) { final InsightCard.Category category = InsightCard.Category.fromInteger(Integer.valueOf(item.get(CATEGORY_ATTRIBUTE_NAME).getN())); final InsightCard.TimePeriod timePeriod = InsightCard.TimePeriod.fromString(item.get(TIME_PERIOD_ATTRIBUTE_NAME).getS()); return new InsightCard( Long.valueOf(item.get(ACCOUNT_ID_ATTRIBUTE_NAME).getN()), item.get(TITLE_ATTRIBUTE_NAME).getS(), item.get(MESSAGE_ATTRIBUTE_NAME).getS(), category, timePeriod, new DateTime(item.get(TIMESTAMP_UTC_ATTRIBUTE_NAME).getS(), DateTimeZone.UTC) ); }
Source:
public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics) { RevisionInfo[] infos = new RevisionInfo[ids.size()]; List<RevisionInfo> infosToLoad = createRevisionInfos(ids, branchPoint, prefetchDepth, loadOnDemand, infos); List<CDORevision> primaryLoadedRevisions = null; List<InternalCDORevision> additionalRevisions = null; if (infosToLoad != null) { additionalRevisions = loadRevisions(infosToLoad, branchPoint, referenceChunk, prefetchDepth); primaryLoadedRevisions = getResultsAndSynthetics(infosToLoad.toArray(new RevisionInfo[0]), null); } if (primaryLoadedRevisions != null && !primaryLoadedRevisions.isEmpty() || additionalRevisions != null && !additionalRevisions.isEmpty()) { List<CDORevision> additional = Collections.emptyList(); if (additionalRevisions != null && !additionalRevisions.isEmpty()) { additional = new ArrayList<CDORevision>(additionalRevisions); } fireEvent(new RevisionsLoadedEvent(this, primaryLoadedRevisions, additional)); } return getResultsAndSynthetics(infos, synthetics); }

Target:
public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics) { RevisionInfo[] infos = new RevisionInfo[ids.size()]; List<RevisionInfo> infosToLoad = createRevisionInfos(ids, branchPoint, prefetchDepth, loadOnDemand, infos); List<CDORevision> primaryLoadedRevisions = null; List<? extends CDORevision> additionalLoadedRevisions = null; if (infosToLoad != null) { additionalLoadedRevisions = loadRevisions(infosToLoad, branchPoint, referenceChunk, prefetchDepth); primaryLoadedRevisions = getResultsAndSynthetics(infosToLoad.toArray(new RevisionInfo[0]), null); } if (primaryLoadedRevisions != null && !primaryLoadedRevisions.isEmpty() || additionalLoadedRevisions != null && !additionalLoadedRevisions.isEmpty()) { List<? extends CDORevision> additional = Collections.emptyList(); if (additionalLoadedRevisions != null && !additionalLoadedRevisions.isEmpty()) { additional = additionalLoadedRevisions; } fireEvent(new RevisionsLoadedEvent(this, primaryLoadedRevisions, additional)); } return getResultsAndSynthetics(infos, synthetics); }
Source:
public ResponseEntity<?> getSubscription(@PathVariable("id") final String subscriptionId, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } return WrappableResult.resultWrapper(() -> subscriptionService.getSubscription(subscriptionId), request); }

Target:
public ResponseEntity<?> getSubscription(@PathVariable("id") final String subscriptionId, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } return WebResult.wrap(() -> subscriptionService.getSubscription(subscriptionId), request); }
Source:
public void addEffect(int potionID, int strength, int seconds, boolean ambient, boolean particles, Target t) { PotionEffect pe = new PotionEffect(PotionEffectType.getById(potionID), (int)Static.msToTicks(seconds * 1000), strength, ambient, particles); try{ if(le != null){ le.addPotionEffect(pe, true); } } catch(NullPointerException e){ Logger.getLogger(BukkitMCLivingEntity.class.getName()).log(Level.SEVERE, "Bukkit appears to have derped. This is a problem with Bukkit, not CommandHelper. The effect should have still been applied.", e); } }

Target:
public void addEffect(int potionID, int strength, int seconds, boolean ambient, boolean particles, Target t) { PotionEffect pe; if (Static.getServer().getMinecraftVersion().lt(MCVersion.MC1_8)) { pe = new PotionEffect(PotionEffectType.getById(potionID), (int)Static.msToTicks(seconds * 1000), strength, ambient); } else { pe = new PotionEffect(PotionEffectType.getById(potionID), (int) Static.msToTicks(seconds * 1000), strength, ambient, particles); } try{ if(le != null){ le.addPotionEffect(pe, true); } } catch(NullPointerException e){ Logger.getLogger(BukkitMCLivingEntity.class.getName()).log(Level.SEVERE, "Bukkit appears to have derped. This is a problem with Bukkit, not CommandHelper. The effect should have still been applied.", e); } }
Source:
ServiceRegistrationImpl getOrCreateRegistration(final ServiceName name) { ServiceRegistrationImpl registration; registration = registry.get(name); if (registration == null) { registration = new ServiceRegistrationImpl(name); ServiceRegistrationImpl existing = registry.putIfAbsent(name, registration); if(existing != null) { return existing; } else { return registration; } } else { return registration; } }

Target:
ServiceRegistrationImpl getOrCreateRegistration(final ServiceName name) { final ConcurrentMap<ServiceName, ServiceRegistrationImpl> registry = this.registry; ServiceRegistrationImpl registration; registration = registry.get(name); if (registration == null) { registration = new ServiceRegistrationImpl(name); ServiceRegistrationImpl existing = registry.putIfAbsent(name, registration); return existing != null ? existing : registration; } else { return registration; } }
Source:
public void setUp() throws Exception { int commonTimeout = stoppingTimeotInaciveWorkspace + shedulerRequstTimeout + TOASTLOADER_WIDGET_LATECY_TIMEOUT_IN_MILLISEC; ide.open(testWorkspace); projectExplorer.waitProjectExplorer(); WaitUtils.sleepQuietly(commonTimeout, TimeUnit.MILLISECONDS); }

Target:
public void setUp() throws Exception { ide.open(testWorkspace); projectExplorer.waitProjectExplorer(); sleepQuietly(getCommonTimeoutInMilliSec(), MILLISECONDS); }
Source:
public static Map<String, Object> getVariablesPojo(String basePath) throws JsonProcessingException, ProcessingException { String filePath = basePath + VARIABLE_CONFIG_PATH; File variableFile = new File(filePath); if (variableFile.exists()) { String jsonConfig = hjsonToJson(readConfigFile(variableFile)); if (verifySchema(VARIABLE, jsonConfig)) { return getModelPojo(jsonConfig, Map.class); } return null; } else { log.info("Variables config file not found at " + filePath); return null; } }

Target:
public static Map<String, Object> getVariablesPojo(String basePath) throws IOException { Map<String, Object> variables = null; String filePath = basePath + VARIABLE_CONFIG_PATH; File variableFile = new File(filePath); if (variableFile.exists()) { String jsonConfig = hjsonToJson(readConfigFile(variableFile)); try { if (DynamicConfigSchemaValidator.verifySchema(VARIABLE, jsonConfig)) { variables = getModelPojo(jsonConfig, Map.class); } } catch (ProcessingException e) { log.error("Error Validating variable config : " + e.getMessage()); throw new IOException(e); } } else { log.info("Variables config file not found at " + filePath); } return (variables == null ? new HashMap<String, Object>() : variables); }
Source:
public CurrencyAmount rpv01( ResolvedCdsIndex cdsIndex, CreditRatesProvider ratesProvider, LocalDate referenceDate, PriceType priceType, ReferenceData refData) { if (isExpired(cdsIndex, ratesProvider)) { return CurrencyAmount.of(cdsIndex.getCurrency(), 0d); } ResolvedCds cds = cdsIndex.toSingleNameCds(); LocalDate stepinDate = cds.getStepinDateOffset().adjust(ratesProvider.getValuationDate(), refData); LocalDate effectiveStartDate = cds.calculateEffectiveStartDate(stepinDate); Triple<CreditDiscountFactors, LegalEntitySurvivalProbabilities, Double> rates = reduceDiscountFactors(cds, ratesProvider); double riskyAnnuity = underlyingPricer.riskyAnnuity( cds, rates.getFirst(), rates.getSecond(), referenceDate, stepinDate, effectiveStartDate, priceType); return CurrencyAmount.of(cds.getCurrency(), cds.getBuySell().normalize(cds.getNotional()) * riskyAnnuity * rates.getThird()); }

Target:
public CurrencyAmount rpv01( ResolvedCdsIndex cdsIndex, CreditRatesProvider ratesProvider, LocalDate referenceDate, PriceType priceType, ReferenceData refData) { if (isExpired(cdsIndex, ratesProvider)) { return CurrencyAmount.of(cdsIndex.getCurrency(), 0d); } ResolvedCds cds = cdsIndex.toSingleNameCds(); LocalDate stepinDate = cds.getStepinDateOffset().adjust(ratesProvider.getValuationDate(), refData); LocalDate effectiveStartDate = cds.calculateEffectiveStartDate(stepinDate); Triple<CreditDiscountFactors, LegalEntitySurvivalProbabilities, Double> rates = reduceDiscountFactors(cds, ratesProvider); double riskyAnnuity = underlyingPricer.riskyAnnuity( cds, rates.getFirst(), rates.getSecond(), referenceDate, stepinDate, effectiveStartDate, priceType); double amount = cds.getBuySell().normalize(cds.getNotional()) * riskyAnnuity * rates.getThird(); return CurrencyAmount.of(cds.getCurrency(), amount); }
Source:
public NodeStats stats() { NodeStats nodeStats = null; for(RawClient rc : cluster) { if (nodeStats == null) nodeStats = rc.stats(); else nodeStats.add(rc.stats()); } return nodeStats; }

Target:
public NodeStats stats() throws IOException { NodeStats nodeStats = null; for(RawClient rc : cluster) { if (nodeStats == null) nodeStats = rc.stats(); else nodeStats.add(rc.stats()); } return nodeStats; }
Source:
protected List<ILogData> getNextEntries(T context, long maxGlobal, Function<ILogData, Boolean> contextCheckFn) { final List<ILogData> dataList = new ArrayList<>(); ILogData thisData; while ((thisData = streamReadWithCheck(()->getNextEntry(context, maxGlobal), maxGlobal)) != null) { dataList.add(thisData); updatePointer(thisData); if (contextCheckFn.apply(thisData)) { break; } } return dataList; }

Target:
protected List<ILogData> getNextEntries(T context, long maxGlobal, Function<ILogData, Boolean> contextCheckFn) { final List<ILogData> dataList = new ArrayList<>(); ILogData thisData; while ((thisData = getNextEntry(context, maxGlobal)) != null) { dataList.add(thisData); updatePointer(thisData); if (contextCheckFn.apply(thisData)) { break; } } return dataList; }
Source:
static List<Path> getSourceFiles(ImmutableSet<SourcePath> srcPaths, BuildContext context) { List<Path> srcFiles = new ArrayList<>(); for (SourcePath path : srcPaths) { Path srcPath = context.getSourcePathResolver().getAbsolutePath(path); if (path instanceof BuildTargetSourcePath && Files.isDirectory(srcPath)) { try (Stream<Path> sourcePaths = Files.list(srcPath)) { srcFiles.addAll(sourcePaths.filter(Files::isRegularFile).collect(Collectors.toList())); } catch (IOException e) { throw new RuntimeException("An error occur when listing the files under " + srcPath, e); } } else { srcFiles.add(srcPath); } } return srcFiles; }

Target:
static List<Path> getSourceFiles(ImmutableSet<SourcePath> srcPaths, BuildContext context) { List<Path> srcFiles = new ArrayList<>(); for (SourcePath path : srcPaths) { Path srcPath = context.getSourcePathResolver().getAbsolutePath(path); if (Files.isDirectory(srcPath)) { try (Stream<Path> sourcePaths = Files.list(srcPath)) { srcFiles.addAll(sourcePaths.filter(Files::isRegularFile).collect(Collectors.toList())); } catch (IOException e) { throw new RuntimeException("An error occur when listing the files under " + srcPath, e); } } else { srcFiles.add(srcPath); } } return srcFiles; }
Source:
public void supports_xlsforms_value_and_label_refs_in_itemsets_using_secondary_external_instances_csv() throws URISyntaxException { supports_xlsforms_value_and_label_refs_in_itemsets_using_secondary_external_instances("external_secondary_instance_non_standard_use_csv.xml"); }

Target:
public void supports_xlsforms_value_and_label_refs_in_itemsets_using_secondary_external_instances_csv() throws URISyntaxException { supports_xlsforms_value_and_label_refs_in_itemsets_using_secondary_external_instances("external_secondary_instance_csv.xml"); }
Source:
private void runLibertyMojoCreate() throws MojoExecutionException { createParams.addAll(commonParams); createParams.addAll(commonServerParams); Xpp3Dom config = stripConfigElements(getLibertyPluginConfig(), createParams); log.info("Running liberty:create goal"); runLibertyMojo("create", config); }

Target:
private void runLibertyMojoCreate() throws MojoExecutionException { Xpp3Dom config = stripConfigElements(getLibertyPluginConfig(), createParams); log.info("Running liberty:create goal"); runLibertyMojo("create", config); }
Source:
public void checkConditions(Map<Tree, Collection<Constraint>> conditions) { for (Entry<Tree, Collection<Constraint>> entry : conditions.entrySet()) { JavaScriptTree condition = (JavaScriptTree) entry.getKey(); if (loopConditions.contains(condition) && !conditionsWithIssue.contains(condition)) { IterationStatementTree loop = getLoop(condition); if (alwaysTrue(entry.getValue()) && !isBrokenLoop(condition, loop, CheckUtils.buildControlFlowGraph(loop))) { loop.accept(new LoopIssueCreator()); } } } }

Target:
public void checkConditions(Map<Tree, Collection<Constraint>> conditions) { alwaysTrueConditions.addAll(conditions.entrySet().stream() .filter(treeCollectionEntry -> alwaysTrue(treeCollectionEntry.getValue())) .map(Map.Entry::getKey) .collect(Collectors.toSet())); }
Source:
public String getFileName(String principalName, Object parsedFileContents, String userIdentifier) { String fileName = "cbcp_" + principalName; if (StringUtils.isNotBlank(userIdentifier)) { fileName += "_" + userIdentifier; } fileName += "_" + getDateTimeService().toDateTimeStringForFilename(getDateTimeService().getCurrentDate()); fileName = StringUtils.remove(fileName, " "); return fileName; }

Target:
public String getFileName(String principalName, Object parsedFileContents, String userIdentifier) { String fileName = "fp_cbcp_" + principalName; if (StringUtils.isNotBlank(userIdentifier)) { fileName += "_" + userIdentifier; } fileName += "_" + getDateTimeService().toDateTimeStringForFilename(getDateTimeService().getCurrentDate()); fileName = StringUtils.remove(fileName, " "); return fileName; }
Source:
public String getLabel(Object object) { return "feature model"; }

Target:
public String getLabel(Object object) { return PDEUIMessages.FeaturesView_loadingDescription; }
Source:
public void testUserAgent() { Internet.USER_AGENT[] agents = Internet.USER_AGENT.values(); for(Internet.USER_AGENT agent : agents){ assertThat(faker.internet().userAgent(agent), IsNot.not(isEmptyOrNullString())); assertThat(faker.resolve("internet.user_agent." + agent.toString()), IsNot.not(isEmptyOrNullString())); } assertThat(faker.internet().userAgentAny(), IsNot.not(isEmptyOrNullString())); }

Target:
public void testUserAgent() { Internet.UserAgent[] agents = Internet.UserAgent.values(); for(Internet.UserAgent agent : agents) { assertThat(faker.internet().userAgent(agent), not(isEmptyOrNullString())); } assertThat(faker.internet().userAgentAny(), not(isEmptyOrNullString())); }
Source:
protected void ExecuteVmCommand() { lockVmWithCompensationIfNeeded(); if (!isInternalExecution()) { freeLock(); } restoreSnapshotAndRemoveObsoleteSnapshots(); boolean succeeded = true; boolean hasAsyncTasks = false; if (getImagesList().size() > 0) { for (DiskImage image : getImagesList()) { if (image.getimageStatus() != ImageStatus.ILLEGAL) { ImagesContainterParametersBase params = new RestoreFromSnapshotParameters(image.getImageId(), getVmId(), targetSnapshot, removedSnapshotId); VdcReturnValueBase returnValue = runAsyncTask(VdcActionType.RestoreFromSnapshot, params); if (!returnValue.getSucceeded()) { succeeded = false; getReturnValue().setFault(returnValue.getFault()); } } } hasAsyncTasks = !getTaskIdList().isEmpty(); } removeSnapshotsFromDB(); if (hasAsyncTasks) { deleteOrphanedImages(); } else { endActionOnVmConfiguration(); } setSucceeded(succeeded); }

Target:
protected void ExecuteVmCommand() { lockVmWithCompensationIfNeeded(); if (!isInternalExecution()) { freeLock(); } restoreSnapshotAndRemoveObsoleteSnapshots(); boolean succeeded = true; boolean hasAsyncTasks = false; if (!getImagesList().isEmpty()) { for (DiskImage image : getImagesList()) { if (image.getimageStatus() != ImageStatus.ILLEGAL) { ImagesContainterParametersBase params = new RestoreFromSnapshotParameters(image.getImageId(), getVmId(), targetSnapshot, removedSnapshotId); VdcReturnValueBase returnValue = runAsyncTask(VdcActionType.RestoreFromSnapshot, params); if (succeeded && !returnValue.getSucceeded()) { succeeded = false; getReturnValue().setFault(returnValue.getFault()); } } } hasAsyncTasks = !getTaskIdList().isEmpty(); } removeSnapshotsFromDB(); if (hasAsyncTasks) { deleteOrphanedImages(); } else { endActionOnVmConfiguration(); } setSucceeded(succeeded); }
Source:
public void prepareLastAddedPartitionMap() throws InterruptedException { prepareStreamHcatEnableMap(); HCatClient hcatClient = getHCatClient(); if (hcatClient == null) { LOG.warn("Did not get hcatclient"); return; } try { for (String stream : streamsToProcess) { if (isStreamHCatEnabled(stream)) { try { hcatClient.getTable(Conduit.getHcatDBName(), getTableName(stream)); findLastPartition(hcatClient, stream); } catch (HCatException e) { if (e.getCause() instanceof NoSuchObjectException) { stopped = true; LOG.error("Got noSuchObject exception while trying to get table" + " or finding last partition " + e.getMessage()); throw new RuntimeException(e.getCause()); } LOG.warn("Got Exception while finding the last added partition for" + " stream " + stream, e); setFailedToGetPartitions(true); } } else { LOG.info("Hcatalog is not enabled for " + stream + " stream"); } } } finally { submitBack(hcatClient); } }

Target:
public void prepareLastAddedPartitionMap() throws InterruptedException { prepareStreamHcatEnableMap(); HCatClient hcatClient = getHCatClient(); if (hcatClient == null) { LOG.warn("Did not get hcatclient hence not finding the last added partition"); for (String stream : streamsToProcess) { if (isStreamHCatEnabled(stream)) { updateLastAddedPartitionMap(getTableName(stream), FAILED_GET_PARTITIONS); ConduitMetrics.updateSWGuage(getServiceType(), FAILED_TO_GET_HCAT_CLIENT_COUNT, stream, 1); } } return; } try { for (String stream : streamsToProcess) { if (isStreamHCatEnabled(stream)) { try { hcatClient.getTable(Conduit.getHcatDBName(), getTableName(stream)); findLastPartition(hcatClient, stream); } catch (HCatException e) { if (e.getCause() instanceof NoSuchObjectException) { LOG.error("Got noSuchObject exception while trying to get table" + " or finding last partition " + e.getMessage()); throw new RuntimeException(e); } LOG.warn("Got Exception while finding the last added partition for" + " stream " + stream, e); updateLastAddedPartitionMap(getTableName(stream), FAILED_GET_PARTITIONS); } } else { LOG.debug("Hcatalog is not enabled for " + stream + " stream"); } } } finally { addToPool(hcatClient); } }
Source:
private void initEditMode(ChangeInfo info) { if (Gerrit.isSignedIn() && info.status().isOpen()) { RevisionInfo rev = info.revision(revision); if (isEditModeEnabled(info, rev)) { editMode.setVisible(fileTableMode == FileTable.Mode.REVIEW); addFile.setVisible(!editMode.isVisible()); reviewMode.setVisible(!editMode.isVisible()); addFileAction = new AddFileAction( changeId, info.revision(revision), style, addFile); } else { editMode.setVisible(false); addFile.setVisible(false); reviewMode.setVisible(false); } if (rev.is_edit()) { reply.setVisible(false); quickApprove.setVisible(false); } } }

Target:
private void initEditMode(ChangeInfo info) { if (Gerrit.isSignedIn() && info.status().isOpen()) { RevisionInfo rev = info.revision(revision); if (isEditModeEnabled(info, rev)) { editMode.setVisible(fileTableMode == FileTable.Mode.REVIEW); addFile.setVisible(!editMode.isVisible()); reviewMode.setVisible(!editMode.isVisible()); addFileAction = new AddFileAction( changeId, info.revision(revision), style, addFile); } else { editMode.setVisible(false); addFile.setVisible(false); reviewMode.setVisible(false); } } }
Source:
public static UploadPackLogger newChain(List<? extends UploadPackLogger> loggers) { UploadPackLogger[] newLoggers = new UploadPackLogger[loggers.size()]; int i = 0; for (UploadPackLogger logger : loggers) { if (logger != UploadPackLogger.NULL) newLoggers[i++] = logger; } if (i == 0) return UploadPackLogger.NULL; else if (i == 1) return newLoggers[0]; else return new UploadPackLoggerChain(newLoggers); }

Target:
public static UploadPackLogger newChain( List<? extends UploadPackLogger> loggers) { UploadPackLogger[] newLoggers = new UploadPackLogger[loggers.size()]; int i = 0; for (UploadPackLogger logger : loggers) if (logger != UploadPackLogger.NULL) newLoggers[i++] = logger; if (i == 0) return UploadPackLogger.NULL; else if (i == 1) return newLoggers[0]; else return new UploadPackLoggerChain(newLoggers, i); }
Source:
public ProcessResult process(AbstractFile abstractFile) { blackboard = currentCase.getSleuthkitCase().getBlackboard(); if (abstractFile.getKnown().equals(TskData.FileKnown.KNOWN)) { return ProcessResult.OK; } if ((abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)) || (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK))) { return ProcessResult.OK; } if ((abstractFile.isFile() == false)) { return ProcessResult.OK; } boolean isMbox = false; boolean isEMLFile = false; try { byte[] t = new byte[64]; if (abstractFile.getSize() > 64) { int byteRead = abstractFile.read(t, 0, 64); if (byteRead > 0) { isMbox = MboxParser.isValidMimeTypeMbox(t); isEMLFile = EMLParser.isEMLFile(abstractFile, t); } } } catch (TskException ex) { logger.log(Level.WARNING, null, ex); } try { communicationArtifactsHelper = new CommunicationArtifactsHelper(currentCase.getSleuthkitCase(), EmailParserModuleFactory.getModuleName(), abstractFile, Account.Type.EMAIL); } catch (TskCoreException ex) { logger.log(Level.SEVERE, String.format("Failed to create CommunicationArtifactsHelper for file %s", abstractFile.getName()), ex); return ProcessResult.ERROR; } if (isMbox) { return processMBox(abstractFile); } if (isEMLFile) { return processEMLFile(abstractFile); } if (PstParser.isPstFile(abstractFile)) { return processPst(abstractFile); } if (VcardParser.isVcardFile(abstractFile)) { return processVcard(abstractFile); } return ProcessResult.OK; }

Target:
public ProcessResult process(AbstractFile abstractFile) { blackboard = currentCase.getSleuthkitCase().getBlackboard(); if (abstractFile.getKnown().equals(TskData.FileKnown.KNOWN)) { return ProcessResult.OK; } if ((abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)) || (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK))) { return ProcessResult.OK; } if ((abstractFile.isFile() == false)) { return ProcessResult.OK; } boolean isMbox = false; boolean isEMLFile = false; try { byte[] t = new byte[64]; if (abstractFile.getSize() > 64) { int byteRead = abstractFile.read(t, 0, 64); if (byteRead > 0) { isMbox = MboxParser.isValidMimeTypeMbox(t); isEMLFile = EMLParser.isEMLFile(abstractFile, t); } } } catch (TskException ex) { logger.log(Level.WARNING, null, ex); } try { communicationArtifactsHelper = new CommunicationArtifactsHelper(currentCase.getSleuthkitCase(), EmailParserModuleFactory.getModuleName(), abstractFile, Account.Type.EMAIL); } catch (TskCoreException ex) { logger.log(Level.SEVERE, String.format("Failed to create CommunicationArtifactsHelper for file with object id = %d", abstractFile.getId()), ex); return ProcessResult.ERROR; } if (isMbox) { return processMBox(abstractFile); } if (isEMLFile) { return processEMLFile(abstractFile); } if (PstParser.isPstFile(abstractFile)) { return processPst(abstractFile); } if (VcardParser.isVcardFile(abstractFile)) { return processVcard(abstractFile); } return ProcessResult.OK; }
Source:
private boolean canPredPushdown(ExprNodeDesc expr, List<ExprNodeDesc> groupByKeys, FastBitSet[] bitSets, int groupingSetPosition) { List<ExprNodeDesc> columns = new ArrayList<ExprNodeDesc>(); extractCols(expr, columns); for (ExprNodeDesc col : columns) { int index = groupByKeys.indexOf(col); assert index >= 0; for (FastBitSet bitset : bitSets) { int keyPos = bitset.nextClearBit(0); for (; keyPos < groupingSetPosition && keyPos != index; keyPos = bitset.nextClearBit(keyPos + 1)); if (keyPos != index) { return false; } } } return true; }

Target:
private boolean canPredPushdown(ExprNodeDesc expr, List<ExprNodeDesc> groupByKeys, FastBitSet[] bitSets, int groupingSetPosition) { List<ExprNodeDesc> columns = new ArrayList<ExprNodeDesc>(); extractCols(expr, columns); for (ExprNodeDesc col : columns) { int index = groupByKeys.indexOf(col); assert index >= 0; for (FastBitSet bitset : bitSets) { int keyPos = bitset.nextClearBit(0); while (keyPos < groupingSetPosition && keyPos != index) { keyPos = bitset.nextClearBit(keyPos + 1); } if (keyPos != index) { return false; } } } return true; }
Source:
public String createAppointment(Appointment appointment) { String id = null; try { login(); URL postUrl = new URL("<LINK_0>" + googleUser + "/private/full"); CalendarEventEntry myEntry = AppointmentConverter.convertAppointmentToCalendarEventEntry(appointment); CalendarEventEntry insertedEntry = service.insert(postUrl, myEntry); id = insertedEntry.getEditLink().getHref(); log.info("Successfully created appointment " + id); appointment.setId(id); } catch (MalformedURLException e) { log.error("unknown type of URL"); } catch (IOException e) { log.error("unable to connect to the google server"); } catch (ServiceException e) { log.error("unable to insert the appointment"); } finally { this.state = AliveState.DISCONNECTED; } return id; }

Target:
public String createAppointment(Appointment appointment) { String id = null; try { login(); URL postUrl = new URL("<LINK_0>" + googleUser + "/private/full"); CalendarEventEntry myEntry = AppointmentConverter.convertAppointmentToCalendarEventEntry(appointment); CalendarEventEntry insertedEntry = service.insert(postUrl, myEntry); id = insertedEntry.getEditLink().getHref(); log.info("Successfully created appointment " + id); appointment.setId(id); } catch (MalformedURLException e) { throw new DomainMethodExecutionException("unknown type of URL", e); } catch (IOException e) { throw new DomainMethodExecutionException("unable to connect to the google server", e); } catch (ServiceException e) { throw new DomainMethodExecutionException("unable to insert the appointment", e); } finally { this.state = AliveState.DISCONNECTED; } return id; }