auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public QueueAsyncClient buildAsyncClient() { Objects.requireNonNull(queueName, "'queueName' cannot be null."); QueueServiceVersion serviceVersion = version != null ? version : QueueServiceVersion.getLatest(); HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline(() -> { if (storageSharedKeyCredential != null) { return new StorageSharedKeyCredentialPolicy(storageSharedKeyCredential); } else if (tokenCredential != null) { return new BearerTokenAuthenticationPolicy(tokenCredential, String.format("%s/.default", endpoint)); } else if (sasTokenCredential != null) { return new SasTokenCredentialPolicy(sasTokenCredential); } else { return null; } }, retryOptions, logOptions, httpClient, additionalPolicies, configuration, serviceVersion); AzureQueueStorageImpl azureQueueStorage = new AzureQueueStorageBuilder() .url(endpoint) .pipeline(pipeline) .version(serviceVersion.getVersion()) .build(); return new QueueAsyncClient(azureQueueStorage, queueName, accountName, serviceVersion); }

Target:
public QueueAsyncClient buildAsyncClient() { Utility.assertNotNull("queueName", queueName); QueueServiceVersion serviceVersion = version != null ? version : QueueServiceVersion.getLatest(); HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline(() -> { if (storageSharedKeyCredential != null) { return new StorageSharedKeyCredentialPolicy(storageSharedKeyCredential); } else if (tokenCredential != null) { return new BearerTokenAuthenticationPolicy(tokenCredential, String.format("%s/.default", endpoint)); } else if (sasTokenCredential != null) { return new SasTokenCredentialPolicy(sasTokenCredential); } else { return null; } }, retryOptions, logOptions, httpClient, additionalPolicies, configuration, serviceVersion); AzureQueueStorageImpl azureQueueStorage = new AzureQueueStorageBuilder() .url(endpoint) .pipeline(pipeline) .version(serviceVersion.getVersion()) .build(); return new QueueAsyncClient(azureQueueStorage, queueName, accountName, serviceVersion); }
Source:
private int[] calculatePartitions(int[] explicitParts, PartitionResult derivedParts, Object[] args) { if (!F.isEmpty(explicitParts)) return explicitParts; else if (derivedParts != null) { try { Collection<Integer> realParts = derivedParts.tree().apply(args); if (F.isEmpty(realParts)) return new int[0]; else { int[] realParts0 = new int[realParts.size()]; int i = 0; for (Integer realPart : realParts) realParts0[i++] = realPart; return realParts0; } } catch (IgniteCheckedException e) { throw new CacheException("Failed to calculate derived partitions for query.", e); } } return null; }

Target:
private int[] calculatePartitions(int[] explicitParts, PartitionResult derivedParts, Object[] args) { if (!F.isEmpty(explicitParts)) return explicitParts; else if (derivedParts != null) { try { Collection<Integer> realParts = derivedParts.tree().apply(args); if (F.isEmpty(realParts)) return IgniteUtils.EMPTY_INTS; else { int[] realParts0 = new int[realParts.size()]; int i = 0; for (Integer realPart : realParts) realParts0[i++] = realPart; return realParts0; } } catch (IgniteCheckedException e) { throw new CacheException("Failed to calculate derived partitions for query.", e); } } return null; }
Source:
public static HostInfo fromBytes(byte[] bytes) throws JSONException { final JSONObject obj = new JSONObject(new String(bytes, StandardCharsets.UTF_8)); return new HostInfo(obj.getString(HOST_IP), obj.getString(GROUP), (int)obj.getLong(LOCAL_SITES_COUNT)); }

Target:
public static HostInfo fromBytes(byte[] bytes) throws JSONException { final JSONObject obj = new JSONObject(new String(bytes, StandardCharsets.UTF_8)); return new HostInfo(obj.getString(HOST_IP), obj.getString(GROUP), obj.getInt(LOCAL_SITES_COUNT)); }
Source:
public CharSequence getPageTitle(int position) { switch (position) { case 0: return "ALL"; case 1: return "FINAL EXAM"; case 2: return "L&S"; default: return "ALL"; } }

Target:
public CharSequence getPageTitle(int position) { switch (position) { case 0: return CalendarTypes.ALL; case 1: return CalendarTypes.FINAL_EXAM; case 2: return CalendarTypes.LS; default: return CalendarTypes.ALL; } }
Source:
public byte[] toBytes(JobId jobId) { String prefix = jobId.getJobPrefix(); if ((StringUtils.isNotBlank(prefix) && (JobId.JOB_PREFIX.equalsIgnoreCase(prefix))) || (StringUtils.isBlank(prefix))) { return Bytes.add(Bytes.toBytes(jobId.getJobEpoch()), Bytes.toBytes(jobId.getJobSequence())); } else { return Bytes.add(Bytes.toBytes(jobId.getJobPrefix()), Bytes.toBytes(jobId.getJobEpoch()), Bytes.toBytes(jobId.getJobSequence())); } }

Target:
public byte[] toBytes(JobId jobId) { String prefix = jobId.getJobPrefix(); if (StringUtils.isBlank(prefix)) { return Bytes.add(Bytes.toBytes(jobId.getJobEpoch()), Bytes.toBytes(jobId.getJobSequence())); } else { return Bytes.add(Bytes.toBytes(jobId.getJobPrefix()), Bytes.toBytes(jobId.getJobEpoch()), Bytes.toBytes(jobId.getJobSequence())); } }
Source:
private void mergeExternalStreamStatesToZK(JSONObject jsonObj, VoltLogger log) throws JSONException { JSONObject jsonStates; if (jsonObj.has(EXTERNAL_STREAMS_STATES)) { jsonStates = jsonObj.getJSONObject(EXTERNAL_STREAMS_STATES); } else { jsonStates = new JSONObject(); jsonObj.put(EXTERNAL_STREAMS_STATES, jsonStates); } for (Map.Entry<Integer, Boolean> tableEntry : m_partitionExternalStreamsEnabled.entrySet()) { final String partitionStr = tableEntry.getKey().toString(); if (!jsonStates.has(partitionStr)) { jsonStates.put(partitionStr, tableEntry.getValue()); } else { boolean existing = jsonStates.getBoolean(partitionStr); if (log.isDebugEnabled() && existing != tableEntry.getValue()) { log.debug("Found different external stream states on different hosts for partition " + partitionStr + ". This host has " + tableEntry.getValue()); } jsonStates.put(partitionStr, tableEntry.getValue() & existing); } } }

