auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private InputRow getInputRowFromRow(final Row row, final List<String> dimensions) { return new InputRow() { @Override public List<String> getDimensions() { return dimensions; } @Override public long getTimestampFromEpoch() { return row.getTimestampFromEpoch(); } @Override public DateTime getTimestamp() { return row.getTimestamp(); } @Override public List<String> getDimension(String dimension) { return row.getDimension(dimension); } @Override public Object getRaw(String dimension) { return row.getRaw(dimension); } @Override public Float getFloatMetric(String metric) { return row.getFloatMetric(metric); } @Override public Long getLongMetric(String metric) { return row.getLongMetric(metric); } @Override public Double getDoubleMetric(String metric) { return row.getDoubleMetric(metric); } @Override public int compareTo(Row o) { return row.compareTo(o); } }; }

Target:
private InputRow getInputRowFromRow(final Row row, final List<String> dimensions) { return new InputRow() { @Override public List<String> getDimensions() { return dimensions; } @Override public long getTimestampFromEpoch() { return row.getTimestampFromEpoch(); } @Override public DateTime getTimestamp() { return row.getTimestamp(); } @Override public List<String> getDimension(String dimension) { return row.getDimension(dimension); } @Override @Nullable public Object getRaw(String dimension) { return row.getRaw(dimension); } @Override public Number getMetric(String metric) { return row.getMetric(metric); } @Override public int compareTo(Row o) { return row.compareTo(o); } }; }
Source:
private boolean hasAnyImportInCurrentGroup(String currentGroup) { boolean result = false; for (ImportDetails currentImport : importToGroupList) { if (currentGroup.equals(currentImport.getImportGroup())) { result = true; } } return result; }

Target:
private boolean hasAnyImportInCurrentGroup(String currentGroup) { boolean result = false; for (ImportDetails currentImport : importToGroupList) { if (currentGroup.equals(currentImport.getImportGroup())) { result = true; break; } } return result; }
Source:
public boolean initialize(ServiceProviderConfiguration configuration, PlatformConfiguration platformConfiguration) { LOGGER.info("Initializing LeaseServiceProvider"); leaseDuration = new LeaseDurationImpl(Duration.ofMillis(getLeaseLength(configuration))); TimeSource timeSource = TimeSourceProvider.getTimeSource(); proxyClientConnectionCloser = new ProxyClientConnectionCloser(); leaseState = new LeaseState(timeSource, proxyClientConnectionCloser); leaseMonitorThread = new LeaseMonitorThread(timeSource, leaseState); leaseMonitorThread.start(); LOGGER.info("LeaseServiceProvider initialized"); return true; }

Target:
public boolean initialize(ServiceProviderConfiguration configuration, PlatformConfiguration platformConfiguration) { LOGGER.info("Initializing LeaseServiceProvider"); leaseConfiguration = configuration instanceof LeaseConfiguration ? (LeaseConfiguration) configuration: new LeaseConfigurationImpl(LeaseConstants.DEFAULT_LEASE_LENGTH); TimeSource timeSource = TimeSourceProvider.getTimeSource(); proxyClientConnectionCloser = new ProxyClientConnectionCloser(); leaseState = new LeaseState(timeSource, proxyClientConnectionCloser); leaseMonitorThread = new LeaseMonitorThread(timeSource, leaseState); leaseMonitorThread.start(); return true; }
Source:
public void testDeleteClientDeleteMutationPlan() throws Exception { String tableName = generateUniqueName(); String indexName = generateUniqueName(); String tagValue = "customer-delete"; String delete = "DELETE FROM " + tableName + " WHERE v1 = 'foo'"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(ConnectionQueryServices.SOURCE_OPERATION_ATTRIB, tagValue); createAndUpsertTable(tableName, indexName, props); verifyDeletePlan(delete, "ClientSelectDeleteMutationPlan", props); executeDelete(delete, props, 1); String startRowKeyForBaseTable = "1"; String startRowKeyForIndexTable = "foo"; checkTagPresentInDeleteMarker(tableName, startRowKeyForBaseTable, true, tagValue); checkTagPresentInDeleteMarker(indexName, startRowKeyForIndexTable, false, null); }

Target:
public void testDeleteClientDeleteMutationPlan() throws Exception { String tableName = generateUniqueName(); String indexName = generateUniqueName(); String tagValue = "customer-delete"; String delete = "DELETE FROM " + tableName + " WHERE v1 = 'foo'"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(ConnectionQueryServices.SOURCE_OPERATION_ATTRIB, tagValue); createAndUpsertTable(tableName, indexName, props); verifyDeletePlan(delete, DeleteCompiler.ClientSelectDeleteMutationPlan.class, props); executeDelete(delete, props, 1); String startRowKeyForBaseTable = "1"; String startRowKeyForIndexTable = "foo"; checkTagPresentInDeleteMarker(tableName, startRowKeyForBaseTable, true, tagValue); checkTagPresentInDeleteMarker(indexName, startRowKeyForIndexTable, false, null); }
Source:
protected void syncRefresh() { final Runnable pending; synchronized (this) { pending = refreshRunnable; } if (pending != null) { Control control = getControl(); Display display = (control == null) ? null : control.getDisplay(); display.syncExec(pending); } }

Target:
protected void syncRefresh() { final Runnable pending; synchronized (this) { pending = refreshRunnable; } if (pending != null) { Control control = getControl(); Display display = ((control == null) || control.isDisposed()) ? null : control.getDisplay(); if (display != null) { display.syncExec(pending); } } }
Source:
public static void minCombine(Type type, BlockPositionState state, BlockPositionState otherState) { if (state.getBlock() == null) { state.setBlock(otherState.getBlock()); state.setPosition(otherState.getPosition()); return; } if (type.compareTo(otherState.getBlock(), otherState.getPosition(), state.getBlock(), state.getPosition()) < 0) { state.setBlock(otherState.getBlock()); state.setPosition(otherState.getPosition()); } }

