auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testWithAppEnricher() throws Exception { Entity app = createAndStartApplication("test-app-with-enricher.yaml"); waitForApplicationTasks(app); Assert.assertEquals(app.getDisplayName(), "test-app-with-enricher"); log.info("App started:"); Entities.dumpInfo(app); Assert.assertEquals(app.getEnrichers().size(), 1); final Enricher enricher = app.getEnrichers().iterator().next(); Assert.assertTrue(enricher instanceof TestEnricher); Assert.assertEquals(enricher.getConfig(TestEnricher.CONF_NAME), "Name from YAML"); Assert.assertEquals(enricher.getConfig(TestEnricher.CONF_FROM_FUNCTION), "$brooklyn: is a fun place"); Entity target = ((EntityInternal)app).getExecutionContext().submit(MutableMap.of(), new Callable<Entity>() { public Entity call() { return enricher.getConfig(TestEnricher.TARGET_ENTITY); }}).get(); Assert.assertNotNull(target); Assert.assertEquals(target.getDisplayName(), "testentity"); Assert.assertEquals(target, app.getChildren().iterator().next()); Entity targetFromFlag = ((EntityInternal)app).getExecutionContext().submit(MutableMap.of(), new Callable<Entity>() { public Entity call() { return enricher.getConfig(TestEnricher.TARGET_ENTITY_FROM_FLAG); }}).get(); Assert.assertEquals(targetFromFlag, target); Map<?, ?> leftoverProperties = ((TestEnricher) enricher).getLeftoverProperties(); Assert.assertEquals(leftoverProperties.get("enricherLiteralValue1"), "Hello"); Assert.assertEquals(leftoverProperties.get("enricherLiteralValue2"), "World"); Assert.assertEquals(leftoverProperties.size(), 2); }

Target:
public void testWithAppEnricher() throws Exception { Entity app = createAndStartApplication("test-app-with-enricher.yaml"); waitForApplicationTasks(app); Assert.assertEquals(app.getDisplayName(), "test-app-with-enricher"); log.info("App started:"); Entities.dumpInfo(app); Assert.assertEquals(app.getEnrichers().size(), 1); final Enricher enricher = app.getEnrichers().iterator().next(); Assert.assertTrue(enricher instanceof TestEnricher, "enricher="+enricher); Assert.assertEquals(enricher.getConfig(TestEnricher.CONF_NAME), "Name from YAML"); Assert.assertEquals(enricher.getConfig(TestEnricher.CONF_FROM_FUNCTION), "$brooklyn: is a fun place"); Entity target = ((EntityInternal)app).getExecutionContext().submit(MutableMap.of(), new Callable<Entity>() { public Entity call() { return enricher.getConfig(TestEnricher.TARGET_ENTITY); }}).get(); Assert.assertNotNull(target); Assert.assertEquals(target.getDisplayName(), "testentity"); Assert.assertEquals(target, app.getChildren().iterator().next()); Entity targetFromFlag = ((EntityInternal)app).getExecutionContext().submit(MutableMap.of(), new Callable<Entity>() { public Entity call() { return enricher.getConfig(TestEnricher.TARGET_ENTITY_FROM_FLAG); }}).get(); Assert.assertEquals(targetFromFlag, target); Map<?, ?> leftoverProperties = ((TestEnricher) enricher).getLeftoverProperties(); Assert.assertEquals(leftoverProperties.get("enricherLiteralValue1"), "Hello"); Assert.assertEquals(leftoverProperties.get("enricherLiteralValue2"), "World"); Assert.assertEquals(leftoverProperties.size(), 2); }
Source:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final ChromeScreenshotReportSource that = (ChromeScreenshotReportSource) o; return _ignoreCertificateErrors == that._ignoreCertificateErrors && Objects.equals(getId(), that.getId()) && Objects.equals(getUrl(), that.getUrl()) && Objects.equals(getTitle(), that.getTitle()) && Objects.equals(getTriggeringEventName(), that.getTriggeringEventName()); }

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final ChromeScreenshotReportSource that = (ChromeScreenshotReportSource) o; return _ignoreCertificateErrors == that._ignoreCertificateErrors && Objects.equals(_id, that._id) && Objects.equals(_uri, that._uri) && Objects.equals(_title, that._title) && Objects.equals(_triggeringEventName, that._triggeringEventName); }
Source:
public final void testStorePlanWithRCFile() throws IOException, PlanningException { FileFragment[] frags = FileStorageManager.splitNG(conf, "default.score", score.getMeta(), score.getPath(), Integer.MAX_VALUE); Path workDir = CommonTestingUtil.getTestDir("target/test-data/testStorePlanWithRCFile"); TaskAttemptContext ctx = new TaskAttemptContext(new QueryContext(conf), LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan), new FileFragment[] { frags[0] }, workDir); ctx.setEnforcer(new Enforcer()); ctx.setOutputPath(new Path(workDir, "grouped2")); Expr context = analyzer.parse(CreateTableAsStmts[1]); LogicalPlan plan = planner.createPlan(defaultContext, context); LogicalNode rootNode = optimizer.optimize(plan); TableMeta outputMeta = CatalogUtil.newTableMeta(StoreType.RCFILE); PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf); PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode); exec.init(); exec.next(); exec.close(); Scanner scanner = ((FileStorageManager)StorageManager.getFileStorageManager(conf)).getFileScanner(outputMeta, rootNode.getOutSchema(), ctx.getOutputPath()); scanner.init(); Tuple tuple; int i = 0; while ((tuple = scanner.next()) != null) { assertEquals(6, tuple.get(2).asInt4()); assertEquals(3, tuple.get(3).asInt4()); assertEquals(1, tuple.get(4).asInt4()); i++; } assertEquals(10, i); scanner.close(); assertEquals(10, ctx.getResultStats().getNumRows().longValue()); }

