auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public static Async<Void> parallel(Collection<? extends Async<?>> asyncs, final boolean alwaysSucceed, <END> final ParallelData parallelData) { final ResolvableAsync<Void> result = parallelData.getResultAsync(); final Runnable checkTermination = new Runnable() { @Override public void run() { if (parallelData.decrementInProgressAndGet() == 0) { List<Throwable> exceptions = parallelData.getExceptions(); if (!exceptions.isEmpty() && !alwaysSucceed) { result.failure(new ThrowableCollectionException(exceptions)); } else { result.success(null); } } } }; for (Async<?> a : asyncs) { a.onResult(new Consumer<Object>() { @Override public void accept(Object item) { checkTermination.run(); } }, new Consumer<Throwable>() { @Override public void accept(Throwable failure) { parallelData.addException(failure); checkTermination.run(); } }); } if (asyncs.isEmpty()) { return Asyncs.constant(null); } return result; }</code><technical_language>this method private</technical_language>

Target:
private static Async<Void> parallel(Collection<? extends Async<?>> asyncs, final boolean alwaysSucceed, final ParallelData parallelData) { if (asyncs.isEmpty()) { return Asyncs.constant(null); } final ResolvableAsync<Void> result = parallelData.getResultAsync(); final Runnable checkTermination = new Runnable() { @Override public void run() { if (parallelData.decrementInProgressAndGet() == 0) { List<Throwable> exceptions = parallelData.getExceptions(); if (!exceptions.isEmpty() && !alwaysSucceed) { result.failure(new ThrowableCollectionException(exceptions)); } else { result.success(null); } } } }; for (Async<?> a : asyncs) { a.onResult(new Consumer<Object>() { @Override public void accept(Object item) { checkTermination.run(); } }, new Consumer<Throwable>() { @Override public void accept(Throwable failure) { parallelData.addException(failure); checkTermination.run(); } }); } return result; }
Source:
<code>public boolean upgradeClusterManager(long stackId, StatedImage currentImage, StatedImage targetImage) { String currentCmBuildNumber = currentImage.getImage().getCmBuildNumber(); <START> boolean clusterManagerUpdateNeeded = !currentCmBuildNumber.equals(targetImage.getImage().getCmBuildNumber()); <END> flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), DATALAKE_UPGRADE, targetImage.getImage().getUuid()); clusterService.updateClusterStatusByStackId(stackId, Status.UPDATE_IN_PROGRESS); if (clusterManagerUpdateNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE); } else { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_NOT_NEEDED, currentCmBuildNumber); } return clusterManagerUpdateNeeded; }</code><technical_language>Pls. ensure this is NPE safe</technical_language>

Target:
public boolean upgradeClusterManager(long stackId, StatedImage currentImage, StatedImage targetImage) { String currentCmBuildNumber = currentImage.getImage().getCmBuildNumber(); boolean clusterManagerUpdateNeeded = isUpdateNeeded(currentCmBuildNumber, targetImage.getImage().getCmBuildNumber()); flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), DATALAKE_UPGRADE, targetImage.getImage().getUuid()); clusterService.updateClusterStatusByStackId(stackId, Status.UPDATE_IN_PROGRESS); if (clusterManagerUpdateNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE); } else { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_NOT_NEEDED, currentCmBuildNumber); } return clusterManagerUpdateNeeded; }
Source:
<code>public SpongeGameModeData(GameMode mode) { <START> super(GameModeData.class, mode, Keys.GAME_MODE, ImmutableGameModeData.class); <END> }</code><technical_language>ImmutableGameModeData class supposed here, supposed Sponge equivalent implementation, in this case ImmutableSpongGameModeData.class</technical_language>

Target:
public SpongeGameModeData(GameMode mode) { super(GameModeData.class, mode, Keys.GAME_MODE, ImmutableSpongeGameModeData.class); }
Source:
<code>private SoftwareInfoManager(XMPPConnection connection) throws IOException, XmlPullParserException, SmackParsingException { super(connection); serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); <START> addFeature(); <END> discoverInfoBuilder = DiscoverInfo.builder(connection); }</code><technical_language>I *think* adding disco feature is unnecessary in this place, ServiceDiscoveryManager announce itself</technical_language>

Target:
private SoftwareInfoManager(XMPPConnection connection) throws IOException, XmlPullParserException, SmackParsingException { super(connection); serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); }
Source:
<code>public void complete(T value) { Preconditions.checkState( <START> future.complete(value)); <END> }</code><technical_language>nit: error message? (applying this class)</technical_language>

Target:
public void complete(T value) { Preconditions.checkState( future.complete(value), "This result is already completed"); }
Source:
<code>public static void setRandomProfession(EntityVillager entity, Random rand) { ArrayList<String> entries = new ArrayList(INSTANCE.professionsByName.keySet()); int prof = rand.nextInt(entries.size()); VillagerProfession profession = INSTANCE.professionsByName.get(entries.get(prof)); <START> entity.setProfession(profession.id); <END> }</code><technical_language>Problem this is HashMaps ordered this is in world gen derp dont vanilla world gen compatibility, need a ordered list of professions ID</technical_language>

Target:
public static void setRandomProfession(EntityVillager entity, Random rand) { ArrayList entries = new ArrayList(INSTANCE.professions.getKeys()); int prof = rand.nextInt(entries.size()); VillagerProfession profession = INSTANCE.professions.getObject(entries.get(prof)); entity.setProfession(profession.getId()); }
Source:
<code>private void openDialog(Shell shell, EditableConfiguration config, ConfigurationViewModels configurationViewModels) { config.setIsComponent(true); EditConfigDialog editDialog = new EditConfigDialog(shell, TITLE, SUB_TITLE, config, true, configurationViewModels, false); if (editDialog.open() == Window.OK) { if (editDialog.doAsComponent()) { SERVER.saveAsComponent().uncheckedWrite(editDialog.getComponent()); } else { SERVER.saveAs().uncheckedWrite(editDialog.getConfig()); } } <START> editDialog.close(); <END> }</code><technical_language>autocloseable try-with-resources</technical_language>