Target:
public static void minCombine(Type type, BlockPositionState state, BlockPositionState otherState) { if (state.getBlock() == null || type.compareTo(otherState.getBlock(), otherState.getPosition(), state.getBlock(), state.getPosition()) < 0) { state.setBlock(otherState.getBlock()); state.setPosition(otherState.getPosition()); } }
Source:
public DefDeclaration(String name, Type returnType, List<NameBinding> argNames, TypedAST body, boolean isClassDef, FileLocation location) { if (argNames == null) { argNames = new LinkedList<NameBinding>(); } this.type = getMethodType(argNames, returnType); this.name = name; this.body = (ExpressionAST) body; this.argNames = argNames; this.isClass = isClassDef; this.location = location; }

Target:
public DefDeclaration(String name, Type returnType, List<NameBinding> argNames, TypedAST body, boolean isClassDef, FileLocation location) { this(name, returnType, null, argNames, body, isClassDef, location); }
Source:
public long getEstimatedSizeBytes(PipelineOptions options) { if (isRemoteFileFromLaunchSite) { return 0; } long size = 0; try { if (serializableSplit != null) { return serializableSplit.getSplit().getLength(); } Job job = Job.getInstance(getDeserializerConfiguration()); for (FileStatus st : listStatus(createFormat(job), job)) { size += st.getLen(); } return size; } catch (IOException | NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException | InterruptedException e) { SOURCE_LOG.error("Got exception while trying to getEstimatedSizeBytes().", e); return 0; } }

Target:
public long getEstimatedSizeBytes(PipelineOptions options) { if (isRemoteFileFromLaunchSite) { return 0; } try { if (serializableSplit != null) { return serializableSplit.getSplit().getLength(); } Job job = Job.getInstance(getDeserializerConfiguration()); long size = 0; for (FileStatus st : listStatus(createFormat(job), job)) { size += st.getLen(); } return size; } catch (IOException | NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException | InterruptedException e) { SOURCE_LOG.error("Got exception while trying to getEstimatedSizeBytes().", e); return 0; } }
Source:
public void testNotAllInputsReferenced() throws Exception { tester().assertThat(new PruneAggregationColumns()) .on(p -> buildProjectedAggregation(p, symbol -> symbol.getName().equals("b"))) .matches( strictProject( ImmutableMap.of("b", expression("b")), aggregation( ImmutableList.of(ImmutableList.of()), ImmutableMap.of( Optional.of("b"), functionCall("count", false, ImmutableList.of())), ImmutableMap.of(), Optional.empty(), SINGLE, values()))); }

Target:
public void testNotAllInputsReferenced() throws Exception { tester().assertThat(new PruneAggregationColumns()) .on(p -> buildProjectedAggregation(p, symbol -> symbol.getName().equals("b"))) .matches( strictProject( ImmutableMap.of("b", expression("b")), aggregation( ImmutableList.of(ImmutableList.of("key")), ImmutableMap.of( Optional.of("b"), functionCall("count", false, ImmutableList.of())), ImmutableMap.of(), Optional.empty(), SINGLE, values("key")))); }
Source:
public void onStart() throws Exception { try { startDispatcherServices(); } catch (Throwable t) { getTerminationFuture().completeExceptionally(t); final DispatcherException exception = new DispatcherException(String.format("Could not start the Dispatcher %s", getAddress()), t); onFatalError(exception); throw exception; } dispatcherBootstrap.initialize(this, this.getRpcService().getScheduledExecutor()); }

Target:
public void onStart() throws Exception { try { startDispatcherServices(); } catch (Throwable t) { final DispatcherException exception = new DispatcherException(String.format("Could not start the Dispatcher %s", getAddress()), t); onFatalError(exception); throw exception; } dispatcherBootstrap.initialize(this, this.getRpcService().getScheduledExecutor()); }
Source:
private boolean containsHtmlText(ArrayList<Object> list) { for (Iterator<Object> it = list.iterator(); it.hasNext(); ) { Object o = it.next(); if (o instanceof String) { String mediaType = (String) o; String[] parts = mediaType.split("/"); if (parts.length >= 2 && parts[0].trim().equals("text") && parts[1].trim().startsWith("html")) { return true; } } } return false; }

Target:
private boolean containsHtmlText(ArrayList<Object> list) { for (Iterator<Object> it = list.iterator(); it.hasNext(); ) { Object o = it.next(); if (o instanceof String) { String mediaType = (String) o; String[] partsType = mediaType.split("/"); if (partsType.length >= 2) { String[] partsSubtype = partsType[1].split(";"); if (partsType[0].trim().equalsIgnoreCase("text") && partsSubtype[0].trim().toLowerCase().equals("html")) { return true; } } } } return false; }
Source:
public boolean onStartJob(JobParameters params) { Log.d(TAG, "Job started"); ClientConfig.initialize(getApplicationContext()); DBTasks.refreshAllFeeds(getApplicationContext(), null); UserPreferences.restartUpdateAlarm(false); return true; }

Target:
public boolean onStartJob(JobParameters params) { Log.d(TAG, "Job started"); ClientConfig.initialize(getApplicationContext()); FeedUpdateUtils.startAutoUpdate(getApplicationContext(), () -> { UserPreferences.restartUpdateAlarm(false); jobFinished(params, false); }); return true; }
Source:
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException { if (arguments.length != 1) { throw new UDFArgumentLengthException( "Ex2 takes 1 mandatory argument"); } GenericUDFUtils.ReturnObjectInspectorResolver keyOIResolver = new GenericUDFUtils.ReturnObjectInspectorResolver( true); GenericUDFUtils.ReturnObjectInspectorResolver valueOIResolver = new GenericUDFUtils.ReturnObjectInspectorResolver( true); ObjectInspector keyOI = keyOIResolver.get(); ObjectInspector valueOI = valueOIResolver.get(); if (keyOI == null) { keyOI = PrimitiveObjectInspectorFactory .getPrimitiveJavaObjectInspector(PrimitiveObjectInspector.PrimitiveCategory.STRING); } if (valueOI == null) { valueOI = PrimitiveObjectInspectorFactory .getPrimitiveJavaObjectInspector(PrimitiveObjectInspector.PrimitiveCategory.STRING); } try { p = new CachingParser(); } catch (IOException e) { e.printStackTrace(); } argumentOIs = arguments; return ObjectInspectorFactory.getStandardMapObjectInspector(keyOI, valueOI); }

