auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static Block zipWith( Type leftElementType, Type rightElementType, ArrayType outputArrayType, Object state, Block leftBlock, Block rightBlock, BinaryFunctionInterface function) { checkCondition(leftBlock.getPositionCount() == rightBlock.getPositionCount(), INVALID_FUNCTION_ARGUMENT, "Arrays must have the same length"); Type outputElementType = outputArrayType.getElementType(); PageBuilder pageBuilder = (PageBuilder) state; if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder arrayBlockBuilder = pageBuilder.getBlockBuilder(0); BlockBuilder blockBuilder = arrayBlockBuilder.beginBlockEntry(); for (int position = 0; position < leftBlock.getPositionCount(); position++) { Object left = readNativeValue(leftElementType, leftBlock, position); Object right = readNativeValue(rightElementType, rightBlock, position); Object output; try { output = function.apply(left, right); } catch (Throwable throwable) { throw Throwables.propagate(throwable); } writeNativeValue(outputElementType, blockBuilder, output); } arrayBlockBuilder.closeEntry(); pageBuilder.declarePosition(); <START> return outputArrayType.getObject(arrayBlockBuilder, arrayBlockBuilder.getPositionCount() - 1); <END> }</code><technical_language>pageBuilder is in a consistent state throw. i.e. need some code throw Throwables.propagate(throwable). In addition, refactoring this code, remove usage of deprecated function propagate</technical_language>

Target:
public static Block zipWith( Type leftElementType, Type rightElementType, ArrayType outputArrayType, Object state, Block leftBlock, Block rightBlock, BinaryFunctionInterface function) { checkCondition(leftBlock.getPositionCount() == rightBlock.getPositionCount(), INVALID_FUNCTION_ARGUMENT, "Arrays must have the same length"); Type outputElementType = outputArrayType.getElementType(); PageBuilder pageBuilder = (PageBuilder) state; if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder arrayBlockBuilder = pageBuilder.getBlockBuilder(0); BlockBuilder blockBuilder = arrayBlockBuilder.beginBlockEntry(); for (int position = 0; position < leftBlock.getPositionCount(); position++) { Object left = readNativeValue(leftElementType, leftBlock, position); Object right = readNativeValue(rightElementType, rightBlock, position); Object output; try { output = function.apply(left, right); } catch (Throwable throwable) { arrayBlockBuilder.closeEntry(); pageBuilder.declarePosition(); throwIfUnchecked(throwable); throw new RuntimeException(throwable); } writeNativeValue(outputElementType, blockBuilder, output); } arrayBlockBuilder.closeEntry(); pageBuilder.declarePosition(); return outputArrayType.getObject(arrayBlockBuilder, arrayBlockBuilder.getPositionCount() - 1); }
Source:
<code>protected void handleCreateTarget() { final Map<String, String> commands = uiManager.getAddTargetCommands(); final Map<String, Image> images = uiManager.getTargetIcons(); if (!commands.isEmpty()) { ListDialog ld = new ListDialog(getShell()); ld.setTitle("New Launch Target"); ld.setMessage("Select target type to create"); ld.setContentProvider(new ArrayContentProvider()); ld.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return (String)element; } @Override public Image getImage(Object element) { return images.get(element); } }); ld.setInput(commands.keySet().toArray()); <START> switch(ld.open()) { <END> case Window.CANCEL: return; case Window.OK: String command = commands.get((String) (ld.getResult()[0])); Activator.runCommand(command); return; default: } } }</code><technical_language>picky do switch here</technical_language>

Target:
protected void handleCreateTarget() { final Map<String, String> commands = uiManager.getAddTargetCommands(); final Map<String, Image> images = uiManager.getTargetIcons(); if (!commands.isEmpty()) { ListDialog ld = new ListDialog(getShell()); ld.setTitle("New Launch Target"); ld.setMessage("Select target type to create"); ld.setContentProvider(new ArrayContentProvider()); ld.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return (String)element; } @Override public Image getImage(Object element) { return images.get(element); } }); ld.setInput(commands.keySet().toArray()); if (ld.open() == Window.OK) { String command = commands.get((String) (ld.getResult()[0])); Activator.runCommand(command); } } }
Source:
<code>public boolean addEndpointForTenant(String endpointData, String tenantDomain) throws EndpointAdminException { try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); boolean status = addEndpoint(endpointData); <START> return status; <END> } finally { PrivilegedCarbonContext.endTenantFlow(); } }</code><technical_language>remove status variable calling "return addEndpoint(endpointData);"</technical_language>

Target:
public boolean addEndpointForTenant(String endpointData, String tenantDomain) throws EndpointAdminException { try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); return addEndpoint(endpointData); } finally { PrivilegedCarbonContext.endTenantFlow(); } }
Source:
<code>public List<PlanFragment> getSourceFragments(RemoteSourceNode node) { return node.getSourceFragmentIds().stream() .map(id -> { <START> verify(fragmentMap.containsKey(id), "fragment id not in map"); <END> return fragmentMap.get(id); }) .collect(toImmutableList()); }</code><technical_language>ditto error message</technical_language>

Target:
public List<PlanFragment> getSourceFragments(RemoteSourceNode node) { return node.getSourceFragmentIds().stream() .map(id -> { verify(fragments.containsKey(id), "fragment id not in map: %s", id); return fragments.get(id); }) .collect(toImmutableList()); }
Source:
<code>public void showIssue(String repoId, int id, boolean isPullRequest, boolean isForceRefresh) { if (isPullRequest) { logger.info("Showing pull request #" + id); runBrowserOperation(() -> driver.get(GitHubURL.getPathForPullRequest(repoId, id), isForceRefresh)); runBrowserOperation(() -> driver.scrollToBottom()); } else { logger.info("Showing issue #" + id); runBrowserOperation(() -> driver.get(GitHubURL.getPathForIssue(repoId, id), isForceRefresh)); <START> runBrowserOperation(() -> driver.scrollToBottom()); <END> } }</code><technical_language>occur in cases, conditional. Also, a direct method reference used</technical_language>