Target:
private void openDialog(Shell shell, EditableConfiguration config, ConfigurationViewModels configurationViewModels) { config.setIsComponent(true); EditConfigDialog editDialog = new EditConfigDialog(shell, TITLE, SUB_TITLE, config, true, configurationViewModels, false); if (editDialog.open() == Window.OK) { if (editDialog.doAsComponent()) { SERVER.saveAsComponent().uncheckedWrite(editDialog.getComponent()); } else { SERVER.saveAs().uncheckedWrite(editDialog.getConfig()); } } }
Source:
<code>public Iterator<Proposal> getProposalsFromTxnLog(long startZxid, long sizeLimit) { if (sizeLimit < 0) { LOG.debug("Negative size limit - retrieving proposal via txnlog is disabled"); return TxnLogProposalIterator.EMPTY_ITERATOR; } TxnIterator itr = null; try { itr = snapLog.readTxnLog(startZxid, false); if ((itr.getHeader() != null) && (itr.getHeader().getZxid() > startZxid)) { <START> LOG.warn("Unable to find proposals from txnlog for zxid: {}", startZxid); <END> itr.close(); return TxnLogProposalIterator.EMPTY_ITERATOR; } if (sizeLimit > 0) { long txnSize = itr.getStorageSize(); if (txnSize > sizeLimit) { LOG.info("Txnlog size: exceeds sizeLimit: {}", txnSize, sizeLimit); itr.close(); return TxnLogProposalIterator.EMPTY_ITERATOR; } } } catch (IOException e) { LOG.error("Unable to read txnlog from disk", e); try { if (itr != null) { itr.close(); } } catch (IOException ioe) { LOG.warn("Error closing file iterator", ioe); } return TxnLogProposalIterator.EMPTY_ITERATOR; } return new TxnLogProposalIterator(itr); }</code><technical_language>Add "0x"s? (and Long.toHexString())</technical_language>

Target:
public Iterator<Proposal> getProposalsFromTxnLog(long startZxid, long sizeLimit) { if (sizeLimit < 0) { LOG.debug("Negative size limit - retrieving proposal via txnlog is disabled"); return TxnLogProposalIterator.EMPTY_ITERATOR; } TxnIterator itr = null; try { itr = snapLog.readTxnLog(startZxid, false); if ((itr.getHeader() != null) && (itr.getHeader().getZxid() > startZxid)) { LOG.warn( "Unable to find proposals from txnlog for zxid: 0x{}", Long.toHexString(startZxid)); itr.close(); return TxnLogProposalIterator.EMPTY_ITERATOR; } if (sizeLimit > 0) { long txnSize = itr.getStorageSize(); if (txnSize > sizeLimit) { LOG.info("Txnlog size: exceeds sizeLimit: {}", txnSize, sizeLimit); itr.close(); return TxnLogProposalIterator.EMPTY_ITERATOR; } } } catch (IOException e) { LOG.error("Unable to read txnlog from disk", e); try { if (itr != null) { itr.close(); } } catch (IOException ioe) { LOG.warn("Error closing file iterator", ioe); } return TxnLogProposalIterator.EMPTY_ITERATOR; } return new TxnLogProposalIterator(itr); }
Source:
<code>public static String getSuggestedDiskAlias(Disk disk, String diskPrefix) { String diskAlias; if (disk == null) { diskAlias = getDefaultDiskAlias(diskPrefix, "1"); <START> log.errorFormat("Disk object is null, the suggested default disk alias to be used is %1$s", <END> diskAlias); } else { diskAlias = disk.getDiskAlias(); if (diskAlias == null) { diskAlias = getDefaultDiskAlias(diskPrefix, new Integer(disk.getInternalDriveMapping()).toString()); log.infoFormat("Disk alias retrieved from the client is null, the suggested default disk alias to be used is %1$s", diskAlias); } } return diskAlias; }</code><technical_language>this is error? warn? this is called? do expect happen</technical_language>

Target:
public static String getSuggestedDiskAlias(Disk disk, String diskPrefix) { String diskAlias; if (disk == null) { diskAlias = getDefaultDiskAlias(diskPrefix, "1"); log.warnFormat("Disk object is null, the suggested default disk alias to be used is %1$s", diskAlias); } else { diskAlias = disk.getDiskAlias(); if (diskAlias == null) { diskAlias = getDefaultDiskAlias(diskPrefix, String.valueOf(disk.getInternalDriveMapping())); log.infoFormat("Disk alias retrieved from the client is null, the suggested default disk alias to be used is %1$s", diskAlias); } } return diskAlias; }
Source:
<code>public GenericShuffleProducer construct(ConstructArgs args) { return new GenericShuffleProducer( null, getRealOperatorIds().toArray(new ExchangePairID[] {}), <START> MyriaUtils.integerSetToIntArray(getRealWorkerIds()), <END> new BroadcastDistributeFunction(getRealWorkerIds().size())); }</code><technical_language>changed Ints.toArray()</technical_language>

Target:
public GenericShuffleProducer construct(ConstructArgs args) { GenericShuffleProducer ret = new GenericShuffleProducer( null, getRealOperatorIds().toArray(new ExchangePairID[] {}), Ints.toArray(getRealWorkerIds()), new BroadcastDistributeFunction()); ret.getDistributeFunction().setDestinations(getRealWorkerIds().size(), 1); return ret; }
Source:
<code>protected String resolveJava() throws InterruptedException, IOException { for (JavaProvider provider : JavaProvider.all()) { for (String javaCommand : provider.getJavas(computer, listener, connection)) { LOGGER.fine("Trying Java at " + javaCommand); try { return checkJavaVersion(listener, javaCommand); } catch (IOException e) { LOGGER.log(FINE, "Failed to check the Java version",e); } } } <START> throw new IOException("Java not found " + computer + ", install a Java 8+ version on the Agent, if you need " <END> + "others JDK use the Global Tool Configuration to install them."); }</code><technical_language>If talking version of Java run Agent, Java 8 is currently supported. If talking version Agent build with, different. intent of message. like: "Java " + computer + ". Install a Java 8 version Agent. Global Tool Configuration install them."</technical_language>