Target:
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException{ if (arguments.length != 1) throw new UDFArgumentLengthException( "Arguments array has more than 1 element"); for (int i = 0; i < arguments.length; i++) { if (arguments[i].getCategory() != Category.PRIMITIVE) { throw new UDFArgumentTypeException(i, "A string argument was expected but an argument of type " + arguments[i].getTypeName() + " was given."); } PrimitiveCategory primitiveCategory = ((PrimitiveObjectInspector) arguments[i]) .getPrimitiveCategory(); if (primitiveCategory != PrimitiveCategory.STRING && primitiveCategory != PrimitiveCategory.VOID) { throw new UDFArgumentTypeException(i, "A string argument was expected but an argument of type " + arguments[i].getTypeName() + " was given."); } } try { p = new CachingParser(); } catch (IOException e) { e.printStackTrace(); } argumentOIs = arguments; return ObjectInspectorFactory.getStandardMapObjectInspector( PrimitiveObjectInspectorFactory.javaStringObjectInspector, PrimitiveObjectInspectorFactory.javaStringObjectInspector); }
Source:
protected TmfXmlStateValue(ITmfXmlModelFactory modelFactory, Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes, @Nullable String eventField) { fPath = attributes; fContainer = container; fEventField = eventField; if (!node.getNodeName().equals(TmfXmlStrings.STATE_VALUE)) { throw new IllegalArgumentException("TmfXmlStateValue constructor: Element is not a stateValue"); } String id = node.getAttribute(TmfXmlStrings.ID); fID = id.isEmpty() ? null : id; fIncrement = Boolean.parseBoolean(node.getAttribute(TmfXmlStrings.INCREMENT)); fUpdate = Boolean.parseBoolean(node.getAttribute(TmfXmlStrings.UPDATE)); fStateValue = initializeStateValue(modelFactory, node); String forcedTypeName = node.getAttribute(TmfXmlStrings.FORCED_TYPE); fForcedType = !forcedTypeName.isEmpty() ? TmfXmlUtils.getTmfStateValueByName(forcedTypeName): ITmfStateValue.Type.NULL; String stack = node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK); fStackType = ValueTypeStack.getTypeFromString(stack); fMappingGroup = node.getAttribute(TmfXmlStrings.MAPPING_GROUP); }

Target:
protected TmfXmlStateValue(ITmfXmlModelFactory modelFactory, Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes, @Nullable String eventField) { fPath = attributes; fContainer = container; fEventField = eventField; if (!node.getNodeName().equals(TmfXmlStrings.STATE_VALUE)) { throw new IllegalArgumentException("TmfXmlStateValue constructor: Element is not a stateValue"); } String id = node.getAttribute(TmfXmlStrings.ID); fID = id.isEmpty() ? null : id; fIncrement = Boolean.parseBoolean(node.getAttribute(TmfXmlStrings.INCREMENT)); fUpdate = Boolean.parseBoolean(node.getAttribute(TmfXmlStrings.UPDATE)); fStateValue = initializeStateValue(modelFactory, node); String forcedTypeName = node.getAttribute(TmfXmlStrings.FORCED_TYPE); fForcedType = forcedTypeName.isEmpty() ? ITmfStateValue.Type.NULL : TmfXmlUtils.getTmfStateValueByName(forcedTypeName); String stack = node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK); fStackType = ValueTypeStack.getTypeFromString(stack); fMappingGroup = node.getAttribute(TmfXmlStrings.MAPPING_GROUP); }
Source:
public boolean execute(String rawCommand, EntityRef callingClient) { String commandName = processCommandName(rawCommand); List<String> processedParameters = processParameters(rawCommand); ClientComponent cc = callingClient.getComponent(ClientComponent.class); if (cc.local) { if (!rawCommand.isEmpty() && (localCommandHistory.isEmpty() || localCommandHistory.getLast() != rawCommand)) localCommandHistory.add(rawCommand); } return execute(new Name(commandName), processedParameters, callingClient); }

Target:
public boolean execute(String rawCommand, EntityRef callingClient) { String commandName = processCommandName(rawCommand); List<String> processedParameters = processParameters(rawCommand); ClientComponent cc = callingClient.getComponent(ClientComponent.class); if (cc.local) { if (!rawCommand.isEmpty() && (localCommandHistory.isEmpty() || !localCommandHistory.getLast().equals(rawCommand))) { localCommandHistory.add(rawCommand); } } return execute(new Name(commandName), processedParameters, callingClient); }
Source:
public ValidationResult invalidBiosType() { return ValidationResult.failWith(EngineMessage.BIOS_TYPE_INVALID_FOR_CLUSTER) .when(newCluster != null && newCluster.getBiosType() == null || cluster.getBiosType() == null); }

Target:
public ValidationResult invalidBiosType() { return ValidationResult.failWith(EngineMessage.BIOS_TYPE_INVALID_FOR_CLUSTER) .when(newCluster != null && newCluster.getBiosType() == BiosType.CLUSTER_DEFAULT || cluster.getBiosType() == BiosType.CLUSTER_DEFAULT); }
Source:
public void execute(ProgressMonitor pm) throws SQLException { if(!pk_name.isEmpty()) { resultSetHolder.setCommand(getCommand()+" LIMIT 0"); cachePrimaryKey(pm); } else { LOGGER.warn(I18N.tr("The table {0} does not contain a primary key, a vast amount of memory may be required", location)); resultSetHolder.setCommand(getCommand()); PropertyChangeListener listener = EventHandler.create(PropertyChangeListener.class, resultSetHolder, "cancel"); pm.addPropertyChangeListener(ProgressMonitor.PROP_CANCEL, listener); try { resultSetHolder.getResource(); } finally { pm.removePropertyChangeListener(listener); } } }