Target:
private void mergeExternalStreamStatesToZK(JSONObject jsonObj, VoltLogger log) throws JSONException { JSONArray jsonPartitions; Set<Integer> disabledStreamsInJson = new HashSet<>(); if (jsonObj.has(DISABLED_EXTERNAL_STREAMS)) { jsonPartitions = jsonObj.getJSONArray(DISABLED_EXTERNAL_STREAMS); for (int i=0; i<jsonPartitions.length(); i++) { disabledStreamsInJson.add(jsonPartitions.getInt(i)); } } else { jsonPartitions = new JSONArray(); jsonObj.put(DISABLED_EXTERNAL_STREAMS, jsonPartitions); } for (Integer partition : m_disabledExternalStreams) { if (!disabledStreamsInJson.contains(partition)) { jsonPartitions.put(partition); } } }
Source:
public ScaledNumberIndexFieldTypeContext<?, BigDecimal> asBigDecimal() { return new StubScaledNumberIndexFieldTypeContext( BigDecimal.class, defaultsProvider ); }

Target:
public ScaledNumberIndexFieldTypeContext<?, BigDecimal> asBigDecimal() { return new StubScaledNumberIndexFieldTypeContext<>( BigDecimal.class, defaultsProvider ); }
Source:
private AsyncTaskManager() { _tasks = new ConcurrentHashMap<Guid, SPMAsyncTask>(); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAFixedDelayJob(this, "_timer_Elapsed", new Class[] {}, new Object[] {}, Config.<Integer> GetValue(ConfigValues.AsyncTaskPollingRate), Config.<Integer> GetValue(ConfigValues.AsyncTaskPollingRate), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(this, "_cacheTimer_Elapsed", new Class[] {}, new Object[] {}, Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), TimeUnit.SECONDS); _cacheTimeInMinutes = Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCachingTimeInMinutes); tasksInDbAfterRestart = new ConcurrentHashMap<Guid, List<AsyncTasks>>(); for (AsyncTasks task: DbFacade.getInstance().getAsyncTaskDao().getAll()) { if (NGuid.Empty.equals(task.getVdsmTaskId())) { log.infoFormat("Failing task {0} as it does not have a vdsm id.", task.getTaskId()); failTaskWithoutVdsmId(task); continue; } tasksInDbAfterRestart.putIfAbsent(task.getStoragePoolId(), new ArrayList<AsyncTasks>()); List<AsyncTasks> tasksPerStoragePool = tasksInDbAfterRestart.get(task.getStoragePoolId()); tasksInDbAfterRestart.put(task.getStoragePoolId(), tasksPerStoragePool); tasksPerStoragePool.add(task); } }

Target:
private AsyncTaskManager() { _tasks = new ConcurrentHashMap<Guid, SPMAsyncTask>(); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAFixedDelayJob(this, "_timer_Elapsed", new Class[] {}, new Object[] {}, Config.<Integer> GetValue(ConfigValues.AsyncTaskPollingRate), Config.<Integer> GetValue(ConfigValues.AsyncTaskPollingRate), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(this, "_cacheTimer_Elapsed", new Class[] {}, new Object[] {}, Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), TimeUnit.SECONDS); _cacheTimeInMinutes = Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCachingTimeInMinutes); tasksInDbAfterRestart = new ConcurrentHashMap<Guid, List<AsyncTasks>>(); for (AsyncTasks task: DbFacade.getInstance().getAsyncTaskDao().getAll()) { if (Guid.isNullOrEmpty(task.getVdsmTaskId())) { log.infoFormat("Failing task {0} as it does not have a vdsm id.", task.getTaskId()); failTaskWithoutVdsmId(task); continue; } tasksInDbAfterRestart.putIfAbsent(task.getStoragePoolId(), new ArrayList<AsyncTasks>()); List<AsyncTasks> tasksPerStoragePool = tasksInDbAfterRestart.get(task.getStoragePoolId()); tasksInDbAfterRestart.put(task.getStoragePoolId(), tasksPerStoragePool); tasksPerStoragePool.add(task); } }
Source:
public RetryHandler(ForkliftConnectorI connector, File dir) { this.dir = dir; this.connector = connector; this.mapper = new ObjectMapper().registerModule(new JavaTimeModule()) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); this.executor = Executors.newScheduledThreadPool(1); cleanup = new Callback<RetryMessage>() { @Override public void handle(RetryMessage msg) { log.info("Cleaning up persistent file {}", msg.getPersistedPath()); final File f = new File(msg.getPersistedPath()); if (f.exists()) f.delete(); } }; new FileScanner(dir).scan().stream() .filter(result -> result.getFilename().startsWith("retry") && result.getFilename().endsWith(".msg")) .forEach(result -> { try { final RetryMessage retryMessage = mapper.readValue(new File(dir, result.getFilename()), RetryMessage.class); executor.schedule(new RetryRunnable(retryMessage, connector, cleanup), Long.parseLong(Integer.toString((int)retryMessage.getProperties().get("forklift-retry-timeout"))), TimeUnit.SECONDS); } catch (Exception e) { log.error("Unable to read file {}", result.getFilename()); } }); }

Target:
public RetryHandler(ForkliftConnectorI connector, File dir) { this.dir = dir; this.connector = connector; this.mapper = new ObjectMapper().registerModule(new JavaTimeModule()) .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); this.executor = Executors.newScheduledThreadPool(1); cleanup = new Callback<RetryMessage>() { @Override public void handle(RetryMessage msg) { log.info("Cleaning up persistent file {}", msg.getPersistedPath()); final File f = new File(msg.getPersistedPath()); if (f.exists()) f.delete(); } }; new FileScanner(dir).scan().stream() .filter(result -> result.getFilename().startsWith("retry") && result.getFilename().endsWith(".msg")) .forEach(result -> { try { final RetryMessage retryMessage = mapper.readValue(new File(dir, result.getFilename()), RetryMessage.class); executor.schedule(new RetryRunnable(retryMessage, connector, cleanup), Long.parseLong(Integer.toString((int)retryMessage.getProperties().get("forklift-retry-timeout"))), TimeUnit.SECONDS); } catch (Exception e) { log.error("Unable to read file {}", result.getFilename()); } }); }
Source:
public void testStaticMapping() throws IOException, InvalidRoutingDataException { String newRealm = "newRealm"; _testRawRoutingData.put(newRealm, ImmutableSet.of("/newKey")); _msdsServer.stopServer(); _msdsServer = new MockMetadataStoreDirectoryServer(_host, _port, _namespace, _testRawRoutingData); _msdsServer.startServer(); Map<String, List<String>> rawRoutingData = HttpRoutingDataReader.getRawRoutingData(); Assert.assertFalse(rawRoutingData.containsKey(newRealm)); MetadataStoreRoutingData data = HttpRoutingDataReader.getMetadataStoreRoutingData(); Map<String, String> allMappings = data.getAllMappingUnderPath("/"); Map<String, Set<String>> groupedMappings = allMappings.entrySet().stream().collect(Collectors .groupingBy(Map.Entry::getValue, Collectors.mapping(Map.Entry::getKey, Collectors.toSet()))); Assert.assertFalse(groupedMappings.containsKey(newRealm)); }