Target:
protected String resolveJava() throws InterruptedException, IOException { for (JavaProvider provider : JavaProvider.all()) { for (String javaCommand : provider.getJavas(computer, listener, connection)) { LOGGER.fine("Trying Java at " + javaCommand); try { return checkJavaVersion(listener, javaCommand); } catch (IOException e) { LOGGER.log(FINE, "Failed to check the Java version",e); } } } throw new IOException("Java not found on " + computer + ". Install a Java 8 version on the Agent."); }
Source:
<code><START> public void testInvokeRebalanceAndInvokeRebalanceForResource() { <END> String resourceName = "ResourceToInvoke"; _gSetupTool.getClusterManagementTool() .addResource(CLUSTER_NAME, resourceName, 5, MasterSlaveSMD.name); IdealState idealState = _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, resourceName); ResourceConfig resourceConfig = new ResourceConfig(resourceName); resourceConfig.setPreferenceLists(Collections.singletonMap("0", Arrays.asList("1", "2", "3"))); _configAccessor.setResourceConfig(CLUSTER_NAME, resourceName, resourceConfig); int i = 0; while (i++ < NUM_ATTEMPTS) { RebalanceScheduler.invokeRebalance(_manager.getHelixDataAccessor(), resourceName); RebalanceScheduler .invokeRebalanceForResourceConfig(_manager.getHelixDataAccessor(), resourceName); } Assert.assertTrue(idealState.getRecord().equals( _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, resourceName).getRecord())); Assert.assertTrue(resourceConfig.getRecord().equals( _configAccessor.getResourceConfig(CLUSTER_NAME, resourceName).getRecord())); }</code><technical_language>In test, validate record changed, i.e, version of znode is increased</technical_language>

Target:
public void testInvokeRebalanceAndInvokeRebalanceForResource() { String resourceName = "ResourceToInvoke"; _gSetupTool.getClusterManagementTool() .addResource(CLUSTER_NAME, resourceName, 5, MasterSlaveSMD.name); IdealState idealState = _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, resourceName); ResourceConfig resourceConfig = new ResourceConfig(resourceName); resourceConfig.setPreferenceLists(Collections.singletonMap("0", Arrays.asList("1", "2", "3"))); _configAccessor.setResourceConfig(CLUSTER_NAME, resourceName, resourceConfig); int i = 0; while (i++ < NUM_ATTEMPTS) { RebalanceScheduler.invokeRebalance(_manager.getHelixDataAccessor(), resourceName); RebalanceScheduler .invokeRebalanceForResourceConfig(_manager.getHelixDataAccessor(), resourceName); } IdealState newIdealState = _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, resourceName); ResourceConfig newResourceConfig = _configAccessor.getResourceConfig(CLUSTER_NAME, resourceName); Assert.assertTrue(idealState.getRecord().equals(newIdealState.getRecord())); Assert.assertEquals(idealState.getStat().getVersion(), 0); Assert.assertEquals(newIdealState.getStat().getVersion(), NUM_ATTEMPTS); Assert.assertTrue(resourceConfig.getRecord().equals(newResourceConfig.getRecord())); Assert.assertEquals( resourceConfig.getStat().getVersion(), 0); Assert.assertEquals(newResourceConfig.getStat().getVersion(), NUM_ATTEMPTS); }
Source:
<code>public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); context.record( <START> TransformLineageRecorderUtils.allInToAllOut(normalizeFieldList, <END> TransformLineageRecorderUtils.getFields(outputSchema), "normalize", "Normalize wide rows and reduce data to canonical form.")); }</code><technical_language>normalizeFieldList outputSchema null</technical_language>

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); initializeFieldData(); if (context.getOutputSchema() == null || context.getOutputSchema().getFields() == null) { return; } context.record( TransformLineageRecorderUtils.generateManyToMany(normalizeFieldList, TransformLineageRecorderUtils.getFields(context.getOutputSchema()), "normalize", "Normalize wide rows and reduce data to canonical form.")); }
Source:
<code>protected void applyHeaders() { <START> getHeaders().entrySet().forEach(e -> e.getValue().forEach(v -> this.jettyRequest.header(e.getKey(), v))); <END> if (!getHeaders().containsKey(HttpHeaders.ACCEPT)) { this.jettyRequest.header(HttpHeaders.ACCEPT, "*/*"); } }</code><technical_language>a variable instead of calling getHeaders() twice</technical_language>

Target:
protected void applyHeaders() { HttpHeaders headers = getHeaders(); headers.forEach((key, value) -> value.forEach(v -> this.jettyRequest.header(key, v))); if (!headers.containsKey(HttpHeaders.ACCEPT)) { this.jettyRequest.header(HttpHeaders.ACCEPT, "*/*"); } }
Source:
<code>protected List<Identifier> findByParentPath(final String siteId, String parentPath) throws DotDataException { final Identifier identifier = findByURI(siteId, parentPath); if(!UtilMethods.isSet(identifier) || !UtilMethods.isSet(identifier.getId()) ){ return Collections.emptyList(); } parentPath = identifier.getURI(); if(!parentPath.endsWith("/")) { parentPath=parentPath+"/"; } <START> Logger.info(getClass(),parentPath); <END> DotConnect dc = new DotConnect(); dc.setSQL("select * from identifier where parent_path = ? and host_inode = ?"); dc.addParam(parentPath); dc.addParam(siteId); return TransformerLocator.createIdentifierTransformer(dc.loadObjectResults()).asList(); }</code><technical_language>remove this logger</technical_language>