Target:
public void execute(ProgressMonitor pm) throws SQLException { if(!pk_name.isEmpty()) { resultSetHolder.setCommand(getCommand()+" LIMIT 0"); cachePrimaryKey(pm); } else { LOGGER.warn(I18N.tr("Table {0} does not contain a primary key. A vast amount of memory may be required.", location)); resultSetHolder.setCommand(getCommand()); PropertyChangeListener listener = EventHandler.create(PropertyChangeListener.class, resultSetHolder, "cancel"); pm.addPropertyChangeListener(ProgressMonitor.PROP_CANCEL, listener); try { resultSetHolder.getResource(); } finally { pm.removePropertyChangeListener(listener); } } }
Source:
private FmsGroup umsGroupToGroup(Group umsGroup) { FmsGroup fmsGroup = new FmsGroup(); fmsGroup.withName(umsGroup.getGroupName()); fmsGroup.withAzureObjectId(getOptionalAzureObjectId(umsGroup.getCloudIdentitiesList())); return fmsGroup; }

Target:
private FmsGroup umsGroupToGroup(Group umsGroup) { FmsGroup fmsGroup = new FmsGroup(); fmsGroup.withName(umsGroup.getGroupName()); return fmsGroup; }
Source:
Block makeBlock(int positionCount, boolean includeNulls, boolean[] nulls, long[] values) { Block block = new Int128ArrayBlock(positionCount, Optional.ofNullable(includeNulls ? nulls : null), values); return block; }

Target:
protected Block makeBlock(int positionCount, boolean includeNulls, boolean[] nulls, long[] values) { return new Int128ArrayBlock(positionCount, Optional.ofNullable(includeNulls ? nulls : null), values); }
Source:
public ObjectId getItem(int index) { checkWidget(); if (0 > index || index >= commits.size()) { SWT.error(SWT.ERROR_INVALID_RANGE); } return commits.get(index).objectId; }

Target:
public ObjectId getItem(int index) { checkWidget(); if (index < 0 || commits.size() <= index) { SWT.error(SWT.ERROR_INVALID_RANGE); } return commits.get(index).objectId; }
Source:
protected Response performRemove(String id) { return Response.serverError().build(); }

Target:
protected Response performRemove(String id) { throw new UnsupportedOperationException(); }
Source:
private void transition(final State from, final State to) { if (state != from) { throw new ISE("Cannot transition from[%s] to[%s].", from, to); } state = to; }

Target:
private void transition(final State from, final State to) { if (state != from) { throw new ISE("Cannot transition from[%s] to[%s] because current state[%s] is not [%s].", from, to, state, from); } state = to; }
Source:
public void createControl(Composite parent, final FormToolkit toolkit) { Collection<String> reviewUrls = taskReviewStore.getReviewUrls(getTaskEditorPage().getTask().getUrl()); getReviewsFromUrls(reviewUrls); if (reviews.size() == 0) { return; } reviewContainers = new ArrayList<TaskReview>(); try { populateReviews(reviewContainers); } catch (NumberFormatException e) { return; } selectionProvider = new SelectionProviderAdapter(); section = createSection(parent, toolkit, hasIncoming); section.setText(section.getText()); expandSection(toolkit, section); section.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent event) { if (reviewContainers == null) { expandSection(toolkit, section); getTaskEditorPage().reflow(); } } }); setSection(toolkit, section); }

Target:
public void createControl(Composite parent, final FormToolkit toolkit) { if (taskReviewStore != null) { Collection<String> reviewUrls = taskReviewStore.getReviewUrls(getTaskEditorPage().getTask().getUrl()); getReviewsFromUrls(reviewUrls); } if (reviews.size() == 0 || reviews == null) { return; } reviewContainers = new ArrayList<TaskReview>(); populateReviews(reviewContainers); selectionProvider = new SelectionProviderAdapter(); section = createSection(parent, toolkit, true); section.setText(section.getText()); createContents(toolkit, section); section.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent event) { if (reviewContainers == null) { createContents(toolkit, section); getTaskEditorPage().reflow(); } } }); setSection(toolkit, section); }
Source:
void emitEscapedContent(int c) throws IOException { if (c == '\\') { super.emitContent("&#92;"); } else { if (c == '{' || c == '\\' || c == '[' || c == ']') { super.emitContent('\\'); } super.emitContent(c); } }

Target:
void emitEscapedContent(int c) throws IOException { if (c == '\\') { super.emitContent("&#92;"); } else { if ((c == '#' && getLastChar() == '&') || (c == '{' || c == '\\' || c == '[' || c == ']')) { super.emitContent('\\'); } super.emitContent(c); } }
Source:
public void setUp() { PaChannelsIngester paChannelsIngester = mock(PaChannelsIngester.class); PaChannelGroupsIngester paChannelGroupsIngester = mock(PaChannelGroupsIngester.class); ChannelResolver channelResolver = mock(ChannelResolver.class); ChannelWriter channelWriter = mock(ChannelWriter.class); ChannelGroupResolver channelGroupResolver = mock(ChannelGroupResolver.class); ChannelGroupWriter channelGroupWriter = mock(ChannelGroupWriter.class); channelDataHandler = new PaChannelDataHandler( paChannelsIngester, paChannelGroupsIngester, channelResolver, channelWriter, channelGroupResolver, channelGroupWriter ); Image existingImage = Image.builder("existing uri").withTheme(ImageTheme.DARK_MONOCHROME).build(); existingChannel = Channel.builder().withImage(existingImage).build(); Image newImage = Image.builder("new uri").withTheme(ImageTheme.DARK_MONOCHROME).build(); newChannel = Channel.builder().withImage(newImage).build(); }