Target:
public void testStaticMapping() throws IOException, InvalidRoutingDataException { String newRealm = "newRealm"; _testRawRoutingData.put(newRealm, ImmutableSet.of("/newKey")); _msdsServer.stopServer(); _msdsServer = new MockMetadataStoreDirectoryServer(_host, _port, _namespace, _testRawRoutingData); _msdsServer.startServer(); Map<String, List<String>> rawRoutingData = HttpRoutingDataReader.getRawRoutingData(); Assert.assertFalse(rawRoutingData.containsKey(newRealm)); _testRawRoutingData.remove(newRealm); Assert.assertEquals(rawRoutingData.keySet(), _testRawRoutingData.keySet()); _testRawRoutingData.forEach((realm, keys) -> Assert .assertEquals(new HashSet(rawRoutingData.get(realm)), new HashSet(keys))); MetadataStoreRoutingData data = HttpRoutingDataReader.getMetadataStoreRoutingData(); Map<String, String> allMappings = data.getAllMappingUnderPath("/"); Map<String, Set<String>> groupedMappings = allMappings.entrySet().stream().collect(Collectors .groupingBy(Map.Entry::getValue, Collectors.mapping(Map.Entry::getKey, Collectors.toSet()))); Assert.assertFalse(groupedMappings.containsKey(newRealm)); }
Source:
private String getDefaultAlbumList() { try { return new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("fallback-album-list.json").toURI()))); } catch (Exception e) { e.printStackTrace(); } return null; }

Target:
private String getDefaultAlbumList() { try { return new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("fallback-album-list.json").toURI()))); } catch (Exception e) { LOGGER.error("error occurred while reading the file", e); } return null; }
Source:
public static boolean eventsMatch(final Event e1, final Event e2) { if (e1 == e2) { return true; } if (e1 == null || e2 == null) { return false; } if (e1.getUei() != e2.getUei() && (e1.getUei() == null || e2.getUei() == null || !e1.getUei().equals(e2.getUei()))) { return false; } if (!e1.getNodeid().equals(e2.getNodeid())) { return false; } if (e1.getInterface() != e2.getInterface() && (e1.getInterface() == null || e2.getInterface() == null || !e1.getInterface().equals(e2.getInterface()))) { return false; } if (e1.getService() != e2.getService() && (e1.getService() == null || e2.getService() == null || !e1.getService().equals(e2.getService()))) { return false; } return true; }

Target:
public static boolean eventsMatch(final Event e1, final Event e2) { if (e1 == e2) { return true; } if (e1 == null || e2 == null) { return false; } if (e1.getUei() != e2.getUei() && (e1.getUei() == null || e2.getUei() == null || !e1.getUei().equals(e2.getUei()))) { return false; } if ((long)e1.getNodeid() != (long)e2.getNodeid()) { return false; } if (e1.getInterface() != e2.getInterface() && (e1.getInterface() == null || e2.getInterface() == null || !e1.getInterface().equals(e2.getInterface()))) { return false; } if (e1.getService() != e2.getService() && (e1.getService() == null || e2.getService() == null || !e1.getService().equals(e2.getService()))) { return false; } return true; }
Source:
public JsonArray getTsnePlotMetaData(String experimentAccession) { JsonObject result = new JsonObject(); result.add("metadata", getMetadata(experimentAccession)); return result.getAsJsonArray("metadata"); }

Target:
public JsonArray getTsnePlotMetaData(String experimentAccession) { return getMetadata(experimentAccession); }
Source:
void validateSuccess() { setupHosts(true, true); setupNics(true, false); ValidateTestUtils.runAndAssertValidateSuccess(command); }

Target:
void validateSuccess() { setupHosts(HostValid.VALID, HostValid.VALID); setupNics(VdsInterfaceType.MANAGEMENT, VdsInterfaceType.NONE); ValidateTestUtils.runAndAssertValidateSuccess(command); }
Source:
static <T> int lastIndexOfSlice(IndexedSeq<T> t, IndexedSeq<T> slice, int end) { if (end < 0) { return -1; } if (t.isEmpty()) { return slice.isEmpty() ? 0 : -1; } if (slice.isEmpty()) { int len = t.length(); return len < end ? len : end; } int p = 0; int result = -1; while (t.length() >= p + slice.length()) { int r = findSlice(t, p, slice); if (r < 0) { return result; } if (r <= end) { result = r; p = r + 1; } else { return result; } } return result; }

Target:
static <T> int lastIndexOfSlice(IndexedSeq<T> t, IndexedSeq<T> slice, int end) { if (end < 0) { return -1; } if (t.isEmpty()) { return slice.isEmpty() ? 0 : -1; } if (slice.isEmpty()) { int len = t.length(); return len < end ? len : end; } int p = 0; int result = -1; final int maxPtr = t.length() - slice.length(); while (p <= maxPtr) { int r = findSlice(t, p, maxPtr, slice); if (r < 0) { return result; } if (r <= end) { result = r; p = r + 1; } else { return result; } } return result; }
Source:
public KijiCell<T> next() { KeyValue kv = mKVs.next(); mNumVersions += 1; KijiCell<T> cell = null; try { cell = new KijiCell<T>(mFamily, mQualifier, kv.getTimestamp(), mDecoder.decodeCell(kv.getValue())); } catch (IOException ex) { throw new RuntimeException(ex.getMessage()); } return cell; }