Target:
protected List<Identifier> findByParentPath(final String siteId, String parentPath) throws DotDataException { final Identifier identifier = findByURI(siteId, parentPath); if(!UtilMethods.isSet(identifier) || !UtilMethods.isSet(identifier.getId()) ){ return Collections.emptyList(); } parentPath = identifier.getURI(); if(!parentPath.endsWith("/")) { parentPath=parentPath+"/"; } DotConnect dc = new DotConnect(); dc.setSQL("select * from identifier where parent_path = ? and host_inode = ?"); dc.addParam(parentPath); dc.addParam(siteId); return TransformerLocator.createIdentifierTransformer(dc.loadObjectResults()).asList(); }
Source:
<code>@Override public boolean add(Integer integer) { if (integer == null) <START> throw new UnsupportedOperationException("Negative or null values are not supported!"); <END> return add((int) integer); }</code><technical_language>"IllegalArgumentException"</technical_language>

Target:
@Override public boolean add(Integer integer) { if (integer == null) throw new IllegalArgumentException("Negative or null values are not supported!"); return add((int)integer); }
Source:
<code>public boolean isDeleted(ArtifactId artifact) { <START> return ((Artifact) artifact).isDeleted(); <END> }</code><technical_language>update method in type Artifact put in instanceof check</technical_language>

Target:
public boolean isDeleted(ArtifactId artifact) { return ((Artifact) services.getArtifact(artifact)).isDeleted(); }
Source:
<code>public List<GroupedTimelineLogSummary> getTimelineLogSummaryHistopry(@Auth final AccessToken accessToken, @QueryParam("start_date") final String startDate, @QueryParam("end_date") final String endDate) { <START> List<GroupedTimelineLogSummary> summaries = timelineAnalyticsDAO.getGroupedSummariesForDateRange(startDate, endDate); <END> return summaries; }</code><technical_language>final checking dates null</technical_language>

Target:
public List<GroupedTimelineLogSummary> getTimelineLogSummaryHistopry(@Auth final AccessToken accessToken, @QueryParam("start_date") final String startDate, @QueryParam("end_date") final String endDate) { if (startDate == null || endDate == null) { throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(new JsonError( Response.Status.BAD_REQUEST.getStatusCode(), "start_date and end_date must be specified")).build()); } final List<GroupedTimelineLogSummary> summaries = timelineAnalyticsDAO.getGroupedSummariesForDateRange(startDate, endDate); return summaries; }
Source:
<code>public JsonArray execJson() { checkNotClosed(); HttpQuery httpQuery = makeHttpQuery(); httpQuery.setAccept(WebContent.contentTypeJSON); InputStream in = httpQuery.exec(); JsonValue v = JSON.parseAny(in); <START> if ( ! v.isArray() ) <END> return v.getAsArray(); }</code><technical_language>A left-over development/debugging</technical_language>

Target:
public JsonArray execJson() { checkNotClosed(); HttpQuery httpQuery = makeHttpQuery(); httpQuery.setAccept(WebContent.contentTypeJSON); InputStream in = httpQuery.exec(); JsonValue v = JSON.parseAny(in); if ( ! v.isArray() ) throw new QueryExecException("Return from a JSON query isn't an array"); return v.getAsArray(); }
Source:
<code>private MetricsQuery(final Builder builder) { _startTime = builder._startTime; _endTime = builder._endTime; <START> _metrics = ImmutableList.copyOf(builder._metrics); <END> }</code><technical_language>need a copy if immutable</technical_language>

Target:
private MetricsQuery(final Builder builder) { _startTime = builder._startTime; _endTime = Optional.ofNullable(builder._endTime); _metrics = builder._metrics; }
Source:
<code>WorkerTransfer(WorkerState workerState, Map<String, Object> topologyConf, int maxTaskIdInTopo) { this.workerState = workerState; this.backPressureWaitStrategy = IWaitStrategy.createBackPressureWaitStrategy(topologyConf); this.drainer = new TransferDrainer(); this.remoteBackPressureStatus = new AtomicBoolean[maxTaskIdInTopo + 1]; for (int i = 0; i < remoteBackPressureStatus.length; i++) { remoteBackPressureStatus[i] = new AtomicBoolean(false); } Integer xferQueueSz = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_TRANSFER_BUFFER_SIZE)); Integer xferBatchSz = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_TRANSFER_BATCH_SIZE)); if (xferBatchSz > xferQueueSz / 2) { throw new IllegalArgumentException(Config.TOPOLOGY_TRANSFER_BATCH_SIZE + ":" + xferBatchSz + " must be no more than half of " + Config.TOPOLOGY_TRANSFER_BUFFER_SIZE + ":" + xferQueueSz); } List<Integer> taskIds = new ArrayList<>(); taskIds.add(-1); this.transferQueue = new JCQueue("worker-transfer-queue", xferQueueSz, 0, xferBatchSz, backPressureWaitStrategy, <START> workerState.getTopologyId(), Constants.SYSTEM_COMPONENT_ID, taskIds, workerState.getPort(), <END> workerState.getMetricRegistry()); }</code><technical_language>simplified Collections.singletonList(-1)</technical_language>

Target:
WorkerTransfer(WorkerState workerState, Map<String, Object> topologyConf, int maxTaskIdInTopo) { this.workerState = workerState; this.backPressureWaitStrategy = IWaitStrategy.createBackPressureWaitStrategy(topologyConf); this.drainer = new TransferDrainer(); this.remoteBackPressureStatus = new AtomicBoolean[maxTaskIdInTopo + 1]; for (int i = 0; i < remoteBackPressureStatus.length; i++) { remoteBackPressureStatus[i] = new AtomicBoolean(false); } Integer xferQueueSz = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_TRANSFER_BUFFER_SIZE)); Integer xferBatchSz = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_TRANSFER_BATCH_SIZE)); if (xferBatchSz > xferQueueSz / 2) { throw new IllegalArgumentException(Config.TOPOLOGY_TRANSFER_BATCH_SIZE + ":" + xferBatchSz + " must be no more than half of " + Config.TOPOLOGY_TRANSFER_BUFFER_SIZE + ":" + xferQueueSz); } this.transferQueue = new JCQueue("worker-transfer-queue", xferQueueSz, 0, xferBatchSz, backPressureWaitStrategy, workerState.getTopologyId(), Constants.SYSTEM_COMPONENT_ID, Collections.singletonList(-1), workerState.getPort(), workerState.getMetricRegistry()); }
Source:
<code>public void testValidateGracePeriodAndExternalPorts() throws Exception { final Job noPorts = Json.read(stringFromResource("job-with-no-ports.json"), Job.class); assertThat(validator.validate(noPorts), Matchers.<String>empty()); final Job noExternalPorts = Json.read( stringFromResource("job-with-no-external-ports.json"), Job.class); assertThat(validator.validate(noExternalPorts), Matchers.<String>empty()); final Job externalPorts = Json.read( stringFromResource("job-with-external-ports.json"), Job.class); assertThat(validator.validate(externalPorts), Matchers.<String>empty()); final Job externalPortsAndGracePeriod = Json.read( stringFromResource("job-with-external-ports-and-grace-period.json"), Job.class); assertThat(validator.validate(externalPortsAndGracePeriod), hasItem("Job has a grace period and static/external ports. " <START> + "Please choose one or the other.")); <END> }</code><technical_language>is a test for grace period static ports</technical_language>