Target:
public void setUp() { PaChannelsIngester paChannelsIngester = mock(PaChannelsIngester.class); PaChannelGroupsIngester paChannelGroupsIngester = mock(PaChannelGroupsIngester.class); ChannelResolver channelResolver = mock(ChannelResolver.class); ChannelWriter channelWriter = mock(ChannelWriter.class); ChannelGroupResolver channelGroupResolver = mock(ChannelGroupResolver.class); ChannelGroupWriter channelGroupWriter = mock(ChannelGroupWriter.class); channelDataHandler = new PaChannelDataHandler( paChannelsIngester, paChannelGroupsIngester, channelResolver, channelWriter, channelGroupResolver, channelGroupWriter ); Image existingImage = Image.builder("existing uri").withTheme(ImageTheme.DARK_MONOCHROME).build(); existingChannel = Channel.builder().withImage(existingImage).build(); }
Source:
public void reapEntries(final Date reapingDate) { sqlDao.inTransaction(new Transaction<Void, QueueSqlDao<T>>() { @Override public Void inTransaction(final QueueSqlDao<T> transactional, final TransactionStatus status) throws Exception { final DateTime now = clock.getUTCNow(); final List<T> entriesLeftBehind = sqlDao.getEntriesLeftBehind(config.getMaxReDispatchCount(), now.toDate(), reapingDate, config.getTableName()); if (entriesLeftBehind.size() > 0) { final Iterable<T> entriesToMove = Iterables.transform(entriesLeftBehind, new Function<T, T>() { @Nullable @Override public T apply(@Nullable final T entry) { entry.setProcessingState(PersistentQueueEntryLifecycleState.REAPED); return entry; } }); moveEntriesToHistoryFromTransaction(transactional, entriesToMove); for (T entry : entriesLeftBehind) { entry.setCreatedDate(now); entry.setProcessingState(PersistentQueueEntryLifecycleState.AVAILABLE); entry.setCreatingOwner(CreatorName.get()); } transactional.insertEntries(entriesLeftBehind, config.getTableName()); log.warn("{} entries were reaped by {}",DB_QUEUE_LOG_ID ,entriesLeftBehind.size(), CreatorName.get()); } return null; } }); }

Target:
public void reapEntries(final Date reapingDate) { sqlDao.inTransaction(new Transaction<Void, QueueSqlDao<T>>() { @Override public Void inTransaction(final QueueSqlDao<T> transactional, final TransactionStatus status) throws Exception { final DateTime now = clock.getUTCNow(); final List<T> entriesLeftBehind = sqlDao.getEntriesLeftBehind(config.getMaxReDispatchCount(), now.toDate(), reapingDate, config.getTableName()); if (entriesLeftBehind.size() > 0) { final Iterable<T> entriesToMove = Iterables.transform(entriesLeftBehind, new Function<T, T>() { @Nullable @Override public T apply(@Nullable final T entry) { entry.setProcessingState(PersistentQueueEntryLifecycleState.REAPED); return entry; } }); moveEntriesToHistoryFromTransaction(transactional, entriesToMove); for (T entry : entriesLeftBehind) { entry.setCreatedDate(now); entry.setProcessingState(PersistentQueueEntryLifecycleState.AVAILABLE); entry.setCreatingOwner(CreatorName.get()); totalInsert.inc(); } transactional.insertEntries(entriesLeftBehind, config.getTableName()); log.warn("{} entries were reaped by {}",DB_QUEUE_LOG_ID ,entriesLeftBehind.size(), CreatorName.get()); } return null; } }); }
Source:
public void runAtDriver(RuntimeContainer container) { if (container != null) { DatabaseClient containerClient = (DatabaseClient) container.getComponentData(properties.getReferencedComponentId(), MarkLogicConnection.CONNECTION); if (containerClient != null) { containerClient.release(); } LOGGER.info("Connection released"); } }