Target:
public void showIssue(String repoId, int id, boolean isPullRequest, boolean isForceRefresh) { if (isPullRequest) { logger.info("Showing pull request #" + id); runBrowserOperation(() -> driver.get(GitHubURL.getPathForPullRequest(repoId, id), isForceRefresh)); } else { logger.info("Showing issue #" + id); runBrowserOperation(() -> driver.get(GitHubURL.getPathForIssue(repoId, id), isForceRefresh)); } runBrowserOperation(() -> scrollToBottom()); }
Source:
<code>public ElasticsearchQueryBuilder(List<ElasticsearchColumnHandle> columnHandles, ElasticsearchConnectorConfig config, ElasticsearchSplit split) { columns = requireNonNull(columnHandles, "columnHandles is null"); requireNonNull(config, "config is null"); requireNonNull(split, "split is null"); ElasticsearchTableDescription table = split.getTable(); tupleDomain = split.getTupleDomain(); index = split.getIndex(); type = table.getType(); shard = split.getShard(); try { <START> Settings settings = Settings.builder().put("client.transport.ignore_cluster_name", true).build(); <END> client = new PreBuiltTransportClient(settings).addTransportAddress(new TransportAddress(InetAddress.getByName(split.getSearchNode()), split.getPort())); } catch (IOException e) { throw new PrestoException(ELASTIC_SEARCH_CONNECTION_ERROR, "Error connecting to Elasticsearch SearchNode: " + split.getSearchNode() + " with port: " + split.getPort(), e); } scrollTimeout = config.getScrollTimeout(); scrollSize = config.getScrollSize(); }</code><technical_language>Please format this like: Settings settings = Settings.builder() .put("client.transport.ignore_cluster_name", true) .build();</technical_language>

Target:
public ElasticsearchQueryBuilder(List<ElasticsearchColumnHandle> columnHandles, ElasticsearchConnectorConfig config, ElasticsearchSplit split) { requireNonNull(columnHandles, "columnHandles is null"); requireNonNull(config, "config is null"); requireNonNull(split, "split is null"); ElasticsearchTableDescription table = split.getTable(); columns = columnHandles; tupleDomain = split.getTupleDomain(); index = split.getIndex(); type = table.getType(); shard = split.getShard(); try { Settings settings = Settings.builder() .put("client.transport.ignore_cluster_name", true) .build(); InetAddress address = InetAddress.getByName(split.getSearchNode()); client = new PreBuiltTransportClient(settings) .addTransportAddress(new TransportAddress(address, split.getPort())); } catch (UnknownHostException e) { throw new PrestoException(ELASTICSEARCH_CONNECTION_ERROR, format("Error connecting to search node (%s:%d)", split.getSearchNode(), split.getPort()), e); } scrollTimeout = config.getScrollTimeout(); scrollSize = config.getScrollSize(); }
Source:
<code>public PlaylistFragment(){ for(SongMetadata s : metadataList){ <START> s.setTitle("This is a really really really looooooooooooooooooooooooooooooooooooooooooooooong Title"); <END> s.setAlbum("Album is super freaking long too"); s.setArtist("Artist is too, but not as much"); } metadataList.get(0).setUsername("Reid"); metadataList.get(1).setUsername("Lizziemom"); metadataList.get(2).setUsername("Greenie"); }</code><technical_language>Wow long</technical_language>

Target:
public PlaylistFragment(){ for(SongMetadata s : metadataList){ s.setTitle("This is a really really really loooooooooooooooooooooo" + "ooooooooooooooooooooooooong Title"); s.setAlbum("Album is super freaking long too"); s.setArtist("Artist is too, but not as much"); } metadataList.get(0).setUsername("Reid"); metadataList.get(1).setUsername("Lizziemom"); metadataList.get(2).setUsername("Greenie"); }
Source:
<code>private DatastreamDocument getXMLDatastreamIfExists(PID pid, String datastreamName) throws FedoraException { log.debug("Attempting to get datastream " + datastreamName + " for object " + pid); try { while (true) { edu.unc.lib.dl.fedora.types.Datastream datastream = managementClient.getDatastream(pid, datastreamName); if (datastream == null) { return null; } <START> log.debug("Got datastream, attempting to get dissemination version with create date " + managementClient.getDatastream(pid, datastreamName).getCreateDate()); <END> try { MIMETypedStream mts = accessClient.getDatastreamDissemination(pid, datastreamName, datastream.getCreateDate()); try (ByteArrayInputStream bais = new ByteArrayInputStream(mts.getStream())) { Document dsDoc = new SAXBuilder().build(bais); return new DatastreamDocument(dsDoc, datastream.getCreateDate()); } catch (JDOMException | IOException e) { throw new ServiceException("Failed to parse datastream " + datastreamName + " for object " + pid, e); } } catch (NotFoundException e) { log.debug("No dissemination version for create date " + datastream.getCreateDate() + " found, retrying"); } } } catch (NotFoundException e) { return null; } }</code><technical_language>Guessing this is in for testing? want re-retrieval datastream profile</technical_language>

Target:
private DatastreamDocument getXMLDatastreamIfExists(PID pid, String datastreamName) throws FedoraException { log.debug("Attempting to get datastream " + datastreamName + " for object " + pid); try { while (true) { edu.unc.lib.dl.fedora.types.Datastream datastream = managementClient.getDatastream(pid, datastreamName); if (datastream == null) { return null; } log.debug("Got datastream, attempting to get dissemination version with create date " + datastream.getCreateDate()); try { MIMETypedStream mts = accessClient.getDatastreamDissemination(pid, datastreamName, datastream.getCreateDate()); try (ByteArrayInputStream bais = new ByteArrayInputStream(mts.getStream())) { Document dsDoc = new SAXBuilder().build(bais); return new DatastreamDocument(dsDoc, datastream.getCreateDate()); } catch (JDOMException | IOException e) { throw new ServiceException("Failed to parse datastream " + datastreamName + " for object " + pid, e); } } catch (NotFoundException e) { log.debug("No dissemination version for create date " + datastream.getCreateDate() + " found, retrying"); } } } catch (NotFoundException e) { return null; } }
Source:
<code>public static Neo4jBoltClient getInstance(Neo4jConfiguration neo4jConfiguration) { <START> if ( INSTANCE_MAP != null && <END> INSTANCE_MAP.size() > 0 && INSTANCE_MAP.containsKey(neo4jConfiguration) ) return INSTANCE_MAP.get(neo4jConfiguration); else { Neo4jBoltClient instance = new Neo4jBoltClient(neo4jConfiguration); if( instance != null && instance.client != null ) { INSTANCE_MAP.put(neo4jConfiguration, instance); return instance; } else { return null; } } }</code><technical_language>extra space openning brace - style check nitpick</technical_language>