Target:
public void testValidateGracePeriodAndExternalPorts() throws Exception { final Job noPorts = Json.read(stringFromResource("job-with-no-ports.json"), Job.class); assertThat(validator.validate(noPorts), Matchers.<String>empty()); final Job noExternalPorts = Json.read( stringFromResource("job-with-no-external-ports.json"), Job.class); assertThat(validator.validate(noExternalPorts), Matchers.<String>empty()); final Job externalPorts = Json.read( stringFromResource("job-with-external-ports.json"), Job.class); assertThat(validator.validate(externalPorts), Matchers.<String>empty()); final Job gracePeriod = Json.read( stringFromResource("job-with-grace-period.json"), Job.class); assertThat(validator.validate(gracePeriod), Matchers.<String>empty()); final Job externalPortsAndGracePeriod = Json.read( stringFromResource("job-with-external-ports-and-grace-period.json"), Job.class); assertThat(validator.validate(externalPortsAndGracePeriod), hasItem("This configuration will prevent new containers from deploying during the " + "gracePeriod because of port conflicts.")); }
Source:
<code>public void offer(PrioritizedSplitRunner split) { checkArgument(split != null, "split is null"); <START> split.setReady(); <END> lock.lock(); try { levelWaitingSplits.get(split.getLevel()).offer(split); notEmpty.signal(); } finally { lock.unlock(); } }</code><technical_language>declare in field declaration</technical_language>

Target:
public void offer(PrioritizedSplitRunner split) { checkArgument(split != null, "split is null"); split.setReady(); lock.lock(); try { levelWaitingSplits.get(split.getPriority().getLevel()).offer(split); notEmpty.signal(); } finally { lock.unlock(); } }
Source:
<code>private List<JobID> tryExecuteJobs(final DispatcherGateway dispatcherGateway, final PackagedProgram program, final Configuration configuration) { configuration.set(DeploymentOptions.ATTACHED, false); final List<JobID> applicationJobIds = new ArrayList<>(); final PipelineExecutorServiceLoader executorServiceLoader = new WebSubmissionExecutorServiceLoader(applicationJobIds, dispatcherGateway); try { ClientUtils.executeProgram(executorServiceLoader, configuration, program, enforceSingleJobExecution, true); } catch (ProgramInvocationException e) { LOG.warn("Could not execute application: ", e); <START> throw new CompletionException(new RestHandlerException("Could not execute application.", HttpResponseStatus.BAD_REQUEST, e)); <END> } return applicationJobIds; }</code><technical_language>is pretty weird throw RestHandlerException (along a CompletionException CompletableFuture in sight); seemingly do REST layer. suggest change JarRunHandler explicitly handle exceptions thrown applicationRunner.run changing thenApply a handle</technical_language>

Target:
private List<JobID> tryExecuteJobs(final DispatcherGateway dispatcherGateway, final PackagedProgram program, final Configuration configuration) { configuration.set(DeploymentOptions.ATTACHED, false); final List<JobID> applicationJobIds = new ArrayList<>(); final PipelineExecutorServiceLoader executorServiceLoader = new WebSubmissionExecutorServiceLoader(applicationJobIds, dispatcherGateway); try { ClientUtils.executeProgram(executorServiceLoader, configuration, program, enforceSingleJobExecution, true); } catch (ProgramInvocationException e) { LOG.warn("Could not execute application: ", e); throw new FlinkRuntimeException("Could not execute application.", e); } return applicationJobIds; }
Source:
<code>public int getBlockPower(BlockFace face) { BlockType type = ItemTable.instance().getBlock(getType()); if(type == null) { return 0; } <START> return (type.canBlockEmitPower(this, face, false) <END> ? getWorld().getRSManager().getBlockPower(this) : 0); }</code><technical_language><LINK_0></technical_language>

Target:
public int getBlockPower(BlockFace face) { BlockType type = ItemTable.instance().getBlock(getType()); if(type == null) { return 0; } return type.canBlockEmitPower(this, face, false) ? getWorld().getRSManager().getBlockPower(this) : 0; }
Source:
<code>private static boolean learnedValueIsGreatestAcceptedValue( List<ConsolidatedLearnerAndAcceptorRecord> records, Long seq) { byte[] learnedValueData = getPaxosValueData(getLearnedValue(records, seq)); if (learnedValueData == null) { return true; } byte[] greatestAcceptedValueData = getPaxosValueData(getGreatestAcceptedValueAtSequence(records, seq)); if (greatestAcceptedValueData == null) { <START> return false; <END> } return PtBytes.toLong(greatestAcceptedValueData) <= PtBytes.toLong(learnedValueData); }</code><technical_language>if this is a bug in atlas code throw a SafeIllegalStateException</technical_language>