Target:
public final void testStorePlanWithRCFile() throws IOException, PlanningException { FileFragment[] frags = FileStorageManager.splitNG(conf, "default.score", score.getMeta(), new Path(score.getPath()), Integer.MAX_VALUE); Path workDir = CommonTestingUtil.getTestDir("target/test-data/testStorePlanWithRCFile"); TaskAttemptContext ctx = new TaskAttemptContext(new QueryContext(conf), LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan), new FileFragment[] { frags[0] }, workDir); ctx.setEnforcer(new Enforcer()); ctx.setOutputPath(new Path(workDir, "grouped2")); Expr context = analyzer.parse(CreateTableAsStmts[1]); LogicalPlan plan = planner.createPlan(defaultContext, context); LogicalNode rootNode = optimizer.optimize(plan); TableMeta outputMeta = CatalogUtil.newTableMeta(StoreType.RCFILE); PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf); PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode); exec.init(); exec.next(); exec.close(); Scanner scanner = ((FileStorageManager)StorageManager.getFileStorageManager(conf)).getFileScanner( outputMeta, rootNode.getOutSchema(), ctx.getOutputPath()); scanner.init(); Tuple tuple; int i = 0; while ((tuple = scanner.next()) != null) { assertEquals(6, tuple.get(2).asInt4()); assertEquals(3, tuple.get(3).asInt4()); assertEquals(1, tuple.get(4).asInt4()); i++; } assertEquals(10, i); scanner.close(); assertEquals(10, ctx.getResultStats().getNumRows().longValue()); }
Source:
public static <T> void assertFieldValues(String hintMessage, Map<T, String> fields, FormPage<T> page) { String formatString = hintMessage + " field '%s' value"; fields.forEach((key, val) -> { String fieldValue = page.getField(key); if (val == null) { assertTrue(String.format(formatString, key.toString()) + " expected null", isStringEmptyOrNull(fieldValue)); } else { assertEquals(String.format(formatString, key.toString()), val, page.getField(key)); } }); }

Target:
public static <T extends FieldElement> void assertFieldValues(String hintMessage, Map<T, String> fields, FormPage<T> page) { String formatString = hintMessage + " field '%s' value"; fields.forEach((key, val) -> { String fieldValue = page.getField(key); if (val == null) { assertTrue(String.format(formatString, key.toString()) + " expected null", isStringEmptyOrNull(fieldValue)); } else { assertEquals(String.format(formatString, key.toString()), val, page.getField(key)); } }); }
Source:
public BaseOrionExpectTest() { provider = "orion"; }

Target:
public BaseOrionExpectTest() { this.provider = "orionblob"; }
Source:
public void initGui() { super.initGui(); myScrollBar.setLeft( 175 ); myScrollBar.setHeight( 106 ); myScrollBar.setTop( 18 ); searchField = new MEGuiTextField( fontRendererObj, this.guiLeft + Math.max( 107, offsetX ), this.guiTop + 6, 64, fontRendererObj.FONT_HEIGHT ); searchField.setEnableBackgroundDrawing( false ); searchField.setMaxStringLength( 25 ); searchField.setTextColor( 0xFFFFFF ); searchField.setVisible( true ); }

Target:
public void initGui() { super.initGui(); myScrollBar.setLeft( 175 ); myScrollBar.setHeight( 106 ); myScrollBar.setTop( 18 ); searchField = new MEGuiTextField( fontRendererObj, this.guiLeft + Math.max( 107, offsetX ), this.guiTop + 6, 64, fontRendererObj.FONT_HEIGHT ); searchField.setEnableBackgroundDrawing( false ); searchField.setMaxStringLength( 25 ); searchField.setTextColor( 0xFFFFFF ); searchField.setVisible( true ); searchField.setFocused( true ); }
Source:
public HashMap<Component, List<Pair<Component, Integer>>> getFoundComponents() { return foundComponents; }

Target:
public Map<Component, List<Pair<Component, Integer>>> getFoundComponents() { return foundComponents; }
Source:
public void handleGenieException( final HttpServletResponse response, final GenieException e ) throws IOException { if (e instanceof GenieBadRequestException) { this.badRequestRate.increment(); } else if (e instanceof GenieConflictException) { this.conflictRate.increment(); } else if (e instanceof GenieNotFoundException) { this.notFoundRate.increment(); } else if (e instanceof GeniePreconditionException) { this.preconditionRate.increment(); } else if (e instanceof GenieServerException) { this.serverRate.increment(); } else if (e instanceof GenieServerUnavailableException) { this.serverUnavailableRate.increment(); } else if (e instanceof GenieTimeoutException) { this.timeoutRate.increment(); } else if (e instanceof GenieUserLimitExceededException) { this.userLimitExceededRate.increment(); } else { this.genieRate.increment(); } log.error(e.getLocalizedMessage(), e); response.sendError(e.getErrorCode(), e.getLocalizedMessage()); }

Target:
public void handleGenieException( final HttpServletResponse response, final GenieException e ) throws IOException { if (e instanceof GenieBadRequestException) { this.badRequestRate.increment(); } else if (e instanceof GenieConflictException) { this.conflictRate.increment(); } else if (e instanceof GenieNotFoundException) { this.notFoundRate.increment(); } else if (e instanceof GeniePreconditionException) { this.preconditionRate.increment(); } else if (e instanceof GenieServerException) { this.serverRate.increment(); } else if (e instanceof GenieServerUnavailableException) { this.serverUnavailableRate.increment(); } else if (e instanceof GenieTimeoutException) { this.timeoutRate.increment(); } else if (e instanceof GenieUserLimitExceededException) { final GenieUserLimitExceededException userLimitExceededException = (GenieUserLimitExceededException) e; final Id taggedId = this.userLimitExceededRateId .withTag("user", userLimitExceededException.getUser()) .withTag("limit", userLimitExceededException.getExceededLimitName()); this.registry.counter(taggedId).increment(); } else { this.genieRate.increment(); } log.error(e.getLocalizedMessage(), e); response.sendError(e.getErrorCode(), e.getLocalizedMessage()); }
Source:
private static FileDialog createNewFileDialog(Shell parent, int style) { String[] desiredPath = fOverridePath; fOverride = false; return new FileDialog(parent, style) { @Override public String open() { return desiredPath != null ? desiredPath[0] : null; } @Override protected void checkSubclass() { } @Override public String getFileName() { return desiredPath != null ? getFileName(desiredPath[0]) : ""; } @Override public String[] getFileNames() { List<String> inStrings = Arrays.asList(desiredPath); List<String> outStrings = new ArrayList<>(); for (String entry : inStrings) { outStrings.add(getFileName(entry)); } return outStrings.toArray(new String[outStrings.size()]); } @Override public String getFilterPath() { return (desiredPath != null) ? new Path(desiredPath[0]).removeLastSegments(1).toString() : ""; } private String getFileName(String path) { return new Path(path).lastSegment(); } }; }