Target:
public static Neo4jBoltClient getInstance(Neo4jConfiguration neo4jConfiguration) { if ( INSTANCE_MAP != null && INSTANCE_MAP.size() > 0 && INSTANCE_MAP.containsKey(neo4jConfiguration)) { return INSTANCE_MAP.get(neo4jConfiguration); } else { Neo4jBoltClient instance = new Neo4jBoltClient(neo4jConfiguration); if( instance != null && instance.client != null ) { INSTANCE_MAP.put(neo4jConfiguration, instance); return instance; } else { return null; } } }
Source:
<code>public void testRemoveValueNoStoreEntryCacheAccessExceptionEqualCacheWriterEntry() throws Exception { final MockStore realStore = new MockStore(Collections.<String, String>emptyMap()); this.store = spy(realStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final MockCacheWriter realCache = new MockCacheWriter(Collections.singletonMap("key", "value")); this.cacheWriter = spy(realCache); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); <START> assertFalse(ehcache.remove("key", "value")); <END> verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); assertThat(realCache.getEntries().containsKey("key"), is(true)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }</code><technical_language>drop this assert, for reasons mentioned in similar tests</technical_language>

Target:
public void testRemoveValueNoStoreEntryCacheAccessExceptionEqualCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.singletonMap("key", "value")); this.cacheWriter = spy(fakeWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); ehcache.remove("key", "value"); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); assertThat(fakeWriter.getEntryMap().containsKey("key"), is(true)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }
Source:
<code>public String format(String projectName, String revision, ConfigSection globalCfg, InputStream raw) throws IOException { html.startDocument() .openHead() .closeHead() .openBody() .openTable() .appendCellHeader("name") .appendCellHeader("size") .appendCellHeader("last modified"); try (ZipInputStream zip = new ZipInputStream(raw)) { <START> ZipEntry entry; while ((entry = zip.getNextEntry()) != null) { <END> html.openRow() .appendCell(entry.getName()); if (!entry.isDirectory()) { if (entry.getSize() != -1) { html.appendCell(FileUtils.byteCountToDisplaySize(entry.getSize())); } else { html.appendCell("n/a"); } } else { html.appendCell(); } html.appendDateCell(entry.getTime()) .closeRow(); } } html.closeTable() .closeBody() .endDocument(); return util.applyCss(html.toString(), NAME, projectName); }</code><technical_language>"for" loop usage this reduced line. This is standard idiom here: for (ZipEntry entry; (entry = zip.getNextEntry()) != null;) { [...]</technical_language>

Target:
public String format(String projectName, String revision, ConfigSection globalCfg, InputStream raw) throws IOException { html.startDocument() .openHead() .closeHead() .openBody() .openTable() .appendCellHeader("name") .appendCellHeader("size") .appendCellHeader("last modified"); try (ZipInputStream zip = new ZipInputStream(raw)) { for (ZipEntry entry; (entry = zip.getNextEntry()) != null;) { html.openRow() .appendCell(entry.getName()); if (!entry.isDirectory()) { if (entry.getSize() != -1) { html.appendCell(FileUtils.byteCountToDisplaySize(entry.getSize())); } else { html.appendCell("n/a"); } } else { html.appendCell(); } html.appendDateCell(entry.getTime()) .closeRow(); } } html.closeTable() .closeBody() .endDocument(); return util.applyCss(html.toString(), NAME, projectName); }
Source:
<code><START> protected void refreshVisuals() { <END> Connector connector = (Connector) getNotationView(); NamedStyle namedStyle = connector.getNamedStyle(NotationPackage.Literals.INT_VALUE_STYLE, "delta"); if (namedStyle instanceof IntValueStyle) { int delta = ((IntValueStyle) namedStyle).getIntValue(); ((DurationLinkFigure) getFigure()).setArrowPositionDelta(delta); } super.refreshVisuals(); }</code><technical_language>This edit part (And for DurationObservation) needs install a Notation listener, in order react Named Style changes refresh Figure. Otherwise, undo-redo work properly (Moving arrow line -> arrow line is properly refreshed) (I'll send a code snippet separately for achieve this)</technical_language>

Target:
protected void refreshVisuals() { Connector connector = (Connector) getNotationView(); NamedStyle namedStyle = connector.getNamedStyle(NotationPackage.Literals.INT_VALUE_STYLE, "delta"); if (namedStyle instanceof IntValueStyle) { refreshArrowDelta((IntValueStyle) namedStyle); } super.refreshVisuals(); }
Source:
<code>public synchronized void clearCache(HelixConstants.ChangeType changeType) { switch (changeType) { case LIVE_INSTANCE: case INSTANCE_CONFIG: <START> LOG.warn("clearCache is deprecated for changeType: " + changeType); <END> break; case EXTERNAL_VIEW: _externalViewCache.clear(); break; default: break; } }</code><technical_language>nit: For new log, please do this ""clearCache is deprecated for changeType: {}", changeType". Minor performance improvement if config log level error</technical_language>

Target:
public synchronized void clearCache(HelixConstants.ChangeType changeType) { switch (changeType) { case LIVE_INSTANCE: case INSTANCE_CONFIG: LOG.warn("clearCache is deprecated for changeType: {}.", changeType); break; case EXTERNAL_VIEW: _externalViewCache.clear(); break; default: break; } }
Source:
<code>public static Geometry unifyWindingOrder(Geometry geometry, boolean counterClockWise) { if (geometry == null) { return null; } if (geometry instanceof MultiPolygon) { return unifyWindingOrderForMultiPolygon((MultiPolygon) geometry, counterClockWise); } else if (geometry instanceof Polygon) { return unifyWindingOrderForPolyGon((Polygon) geometry, counterClockWise); } else if (geometry instanceof LinearRing) { return unifyWindingOrderForLinearRing((LinearRing) geometry, counterClockWise); } else if (geometry instanceof GeometryCollection <START> && geometry.getClass() == GeometryCollection.class) { <END> return unifyWindingOrderForGeometryCollection((GeometryCollection) geometry, counterClockWise); } else return geometry; }</code><technical_language>If do class check omit instanceof check. I prefer if equals instead of ==, in OSGi class provided class loaders. this work in cases: GeometryCollection.class.equals(geometry.getClass())</technical_language>

Target:
public static Geometry unifyWindingOrder(Geometry geometry, boolean counterClockWise) { if (geometry == null) { return null; } if (geometry instanceof MultiPolygon) { return unifyWindingOrderForMultiPolygon((MultiPolygon) geometry, counterClockWise); } else if (geometry instanceof Polygon) { return unifyWindingOrderForPolyGon((Polygon) geometry, counterClockWise); } else if (geometry instanceof LinearRing) { return unifyWindingOrderForLinearRing((LinearRing) geometry, counterClockWise); } else if (GeometryCollection.class.equals(geometry.getClass())) { return unifyWindingOrderForGeometryCollection((GeometryCollection) geometry, counterClockWise); } else return geometry; }
Source:
<code>private void dumpLibraryProperties(@CheckForNull ZipOutputStream zos) { Properties libraryProperties = new Properties(); libraryProperties.put(KEY_LIB_EMITTER, "jill " + version); libraryProperties.put(KEY_LIB_MAJOR_VERSION, "0"); libraryProperties.put(KEY_LIB_MINOR_VERSION, "0"); libraryProperties.put(KEY_JAYCE, String.valueOf(true)); <START> libraryProperties.put(KEY_JAYCE_MAJOR_VERSION, "2"); libraryProperties.put(KEY_JAYCE_MINOR_VERSION, "14"); <END> if (zos != null) { dumpPropertiesToZip(zos, libraryProperties); } else { dumpPropertiesToFile(new File(options.getOutputDir(), LIBRARY_PROPERTIES), libraryProperties); } }</code><technical_language>constants for version numbers</technical_language>

Target:
private void dumpLibraryProperties(@CheckForNull ZipOutputStream zos) { Properties libraryProperties = new Properties(); libraryProperties.put(KEY_LIB_EMITTER, "jill " + version); libraryProperties.put(KEY_LIB_MAJOR_VERSION, LIB_MAJOR_VERSION); libraryProperties.put(KEY_LIB_MINOR_VERSION, LIB_MINOR_VERSION); libraryProperties.put(KEY_JAYCE, String.valueOf(true)); libraryProperties.put(KEY_JAYCE_MAJOR_VERSION, JAYCE_MAJOR_VERSION); libraryProperties.put(KEY_JAYCE_MINOR_VERSION, JAYCE_MINOR_VERSION); if (zos != null) { dumpPropertiesToZip(zos, libraryProperties); } else { dumpPropertiesToFile(new File(options.getOutputDir(), LIBRARY_PROPERTIES), libraryProperties); } }
Source:
<code><START> public SerializableProtobuf(T object, ProtobufCodec<T> codec) { <END> buf = new byte[codec.sizeof(object)]; codec.encode(object, buf); this.object = object; this.codec = codec; hash = object.hashCode(); }</code><technical_language>need public</technical_language>

Target:
SerializableProtobuf(T object, ProtobufCodec<T> codec) { this.object = object; this.codec = codec; this.hash = object.hashCode(); }
Source:
<code>public void initializeDefaultPreferences() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); store.setDefault(PreferenceConstants.P_STANDARD, ""); store.setDefault(PreferenceConstants.P_CLASSIFICATION, ""); store.setDefault(PreferenceConstants.P_APPLICATION_DOMAIN, ""); store.setDefault(PreferenceConstants.P_FUNCTION, ""); store.setDefault(PreferenceConstants.P_TYPE, ""); store.setDefault(PreferenceConstants.P_DESCRIPTION, ""); <START> store.setDefault(PreferenceConstants.P_VERSION, ""); END> store.setDefault(PreferenceConstants.P_ORGANIZATION, ""); store.setDefault(PreferenceConstants.P_AUTHOR, ""); store.setDefault(PreferenceConstants.P_DATE, ""); store.setDefault(PreferenceConstants.P_REMARKS, ""); }</code><technical_language>if this a preference</technical_language>