Target:
private static boolean learnedValueIsGreatestAcceptedValue( List<ConsolidatedLearnerAndAcceptorRecord> records, Long seq) { byte[] learnedValueData = getPaxosValueData(getLearnedValue(records, seq)); if (learnedValueData == null) { return true; } byte[] greatestAcceptedValueData = getPaxosValueData(getGreatestAcceptedValueAtSequence(records, seq)); Preconditions.checkNotNull( greatestAcceptedValueData, "Value learned did have data while there " + "was no data in any of the accepted states. This should never happen, contact support"); return PtBytes.toLong(greatestAcceptedValueData) <= PtBytes.toLong(learnedValueData); }
Source:
<code>DatasetPermissions assignPermissions(Session session, CollectionDescription description, String datasetID) throws DatasetPermissionsException { DatasetPermissions permissions = new DatasetPermissions(); <START> if (isAdminOrPublisher(session)) { <END> permissions.permit(CREATE, READ, UPDATE, DELETE); } else if (isCollectionViewer(session, description)) { permissions.permit(READ); } else { info().data("collection_id", description.getId()) .data("dataset_id", datasetID) .data("user", session.getEmail()) .log("user not permitted to access dataset"); return permissions; } info().data("collection_id", description.getId()) .data("dataset_id", datasetID) .data("user", session.getEmail()) .log("permitted collection dataset permissions for user"); return permissions; }</code><technical_language>need explain this me. Successful return is true? Error is false</technical_language>

Target:
DatasetPermissions assignPermissions(Session session, CollectionDescription description, String datasetID) throws DatasetPermissionsException { DatasetPermissions permissions = new DatasetPermissions(); if (isAdminOrPublisher(session)) { permissions.permit(CREATE, READ, UPDATE, DELETE); } else if (isCollectionViewer(session, description)) { permissions.permit(READ); } else { info().collectionID(description.getId()).datasetID(datasetID).user(session).log("user not permitted to access dataset"); return permissions; } info().collectionID(description).datasetID(datasetID).user(session).log("permitted collection dataset permissions for user"); return permissions; }
Source:
<code>public void verifySuggest() { createGraphMLAndWaitUntilDone(); given().params("s", "unknown") .accept(ContentType.JSON) .get("/search/suggestions/{namespace}/", "acme:regions") .then().statusCode(204); Response response = given().params("s", "North Region") .accept(ContentType.JSON) .get("/search/suggestions/{namespace}/", "acme:regions"); <START> LOG.info("Results from search:" + response.asString()); <END> response .then().statusCode(200) .contentType(ContentType.JSON) .content("[0].context", Matchers.is("GenericVertex")) .content("[0].label", Matchers.is("North Region")) .content("[0].provider", Matchers.is("LabelSearchProvider")); }</code><technical_language>RestAssured for this, is a .log()-statement: <LINK_0></technical_language>

Target:
public void verifySuggest() { createGraphMLAndWaitUntilDone(); given().log().ifValidationFails() .params("s", "unknown") .accept(ContentType.JSON) .get("/search/suggestions/{namespace}/", "acme:regions") .then().log().ifValidationFails() .statusCode(204); given().log().ifValidationFails() .params("s", "North Region") .accept(ContentType.JSON) .get("/search/suggestions/{namespace}/", "acme:regions") .then().log().ifValidationFails() .statusCode(200) .contentType(ContentType.JSON) .content("[0].context", Matchers.is("GenericVertex")) .content("[0].label", Matchers.is("North Region")) .content("[0].provider", Matchers.is("LabelSearchProvider")) .content("", Matchers.hasSize(1)); }
Source:
<code>public void tearDown() { <START> if (null == defaultAndesAckWaitTimeOut) { <END> System.clearProperty("AndesAckWaitTimeOut"); } else { System.setProperty("AndesAckWaitTimeOut", defaultAndesAckWaitTimeOut); } }</code><technical_language>this a string, safer StringUtils.isBlank</technical_language>

Target:
public void tearDown() { if (StringUtils.isBlank(defaultAndesAckWaitTimeOut)) { System.clearProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY); } else { System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, defaultAndesAckWaitTimeOut); } }
Source:
<code>public WintersNight(UUID ownerId, CardSetInfo setInfo) { <START> super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{W}{R}{G}"); <END> addSuperType(SuperType.WORLD); ManaEffect effect = new AddManaOfAnyTypeProducedEffect(); effect.setText("that player adds one mana to his or her mana pool of any type that land produced"); Ability ability = new TapForManaAllTriggeredManaAbility(effect, filter, SetTargetPointer.PERMANENT); Effect effect2 = new DontUntapInControllersNextUntapStepTargetEffect(); effect2.setText("That land doesn't untap during its controller's next untap step"); ability.addEffect(effect2); this.addAbility(ability); }</code><technical_language>Mana cost needs {R}{G}{W}</technical_language>

Target:
public WintersNight(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{R}{G}{W}"); addSuperType(SuperType.WORLD); ManaEffect effect = new AddManaOfAnyTypeProducedEffect(); effect.setText("that player adds one mana to his or her mana pool of any type that land produced"); Ability ability = new TapForManaAllTriggeredManaAbility(effect, filter, SetTargetPointer.PERMANENT); Effect effect2 = new DontUntapInControllersNextUntapStepTargetEffect(); effect2.setText("That land doesn't untap during its controller's next untap step"); ability.addEffect(effect2); this.addAbility(ability); }
Source:
<code>@CombineFunction public static void combine( <START> @AggregationState DifferentialEntropyState state, <END> @AggregationState DifferentialEntropyState otherState) { DifferentialEntropyStateStrategy strategy = state.getStrategy(); DifferentialEntropyStateStrategy otherStrategy = otherState.getStrategy(); if (strategy == null && otherStrategy != null) { state.setStrategy(otherStrategy); return; } if (otherStrategy == null) { return; } verify(strategy.getClass() == otherStrategy.getClass(), format("In combine, %s != %s", strategy.getClass().getSimpleName(), otherStrategy.getClass().getSimpleName())); strategy.mergeWith(otherStrategy); }</code><technical_language>nit: put @CombineFunction a line @CombineFunction public static void combine(</technical_language>

Target:
public static void combine( @AggregationState DifferentialEntropyState state, @AggregationState DifferentialEntropyState otherState) { DifferentialEntropyStateStrategy strategy = state.getStrategy(); DifferentialEntropyStateStrategy otherStrategy = otherState.getStrategy(); if (strategy == null && otherStrategy != null) { state.setStrategy(otherStrategy); return; } if (otherStrategy == null) { return; } verify(strategy.getClass() == otherStrategy.getClass(), format("In combine, %s != %s", strategy.getClass().getSimpleName(), otherStrategy.getClass().getSimpleName())); strategy.mergeWith(otherStrategy); }
Source:
<code>protected void executeQueryCommand() { HashMap<String, List<String>> namespacesMap = new HashMap<>(); for (ExtensionProxy authz: EngineExtensionsManager.getInstance().getExtensionsByService(Authz.class.getName())) { for (String namespace : authz.getContext().get(Authz.ContextKeys.AVAILABLE_NAMESPACES, Arrays.asList("*"))) { MultiValueMapUtils.addToMap(AuthzUtils.getName(authz), namespace, namespacesMap); } } <START> for (Entry<String, List<String>> entry : namespacesMap.entrySet()) { <END> Collections.sort(entry.getValue()); } setReturnValue(namespacesMap); }</code><technical_language>namespacesMap.values() Collections.sort(entry)</technical_language>

Target:
protected void executeQueryCommand() { HashMap<String, List<String>> namespacesMap = new HashMap<>(); for (ExtensionProxy authz: EngineExtensionsManager.getInstance().getExtensionsByService(Authz.class.getName())) { for (String namespace : authz.getContext().get(Authz.ContextKeys.AVAILABLE_NAMESPACES, Arrays.asList("*"))) { MultiValueMapUtils.addToMap(AuthzUtils.getName(authz), namespace, namespacesMap); } } for (List<String> entry : namespacesMap.values()) { Collections.sort(entry); } setReturnValue(namespacesMap); }
Source:
<code>public void testAlwaysMeteredVpnWithNonNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } <START> Network wifi = getWifiNetwork(); assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = new ArrayList<>(1); underlyingNetworks.add(wifi); String allowedApps = mPackageName; boolean isAlwaysMetered = true; <END> startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, isAlwaysMetered); assertEquals(mNetwork, mCM.getActiveNetwork()); ensureVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertTrue(isNetworkMetered(mNetwork)); assertTrue(mCM.isActiveNetworkMetered()); }</code><technical_language>cut copy-paste making helper function(s)</technical_language>