Target:
private static FileDialog createNewFileDialog(Shell parent, int style) { String[] overrridePath = fOverridePath; String[] sanitizedPath = overrridePath == null ? null : overrridePath.length == 0 ? null : overrridePath; fOverride = false; return new FileDialog(parent, style) { @Override public String open() { return sanitizedPath != null ? sanitizedPath[0] : null; } @Override protected void checkSubclass() { } @Override public String getFileName() { return sanitizedPath != null ? getFileName(sanitizedPath[0]) : ""; } @Override public String[] getFileNames() { List<String> inStrings = sanitizedPath == null ? Collections.emptyList() : Arrays.asList(sanitizedPath); List<String> outStrings = new ArrayList<>(); for (String entry : inStrings) { outStrings.add(getFileName(entry)); } return outStrings.toArray(new String[outStrings.size()]); } @Override public String getFilterPath() { return (sanitizedPath != null) ? new Path(sanitizedPath[0]).removeLastSegments(1).toString() : ""; } private String getFileName(String path) { return new Path(path).lastSegment(); } }; }
Source:
public MrrtReportTemplate getMrrtReportTemplateByUuid(String uuid) { return (MrrtReportTemplate) sessionFactory.getCurrentSession() .createQuery("from MrrtReportTemplate m where m.uuid = :uuid") .setString("uuid", uuid) .uniqueResult(); }

Target:
public MrrtReportTemplate getMrrtReportTemplateByUuid(String uuid) { final Criteria criteria = createMrrtReportTemplateCriteria(); criteria.add(Restrictions.eq("uuid", uuid)); return (MrrtReportTemplate) criteria.uniqueResult(); }
Source:
private static ItemStack insertIntoVanillaInventory(ItemStack stack, Inventory inv) { ItemStack[] contents = inv.getContents(); int minSlot = 0; int maxSlot = contents.length; if (inv instanceof FurnaceInventory) { if (stack.getType().isFuel()) { minSlot = 1; maxSlot = 2; } else { maxSlot = 1; } } else if (inv instanceof BrewerInventory) { if (stack.getType() == Material.POTION || stack.getType() == Material.LINGERING_POTION || stack.getType() == Material.SPLASH_POTION) { maxSlot = 3; } else if (stack.getType() == Material.BLAZE_POWDER) { minSlot = 4; maxSlot = 5; } else { minSlot = 3; maxSlot = 4; } } for (int slot = minSlot; slot < maxSlot; slot++) { ItemStack is = contents[slot]; if (is == null) { inv.setItem(slot, stack.clone()); return null; } else { if (SlimefunUtils.isItemSimilar(is, stack, true, false) && is.getAmount() < is.getType().getMaxStackSize()) { int amount = is.getAmount() + stack.getAmount(); if (amount > is.getType().getMaxStackSize()) { is.setAmount(is.getType().getMaxStackSize()); stack.setAmount(amount - is.getType().getMaxStackSize()); } else { is.setAmount(amount); stack = null; } inv.setItem(slot, is); return stack; } } } return stack; }

Target:
private static ItemStack insertIntoVanillaInventory(ItemStack stack, Inventory inv) { ItemStack[] contents = inv.getContents(); int minSlot = 0; int maxSlot = contents.length; if (inv instanceof FurnaceInventory) { if (stack.getType().isFuel()) { minSlot = 1; maxSlot = 2; } else { maxSlot = 1; } } else if (inv instanceof BrewerInventory) { if (stack.getType() == Material.POTION || stack.getType() == Material.LINGERING_POTION || stack.getType() == Material.SPLASH_POTION) { maxSlot = 3; } else if (stack.getType() == Material.BLAZE_POWDER) { minSlot = 4; maxSlot = 5; } else { minSlot = 3; maxSlot = 4; } } ItemStackWrapper wrapper = new ItemStackWrapper(stack); for (int slot = minSlot; slot < maxSlot; slot++) { ItemStack itemInSlot = contents[slot]; if (itemInSlot == null) { inv.setItem(slot, stack); return null; } else { int maxStackSize = itemInSlot.getType().getMaxStackSize(); if (SlimefunUtils.isItemSimilar(itemInSlot, wrapper, true, false) && itemInSlot.getAmount() < maxStackSize) { int amount = itemInSlot.getAmount() + stack.getAmount(); if (amount > maxStackSize) { stack.setAmount(amount - maxStackSize); } else { stack = null; } itemInSlot.setAmount(Math.min(amount, maxStackSize)); inv.setItem(slot, itemInSlot); return stack; } } } return stack; }
Source:
public static void readByteBufferFully(FileChannel channel, ByteBuffer b) throws IOException { do { if (channel.read(b) == -1) { throwPrematureEndOfFile(); } } while (b.hasRemaining()); }

Target:
static void readByteBufferFully(FileChannel channel, ByteBuffer b) throws IOException { do { if (channel.read(b) == -1) { throwPrematureEndOfFile(); } } while (b.hasRemaining()); }
Source:
private <T, E> List<T> requestList(String url, Class<T> resultClass, QueryPart<T> query, RequestProcessor<E> requestProcessor) { Response response = doRequest(url, query, requestProcessor); if (response.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)) { return response.readEntity(listType(resultClass)); } else if (response.getStatus() == HttpStatus.SC_NOT_FOUND) { return Collections.emptyList(); } else { throw AtsdServerExceptionFactory.fromResponse(response); } }