Target:
public void initializeDefaultPreferences() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); store.setDefault(PreferenceConstants.P_STANDARD, ""); store.setDefault(PreferenceConstants.P_CLASSIFICATION, ""); store.setDefault(PreferenceConstants.P_APPLICATION_DOMAIN, ""); store.setDefault(PreferenceConstants.P_FUNCTION, ""); store.setDefault(PreferenceConstants.P_TYPE, ""); store.setDefault(PreferenceConstants.P_DESCRIPTION, ""); store.setDefault(PreferenceConstants.P_VERSION, "1.0"); store.setDefault(PreferenceConstants.P_ORGANIZATION, ""); store.setDefault(PreferenceConstants.P_AUTHOR, System.getProperty("user.name")); store.setDefault(PreferenceConstants.P_REMARKS, ""); }
Source:
<code>public String toString() { StringBuffer sb = new StringBuffer(); String[] paths = getNativePaths(); for (int i = 0; i < paths.length; i++) { if (i > 0) { sb.append("; "); } sb.append(paths[i]); } String[] procs = getProcessors(); for (String proc : procs) { sb.append("; "); sb.append(Constants.BUNDLE_NATIVECODE_PROCESSOR); sb.append('='); sb.append(proc); } String[] oses = getOSNames(); for (String <START> ose : <END> oses) { sb.append("; "); sb.append(Constants.BUNDLE_NATIVECODE_OSNAME); sb.append('='); sb.append(ose); } VersionRange[] osRanges = getOSVersions(); for (VersionRange osRange : osRanges) { sb.append("; "); sb.append(Constants.BUNDLE_NATIVECODE_OSVERSION); sb.append("=\""); sb.append(osRange.toString()); sb.append('"'); } String[] langs = getLanguages(); for (String lang : langs) { sb.append("; "); sb.append(Constants.BUNDLE_NATIVECODE_LANGUAGE); sb.append('='); sb.append(lang); } Filter f = getFilter(); if (f != null) { sb.append("; "); sb.append(Constants.SELECTION_FILTER_ATTRIBUTE); sb.append("=\""); sb.append(f.toString()); sb.append('"'); } return (sb.toString()); }</code><technical_language>rename os</technical_language>