Target:
public KijiCell<T> next() { KeyValue kv = mKVs.next(); mNumVersions += 1; try { return new KijiCell<T>(mFamily, mQualifier, kv.getTimestamp(), mDecoder.decodeCell(kv.getValue())); } catch (IOException ex) { throw new KijiIOException(ex); } }
Source:
void onNext(ClickEvent event) { GQuery.console.info("next"); next(); }

Target:
void onNext(ClickEvent event) { next(); }
Source:
public void testAuthorDeleteRelationshipCopyToRightItem() throws Exception { initPublicationAuthor(); getClient(adminAuthToken).perform( delete("/api/core/relationships/" + relationship.getID() + "?copyVirtualMetadata=right")) .andExpect(status().isNoContent()); leftItem = itemService.find(context, leftItem.getID()); List<MetadataValue> authorList = itemService.getMetadata(leftItem, "dc", "contributor", "author", Item.ANY); assertThat(authorList.size(), equalTo(0)); List<MetadataValue> relationshipMetadataList = itemService .getMetadata(leftItem, "relation", "isAuthorOfPublication", null, Item.ANY); assertThat(relationshipMetadataList.size(), equalTo(0)); }

Target:
public void testAuthorDeleteRelationshipCopyToRightItem() throws Exception { initPublicationAuthor(); getClient(adminAuthToken).perform( delete("/api/core/relationships/" + relationship.getID() + "?copyVirtualMetadata=right")) .andExpect(status().isNoContent()); leftItem = itemService.find(context, leftItem.getID()); List<MetadataValue> authorList = itemService.getMetadata(leftItem, "dc", "contributor", "author", Item.ANY); assertThat(authorList.size(), equalTo(0)); List<MetadataValue> relationshipMetadataList = itemService .getMetadata(leftItem, "relation", "isAuthorOfPublication", null, Item.ANY); assertThat(relationshipMetadataList.size(), equalTo(0)); relationshipMetadataList = itemService .getMetadata(rightItem, "relation", "isPublicationOfAuthor", null, Item.ANY); assertThat(relationshipMetadataList.size(), equalTo(0)); }
Source:
public int getItemViewType(int position) { Object currentObject = notifications.get(position); if(currentObject instanceof Notification) { return VIEW_TYPE_NOTIFICAITON; } return 0; }

Target:
public int getItemViewType(int position) { return VIEW_TYPE_NOTIFICAITON; }
Source:
public WorkspaceCache createExternalWorkspace(String name, Connectors connectors) { this.workspaceNames.add(name); refreshRepositoryMetadata(true); Cache<NodeKey, CachedNode> nodeCache = cacheForWorkspace(name); ExecutionContext context = context(); String sourceKey = NodeKey.keyForSourceName(name); String workspaceKey = NodeKey.keyForWorkspaceName(name); ExternalDocumentStore documentStore = new ExternalDocumentStore(connectors); String rootId = documentStore.getRootId(sourceKey); NodeKey rootKey = new NodeKey(sourceKey, workspaceKey, rootId); WorkspaceCache workspaceCache = new WorkspaceCache(context, getKey(), name, documentStore, translator, rootKey, nodeCache, changeBus); workspaceCachesByName.put(name, workspaceCache); return workspace(name); }

Target:
public WorkspaceCache createExternalWorkspace(String name, Connectors connectors) throws RepositoryException { if (this.workspaceNames.contains(name)) { throw new RepositoryException(JcrI18n.connectorSourceNameInvalid.text(name)); } Cache<NodeKey, CachedNode> nodeCache = cacheForWorkspace(name); ExecutionContext context = context(); String sourceKey = NodeKey.keyForSourceName(name); String workspaceKey = NodeKey.keyForWorkspaceName(name); ExternalDocumentStore documentStore = new ExternalDocumentStore(connectors); String rootId = documentStore.getRootId(sourceKey); if (rootId == null) { throw new RepositoryException(JcrI18n.connectorDoesNotExposeRoot.text(name)); } NodeKey rootKey = new NodeKey(sourceKey, workspaceKey, rootId); WorkspaceCache workspaceCache = new WorkspaceCache(context, getKey(), name, documentStore, translator, rootKey, nodeCache, changeBus); externalWorkspaces.put(name, workspaceCache); return workspaceCache; }
Source:
public void shouldEditAnIdentifierPoolSource() throws Exception { String name = "{\"name\":\"Updated Identifier Pool Description\"}"; assertEquals("Test Identifier Pool", service.getIdentifierSourceByUuid(POOL_SOURCE_UUID).getName()); handle(newPostRequest(getURI() + "/" + getUuid(), name)); assertEquals("Updated Identifier Pool Description", service.getIdentifierSourceByUuid(getUuid()).getName()); }

Target:
public void shouldEditAnIdentifierPoolSource() throws Exception { String name = "{\"name\":\"Updated Identifier Pool Name\"}"; assertEquals("Test Identifier Pool", service.getIdentifierSourceByUuid(POOL_SOURCE_UUID).getName()); handle(newPostRequest(getURI() + "/" + getUuid(), name)); assertEquals("Updated Identifier Pool Name", service.getIdentifierSourceByUuid(getUuid()).getName()); }
Source:
public Object deserialize(ByteBuf b, CorfuRuntime rt) { int classNameLength = b.readShort(); byte[] classNameBytes = new byte[classNameLength]; b.readBytes(classNameBytes, 0, classNameLength); String className = new String(classNameBytes); if (className.equals("null")) { return null; } else if (className.equals("CorfuObject")) { int smrClassNameLength = b.readShort(); byte[] smrClassNameBytes = new byte[smrClassNameLength]; b.readBytes(smrClassNameBytes, 0, smrClassNameLength); String smrClassName = new String(smrClassNameBytes); try { return rt.getObjectsView().build() .setStreamID(new UUID(b.readLong(), b.readLong())) .setType((Class<? extends ISMRObject>) Class.forName(smrClassName)) .open(); } catch (ClassNotFoundException cnfe) { log.error("Exception during deserialization!", cnfe); throw new RuntimeException(cnfe); } } else { try (ByteBufInputStream bbis = new ByteBufInputStream(b)) { try (InputStreamReader r = new InputStreamReader(bbis)) { return gson.fromJson(r, Class.forName(className)); } } catch (IOException | ClassNotFoundException ie) { log.error("Exception during deserialization!", ie); throw new RuntimeException(ie); } } }