Target:
private <T, E> List<T> requestList(String url, Class<T> resultClass, QueryPart<T> query, RequestProcessor<E> requestProcessor) { Response response = doRequest(url, query, requestProcessor); if (AtsdUtil.hasStatusFamily(response, Response.Status.Family.SUCCESSFUL)) { return response.readEntity(listType(resultClass)); } else if (response.getStatus() == HttpStatus.SC_NOT_FOUND) { return Collections.emptyList(); } else { throw AtsdServerExceptionFactory.fromResponse(response); } }
Source:
VoltMessage createRepairMessage(Iv2RepairLogResponseMessage msg) { if (msg.getPayload() instanceof CompleteTransactionMessage) { CompleteTransactionMessage message = (CompleteTransactionMessage)msg.getPayload(); message.setForReplica(false); message.setRequireAck(false); message.setTimestamp(m_restartSeqGenerator.getNextSeqNum()); if (tmLog.isDebugEnabled()) { tmLog.debug(m_whoami + "sending completion for txn " + TxnEgo.txnIdToString(message.getTxnId()) + ", ts " + MpRestartSequenceGenerator.restartSeqIdToString(message.getTimestamp())); } return message; } else { FragmentTaskMessage ftm = (FragmentTaskMessage)msg.getPayload(); boolean restart = !ftm.isReadOnly(); if (restart) { assert(ftm.getInitiateTask() != null); m_interruptedTxns.add(ftm.getInitiateTask()); } CompleteTransactionMessage rollback = null; String procName = ftm.getProcedureName(); if (procName != null) { final SystemProcedureCatalog.Config proc = SystemProcedureCatalog.listing.get(procName); if (proc != null && !proc.isRestartable()) { rollback = new CompleteTransactionMessage( ftm.getInitiatorHSId(), ftm.getCoordinatorHSId(), ftm.getTxnId(), ftm.isReadOnly(), 0, true, false, restart, ftm.isForReplay(), ftm.isNPartTxn()); } } return rollback; } }

Target:
VoltMessage createRepairMessage(Iv2RepairLogResponseMessage msg) { if (msg.getPayload() instanceof CompleteTransactionMessage) { CompleteTransactionMessage message = (CompleteTransactionMessage)msg.getPayload(); message.setForReplica(false); message.setRequireAck(false); message.setTimestamp(m_restartSeqGenerator.getNextSeqNum()); if (tmLog.isDebugEnabled()) { tmLog.debug(m_whoami + "sending completion for txn " + TxnEgo.txnIdToString(message.getTxnId()) + ", ts " + MpRestartSequenceGenerator.restartSeqIdToString(message.getTimestamp())); } return message; } else { FragmentTaskMessage ftm = (FragmentTaskMessage)msg.getPayload(); boolean restart = !ftm.isReadOnly(); if (restart) { assert(ftm.getInitiateTask() != null); m_interruptedTxns.add(ftm.getInitiateTask()); } CompleteTransactionMessage rollback = null; if (ftm.isSysProcTask()) { String procName = ftm.getProcedureName(); if (procName != null) { final SystemProcedureCatalog.Config proc = SystemProcedureCatalog.listing.get(procName); if (proc != null && !proc.isRestartable()) { rollback = new CompleteTransactionMessage( ftm.getInitiatorHSId(), ftm.getCoordinatorHSId(), ftm.getTxnId(), ftm.isReadOnly(), 0, true, false, restart, ftm.isForReplay(), ftm.isNPartTxn()); } } } return rollback; } }
Source:
public synchronized void setExecutors(final ScheduledExecutorService mainExecutor, final ScheduledExecutorService secondaryExecutor, final boolean detach) { if (mainExecutor == null || secondaryExecutor == null) { throw new IllegalArgumentException("executors must not be null"); } if (this.executor == mainExecutor && this.secondaryExecutor == secondaryExecutor) { return; } if (running) { throw new IllegalStateException("executor service can not be set on running server"); } if (!this.detachExecutor) { if (this.executor != null) { this.executor.shutdownNow(); } if (this.secondaryExecutor != null) { this.secondaryExecutor.shutdownNow(); } } this.executor = mainExecutor; this.secondaryExecutor = secondaryExecutor; this.detachExecutor = detach; for (Endpoint ep : endpoints) { ep.setExecutors(this.executor, this.secondaryExecutor); } }

Target:
public synchronized void setExecutors(final ScheduledExecutorService mainExecutor, final ScheduledExecutorService secondaryExecutor, final boolean detach) { if (mainExecutor == null || secondaryExecutor == null) { throw new NullPointerException("executors must not be null"); } if (this.executor == mainExecutor && this.secondaryExecutor == secondaryExecutor) { return; } if (running) { throw new IllegalStateException("executor service can not be set on running server"); } if (!this.detachExecutor) { if (this.executor != null) { this.executor.shutdownNow(); } if (this.secondaryExecutor != null) { this.secondaryExecutor.shutdownNow(); } } this.executor = mainExecutor; this.secondaryExecutor = secondaryExecutor; this.detachExecutor = detach; for (Endpoint ep : endpoints) { ep.setExecutors(this.executor, this.secondaryExecutor); } }
Source:
private boolean processNewTransportRelation(Relation rel, TransportRoute r) { for (Entry<Entity, String> entry : rel.getMemberEntities().entrySet()) { String role = entry.getValue(); if (role.isEmpty()) continue; if ("stop".equals(role)) continue; if ("platform".equals(role)) continue; if (role.matches("^(stop|platform)_(entry|exit)_only$")) continue; return false; } List<Entity> platforms = new ArrayList<Entity>(); List<Entity> stops = new ArrayList<Entity>(); for (Entry<Entity, String> entry : rel.getMemberEntities().entrySet()) { String role = entry.getValue(); if (role.startsWith("platform")) platforms.add(entry.getKey()); else if (role.startsWith("stop")) stops.add(entry.getKey()); else r.addWay((Way) entry.getKey()); } if (platforms.isEmpty()) platforms.addAll(stops); if (platforms.isEmpty()) return false; for (Entity s : platforms) { TransportStop stop = new TransportStop(s); if (stop.getName().isEmpty() && stopNames.containsKey(EntityId.valueOf(s))) stop.setName(stopNames.get(EntityId.valueOf(s))); r.getForwardStops().add(stop); } return true; }