Target:
public String toString() { StringBuffer sb = new StringBuffer(); String[] paths = getNativePaths(); for (int i = 0; i < paths.length; i++) { if (i > 0) { sb.append("; "); } sb.append(paths[i]); } String[] procs = getProcessors(); for (String proc : procs) { sb.append("; "); sb.append(Constants.BUNDLE_NATIVECODE_PROCESSOR); sb.append('='); sb.append(proc); } String[] oses = getOSNames(); for (String os : oses) { sb.append("; "); sb.append(Constants.BUNDLE_NATIVECODE_OSNAME); sb.append('='); sb.append(os); } VersionRange[] osRanges = getOSVersions(); for (VersionRange osRange : osRanges) { sb.append("; "); sb.append(Constants.BUNDLE_NATIVECODE_OSVERSION); sb.append("=\""); sb.append(osRange.toString()); sb.append('"'); } String[] langs = getLanguages(); for (String lang : langs) { sb.append("; "); sb.append(Constants.BUNDLE_NATIVECODE_LANGUAGE); sb.append('='); sb.append(lang); } Filter f = getFilter(); if (f != null) { sb.append("; "); sb.append(Constants.SELECTION_FILTER_ATTRIBUTE); sb.append("=\""); sb.append(f.toString()); sb.append('"'); } return (sb.toString()); }
Source:
<code>private void pushJetpackProtectAndSsoSettings() { final Map<String, Object> params = serializeJetpackProtectAndSsoParams(); if (params.isEmpty()) { <START> return; <END> } WordPress.getRestClientUtilsV1_1().setJetpackSettings(mSite.getSiteId(), params, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { AppLog.d(AppLog.T.API, "Jetpack settings updated"); mRemoteJpSettings.monitorActive = mJpSettings.monitorActive; mRemoteJpSettings.jetpackProtectEnabled = mJpSettings.jetpackProtectEnabled; mRemoteJpSettings.jetpackProtectWhitelist.clear(); mRemoteJpSettings.jetpackProtectWhitelist.addAll(mJpSettings.jetpackProtectWhitelist); mRemoteJpSettings.ssoActive = mJpSettings.ssoActive; mRemoteJpSettings.ssoMatchEmail = mJpSettings.ssoMatchEmail; mRemoteJpSettings.ssoRequireTwoFactor = mJpSettings.ssoRequireTwoFactor; notifySavedOnUiThread(null); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error updating Jetpack settings: " + error); notifySavedOnUiThread(error); } }); }</code><technical_language>want add a log for HEs</technical_language>

Target:
private void pushJetpackProtectAndSsoSettings() { final Map<String, Object> params = serializeJetpackProtectAndSsoParams(); if (params.isEmpty()) { AppLog.v(AppLog.T.API, "No Jetpack settings changes detected. Skipping network POST call."); return; } final JetpackSettingsModel sentJpData = new JetpackSettingsModel(mJpSettings); WordPress.getRestClientUtilsV1_1().setJetpackSettings(mSite.getSiteId(), params, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { AppLog.d(AppLog.T.API, "Jetpack settings updated"); mRemoteJpSettings.monitorActive = sentJpData.monitorActive; mRemoteJpSettings.jetpackProtectEnabled = sentJpData.jetpackProtectEnabled; mRemoteJpSettings.jetpackProtectWhitelist.clear(); mRemoteJpSettings.jetpackProtectWhitelist.addAll(sentJpData.jetpackProtectWhitelist); mRemoteJpSettings.ssoActive = sentJpData.ssoActive; mRemoteJpSettings.ssoMatchEmail = sentJpData.ssoMatchEmail; mRemoteJpSettings.ssoRequireTwoFactor = sentJpData.ssoRequireTwoFactor; notifySavedOnUiThread(null); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error updating Jetpack settings: " + error); notifySavedOnUiThread(error); } }); }
Source:
<code>private String getFullArtifactName( DependencyNode node, boolean usePremanaged ) { Artifact artifact = node.getArtifact(); String version = node.getPremanagedVersion(); if ( !usePremanaged || version == null ) { version = uniqueVersions ? artifact.getVersion() : artifact.getBaseVersion(); } String result = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + version; if ( artifact.getScope() != null ) { result += " [" + artifact.getScope() + ']'; if ( "compile".equals( artifact.getScope() ) ) <START> { <END> result = MessageUtils.buffer().strong( result ).toString(); } } return result; }</code><technical_language>Based eclipse output want conflicts highlighted, entire tree. advice add a screenshot of result ensure working result</technical_language>

Target:
private String getFullArtifactName( DependencyNode node, boolean usePremanaged ) { Artifact artifact = node.getArtifact(); String version = node.getPremanagedVersion(); if ( !usePremanaged || version == null ) { version = uniqueVersions ? artifact.getVersion() : artifact.getBaseVersion(); } String result = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + version; if ( "compile".equals( artifact.getScope() ) ) { return MessageUtils.buffer().strong( result ).toString(); } if ( artifact.getScope() != null ) { return result + " [" + artifact.getScope() + ']'; } return result; }
Source:
<code>private static String getPersistenceXml() { return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<persistence xmlns=\"<LINK_3>\" xmlns:orm=\"<LINK_2>\" xmlns:xsi=\"<LINK_1>\" version=\"2.0\" xsi:schemaLocation=\"<LINK_3> <LINK_0> <LINK_2> <LINK_2>_2_0.xsd\">\n" + " <persistence-unit name=\"org.jbpm.test:test-module:1.0.0-SNAPSHOT\" transaction-type=\"JTA\">\n" + " <provider>org.hibernate.ejb.HibernatePersistence</provider>\n" + " <jta-data-source>java:jdbc/testDS1</jta-data-source>\n" + " <class>example.CaseDetail</class>\n" + " <class>org.drools.persistence.jpa.marshaller.MappedVariable</class>\n" + " <class>org.drools.persistence.jpa.marshaller.VariableEntity</class>\n" + " <exclude-unlisted-classes>true</exclude-unlisted-classes>\n" + " <properties>\n" + <START> " <property name=\"hibernate.dialect\" value=\"org.hibernate.dialect.PostgreSQLDialect\"/>\n" + <END> " <property name=\"hibernate.max_fetch_depth\" value=\"3\"/>\n" + " <property name=\"hibernate.hbm2ddl.auto\" value=\"update\"/>\n" + " <property name=\"hibernate.show_sql\" value=\"false\"/>\n" + " <property name=\"hibernate.id.new_generator_mappings\" value=\"false\"/>\n" + " <property name=\"hibernate.transaction.jta.platform\" value=\"org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform\"/>\n" + " </properties>\n" + " </persistence-unit>\n" + "</persistence>"; }</code><technical_language>@tsurdilo I question. is this persistence.xml in String in a seperate resource file, moreover, is mentioned run PostgreSQL</technical_language>

Target:
private static String getPersistenceXml() { File entityTestPersistence = new File("src/test/resources/entity/entity-test-persistence.xml"); assertTrue(entityTestPersistence.exists()); return IoUtils.readFileAsString(entityTestPersistence); }
Source:
<code>public void adsVelesWithBidderOfferEvent() { networkTrafficInterceptor.startIntercepting(); String url = TEST_PAGE_BIDDER.getUrl(); AdsVelesObject velesAds = new AdsVelesObject(driver, urlBuilder.appendQueryStringToURL(url, APPNEXUS_DEBUG_MODE)); <START> Assertion.assertTrue(velesAds.isVelesPlayerInIncontentSlotDisplayed()); <END> velesAds.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, AdsVelesObject.BIDDER_PLAYER_EVENT_PATTERN); }</code><technical_language>add some message this assertion? (and others)</technical_language>

Target:
public void adsVelesWithBidderOfferEvent() { networkTrafficInterceptor.startIntercepting(); String url = TEST_PAGE_BIDDER.getUrl(); AdsVelesObject velesAds = new AdsVelesObject(driver, urlBuilder.appendQueryStringToURL(url, APPNEXUS_DEBUG_MODE)); Assertion.assertTrue(velesAds.isVelesPlayerInIncontentSlotDisplayed(), ASSERTION_VELES_PLAYER_NOT_RENDERED); velesAds.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, AdsVelesObject.BIDDER_PLAYER_EVENT_PATTERN); }
Source:
<code>public Curve createCurve(PointArray points, boolean closed) throws MismatchedReferenceSystemException, MismatchedDimensionException { if (points == null) throw new NullPointerException("Points are required to create a curve"); List segmentList = new ArrayList (); for( int i = 0; i < points.size() - 1; i++){ int start = i; int end = i + 1; DirectPosition point1 = points.getDirectPosition( start, null ); DirectPosition point2 = points.getDirectPosition( end, null ); LineSegment segment = createLineSegment( point1, point2 ); segmentList.add( segment ); } if(closed) { LineSegment first = (LineSegment) segmentList.get(0); LineSegment last = (LineSegment) segmentList.get(segmentList.size() - 1); if(!first.getStartPoint().equals(last.getEndPoint())) { LineSegment segment = createLineSegment(last.getEndPoint(), first.getStartPoint()); <START> segmentList.add( segment ); <END> } } return getPrimitiveFactory().createCurve( segmentList ); }</code><technical_language>spaces brackets</technical_language>

Target:
public Curve createCurve(PointArray points, boolean closed) throws MismatchedReferenceSystemException, MismatchedDimensionException { if (points == null) throw new NullPointerException("Points are required to create a curve"); if (points.size() < 2) throw new IllegalArgumentException( "At least two points are required to create a curve"); List segmentList = new ArrayList (); for (int i = 0; i < points.size() - 1; i++) { int start = i; int end = i + 1; DirectPosition point1 = points.getDirectPosition(start, null); DirectPosition point2 = points.getDirectPosition(end, null); LineSegment segment = createLineSegment(point1, point2); segmentList.add(segment); } if (closed) { LineSegment first = (LineSegment) segmentList.get(0); LineSegment last = (LineSegment) segmentList.get(segmentList.size() - 1); if (!first.getStartPoint().equals(last.getEndPoint())) { LineSegment segment = createLineSegment(last.getEndPoint(), first.getStartPoint()); segmentList.add(segment); } } return getPrimitiveFactory().createCurve(segmentList); }
Source:
<code>public List<OrganizationType> getAllOrganizations(String exchangeName) throws ExchangeManagerException { refreshExchangeCacheIfRequired(); List<OrganizationType> orgList = new ArrayList<>(); String exName = StringUtils.isNotEmpty(exchangeName) ? exchangeName : getDefaultExchange(); Map<String, OrganizationType> orgMap = exCache.get(exName); if (null != orgMap) { for (Entry<String, OrganizationType> hcidKey : orgMap.entrySet()) { <START> OrganizationType org = orgMap.get(hcidKey.getKey()); <END> orgList.add(syncWithOverrides(org, hcidKey.getKey())); } } return orgList; }</code><technical_language>get this Entry instead. need traverse map again</technical_language>

Target:
public List<OrganizationType> getAllOrganizations(String exchangeName) throws ExchangeManagerException { refreshExchangeCacheIfRequired(); List<OrganizationType> orgList = new ArrayList<>(); String exName = StringUtils.isNotEmpty(exchangeName) ? exchangeName : getDefaultExchange(); Map<String, OrganizationType> orgMap = exCache.get(exName); if (null != orgMap) { for (Entry<String, OrganizationType> hcidKey : orgMap.entrySet()) { orgList.add(syncWithOverrides(hcidKey.getValue(), hcidKey.getKey())); } } return orgList; }
Source:
<code>public static void cleanup(@NonNull final String traceTypeId) { TmfWorkspaceModifyOperation operation = new TmfWorkspaceModifyOperation() { @Override public void execute(IProgressMonitor monitor) throws CoreException { for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { if (project.hasNature(TmfProjectNature.ID)) { TmfProjectElement projectElement = TmfProjectRegistry.getProject(project, true); final TmfTraceFolder tracesFolder = projectElement.getTracesFolder(); if (tracesFolder != null) { for (final TmfTraceElement trace : tracesFolder.getTraces()) { if (monitor.isCanceled()) { throw new OperationCanceledException(); } if (traceTypeId.equals(trace.getTraceType())) { <START> Display.getDefault().syncExec(() -> trace.closeEditors()); <END> trace.deleteSupplementaryResources(); trace.refreshSupplementaryFolder(); } } } } } TmfTableColumnUtils.clearColumnOrder(traceTypeId); TmfTableColumnUtils.clearColumnWidth(traceTypeId); TmfTableColumnUtils.clearColumnResizable(traceTypeId); } }; try { PlatformUI.getWorkbench().getProgressService().run(true, true, operation); } catch (InterruptedException e) { } catch (InvocationTargetException e) { TraceUtils.displayErrorMsg(e.toString(), e.getTargetException().toString()); } }</code><technical_language>method reference? asking</technical_language>

Target:
public static void cleanup(@NonNull final String traceTypeId) { TmfWorkspaceModifyOperation operation = new TmfWorkspaceModifyOperation() { @Override public void execute(IProgressMonitor monitor) throws CoreException { for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { if (project.hasNature(TmfProjectNature.ID)) { TmfProjectElement projectElement = TmfProjectRegistry.getProject(project, true); final TmfTraceFolder tracesFolder = projectElement.getTracesFolder(); if (tracesFolder != null) { for (final TmfTraceElement trace : tracesFolder.getTraces()) { if (monitor.isCanceled()) { throw new OperationCanceledException(); } if (traceTypeId.equals(trace.getTraceType())) { Display.getDefault().syncExec(trace::closeEditors); trace.deleteSupplementaryResources(); trace.refreshSupplementaryFolder(); } } } } } TmfTableColumnUtils.clearColumnOrder(traceTypeId); TmfTableColumnUtils.clearColumnWidth(traceTypeId); TmfTableColumnUtils.clearColumnResizable(traceTypeId); } }; try { PlatformUI.getWorkbench().getProgressService().run(true, true, operation); } catch (InterruptedException e) { } catch (InvocationTargetException e) { TraceUtils.displayErrorMsg(e.toString(), e.getTargetException().toString()); } }
Source:
<code>public int open() { <START> textChanged(newName); <END> text.selectAll(); return super.open(); }</code><technical_language>if new name is null, name put text i validate text newName/OldName</technical_language>

Target:
public int open() { textChanged(text.getText()); text.selectAll(); return super.open(); }
Source:
<code>public Iterator<E> find(EntityFilters filters, FieldMask fieldMask) { checkNotNull(filters); checkNotNull(fieldMask); final EntityQuery<I> entityQuery = EntityQueries.from(filters, getEntityClass()); final EntityQuery<I> completeQuery = toCompleteQuery(entityQuery); final Iterator<EntityRecord> records = recordStorage().readAll(completeQuery, fieldMask); <START> final Function<EntityRecord, E> transformer = entityConverter().reverse(); <END> final Iterator<E> result = transform(records, transformer); return result; }</code><technical_language>Pease rename variable transformer kind of transformation. Do suggest OptimusPrime :) transformation does</technical_language>

Target:
public Iterator<E> find(EntityFilters filters, FieldMask fieldMask) { checkNotNull(filters); checkNotNull(fieldMask); final EntityQuery<I> entityQuery = EntityQueries.from(filters, getEntityClass()); final EntityQuery<I> completeQuery = toCompleteQuery(entityQuery); final Iterator<EntityRecord> records = recordStorage().readAll(completeQuery, fieldMask); final Function<EntityRecord, E> toEntity = entityConverter().reverse(); final Iterator<E> result = transform(records, toEntity); return result; }
Source:
<code>public static void setupServer(boolean updateable, SecurityHandler sh) { dsgTesting = DatasetGraphFactory.createTxnMem(); server = FusekiEmbeddedServer.create() <START> .add(datasetPath(), dsgTesting) <END> .setPort(port()) .setSecurityHandler(sh) .build() .start(); }</code><technical_language>of test server instances in-memory datasets, is great for speed. places test server instances touch disk</technical_language>

Target:
public static void setupServer(boolean updateable, SecurityHandler sh) { setupServer(updateable, sh, DatasetGraphFactory.createTxnMem()); }
Source:
<code>private TaskConfigurer getDefaultConfigurer() { verifyEnvironment(); int configurers = this.context.getBeanNamesForType(TaskConfigurer.class).length; if (configurers < 1) { if(!CollectionUtils.isEmpty(this.dataSources) && this.dataSources.size() == 1) { return new DefaultTaskConfigurer( <START> this.dataSources.iterator().next(), <END> taskProperties.getTablePrefix()); } else { return new DefaultTaskConfigurer(null, taskProperties.getTablePrefix()); } } else { if(configurers == 1) { return this.context.getBean(TaskConfigurer.class); } else { throw new IllegalStateException("Expected one TaskConfigurer but found " + configurers); } } }</code><technical_language>TaskConfigurer</technical_language>

Target:
private TaskConfigurer getDefaultConfigurer() { verifyEnvironment(); int configurers = this.context.getBeanNamesForType(TaskConfigurer.class).length; if (configurers < 1) { TaskConfigurer taskConfigurer; if(!CollectionUtils.isEmpty(this.dataSources) && this.dataSources.size() == 1) { taskConfigurer = new DefaultTaskConfigurer( this.dataSources.iterator().next(), taskProperties.getTablePrefix()); } else { taskConfigurer = new DefaultTaskConfigurer( taskProperties.getTablePrefix()); } this.context.getBeanFactory().registerSingleton("taskConfigurer", taskConfigurer); return taskConfigurer; } else { if(configurers == 1) { return this.context.getBean(TaskConfigurer.class); } else { throw new IllegalStateException("Expected one TaskConfigurer but found " + configurers); } } }
Source:
<code>private void renderCommands() { commandTable.removeAllRows(); if (scheme.getItemCount() > 0) { FetchInfo fetchInfo = fetch.get(scheme.getValue(scheme.getSelectedIndex())); for (String commandName : Natives.keys(fetchInfo.commands())) { String command = fetchInfo.command(commandName); <START> if (command.contains("@*:")) { command = command.replace("@*:", "@" + Window.Location.getHostName() + ":"); } <END> CopyableLabel copyLabel = new CopyableLabel(command); copyLabel.setStyleName(style.clippy()); insertCommand(commandName, copyLabel); } } insertPatch(); insertCommand(null, scheme); }</code><technical_language>This happen client side</technical_language>

Target:
private void renderCommands() { commandTable.removeAllRows(); if (scheme.getItemCount() > 0) { FetchInfo fetchInfo = fetch.get(scheme.getValue(scheme.getSelectedIndex())); for (String commandName : Natives.keys(fetchInfo.commands())) { CopyableLabel copyLabel = new CopyableLabel(fetchInfo.command(commandName)); copyLabel.setStyleName(style.clippy()); insertCommand(commandName, copyLabel); } } insertPatch(); insertCommand(null, scheme); }
Source:
<code>public SpiderPanel(ExtensionSpider extension, SpiderParam spiderScanParam) { super("spider", new ImageIcon(SpiderPanel.class.getResource("/resource/icon/16/spider.png")), extension); tabbedPane = new JTabbedPane(); tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { switch(tabbedPane.getSelectedIndex()) { case 0: <START> getUrlsExportButton().setEnabled(true); <END> getUrlsExportButton().setVisible(true); getMessagesExportButton().setEnabled(false); getMessagesExportButton().setVisible(false); break; case 1: getUrlsExportButton().setEnabled(false); getUrlsExportButton().setVisible(false); getMessagesExportButton().setEnabled(true); getMessagesExportButton().setVisible(true); break; } } }); this.extension = extension; this.setDefaultAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | Event.SHIFT_MASK, false)); this.setMnemonic(Constant.messages.getChar("spider.panel.mnemonic")); }</code><technical_language>This button "re-enabled" Messages tab is hidden, otherwise, if Messages tab selected hide it, export button shown/enabled is Messages instead of URLs</technical_language>