Target:
public void testAlwaysMeteredVpnWithNonNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } Network wifi = getWifiNetwork(); assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = new ArrayList<>(1); underlyingNetworks.add(wifi); String allowedApps = mPackageName; boolean isAlwaysMetered = true; startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, isAlwaysMetered); assertEquals(mNetwork, mCM.getActiveNetwork()); assertVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertTrue(isNetworkMetered(mNetwork)); assertTrue(mCM.isActiveNetworkMetered()); }
Source:
<code>public void eventReceived(Object output) { if (output instanceof MIOutput) { MIOOBRecord[] records = ((MIOutput)output).getMIOOBRecords(); for (MIOOBRecord r : records) { if (r instanceof MINotifyAsyncOutput) { MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput)r; String asyncClass = notifyOutput.getAsyncClass(); if ("record-started".equals(asyncClass) || "record-stopped".equals(asyncClass)) { if ("record-stopped".equals(asyncClass)) { fReverseTraceMethod = ReverseTraceMethod.STOP_TRACE; getSession().dispatchEvent(new GdbReverseModeChangedDMEvent(fCommandControl.getContext(), false), getProperties()); <START> return; <END> } else { getConnection().queueCommand( fCommandFactory.createCLIRecord(getConnection().getContext()), new DataRequestMonitor<MIInfo>(getExecutor(), null) { @Override public void handleSuccess() { MIOutput output = getData().getMIOutput(); if (output.toString().contains("Processor")) fReverseTraceMethod = ReverseTraceMethod.PROCESSOR_TRACE; else if (output.toString().contains("Branch")) fReverseTraceMethod = ReverseTraceMethod.BRANCH_TRACE; else fReverseTraceMethod = ReverseTraceMethod.FULL_TRACE; getSession().dispatchEvent(new GdbReverseModeChangedDMEvent(fCommandControl.getContext(), true), getProperties()); done(); } @Override public void handleFailure() { done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Trace method could not be determined", null)); } }); } } } } } }</code><technical_language>remove 'return'</technical_language>

Target:
public void eventReceived(Object output) { if (output instanceof MIOutput) { MIOOBRecord[] records = ((MIOutput)output).getMIOOBRecords(); for (MIOOBRecord r : records) { if (r instanceof MINotifyAsyncOutput) { MINotifyAsyncOutput notifyOutput = (MINotifyAsyncOutput)r; String asyncClass = notifyOutput.getAsyncClass(); if ("record-started".equals(asyncClass) || "record-stopped".equals(asyncClass)) { if ("record-stopped".equals(asyncClass)) { fReverseTraceMethod = ReverseTraceMethod.STOP_TRACE; getSession().dispatchEvent(new GdbReverseModeChangedDMEvent(fCommandControl.getContext(), false), getProperties()); } else { getConnection().queueCommand( fCommandFactory.createCLIInfoRecord(getConnection().getContext()), new DataRequestMonitor<MIinfoRecord>(getExecutor(), null) { @Override public void handleSuccess() { MIinfoRecord output = getData(); fReverseTraceMethod = output.getReverseMethod(); getSession().dispatchEvent(new GdbReverseModeChangedDMEvent(fCommandControl.getContext(), true), getProperties()); } }); } } } } } }
Source:
<code>public Response getSearch(@QueryParam("q") String q) { try { PipedInputStream results = spawn.getSearchResultStream(new SearchOptions(q)); StreamingOutput stream = new StreamingOutput() { @Override public void write(OutputStream output) throws IOException, WebApplicationException { <START> byte[] buf = new byte[256]; <END> while (results.read(buf) != -1) { output.write(buf); output.flush(); } results.close(); } }; return Response.ok().entity(stream).build(); } catch (IOException e) { e.printStackTrace(); return Response.serverError().build(); } }</code><technical_language>try finally { results.close() }</technical_language>

Target:
public Response getSearch(@QueryParam("q") String q) { try { final PipedInputStream results = spawn.getSearchResultStream(new SearchOptions(q)); StreamingOutput stream = new StreamingOutput() { @Override public void write(OutputStream output) throws IOException, WebApplicationException { byte[] buf = new byte[256]; try { while (results.read(buf) != -1) { output.write(buf); output.flush(); } } finally { results.close(); } } }; return Response.ok().entity(stream).build(); } catch (IOException e) { e.printStackTrace(); return Response.serverError().build(); } }
Source:
<code>public HighscoreLeaderboard() { removeQueue = new ConcurrentLinkedQueue<>(); addQueue = new ConcurrentLinkedQueue<>(); entries = FXCollections.observableArrayList(); <START> addedEntries = new HashMap<>(); <END> setItems(entries); setStyle("-fx-font: 20 arial; "); }</code><technical_language>map concurrent</technical_language>

Target:
public HighscoreLeaderboard() { entries = FXCollections.observableArrayList(); sortedEntries = Collections.synchronizedSortedSet(new TreeSet<Entry>((c1, c2) -> Double.compare(c2.score, c1.score))); setItems(entries); setStyle("-fx-font: 20 arial; "); }
Source:
<code>private String parseCodeName() { if (this.major == 10) { <START> final String OSHI_VERSIONS_PROPERTIES = "oshi.versions.properties"; <END> Properties verProps = FileUtil.readPropertiesFromFilename(OSHI_VERSIONS_PROPERTIES); String major = String.valueOf(this.major); String minor = String.valueOf(this.minor); String version_number = major+"."+minor; String version_name = verProps.getProperty(version_number); return version_name; } LOG.warn("Unable to parse version {}.{} to a codename.", this.major, this.minor); return ""; }</code><technical_language>Declare this public static top of file. want macos.versions</technical_language>

Target:
private String parseCodeName() { if (this.major == 10) { Properties verProps = FileUtil.readPropertiesFromFilename(MACOS_VERSIONS_PROPERTIES); return verProps.getProperty(this.major + "." + this.minor); } LOG.warn("Unable to parse version {}.{} to a codename.", this.major, this.minor); return ""; }
Source:
<code>public CommandProcessingResult close(Long savingsId, JsonCommand command) { final AppUser user = this.context.authenticatedUser(); this.savingsAccountTransactionDataValidator.validateClosing(command); final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId); final List<Long> existingTransactionIds = new ArrayList<Long>(); final List<Long> existingReversedTransactionIds = new ArrayList<Long>(); final Map<String, Object> changes = account.close(user, command, DateUtils.getLocalDateOfTenant()); if (!changes.isEmpty()) { this.savingAccountRepository.save(account); final String noteText = command.stringValueOfParameterNamed("note"); if (StringUtils.isNotBlank(noteText)) { final Note note = Note.savingNote(account, noteText); changes.put("note", noteText); this.noteRepository.save(note); } } <START> postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds); <END> return new CommandProcessingResultBuilder() .withEntityId(savingsId) .withOfficeId(account.officeId()) .withClientId(account.clientId()) .withGroupId(account.groupId()) .withSavingsId(savingsId) .with(changes) .build(); }</code><technical_language>new transactions created while closing a savings account, do need call for posting journal entries</technical_language>

Target:
public CommandProcessingResult close(Long savingsId, JsonCommand command) { final AppUser user = this.context.authenticatedUser(); this.savingsAccountTransactionDataValidator.validateClosing(command); final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId); final Map<String, Object> changes = account.close(user, command, DateUtils.getLocalDateOfTenant()); if (!changes.isEmpty()) { this.savingAccountRepository.save(account); final String noteText = command.stringValueOfParameterNamed("note"); if (StringUtils.isNotBlank(noteText)) { final Note note = Note.savingNote(account, noteText); changes.put("note", noteText); this.noteRepository.save(note); } } return new CommandProcessingResultBuilder() .withEntityId(savingsId) .withOfficeId(account.officeId()) .withClientId(account.clientId()) .withGroupId(account.groupId()) .withSavingsId(savingsId) .with(changes) .build(); }
Source:
<code>public static Triple fromJena(RDFTermFactory factory, org.apache.jena.graph.Triple triple) throws ConversionException{ if (factory instanceof JenaRDFTermFactory) { return ((JenaRDFTermFactory) factory).fromJena(triple); } BlankNodeOrIRI subject; IRI predicate; try { subject = (BlankNodeOrIRI) fromJena(factory, triple.getSubject()); predicate = (IRI) fromJena(factory, triple.getPredicate()); } catch (ClassCastException ex) { throw new ConversionException("Can't convert generalized triple: " + triple, ex); } RDFTerm object = fromJena(factory, triple.getObject()); <START> return factory.createTriple(subject, predicate, object); <END> }</code><technical_language>a style-thing, nicer put (declaration, assignment, return) try, i.e. try { BlankNodeOrIRI subject = (BlankNodeOrIRI) fromJena(factory, triple.getSubject()); IRI predicate = (IRI) fromJena(factory, triple.getPredicate()); RDFTerm object = fromJena(factory, triple.getObject()); return factory.createTriple(subject, predicate, object); } catch (ClassCastException ex) { throw new ConversionException("Can't convert generalized triple: " + triple, ex); }</technical_language>

Target:
public static Triple fromJena(RDFTermFactory factory, org.apache.jena.graph.Triple triple) throws ConversionException{ if (factory instanceof JenaRDFTermFactory) { return ((JenaRDFTermFactory) factory).fromJena(triple); } final BlankNodeOrIRI subject; final IRI predicate; try { subject = (BlankNodeOrIRI) fromJena(factory, triple.getSubject()); predicate = (IRI) fromJena(factory, triple.getPredicate()); } catch (ClassCastException ex) { throw new ConversionException("Can't convert generalized triple: " + triple, ex); } RDFTerm object = fromJena(factory, triple.getObject()); return factory.createTriple(subject, predicate, object); }