Target:
public void runAtDriver(RuntimeContainer container) { if (container != null) { DatabaseClient containerClient = (DatabaseClient) container.getComponentData(properties.getReferencedComponentId(), MarkLogicConnection.CONNECTION); if (containerClient != null) { containerClient.release(); LOGGER.info("Connection released"); } } }
Source:
public static void setupProducts() { removeProducts(); setupTestProducts(); setupEvilTestProducts(); final SearchSort<ProductProjection> sortByCreatedAt = ProductProjectionSearch.model().createdAt().sort(SimpleSearchSortDirection.DESC); final TermFacetExpression<ProductProjection, String> facet = ProductProjectionSearch.model().allVariants().attribute().ofText(ATTR_NAME_COLOR).facetOf().all(); final SearchDsl<ProductProjection> search = ProductProjectionSearch.of(STAGED).withSort(sortByCreatedAt).plusFacet(facet); execute(search, res -> { final List<String> ids = SphereTestUtils.toIds(res.getResults()); final boolean productsExist = ids.contains(product1.getId()) && ids.contains(product2.getId()) && ids.contains(product3.getId()) && ids.contains(evilProduct1.getId()) && ids.contains(evilProduct2.getId()); final boolean facetsExist = res.getTermFacetResult(facet).map(term -> term.getMissing() > 1 && term.getTotal() > 1).orElse(false); return productsExist && facetsExist; }); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public static void setupProducts() { removeProducts(); setupTestProducts(); setupEvilTestProducts(); }
Source:
private void getHistory(IngestJobContext context, AbstractFile historyFile) throws TskCoreException, IOException { if (historyFile.getSize() == 0) { return; } File tempHistoryFile = createTemporaryFile(context, historyFile); try { ContentUtils.writeToFile(historyFile, tempHistoryFile, context::dataSourceIngestIsCancelled); } catch (IOException ex) { throw new IOException("Error writingToFile: " + historyFile, ex); } try { postArtifact(getHistoryArtifacts(historyFile, tempHistoryFile.toPath(), context)); } finally { tempHistoryFile.delete(); } }

Target:
private void getHistory(IngestJobContext context, AbstractFile historyFile) throws TskCoreException, IOException { if (historyFile.getSize() == 0) { return; } File tempHistoryFile = createTemporaryFile(context, historyFile); try { ContentUtils.writeToFile(historyFile, tempHistoryFile, context::dataSourceIngestIsCancelled); } catch (IOException ex) { throw new IOException("Error writingToFile: " + historyFile, ex); } try { postArtifacts(getHistoryArtifacts(historyFile, tempHistoryFile.toPath(), context)); } finally { tempHistoryFile.delete(); } }
Source:
private String getRootUrl() { return appUrl.concat("/medic/_design/medic/_rewrite/"); }

Target:
private String getRootUrl() { return appUrl; }
Source:
protected Object readResolve() { if (parameterDefinitions == null) { parameterDefinitions = Collections.emptyList(); } return this; }

Target:
private Object readResolve() { return parameterDefinitions == null ? new ParametersDefinitionProperty() : this; }
Source:
private void validateTypeCombination(OMElement sourceElement, OMElement targetElement) { int sourceType = -1; int targetType = -1; OMAttribute sourceTypeAttr = sourceElement.getAttribute(ATT_TYPE); if (sourceTypeAttr != null && sourceTypeAttr.getAttributeValue() != null) { sourceType = convertTypeToInt(sourceTypeAttr.getAttributeValue()); if (sourceType < 0) { throw new SynapseException("Un-expected source type"); } } OMAttribute targetTypeAttr = targetElement.getAttribute(ATT_TYPE); if (targetTypeAttr != null && targetTypeAttr.getAttributeValue() != null) { targetType = convertTypeToInt(targetTypeAttr.getAttributeValue()); if (targetType < 0) { throw new SynapseException("Un-expected target type"); } if (targetType == 4) { throw new SynapseException("Inline not support for target attribute"); } } if (sourceType == 1) { if (targetType == 0 || targetType == 1 || targetType == 2) { throw new SynapseException("Wrong combination of source and target type"); } } else if (sourceType == 2) { if (targetType == 1 || targetType == 2) { throw new SynapseException("Wrong combination of source and target type"); } } else if (sourceType == 0 && targetType == 1) { throw new SynapseException("Wrong combination of source and target type"); } }

Target:
private void validateTypeCombination(OMElement sourceElement, OMElement targetElement) { int sourceType = -1; int targetType = -1; OMAttribute sourceTypeAttr = sourceElement.getAttribute(ATT_TYPE); if (sourceTypeAttr != null && sourceTypeAttr.getAttributeValue() != null) { sourceType = convertTypeToInt(sourceTypeAttr.getAttributeValue()); if (sourceType < 0) { throw new SynapseException("Unexpected source type"); } } OMAttribute targetTypeAttr = targetElement.getAttribute(ATT_TYPE); if (targetTypeAttr != null && targetTypeAttr.getAttributeValue() != null) { targetType = convertTypeToInt(targetTypeAttr.getAttributeValue()); if (targetType < 0) { throw new SynapseException("Unexpected target type"); } if (targetType == 4) { throw new SynapseException("Inline not support for target attribute"); } } if (sourceType == 1) { if (targetType == 0 || targetType == 1 || targetType == 2) { throw new SynapseException("Wrong combination of source and target type"); } } else if (sourceType == 2) { if (targetType == 1 || targetType == 2) { throw new SynapseException("Wrong combination of source and target type"); } } else if (sourceType == 0 && targetType == 1) { throw new SynapseException("Wrong combination of source and target type"); } }
Source:
public void testCreateJUnitTestCase() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); String string= "E"; int offset= buf.toString().indexOf(string); AssistContext context= getCorrectionContext(cu, offset, string.length()); List<IJavaCompletionProposal> proposals= collectAssists(context, false); assertNumberOfProposals(proposals, 1); assertProposalExists(proposals, "Create new test case for class 'E.java'"); }

Target:
public void testCreateJUnitTestCase() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class E {\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); String string= "E"; int offset= buf.toString().indexOf(string); AssistContext context= getCorrectionContext(cu, offset, string.length()); List<IJavaCompletionProposal> proposals= collectAssists(context, false); assertNumberOfProposals(proposals, 1); assertProposalExists(proposals, Messages.format(CorrectionMessages.QuickAssistProcessor_create_new_junit_test_case, "E.java")); }
Source:
public void testWithArrays() { final byte[] authenthicationKey = { 1 }; final byte[] encryptionKey = { 1 }; final KeySet keySet = new KeySet(authenthicationKey, encryptionKey); final KeySetDto keySetDto = this.configurationMapper.map(keySet, KeySetDto.class); assertNotNull(keySet); assertNotNull(keySetDto); assertNotNull(keySetDto.getAuthenticationKey()); assertNotNull(keySetDto.getEncryptionKey()); assertEquals(keySet.getAuthenticationKey().length, keySetDto.getAuthenticationKey().length); assertEquals(keySet.getEncryptionKey().length, keySetDto.getEncryptionKey().length); assertEquals(keySet.getAuthenticationKey()[0], keySetDto.getAuthenticationKey()[0]); assertEquals(keySet.getEncryptionKey()[0], keySetDto.getEncryptionKey()[0]); }

Target:
public void testWithArrays() { final byte[] authenthicationKey = { 1 }; final byte[] encryptionKey = { 1 }; final KeySet keySet = new KeySet(authenthicationKey, encryptionKey); final KeySetDto keySetDto = this.configurationMapper.map(keySet, KeySetDto.class); assertNotNull(keySetDto); assertNotNull(keySetDto.getAuthenticationKey()); assertNotNull(keySetDto.getEncryptionKey()); assertEquals(keySet.getAuthenticationKey().length, keySetDto.getAuthenticationKey().length); assertEquals(keySet.getEncryptionKey().length, keySetDto.getEncryptionKey().length); assertEquals(keySet.getAuthenticationKey()[0], keySetDto.getAuthenticationKey()[0]); assertEquals(keySet.getEncryptionKey()[0], keySetDto.getEncryptionKey()[0]); }
Source:
public final int hashCode() { if (hashCode == Utils.NO_HASHCODE) { hashCode = computeHash(); } return hashCode; }

Target:
public final int hashCode() { if (hashCode == Utils.NO_HASHCODE) { hashCode = computeHash(); hashCode = hashCode == 0 ? 1 : hashCode; } return hashCode; }
Source:
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { final int fortune = 0; EnumHempGrowth growth = state.get(GROWTH); List<ItemStack> drops = new ArrayList<ItemStack>(); drops.add(new ItemStack(IEContent.itemSeeds, 1)); if(growth==getMaxGrowth(growth)) { for(int i = 0; i < 3+fortune; ++i) if(Utils.RAND.nextInt(8) <= growth.ordinal()) drops.add(new ItemStack(IEContent.itemHempFiber, 1)); } return drops; }