Target:
public SpiderPanel(ExtensionSpider extension, SpiderParam spiderScanParam) { super("spider", new ImageIcon(SpiderPanel.class.getResource("/resource/icon/16/spider.png")), extension); tabbedPane = new JTabbedPane(); tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { switch(tabbedPane.getSelectedIndex()) { case 0: getExportButton().setTable(getUrlsTable()); break; case 1: getExportButton().setTable(getMessagesTable()); break; } } }); this.extension = extension; this.setDefaultAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | Event.SHIFT_MASK, false)); this.setMnemonic(Constant.messages.getChar("spider.panel.mnemonic")); }
Source:
<code>public void planCanPointToPublishedSurvey() { GuidCreatedOnVersionHolder surveyKeys = null; GuidVersionHolder keys = null; try { Survey survey = TestSurvey.getSurvey(SchedulePlanTest.class); surveyKeys = developerClient.createSurvey(survey); SchedulePlan plan = Tests.getSimpleSchedulePlan(); SimpleScheduleStrategy strategy = (SimpleScheduleStrategy) plan.getStrategy(); Activity activity = new Activity("Test", null, new SurveyReference(surveyKeys.getGuid(), surveyKeys.getCreatedOn())); assertEquals(ActivityType.SURVEY, activity.getActivityType()); strategy.getSchedule().getActivities().clear(); strategy.getSchedule().getActivities().add(activity); keys = developerClient.createSchedulePlan(plan); SchedulePlan newPlan = developerClient.getSchedulePlan(keys.getGuid()); plan.setGuid(newPlan.getGuid()); plan.setModifiedOn(newPlan.getModifiedOn()); Tests.getActivitiesFromSimpleStrategy(plan).set(0, Tests.getActivityFromSimpleStrategy(newPlan)); assertEquals(plan, newPlan); } catch(Exception e) { <START> e.printStackTrace(); <END> } finally { developerClient.deleteSchedulePlan(keys.getGuid()); admin.getSession().getAdminClient().deleteSurveyPermanently(surveyKeys); } }</code><technical_language>Remove this. This suppresses test failures</technical_language>