Target:
public Object deserialize(ByteBuf b, CorfuRuntime rt) { int classNameLength = b.readShort(); byte[] classNameBytes = new byte[classNameLength]; b.readBytes(classNameBytes, 0, classNameLength); String className = new String(classNameBytes); if (className.equals("null")) { return null; } else if (className.equals("CorfuObject")) { int smrClassNameLength = b.readShort(); byte[] smrClassNameBytes = new byte[smrClassNameLength]; b.readBytes(smrClassNameBytes, 0, smrClassNameLength); String smrClassName = new String(smrClassNameBytes); try { return rt.getObjectsView().build() .setStreamID(new UUID(b.readLong(), b.readLong())) .setType((Class<? extends ICorfuSMR>) Class.forName(smrClassName)) .open(); } catch (ClassNotFoundException cnfe) { log.error("Exception during deserialization!", cnfe); throw new RuntimeException(cnfe); } } else { try (ByteBufInputStream bbis = new ByteBufInputStream(b)) { try (InputStreamReader r = new InputStreamReader(bbis)) { return gson.fromJson(r, Class.forName(className)); } } catch (IOException | ClassNotFoundException ie) { log.error("Exception during deserialization!", ie); throw new RuntimeException(ie); } } }
Source:
void doInitialize() { try { loadEverything(); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
void doInitialize() { try { loadEverything(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
Source:
private static boolean validateValue(final MeasurementVariable var, final String value, final BindingResult errors) { if (StringUtils.isBlank(value) || MISSING_VALUE.equals(value)) { return true; } if (isInvalidNumber(var, value)) { errors.reject("warning.import.save.invalid.cell.numeric.value", new String[] {var.getAlias(), value}, ""); return false; } else if (isInvalidDate(var, value)) { errors.reject("warning.import.save.invalid.cell.date.value", new String[] {var.getAlias(), value}, ""); return false; } return true; }

Target:
private static boolean validateValue(final MeasurementVariable var, final String value, final BindingResult errors) { if (StringUtils.isBlank(value)) { return true; } if (isInvalidNumber(var, value)) { errors.reject("warning.import.save.invalid.cell.numeric.value", new String[] {var.getAlias(), value}, ""); return false; } else if (isInvalidDate(var, value)) { errors.reject("warning.import.save.invalid.cell.date.value", new String[] {var.getAlias(), value}, ""); return false; } return true; }
Source:
static boolean isValidNlMsg(@NonNull ByteBuffer bytes) { return bytes.position() < bytes.limit() && bytes.remaining() >= StructNlMsgHdr.STRUCT_SIZE; }

Target:
static boolean isValidNlMsg(@NonNull ByteBuffer bytes) { return bytes.remaining() >= StructNlMsgHdr.STRUCT_SIZE; }
Source:
private void reload(final Repository repository) { final boolean repositoryChanged = currentRepository != repository; final AtomicReference<IndexDiff> results = new AtomicReference<IndexDiff>(); final String jobTitle = MessageFormat.format(UIText.StagingView_IndexDiffReload, StagingView.getRepositoryName(repository)); if (reloadJob != null) reloadJob.cancel(); reloadJob = new Job(jobTitle) { @Override protected IStatus run(IProgressMonitor monitor) { IndexDiff indexDiff = doReload(repository, monitor, jobTitle); results.set(indexDiff); if (monitor.isCanceled()) return Status.CANCEL_STATUS; return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { if (family.equals(JobFamilies.STAGING_VIEW_REFRESH)) return true; return super.belongsTo(family); } }; reloadJob.setUser(false); reloadJob.setRule(ResourcesPlugin.getWorkspace().getRoot()); reloadJob.addJobChangeListener(new JobChangeAdapter() { public void done(final IJobChangeEvent event) { asyncExec(new Runnable() { public void run() { if (form.isDisposed()) return; if (!event.getResult().isOK()) { return; } final IndexDiff indexDiff = results.get(); final StagingViewUpdate update = new StagingViewUpdate(currentRepository, indexDiff, null); unstagedTableViewer.setInput(update); stagedTableViewer.setInput(update); enableCommitWidgets(true); commitAction.setEnabled(repository.getRepositoryState() .canCommit()); form.setText(StagingView.getRepositoryName(repository)); updateCommitMessageComponent(repositoryChanged); updateSectionText(); } }); } }); schedule(reloadJob); }

Target:
private void reload(final Repository repository) { final boolean repositoryChanged = currentRepository != repository; final AtomicReference<IndexDiff> results = new AtomicReference<IndexDiff>(); final String jobTitle = MessageFormat.format(UIText.StagingView_IndexDiffReload, StagingView.getRepositoryName(repository)); if (reloadJob != null) reloadJob.cancel(); reloadJob = new Job(jobTitle) { @Override protected IStatus run(IProgressMonitor monitor) { IndexDiff indexDiff = doReload(repository, monitor, jobTitle); results.set(indexDiff); if (monitor.isCanceled()) return Status.CANCEL_STATUS; return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { if (family.equals(JobFamilies.STAGING_VIEW_REFRESH)) return true; return super.belongsTo(family); } }; reloadJob.setUser(false); reloadJob.setRule(ResourcesPlugin.getWorkspace().getRoot()); reloadJob.addJobChangeListener(new JobChangeAdapter() { public void done(final IJobChangeEvent event) { asyncExec(new Runnable() { public void run() { if (form.isDisposed()) return; if (!event.getResult().isOK()) return; final IndexDiff indexDiff = results.get(); final StagingViewUpdate update = new StagingViewUpdate(currentRepository, indexDiff, null); unstagedTableViewer.setInput(update); stagedTableViewer.setInput(update); enableCommitWidgets(true); commitAction.setEnabled(repository.getRepositoryState() .canCommit()); form.setText(StagingView.getRepositoryName(repository)); updateCommitMessageComponent(repositoryChanged); updateSectionText(); } }); } }); schedule(reloadJob); }
Source:
public CompletableFuture<Object> invokeAsync(ComponentRegistry componentRegistry) throws Throwable { if (command instanceof VisitableCommand) { VisitableCommand vc = (VisitableCommand) command; vc.init(componentRegistry); InvocationContextFactory icf = componentRegistry.getInvocationContextFactory().running(); InvocationContext ctx = icf.createRemoteInvocationContextForCommand(vc, getOrigin()); if (command instanceof RemoteLockCommand) { ctx.setLockOwner(((RemoteLockCommand) command).getKeyLockOwner()); } if (trace) log.tracef("Invoking command %s, with originLocal flag set to %b", command, ctx .isOriginLocal()); return componentRegistry.getInterceptorChain().running().invokeAsync(ctx, vc); } else { throw new RuntimeException( "Do we still need to deal with non-visitable commands? (" + command.getClass().getName() + ")"); } }

Target:
public CompletionStage<?> invokeAsync(ComponentRegistry componentRegistry) throws Throwable { command.init(componentRegistry); InvocationContextFactory icf = componentRegistry.getInvocationContextFactory().running(); InvocationContext ctx = icf.createRemoteInvocationContextForCommand(command, getOrigin()); if (command instanceof RemoteLockCommand) { ctx.setLockOwner(((RemoteLockCommand) command).getKeyLockOwner()); } if (trace) log.tracef("Invoking command %s, with originLocal flag set to %b", command, ctx .isOriginLocal()); return componentRegistry.getInterceptorChain().running().invokeAsync(ctx, command); }
Source:
protected boolean swapAndClearCache(String namespaceKey, String cacheKey) { final Lock lock = nsLocks.get(namespaceKey); lock.lock(); try { ConcurrentMap<String, String> cacheMap = mapMap.get(cacheKey); if (cacheMap == null) { throw new IAE("Namespace [%s] does not exist", cacheKey); } dataSize.addAndGet(cacheMap.size()); ConcurrentMap<String, String> prior = mapMap.put(namespaceKey, cacheMap); mapMap.remove(cacheKey); if (prior != null) { dataSize.addAndGet(-prior.size()); return true; } else { return false; } } finally { lock.unlock(); } }

Target:
protected boolean swapAndClearCache(String namespaceKey, String cacheKey) { final Lock lock = nsLocks.get(namespaceKey); lock.lock(); try { ConcurrentMap<String, String> cacheMap = mapMap.get(cacheKey); if (cacheMap == null) { throw new IAE("Extraction Cache [%s] does not exist", cacheKey); } dataSize.addAndGet(cacheMap.size()); ConcurrentMap<String, String> prior = mapMap.put(namespaceKey, cacheMap); mapMap.remove(cacheKey); if (prior != null) { dataSize.addAndGet(-prior.size()); return true; } else { return false; } } finally { lock.unlock(); } }
Source:
V mergeInternal(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, Metadata metadata, long flags, ContextBuilder contextBuilder) { assertKeyNotNull(key); assertValueNotNull(value); assertFunctionNotNull(remappingFunction); DataConversion keyDataConversion = getKeyDataConversion(); DataConversion valueDataConversion = getValueDataConversion(); if (remappingFunction instanceof BiFunctionMapper) { BiFunctionMapper biFunctionMapper = (BiFunctionMapper) remappingFunction; keyDataConversion = biFunctionMapper.getKeyDataConversion(); valueDataConversion = biFunctionMapper.getValueDataConversion(); } ReadWriteKeyCommand<K, V, V> command = commandsFactory.buildReadWriteKeyCommand(key, new MergeFunction<>(value, remappingFunction, metadata), keyPartitioner.getSegment(key), Params.fromFlagsBitSet(flags), keyDataConversion, valueDataConversion); return invocationHelper.invoke(contextBuilder, command, 1); }

Target:
V mergeInternal(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, Metadata metadata, long flags, ContextBuilder contextBuilder) { assertKeyNotNull(key); assertValueNotNull(value); assertFunctionNotNull(remappingFunction); DataConversion keyDataConversion; DataConversion valueDataConversion; if (remappingFunction instanceof BiFunctionMapper) { BiFunctionMapper biFunctionMapper = (BiFunctionMapper) remappingFunction; keyDataConversion = biFunctionMapper.getKeyDataConversion(); valueDataConversion = biFunctionMapper.getValueDataConversion(); } else { keyDataConversion = getKeyDataConversion(); valueDataConversion = getValueDataConversion(); } ReadWriteKeyCommand<K, V, V> command = commandsFactory.buildReadWriteKeyCommand(key, new MergeFunction<>(value, remappingFunction, metadata), keyPartitioner.getSegment(key), Params.fromFlagsBitSet(flags), keyDataConversion, valueDataConversion); return invocationHelper.invoke(contextBuilder, command, 1); }
Source:
public AuditLogType getAuditLogTypeValue() { if (ACTIVE.equals(getCommandStatus()) && getSucceeded()){ return outOfSyncHostsExist() ? CLUSTER_SYNC_ALL_NETWORKS_STARTED : CLUSTER_SYNC_NOTHING_TO_DO; } else if (ENDED_SUCCESSFULLY.equals(getCommandStatus())) { return CLUSTER_SYNC_ALL_NETWORKS_FINISHED; } return CLUSTER_SYNC_ALL_NETWORKS_FAILED; }

Target:
public AuditLogType getAuditLogTypeValue() { if (EXECUTE.equals(getActionState()) && getSucceeded()){ return outOfSyncHostsExist() ? CLUSTER_SYNC_ALL_NETWORKS_STARTED : CLUSTER_SYNC_NOTHING_TO_DO; } else if (EXECUTE.equals(getActionState()) && !getSucceeded()) { return CLUSTER_SYNC_ALL_NETWORKS_START_ERROR; } else if (END_SUCCESS.equals(getActionState())) { return CLUSTER_SYNC_ALL_NETWORKS_FINISHED; } return CLUSTER_SYNC_ALL_NETWORKS_FAILED; }
Source:
public void testFunctionOr() throws Exception { ecqlReparseTest("PropertyExists('name') = true OR PropertyExists('name') = false"); }

Target:
public void testFunctionOr() throws Exception { ecqlReparseTest("PropertyExists('name') = true OR PropertyExists('name') = false"); ecqlReparseTest("PropertyExists('name') IN (true, false)"); }
Source:
private synchronized void registerMetricWithFqn(String fullyQualifiedMetricName, Metric metric) { try { if (!globalMetricsRegistry.contains(fullyQualifiedMetricName)) { metricRegistry.register(fullyQualifiedMetricName, metric); globalMetricsRegistry.add(fullyQualifiedMetricName); } registeredMetrics.add(fullyQualifiedMetricName); } catch (Exception e) { log.error("Unable to register metric {}", fullyQualifiedMetricName, e); } }

Target:
private synchronized void registerMetricWithFqn(String fullyQualifiedMetricName, Metric metric) { try { if (!metricRegistry.getNames().contains(fullyQualifiedMetricName)) { metricRegistry.register(fullyQualifiedMetricName, metric); } registeredMetrics.add(fullyQualifiedMetricName); } catch (Exception e) { log.error("Unable to register metric {}", fullyQualifiedMetricName, e); } }
Source:
public Application launchAppYaml(String url, boolean waitForTasksToComplete) { try { Application app = createFromUrl(url); EntityManagementUtils.start(app); log.info("Application started from YAML file "+url+": "+app); return app; } catch (Exception e) { throw Exceptions.propagate(e); } }

Target:
public Application launchAppYaml(String url, boolean waitForTasksToComplete) { try { Reader input = Streams.reader(new ResourceUtils(this).getResourceFromUrl(url)); Application app = launchAppYaml(input, waitForTasksToComplete); log.info("Application started from YAML file "+url+": "+app); return app; } catch (Exception e) { throw Exceptions.propagate(e); } }
Source:
private void collectIdColumns(String prefix, EntityType<?> ownerType, EntityType<?> currentType, Map<String, AttributeEntry<?, ?>> attributeMap, Attribute<?, ?> attribute, Class<?> fieldType) { List<String> identifierOrUniqueKeyEmbeddedPropertyNames = jpaProvider.getIdentifierOrUniqueKeyEmbeddedPropertyNames(currentType, attribute.getName()); for (String name : identifierOrUniqueKeyEmbeddedPropertyNames) { EntityType<?> fieldEntityType = delegate.entity(fieldType); Attribute<?, ?> idAttribute = JpaMetamodelUtils.getAttribute(fieldEntityType, name); try { Class<?> idType = JpaMetamodelUtils.resolveFieldClass(fieldType, idAttribute); String idPath = prefix + "." + name; attributeMap.put(idPath, new AttributeEntry(jpaProvider, ownerType, idAttribute, idPath, idType, Arrays.asList(attribute, idAttribute))); if (isAssociation(idAttribute) && !idAttribute.isCollection() && !jpaProvider.isForeignJoinColumn(ownerType, idAttribute.getName())) { collectIdColumns(idPath, ownerType, fieldEntityType, attributeMap, idAttribute, idType); } } catch (NullPointerException e1) { throw e1; } } }

Target:
private void collectIdColumns(String prefix, EntityType<?> ownerType, EntityType<?> currentType, Map<String, AttributeEntry<?, ?>> attributeMap, Attribute<?, ?> attribute, Class<?> fieldType) { List<String> identifierOrUniqueKeyEmbeddedPropertyNames = jpaProvider.getIdentifierOrUniqueKeyEmbeddedPropertyNames(currentType, attribute.getName()); for (String name : identifierOrUniqueKeyEmbeddedPropertyNames) { EntityType<?> fieldEntityType = delegate.entity(fieldType); Attribute<?, ?> idAttribute = JpaMetamodelUtils.getAttribute(fieldEntityType, name); Class<?> idType = JpaMetamodelUtils.resolveFieldClass(fieldType, idAttribute); String idPath = prefix + "." + name; attributeMap.put(idPath, new AttributeEntry(jpaProvider, ownerType, idAttribute, idPath, idType, Arrays.asList(attribute, idAttribute))); if (isAssociation(idAttribute) && !idAttribute.isCollection() && !jpaProvider.isForeignJoinColumn(ownerType, idAttribute.getName())) { collectIdColumns(idPath, ownerType, fieldEntityType, attributeMap, idAttribute, idType); } } }
Source:
private JobIdData submit(String sessionId, InputStream job, MediaType mediaType, Map<String, String> variables, Map<String, String> genericInfos) throws NotConnectedRestException { String uriTmpl = restEndpointURL + addSlashIfMissing(restEndpointURL) + "scheduler/submit"; ResteasyClient client = new ResteasyClientBuilder().httpEngine(httpEngine) .providerFactory(providerFactory) .build(); ResteasyWebTarget target = client.target(uriTmpl); if (variables != null) { for (String key : variables.keySet()) { target = target.matrixParam(key, variables.get(key)); } } if (genericInfos != null) { for (String key : genericInfos.keySet()) { target = target.queryParam(key, genericInfos.get(key)); } } MultipartFormDataOutput formData = new MultipartFormDataOutput(); formData.addFormData("file", job, mediaType); GenericEntity<MultipartFormDataOutput> entity = new GenericEntity<MultipartFormDataOutput>(formData) { }; Response response = target.request() .header("sessionid", sessionId) .post(Entity.entity(entity, MediaType.MULTIPART_FORM_DATA_TYPE)); if (response.getStatus() != HttpURLConnection.HTTP_OK) { if (response.getStatus() == HttpURLConnection.HTTP_UNAUTHORIZED) { throw new NotConnectedRestException("User not authenticated or session timeout."); } else { throwException(String.format("Job submission failed status code: %d", response.getStatus()), response); } } return response.readEntity(JobIdData.class); }

Target:
private JobIdData submit(String sessionId, InputStream job, MediaType mediaType, Map<String, String> variables, Map<String, String> genericInfos) throws NotConnectedRestException { String uriTmpl = restEndpointURL + addSlashIfMissing(restEndpointURL) + "scheduler/submit"; ResteasyClient client = new ResteasyClientBuilder().httpEngine(httpEngine) .providerFactory(providerFactory) .build(); ResteasyWebTarget target = client.target(uriTmpl); if (variables != null) { for (String key : variables.keySet()) { target = target.matrixParam(key, variables.get(key)); } } if (genericInfos != null) { for (String key : genericInfos.keySet()) { target = target.queryParamNoTemplate(key, genericInfos.get(key)); } } MultipartFormDataOutput formData = new MultipartFormDataOutput(); formData.addFormData("file", job, mediaType); GenericEntity<MultipartFormDataOutput> entity = new GenericEntity<MultipartFormDataOutput>(formData) { }; Response response = target.request() .header("sessionid", sessionId) .post(Entity.entity(entity, MediaType.MULTIPART_FORM_DATA_TYPE)); if (response.getStatus() != HttpURLConnection.HTTP_OK) { if (response.getStatus() == HttpURLConnection.HTTP_UNAUTHORIZED) { throw new NotConnectedRestException("User not authenticated or session timeout."); } else { throwException(String.format("Job submission failed status code: %d", response.getStatus()), response); } } return response.readEntity(JobIdData.class); }
Source:
public DropwizardSSLConnectionSocketFactory(TlsConfiguration configuration) { this.configuration = configuration; this.verifier = null; }

Target:
public DropwizardSSLConnectionSocketFactory(TlsConfiguration configuration) { this(configuration, null); }
Source:
public void consistencyCheckerLogUseSystemTimezoneIfConfigurable() throws Exception { TimeZone defaultTimeZone = TimeZone.getDefault(); try { ConsistencyCheckService service = mock( ConsistencyCheckService.class ); Mockito.when( service.runFullConsistencyCheck( any( File.class ), any( Config.class ), any( ProgressMonitorFactory.class ), any( LogProvider.class ), any( FileSystemAbstraction.class ), eq( false ), any( CheckConsistencyConfig.class ) ) ) .then( (Answer<ConsistencyCheckService.Result>) invocationOnMock -> { LogProvider provider = invocationOnMock.getArgumentAt( 3, LogProvider.class ); provider.getLog( "test" ).info( "testMessage" ); return ConsistencyCheckService.Result.success( new File( StringUtils.EMPTY ) ); } ); File storeDir = storeDirectory.directory(); File configFile = storeDirectory.file( Config.DEFAULT_CONFIG_FILE_NAME ); Properties properties = new Properties(); properties.setProperty( GraphDatabaseSettings.log_timezone.name(), LogTimeZone.SYSTEM.name() ); properties.store( new FileWriter( configFile ), null ); String[] args = {storeDir.getPath(), "-config", configFile.getPath()}; checkLogRecordTimeZone( service, args, 5, "+0500" ); checkLogRecordTimeZone( service, args, -5, "-0500" ); } finally { TimeZone.setDefault( defaultTimeZone ); } }

Target:
public void consistencyCheckerLogUseSystemTimezoneIfConfigurable() throws Exception { TimeZone defaultTimeZone = TimeZone.getDefault(); try { ConsistencyCheckService service = mock( ConsistencyCheckService.class ); Mockito.when( service.runFullConsistencyCheck( any( File.class ), any( Config.class ), any( ProgressMonitorFactory.class ), any( LogProvider.class ), any( FileSystemAbstraction.class ), eq( false ), any( CheckConsistencyConfig.class ) ) ) .then( invocationOnMock -> { LogProvider provider = invocationOnMock.getArgumentAt( 3, LogProvider.class ); provider.getLog( "test" ).info( "testMessage" ); return ConsistencyCheckService.Result.success( new File( StringUtils.EMPTY ) ); } ); File storeDir = storeDirectory.directory(); File configFile = storeDirectory.file( Config.DEFAULT_CONFIG_FILE_NAME ); Properties properties = new Properties(); properties.setProperty( GraphDatabaseSettings.log_timezone.name(), LogTimeZone.SYSTEM.name() ); properties.store( new FileWriter( configFile ), null ); String[] args = {storeDir.getPath(), "-config", configFile.getPath()}; checkLogRecordTimeZone( service, args, 5, "+0500" ); checkLogRecordTimeZone( service, args, -5, "-0500" ); } finally { TimeZone.setDefault( defaultTimeZone ); } }
Source:
public Value atomize() { if (value == null) { Object data = attribute.getValue(); if (data instanceof List) { final List<?> dataList = (List<?>) data; final Item[] converted = new Item[dataList.size()]; for (int i = 0; i < dataList.size(); i++) { converted[i] = SaxonXPathRuleQuery.getAtomicRepresentation(dataList.get(i)); } value = new SequenceExtent(converted); } else { value = SaxonXPathRuleQuery.getAtomicRepresentation(attribute.getValue()); } } return value; }

Target:
public Value atomize() { if (value == null) { Object data = attribute.getValue(); if (data instanceof List) { value = SaxonXPathRuleQuery.getSequenceRepresentation((List<?>) data); } else { value = SaxonXPathRuleQuery.getAtomicRepresentation(attribute.getValue()); } } return value; }
Source:
public Operation getBatchOperation() { CompositeOperation compositeOperation = new CompositeOperation(); if (hasDiscoveryGroupName()) { compositeOperation.addStep(new UndefineAttribute(address, CONNECTOR_ATTRIBUTE)); compositeOperation.addStep(new WriteAttribute(address, DISCOVERY_GROUP_NAME, configuration .getSimpleValue(DISCOVERY_GROUP_NAME))); } else { compositeOperation.addStep(new UndefineAttribute(address, DISCOVERY_GROUP_NAME)); List<Property> propertyList = configuration.getList(CONNECTOR_PROPERTY).getList(); List<String> connectors = new ArrayList<String>(propertyList.size()); for (Property property : propertyList) { if (property instanceof PropertySimple) { PropertySimple propertySimple = (PropertySimple) property; connectors.add(propertySimple.getStringValue()); } else { getLog().warn(property.getName() + " property has unexpected type: " + property.getClass()); } } compositeOperation.addStep(new WriteAttribute(address, CONNECTOR_PROPERTY, connectors)); } return compositeOperation; }

Target:
public Operation getBatchOperation() { CompositeOperation compositeOperation = new CompositeOperation(); if (hasDiscoveryGroupName()) { compositeOperation.addStep(new UndefineAttribute(address, CONNECTOR_ATTRIBUTE)); compositeOperation.addStep(new WriteAttribute(address, DISCOVERY_GROUP_NAME, configuration .getSimpleValue(DISCOVERY_GROUP_NAME))); } else { compositeOperation.addStep(new UndefineAttribute(address, DISCOVERY_GROUP_NAME)); List<Property> propertyList = configuration.getList(CONNECTOR_PROPERTY).getList(); List<String> connectors = new ArrayList<String>(propertyList.size()); for (Property property : propertyList) { if (property instanceof PropertySimple) { PropertySimple propertySimple = (PropertySimple) property; connectors.add(propertySimple.getStringValue()); } else { throw new IllegalArgumentException(property.getName() + " property has unexpected type: " + property.getClass()); } } compositeOperation.addStep(new WriteAttribute(address, CONNECTOR_PROPERTY, connectors)); } return compositeOperation; }