Target:
private boolean processNewTransportRelation(Relation rel, TransportRoute r) { for (Entry<Entity, String> entry : rel.getMemberEntities().entrySet()) { String role = entry.getValue(); if (role.isEmpty()) continue; if ("stop".equals(role)) continue; if ("platform".equals(role)) continue; stopPlatformMatcher.reset(role); if (stopPlatformMatcher.matches()) continue; return false; } List<Entity> platforms = new ArrayList<Entity>(); List<Entity> stops = new ArrayList<Entity>(); for (Entry<Entity, String> entry : rel.getMemberEntities().entrySet()) { String role = entry.getValue(); if (role.startsWith("platform")) platforms.add(entry.getKey()); else if (role.startsWith("stop")) stops.add(entry.getKey()); else if (entry.getKey() instanceof Way) r.addWay((Way) entry.getKey()); } Map<Entity, String> replacement = new HashMap<Entity, String>(); List<Entity> merged = mergePlatformsStops(platforms, stops, replacement); if (merged.isEmpty()) return false; for (Entity s : merged) { TransportStop stop = new TransportStop(s); if (replacement.containsKey(s)) stop.setName(replacement.get(s)); else if (s.getTag(OSMTagKey.NAME) == null && stopAreas.containsKey(EntityId.valueOf(s))) stop.setName(stopAreas.get(EntityId.valueOf(s)).getTag(OSMTagKey.NAME)); r.getForwardStops().add(stop); } return true; }
Source:
public void taskAccepted(Executor executor, Queue.Task task) { EC2Computer computer = (EC2Computer) executor.getOwner(); EC2AbstractSlave slaveNode = computer.getNode(); int maxTotalUses = slaveNode.maxTotalUses; if (maxTotalUses <= -1) { LOGGER.info("maxTotalUses set to unlimited (" + slaveNode.maxTotalUses + ") for agent " + slaveNode.instanceId); return; } else if (maxTotalUses <= 1) { LOGGER.info("maxTotalUses drained - suspending agent " + slaveNode.instanceId); computer.setAcceptingTasks(false); } else { slaveNode.maxTotalUses = slaveNode.maxTotalUses - 1; LOGGER.info("maxTotalUses set to " + slaveNode.maxTotalUses + " for agent " + slaveNode.instanceId); } }

Target:
public void taskAccepted(Executor executor, Queue.Task task) { EC2Computer computer = (EC2Computer) executor.getOwner(); EC2AbstractSlave slaveNode = computer.getNode(); int maxTotalUses = slaveNode.maxTotalUses; if (maxTotalUses <= -1) { LOGGER.fine("maxTotalUses set to unlimited (" + slaveNode.maxTotalUses + ") for agent " + slaveNode.instanceId); return; } else if (maxTotalUses <= 1) { LOGGER.info("maxTotalUses drained - suspending agent " + slaveNode.instanceId); computer.setAcceptingTasks(false); } else { slaveNode.maxTotalUses = slaveNode.maxTotalUses - 1; LOGGER.info("Agent " + slaveNode.instanceId + " has " + slaveNode.maxTotalUses + " builds left"); } }
Source:
public Optional<String> getRoutingKey(final TelemetryProtos.TelemetryMessageLog message) { if (message.getUseRoutingKey()) { return Optional.of(String.format("%s@%s:%d", message.getLocation(), message.getSourceAddress(), message.getSourcePort())); } else { return null; } }

Target:
public Optional<String> getRoutingKey(final TelemetryProtos.TelemetryMessageLog message) { if (message.getUseRoutingKey()) { return Optional.of(String.format("%s@%s:%d", message.getLocation(), message.getSourceAddress(), message.getSourcePort())); } return Optional.empty(); }
Source:
public void delete(final String path) throws IOException { LOG.debug("DELETE {}", path); final GenericUrl genericUrl = new GenericUrl(this.url + formatPath(path)); final HttpRequestFactory httpRequestFactory = httpRequestFactoryProvider.getRequestFactory(); final HttpRequest request = httpRequestFactory.buildDeleteRequest(genericUrl); HttpResponse response = null; try { response = request.execute(); if (LOG.isDebugEnabled()) { LOG.debug("DELETE response ", path, response.getStatusCode(), response.getStatusMessage()); } } catch (final HttpResponseException e) { throw new MantaClientHttpResponseException(e); } finally { if (response != null) { response.disconnect(); } } }

Target:
public void delete(final String path) throws IOException { LOG.debug("DELETE {}", path); final GenericUrl genericUrl = new GenericUrl(this.url + formatPath(path)); final HttpRequestFactory httpRequestFactory = httpRequestFactoryProvider.getRequestFactory(); final HttpRequest request = httpRequestFactory.buildDeleteRequest(genericUrl); HttpResponse response = null; try { response = request.execute(); LOG.debug("DELETE response ", path, response.getStatusCode(), response.getStatusMessage()); } catch (final HttpResponseException e) { throw new MantaClientHttpResponseException(e); } finally { if (response != null) { response.disconnect(); } } }
Source:
private GeneralCommandLine getPantsExportCommand(final File outputFile, @NotNull Consumer<String> statusConsumer) throws IOException { final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); Optional<String> rcArg = IJRC.getImportPantsRc(commandLine.getWorkDirectory().getPath()); rcArg.ifPresent(commandLine::addParameter); final File targetSpecsFile = FileUtil.createTempFile("pants_target_specs", ".in"); try (FileWriter targetSpecsFileWriter = new FileWriter(targetSpecsFile)) { for (String targetSpec : getTargetSpecs()) { targetSpecsFileWriter.write(targetSpec); targetSpecsFileWriter.write('\n'); } } commandLine.addParameter("--target-spec-file=" + targetSpecsFile.getPath()); commandLine.addParameter("--no-quiet"); if (getOptions().isImportSourceDepsAsJars()) { commandLine.addParameter("export-dep-as-jar"); if (myResolveSourcesAndDocsForJars) { commandLine.addParameter("--sources"); } } else { commandLine.addParameter("export"); } commandLine.addParameter("--output-file=" + outputFile.getPath()); commandLine.addParameter("--formatted"); if (myResolveSourcesAndDocsForJars) { commandLine.addParameter("--export-libraries-sources"); commandLine.addParameter("--export-libraries-javadocs"); } return commandLine; }