Target:
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { ItemStack tool = builder.get(LootParameters.TOOL); int fortune = (tool==null)?(0):(EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, tool)); EnumHempGrowth growth = state.get(GROWTH); List<ItemStack> drops = new ArrayList<ItemStack>(); drops.add(new ItemStack(IEContent.itemSeeds, 1)); if(growth==getMaxGrowth(growth)) { for(int i = 0; i < 3+fortune; ++i) if(Utils.RAND.nextInt(8) <= growth.ordinal()) drops.add(new ItemStack(IEContent.itemHempFiber, 1)); } return drops; }
Source:
public Throwable getThrowable() { return throwable; }

Target:
public Optional<Throwable> getThrowable() { return Optional.ofNullable(throwable); }
Source:
protected int run() throws Exception { boolean errorOccurred = false; try { Jenkins.getInstance().getQueue().clear(); } catch (AccessDeniedException e) { stderr.println(e.getMessage()); errorOccurred = true; } catch (Exception e) { final String errorMsg = String.format("Unexpected exception occurred during performing clear-queue command: %s", e.getMessage()); stderr.println(errorMsg); LOGGER.warning(errorMsg); errorOccurred = true; } return errorOccurred ? 1 : 0; }

Target:
protected int run() throws Exception { Jenkins.getActiveInstance().getQueue().clear(); return 0; }
Source:
public static <T, E extends Exception> T maybeLog(CallableCheckedException<T, E> action, BiConsumer<LoggingFunction, Stopwatch> primaryLogger, BiConsumer<LoggingFunction, T> additonalLoggerWithAccessToResult) throws E { if (log.isTraceEnabled() || slowlogger.isWarnEnabled()) { Monitor<T> monitor = Monitor.createMonitor( primaryLogger, additonalLoggerWithAccessToResult, slowLogPredicate); try { T res = action.call(); monitor.registerResult(res); return res; } catch (Exception ex) { monitor.registerException(ex); throw Throwables.throwUncheckedException(ex); } finally { monitor.log(); } } else { return action.call(); } }

Target:
public static <T, E extends Exception> T maybeLog(CallableCheckedException<T, E> action, BiConsumer<LoggingFunction, Stopwatch> primaryLogger, BiConsumer<LoggingFunction, T> additonalLoggerWithAccessToResult) throws E { if (log.isTraceEnabled() || slowlogger.isWarnEnabled()) { Monitor<T> monitor = Monitor.createMonitor( primaryLogger, additonalLoggerWithAccessToResult, slowLogPredicate); try { T res = action.call(); monitor.registerResult(res); return res; } catch (Exception ex) { monitor.registerException(ex); throw ex; } finally { monitor.log(); } } else { return action.call(); } }
Source:
@Override public JsonWriter value(BufferedSource source) throws IOException { Object value = JsonReader.of(source).readJsonValue(); if (value instanceof String) { return value((String) value); } if (value instanceof Number) { return value((Number) value); } if (promoteValueToName) { throw new AssertionError("This is not a map key."); } boolean serializeNulls = this.serializeNulls; this.serializeNulls = true; try { add(value); } finally { this.serializeNulls = serializeNulls; } pathIndices[stackSize - 1]++; return this; }

Target:
@Override public JsonWriter value(BufferedSource source) throws IOException { if (promoteValueToName) { throw new IllegalStateException( "BufferedSource cannot be used as a map key in JSON at path " + getPath()); } Object value = JsonReader.of(source).readJsonValue(); boolean serializeNulls = this.serializeNulls; this.serializeNulls = true; try { add(value); } finally { this.serializeNulls = serializeNulls; } pathIndices[stackSize - 1]++; return this; }
Source:
private static StringBuilder buildSecurityHeader(StringBuilder securityHeaderBuilder, String username, String password, WsTrustVersion version) { StringBuilder messageCredentialsBuilder = new StringBuilder( MAX_EXPECTED_MESSAGE_SIZE); String guid = UUID.randomUUID().toString(); username = StringEscapeUtils.escapeXml10(username); password = StringEscapeUtils.escapeXml10(password); DateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = new Date(); String currentTimeString = dateFormat.format(date); int toAdd = 60 * 1000 * 10; date = new Date(date.getTime() + toAdd); String expiryTimString = dateFormat.format(date); messageCredentialsBuilder.append(String.format( "<o:UsernameToken u:Id='uuid-" + "%s'>" + "<o:Username>%s</o:Username>" + "<o:Password>%s</o:Password>" + "</o:UsernameToken>", guid, username, password)); securityHeaderBuilder.append("<o:Security s:mustUnderstand='1' xmlns:o='<LINK_0>'>"); securityHeaderBuilder.append(String.format( "<u:Timestamp u:Id='_0'>" + "<u:Created>%s</u:Created>" + "<u:Expires>%s</u:Expires>" + "</u:Timestamp>", currentTimeString, expiryTimString)); securityHeaderBuilder.append(messageCredentialsBuilder.toString()); securityHeaderBuilder.append("</o:Security>"); return securityHeaderBuilder; }