Target:
public void planCanPointToPublishedSurvey() { GuidCreatedOnVersionHolder surveyKeys = null; GuidVersionHolder keys = null; try { Survey survey = TestSurvey.getSurvey(SchedulePlanTest.class); surveyKeys = developerClient.createSurvey(survey); SchedulePlan plan = Tests.getSimpleSchedulePlan(); SimpleScheduleStrategy strategy = (SimpleScheduleStrategy) plan.getStrategy(); Activity activity = new Activity("Test", null, new SurveyReference(surveyKeys.getGuid(), surveyKeys.getCreatedOn())); assertEquals(ActivityType.SURVEY, activity.getActivityType()); strategy.getSchedule().getActivities().clear(); strategy.getSchedule().getActivities().add(activity); keys = developerClient.createSchedulePlan(plan); SchedulePlan newPlan = developerClient.getSchedulePlan(keys.getGuid()); plan.setGuid(newPlan.getGuid()); plan.setModifiedOn(newPlan.getModifiedOn()); Tests.getActivitiesFromSimpleStrategy(plan).set(0, Tests.getActivityFromSimpleStrategy(newPlan)); assertEquals(plan, newPlan); } finally { developerClient.deleteSchedulePlan(keys.getGuid()); admin.getSession().getAdminClient().deleteSurveyPermanently(surveyKeys); } }