Target:
private GeneralCommandLine getPantsExportCommand(final File outputFile, @NotNull Consumer<String> statusConsumer) throws IOException { final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); Optional<String> rcArg = IJRC.getImportPantsRc(commandLine.getWorkDirectory().getPath()); rcArg.ifPresent(commandLine::addParameter); final File targetSpecsFile = FileUtil.createTempFile("pants_target_specs", ".in"); try (FileWriter targetSpecsFileWriter = new FileWriter(targetSpecsFile)) { for (String targetSpec : getTargetSpecs()) { targetSpecsFileWriter.write(targetSpec); targetSpecsFileWriter.write('\n'); } } commandLine.addParameter("--target-spec-file=" + targetSpecsFile.getPath()); commandLine.addParameter("--no-quiet"); if (PantsUtil.isCompatiblePantsVersion(getProjectPath(), "1.24.0")) { commandLine.addParameter("--export-available-target-types"); } if (getOptions().isImportSourceDepsAsJars()) { commandLine.addParameter("export-dep-as-jar"); commandLine.addParameter("--sources"); } else { commandLine.addParameter("export"); } commandLine.addParameter("--output-file=" + outputFile.getPath()); commandLine.addParameter("--formatted"); if (myResolveSourcesAndDocsForJars) { commandLine.addParameter("--export-libraries-sources"); commandLine.addParameter("--export-libraries-javadocs"); } return commandLine; }
Source:
public AccountService getAccountService() throws InstantiationException { return new HelixAccountService(storeConfig, new HelixPropertyStoreFactory<>()); }

Target:
public AccountService getAccountService() { long startTimeMs = System.currentTimeMillis(); logger.info("Starting a HelixAccountService"); ZkClient zkClient = new ZkClient(storeConfig.zkClientConnectString, storeConfig.zkClientSessionTimeoutMs, storeConfig.zkClientConnectionTimeoutMs, new ZNRecordSerializer()); List<String> subscribedPaths = Collections.singletonList(storeConfig.rootPath); HelixPropertyStore<ZNRecord> helixStore = new ZkHelixPropertyStore<>(new ZkBaseDataAccessor<>(zkClient), storeConfig.rootPath, subscribedPaths); logger.info("HelixPropertyStore started with zkClientConnectString={}, zkClientSessionTimeoutMs={}, " + "zkClientConnectionTimeoutMs={}, rootPath={}, subscribedPaths={}", storeConfig.zkClientConnectString, storeConfig.zkClientSessionTimeoutMs, storeConfig.zkClientConnectionTimeoutMs, storeConfig.rootPath, subscribedPaths); HelixAccountService helixAccountService = new HelixAccountService(helixStore, accountServiceMetrics, notifier); long spentTimeMs = System.currentTimeMillis() - startTimeMs; logger.info("HelixAccountService started, took ms", spentTimeMs); accountServiceMetrics.startupTimeInMs.update(spentTimeMs); return helixAccountService; }
Source:
public CompactSketch<T> filter(Sketch<T> sketchIn) { QuickSelectSketch<T> sketch = new QuickSelectSketch<>(sketchIn.getRetainedEntries(), 0, summaryFactory); final SketchIterator<T> it = sketchIn.iterator(); while (it.next()) { final T summary = it.getSummary(); if (predicate.test(summary)) { sketch.insert(it.getKey(), summary.copy()); } } sketch.setThetaLong(sketchIn.getThetaLong()); sketch.setNotEmpty(); return sketch.compact(); }

Target:
public CompactSketch<T> filter(Sketch<T> sketchIn) { if (sketchIn == null) return new CompactSketch<>(null, null, Long.MAX_VALUE, true); QuickSelectSketch<T> sketch = new QuickSelectSketch<>(sketchIn.getRetainedEntries(), ResizeFactor.X1.lg(), null); boolean empty = true; final SketchIterator<T> it = sketchIn.iterator(); while (it.next()) { final T summary = it.getSummary(); if (predicate.test(summary)) { sketch.insert(it.getKey(), summary.copy()); empty = false; } } sketch.setThetaLong(sketchIn.getThetaLong()); if (!empty) sketch.setNotEmpty(); return sketch.compact(); }
Source:
public Response build() { return Response.create(status, reason, headers, body, request); }

Target:
public Response build() { return new Response(this); }
Source:
protected void deleteAllObjectsInContainerDLO(String regionId, final String containerName) { Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS); ObjectList objects = getApi().getObjectApi(regionId, containerName).list(new ListContainerOptions()); if (objects == null) { return; } List<String> pathsToDelete = Lists.transform(objects, new Function<SwiftObject, String>() { public String apply(SwiftObject input) { return containerName + "/" + input.getName(); } }); if (!pathsToDelete.isEmpty()) { for (String name : pathsToDelete) getApi().getObjectApi(regionId, containerName).delete(name); } }

Target:
protected void deleteAllObjectsInContainerDLO(String regionId, final String containerName) { ObjectList objects = getApi().getObjectApi(regionId, containerName).list(new ListContainerOptions()); if (objects == null) { return; } for (SwiftObject object : objects) { String name = containerName + "/" + object.getName(); getApi().getObjectApi(regionId, containerName).delete(name); } }
Source:
private CustomTabsIntent buildCustomTabsIntent() { CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); builder.setShowTitle(true); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(activity); int color; if (pref.getBoolean(Constants.CONFIG_DARK_THEME, false)) { color = activity.getResources().getColor(R.color.primary_material_dark); } else { color = activity.getResources().getColor(R.color.pumpkin_primary); } builder.setToolbarColor(color); String saveLabel = activity.getResources().getString(R.string.save); Bitmap saveIcon = BitmapFactory.decodeResource(activity.getResources(), R.drawable.ic_share_white_24dp); builder.setActionButton(saveIcon, saveLabel, createShareIntent()); return builder.build(); }

Target:
private CustomTabsIntent buildCustomTabsIntent() { CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); builder.setShowTitle(true); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(activity); int color; if (pref.getBoolean(Constants.CONFIG_DARK_THEME, false)) { color = ContextCompat.getColor(activity, R.color.primary_material_dark); } else { color = ContextCompat.getColor(activity, R.color.pumpkin_primary); } builder.setToolbarColor(color); String label = activity.getResources().getString(R.string.share); Bitmap icon = BitmapFactory.decodeResource(activity.getResources(), R.drawable.ic_share_white_24dp); builder.setActionButton(icon, label, createShareIntent()); return builder.build(); }
Source:
public void txAbort() { operations.clear(); tablesInTxn.clear(); if (TransactionalContext.isInTransaction()) { this.objectsView.TXAbort(); tablesInTxn.forEach(t -> t.getMetrics().numTxnAborts.incrementAndGet()); } }