Target:
private static StringBuilder buildSecurityHeader(StringBuilder securityHeaderBuilder, String username, String password, WsTrustVersion version) { StringBuilder messageCredentialsBuilder = new StringBuilder( MAX_EXPECTED_MESSAGE_SIZE); String guid = UUID.randomUUID().toString(); username = StringEscapeUtils.escapeXml10(username); password = StringEscapeUtils.escapeXml10(password); DateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = new Date(); String currentTimeString = dateFormat.format(date); int toAdd = 60 * 1000 * 10; date = new Date(date.getTime() + toAdd); String expiryTimeString = dateFormat.format(date); messageCredentialsBuilder.append(String.format( "<o:UsernameToken u:Id='uuid-" + "%s'>" + "<o:Username>%s</o:Username>" + "<o:Password>%s</o:Password>" + "</o:UsernameToken>", guid, username, password)); securityHeaderBuilder.append("<o:Security s:mustUnderstand='1' xmlns:o='<LINK_0>'>"); securityHeaderBuilder.append(String.format( "<u:Timestamp u:Id='_0'>" + "<u:Created>%s</u:Created>" + "<u:Expires>%s</u:Expires>" + "</u:Timestamp>", currentTimeString, expiryTimeString)); securityHeaderBuilder.append(messageCredentialsBuilder.toString()); securityHeaderBuilder.append("</o:Security>"); return securityHeaderBuilder; }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); setContentView(R.layout.post_list_activity); mIsPage = getIntent().getBooleanExtra(EXTRA_VIEW_PAGES, false); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(getString(mIsPage ? R.string.pages : R.string.posts)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } if (savedInstanceState == null) { mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE); } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } mPostList = PostsListFragment.newInstance(mSite); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.post_list_container, mPostList); fragmentTransaction.commit(); showErrorDialogIfNeeded(getIntent().getExtras()); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); setContentView(R.layout.post_list_activity); mIsPage = getIntent().getBooleanExtra(EXTRA_VIEW_PAGES, false); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(getString(mIsPage ? R.string.pages : R.string.posts)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } if (savedInstanceState == null) { mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE); } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } mPostList = (PostsListFragment) getFragmentManager().findFragmentByTag(PostsListFragment.TAG); if (mPostList == null) { mPostList = PostsListFragment.newInstance(mSite); getFragmentManager().beginTransaction() .add(R.id.post_list_container, mPostList, PostsListFragment.TAG) .commit(); } showErrorDialogIfNeeded(getIntent().getExtras()); }
Source:
public void shouldRestoreAndProgressWhenTopicWrittenToDuringRestorationWithEosAlphaEnabled() throws Exception { try { STREAMS_CONFIG.put(StreamsConfig.PROCESSING_GUARANTEE_CONFIG, StreamsConfig.EXACTLY_ONCE); streamsOne = new KafkaStreams(streamsBuilder.build(), STREAMS_CONFIG); streamsOne.start(); produceKeyValues("a", "b", "c"); assertNumberValuesRead(readKeyValues, expectedInitialResultsMap, "Table did not read all values"); streamsOne.close(); streamsOne = new KafkaStreams(streamsBuilder.build(), STREAMS_CONFIG); streamsOne.setGlobalStateRestoreListener(new UpdatingSourceTopicOnRestoreStartStateRestoreListener()); streamsOne.start(); produceKeyValues("f", "g", "h"); assertNumberValuesRead( readKeyValues, expectedResultsWithDataWrittenDuringRestoreMap, "Table did not get all values after restart"); } finally { streamsOne.close(Duration.ofSeconds(5)); } }

Target:
public void shouldRestoreAndProgressWhenTopicWrittenToDuringRestorationWithEosAlphaEnabled() throws Exception { STREAMS_CONFIG.put(StreamsConfig.PROCESSING_GUARANTEE_CONFIG, StreamsConfig.EXACTLY_ONCE); shouldRestoreAndProgressWhenTopicWrittenToDuringRestorationWithEosEnabled(); }
Source:
public void addRegion(Region region) { if (!regions.contains(region)) { if (serviceConnected) { try { beaconManager.startMonitoringBeaconsInRegion(region); } catch (RemoteException e) { LogManager.e(e, TAG, "Can't add bootstrap region"); } }else{ LogManager.w(TAG, "Adding a rigion: service not yet Connected"); } regions.add(region); } }

Target:
public void addRegion(Region region) { if (!regions.contains(region)) { if (serviceConnected) { try { beaconManager.startMonitoringBeaconsInRegion(region); } catch (RemoteException e) { LogManager.e(e, TAG, "Can't add bootstrap region"); } }else{ LogManager.w(TAG, "Adding a region: service not yet Connected"); } regions.add(region); } }
Source:
private void persistWorkbenchModel() { try { Job.getJobManager().join(WORKBENCH_AUTO_SAVE_JOB, new NullProgressMonitor()); } catch (OperationCanceledException e) { } catch (InterruptedException e) { } final MApplication appCopy = (MApplication) EcoreUtil.copy((EObject) application); if (detectWorkbenchCorruption(appCopy)) { return; } final IModelResourceHandler handler = e4Context.get(IModelResourceHandler.class); Job cleanAndSaveJob = new Job(WORKBENCH_AUTO_SAVE_BACKGROUND_JOB) { @Override protected IStatus run(IProgressMonitor monitor) { final Resource res = handler.createResourceWithApp(appCopy); cleanUpCopy(appCopy, e4Context); try { if (!detectWorkbenchCorruption((MApplication) res.getContents().get(0))) { res.save(null); } } catch (IOException e) { } finally { res.unload(); res.getResourceSet().getResources().remove(res); } return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { return WORKBENCH_AUTO_SAVE_JOB.equals(family); } }; cleanAndSaveJob.setPriority(Job.SHORT); cleanAndSaveJob.setSystem(true); cleanAndSaveJob.schedule(); }

Target:
private void persistWorkbenchModel() { final MApplication appCopy = (MApplication) EcoreUtil.copy((EObject) application); if (detectWorkbenchCorruption(appCopy)) { return; } final IModelResourceHandler handler = e4Context.get(IModelResourceHandler.class); Job cleanAndSaveJob = new Job(APPLICATIONMODEL_SAVE_JOB) { @Override protected IStatus run(IProgressMonitor monitor) { final Resource res = handler.createResourceWithApp(appCopy); cleanUpCopy(appCopy, e4Context); try { if (!detectWorkbenchCorruption((MApplication) res.getContents().get(0))) { res.save(null); } } catch (IOException e) { } finally { res.unload(); res.getResourceSet().getResources().remove(res); } return Status.OK_STATUS; } }; cleanAndSaveJob.setPriority(Job.SHORT); cleanAndSaveJob.setSystem(true); cleanAndSaveJob.setJobGroup(jobGroupWorkbenchSaveJob); cleanAndSaveJob.schedule(); }