Target:
public void txAbort() { operations.clear(); if (TransactionalContext.isInTransaction()) { this.objectsView.TXAbort(); tablesInTxn.forEach(t -> t.getMetrics().incNumTxnAborts()); } tablesInTxn.clear(); }
Source:
public void testLoadGlobalMRUObjectsFromServer() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); Map<String, String> idToSubjects = new HashMap<String, String>(); int numberOfRecords = 1; idToSubjects = createRecordsOnServer(numberOfRecords, Constants.CASE); String[] ids = idToSubjects.keySet().toArray(new String[numberOfRecords]); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size()+numberOfRecords, mruObjects.size()); } finally { deleteRecordsOnServer(ids, Constants.CASE); } }

Target:
public void testLoadGlobalMRUObjectsFromServer() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); int numberOfRecords = 1; Map<String, String> idToSubjects = createRecordsOnServer(numberOfRecords, Constants.CASE); Set<String> ids = idToSubjects.keySet(); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size()+numberOfRecords, mruObjects.size()); } finally { deleteRecordsOnServer(ids, Constants.CASE); } }
Source:
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try { MinioClient minioClient = MinioClient.builder() .endpoint("<LINK_1>") .credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG") .build(); String config = "<ReplicationConfiguration>" + " <Role>arn:aws:iam::35667example:role/CrossRegionReplicationRoleForS3</Role>" + " <Rule>" + " <ID>rule1</ID>" + " <Status>Enabled</Status>" + " <Priority>1</Priority>" + " <DeleteMarkerReplication>" + " <Status>Disabled</Status>" + " </DeleteMarkerReplication>" + " <Filter>" + " <And>" + " <Prefix>TaxDocs</Prefix>" + " <Tag>" + " <Key>key1</Key>" + " <Value>value1</Value>" + " </Tag>" + " <Tag>" + " <Key>key1</Key>" + " <Value>value1</Value>" + " </Tag>" + " </And>" + " </Filter>" + " <Destination>" + " <Bucket>arn:aws:s3:::exampletargetbucket</Bucket>" + " </Destination>" + " </Rule>" + "</ReplicationConfiguration>"; minioClient.setBucketReplication( SetBucketReplicationArgs.builder().bucket("my-bucketname").config(config).build()); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }

Target:
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try { MinioClient minioClient = MinioClient.builder() .endpoint("<LINK_1>") .credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG") .build(); String config = "<ReplicationConfiguration>" + " <Role>REPLACE-WITH-ACTUAL-REPLICATION-ROLE</Role>" + " <Rule>" + " <ID>rule1</ID>" + " <Status>Enabled</Status>" + " <Priority>1</Priority>" + " <DeleteMarkerReplication>" + " <Status>Disabled</Status>" + " </DeleteMarkerReplication>" + " <Filter>" + " <And>" + " <Prefix>TaxDocs</Prefix>" + " <Tag>" + " <Key>key1</Key>" + " <Value>value1</Value>" + " </Tag>" + " <Tag>" + " <Key>key2</Key>" + " <Value>value2</Value>" + " </Tag>" + " </And>" + " </Filter>" + " <Destination>" + " <Bucket>REPLACE-WITH-ACTUAL-DESTINATION-BUCKET-ARN</Bucket>" + " </Destination>" + " </Rule>" + "</ReplicationConfiguration>"; minioClient.setBucketReplication( SetBucketReplicationArgs.builder().bucket("my-bucketname").config(config).build()); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }
Source:
private Map.Entry<K, V> convert(String bucketToConvert) { final String[] keyValue = bucketToConvert.split(Pattern.quote(KEY_VALUE_DELIMITER)); checkKeyValue(keyValue); final String key = keyValue[0]; final String value = keyValue[1]; try { final K convertedKey = convert(keyClass, key); final V convertedValue = convert(valueClass, value); final Map.Entry<K, V> convertedBucket = new AbstractMap.SimpleEntry<>(convertedKey, convertedValue); return convertedBucket; } catch (Throwable e) { throw newIllegalArgumentException("The exception is occurred during the conversion", e); } }

Target:
private Map.Entry<K, V> convert(String bucketToConvert) { final String[] keyValue = bucketToConvert.split(keyValuePattern); checkKeyValue(keyValue); final String key = unquote(keyValue[0]); final String value = unquote(keyValue[1]); try { final K convertedKey = convert(keyClass, key); final V convertedValue = convert(valueClass, value); final Map.Entry<K, V> convertedBucket = new AbstractMap.SimpleEntry<>(convertedKey, convertedValue); return convertedBucket; } catch (Throwable e) { throw newIllegalArgumentException("The exception occurred during the conversion", e); } }
Source:
public void execute(){ List<String> keys = _accountService.getKeys(this); RegisterResponse response = new RegisterResponse(); if(keys != null){ response.setApiKey(keys.get(0)); response.setSecretKey(keys.get(1)); } response.setObjectName("listkeys"); response.setResponseName(getCommandName()); this.setResponseObject(response); }

Target:
public void execute(){ Map<String, String> keys = _accountService.getKeys(this); RegisterResponse response = new RegisterResponse(); if(keys != null){ response.setApiKey(keys.get("apikey")); response.setSecretKey(keys.get("secretkey")); } response.setObjectName("userkeys"); response.setResponseName(getCommandName()); this.setResponseObject(response); }
Source:
public BlobProperties(long blobSize, String serviceId) { timeToLive = SystemTime.getInstance().milliseconds() + (SystemTime.SecsPerHour * SystemTime.MsPerSec); isPrivate = false; this.blobSize = blobSize; this.creationTime = SystemTime.getInstance().milliseconds(); this.serviceId = serviceId; this.contentType = null; this.memberId = null; this.parentBlobId = null; }

Target:
public BlobProperties(long blobSize, String serviceId) { timeToLiveInMs = SystemTime.getInstance().milliseconds() + (SystemTime.MsPerSec * SystemTime.SecsPerHour); isPrivate = false; this.blobSize = blobSize; this.creationTimeInMs = SystemTime.getInstance().milliseconds(); this.serviceId = serviceId; this.contentType = null; this.memberId = null; this.parentBlobId = null; }
Source:
public void output(String s) { frame.getDialogService().notify(s); }

Target:
public void output(String s) { dialogService.notify(s); }
Source:
private void updateMutePreviewOverlayVisibility() { boolean showMuteOverlay = getMuteOverlayConfig(); mutePreviewOverlay.setVisibility( showMuteOverlay && muteButton.isChecked() && !isInGreenScreenMode ? View.VISIBLE : View.GONE); }

Target:
private void updateMutePreviewOverlayVisibility() { mutePreviewOverlay.setVisibility( getMuteOverlayConfig() && muteButton.isChecked() && !isInGreenScreenMode ? View.VISIBLE : View.GONE); }
Source:
public void runParagraphs(RunParagraphsEvent event) { try { listener.runParagraphs(event.getNoteId(), event.getParagraphIndices(), event.getParagraphIds(), event.getCurParagraphId()); if (InterpreterContext.get() != null) { LOGGER.info("complete runParagraphs." + InterpreterContext.get().getParagraphId() + " " + event); } else { LOGGER.info("complete runParagraphs." + event); } } catch (IOException e) { LOGGER.error(e.getMessage()); } }

Target:
public void runParagraphs(RunParagraphsEvent event) throws TException { try { listener.runParagraphs(event.getNoteId(), event.getParagraphIndices(), event.getParagraphIds(), event.getCurParagraphId()); if (InterpreterContext.get() != null) { LOGGER.info("complete runParagraphs." + InterpreterContext.get().getParagraphId() + " " + event); } else { LOGGER.info("complete runParagraphs." + event); } } catch (IOException e) { throw new TException(e); } }
Source:
public NettyServerFactory(VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, final RestRequestHandler requestHandler, final PublicAccessLogger publicAccessLogger, final RestServerState restServerState, SSLFactory sslFactory) { if (verifiableProperties == null || metricRegistry == null || requestHandler == null || publicAccessLogger == null || restServerState == null) { throw new IllegalArgumentException("Null arg(s) received during instantiation of NettyServerFactory"); } this.nettyConfig = new NettyConfig(verifiableProperties); this.nettyMetrics = new NettyMetrics(metricRegistry); ConnectionStatsHandler connectionStatsHandler = new ConnectionStatsHandler(nettyMetrics); Map<Integer, ChannelInitializer<SocketChannel>> initializers = new HashMap<>(); initializers.put(nettyConfig.nettyServerPort, new NettyServerChannelInitializer(nettyConfig, nettyMetrics, connectionStatsHandler, requestHandler, publicAccessLogger, restServerState, null)); if (sslFactory != null) { initializers.put(nettyConfig.nettyServerSSLPort, new NettyServerChannelInitializer(nettyConfig, nettyMetrics, connectionStatsHandler, requestHandler, publicAccessLogger, restServerState, sslFactory)); } this.channelInitializers = Collections.unmodifiableMap(initializers); }

Target:
public NettyServerFactory(VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, final RestRequestHandler requestHandler, final PublicAccessLogger publicAccessLogger, final RestServerState restServerState, SSLFactory sslFactory) { if (verifiableProperties == null || metricRegistry == null || requestHandler == null || publicAccessLogger == null || restServerState == null) { throw new IllegalArgumentException("Null arg(s) received during instantiation of NettyServerFactory"); } nettyConfig = new NettyConfig(verifiableProperties); if (sslFactory == null && nettyConfig.nettyServerSSLEnabled) { throw new IllegalArgumentException("NettyServer requires SSL, but sslFactory is null"); } nettyMetrics = new NettyMetrics(metricRegistry); ConnectionStatsHandler connectionStatsHandler = new ConnectionStatsHandler(nettyMetrics); Map<Integer, ChannelInitializer<SocketChannel>> initializers = new HashMap<>(); initializers.put(nettyConfig.nettyServerPort, new NettyServerChannelInitializer(nettyConfig, nettyMetrics, connectionStatsHandler, requestHandler, publicAccessLogger, restServerState, null)); if (nettyConfig.nettyServerSSLEnabled) { initializers.put(nettyConfig.nettyServerSSLPort, new NettyServerChannelInitializer(nettyConfig, nettyMetrics, connectionStatsHandler, requestHandler, publicAccessLogger, restServerState, sslFactory)); } channelInitializers = Collections.unmodifiableMap(initializers); }
Source:
public TenantIdentityMgtClient(String cookie, String backendServerURL, ConfigurationContext configContext) throws Exception { try { stub = new UserIdentityManagementAdminServiceStub(configContext, backendServerURL + "UserIdentityManagementAdminService"); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (Exception e) { throw new Exception("Error occurred while creating TenantIdentityMgtClient Object"); } }

Target:
public TenantIdentityMgtClient(String cookie, String backendServerURL, ConfigurationContext configContext) throws Exception { try { stub = new UserIdentityManagementAdminServiceStub(configContext, backendServerURL + IdentityMgtAdminUIConstants.IDENTITY_MGT_ADMIN_SERVICE_URL); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (Exception e) { throw new Exception("Error occurred while creating TenantIdentityMgtClient Object", e); } }
Source:
public void testInspectGcsFile() throws InterruptedException, ExecutionException, IOException { InspectGcsFile.inspectGcsFile(PROJECT_ID, GCS_PATH, TOPIC_ID, SUBSCRIPTION_ID); String output = bout.toString(); assertThat(output, containsString("Job created: ")); String jobId = output.split("Job created: ")[1].split("\n")[0]; CancelDlpJobRequest request = CancelDlpJobRequest.newBuilder().setName(jobId).build(); try (DlpServiceClient client = DlpServiceClient.create()) { client.cancelDlpJob(request); } }

Target:
public void testInspectGcsFile() throws InterruptedException, ExecutionException, IOException { InspectGcsFile.inspectGcsFile(PROJECT_ID, GCS_PATH, TOPIC_ID, SUBSCRIPTION_ID); TimeUnit.SECONDS.sleep(3); String output = bout.toString(); assertThat(output, containsString("Job created: ")); String jobId = output.split("Job created: ")[1].split("\n")[0]; CancelDlpJobRequest request = CancelDlpJobRequest.newBuilder().setName(jobId).build(); try (DlpServiceClient client = DlpServiceClient.create()) { client.cancelDlpJob(request); } }